|
|
@@ -66,6 +66,8 @@ namespace Business.SystemJobManagement
|
|
|
|
|
|
private IRepository<srm_po_occupy, long> _mysql_srm_po_occupy;
|
|
|
|
|
|
+ private IRepository<ic_item_stock, long> _mysql_ic_item_stock;
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 雪花算法
|
|
|
/// </summary>
|
|
|
@@ -157,6 +159,7 @@ namespace Business.SystemJobManagement
|
|
|
IRepository<mes_tech_process, long> mysql_mes_tech_process,
|
|
|
ISqlRepository<CustMaster> custMaster,
|
|
|
ISqlRepository<SuppMaster> suppMaster,
|
|
|
+ IRepository<ic_item_stock, long> mysql_ic_item_stock,
|
|
|
ISqlRepository<ConsigneeAddressMaster> consigneeAddressMaster,
|
|
|
ISqlRepository<ItemMaster> itemMaster,
|
|
|
ISqlRepository<ProductStructureMaster> productStructureMaster,
|
|
|
@@ -213,6 +216,7 @@ namespace Business.SystemJobManagement
|
|
|
_srm_po_list = srm_po_list;
|
|
|
_nbrMaster = nbrMaster;
|
|
|
_nbrDetail = nbrDetail;
|
|
|
+ _mysql_ic_item_stock = mysql_ic_item_stock;
|
|
|
_mysql_srm_po_occupy = mysql_srm_po_occupy;
|
|
|
_ic_item_stockoccupy = ic_item_stockoccupy;
|
|
|
_ASNBOLShipperDetail = ASNBOLShipperDetail;
|
|
|
@@ -661,6 +665,9 @@ namespace Business.SystemJobManagement
|
|
|
List<ic_item_stock> stockAdd = new List<ic_item_stock>();
|
|
|
List<ic_item> ItemsUpd = new List<ic_item>();
|
|
|
List<srm_purchase> srm_purchaseAdd = new List<srm_purchase>();
|
|
|
+
|
|
|
+ var icitemStokc = _mysql_ic_item_stock.GetListAsync().Result;
|
|
|
+
|
|
|
if (custList != null && custList.Count > 0)
|
|
|
{
|
|
|
for (int i = 0; i < custList.Count; i++)
|
|
|
@@ -696,6 +703,7 @@ namespace Business.SystemJobManagement
|
|
|
erpclsText = "外购";
|
|
|
}
|
|
|
}
|
|
|
+ var upditemStock = icitemStokc.Find(x => x.icitem_number == ic_item.number);
|
|
|
if (ic_item == null)
|
|
|
{
|
|
|
ItemsAdd.Add(new ic_item(itemId)
|
|
|
@@ -751,7 +759,7 @@ namespace Business.SystemJobManagement
|
|
|
Shipping_date = 3,
|
|
|
PurLT = custList[i].PurLT
|
|
|
});;
|
|
|
- ic_item_stock addStock = new ic_item_stock();
|
|
|
+ /*ic_item_stock addStock = new ic_item_stock();
|
|
|
addStock.GenerateNewId(help.NextId());
|
|
|
addStock.icitem_id = itemId;
|
|
|
addStock.icitem_number = custList[i].ItemNum; //物料编码
|
|
|
@@ -766,7 +774,7 @@ namespace Business.SystemJobManagement
|
|
|
addStock.update_time = DateTime.Now;
|
|
|
addStock.create_by_name = "admin";
|
|
|
addStock.update_by_name = "admin";
|
|
|
- stockAdd.Add(addStock);
|
|
|
+ stockAdd.Add(addStock);*/
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -781,6 +789,25 @@ namespace Business.SystemJobManagement
|
|
|
ic_item.PurLT = custList[i].PurLT;
|
|
|
ItemsUpd.Add(ic_item);
|
|
|
}
|
|
|
+ if (upditemStock == null)
|
|
|
+ {
|
|
|
+ ic_item_stock addStock = new ic_item_stock();
|
|
|
+ addStock.GenerateNewId(help.NextId());
|
|
|
+ addStock.icitem_id = ic_item.Id;
|
|
|
+ addStock.icitem_number = ic_item.number; //物料编码
|
|
|
+ addStock.icitem_name = ic_item.name; //物料名称
|
|
|
+ addStock.sqty = 0;
|
|
|
+ addStock.quantity_in_transit = 0;
|
|
|
+ addStock.fversion = ic_item.fversion;
|
|
|
+ addStock.factory_id = long.Parse(custList[i].Domain);
|
|
|
+ addStock.company_id = 1000;
|
|
|
+ addStock.tenant_id = 1000;
|
|
|
+ addStock.create_time = DateTime.Now;
|
|
|
+ addStock.update_time = DateTime.Now;
|
|
|
+ addStock.create_by_name = "admin";
|
|
|
+ addStock.update_by_name = "admin";
|
|
|
+ stockAdd.Add(addStock);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
_businessDbContext.BulkInsert(ItemsAdd);
|