shiqian.wang 16 hours ago
parent
commit
62b4fea6a9
  1. BIN
      .vs/ICSSoft.FromERP/v16/.suo
  2. 6
      ICSSoft.FromERP/IcsMo_Rhtyon.cs
  3. 8
      ICSSoft.FromERP/IcsSBom_Rhtyon.cs
  4. 48
      ICSSoft.FromERP/SyncMoHour_Rhyton.cs

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

Binary file not shown.

6
ICSSoft.FromERP/IcsMo_Rhtyon.cs

@ -103,6 +103,7 @@ and b1.code not like 'K10%'
,case when a.ActualCompleteDate is null then ''
else Convert(varchar(10),a.ActualCompleteDate,120 ) end as ActualCompleteDate
,a.IsFIClose
,e3.Name AlternateTypeName
INTO #TempMO
from {1}.dbo.MO_MO as A With(NoLock)
left join {1}.dbo.[MO_MOMemo] as A1 With(NoLock) on (A.[ID] = A1.[MO])
@ -116,6 +117,9 @@ else Convert(varchar(10),a.ActualCompleteDate,120 ) end as ActualCompleteDate
left join {1}.dbo.[CBO_Department] as A13 With(NoLock) on (A.[Department] = A13.[ID])
left join {1}.dbo.[CBO_Department_Trl] as A14 With(NoLock) on (A14.SysMlFlag = 'zh-CN') and (A13.[ID] = A14.[ID])
LEFT JOIN {1}.dbo.[CBO_Wh] AS A22 With(NoLock) ON A22.ID=A.CompleteWh
left join {1}.dbo.UBF_Sys_ExtEnumType e1 on e1.Code = 'UFIDA.U9.CBO.MFG.Enums.AlternateTypesEnum'
left join {1}.dbo.UBF_Sys_ExtEnumValue e2 on e1.ID=e2.ExtEnumType and e2.evalue=a.BOMAlternate
left join {1}.dbo.UBF_Sys_ExtEnumValue_Trl e3 on e2.id=e3.ID and e3.SysMLFlag='zh-CN'
where (A.DocState=2 OR A.DocState=3) and A.[BusinessType] != 50 and (A.[BusinessType] != 52)
and (A.[BusinessType] != 2417) and (A.[IsMultiRouting] != 1) and A.[ItemMaster] is not null --and (A.[IsStartMO] != 1)
and ISNULL(A.ModifiedOn,A.BusinessCreatedOn)>=@LastTime AND A12.id='{0}'
@ -157,7 +161,6 @@ else Convert(varchar(10),a.ActualCompleteDate,120 ) end as ActualCompleteDate
values.Add("WHCode", "a.WHCode");//仓库
values.Add("MoPlanStartDate", "a.StartDate");//开工日
values.Add("MoPlanEndDate", "a.DueDate");//完工日
values.Add("MOMemo", "a.MOMemo");//生产订单状态
values.Add("MoUser", "a.CreatePerson");//生产订单状态
values.Add("MODOWNDATE", "a.CreateDateTime");//生产订单状态
@ -173,6 +176,7 @@ else Convert(varchar(10),a.ActualCompleteDate,120 ) end as ActualCompleteDate
values.Add("Default3", "a.ActualCompleteDate");
values.Add("Default5", "a.DocState");
values.Add("Default6", "a.IsFIClose");
values.Add("Alternate", "a.AlternateTypeName");
//更新存在数据
sql += ICSHelper.UpdateSQL("b", values)

8
ICSSoft.FromERP/IcsSBom_Rhtyon.cs

@ -77,6 +77,7 @@ isnull( A6.[Code],'') as 项目号,
,A.ModifiedOn as MTime
,A.ID as ErpDetailID
,e3.Name AlternateTypeName
,u1.Name as SBItemUom
INTO #TempBOM
from {1}.dbo.CBO_BOMComponent as A
left join {1}.dbo.[CBO_BOMMaster] as A1 on (A.[BOMMaster] = A1.[ID])
@ -91,7 +92,7 @@ LEFT JOIN {1}.dbo.[Base_Organization_Trl] AS J ON ( I.[ID] = J.[ID] AND J.SysM
left join {1}.dbo.UBF_Sys_ExtEnumType e1 on e1.Code = 'UFIDA.U9.CBO.MFG.Enums.AlternateTypesEnum'
left join {1}.dbo.UBF_Sys_ExtEnumValue e2 on e1.ID=e2.ExtEnumType and e2.evalue=A1.AlternateType
left join {1}.dbo.UBF_Sys_ExtEnumValue_Trl e3 on e2.id=e3.ID and e3.SysMLFlag='zh-CN'
left join {1}.dbo.Base_UOM_Trl u1 on a.IssueUOM=u1.id and u1.SysMLFlag='zh-CN'
where 1=1 and IsEffective=1 and A.ModifiedOn>=@LastTime AND I.id={0} and A.ComponentType=0
and A1.AlternateType=0
and A1.bomtype=0
@ -123,6 +124,9 @@ and a.TenantId='{0}'
//values.Add("SBItemDesc", "a.子阶料描述");
values.Add("SBSITEMCODE", "a.子阶料编码");
values.Add("SBITEMQTY", "a.子阶料计量数量");
values.Add("SBUsageQty", "a.UsageQty");
values.Add("ParentQty", "a.ParentQty");
values.Add("SBItemUom", "a.SBItemUom");
values.Add("SEQ", "1");
values.Add("SBItemECN", "a.工程变更号");
values.Add("SBItemStatus", "'Y'");
@ -135,7 +139,7 @@ and a.TenantId='{0}'
values.Add("LastModifierUserId", "'" + ConstWorkPoint.Muser + "'");//操作人
values.Add("LastModifierUserName", "'" + ConstWorkPoint.Musername + "'");//操作人名称
values.Add("SBItemContype", "c.ItemContype");
values.Add("SBUseage", "a.AlternateTypeName");
values.Add("Alternate", "a.AlternateTypeName");
values.Add("FixedScrap", "a.固定损耗");
values.Add("Scrap", "a.变动损耗");
values.Add("ScrapType", "a.损耗类型");

48
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
@ -150,6 +166,7 @@ order by a.MoCode, a.OpSeq asc
,RealTime
,ManualTime
,MachiningTotalTime
,EqpTotalTime
,ResQty
,HourDiff
,Status
@ -168,15 +185,36 @@ a.MoCode
,a.TotalTime
,a.PTime
,a.ManualTime
,(a.PTime+cast( a.ManualTime as decimal(18,6) ))
,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'

Loading…
Cancel
Save