xusc 1 month ago
parent
commit
5b3a377dd8
  1. BIN
      .vs/ICSSoft.FromERP/v16/.suo
  2. 4
      ICSSoft.FromERP/App.config
  3. 88
      ICSSoft.FromERP/SyncMoHour_Rhyton.cs
  4. 2
      ICSSoft.Test/Program.cs

BIN
.vs/ICSSoft.FromERP/v16/.suo

Binary file not shown.

4
ICSSoft.FromERP/App.config

@ -37,9 +37,9 @@
</appSettings>
<connectionStrings>
<!--<add name="SysConnectionString" connectionString="Data Source=119.3.29.177;Database=ICSMESBase;Uid=gitea;Pwd=aA123456;"/>-->
<!--<add name="SysConnectionString" connectionString="server=192.168.93.135; Database=ICSMESBase_RuiTeng; User ID=sa; Password=rhyt0n***;MultipleActiveResultSets=True;Connect Timeout=300;"/>-->
<add name="SysConnectionString" connectionString="server=192.168.93.135; Database=ICSMESBase_RuiTeng; User ID=sa; Password=rhyt0n***;MultipleActiveResultSets=True;Connect Timeout=300;"/>
<!--<add name="SysConnectionString" connectionString="server=192.168.93.135; Database=ICSMESBase_RuiTengZS; User ID=sa; Password=rhyt0n***;MultipleActiveResultSets=True;Connect Timeout=300;"/>-->
<add name="SysConnectionString" connectionString="server=192.168.1.155; Database=ICSMESBase_WeiMas; User ID=sa; Password=aA123456;MultipleActiveResultSets=True;Connect Timeout=300;"/>
<!--<add name="SysConnectionString" connectionString="server=192.168.1.155; Database=ICSMESBase_WeiMas; User ID=sa; Password=aA123456;MultipleActiveResultSets=True;Connect Timeout=300;"/>-->
<!--<add name="SysConnectionString" connectionString="server=172.16.12.201; Database=ICSJYMES; User ID=sa; Password=aA123456;MultipleActiveResultSets=True;Connect Timeout=300;"/>-->
<add name="APIAddStdWorkHour" connectionString="http://192.168.1.110:9097/api/APIAddStdWorkHour"/>
<add name="MailOpen" connectionString="true"/>

88
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
";

2
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);

Loading…
Cancel
Save