|
|
@@ -780,7 +780,7 @@ namespace Business.SystemJobManagement
|
|
|
}
|
|
|
_businessDbContext.BulkInsert(ItemsAdd);
|
|
|
_businessDbContext.BulkInsert(stockAdd);
|
|
|
- _businessDbContext.BulkUpdate(ItemsUpd);
|
|
|
+ _businessDbContext.ic_item.UpdateRange(ItemsUpd);
|
|
|
}
|
|
|
|
|
|
public void SyncBom()
|
|
|
@@ -789,9 +789,12 @@ namespace Business.SystemJobManagement
|
|
|
var ic_itemList = _mysql_ic_item.GetListAsync().Result;
|
|
|
var ic_bomchildList = _mysql_ic_bom_child.GetListAsync().Result;
|
|
|
List<ProductStructureMaster> wmsBomList = _productStructureMaster.Select(a => a.IsActive);
|
|
|
+ List<ItemMaster> custList = new List<ItemMaster>();
|
|
|
+ custList = _itemMaster.Select(a => a.IsActive);
|
|
|
List<ic_bom> ItemsAdd = new List<ic_bom>();
|
|
|
List<ic_bom_child> childItemsAdd = new List<ic_bom_child>();
|
|
|
List<ic_bom_child> childItemsUpd = new List<ic_bom_child>();
|
|
|
+ List<ic_bom_child> childItemsDel = new List<ic_bom_child>();
|
|
|
if (wmsBomList != null && wmsBomList.Count > 0)
|
|
|
{
|
|
|
var ItemMasterDS = wmsBomList.Select(a => a.ParentItem).Distinct().ToList();
|
|
|
@@ -827,6 +830,8 @@ namespace Business.SystemJobManagement
|
|
|
{
|
|
|
var itemchild = ic_itemList.Find(a => a.number == child.ComponentItem);
|
|
|
if (itemchild == null) { continue; }
|
|
|
+ var itemMaster = custList.Find(a => a.ItemNum == child.ComponentItem);
|
|
|
+ if (itemMaster == null || itemMaster.MRPRequired==0) { continue; }
|
|
|
decimal scrap = child.QtyExchd > child.Scrap ? child.QtyExchd : child.Scrap;
|
|
|
/*//如果当前明细是BOM,则使用组件报废率
|
|
|
if (wmsBomList.Where(c => c.ParentItem == child.ComponentItem).Any())
|
|
|
@@ -865,7 +870,9 @@ namespace Business.SystemJobManagement
|
|
|
foreach (var child in ItemList)
|
|
|
{
|
|
|
var itemchild = ic_itemList.Find(a => a.number == child.ComponentItem);
|
|
|
- if (itemchild == null) { continue; }
|
|
|
+ var itemMaster = custList.Find(a => a.ItemNum == child.ComponentItem);
|
|
|
+
|
|
|
+ bool flag = itemchild == null || itemMaster == null || itemMaster.MRPRequired == 0;
|
|
|
var icbomchild = ic_bomchildList.Find(s => s.bom_number == c && s.item_number == child.ComponentItem);
|
|
|
decimal scrap = child.QtyExchd > child.Scrap ? child.QtyExchd : child.Scrap;
|
|
|
/*//如果当前明细是BOM,则使用组件报废率
|
|
|
@@ -875,6 +882,7 @@ namespace Business.SystemJobManagement
|
|
|
}*/
|
|
|
if (icbomchild == null)
|
|
|
{
|
|
|
+ if (flag) { continue; }
|
|
|
var bomchild = new ic_bom_child(help.NextId())
|
|
|
{
|
|
|
bom_id = icbom.Id,
|
|
|
@@ -903,6 +911,7 @@ namespace Business.SystemJobManagement
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ if (flag) { childItemsDel.Add(icbomchild); }
|
|
|
icbomchild.qty = child.Qty;
|
|
|
icbomchild.erp_cls = itemchild == null ? 2 : itemchild.erp_cls;
|
|
|
icbomchild.begin_day = child.StartEff;
|
|
|
@@ -923,7 +932,8 @@ namespace Business.SystemJobManagement
|
|
|
}
|
|
|
_businessDbContext.BulkInsert(ItemsAdd);
|
|
|
_businessDbContext.BulkInsert(childItemsAdd);
|
|
|
- _businessDbContext.BulkUpdate(childItemsUpd);
|
|
|
+ _businessDbContext.ic_bom_child.UpdateRange(childItemsUpd);
|
|
|
+ _mysql_ic_bom_child.HardDeleteAsync(childItemsDel);
|
|
|
}
|
|
|
}
|
|
|
|