|
|
@@ -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;
|
|
|
@@ -1323,6 +1323,8 @@ namespace Business.ResourceExamineManagement
|
|
|
new NLogHelper("ResourceExamineAppService").WriteLog("PrAutoMerge", "采购申请单自动合并更新失败:" + e.Message, _currentTenant.Id.ToString());
|
|
|
};
|
|
|
}
|
|
|
+ //暂时固定传8010后面有时间再改
|
|
|
+ await CreateDemandSchedule("8010");
|
|
|
return "ok";
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
@@ -4074,7 +4076,7 @@ namespace Business.ResourceExamineManagement
|
|
|
string LocationFrom = "";
|
|
|
if (find != null)
|
|
|
{
|
|
|
- LocationFrom = find.Location;
|
|
|
+ //LocationFrom = find.Location;
|
|
|
//找出职责范围负责人
|
|
|
var ewdm = ewdmList.Find(s => 0 >= string.Compare(s.ItemNum1, a.ItemNum) && 0 >= string.Compare(a.ItemNum, s.ItemNum2));
|
|
|
if (ewdm != null && !string.IsNullOrEmpty(ewdm.Employee))
|
|
|
@@ -4093,7 +4095,7 @@ namespace Business.ResourceExamineManagement
|
|
|
ItemNum = a.ItemNum,
|
|
|
QtyFrom = 0,
|
|
|
QtyTo = 0,
|
|
|
- LocationFrom = LocationFrom,
|
|
|
+ LocationFrom = string.IsNullOrEmpty(a.Location) == true ? find.Location : a.Location,
|
|
|
LocationTo = LocationTo,//现在这几条线是同一线边仓,暂时不考虑多个线边仓
|
|
|
WorkOrd = workord.WorkOrd,
|
|
|
QtyOrd = a.QtyRequired,
|
|
|
@@ -5056,7 +5058,8 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- await _businessDbContext.BulkUpdateAsync(list);
|
|
|
+ //await _businessDbContext.BulkUpdateAsync(list);
|
|
|
+ _businessDbContext.ic_bom_child.UpdateRange(list);
|
|
|
}
|
|
|
return "ok";
|
|
|
}
|
|
|
@@ -5089,8 +5092,16 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
await _businessDbContext.BulkDeleteAsync(refBomList);
|
|
|
}
|
|
|
- var boms = _ic_bom.GetListAsync(s => refList.Select(c => c.sourceid).Contains(s.Id)).Result;
|
|
|
- if (boms.Any()) {
|
|
|
+ var boms = _ic_bom.GetListAsync(s => refList.Select(c => c.sourceid).Contains(s.mysql_id)).Result;
|
|
|
+ if (boms.Any())
|
|
|
+ {
|
|
|
+ AutoCreateBomBill(dto.company_id.ToString(), boms);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var boms = _ic_bom.GetListAsync(s => s.mysql_id== dto.id).Result;
|
|
|
+ if (boms.Any())
|
|
|
+ {
|
|
|
AutoCreateBomBill(dto.company_id.ToString(), boms);
|
|
|
}
|
|
|
}
|
|
|
@@ -5649,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++)
|
|
|
{
|
|
|
@@ -5702,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 = "";
|
|
|
@@ -5716,6 +5734,7 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ await _mysql_ic_demandschedule.DeleteAsync(a => a.status != "P");
|
|
|
await _businessDbContext.BulkInsertAsync(ds);
|
|
|
return "ok";
|
|
|
}
|