|
|
@ -1148,8 +1148,8 @@ SELECT C.molotcode as 销售车号,C.ITEMCODE 物料编码,dd.INVNAME 物料 |
|
|
a.OPCODE 工序代码,ppp.opname 工序名称,us.UserName 报工人,B.UserCodeBegin, |
|
|
a.OPCODE 工序代码,ppp.opname 工序名称,us.UserName 报工人,B.UserCodeBegin, |
|
|
CASE WHEN A.ACTIONRESULT='COLLECT_BEGIN' then '----生产中----' WHEN A.ACTIONRESULT='COLLECT_END' then '----已结束----' end as 工序结束状态, |
|
|
CASE WHEN A.ACTIONRESULT='COLLECT_BEGIN' then '----生产中----' WHEN A.ACTIONRESULT='COLLECT_END' then '----已结束----' end as 工序结束状态, |
|
|
ISNULL(DATEDIFF(MINUTE, B.BeginDateTime, B.EndDateTime) ,0) as '报工时长', |
|
|
ISNULL(DATEDIFF(MINUTE, B.BeginDateTime, B.EndDateTime) ,0) as '报工时长', |
|
|
isnull(CONVERT(VARCHAR,B.BeginDateTime,120),'') 开工时间, |
|
|
|
|
|
isnull(CONVERT(VARCHAR,B.EndDateTime,120),'') 完工时间 ,A.ID,B.ID DetailID,B.BeginDateTime,B.EndDateTime |
|
|
|
|
|
|
|
|
isnull(CONVERT(VARCHAR(19),B.BeginDateTime,21),'') 开工时间, |
|
|
|
|
|
isnull(CONVERT(VARCHAR(19),B.EndDateTime,21),'') 完工时间 ,A.ID,B.ID DetailID,B.BeginDateTime,B.EndDateTime |
|
|
|
|
|
|
|
|
into #TempCCDD_Tt |
|
|
into #TempCCDD_Tt |
|
|
FROM ICSLOTONWIP A with(nolock) |
|
|
FROM ICSLOTONWIP A with(nolock) |
|
|
@ -1164,8 +1164,8 @@ ORDER BY C.molotcode, C.ITEMCODE , us.UserName asc |
|
|
|
|
|
|
|
|
SELECT A.id, |
|
|
SELECT A.id, |
|
|
PP.Usercode , |
|
|
PP.Usercode , |
|
|
pp.BeginTime 开始时间, |
|
|
|
|
|
pp.EndTime 结束时间, |
|
|
|
|
|
|
|
|
isnull(CONVERT(varchar(19), pp.BeginTime, 21),'') 开始时间, |
|
|
|
|
|
isnull( CONVERT(varchar(19), pp.EndTime, 21) ,'') 结束时间, |
|
|
isnull(vv.EnumText,'') 暂停原因 , |
|
|
isnull(vv.EnumText,'') 暂停原因 , |
|
|
DATEDIFF(MINUTE, PP.BeginTime, PP.EndTime) 暂停时长 |
|
|
DATEDIFF(MINUTE, PP.BeginTime, PP.EndTime) 暂停时长 |
|
|
into #TempFFF |
|
|
into #TempFFF |
|
|
@ -1264,17 +1264,31 @@ ORDER BY 销售车号, 物料编码 ,报工人 asc |
|
|
drop table #tempNum |
|
|
drop table #tempNum |
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TempMOCCOM')) |
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#TempMOCCOM')) |
|
|
drop table #TempMOCCOM |
|
|
drop table #TempMOCCOM |
|
|
|
|
|
|
|
|
|
|
|
if exists(select * from tempdb..sysobjects where id=object_id('tempdb..#Tempcccc')) |
|
|
|
|
|
drop table #Tempcccc |
|
|
|
|
|
|
|
|
select distinct tso.socode 销售车辆号,convert(varchar(10),tso.plandate,120) as 客户交货期, |
|
|
select distinct tso.socode 销售车辆号,convert(varchar(10),tso.plandate,120) as 客户交货期, |
|
|
isnull(convert(char(4),cus.fname),'') 用户单位, ISNULL(inv.invname,'') as 产品名称 |
|
|
|
|
|
|
|
|
isnull(convert(char(4),cus.fname),'') 用户单位--, -- ISNULL(inv.invname,'') as 产品名称 |
|
|
into #TempSSCC |
|
|
into #TempSSCC |
|
|
from |
|
|
from |
|
|
icsso tso with(nolock) |
|
|
icsso tso with(nolock) |
|
|
left join ICSCustomer cus with(nolock) on tso.cusid = cus.FCUSTID |
|
|
left join ICSCustomer cus with(nolock) on tso.cusid = cus.FCUSTID |
|
|
left join icsmo tmo with(nolock) on tso.socode = tmo.molotcode |
|
|
left join icsmo tmo with(nolock) on tso.socode = tmo.molotcode |
|
|
left join ICSINVENTORY inv with(nolock) on inv.invcode=tmo.itemcode |
|
|
|
|
|
|
|
|
-- left join ICSINVENTORY inv with(nolock) on inv.invstd like tso.socode --tmo.itemcode |
|
|
where tso.status = 'C' and tmo.id in(select moid from ICSMO2ROUTE with(nolock) ) |
|
|
where tso.status = 'C' and tmo.id in(select moid from ICSMO2ROUTE with(nolock) ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select 销售车辆号,产品名称 |
|
|
|
|
|
into #Tempcccc from ( |
|
|
|
|
|
select ss.销售车辆号 ,row_number() over (partition by ss.销售车辆号 |
|
|
|
|
|
order by case when inv.invname like '%车' then 0 else 1 end ,inv.invname desc,inv.id) rn , inv.invname 产品名称 |
|
|
|
|
|
from #TempSSCC ss |
|
|
|
|
|
left join ICSINVENTORY inv on inv.invstd like '%'+ss.销售车辆号+'%' |
|
|
|
|
|
) hh |
|
|
|
|
|
where rn=1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select count(id) wipnum,molotcode |
|
|
select count(id) wipnum,molotcode |
|
|
into #TempMOCCOM |
|
|
into #TempMOCCOM |
|
|
@ -1302,11 +1316,11 @@ ORDER BY 销售车号, 物料编码 ,报工人 asc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
select row_number() over (order by a.客户交货期,a.销售车辆号)as 序号, a.* |
|
|
|
|
|
|
|
|
select row_number() over (order by a.客户交货期,a.销售车辆号)as 序号, a.* ,cc.产品名称 |
|
|
from ( |
|
|
from ( |
|
|
|
|
|
|
|
|
select tso.销售车辆号, 客户交货期, 用户单位, |
|
|
select tso.销售车辆号, 客户交货期, 用户单位, |
|
|
产品名称, |
|
|
|
|
|
|
|
|
-- 产品名称, |
|
|
CASE WHEN ISNULL(tnum.monum,0) =0 THEN '0%' ELSE |
|
|
CASE WHEN ISNULL(tnum.monum,0) =0 THEN '0%' ELSE |
|
|
concat(cast(cast(tnum.wipnum * 1.0 / tnum.monum as decimal(18,3))* 100 as decimal(18,0)),'%') END 进度, |
|
|
concat(cast(cast(tnum.wipnum * 1.0 / tnum.monum as decimal(18,3))* 100 as decimal(18,0)),'%') END 进度, |
|
|
CASE WHEN ISNULL(tnum.monum,0) =0 THEN '未开工' ELSE (case when tnum.wipnum/tnum.monum =1 then '已完工' when tnum.wipbnum >0 then '开工中' else '未开工' end ) END 生产状态 |
|
|
CASE WHEN ISNULL(tnum.monum,0) =0 THEN '未开工' ELSE (case when tnum.wipnum/tnum.monum =1 then '已完工' when tnum.wipbnum >0 then '开工中' else '未开工' end ) END 生产状态 |
|
|
@ -1314,6 +1328,7 @@ ORDER BY 销售车号, 物料编码 ,报工人 asc |
|
|
left join #tempNum tnum on tnum.销售车辆号 = tso.销售车辆号 |
|
|
left join #tempNum tnum on tnum.销售车辆号 = tso.销售车辆号 |
|
|
|
|
|
|
|
|
) a |
|
|
) a |
|
|
|
|
|
left join #Tempcccc cc on a.销售车辆号=cc.销售车辆号 |
|
|
";
|
|
|
";
|
|
|
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null); |
|
|
DataTable dt = Repository().GetDataTableBySql_Other(SqlText, "MESconnstr", null); |
|
|
|
|
|
|
|
|
|