diff --git a/ICSSoft.FromERP/IcsOp.cs b/ICSSoft.FromERP/IcsOp.cs index 934acce..b0599f1 100644 --- a/ICSSoft.FromERP/IcsOp.cs +++ b/ICSSoft.FromERP/IcsOp.cs @@ -52,7 +52,7 @@ namespace ICSSoft.FromERP case AlternateType when '0' then '主制造' when '1' then '委外' when '2001' then '试制' end as AlternateType, ITEM.Code+'_'+RoutingVersionCode+'_'+(case AlternateType when '0' then '主制造' when '1' then '委外' when '2001' then '试制' end ) AS RouteDesc,RoutingVersionCode,RoutingVersion, u9route.CreatedOn as RouteCreateTime,u9route.ModifiedOn as RouteModifiedTime,opu9.Sequence as opseq, -opu9trl.Description+'_'+OPU9.Sequence as U9Opcode,opu9.CreatedOn as opCreateTime,opu9.ModifiedOn as OpModifiedTime,opu9trl.Description as OpDesc, +opu9trl.Description+'_'+OPU9.Sequence as U9Opcode,opu9.CreatedOn as opCreateTime,opu9.ModifiedOn as OpModifiedTime,opu9trl.Description as OpDesc,opu9.DescFlexField_PrivateDescSeg1 AS HourRate,opu9.DescFlexField_PrivateDescSeg2 as EqpCalcType, u9route.ID as routeID,opu9.ID as OPID,work.Code AS SegCode,u9Group.Code as CrewCode,u9route.Lot,u9Line.Code as LineCode,'' as MesOpcode, case when timeuom.Name='小时' then cast (opu9.RunTime as decimal(18,6)) when timeuom.Name='秒' then cast (opu9.RunTime/3600 as decimal(18,6)) @@ -206,15 +206,15 @@ WHERE u9route.org='{0}' And u9route.ModifiedOn>='{1}' and u9route.ApproveDate i #region 途程关联工序 string routeOpSql = ""; count = 0; - var RouteOpObj = table.AsEnumerable().Select(a => new { RouteCode = a["ROUTECODE"].ToString(), Opcode = a["MesOpcode"].ToString(), Opseq = a["opseq"].ToString(), ParallelOp = a["IsSubcOperation"].ToString(), ItemCode = a["ItemCode"].ToString(), RouteVersion = a["RoutingVersion"].ToString(), Stime = a["Stime"].ToString(), Rtime = a["Rtime"].ToString(), SEGCODE = a["SegCode"].ToString(), SegName = a["SegNAME"].ToString(), CrewCode = a["CrewCode"].ToString(), CREWName = a["CREWName"].ToString() }). + var RouteOpObj = table.AsEnumerable().Select(a => new { RouteCode = a["ROUTECODE"].ToString(), Opcode = a["MesOpcode"].ToString(), Opseq = a["opseq"].ToString(), ParallelOp = a["IsSubcOperation"].ToString(), ItemCode = a["ItemCode"].ToString(), RouteVersion = a["RoutingVersion"].ToString(), Stime = a["Stime"].ToString(), Rtime = a["Rtime"].ToString(), SEGCODE = a["SegCode"].ToString(), SegName = a["SegNAME"].ToString(), CrewCode = a["CrewCode"].ToString(), CREWName = a["CREWName"].ToString(), HourRate = a["HourRate"].ToString(),EqpCalcType=a["EqpCalcType"].ToString() }). Distinct().ToList(); RouteOpObj.ForEach(b => { count++; if (count != RouteOpObj.Count) - routeOpSql += $" SELECT '{b.RouteCode}' as RouteCode,'{b.Opcode}' as Opcode,'{b.Opseq}' as Opseq,'{b.ParallelOp}' as ParallelOp,'{b.ItemCode}' as ItemCode,{b.Rtime} as Rtime,{b.Stime} as Stime,'{b.SEGCODE}' as SEGCODE,'{b.SegName}' as SegName,'{b.CrewCode}' as CrewCode,'{b.CREWName}' as CREWName union all"; + routeOpSql += $" SELECT '{b.RouteCode}' as RouteCode,'{b.Opcode}' as Opcode,'{b.Opseq}' as Opseq,'{b.ParallelOp}' as ParallelOp,'{b.ItemCode}' as ItemCode,{b.Rtime} as Rtime,{b.Stime} as Stime,'{b.SEGCODE}' as SEGCODE,'{b.SegName}' as SegName,'{b.CrewCode}' as CrewCode,'{b.CREWName}' as CREWName,'{b.HourRate}' AS HourDate,'{b.EqpCalcType}' as EqpCalcType union all"; else - routeOpSql += $" SELECT '{b.RouteCode}' as RouteCode,'{b.Opcode}' as Opcode,'{b.Opseq}' as Opseq,'{b.ParallelOp}' as ParallelOp,'{b.ItemCode}' as ItemCode,{b.Rtime} as Rtime,{b.Stime} as Stime,'{b.SEGCODE}' as SEGCODE,'{b.SegName}' as SegName,'{b.CrewCode}' as CrewCode,'{b.CREWName}' as CREWName "; + routeOpSql += $" SELECT '{b.RouteCode}' as RouteCode,'{b.Opcode}' as Opcode,'{b.Opseq}' as Opseq,'{b.ParallelOp}' as ParallelOp,'{b.ItemCode}' as ItemCode,{b.Rtime} as Rtime,{b.Stime} as Stime,'{b.SEGCODE}' as SEGCODE,'{b.SegName}' as SegName,'{b.CrewCode}' as CrewCode,'{b.CREWName}' as CREWName,'{b.HourRate}' AS HourDate,'{b.EqpCalcType}' as EqpCalcType "; }); var itemOpSql = routeOpSql; @@ -329,6 +329,8 @@ WHERE u9route.org='{0}' And u9route.ModifiedOn>='{1}' and u9route.ApproveDate i ItemOpDic.Add("Default2", "A.SEGNAME"); ItemOpDic.Add("Default3", "A.CREWCODE"); ItemOpDic.Add("Default4", "A.CREWNAME"); + ItemOpDic.Add("HourRate", "A.HourRate"); + ItemOpDic.Add("EqpCalcType", "A.EqpCalcType"); ItemOpDic.Add("LastModificationTime", "GETDATE()");//操作时间 ItemOpDic.Add("LastModifierUserId", "'" + ConstWorkPoint.Muser + "'");//操作人 ItemOpDic.Add("LastModifierUserName", "'" + ConstWorkPoint.Musername + "'");//操作人名称