xusc 2 weeks ago
parent
commit
381b8b5af1
  1. BIN
      .vs/ICSSoft.FromERP/v16/.suo
  2. 49
      ICSSoft.FromERP/SyncMoHour_Rhyton.cs
  3. 2
      ICSSoft.Test/Program.cs

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

Binary file not shown.

49
ICSSoft.FromERP/SyncMoHour_Rhyton.cs

@ -61,9 +61,22 @@ namespace ICSSoft.FromERP
}
string sql = @"
if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#tempSyncMoHour_Rhyton') and type='U')
DROP TABLE #tempSyncMoHour_Rhyton
select
a.*
,(a.PTime+cast( a.ManualTime as decimal(18,6) )) as MachiningTotalTime
,case when (a.EqpCalcType='1'and a.ResQty>0) then (a.PTime+cast( a.ManualTime as decimal(18,6) ))/a.ResQty
else 0 end as EqpTotalTime
,(a.PTime+cast( a.ManualTime as decimal(18,6) )-a.TotalTime) as HourDiff
into #tempSyncMoHour_Rhyton
from
(
select
a.MoCode
,a.ItemCode
@ -75,13 +88,14 @@ a.MoCode
,((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
,a.Status
,a.TenantId
,a.CreationTime MTIME
,a.CreatorUserId
,a.CreatorUserName
,a.EqpCalcType
into #tempSyncMoHour_Rhyton
from
(
select
@ -103,6 +117,7 @@ from
,GETDATE() CreationTime
,'job' as CreatorUserId
,'job' CreatorUserName
,h1.EqpCalcType
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
@ -131,10 +146,11 @@ and a.MoStatus='mostatus_close'
and a.Default6='0'
and a.TenantId='{0}'
and e.OpControl='10000000'
and (h2.id is null)
and h2.Status='No'
) a
where 1=1
order by a.MoCode, a.OpSeq asc
) a
@ -169,17 +185,36 @@ a.MoCode
,a.TotalTime
,a.PTime
,a.ManualTime
,(a.PTime+cast( a.ManualTime as decimal(18,6) ))
,case when a.ResQty>0 then (a.PTime+cast( a.ManualTime as decimal(18,6) ))/a.ResQty
else 0 end as EqpTotalTime
,a.MachiningTotalTime
,a.EqpTotalTime
,a.ResQty
,(a.PTime+cast( a.ManualTime as decimal(18,6) )-a.TotalTime)
,a.HourDiff
,a.Status
,a.TenantId
,a.MTIME
,a.CreatorUserId
,a.CreatorUserName
from #tempSyncMoHour_Rhyton a
left join IcsMoHourData b on a.MoCode=b.MoCode and a.OpCode=b.OpCode
where b.Id is null
update IcsMoHourData
set STime=a.STime
,Rtime=a.Rtime
,TotalTime=a.TotalTime
,RealTime=a.PTime
,ManualTime=a.ManualTime
,MachiningTotalTime=a.MachiningTotalTime
,EqpTotalTime=a.EqpTotalTime
,ResQty=a.ResQty
,HourDiff=a.HourDiff
from #tempSyncMoHour_Rhyton a
join IcsMoHourData b on a.MoCode=b.MoCode and a.OpCode=b.OpCode
where 1=1
and b.Status='No'

2
ICSSoft.Test/Program.cs

@ -13,7 +13,7 @@ namespace ICSSoft.Test
//ICSVendor test = new ICSVendor();
//test.Execute();
IcsMo_Rhtyon test = new IcsMo_Rhtyon();
SyncMoHour_Rhyton test = new SyncMoHour_Rhyton();
test.Execute();
// var ss= ICSHelper.ApiSign("sj_w_id", "70FF7F01C5899A5ACAAD4ECB7FA5B3C5", 1724650261);

Loading…
Cancel
Save