diff --git a/ICSSoft.FromERP/IcsOp.cs b/ICSSoft.FromERP/IcsOp.cs index 8de2168..a0e767c 100644 --- a/ICSSoft.FromERP/IcsOp.cs +++ b/ICSSoft.FromERP/IcsOp.cs @@ -59,7 +59,7 @@ u9route.ID as routeID,opu9.ID as OPID,work.Code AS SegCode,u9Group.Code as CrewC -- when timeuom.Name='分钟' then cast (opu9.RunTime/60 as decimal(18,6)) --when timeuom.Name='天' then cast (opu9.RunTime/24 as decimal(18,6)) -- end as Stime, - u9Res.TotalResUsage as Stime, + isnull(opRes.TotalResUsage,0) as Stime, case when timeuom.Name='小时' then cast (opu9.SetupTime as decimal(18,6)) when timeuom.Name='秒' then cast (opu9.SetupTime/3600 as decimal(18,6)) when timeuom.Name='分钟' then cast (opu9.SetupTime/60 as decimal(18,6)) @@ -67,7 +67,7 @@ u9route.ID as routeID,opu9.ID as OPID,work.Code AS SegCode,u9Group.Code as CrewC end as Rtime,u9Res.Code AS resCode,u9Restrl.Name as resName,PerResUsage,PerResOutput, case when IsSubcOperation='0' THEN 'N' else 'Y' end as IsSubcOperation,ITEM.Code as ItemCode,u9Group.Name AS CREWName,u9Linetrl.Name as LineName,worktrl.Name as SegNAME, - u9Res.ResQty + isnull(opRes.ResQty,0) ResQty from {2}.DBO.CBO_Routing u9route LEFT JOIN {2}.DBO.CBO_Routing_Trl u9routetrl on u9routetrl.ID=u9route.ID @@ -214,9 +214,9 @@ WHERE u9route.org='{0}' And u9route.ModifiedOn>='{1}' and u9route.ApproveDate i 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,'{b.HourRate}' AS HourDate,'{b.EqpCalcType}' as EqpCalcType,{b.ResQty} AS ResQty 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 HourRate,'{b.EqpCalcType}' as EqpCalcType,{b.ResQty} AS ResQty 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,'{b.HourRate}' AS HourDate,'{b.EqpCalcType}' as EqpCalcType,{b.ResQty} AS ResQty "; + 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 HourRate,'{b.EqpCalcType}' as EqpCalcType,{b.ResQty} AS ResQty "; }); var itemOpSql = routeOpSql;