|
|
@@ -1041,19 +1041,16 @@ namespace Business.ResourceExamineManagement
|
|
|
SRMPRDto sRMPR = new SRMPRDto();
|
|
|
mo_srm_pr_main srm_Pr = new mo_srm_pr_main();
|
|
|
var leadTime = iCItemLeadTimes.Find(x => x.item_id == returnlist.item_id);
|
|
|
- var supplier = supplierList.Where(x => x.icitem_id == returnlist.item_id);//默认取第一个供应商
|
|
|
+ var supplier = supplierList.Where(x => x.icitem_id == returnlist.item_id).ToList();//默认取第一个供应商
|
|
|
var plan = planList.Find(x => x.icitem_id == returnlist.item_id);
|
|
|
- if (leadTime == null || supplier == null || plan == null)
|
|
|
+ sRMPR.srm_Pr_Main = new List<mo_srm_pr_main>();
|
|
|
+ if (leadTime == null || !supplier.Any() || plan == null)
|
|
|
{
|
|
|
- sRMPR.srm_Pr_Main = null;
|
|
|
sRMPR.lastStartTmie = deliveryDate.AddDays(7 * -1);//减去提前期
|
|
|
return sRMPR;
|
|
|
//throw new NotImplementedException("未找到物料ic_factory_details或ic_item_pur或ic_plan信息!");
|
|
|
}
|
|
|
|
|
|
- decimal bestLead = decimal.MaxValue;
|
|
|
- decimal bestPrice=decimal.MaxValue;
|
|
|
- long bestid = 0;
|
|
|
supplier.ForEach(x =>
|
|
|
{
|
|
|
//提前期随机数,金额随机数
|
|
|
@@ -1104,7 +1101,10 @@ namespace Business.ResourceExamineManagement
|
|
|
srm_Pr.totalLeadTime= totalLeadTime;
|
|
|
sRMPR.srm_Pr_Main.Add(srm_Pr);
|
|
|
});
|
|
|
- sRMPR.srm_Pr_Main.OrderBy(x=>x.totalLeadTime).ThenBy(x=>x.pr_orderprice).First().isbestoptions= true;
|
|
|
+ if (sRMPR.srm_Pr_Main.Any())
|
|
|
+ {
|
|
|
+ sRMPR.srm_Pr_Main.OrderBy(x => x.totalLeadTime.GetValueOrDefault()).ThenBy(x => x.pr_orderprice.GetValueOrDefault()).First().isbestoptions = true;
|
|
|
+ }
|
|
|
sRMPR.item_no = returnlist.num;
|
|
|
sRMPR.orderentry_id = returnlist.sentry_id;
|
|
|
sRMPR.lastStartTmie = deliveryDate.AddDays((double)sRMPR.srm_Pr_Main.MinBy(x=>x.totalLeadTime).totalLeadTime * -1);//减去提前期
|