FrmStuffStove.xml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <queryMap desc = "炉批收发存">
  3. <query id = "FrmStuffStove.queryData" desc = "查询">
  4. <![CDATA[
  5. select JUDGE_STOVE_NO,
  6. BATCH_NO,
  7. GROUD_NO,
  8. sum(ORIGINAL_COUNT)ORIGINAL_COUNT,
  9. sum(ORIGINAL_AMOUNT)ORIGINAL_AMOUNT,
  10. sum(DAY_1COUNT)DAY_1COUNT,
  11. sum(DAY_1)DAY_1,
  12. sum(MONTH_1COUNT)MONTH_1COUNT,
  13. sum(MONTH_1)MONTH_1,
  14. sum(DAY_2COUNT)DAY_2COUNT,
  15. sum(DAY_2)DAY_2,
  16. sum(MONTH_2COUNT)MONTH_2COUNT,
  17. sum(MONTH_2)MONTH_2,
  18. sum(AWEIGHT)AWEIGHT,
  19. sum((ORIGINAL_COUNT + MONTH_1COUNT - MONTH_2COUNT)) as END_COUNT,
  20. sum((ORIGINAL_AMOUNT + MONTH_1 - MONTH_2 + AWEIGHT)) as END_AMOUNT,
  21. sum(MATCOUNT)MATCOUNT,
  22. sum(MATWGT)MATWGT,
  23. sum((ORIGINAL_COUNT + MONTH_1COUNT - MONTH_2COUNT - MATCOUNT)) as QUANTITYCOUNT,
  24. sum((ORIGINAL_AMOUNT + MONTH_1 - MONTH_2 + AWEIGHT - MATWGT)) as QUANTITYWGT
  25. from (select JUDGE_STOVE_NO,
  26. BATCH_NO,
  27. GROUD_NO,
  28. storage_no,
  29. sum(k.ORIGINAL_COUNT) as ORIGINAL_COUNT,
  30. sum(k.ORIGINAL_AMOUNT) as ORIGINAL_AMOUNT,
  31. nvl(sum(case
  32. when trunc(k.INSTOCK_TIME) = to_date(?, 'yyyymmdd') then
  33. nvl(k.inListCount, 0)
  34. end),
  35. 0) DAY_1COUNT,
  36. nvl(sum(case
  37. when trunc(k.INSTOCK_TIME) = to_date(?, 'yyyymmdd') then
  38. nvl(k.inListWgt, 0)
  39. end),
  40. 0) DAY_1,
  41. nvl(sum(case
  42. when trunc(k.INSTOCK_TIME) >=
  43. to_date(?, 'yyyymmdd') and
  44. trunc(k.INSTOCK_TIME) <=
  45. to_date(?, 'yyyymmdd') then
  46. nvl(k.inListCount, 0)
  47. end),
  48. 0) MONTH_1COUNT,
  49. nvl(sum(case
  50. when trunc(k.INSTOCK_TIME) >=
  51. to_date(?, 'yyyymmdd') and
  52. trunc(k.INSTOCK_TIME) <=
  53. to_date(?, 'yyyymmdd') then
  54. nvl(k.inListWgt, 0)
  55. end),
  56. 0) MONTH_1,
  57. nvl(sum(case
  58. when trunc(k.OUTSTOCK_TIME) =
  59. to_date(?, 'yyyymmdd') then
  60. nvl(k.outListCount, 0)
  61. end),
  62. 0) DAY_2COUNT,
  63. nvl(sum(case
  64. when trunc(k.OUTSTOCK_TIME) =
  65. to_date(?, 'yyyymmdd') then
  66. nvl(k.outListWgt, 0)
  67. end),
  68. 0) DAY_2,
  69. nvl(sum(case
  70. when trunc(k.OUTSTOCK_TIME) >=
  71. to_date(?, 'yyyymmdd') and
  72. trunc(k.OUTSTOCK_TIME) <=
  73. to_date(?, 'yyyymmdd') then
  74. nvl(k.outListCount, 0)
  75. end),
  76. 0) MONTH_2COUNT,
  77. nvl(sum(case
  78. when trunc(k.OUTSTOCK_TIME) >=
  79. to_date(?, 'yyyymmdd') and
  80. trunc(k.OUTSTOCK_TIME) <=
  81. to_date(?, 'yyyymmdd') then
  82. nvl(k.outListWgt, 0)
  83. end),
  84. 0) MONTH_2,
  85. sum(k.AWEIGHT) as AWEIGHT,
  86. sum(k.MATCOUNT) as MATCOUNT,
  87. sum(k.MATWGT) as MATWGT
  88. from (select JUDGE_STOVE_NO,
  89. BATCH_NO,
  90. groud_no,
  91. storage_no,
  92. sum(ACT_COUNT) ORIGINAL_COUNT,
  93. sum(ACT_WEIGHT) ORIGINAL_AMOUNT,
  94. 0 inListCount,
  95. 0 inListWgt,
  96. 0 outListCount,
  97. 0 outListWgt,
  98. 0 AWEIGHT,
  99. 0 MATCOUNT,
  100. 0 MATWGT,
  101. null OUTSTOCK_TIME,
  102. null INSTOCK_TIME
  103. from ydm_gp_initial t
  104. where t.bal_year_month = ?
  105. and t.handle_log = '1'
  106. and t.storage_no || '&' LIKE ('%' || ? || '%')
  107. and t.judge_stove_no || '&' LIKE ('%' || ? || '%')
  108. #condtions#
  109. group by t.judge_stove_no, t.batch_no, t.groud_no,storage_no
  110. union all
  111. SELECT JUDGE_STOVE_NO,
  112. BATCH_NO,
  113. groud_no,
  114. storage_no,
  115. 0 ORIGINAL_COUNT,
  116. 0 ORIGINAL_AMOUNT,
  117. ACT_COUNT inListCount,
  118. ACT_WEIGHT inListWgt,
  119. 0 outListCount,
  120. 0 outListWgt,
  121. 0 AWEIGHT,
  122. 0 MATCOUNT,
  123. 0 MATWGT,
  124. null OUTSTOCK_TIME,
  125. INSTOCK_TIME INSTOCK_TIME
  126. FROM ymd_gp_inlist
  127. WHERE INSTOCK_TYPE_CODE IN
  128. ('800701', '800702', '800704', '800706', '800707')
  129. AND TRUNC(INSTOCK_TIME) >= TO_DATE(?, 'YYYYMMDD')
  130. AND TRUNC(INSTOCK_TIME) <= TO_DATE(?, 'YYYYMMDD')
  131. and storage_no || '&' LIKE ('%' || ? || '%')
  132. and judge_stove_no || '&' LIKE ('%' || ? || '%')
  133. #condtions#
  134. union all
  135. select JUDGE_STOVE_NO,
  136. BATCH_NO,
  137. GROUD_NO,
  138. storage_no,
  139. 0 ORIGINAL_COUNT,
  140. 0 ORIGINAL_AMOUNT,
  141. 0 inListCount,
  142. 0 inListWgt,
  143. ACT_COUNT outListCount,
  144. (case
  145. when PONDER_NO is null then
  146. nvl(ACT_WEIGHT, 0)
  147. else
  148. nvl(PONDER_GROSS_WT, 0)
  149. end) outListWgt,
  150. 0 AWEIGHT,
  151. 0 MATCOUNT,
  152. 0 MATWGT,
  153. OUTSTOCK_TIME OUTSTOCK_TIME,
  154. null INSTOCK_TIME
  155. from ymd_gp_outlist
  156. where OUTSTOCK_TYPE_CODE IN
  157. ('800805', '800806', '800802', '800808', '800806')
  158. and TRUNC(OUTSTOCK_TIME) >= TO_DATE(?, 'YYYYMMDD')
  159. AND TRUNC(OUTSTOCK_TIME) <= TO_DATE(?, 'YYYYMMDD')
  160. and storage_no || '&' LIKE ('%' || ? || '%')
  161. and judge_stove_no || '&' LIKE ('%' || ? || '%')
  162. #condtions#
  163. union all
  164. select JUDGE_STOVE_NO,
  165. BATCH_NO,
  166. GROUD_NO,storage_no,
  167. 0 ORIGINAL_COUNT,
  168. 0 ORIGINAL_AMOUNT,
  169. 0 inListCount,
  170. 0 inListWgt,
  171. 0 outListCount,
  172. 0 outListWgt,
  173. sum(ACT_WEIGHT) AWEIGHT,
  174. 0 MATCOUNT,
  175. 0 MATWGT,
  176. null OUTSTOCK_TIME,
  177. null INSTOCK_TIME
  178. from ydm_gp_stocktakinglist e
  179. where TRUNC(e.stocktaking_time) >= to_date(?, 'YYYYMMDD')
  180. and TRUNC(e.stocktaking_time) <=
  181. to_date(?, 'YYYYMMDD')
  182. and e.storage_no || '&' LIKE ('%' || ? || '%')
  183. and e.judge_stove_no || '&' LIKE ('%' || ? || '%')
  184. #condtions#
  185. group by JUDGE_STOVE_NO, BATCH_NO, GROUD_NO,storage_no
  186. union all
  187. SELECT F.JUDGE_STOVE_NO,
  188. F.BATCH_NO,
  189. F.GROUD_NO,
  190. g.storage_no,
  191. 0 ORIGINAL_COUNT,
  192. 0 ORIGINAL_AMOUNT,
  193. 0 inListCount,
  194. 0 inListWgt,
  195. 0 outListCount,
  196. 0 outListWgt,
  197. 0 AWEIGHT,
  198. sum(F.Act_Count) MATCOUNT,
  199. sum(F.Act_Weight) MATWGT,
  200. null OUTSTOCK_TIME,
  201. null INSTOCK_TIME
  202. FROM mat_gp_m F, ydm_gp_buttress G
  203. WHERE F.MAT_NO = G.MAT_NO
  204. and g.storage_no || '&' LIKE ('%' || ? || '%')
  205. and f.judge_stove_no || '&' LIKE ('%' || ? || '%')
  206. #condtions#
  207. group by F.Judge_Stove_No, F.Batch_No, F.Groud_No,g.storage_no) k
  208. group by k.Judge_Stove_No, k.Batch_No, k.Groud_No,storage_no) h
  209. group by JUDGE_STOVE_NO,
  210. BATCH_NO,
  211. GROUD_NO
  212. ]]>
  213. </query>
  214. </queryMap>