最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
一次编程实践[ASP+MSSQL]
时间:2022-06-30 10:40:56 编辑:袖梨 来源:一聚教程网
本人工作单位是一家橡塑产品制造企业,05年2月单位领导要求我开发一个生产流程数据核对表,用来稽核流程数据的准确性,其报表基本原理如下:
后续工序今日正品数 + 后续工序今日废品数 = 本工序今日正品数 + 本工序今日留存数 - 本工序昨日留存数
了解了原理后马上开工,第一次考虑用临时表:
select distinct LEFT(productid, 4) + '00' as productid into #productid from yuancaiFlow_view
where productiondate = '2004-3-1'
and productid like '01____'
go
select a.productid,
b.productname,
isnull(hj.GoodQty, 0) as hj_good,
isnull(hjtoday.qty, 0) as hj_today,
isnull(hjyesterday.qty, 0) hj_yesterday,
isnull(hj.GoodQty, 0) - isnull(hjtoday.qty, 0) + isnull(hjyesterday.qty, 0) - isnull(sx.GoodQty, 0) - isnull(sx.BadQty, 0) as hj_difference,
isnull(sx.GoodQty, 0) as sx_good,
isnull(sx.BadQty, 0) as sx_bad,
isnull(sxtoday.qty, 0) as sx_today,
isnull(sxyesterday.qty, 0) sx_yesterday,
isnull(sx.GoodQty, 0) - isnull(sxtoday.qty, 0) + isnull(sxyesterday.qty, 0) - isnull(jt.GoodQty, 0) - isnull(jt.BadQty, 0) as sx_difference,
isnull(jt.GoodQty, 0) as jt_good,
isnull(jt.BadQty, 0) as jt_bad,
isnull(jttoday.qty, 0) as jt_today,
isnull(jtyesterday.qty, 0) jt_yesterday,
isnull(jt.GoodQty, 0) - isnull(jttoday.qty, 0) + isnull(jtyesterday.qty, 0) - isnull(ph.GoodQty, 0) - isnull(ph.BadQty, 0) as jt_difference,
后续工序今日正品数 + 后续工序今日废品数 = 本工序今日正品数 + 本工序今日留存数 - 本工序昨日留存数
了解了原理后马上开工,第一次考虑用临时表:
select distinct LEFT(productid, 4) + '00' as productid into #productid from yuancaiFlow_view
where productiondate = '2004-3-1'
and productid like '01____'
go
select a.productid,
b.productname,
isnull(hj.GoodQty, 0) as hj_good,
isnull(hjtoday.qty, 0) as hj_today,
isnull(hjyesterday.qty, 0) hj_yesterday,
isnull(hj.GoodQty, 0) - isnull(hjtoday.qty, 0) + isnull(hjyesterday.qty, 0) - isnull(sx.GoodQty, 0) - isnull(sx.BadQty, 0) as hj_difference,
isnull(sx.GoodQty, 0) as sx_good,
isnull(sx.BadQty, 0) as sx_bad,
isnull(sxtoday.qty, 0) as sx_today,
isnull(sxyesterday.qty, 0) sx_yesterday,
isnull(sx.GoodQty, 0) - isnull(sxtoday.qty, 0) + isnull(sxyesterday.qty, 0) - isnull(jt.GoodQty, 0) - isnull(jt.BadQty, 0) as sx_difference,
isnull(jt.GoodQty, 0) as jt_good,
isnull(jt.BadQty, 0) as jt_bad,
isnull(jttoday.qty, 0) as jt_today,
isnull(jtyesterday.qty, 0) jt_yesterday,
isnull(jt.GoodQty, 0) - isnull(jttoday.qty, 0) + isnull(jtyesterday.qty, 0) - isnull(ph.GoodQty, 0) - isnull(ph.BadQty, 0) as jt_difference,
相关文章
- DNF手游安图恩困难模式怎么打 DNF手游安图恩困难模式攻略技巧 05-17
- 崩坏星穹铁道如狼成就怎么获取 崩坏星穹铁道如狼成就获取方法 05-17
- 不思议迷宫咒灵试炼怎么过 不思议迷宫咒灵试炼攻略 05-17
- 《复体重剪版》游戏攻略 简述+配置+下载 05-17
- 《夜族崛起》无情铁制武器图纸获取攻略 05-17
- 《哈迪斯2》隐藏6个金色信物解锁方法 05-17