| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706 |
- 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<in_kd_material, long> _kd_material;
- private IRepository<ic_item, long> _ic_item;
- private IRepository<ic_itemTest, long> _ic_itemTest;
- private IRepository<ic_item_ie, long> _ic_item_ie;
- private IRepository<ic_item_ieTest, long> _ic_item_ieTest;
- private IRepository<ic_item_inventory, long> _ic_item_inventory;
- private IRepository<ic_item_pur, long> _ic_item_pur;
- private IRepository<ic_item_purTest, long> _ic_item_purTest;
- private IRepository<ic_item_stock, long> _ic_item_stock;
- private IRepository<ic_plan, long> _ic_plan;
- private IRepository<ic_planTest, long> _ic_planTest;
- private IRepository<ic_check, long> _ic_check;
- private IRepository<ic_factory_details, long> _ic_factory_details;
- private IRepository<ic_factory_detailsTest, long> _ic_factory_detailsTest;
- private IRepository<in_kd_bom, long> _kd_bom;
- private IRepository<ic_bom, long> _ic_bom;
- private IRepository<ic_bom_child, long> _ic_bom_child;
- private IRepository<ic_substitute, long> _ic_substitute;
- private IRepository<ic_substitute_all, long> _ic_substitute_all;
- private IRepository<ic_substitute_all_dtl, long> _ic_substitute_all_dtl;
- private IRepository<ext_xref, long> _ext_xref;
- private IRepository<ext_xrefTest, long> _ext_xrefTest;
- private readonly BusinessDbContext _businessDbContext;
- private readonly BusinessExtDbContext _businessExtDbContext;
- public ExtJobService(
- IRepository<in_kd_material, long> kd_material,
- IRepository<ic_item, long> ic_item,
- IRepository<ic_itemTest, long> ic_itemTest,
- IRepository<ic_item_ie, long> ic_item_ie,
- IRepository<ic_item_ieTest, long> ic_item_ieTest,
- IRepository<ic_item_inventory, long> ic_item_inventory,
- IRepository<ic_item_pur, long> ic_item_pur,
- IRepository<ic_item_purTest, long> ic_item_purTest,
- IRepository<ic_item_stock, long> ic_item_stock,
- IRepository<ic_plan, long> ic_plan,
- IRepository<ic_planTest, long> ic_planTest,
- IRepository<ic_check, long> ic_check,
- IRepository<ic_factory_details, long> ic_factory_details,
- IRepository<ic_factory_detailsTest, long> ic_factory_detailsTest,
- IRepository<in_kd_bom, long> kd_bom,
- IRepository<ic_bom, long> ic_bom,
- IRepository<ic_bom_child, long> ic_bom_child,
- IRepository<ic_substitute, long> ic_substitute,
- IRepository<ic_substitute_all, long> ic_substitute_all,
- IRepository<ic_substitute_all_dtl, long> ic_substitute_all_dtl,
- IRepository<ext_xref, long> ext_xref,
- IRepository<ext_xrefTest, long> 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;
- }
- /// <summary>
- /// 处理物料
- /// </summary>
- public async void DoExt()
- {
- await DoMaterial();
- //DoBom();
- }
- /// <summary>
- /// 处理物料
- /// </summary>
- 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_itemTest> ic_itemListAdd = new List<ic_itemTest>();
- List<ic_itemTest> ic_itemListUpdate = new List<ic_itemTest>();
- List<ic_factory_detailsTest> ic_factory_detailsListAdd = new List<ic_factory_detailsTest>();
- List<ic_factory_detailsTest> ic_factory_detailsListUpdate = new List<ic_factory_detailsTest>();
- List<ic_item_ieTest> ic_item_ieListAdd = new List<ic_item_ieTest>();
- List<ic_item_ieTest> ic_item_ieListUpdate = new List<ic_item_ieTest>();
- List<ic_item_purTest> ic_item_purListAdd = new List<ic_item_purTest>();
- List<ic_item_purTest> ic_item_purListUpdate = new List<ic_item_purTest>();
- List<ic_planTest> ic_planListAdd = new List<ic_planTest>();
- List<ic_planTest> ic_planListUpdate = new List<ic_planTest>();
- List<ext_xrefTest> ext_xrefList = new List<ext_xrefTest>();
- 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_item> ic_itemListAdd = new List<ic_item>();
- //List<ic_item> ic_itemListUpdate = new List<ic_item>();
- //List<ic_factory_details> ic_factory_detailsListAdd = new List<ic_factory_details>();
- //List<ic_factory_details> ic_factory_detailsListUpdate = new List<ic_factory_details>();
- //List<ic_item_ie> ic_item_ieListAdd = new List<ic_item_ie>();
- //List<ic_item_ie> ic_item_ieListUpdate = new List<ic_item_ie>();
- //List<ic_item_pur> ic_item_purListAdd = new List<ic_item_pur>();
- //List<ic_item_pur> ic_item_purListUpdate = new List<ic_item_pur>();
- //List<ic_plan> ic_planListAdd = new List<ic_plan>();
- //List<ic_plan> ic_planListUpdate = new List<ic_plan>();
- //List<ext_xref> ext_xrefList = new List<ext_xref>();
- // 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);
- // }
- // }
- }
- /// <summary>
- /// 处理物料清单
- /// </summary>
- public void DoBom()
- {
- LogManager.Configuration.Install(new NLog.Config.InstallationContext());
- }
- }
- }
|