using Business.Core.Utilities; using Business.EntityFrameworkCore; using Bussiness.Model.Ext; using Bussiness.Model.MES.IC; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Hosting; using NLog; using SixLabors.ImageSharp; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; namespace Business.Quartz { //处理Ext数据库表 public class ExtJobService: ApplicationService { SnowFlake help = new SnowFlake(); private IRepository _kd_material; private IRepository _ic_item; private IRepository _ic_itemTest; private IRepository _ic_item_ie; private IRepository _ic_item_ieTest; private IRepository _ic_item_inventory; private IRepository _ic_item_pur; private IRepository _ic_item_purTest; private IRepository _ic_item_stock; private IRepository _ic_plan; private IRepository _ic_planTest; private IRepository _ic_check; private IRepository _ic_factory_details; private IRepository _ic_factory_detailsTest; private IRepository _kd_bom; private IRepository _ic_bom; private IRepository _ic_bom_child; private IRepository _ic_substitute; private IRepository _ic_substitute_all; private IRepository _ic_substitute_all_dtl; private IRepository _ext_xref; private IRepository _ext_xrefTest; private readonly BusinessDbContext _businessDbContext; private readonly BusinessExtDbContext _businessExtDbContext; public ExtJobService( IRepository kd_material, IRepository ic_item, IRepository ic_itemTest, IRepository ic_item_ie, IRepository ic_item_ieTest, IRepository ic_item_inventory, IRepository ic_item_pur, IRepository ic_item_purTest, IRepository ic_item_stock, IRepository ic_plan, IRepository ic_planTest, IRepository ic_check, IRepository ic_factory_details, IRepository ic_factory_detailsTest, IRepository kd_bom, IRepository ic_bom, IRepository ic_bom_child, IRepository ic_substitute, IRepository ic_substitute_all, IRepository ic_substitute_all_dtl, IRepository ext_xref, IRepository ext_xrefTest, BusinessDbContext businessDbContext, BusinessExtDbContext businessExtDbContext ) { _kd_material= kd_material; _ic_item= ic_item; _ic_itemTest = ic_itemTest; _ic_item_ie = ic_item_ie; _ic_item_ieTest = ic_item_ieTest; _ic_item_inventory = ic_item_inventory; _ic_item_pur= ic_item_pur; _ic_item_purTest = ic_item_purTest; _ic_item_stock = ic_item_stock; _ic_plan= ic_plan; _ic_planTest = ic_planTest; _ic_check = ic_check; _ic_factory_details= ic_factory_details; _ic_factory_detailsTest = ic_factory_detailsTest; _kd_bom = kd_bom; _ic_bom= ic_bom; _ic_bom_child= ic_bom_child; _ic_substitute= ic_substitute; _ic_substitute_all= ic_substitute_all; _ic_substitute_all_dtl= ic_substitute_all_dtl; _ext_xref= ext_xref; _ext_xrefTest = ext_xrefTest; _businessDbContext = businessDbContext; _businessExtDbContext = businessExtDbContext; } /// /// 处理物料 /// public async void DoExt() { await DoMaterial(); //DoBom(); } /// /// 处理物料 /// public async Task DoMaterial() { var extMaterials=_kd_material.GetListAsync(); var ic_items = _ic_itemTest.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); var ic_factory_detailss = _ic_factory_detailsTest.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); var ic_item_ies = _ic_item_ieTest.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); var ic_item_purs = _ic_item_purTest.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); var ic_plans = _ic_planTest.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); List ic_itemListAdd = new List(); List ic_itemListUpdate = new List(); List ic_factory_detailsListAdd = new List(); List ic_factory_detailsListUpdate = new List(); List ic_item_ieListAdd = new List(); List ic_item_ieListUpdate = new List(); List ic_item_purListAdd = new List(); List ic_item_purListUpdate = new List(); List ic_planListAdd = new List(); List ic_planListUpdate = new List(); List ext_xrefList = new List(); if (extMaterials != null) { extMaterials.Result.ForEach(ext => { if (ic_items != null && ic_items.Result.Exists(a => a.number == ext.FNumber)) { var ic_item = ic_items.Result.FirstOrDefault(a => a.number == ext.FNumber); if (ic_item != null) { ic_item.number = ext.FNumber; ic_item.name = ext.FName_2052; ic_item.model = ext.FSpecification_2052; ic_item.full_name = ext.FDescription_2052; ic_item.fms_number = ext.FOldNumber; //0.配置类 1. 2.委外加工 3.外购 4.虚拟件 ic_item.erp_cls = ext.FErpClsID == "配置类" ? 0 : ext.FErpClsID == "自制" ? 1 : ext.FErpClsID == "委外" ? 2 : ext.FErpClsID == "外购" ? 3 : ext.FErpClsID == "虚拟" ? 4 : ext.FErpClsID == "费用" ? 5 : ext.FErpClsID == "服务" ? 6 : -1; ic_item.source = ext.FDataSource; ic_item.iskeyitem = ext.FIsKitting == "是" ? 1 : 0; ic_item.gross_weight = ext.FGROSSWEIGHT; ic_item.net_weight = ext.FNETWEIGHT; ic_item.maund = ext.FWEIGHTUNITID_Name; ic_item.cubic_measure = ext.FVOLUMEUNITID_Name; ic_item.length = ext.FLENGTH; ic_item.width = ext.FWIDTH; ic_item.height = ext.FHEIGHT; ic_item.size = ext.FVOLUME; ic_item.allowpur = ext.FIsPurchase == "是" ? 1 : 0; ic_item.allowsale = ext.FIsSale == "是" ? 1 : 0; ic_item.allowmanu = ext.FIsProduce == "是" ? 1 : 0; ic_item.allowout = ext.FIsSubContract == "是" ? 1 : 0; ic_item.allowbatch = ext.F_SFJLPCH == "是" ? 1 : 0; ic_itemListUpdate.Add(ic_item); ext_xrefList.Add(new ext_xrefTest { dop_table_name = "ic_item", dop_id = ic_item.Id, dop_col1_name = "number", dop_col1_value = ic_item.number, other_sys_name = "kd", other_table_name = "in_kd_material", other_id = ext.Id, other_col1_name = "FNumber", other_col1_value = ext.FNumber }); var ic_factory_detail = ic_factory_detailss.Result.FirstOrDefault(a => a.icitem_id == ic_item.Id); if (ic_factory_detail != null) { ic_factory_detail.product_line = ext.F_CPX_Name; ic_factory_detail.minpackqty = ext.FIncreaseQty; ic_factory_detailsListUpdate.Add(ic_factory_detail); } var ic_item_ie = ic_item_ies.Result.FirstOrDefault(a => a.icitem_id == ic_item.Id); if (ic_item_ie != null) { ic_item_ie.isbackflush = ext.FIsBatchManage == "是" ? 1 : 0; ic_item_ieListUpdate.Add(ic_item_ie); } var ic_item_pur = ic_item_purs.Result.FirstOrDefault(a => a.icitem_id == ic_item.Id); if (ic_item_pur != null) { ic_item_pur.icitem_name = ic_item.name; ic_item_pur.purchgroup = ext.FPurchaseGroupId_Name; ic_item_pur.purcher = ext.FPurchaserId_Name; ic_item_pur.purchase_unit = ext.FPurchaseUnitId_Name; ic_item_purListUpdate.Add(ic_item_pur); } var ic_plan = ic_plans.Result.FirstOrDefault(a => a.icitem_id == ic_item.Id); if (ic_plan != null) { ic_plan.icitem_name = ic_item.name; ic_plan.planner_name = ext.FPurchaseGroupId_Name; ic_plan.fix_leadtime = ext.FFixLeadTime; ic_plan.plan_trategy = ext.FPlanningStrategy == "MRP" ? 1 : 0; ic_plan.order_trategy = ext.FOrderPolicy == "LFL(批对批)" ? 1 : 0; ic_plan.order_inter_val = ext.FOrderIntervalTime; ic_plan.lead_time = ext.FVarLeadTime; ic_plan.bat_change_economy = ext.FVarLeadTimeLotSize; ic_plan.order_point = ext.FReOrderGood; ic_plan.secinv = ext.FPlanSafeStockQty; ic_planListUpdate.Add(ic_plan); } } } else { ic_itemTest item = new ic_itemTest(help.NextId()); item.number = ext.FNumber; item.name = ext.FName_2052; item.model = ext.FSpecification_2052; item.full_name = ext.FDescription_2052; item.fms_number = ext.FOldNumber; //0.配置类 1. 2.委外加工 3.外购 4.虚拟件 item.erp_cls = ext.FErpClsID == "配置类" ? 0 : ext.FErpClsID == "自制" ? 1 : ext.FErpClsID == "委外" ? 2 : ext.FErpClsID == "外购" ? 3 : ext.FErpClsID == "虚拟" ? 4 : ext.FErpClsID == "费用" ? 5 : ext.FErpClsID == "服务" ? 6 : -1; item.source = ext.FDataSource; item.iskeyitem = ext.FIsKitting == "是" ? 1 : 0; item.gross_weight = ext.FGROSSWEIGHT; item.net_weight = ext.FNETWEIGHT; item.maund = ext.FWEIGHTUNITID_Name; item.cubic_measure = ext.FVOLUMEUNITID_Name; item.length = ext.FLENGTH; item.width = ext.FWIDTH; item.height = ext.FHEIGHT; item.size = ext.FVOLUME; item.allowpur = ext.FIsPurchase == "是" ? 1 : 0; item.allowsale = ext.FIsSale == "是" ? 1 : 0; item.allowmanu = ext.FIsProduce == "是" ? 1 : 0; item.allowout = ext.FIsSubContract == "是" ? 1 : 0; item.allowbatch = ext.F_SFJLPCH == "是" ? 1 : 0; item.tenant_id = 101;//TODO item.factory_id = 10101;//TODO item.org_id = 101;//TODO item.IsDeleted = false;//TODO item.is_equipment = 0; item.item_level = 0; item.hb_level = 0; item.matatt = 0; item.picktype = 0; item.enable_warning = 0; ic_itemListAdd.Add(item); ext_xrefList.Add(new ext_xrefTest { dop_table_name = "ic_item", dop_id = item.Id, dop_col1_name = "number", dop_col1_value = item.number, other_sys_name = "kd", other_table_name = "in_kd_material", other_id = ext.Id, other_col1_name = "FNumber", other_col1_value = ext.FNumber }); ic_factory_detailsListAdd.Add(new ic_factory_detailsTest(help.NextId()) { icitem_id = item.Id, icitem_name = ext.FName_2052, tenant_id = 101,//TODO factory_id = 10101,////TODO org_id = 101,//TODO IsDeleted = false,//TODO pick_type = 0, stock_time = 0, batch_manager = 0, days_per = 0, default_chkloc = 0, default_chksp = 0, default_loc = 0, default_sp = 0, product_line = ext.F_CPX_Name, production_leadtime = 0, stock_leadtime = 0, transportation_leadtime = 0, order_leadtime = 0, minpackqty = ext.FIncreaseQty, minorderqty = 0 }); ic_item_ieListAdd.Add(new ic_item_ieTest(help.NextId()) { icitem_id = item.Id, isbackflush = ext.FIsBatchManage == "是" ? 1 : 0, put_integer = 0,//TODO tenant_id = 101,//TODO factory_id = 10101,////TODO org_id = 101,//TODO IsDeleted = false,//TODO }); ic_item_purListAdd.Add(new ic_item_purTest(help.NextId()) { icitem_id = item.Id, icitem_name = item.name, currency_type = ext.FCurrencyId_Name == "人民币" ? 1 : 0,//TODO tenant_id = 101,//TODO factory_id = 10101,////TODO org_id = 101,//TODO IsDeleted = false,//TODO supplier_id = 0, purchgroup = ext.FPurchaseGroupId_Name, purcher = ext.FPurchaserId_Name, purchase_unit = ext.FPurchaseUnitId_Name }); ic_planListAdd.Add(new ic_planTest(help.NextId()) { icitem_id = item.Id, icitem_name = item.name, planner_name = ext.FPurchaseGroupId_Name, fix_leadtime = ext.FFixLeadTime, plan_trategy = ext.FPlanningStrategy == "MRP" ? 1 : 0, order_trategy = ext.FOrderPolicy == "LFL(批对批)" ? 1 : 0, order_inter_val = ext.FOrderIntervalTime, lead_time = ext.FVarLeadTime, bat_change_economy = ext.FVarLeadTimeLotSize, order_point = ext.FReOrderGood, secinv = ext.FPlanSafeStockQty, tenant_id = 101,//TODO factory_id = 10101,////TODO org_id = 101,//TODO IsDeleted = false,//TODO }); } }); if (ic_itemListAdd.Count > 0) { await _ic_itemTest.InsertManyAsync(ic_itemListAdd); //_businessDbContext.ic_itemTest.AddRange(ic_itemListAdd); //await _businessDbContext.ic_itemTest.BatchInsertIntoAsync(_businessDbContext.ic_itemTest); } if (ic_itemListUpdate.Count > 0) { await _ic_itemTest.UpdateManyAsync(ic_itemListUpdate); } if (ic_factory_detailsListAdd.Count > 0) { await _ic_factory_detailsTest.InsertManyAsync(ic_factory_detailsListAdd); //_businessDbContext.ic_factory_detailsTest.AddRange(ic_factory_detailsListAdd); //await _businessDbContext.ic_factory_detailsTest.BatchInsertIntoAsync(_businessDbContext.ic_factory_detailsTest); } if (ic_factory_detailsListUpdate.Count > 0) { await _ic_factory_detailsTest.UpdateManyAsync(ic_factory_detailsListUpdate); } if (ic_item_ieListAdd.Count > 0) { await _ic_item_ieTest.InsertManyAsync(ic_item_ieListAdd); //_businessDbContext.ic_item_ieTest.AddRange(ic_item_ieListAdd); //await _businessDbContext.ic_item_ieTest.BatchInsertIntoAsync(_businessDbContext.ic_item_ieTest); } if (ic_item_ieListUpdate.Count > 0) { await _ic_item_ieTest.UpdateManyAsync(ic_item_ieListUpdate); } if (ic_item_purListAdd.Count > 0) { await _ic_item_purTest.InsertManyAsync(ic_item_purListAdd); //_businessDbContext.ic_item_purTest.AddRange(ic_item_purListAdd); //await _businessDbContext.ic_item_purTest.BatchInsertIntoAsync(_businessDbContext.ic_item_purTest); } if (ic_item_purListUpdate.Count > 0) { await _ic_item_purTest.UpdateManyAsync(ic_item_purListUpdate); } if (ic_planListAdd.Count > 0) { await _ic_planTest.InsertManyAsync(ic_planListAdd); //_businessDbContext.ic_planTest.AddRange(ic_planListAdd); //await _businessDbContext.ic_planTest.BatchInsertIntoAsync(_businessDbContext.ic_planTest); } if (ic_planListUpdate.Count > 0) { await _ic_planTest.UpdateManyAsync(ic_planListUpdate); } if (ext_xrefList.Count > 0) { await _ext_xrefTest.InsertManyAsync(ext_xrefList); //_businessExtDbContext.ext_xrefTest.AddRange(ext_xrefList); //await _businessExtDbContext.ext_xrefTest.BatchInsertIntoAsync(_businessExtDbContext.ext_xrefTest); } } //var ic_items = _ic_item.GetListAsync(p=>p.factory_id==10101&&p.org_id==101&&p.tenant_id==101); //var ic_factory_detailss = _ic_factory_details.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); //var ic_item_ies = _ic_item_ie.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); //var ic_item_purs = _ic_item_pur.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); //var ic_plans = _ic_plan.GetListAsync(p => p.factory_id == 10101 && p.org_id == 101 && p.tenant_id == 101); //List ic_itemListAdd = new List(); //List ic_itemListUpdate = new List(); //List ic_factory_detailsListAdd = new List(); //List ic_factory_detailsListUpdate = new List(); //List ic_item_ieListAdd = new List(); //List ic_item_ieListUpdate = new List(); //List ic_item_purListAdd = new List(); //List ic_item_purListUpdate = new List(); //List ic_planListAdd = new List(); //List ic_planListUpdate = new List(); //List ext_xrefList = new List(); // if (extMaterials != null) //{ // extMaterials.Result.ForEach(ext => // { // if(ic_items != null && ic_items.Result.Exists(a=>a.number==ext.FNumber)) // { // var ic_item = ic_items.Result.FirstOrDefault(a => a.number == ext.FNumber); // if (ic_item != null) // { // ic_item.number = ext.FNumber; // ic_item.name = ext.FName_2052; // ic_item.model = ext.FSpecification_2052; // ic_item.full_name = ext.FDescription_2052; // ic_item.fms_number = ext.FOldNumber; // //0.配置类 1. 2.委外加工 3.外购 4.虚拟件 // ic_item.erp_cls = ext.FErpClsID == "配置类" ? 0 : ext.FErpClsID == "自制" ? 1 : ext.FErpClsID == "委外" ? 2 : ext.FErpClsID == "外购" ? 3 : ext.FErpClsID == "虚拟" ? 4 : ext.FErpClsID == "费用" ? 5 : ext.FErpClsID == "服务" ? 6 : -1; // ic_item.source = ext.FDataSource; // ic_item.iskeyitem = ext.FIsKitting == "是" ? 1 : 0; // ic_item.gross_weight = ext.FGROSSWEIGHT; // ic_item.net_weight = ext.FNETWEIGHT; // ic_item.maund = ext.FWEIGHTUNITID_Name; // ic_item.cubic_measure = ext.FVOLUMEUNITID_Name; // ic_item.length = ext.FLENGTH; // ic_item.width = ext.FWIDTH; // ic_item.height = ext.FHEIGHT; // ic_item.size = ext.FVOLUME; // ic_item.allowpur = ext.FIsPurchase == "是" ? 1 : 0; // ic_item.allowsale = ext.FIsSale == "是" ? 1 : 0; // ic_item.allowmanu = ext.FIsProduce == "是" ? 1 : 0; // ic_item.allowout = ext.FIsSubContract == "是" ? 1 : 0; // ic_item.allowbatch = ext.F_SFJLPCH == "是" ? 1 : 0; // ic_itemListUpdate.Add(ic_item); // ext_xrefList.Add(new ext_xref // { // dop_table_name = "ic_item", // dop_id= ic_item.Id, // dop_col1_name= "number", // dop_col1_value= ic_item.number, // other_sys_name="kd", // other_table_name= "in_kd_material", // other_id=ext.Id, // other_col1_name= "FNumber", // other_col1_value=ext.FNumber // }); // var ic_factory_detail = ic_factory_detailss.Result.FirstOrDefault(a => a.icitem_id == ic_item.Id); // if (ic_factory_detail != null) // { // ic_factory_detail.product_line = ext.F_CPX_Name; // ic_factory_detail.minpackqty = ext.FIncreaseQty; // ic_factory_detailsListUpdate.Add(ic_factory_detail); // } // var ic_item_ie = ic_item_ies.Result.FirstOrDefault(a => a.icitem_id == ic_item.Id); // if (ic_item_ie != null) // { // ic_item_ie.isbackflush = ext.FIsBatchManage == "是" ? 1 : 0; // ic_item_ieListUpdate.Add(ic_item_ie); // } // var ic_item_pur = ic_item_purs.Result.FirstOrDefault(a => a.icitem_id == ic_item.Id); // if (ic_item_pur != null) // { // ic_item_pur.icitem_name = ic_item.name; // ic_item_pur.purchgroup = ext.FPurchaseGroupId_Name; // ic_item_pur.purcher = ext.FPurchaserId_Name; // ic_item_pur.purchase_unit = ext.FPurchaseUnitId_Name; // ic_item_purListUpdate.Add(ic_item_pur); // } // var ic_plan = ic_plans.Result.FirstOrDefault(a => a.icitem_id == ic_item.Id); // if (ic_plan != null) // { // ic_plan.icitem_name = ic_item.name; // ic_plan.planner_name = ext.FPurchaseGroupId_Name; // ic_plan.fix_leadtime = ext.FFixLeadTime; // ic_plan.plan_trategy = ext.FPlanningStrategy == "MRP" ? 1 : 0; // ic_plan.order_trategy = ext.FOrderPolicy == "LFL(批对批)" ? 1 : 0; // ic_plan.order_inter_val = ext.FOrderIntervalTime; // ic_plan.lead_time = ext.FVarLeadTime; // ic_plan.bat_change_economy = ext.FVarLeadTimeLotSize; // ic_plan.order_point = ext.FReOrderGood; // ic_plan.secinv = ext.FPlanSafeStockQty; // ic_planListUpdate.Add(ic_plan); // } // } // } // else // { // ic_item item = new ic_item(help.NextId()); // item.number = ext.FNumber; // item.name = ext.FName_2052; // item.model = ext.FSpecification_2052; // item.full_name = ext.FDescription_2052; // item.fms_number = ext.FOldNumber; // //0.配置类 1. 2.委外加工 3.外购 4.虚拟件 // item.erp_cls = ext.FErpClsID == "配置类" ? 0 : ext.FErpClsID == "自制" ? 1 : ext.FErpClsID == "委外" ? 2 : ext.FErpClsID == "外购" ? 3 : ext.FErpClsID == "虚拟" ? 4 : ext.FErpClsID == "费用" ? 5: ext.FErpClsID == "服务" ? 6: - 1; // item.source = ext.FDataSource; // item.iskeyitem = ext.FIsKitting == "是" ? 1 : 0; // item.gross_weight = ext.FGROSSWEIGHT; // item.net_weight = ext.FNETWEIGHT; // item.maund = ext.FWEIGHTUNITID_Name; // item.cubic_measure = ext.FVOLUMEUNITID_Name; // item.length = ext.FLENGTH; // item.width = ext.FWIDTH; // item.height = ext.FHEIGHT; // item.size = ext.FVOLUME; // item.allowpur = ext.FIsPurchase == "是" ? 1 : 0; // item.allowsale = ext.FIsSale == "是" ? 1 : 0; // item.allowmanu = ext.FIsProduce == "是" ? 1 : 0; // item.allowout = ext.FIsSubContract == "是" ? 1 : 0; // item.allowbatch = ext.F_SFJLPCH == "是" ? 1 : 0; // item.tenant_id = 101;//TODO // item.factory_id = 10101;//TODO // item.org_id = 101;//TODO // item.IsDeleted = false;//TODO // item.is_equipment = 0; // item.item_level = 0; // item.hb_level = 0; // item.matatt = 0; // item.picktype = 0; // item.enable_warning = 0; // ic_itemListAdd.Add(item); // ext_xrefList.Add(new ext_xref // { // dop_table_name = "ic_item", // dop_id = item.Id, // dop_col1_name = "number", // dop_col1_value = item.number, // other_sys_name = "kd", // other_table_name = "in_kd_material", // other_id = ext.Id, // other_col1_name = "FNumber", // other_col1_value = ext.FNumber // }); // ic_factory_detailsListAdd.Add(new ic_factory_details(help.NextId()) // { // icitem_id = item.Id, // icitem_name = ext.FName_2052, // tenant_id = 101,//TODO // factory_id = 10101,////TODO // org_id = 101,//TODO // IsDeleted = false,//TODO // pick_type= 0, // stock_time= 0, // batch_manager=0, // days_per=0, // default_chkloc=0, // default_chksp=0, // default_loc=0, // default_sp=0, // product_line = ext.F_CPX_Name, // production_leadtime= 0, // stock_leadtime= 0, // transportation_leadtime=0, // order_leadtime = 0, // minpackqty = ext.FIncreaseQty, // minorderqty =0 // }); // ic_item_ieListAdd.Add(new ic_item_ie(help.NextId()) // { // icitem_id = item.Id, // isbackflush = ext.FIsBatchManage == "是" ? 1 : 0, // put_integer=0,//TODO // tenant_id = 101,//TODO // factory_id = 10101,////TODO // org_id = 101,//TODO // IsDeleted = false,//TODO // }); // ic_item_purListAdd.Add(new ic_item_pur(help.NextId()) // { // icitem_id = item.Id, // icitem_name = item.name, // currency_type= ext.FCurrencyId_Name == "人民币" ? 1 : 0,//TODO // tenant_id=101,//TODO // factory_id=10101,////TODO // org_id =101,//TODO // IsDeleted =false,//TODO // supplier_id=0, // purchgroup = ext.FPurchaseGroupId_Name, // purcher = ext.FPurchaserId_Name, // purchase_unit = ext.FPurchaseUnitId_Name // }); // ic_planListAdd.Add(new ic_plan(help.NextId()) // { // icitem_id = item.Id, // icitem_name = item.name, // planner_name = ext.FPurchaseGroupId_Name, // fix_leadtime = ext.FFixLeadTime, // plan_trategy = ext.FPlanningStrategy == "MRP" ? 1 : 0, // order_trategy = ext.FOrderPolicy == "LFL(批对批)" ? 1 : 0, // order_inter_val = ext.FOrderIntervalTime, // lead_time = ext.FVarLeadTime, // bat_change_economy = ext.FVarLeadTimeLotSize, // order_point = ext.FReOrderGood, // secinv = ext.FPlanSafeStockQty, // tenant_id = 101,//TODO // factory_id = 10101,////TODO // org_id = 101,//TODO // IsDeleted = false,//TODO // }); // } // }); // if(ic_itemListAdd.Count>0) // { // await _ic_item.InsertManyAsync(ic_itemListAdd); // } // if (ic_itemListUpdate.Count > 0) // { // await _ic_item.UpdateManyAsync(ic_itemListUpdate); // } // if (ic_factory_detailsListAdd.Count > 0) // { // await _ic_factory_details.InsertManyAsync(ic_factory_detailsListAdd); // } // if (ic_factory_detailsListUpdate.Count > 0) // { // await _ic_factory_details.UpdateManyAsync(ic_factory_detailsListUpdate); // } // if (ic_item_ieListAdd.Count > 0) // { // await _ic_item_ie.InsertManyAsync(ic_item_ieListAdd); // } // if (ic_item_ieListUpdate.Count > 0) // { // await _ic_item_ie.UpdateManyAsync(ic_item_ieListUpdate); // } // if (ic_item_purListAdd.Count > 0) // { // await _ic_item_pur.InsertManyAsync(ic_item_purListAdd); // } // if (ic_item_purListUpdate.Count > 0) // { // await _ic_item_pur.UpdateManyAsync(ic_item_purListUpdate); // } // if (ic_planListAdd.Count > 0) // { // await _ic_plan.InsertManyAsync(ic_planListAdd); // } // if (ic_planListUpdate.Count > 0) // { // await _ic_plan.UpdateManyAsync(ic_planListUpdate); // } // if (ext_xrefList.Count > 0) // { // await _ext_xref.UpdateManyAsync(ext_xrefList); // } // } } /// /// 处理物料清单 /// public void DoBom() { LogManager.Configuration.Install(new NLog.Config.InstallationContext()); } } }