From a68210003e80bee37efdd2a13082971c26fc3e2c Mon Sep 17 00:00:00 2001 From: xuli Date: Thu, 31 Oct 2024 17:50:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0=E9=B8=BF=E5=9F=BA-=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E5=90=8C=E6=AD=A5FromU8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vs/ICSSoft.FromERP/v14/.suo | Bin 258048 -> 258048 bytes ICSSoft.FromERP/ICSMoFromU8_XinHJ.cs | 213 +++++++++++++++++++++++++ ICSSoft.FromERP/ICSSoft.FromERP.csproj | 1 + 3 files changed, 214 insertions(+) create mode 100644 ICSSoft.FromERP/ICSMoFromU8_XinHJ.cs diff --git a/.vs/ICSSoft.FromERP/v14/.suo b/.vs/ICSSoft.FromERP/v14/.suo index a8549eae55835bc5abde7fd81f7456e63e550d3d..ba85d59a15a8b21a1dbafa33a076473ab4e66b7c 100644 GIT binary patch delta 8904 zcmeI13tZG?y2s~z-x)w98K#j?5eJ+U1pzO4S4JT-yaA$-nIIy8$yGGGGLoB@+`{?S zJXu;a*S3kZA*?9QroK9WS4P><<|Veh=c2H$gUmKA;N-0?kT}_P(Gbq!K}IFad;vK+qm2 z<=Q}_9AX4AQu;x5lohA6fguynuN?Pl$YCfP1;&6pFdEEObRD{vJcg77{1#75g8UXO zQXtJ>GDrm-fGqz{$R5B4Aln?@B4Z#ETGC1AN7hY6ewHk6$$y4)4#)&gfGjYHVPf*( zrN~IR8!{g}4{||bOJi9lKNDN>zd+qWrC{~FJ}Z!tHOe=-%8))VMmUhG?h6^&l8%P# zC)2xT4R;&*>Zd8Aq@hdE`g=pWZu=P6MAK5i>66Nu_EE-}NJ&!_gFiFXA5ieOOtnbS>3Xs2O2PK~*5~^w2|C{r3!2D@ z$azZrx29vEq6Nqof?1$9^6gsc@7BK=b?Gg2($06QKL+()DDMHJ&3hpK2qe@Ws#%Cc zHjsv00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zt%~AK&=%zHW-0{YKs!so#+|eVplMJmXGY$aR!xJXNjAYskGHDfxp{{tWS4qYI}hUl zCto9HUxC;W8-n|sva78;OLWAAc;z*H{ zbs_vCP3tXk64iXK^DO(Dy*X7}+7yHKbF}(2wUhJFHl~WmULG*1G^CS19&h$|98uWa zx@lBqIQa(KD`FnZ#l~NdgPTtBYHU8ii=``;iXG<-#K-dg4S%OIB}Y&&#qf3#{d*ZN z?HjUQqn#a{hdm*;cQe%Zi5;g&p|opIm-8vunM7fy8sR*z^z7R@&(RDfA}^KV5W^;W zqE5l-T(LL7Pr1@T`vwfYz&Ar3#tLGCuJhbXJ@in86%RUj0j&kX=(j+O7{wDCj`1M( yVv_)oZVJK9%giLn`)@29=K9ddr2Kn?{MUo)9nK`M^#Y4gV&3PMbXd}p_5E*Dc_vK& diff --git a/ICSSoft.FromERP/ICSMoFromU8_XinHJ.cs b/ICSSoft.FromERP/ICSMoFromU8_XinHJ.cs new file mode 100644 index 0000000..296b0e3 --- /dev/null +++ b/ICSSoft.FromERP/ICSMoFromU8_XinHJ.cs @@ -0,0 +1,213 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using Quartz; + + +namespace ICSSoft.FromERP +{ + /// + /// 工单(来源U8) -新鸿基 + /// + public class ICSMoFromU8_XinHJ : IJob + { + private static object key = new object(); + private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public void Execute(IJobExecutionContext context) + { + try + { + lock (key) + { + log.Info("开始……………………………………………………………………"); + Execute(); + log.Info("结束……………………………………………………………………"); + } + } + catch (Exception ex) + { + log.Error(ex.ToString()); + } + } + + public void Execute() + { + try + { + string conStr = ICSHelper.GetConnectString(); + string Namespace = this.GetType().Namespace; + //string Class = this.GetType().Name; + DataTable dt = ICSHelper.GetERPDB(conStr); + + string erpNames = ICSHelper.GetConfigString()["Workpoint_ERPDB"]; + List DBS = erpNames.Split(',').ToList(); + List ListDB = new List(); + foreach (string DB in DBS) + { + if (DB.Split('|') != null && DB.Split('|').Count() > 1) + { + WorkpointERPDBLink wd = new WorkpointERPDBLink(); + wd.Workpoint = DB.Split('|')[0]; + wd.ERPDB = DB.Split('|')[1]; + ListDB.Add(wd); + } + } + + foreach (DataRow dr in dt.Rows) + { + // string erpName = ICSHelper.GetConfigString()["ERPDB"]; + string TenantId = dr["TenantId"].ToString();//mes 组织 + string TenantCode = dr["TenantCode"].ToString(); + string ErpId = dr["ErpID"].ToString(); //erpID + string Class = this.GetType().Name + TenantCode; + + WorkpointERPDBLink dblink = ListDB.FindLast(a => a.Workpoint == TenantCode); + if (dblink == null) + { + return; + } + string erpName = dblink.ERPDB; + + //erpName = string.Format(erpName, TenantId); + #region SQL + string sql = @" + + + select CAST(b.MoDId as VARCHAR(50)) as ID, + a.MoCode as MOCODE, + b.SortSeq as Sequence, + b.InvCode as InvCode, + b.Qty as Quantity, + a.CreateUser as CreatePerson, + a.CreateTime as CreateDateTime, + isnull(b.AuxQty,0) as Amount, + isnull(b.QualifiedInQty,0) as RCVQuantity, + b.MDeptCode as DepCode, + b.WhCode as WHCode, + case when b.CloseUser is not null then 'mostatus_initial' else 'mostatus_close' end as MOStatus, + b.Remark as MOMemo, + case when b.CloseUser is not null then '3' else '2' end as ERPStatus, + c.StartDate as StartDate, + c.DueDate as DueDate, + a.MoId as MOID, + b.MoDId as MODetailID, + + CASE WHEN ISNULL(a.ModifyTime, a.CreateTime)> +ISNULL(b.CloseTime,ISNULL(b.RelsTime,ISNULL(a.ModifyTime, a.CreateTime))) +THEN ISNULL(a.ModifyTime, a.CreateTime) +ELSE ISNULL(b.CloseTime,ISNULL(b.RelsTime,ISNULL(a.ModifyTime, a.CreateTime))) END as MTIME, + isnull(b.CostItemCode,'') ProjectCode,isnull(b.MoLotCode,'') cBatch,'' version ,'' brand, + (case WHEN inv.bFree1=1 THEN isnull(b.Free1,'') ELSE '' END) as cFree1, + (case WHEN inv.bFree2=1 THEN isnull(b.Free2,'') ELSE '' END) as cFree2, + (case WHEN inv.bFree3=1 THEN isnull(b.Free3,'') ELSE '' END) as cFree3, + (case WHEN inv.bFree4=1 THEN isnull(b.Free4,'') ELSE '' END) as cFree4, + (case WHEN inv.bFree5=1 THEN isnull(b.Free5,'') ELSE '' END) as cFree5, + (case WHEN inv.bFree6=1 THEN isnull(b.Free6,'') ELSE '' END) as cFree6, + (case WHEN inv.bFree7=1 THEN isnull(b.Free7,'') ELSE '' END) as cFree7, + (case WHEN inv.bFree8=1 THEN isnull(b.Free8,'') ELSE '' END) as cFree8, + (case WHEN inv.bFree9=1 THEN isnull(b.Free9,'') ELSE '' END) as cFree9, + (case WHEN inv.bFree10=1 THEN isnull(b.Free10,'') ELSE '' END) as cFree10, + CAST('' AS NVARCHAR(500)) as Colspan, + b.MoLotCode 生产批号,b.Free1 零件版本,b.Free2 图纸版本 + + INTO #TempMO + FROM {1}.dbo.mom_order a + INNER JOIN {1}.dbo.mom_orderdetail b ON a.MoId = b.MoId + INNER JOIN {1}.dbo.mom_morder c ON b.MoDId = c.MoDId + LEFT JOIN {1}.dbo.Inventory inv ON b.InvCode = inv.cInvCode + LEFT JOIN {1}.dbo.Customer cus ON b.CustCode = cus.cCusCode + LEFT JOIN {1}.dbo.SO_SODetails so ON b.OrderDId = so.iSOsID + + where ISNULL (b.RelsUser,'') <> '' + and CASE WHEN ISNULL(a.ModifyTime, a.CreateTime)>ISNULL(b.CloseTime,ISNULL(b.RelsTime,ISNULL(a.ModifyTime, a.CreateTime))) THEN ISNULL(a.ModifyTime, a.CreateTime) ELSE ISNULL(b.CloseTime,ISNULL(b.RelsTime,ISNULL(a.ModifyTime, a.CreateTime))) END>=@LastTime + + IF NOT EXISTS(SELECT * FROM #TempMO) + begin + DROP TABLE #TempMO + RETURN + + end"; + sql = string.Format(sql, ErpId, erpName); + sql = ICSHelper.Time(Namespace, Class, TenantId, sql, "#TempMO"); + Dictionary value = new Dictionary(); + + + sql += @"--删除数据 + + SELECT a.ID INTO #tableICSMO + FROM ICSMO a With(NoLock) + LEFT JOIN {1}.dbo.[mom_order] b With(NoLock) ON a.Mocode=b.MoCode + left JOIN {1}.dbo.mom_orderdetail b2 ON b.MoId = b2.MoId AND A.MoSeq=B2.SortSeq + WHERE a.TenantId='{0}' and B2.SortSeq IS NULL + + DELETE FROM ICSMO + WHERE TenantId='{0}' and ID IN ( SELECT ID from #tableICSMO ) + "; + Dictionary values = new Dictionary(); + values.Add("MoCode", "a.MOCODE");//工单号 + values.Add("MoSeq", "a.Sequence");//工单行号 + values.Add("ItemCode", "a.InvCode");//物料代码 + values.Add("MoPlanQty", "a.Quantity");//数量 + values.Add("Amount", "a.Amount"); + values.Add("DepCode", "a.DepCode"); + values.Add("SegCode", "a.DepCode"); + values.Add("WHCode", "a.WHCode");//仓库 + values.Add("MoPlanStartDate", "a.StartDate");//开工日 + values.Add("MoPlanEndDate", "a.DueDate");//完工日 + + values.Add("MOMemo", "a.MOMemo");//生产订单状态 + values.Add("MoUser", "a.CreatePerson");//生产订单状态 + values.Add("MODOWNDATE", "a.CreateDateTime");//生产订单状态 + values.Add("MOID", "a.MoId");//生产订单状态 + values.Add("MODetailID", "a.MODetailID");//生产订单状态 + values.Add("LastModifierUserId", "'" + ConstWorkPoint.Muser + "'"); + values.Add("LastModifierUserName", "'" + ConstWorkPoint.Musername + "'"); + values.Add("LastModificationTime", "a.Mtime");//操作时间 + values.Add("Defaultl", "a.生产批号");//完工日 + values.Add("Default2", "a.零件版本");//完工日 + values.Add("Default3", "a.图纸版本");//完工日 + + //更新存在数据 + sql += ICSHelper.UpdateSQL("b", values) + + @" #TempMO a + INNER JOIN ICSMO b ON a.Mocode=b.Mocode AND A.Sequence=B.MoSeq + WHERE b.TenantId='{0}' "; + + // values.Add("ID", "NEWID()"); + values.Add("MoType", "'normal'");//辅机数量 + values.Add("MOVER", "'1'");//辅机数量 + values.Add("ProjectCode", "a.ProjectCode");//辅机数量 + + values.Add("MOINPUTQTY", "0");//辅机数量 + values.Add("MOSCRAPQTY", "0");//辅机数量 + values.Add("MOACTQTY", "0");//辅机数量 + values.Add("CollectModel", "'SS'");//辅机数量 + values.Add("CollectType", "'collecttype_one'");//辅机数量 + values.Add("MoBom", "'1'");//辅机数量 + values.Add("CreationTime", "a.MTime");//操作人 + values.Add("CreatorUserId", "'" + ConstWorkPoint.Muser + "'");//操作人 + values.Add("CreatorUserName", "'" + ConstWorkPoint.Musername + "'");//操作人名称 + values.Add("TenantId", "'" + TenantId + "'");//站点 + values.Add("MOSTATUS", "a.MOStatus");//生产订单状态 + //插入新增数据 + sql += ICSHelper.InsertSQL("ICSMO", values) + + @" #TempMO a + LEFT JOIN ICSMO b on a.Mocode=b.Mocode AND A.Sequence=B.MoSeq and b.TenantId='{0}' + WHERE 1=1 and b.MoCode is null "; + sql += "DROP TABLE #TempMO"; + sql += " DROP TABLE #tableICSMO "; + sql = string.Format(sql, TenantId, erpName, ErpId); + //return; + ICSHelper.ExecuteDate(conStr, sql); + #endregion + } + } + catch (Exception ex) + { + log.Error(ex.ToString()); + } + } + } +} diff --git a/ICSSoft.FromERP/ICSSoft.FromERP.csproj b/ICSSoft.FromERP/ICSSoft.FromERP.csproj index 5fe1025..06b9c9a 100644 --- a/ICSSoft.FromERP/ICSSoft.FromERP.csproj +++ b/ICSSoft.FromERP/ICSSoft.FromERP.csproj @@ -107,6 +107,7 @@ + From 8c472f09796ef3619494d6c84ee5161e4c9f72c3 Mon Sep 17 00:00:00 2001 From: xuli Date: Fri, 1 Nov 2024 10:35:41 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vs/ICSSoft.FromERP/v14/.suo | Bin 258048 -> 247296 bytes ICSSoft.FromERP/ICSMoFromU8_XinHJ.cs | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.vs/ICSSoft.FromERP/v14/.suo b/.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: Fri, 1 Nov 2024 10:36:37 +0800 Subject: [PATCH 3/4] 1 --- .vs/ICSSoft.FromERP/v14/.suo | Bin 247296 -> 238080 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.vs/ICSSoft.FromERP/v14/.suo b/.vs/ICSSoft.FromERP/v14/.suo index 1e8149b8bdb3c23da1b9a692f74edba7320cbaf0..eff92ed7a067539c59cddf77fe65e8b2a8cded19 100644 GIT binary patch delta 2046 zcmaKte^69a6vy8=@9m0+>+;+9p$n~|fQXvY43@5nBjzt8HBwUn%_&1S1V_o-N0~87 z4!m33Muk7#G!Kw8;3-edAM1}vvoX@Ac29Bki3vGW)ak}CxonM?It^u$N)(iOE#Vm`)t0F`qYcG z$Rb7(vxy{PFp|Kl40P+VB8;L;T4)HV*K!};<_1Z~fm-WS{kJ!tjb&e#lcWuL92CK78hr8^S z?Oj&bu*K|ZP@uxA2(i3r9sd@qxKAT3FeoR1nutM!Fn7rxNDS$Xi9>{VLPQ~+SU*lY zQ9FZ%a#2nzkw`=lF+?}ZS0bONYIN`gs!gF>(dRt*VeCs~sIO0Caq2|cokFZ7CKFGR z+(!FCa#8oFNbpGccOfd#EPP~>+u0hjdh#uA+4Y%2UX;hv9jG;f`yWO zPb!TuoxNEa+W%`BVl=JJu*p@=R(Q*r(l$7;5zOKjw%YWisAmN=6>kLRZ3XN@u%+%cUIO%A2Xe~H$(MY)Hg(FK^aOl zz3=9%pk#203HtbvqO5e_1}(ETOvI9DEo=(e(PHmN=6pp2SlGN9kCkrIW2DnRMy4jk zvrm#@%!!pJLECv7USW53`k;*!?ef`vpw0oTv*!1Qvpi3CpGJ32C(F8OSA@Jw&Ik%D zCcA`~AhCkFvG&)=T@7qc-9i%RKU%iX?xR|keCw<5rfb!Ou*)p^*(ckl(ZRzM^Zs=^ z>IQ1RxlGrdwto6S)b}geeZ^GHc7cA_u3y2XlZxF`?sq}cIS8^qfgaGW#%qb`0d$UJ zCwR#^7-1GBmVw?CU<3jhc2GDBfI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Jx~E;M)JS1DYTo zOTb9kXd5kqHk$BzT|7gkFP)Ko`wVij#zvp~6i>~3Fe!)Ze#*{9Ey$-UzhdK^c+0vK z%uf%U{TZH!lK7kIqbuPCFnR#{Wb*vKTKJcD@O0L~S%XV-{*}z@x#U7yHoC!r&v$cn zse=Z1lo|idVt&(8!?-XW-_#dl_nUr+{cn>GPhmGxjZGWo!eqmqCsvgq62$5cl;8sz$Ly1QS?WY)g9pmsQZ`L-A#ZQh;VMW z`2#~>>Ys=46gs$@%TccG;ud2X?&ZRA2gj3v)-0N}hijnjUe2wA_i%1B>6QJdi+^*+ k88_8#eeF_z_2Y<6>fq+wc8RB!W@PFv;xd&-JGd?A-wy<3J^%m! From fe34dd7037961bd15e6e80d3edcddbe817a68674 Mon Sep 17 00:00:00 2001 From: xuli Date: Fri, 1 Nov 2024 11:31:08 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=B0=E9=B8=BF=E5=9F=BA=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E6=96=99=E5=8F=B7FromU8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ICSSoft.FromERP/ICSInventoryFromU8_XinHJ.cs | 179 ++++++++++++++++++++ ICSSoft.FromERP/ICSSoft.FromERP.csproj | 1 + 2 files changed, 180 insertions(+) create mode 100644 ICSSoft.FromERP/ICSInventoryFromU8_XinHJ.cs diff --git a/ICSSoft.FromERP/ICSInventoryFromU8_XinHJ.cs b/ICSSoft.FromERP/ICSInventoryFromU8_XinHJ.cs new file mode 100644 index 0000000..cab38f7 --- /dev/null +++ b/ICSSoft.FromERP/ICSInventoryFromU8_XinHJ.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Quartz; + +using System.Data; +using System.Net.NetworkInformation; + +namespace ICSSoft.FromERP +{ + /// + /// 物料档案(来源U8) + /// + public class ICSInventoryFromU8_XinHJ : IJob + { + private static object key = new object(); + private static log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public void Execute(IJobExecutionContext context) + { + try + { + lock (key) + { + log.Info("开始……………………………………………………………………"); + Execute(); + log.Info("结束……………………………………………………………………"); + } + } + catch (Exception ex) + { + log.Error(ex.ToString()); + } + } + + public void Execute() + { + try + { + //string conERPStr = ICSHelper.GetERPConnectString(); + string conStr = ICSHelper.GetConnectString(); + string Namespace = this.GetType().Namespace; + //string Class = this.GetType().Name; + string erpNames = ICSHelper.GetConfigString()["Workpoint_ERPDB"]; + List DBS = erpNames.Split(',').ToList(); + List ListDB = new List(); + foreach (string DB in DBS) + { + if (DB.Split('|') != null && DB.Split('|').Count() > 1) + { + WorkpointERPDBLink wd = new WorkpointERPDBLink(); + wd.Workpoint = DB.Split('|')[0]; + wd.ERPDB = DB.Split('|')[1]; + ListDB.Add(wd); + } + } + DataTable dt = ICSHelper.GetERPDB(conStr); + foreach (DataRow dr in dt.Rows) + { + + string TenantId = dr["TenantId"].ToString(); + string TenantCode = dr["TenantCode"].ToString(); + string ErpId = dr["ErpID"].ToString(); //erpID + string Class = this.GetType().Name + TenantCode; + + WorkpointERPDBLink dblink= ListDB.FindLast(a => a.Workpoint == TenantCode); + if (dblink == null) + { + return; + } + string erpName = dblink.ERPDB; + //erpName = string.Format(erpName, TenantId); + + #region SQL + string sql = @" + + select NEWID() AS ID, + a.cInvCode AS ItemCode, + CASE WHEN A.bSelf ='1' THEN '1' WHEN A.bPurchase='1' THEN '1' when a.bProxyForeign='1' THEN '2' + else '' end ItemFormAttribute, + dbo.GetReplaceStr(cInvName) AS ItemName, + a.cEngineerFigNo ItemDrawingNo, + '' ItemDesc, + dbo.GetReplaceStr(isnull(cInvAddCode,'')+'|'+isnull(cInvStd,'')) AS ItemStd, + a.cInvAddCode INVPARSETYPE, + c.cComUnitName AS ItemUnit, + a.cInvCCode ItemMainCategoryCode, + b.cInvCName ClassName, + ISNULL(c.iChangRate,0) as ItemRate, + ISNULL(a.iMassDate,'') as EffectiveDays, + ISNULL(CONVERT(NVARCHAR(50),a.dModifyDate,21),'') MTime, + (case when isnull(a.fOutExcess,0)=0 then 0 else (case when isnull(a.fOutExcess,0)>5 then 3 else 2 end) end) 备料超额类型, + isnull(a.fOutExcess,0) 备料超额值 + + INTO #TempINV + FROM {1}.dbo.Inventory a with(nolock) + LEFT JOIN {1}.dbo.InventoryClass b with(nolock) ON a.cInvCCode = b.cInvCCode + LEFT JOIN {1}.dbo.ComputationUnit c with(nolock) ON a.cComUnitCode = c.cComunitCode + WHERE a.dEDate IS NULL AND a.dModifyDate>=@LastTime + ORDER BY cInvCode + + + IF NOT EXISTS(SELECT * FROM #TempINV) + RETURN"; + sql = string.Format(sql, ErpId, erpName); + sql = ICSHelper.Time(Namespace, Class, TenantId, sql, "#TempINV"); + + sql += @"--删除数据 + + SELECT a.ItemCode INTO #tableICSINVENTORY + FROM ICSINVENTORY a With(NoLock) + LEFT JOIN {1}.dbo.[Inventory] b With(NoLock) ON a.ItemCode=b.cInvCode + WHERE b.cInvCode is null + and a.TenantId='{0}' + + + DELETE ICSINVENTORY + WHERE TenantId='{0}' and ItemCode IN ( SELECT ItemCode from #tableICSINVENTORY) "; + Dictionary values = new Dictionary(); + values.Add("ItemCode", "a.ItemCode");//物料编号 + values.Add("ItemName", "a.ItemName");//物料名称 + values.Add("ItemDesc", "a.ItemDesc");//物料描述 + values.Add("ItemStd", "a.ItemStd");//规格型号 + values.Add("ItemAttribute", "a.ItemFormAttribute");//产品属性(0:采购,1:自制,2:委外,3虚拟) + values.Add("ItemAddCode", "a.INVPARSETYPE"); //产品代码(U8存货代码 ) + values.Add("ItemUnit", "a.ItemUnit");//主计量单位 + values.Add("ItemMainCategoryCode", "a.ItemMainCategoryCode");//大类编码 + values.Add("ItemRate", "a.ItemRate"); + values.Add("InvVersion", "''"); + values.Add("InvBrand", "''"); + values.Add("InvIQC", "0");//是否IQC检验 + values.Add("InvFQC", "0");//是否FQC检验 + values.Add("EffectiveEnable", "0");// + values.Add("EffectiveDays", "a.EffectiveDays");// + values.Add("BatchEnable", "1");// + values.Add("LotEnable", "0");// + values.Add("PrintEnable", "0");// + values.Add("OverType", "a.备料超额类型");//超领类型(1:比例,2:数量,3:不管控) + values.Add("OverValue", "a.备料超额值"); + values.Add("LastModificationTime", "a.Mtime");//操作时间 + values.Add("ItemType", "'itemtype_finishedproduct'"); + values.Add("ItemContype", "'item_control_lot'"); + values.Add("ItemControlType", "'item_control_lot'"); + values.Add("ItemDrawingNo", "b.ItemDrawingNo");//产品图号 + + + //更新存在数据 + sql += ICSHelper.UpdateSQL("b", values) + + @" #TempINV a + INNER JOIN ICSINVENTORY b ON a.ItemCode=b.ItemCode + left join IcsMainCategoryCode d on b.ItemMainCategoryCode=d.ItemMainCategoryCode and b.TenantId=d.TenantId + WHERE b.TenantId='" + TenantId + "' "; + + values.Add("CreationTime", "a.MTime");//操作人 + values.Add("CreatorUserId", "'" + ConstWorkPoint.Muser + "'");//操作人 + values.Add("CreatorUserName", "'" + ConstWorkPoint.Musername + "'");//操作人名称 + values.Add("TenantId", "'" + TenantId + "'");//站点 + //插入新增数据 + sql += ICSHelper.InsertSQL("ICSINVENTORY", values) + + @" #TempINV a + LEFT JOIN ICSINVENTORY b ON a.ItemCode=b.ItemCode and b.TenantId='{0}' + left join IcsMainCategoryCode d on b.ItemMainCategoryCode=d.ItemMainCategoryCode and b.TenantId=d.TenantId + WHERE 1=1 and b.ItemCode is null + "; + sql += " DROP TABLE #TempINV " + + " DROP TABLE #tableICSINVENTORY "; + sql = string.Format(sql, TenantId, erpName, ErpId); + + ICSHelper.ExecuteDate(conStr, sql); + #endregion + } + } + catch (Exception ex) + { + log.Error(ex.ToString()); + } + } + } +} diff --git a/ICSSoft.FromERP/ICSSoft.FromERP.csproj b/ICSSoft.FromERP/ICSSoft.FromERP.csproj index 06b9c9a..6c37c4e 100644 --- a/ICSSoft.FromERP/ICSSoft.FromERP.csproj +++ b/ICSSoft.FromERP/ICSSoft.FromERP.csproj @@ -99,6 +99,7 @@ +