|
|
@@ -73,7 +73,7 @@ namespace Business.ResourceExamineManagement
|
|
|
private readonly IRepository<mo_ic_item,long> _ic_item;
|
|
|
private IRepository<ic_item, long> _mysql_ic_item;
|
|
|
|
|
|
- private IRepository<ic_demandschedule, long> __mysql_ic_demandschedule;
|
|
|
+ private IRepository<ic_demandschedule, long> _mysql_ic_demandschedule;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 物料BOM
|
|
|
@@ -525,7 +525,7 @@ namespace Business.ResourceExamineManagement
|
|
|
_ic_item_stockoccupy = ic_item_stockoccupy;
|
|
|
_srm_supplier = srm_supplier;
|
|
|
_mysql_ic_item = mysql_ic_item;
|
|
|
- __mysql_ic_demandschedule= mysql_ic_demandschedule;
|
|
|
+ _mysql_ic_demandschedule= mysql_ic_demandschedule;
|
|
|
_mysql_ic_bom = mysql_ic_bom;
|
|
|
_mysql_ic_bom_child = mysql_ic_bom_child;
|
|
|
_mysql_crm_seorder = mysql_crm_seorder;
|
|
|
@@ -5660,11 +5660,18 @@ namespace Business.ResourceExamineManagement
|
|
|
}).ToList();
|
|
|
//需要测试工单没有做资源检查会不会报错
|
|
|
var examineIds = workExamineResult.Select(s => s.examineId).ToList();
|
|
|
- var examines=_mysql_bom_child_examine.GetListAsync(a => examineIds.Contains(a.examine_id.Value) && a.erp_cls==3 && a.lack_qty>0 && a.factory_id.ToString() == domain).Result;
|
|
|
+ var examines=_mysql_bom_child_examine.GetListAsync(a => examineIds.Contains(a.examine_id.Value) && a.erp_cls==3 && a.factory_id.ToString() == domain).Result;
|
|
|
var pickBills = _nbrDetail.Select(a => workordList.Contains(a.WorkOrd) && a.Type.ToUpper()=="SM" && a.Domain == domain);
|
|
|
var dsList=_srm_polist_ds.Select(a => a.requestdate <= endTime && a.domain==domain);
|
|
|
var itemList = _itemMaster.Select(a => examines.Select(e=>e.item_number).Distinct().ToList().Contains(a.ItemNum) && a.Domain == domain);
|
|
|
- var itemListStock = _SAPInv.Select(a => examines.Select(e => e.item_number).Distinct().ToList().Contains(a.MATNR) && (a.LGORT=="1000" || a.LGORT == "1001" || a.LGORT == "5007" || a.LGORT == "5008") && a.WERKS == domain);
|
|
|
+ var locationRange = _configurationItem.Select(x => x.FldName == "MRPLocationRange" && x.Domain == domain).FirstOrDefault();
|
|
|
+
|
|
|
+ List<string> locationList = new List<string> { "1000", "1001", "5007", "5008"};
|
|
|
+ if (locationRange != null && locationRange.Val != null)
|
|
|
+ {
|
|
|
+ locationList = locationRange.Val.SplitToArray(",").ToList();
|
|
|
+ }
|
|
|
+ var itemListStock = _SAPInv.Select(a => examines.Select(e => e.item_number).Distinct().ToList().Contains(a.MATNR) && locationList.Contains(a.LGORT) && a.WERKS == domain);
|
|
|
List<ic_demandschedule> ds = new List<ic_demandschedule>();
|
|
|
for(int i=0;i<4;i++)
|
|
|
{
|
|
|
@@ -5713,7 +5720,7 @@ namespace Business.ResourceExamineManagement
|
|
|
itemds.mesqty =d.NeedQty- pickBills.Where(a=> workItem.Select(s=>s.WorkOrd).Contains(a.WorkOrd) && a.ItemNum== d.ItemNum).Sum(q=>q.QtyRec);
|
|
|
itemds.locqty = itemListStock.Where(a=>a.MATNR==d.ItemNum).Sum(a=>a.LABST+a.INSME);
|
|
|
//累计在途数量
|
|
|
- itemds.sechedqty = dsList.Where(a => a.requestdate<itemds.arrivaldate).Sum(a=>a.schedqty-a.sentqty);
|
|
|
+ itemds.sechedqty = dsList.Where(a => a.requestdate<itemds.arrivaldate && a.itemnum==d.ItemNum).Sum(a=>a.schedqty-a.sentqty);
|
|
|
itemds.tosechedqty = itemds.locqty+itemds.sechedqty-itemds.mesqty;
|
|
|
itemds.status = "";
|
|
|
itemds.remarks = "";
|
|
|
@@ -5727,6 +5734,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ await _mysql_ic_demandschedule.DeleteAsync(a => a.status != "P");
|
|
|
await _businessDbContext.BulkInsertAsync(ds);
|
|
|
return "ok";
|
|
|
}
|