| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <?xml version="1.0" encoding="UTF-8"?>
- <queryMap desc = "炉批收发存">
- <query id = "FrmStuffStove.queryData" desc = "查询">
- <![CDATA[
- select JUDGE_STOVE_NO,
- BATCH_NO,
- GROUD_NO,
- sum(ORIGINAL_COUNT)ORIGINAL_COUNT,
- sum(ORIGINAL_AMOUNT)ORIGINAL_AMOUNT,
- sum(DAY_1COUNT)DAY_1COUNT,
- sum(DAY_1)DAY_1,
- sum(MONTH_1COUNT)MONTH_1COUNT,
- sum(MONTH_1)MONTH_1,
- sum(DAY_2COUNT)DAY_2COUNT,
- sum(DAY_2)DAY_2,
- sum(MONTH_2COUNT)MONTH_2COUNT,
- sum(MONTH_2)MONTH_2,
- sum(AWEIGHT)AWEIGHT,
- sum((ORIGINAL_COUNT + MONTH_1COUNT - MONTH_2COUNT)) as END_COUNT,
- sum((ORIGINAL_AMOUNT + MONTH_1 - MONTH_2 + AWEIGHT)) as END_AMOUNT,
- sum(MATCOUNT)MATCOUNT,
- sum(MATWGT)MATWGT,
- sum((ORIGINAL_COUNT + MONTH_1COUNT - MONTH_2COUNT - MATCOUNT)) as QUANTITYCOUNT,
- sum((ORIGINAL_AMOUNT + MONTH_1 - MONTH_2 + AWEIGHT - MATWGT)) as QUANTITYWGT
- from (select JUDGE_STOVE_NO,
- BATCH_NO,
- GROUD_NO,
- storage_no,
- sum(k.ORIGINAL_COUNT) as ORIGINAL_COUNT,
- sum(k.ORIGINAL_AMOUNT) as ORIGINAL_AMOUNT,
- nvl(sum(case
- when trunc(k.INSTOCK_TIME) = to_date(?, 'yyyymmdd') then
- nvl(k.inListCount, 0)
- end),
- 0) DAY_1COUNT,
- nvl(sum(case
- when trunc(k.INSTOCK_TIME) = to_date(?, 'yyyymmdd') then
- nvl(k.inListWgt, 0)
- end),
- 0) DAY_1,
- nvl(sum(case
- when trunc(k.INSTOCK_TIME) >=
- to_date(?, 'yyyymmdd') and
- trunc(k.INSTOCK_TIME) <=
- to_date(?, 'yyyymmdd') then
- nvl(k.inListCount, 0)
- end),
- 0) MONTH_1COUNT,
- nvl(sum(case
- when trunc(k.INSTOCK_TIME) >=
- to_date(?, 'yyyymmdd') and
- trunc(k.INSTOCK_TIME) <=
- to_date(?, 'yyyymmdd') then
- nvl(k.inListWgt, 0)
- end),
- 0) MONTH_1,
- nvl(sum(case
- when trunc(k.OUTSTOCK_TIME) =
- to_date(?, 'yyyymmdd') then
- nvl(k.outListCount, 0)
- end),
- 0) DAY_2COUNT,
- nvl(sum(case
- when trunc(k.OUTSTOCK_TIME) =
- to_date(?, 'yyyymmdd') then
- nvl(k.outListWgt, 0)
- end),
- 0) DAY_2,
- nvl(sum(case
- when trunc(k.OUTSTOCK_TIME) >=
- to_date(?, 'yyyymmdd') and
- trunc(k.OUTSTOCK_TIME) <=
- to_date(?, 'yyyymmdd') then
- nvl(k.outListCount, 0)
- end),
- 0) MONTH_2COUNT,
- nvl(sum(case
- when trunc(k.OUTSTOCK_TIME) >=
- to_date(?, 'yyyymmdd') and
- trunc(k.OUTSTOCK_TIME) <=
- to_date(?, 'yyyymmdd') then
- nvl(k.outListWgt, 0)
- end),
- 0) MONTH_2,
- sum(k.AWEIGHT) as AWEIGHT,
- sum(k.MATCOUNT) as MATCOUNT,
- sum(k.MATWGT) as MATWGT
- from (select JUDGE_STOVE_NO,
- BATCH_NO,
- groud_no,
- storage_no,
- sum(ACT_COUNT) ORIGINAL_COUNT,
- sum(ACT_WEIGHT) ORIGINAL_AMOUNT,
- 0 inListCount,
- 0 inListWgt,
- 0 outListCount,
- 0 outListWgt,
- 0 AWEIGHT,
- 0 MATCOUNT,
- 0 MATWGT,
- null OUTSTOCK_TIME,
- null INSTOCK_TIME
- from ydm_gp_initial t
- where t.bal_year_month = ?
- and t.handle_log = '1'
- and t.storage_no || '&' LIKE ('%' || ? || '%')
- and t.judge_stove_no || '&' LIKE ('%' || ? || '%')
- #condtions#
- group by t.judge_stove_no, t.batch_no, t.groud_no,storage_no
- union all
- SELECT JUDGE_STOVE_NO,
- BATCH_NO,
- groud_no,
- storage_no,
- 0 ORIGINAL_COUNT,
- 0 ORIGINAL_AMOUNT,
- ACT_COUNT inListCount,
- ACT_WEIGHT inListWgt,
- 0 outListCount,
- 0 outListWgt,
- 0 AWEIGHT,
- 0 MATCOUNT,
- 0 MATWGT,
- null OUTSTOCK_TIME,
- INSTOCK_TIME INSTOCK_TIME
- FROM ymd_gp_inlist
- WHERE INSTOCK_TYPE_CODE IN
- ('800701', '800702', '800704', '800706', '800707')
- AND TRUNC(INSTOCK_TIME) >= TO_DATE(?, 'YYYYMMDD')
- AND TRUNC(INSTOCK_TIME) <= TO_DATE(?, 'YYYYMMDD')
- and storage_no || '&' LIKE ('%' || ? || '%')
- and judge_stove_no || '&' LIKE ('%' || ? || '%')
- #condtions#
- union all
- select JUDGE_STOVE_NO,
- BATCH_NO,
- GROUD_NO,
- storage_no,
- 0 ORIGINAL_COUNT,
- 0 ORIGINAL_AMOUNT,
- 0 inListCount,
- 0 inListWgt,
- ACT_COUNT outListCount,
- (case
- when PONDER_NO is null then
- nvl(ACT_WEIGHT, 0)
- else
- nvl(PONDER_GROSS_WT, 0)
- end) outListWgt,
- 0 AWEIGHT,
- 0 MATCOUNT,
- 0 MATWGT,
- OUTSTOCK_TIME OUTSTOCK_TIME,
- null INSTOCK_TIME
- from ymd_gp_outlist
- where OUTSTOCK_TYPE_CODE IN
- ('800805', '800806', '800802', '800808', '800806')
- and TRUNC(OUTSTOCK_TIME) >= TO_DATE(?, 'YYYYMMDD')
- AND TRUNC(OUTSTOCK_TIME) <= TO_DATE(?, 'YYYYMMDD')
- and storage_no || '&' LIKE ('%' || ? || '%')
- and judge_stove_no || '&' LIKE ('%' || ? || '%')
- #condtions#
- union all
- select JUDGE_STOVE_NO,
- BATCH_NO,
- GROUD_NO,storage_no,
- 0 ORIGINAL_COUNT,
- 0 ORIGINAL_AMOUNT,
- 0 inListCount,
- 0 inListWgt,
- 0 outListCount,
- 0 outListWgt,
- sum(ACT_WEIGHT) AWEIGHT,
- 0 MATCOUNT,
- 0 MATWGT,
- null OUTSTOCK_TIME,
- null INSTOCK_TIME
- from ydm_gp_stocktakinglist e
- where TRUNC(e.stocktaking_time) >= to_date(?, 'YYYYMMDD')
- and TRUNC(e.stocktaking_time) <=
- to_date(?, 'YYYYMMDD')
- and e.storage_no || '&' LIKE ('%' || ? || '%')
- and e.judge_stove_no || '&' LIKE ('%' || ? || '%')
- #condtions#
- group by JUDGE_STOVE_NO, BATCH_NO, GROUD_NO,storage_no
- union all
- SELECT F.JUDGE_STOVE_NO,
- F.BATCH_NO,
- F.GROUD_NO,
- g.storage_no,
- 0 ORIGINAL_COUNT,
- 0 ORIGINAL_AMOUNT,
- 0 inListCount,
- 0 inListWgt,
- 0 outListCount,
- 0 outListWgt,
- 0 AWEIGHT,
- sum(F.Act_Count) MATCOUNT,
- sum(F.Act_Weight) MATWGT,
- null OUTSTOCK_TIME,
- null INSTOCK_TIME
- FROM mat_gp_m F, ydm_gp_buttress G
- WHERE F.MAT_NO = G.MAT_NO
- and g.storage_no || '&' LIKE ('%' || ? || '%')
- and f.judge_stove_no || '&' LIKE ('%' || ? || '%')
- #condtions#
- group by F.Judge_Stove_No, F.Batch_No, F.Groud_No,g.storage_no) k
- group by k.Judge_Stove_No, k.Batch_No, k.Groud_No,storage_no) h
- group by JUDGE_STOVE_NO,
- BATCH_NO,
- GROUD_NO
- ]]>
- </query>
- </queryMap>
|