易飛 二 郵件預警 檢查工時底數和暫收明細

2021-08-26 11:15:05 字數 1848 閱讀 4729

--檢查電子-工時底數為1 請及時維護

--條件為在工單乙個月內有生產過的產品

sql:

select mb001 品號,mb002 品名,mb003 規格,mb096 工時底數 from ze.dbo.invmb left join ze.dbo.invml on mb001=ml001 inner join (select distinct ta006 from ze.dbo.mocta where left(ta003,6)=convert(char(6),getdate(),112)) mocta on mb001=ta006 where mb025='m' and mb096=1 and mb002<>'' and left(mb001,1) not in('4','2') and mb017='03' and ml009<>'' and ze.dbo.producttype(mb001)=1 and mb001 in (select ta006 from mocta where datediff(day,ze.dbo.date10(ta003),getdate())<30)

sql:

select datediff(day,substring(t.create_date,1,8),getdate()) 進貨日距今天數 ,ze.dbo.date10(substring(t.create_date,1,8)) 進貨日期, case when th028='0' then '免檢' when th028='1' then '待檢' when th028='2' then '合格' when th028='3' then '不良' else '特採' end 檢驗狀態, t.th001+'-'+rtrim(t.th002)+'-'+t.th003 進貨單,t.th004 品號,t.th005 品名,t.th006 規格,convert(decimal(18,2),t.th007) 進貨數量,t.th008 單位,t.th011+'-'+t.th012 採購單 from ze.dbo.purth t where t.th030='n' 暫收明細表

select  datediff(d,tg003,convert(char(8),getdate(),112)) as  開單日期距今天,

case when th028='1' then '待檢'

when th028='0' then '免檢'

when th028='2' then '合格'

when th028='3' then '不良'

when th028='4' then '特採'

end as 檢驗狀態,

th001+'-'+rtrim(th002)+'-'+th003 as 進貨單,ze.dbo.date10(tg003) as 單據日期,ma002 **商,th004 品號,th005 品名,th006 規格,convert(decimal(18,2),th007) 進貨數量,th008 單位,th010 批號,th011+'-'+rtrim(th012)+'-'+th013 採購單

from ze.dbo.purth

left join ze.dbo.purtg on tg001=th001 and tg002=th002

left join ze.dbo.purma on ma001=tg005

left join ze.dbo.qmsta on ta001=th001 and ta002=th002 and ta003=th003

where datediff(d,tg003,convert(char(8),getdate(),112))>2 and tg013='n' and th028='1' and (ta015 is null or ta015='')

易飛 二 郵件預警 檢查工時底數和暫收明細

檢查電子 工時底數為1 請及時維護 條件為在工單乙個月內有生產過的產品 sql select mb001 品號,mb002 品名,mb003 規格,mb096 工時底數 from ze.dbo.invmb left join ze.dbo.invml on mb001 ml001 inner joi...

易飛 四 郵件預警 生產中工單

sql select mocta.ta001 mocta.ta002 工單,ze.dbo.date10 mocta.ta040 單據日期,mocta.ta006 品號,mocta.ta034 品名,mocta.ta035 規格,ze.dbo.date10 mocta.ta009 預計開工日,ze.d...

易飛 易飛LRP相關SQL

朋友發的易飛lrp相關sql 批次需求計畫系統 重點作業的使用 日誌 是否使用生成批次需求計畫 select case when exists select top 1 progid from dscsys.dbo.worklog with nolock where progid lrpb01 an...