diff --git a/.vs/ICSSoft.FromERP/v16/.suo b/.vs/ICSSoft.FromERP/v16/.suo index cc3669a..56a09ac 100644 Binary files a/.vs/ICSSoft.FromERP/v16/.suo and b/.vs/ICSSoft.FromERP/v16/.suo differ diff --git a/ICSSoft.FromERP/App.config b/ICSSoft.FromERP/App.config index 85b5e34..583e0de 100644 --- a/ICSSoft.FromERP/App.config +++ b/ICSSoft.FromERP/App.config @@ -37,9 +37,9 @@ - + - + diff --git a/ICSSoft.FromERP/SyncMoHour_Rhyton.cs b/ICSSoft.FromERP/SyncMoHour_Rhyton.cs index 3b22aa5..6848503 100644 --- a/ICSSoft.FromERP/SyncMoHour_Rhyton.cs +++ b/ICSSoft.FromERP/SyncMoHour_Rhyton.cs @@ -64,10 +64,6 @@ namespace ICSSoft.FromERP if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#tempSyncMoHour_Rhyton') and type='U') DROP TABLE #tempSyncMoHour_Rhyton - --工单工时同步表 - if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#tempSyncMoHourYesData_Rhyton') and type='U') -DROP TABLE #tempSyncMoHourYesData_Rhyton - select a.MoCode ,a.ItemCode @@ -75,6 +71,7 @@ a.MoCode ,a.MoPlanQty ,a.STime ,a.Rtime +,a.ResQty ,((a.STime*a.MoPlanQty)+a.Rtime) as TotalTime ,cast( cast( isnull( a.ProduceTime,0) as decimal(18,6)) /cast( 3600 as decimal(18,6)) as decimal(18,6)) as PTime ,a.ManualTime @@ -95,30 +92,11 @@ from ,e.OpSeq --,e2.OPName ,a.MoPlanQty - , - ( - select sum(isnull( f.Stime,0)) Stime - from IcsItem2Route h with(nolock) - join IcsItemRoute2Op f with(nolock) on h.ItemCode=f.ItemCode and h.RouteCode=f.RouteCode - where h.IsRef='Y' - and h.ItemCode=a.ItemCode - and f.OpCode=e.OpCode - group by h.ItemCode,f.OpCode - ) - as STime - , - ( - select sum(isnull( f.Rtime,0)) Rtime - from IcsItem2Route h with(nolock) - join IcsItemRoute2Op f with(nolock) on h.ItemCode=f.ItemCode and h.RouteCode=f.RouteCode - where h.IsRef='Y' - and h.ItemCode=a.ItemCode - and f.OpCode=e.OpCode - group by h.ItemCode,f.OpCode - ) - as Rtime - ,g.ProduceTime - ,f.RecordingHours as ManualTime + ,isnull( h1.Stime,0) STime + ,isnull( h1.Rtime,0) RTime + ,isnull(h1.ResQty,0) ResQty + ,isnull( g.ProduceTime,0) ProduceTime + ,isnull(f.RecordingHours,0) as ManualTime --,0.00 as AlterTime ,'No' as Status ,'{0}' as TenantId @@ -128,7 +106,7 @@ from from IcsMo a with(nolock) join IcsInventory b with(nolock) on a.ItemCode=b.ItemCode and a.TenantId=b.TenantId join IcsMo2Route d with(nolock) on a.MoCode=d.MoCode and d.IsMRoute='Y' and a.TenantId=d.TenantId - join IcsMoRoute2Op e with(nolock) on d.MoCode=e.MoCode and d.RouteId=e.RouteId and d.TenantId=e.TenantId + join IcsMoRoute2Op e with(nolock) on d.MoCode=e.MoCode and d.RouteCode=e.RouteCode and d.TenantId=e.TenantId join IcsOP e2 with(nolock) on e.OpCode=e2.OPCode and e.TenantId=e2.TenantId left join ( @@ -144,21 +122,20 @@ and t.IsHistory='N' and t.CollectForm='Standard' group by t.MoCode,t.OpCode ) g on a.MoCode=g.MoCode and e.OpCode=g.OpCode + +left join IcsItem2Route h with(nolock) on b.ItemCode=h.ItemCode and d.RouteCode=h.RouteCode and b.TenantId=h.TenantId +left join IcsItemRoute2Op h1 with(nolock) on h.ItemCode=h1.ItemCode and h.RouteCode=h1.RouteCode and e.OpCode=h1.OpCode and h.TenantId=h1.TenantId +left join IcsMoHourData h2 with(nolock) on a.mocode=h2.mocode and e.OpCode=h2.OpCode where 1=1 and a.TenantId='{0}' ---and a.CreationTime>@LastTime +and e.OpControl='10000000' +and (h2.id is null) ) a where 1=1 order by a.MoCode, a.OpSeq asc -delete from IcsMoHourData -where Status='No' -select * into #tempSyncMoHourYesData_Rhyton from IcsMoHourData -where Status='Yes' - -truncate table IcsMoHourData insert into IcsMoHourData ( MoCode @@ -171,6 +148,7 @@ truncate table IcsMoHourData ,RealTime ,ManualTime ,MachiningTotalTime +,ResQty ,Status ,TenantId ,CreationTime @@ -188,50 +166,14 @@ a.MoCode ,a.PTime ,a.ManualTime ,(a.PTime+a.ManualTime) +,a.ResQty ,a.Status ,a.TenantId ,a.MTIME ,a.CreatorUserId ,a.CreatorUserName from #tempSyncMoHour_Rhyton a -left join IcsMoHourData b with(nolock) on a.MoCode=b.MoCode and a.OpCode=b.OpCode -where b.MoCode is null and b.OpCode is null - - - insert into IcsMoHourData ( - MoCode - ,ItemCode - ,OpCode - ,Qty - ,STime - ,RTime - ,TotalTime - ,RealTime - ,ManualTime - ,AlterTime - ,MachiningTotalTime - ,EqpTotalTime - ,Status - ,TenantId - ,CreationTime - ,CreatorUserId - ,CreatorUserName - ,VerifyUser - ,VerifyDate - ,LastModificationTime - ,LastModifierUserId - ,LastModifierUserName - ) - select a.MoCode,a.ItemCode,a.OpCode,a.Qty,a.STime,a.RTime,a.TotalTime - ,a.RealTime,a.ManualTime - ,a.AlterTime - ,a.MachiningTotalTime - ,a.EqpTotalTime - ,a.Status,a.TenantId - ,a.CreationTime,a.CreatorUserId,a.CreatorUserName,a.VerifyUser,a.VerifyDate - ,a.LastModificationTime,a.LastModifierUserId,a.LastModifierUserName - from #tempSyncMoHourYesData_Rhyton a "; diff --git a/ICSSoft.Test/Program.cs b/ICSSoft.Test/Program.cs index 60cec7a..20172ab 100644 --- a/ICSSoft.Test/Program.cs +++ b/ICSSoft.Test/Program.cs @@ -13,7 +13,7 @@ namespace ICSSoft.Test //ICSVendor test = new ICSVendor(); //test.Execute(); - SyncSO_WeiMas test = new SyncSO_WeiMas(); + SyncMoHour_Rhyton test = new SyncMoHour_Rhyton(); test.Execute(); // var ss= ICSHelper.ApiSign("sj_w_id", "70FF7F01C5899A5ACAAD4ECB7FA5B3C5", 1724650261);