TotalProduction.xml 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <queryMap desc = "产量信息统计">
  3. <query id = "FrmrptTotalProduct.get_TotalProductionData_Insert" desc = "A、B、D、E、F、G产量信息查询">
  4. <![CDATA[
  5. BEGIN
  6. delete from TEMP_TAB_RPT_PRODUCTION;
  7. insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction,
  8. outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input,
  9. output, firstgood,totalinput,totaloutput,totalfirstgood)
  10. select '#today#' as productiondate,'A' as processcode
  11. ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  12. ,to_char(production_d,'FM9,999,990.000') as production
  13. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  14. ,(select to_char(sum(nvl(t.TAPPINGWGT,0)),'FM9,999,999.000')
  15. from stl_eaf_optinfo t
  16. where to_char(t.OPTDATE+3/24,'yyyyMMdd')=replace('#today#','-','')
  17. and nvl((select t1.ef_pline_code from stl_control_log t1
  18. where t.stove_no=t1.stove_no and rownum=1),
  19. (select t2.ef_pline_code from pln_steelforfurnace t2
  20. where t.stove_no=t2.stove_no and rownum=1))=a.pline_code) as output
  21. ,(select to_char(sum(nvl(t.TAPPINGWGT,0)),'FM999,999.000')
  22. from stl_eaf_optinfo t
  23. where substr(to_char(t.OPTDATE+3/24,'yyyyMMdd'),1,6)=replace(substr('#today#',1,7),'-','')
  24. and to_char(t.OPTDATE+3/24,'yyyyMMdd')<=replace('#today#','-','')
  25. and nvl((select t1.ef_pline_code from stl_control_log t1
  26. where t.stove_no=t1.stove_no and rownum=1),
  27. (select t2.ef_pline_code from pln_steelforfurnace t2
  28. where t.stove_no=t2.stove_no and rownum=1))=a.pline_code) as totaloutput
  29. ,'' as productionrate,'' as firstgoodrate
  30. ,'' as productionrate_m,'' as firstgoodrate_m
  31. ,to_number(null) as input,to_number(null) as output,to_number(null) as firstgood
  32. ,to_number(null) as totalinput,to_number(null) as totaloutput,to_number(null) as totalfirstgood
  33. from v_production_a_pline a
  34. left join (select t.pline_code,sum(t.production) as production_m
  35. from v_production_a t
  36. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  37. and t.proc_date<=replace('#today#','-','')
  38. group by t.pline_code) x on x.pline_code=a.pline_code
  39. left join (select t.pline_code,sum(t.production) as production_d
  40. from v_production_a t
  41. where t.proc_date=replace('#today#','-','')
  42. group by t.pline_code) y on y.pline_code=a.pline_code
  43. where x.production_m is not null
  44. order by a.department_code_p,a.factory_code,a.pline_code;
  45. insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction,
  46. outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input,
  47. output, firstgood,totalinput,totaloutput,totalfirstgood)
  48. select '#today#' as productiondate,'B' as processcode
  49. ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  50. ,to_char(production_d,'FM9,999,990.000') as production
  51. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  52. ,to_char((select sum(t.weight) --合格量
  53. from v_production_b_pweight t
  54. where t.proc_date=replace('#today#','-','')
  55. and t.pline_code=a.pline_code),'FM9,999,999.000') as outputweight
  56. ,to_char((select sum(t.weight) --合格量
  57. from v_production_b_pweight t
  58. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  59. and t.proc_date<=replace('#today#','-','')
  60. and t.pline_code=a.pline_code),'FM9,999,999.000') as totaloutputweight
  61. ,'' as productionrate ,'' as firstgoodrate
  62. ,'' as productionrate_m ,'' as firstgoodrate_m
  63. ,y.output_d as input,y.output_d as output,y.firstgood_d as firstgood
  64. ,x.output_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  65. from v_production_b_pline a
  66. left join (select t.pline_code
  67. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  68. from v_production_b_new t
  69. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  70. and t.proc_date<=replace('#today#','-','')
  71. group by t.pline_code) x on x.pline_code=a.pline_code
  72. left join
  73. (select t.pline_code
  74. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  75. from v_production_b_new t
  76. where t.proc_date=replace('#today#','-','')
  77. group by t.pline_code) y on y.pline_code=a.pline_code
  78. where (select sum(t.weight) --合格量
  79. from v_production_b_pweight t
  80. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  81. and to_char(t.product_TIME+3/24,'yyyyMMdd')<=replace('#today#','-','')
  82. and t.pline_code=a.pline_code) is not null or production_m is not null
  83. order by a.department_code_p,a.factory_code,a.pline_code;
  84. insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction,
  85. outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input,
  86. output, firstgood,totalinput,totaloutput,totalfirstgood)
  87. select '#today#' as productiondate,'D' as processcode
  88. ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  89. ,to_char(production_d,'FM9,999,990.000') as production
  90. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  91. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  92. from v_production_d_pweight y
  93. where y.proc_date=replace('#today#','-','') and qualified_wt>0
  94. and y.pline_code=x.pline_code) as outputweight
  95. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  96. from v_production_d_pweight y
  97. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  98. and y.proc_date<=replace('#today#','-','') and qualified_wt>0
  99. and y.pline_code=x.pline_code) as totaloutputweight
  100. ,'' as productionrate
  101. ,'' as firstgoodrate
  102. ,'' as productionrate_m
  103. ,'' as firstgoodrate_m
  104. ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  105. ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  106. from v_production_d_pline a
  107. left join (select t.pline_code,sum(t.input) as input_m,sum(t.outputweight) as outputweight_m
  108. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  109. from v_production_d_new t
  110. where substr(t.production_date,1,7)=substr('#today#',1,7)
  111. and t.production_date<='#today#'
  112. group by t.pline_code) x on x.pline_code=a.pline_code
  113. left join
  114. (select t.pline_code,sum(t.input) as input_d
  115. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.outputweight) as outputweight_d
  116. from v_production_d_new t
  117. where t.production_date='#today#'
  118. group by t.pline_code) y on y.pline_code=a.pline_code
  119. where (select sum(y.qualified_wt)
  120. from v_production_d_pweight y
  121. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  122. and y.proc_date<=replace('#today#','-','') and qualified_wt>0
  123. and y.pline_code=x.pline_code) is not null or production_m is not null
  124. order by a.department_code_p,a.factory_code,a.pline_code;
  125. insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction,
  126. outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input,
  127. output, firstgood,totalinput,totaloutput,totalfirstgood)
  128. select '#today#' as productiondate,'E' as processcode
  129. ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  130. ,to_char(production_d,'FM9,999,990.000') as production
  131. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  132. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  133. from v_production_e_pweight y
  134. where y.proc_date=replace('#today#','-','')
  135. and y.pline_code=x.pline_code) as outputweight
  136. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  137. from v_production_e_pweight y
  138. where bal_year_month=replace(substr('#today#',1,7),'-','')
  139. and y.proc_date<=replace('#today#','-','')
  140. and y.pline_code=x.pline_code) as totaloutputweight
  141. ,'' as productionrate
  142. ,'' as firstgoodrate
  143. ,'' as productionrate_m
  144. ,'' as firstgoodrate_m
  145. ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  146. ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  147. from v_production_e_pline a
  148. left join
  149. (select t.pline_code,sum(t.input) as input_m,sum(t.output_weight) as outputweight_m
  150. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  151. from v_production_e t
  152. where substr(t.production_date,1,7)=substr('#today#',1,7)
  153. and t.production_date<='#today#'
  154. group by t.pline_code) x on x.pline_code=a.pline_code
  155. left join
  156. (select t.pline_code,sum(t.input) as input_d
  157. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
  158. from v_production_e t
  159. where t.production_date='#today#'
  160. group by t.pline_code) y on y.pline_code=a.pline_code
  161. where (select sum(y.qualified_wt)
  162. from v_production_e_pweight y
  163. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  164. and y.proc_date<=replace('#today#','-','')
  165. and y.pline_code=x.pline_code) is not null or production_m is not null
  166. order by a.department_code_p,a.factory_code,a.pline_code;
  167. insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction,
  168. outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input,
  169. output, firstgood,totalinput,totaloutput,totalfirstgood)
  170. select '#today#' as productiondate,'F' as processcode
  171. ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  172. ,to_char(production_d,'FM9,999,990.000') as production
  173. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  174. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  175. from v_production_f_pweight y
  176. where proc_date=replace('#today#','-','')
  177. and y.pline_code=x.pline_code) as outputweight
  178. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  179. from v_production_f_pweight y
  180. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  181. and y.proc_date<=replace('#today#','-','')
  182. and y.pline_code=x.pline_code) as totaloutputweight
  183. ,'' as productionrate
  184. ,'' as firstgoodrate
  185. ,'' as productionrate_m
  186. ,'' as firstgoodrate_m
  187. ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  188. ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  189. from v_production_f_pline a
  190. left join
  191. (select t.pline_code,sum(t.input) as input_m,sum(t.output_weight) as outputweight_m
  192. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  193. from v_production_f t
  194. where substr(t.production_date,1,7)=substr('#today#',1,7)
  195. and t.production_date<='#today#'
  196. group by t.pline_code) x on x.pline_code=a.pline_code
  197. left join
  198. (select t.pline_code,sum(t.input) as input_d
  199. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
  200. from v_production_f t
  201. where t.production_date='#today#'
  202. group by t.pline_code) y on y.pline_code=a.pline_code
  203. where (select sum(y.qualified_wt)
  204. from v_production_f_pweight y
  205. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  206. and y.proc_date<=replace('#today#','-','')
  207. and y.pline_code=x.pline_code) is not null or production_m is not null
  208. order by a.department_code_p,a.factory_code,a.pline_code;
  209. insert into TEMP_TAB_RPT_PRODUCTION (productiondate, processcode,area,dept,plinename,production,totalproduction,
  210. outputweight, totaloutputweight,productionrate,firstgoodrate,productionrate_m,firstgoodrate_m,input,
  211. output, firstgood,totalinput,totaloutput,totalfirstgood)
  212. select '#today#' as productiondate,'G' as processcode
  213. ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  214. ,to_char(production_d,'FM9,999,990.000') as production
  215. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  216. ,(select to_char(sum(qualified_wt),'FM9,999,990.000')
  217. from v_production_g_pweight t --生产点
  218. where proc_date=replace('#today#','-','')
  219. and t.pline_code=a.pline_code) as outputweight
  220. ,(select to_char(sum(qualified_wt),'FM9,999,990.000')
  221. from v_production_g_pweight t --生产点
  222. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  223. and proc_date<=replace('#today#','-','')
  224. and t.pline_code=a.pline_code) as totaloutputweight
  225. ,'' as productionrate
  226. ,'' as firstgoodrate
  227. ,'' as productionrate_m
  228. ,'' as firstgoodrate_m
  229. ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  230. ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  231. from v_production_g_pline a
  232. left join
  233. (select t.pline_code,sum(t.input) as input_m
  234. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m,sum(t.output_weight) as outputweight_m
  235. from v_production_g t
  236. where substr(t.production_date,1,7)=substr('#today#',1,7)
  237. and t.production_date<='#today#'
  238. group by t.pline_code) x on x.pline_code=a.pline_code
  239. left join
  240. (select t.pline_code,sum(t.input) as input_d
  241. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
  242. from v_production_g t
  243. where t.production_date='#today#'
  244. group by t.pline_code) y on y.pline_code=a.pline_code
  245. where (select sum(qualified_wt)
  246. from v_production_g_pweight t --生产点
  247. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  248. and proc_date<=replace('#today#','-','')
  249. and t.pline_code=a.pline_code) is not null or production_m is not null
  250. order by a.department_code_p,a.factory_code,a.pline_code;
  251. commit;
  252. end;
  253. ]]>
  254. </query>
  255. <query id = "FrmrptTotalProduct.get_TotalProductionData_Select" desc = "A、B、D、E、F、G产量信息查询">
  256. <![CDATA[
  257. select * from TEMP_TAB_RPT_PRODUCTION where productiondate='#today#'
  258. ]]>
  259. </query>
  260. <query id = "FrmrptTotalProduct.get_TotalProductionData0" desc = "A、B、D、E、F、G产量信息查询">
  261. <![CDATA[
  262. select * from (select '#today#' as productiondate,'A' as processcode
  263. ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  264. ,to_char(production_d,'FM9,999,990.000') as production
  265. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  266. ,to_char(production_d,'FM9,999,990.000') as outputweight
  267. ,to_char(production_m,'FM9,999,990.000') as totaloutputweight
  268. ,'' as productionrate,'' as firstgoodrate
  269. ,'' as productionrate_m,'' as firstgoodrate_m
  270. ,to_number(null) as input,to_number(null) as output,to_number(null) as firstgood
  271. ,to_number(null) as totalinput,to_number(null) as totaloutput,to_number(null) as totalfirstgood
  272. from v_production_a_pline a
  273. left join (select t.pline_code,sum(t.production) as production_m
  274. from v_production_a t
  275. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  276. and t.proc_date<=replace('#today#','-','')
  277. group by t.pline_code) x on x.pline_code=a.pline_code
  278. left join (select t.pline_code,sum(t.production) as production_d
  279. from v_production_a t
  280. where t.proc_date=replace('#today#','-','')
  281. group by t.pline_code) y on y.pline_code=a.pline_code
  282. where x.production_m is not null
  283. order by a.department_code_p,a.factory_code,a.pline_code)
  284. union all
  285. select * from (select '#today#' as productiondate,'B' as processcode
  286. ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  287. ,to_char(production_d,'FM9,999,990.000') as production
  288. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  289. ,to_char((select sum(t.weight) --合格量
  290. from v_production_b_pweight t
  291. where t.proc_date=replace('#today#','-','')
  292. and t.pline_code=a.pline_code),'FM999999.000') as outputweight
  293. ,to_char((select sum(t.weight) --合格量
  294. from v_production_b_pweight t
  295. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  296. and t.proc_date<=replace('#today#','-','')
  297. and t.pline_code=a.pline_code),'FM999999.000') as totaloutputweight
  298. ,'' as productionrate ,'' as firstgoodrate
  299. ,'' as productionrate_m ,'' as firstgoodrate_m
  300. ,y.output_d as input,y.output_d as output,y.firstgood_d as firstgood
  301. ,x.output_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  302. from v_production_b_pline a
  303. left join (select t.pline_code
  304. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  305. from v_production_b_new t
  306. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  307. and t.proc_date<=replace('#today#','-','')
  308. group by t.pline_code) x on x.pline_code=a.pline_code
  309. left join
  310. (select t.pline_code
  311. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  312. from v_production_b_new t
  313. where t.proc_date=replace('#today#','-','')
  314. group by t.pline_code) y on y.pline_code=a.pline_code
  315. where/* (select sum(t.weight) --合格量+废品
  316. from v_production_b_pweight t
  317. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  318. and to_char(t.product_TIME+3/24,'yyyyMMdd')<=replace('#today#','-','')
  319. and t.pline_code=a.pline_code) is not null or */production_m is not null
  320. order by a.department_code_p,a.factory_code,a.pline_code)
  321. union all
  322. select * from (select '#today#' as productiondate,'D' as processcode
  323. ,a.department_desc_p as area ,a.factoryname as dept,a.pline_name as plinename
  324. ,to_char(production_d,'FM9,999,990.000') as production
  325. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  326. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  327. from v_production_d_pweight y
  328. where y.proc_date=replace('#today#','-','') and qualified_wt>0
  329. and y.pline_code=x.pline_code) as outputweight
  330. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  331. from v_production_d_pweight y
  332. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  333. and y.proc_date<=replace('#today#','-','') and qualified_wt>0
  334. and y.pline_code=x.pline_code) as totaloutputweight
  335. ,'' as productionrate
  336. ,'' as firstgoodrate
  337. ,'' as productionrate_m
  338. ,'' as firstgoodrate_m
  339. ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  340. ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  341. from v_production_d_pline a
  342. left join (select t.pline_code,sum(t.input) as input_m,sum(t.outputweight) as outputweight_m
  343. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  344. from v_production_d_new t
  345. where substr(t.production_date,1,7)=substr('#today#',1,7)
  346. and t.production_date<='#today#'
  347. group by t.pline_code) x on x.pline_code=a.pline_code
  348. left join
  349. (select t.pline_code,sum(t.input) as input_d
  350. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.outputweight) as outputweight_d
  351. from v_production_d_new t
  352. where t.production_date='#today#'
  353. group by t.pline_code) y on y.pline_code=a.pline_code
  354. where (select sum(y.qualified_wt)
  355. from v_production_d_pweight y
  356. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  357. and y.proc_date<=replace('#today#','-','') and qualified_wt>0
  358. and y.pline_code=x.pline_code) is not null or production_m is not null
  359. order by a.department_code_p,a.factory_code,a.pline_code)
  360. union all
  361. select * from (select '#today#' as productiondate,'E' as processcode
  362. ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  363. ,to_char(production_d,'FM9,999,990.000') as production
  364. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  365. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  366. from v_production_e_pweight y
  367. where y.proc_date=replace('#today#','-','')
  368. and y.pline_code=x.pline_code) as outputweight
  369. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  370. from v_production_e_pweight y
  371. where bal_year_month=replace(substr('#today#',1,7),'-','')
  372. and y.proc_date<=replace('#today#','-','')
  373. and y.pline_code=x.pline_code) as totaloutputweight
  374. ,'' as productionrate
  375. ,'' as firstgoodrate
  376. ,'' as productionrate_m
  377. ,'' as firstgoodrate_m
  378. ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  379. ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  380. from v_production_e_pline a
  381. left join
  382. (select t.pline_code,sum(t.input) as input_m,sum(t.output_weight) as outputweight_m
  383. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  384. from v_production_e t
  385. where substr(t.production_date,1,7)=substr('#today#',1,7)
  386. and t.production_date<='#today#'
  387. group by t.pline_code) x on x.pline_code=a.pline_code
  388. left join
  389. (select t.pline_code,sum(t.input) as input_d
  390. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
  391. from v_production_e t
  392. where t.production_date='#today#'
  393. group by t.pline_code) y on y.pline_code=a.pline_code
  394. where (select sum(y.qualified_wt)
  395. from v_production_e_pweight y
  396. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  397. and y.proc_date<=replace('#today#','-','')
  398. and y.pline_code=x.pline_code) is not null or production_m is not null
  399. order by a.department_code_p,a.factory_code,a.pline_code)
  400. union all
  401. select * from (select '#today#' as productiondate,'F' as processcode
  402. ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  403. ,to_char(production_d,'FM9,999,990.000') as production
  404. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  405. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  406. from v_production_f_pweight y
  407. where proc_date=replace('#today#','-','')
  408. and y.pline_code=x.pline_code) as outputweight
  409. ,(select to_char(sum(y.qualified_wt),'FM9,999,990.000')
  410. from v_production_f_pweight y
  411. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  412. and y.proc_date<=replace('#today#','-','')
  413. and y.pline_code=x.pline_code) as totaloutputweight
  414. ,'' as productionrate
  415. ,'' as firstgoodrate
  416. ,'' as productionrate_m
  417. ,'' as firstgoodrate_m
  418. ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  419. ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  420. from v_production_f_pline a
  421. left join
  422. (select t.pline_code,sum(t.input) as input_m,sum(t.output_weight) as outputweight_m
  423. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  424. from v_production_f t
  425. where substr(t.production_date,1,7)=substr('#today#',1,7)
  426. and t.production_date<='#today#'
  427. group by t.pline_code) x on x.pline_code=a.pline_code
  428. left join
  429. (select t.pline_code,sum(t.input) as input_d
  430. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
  431. from v_production_f t
  432. where t.production_date='#today#'
  433. group by t.pline_code) y on y.pline_code=a.pline_code
  434. where (select sum(y.qualified_wt)
  435. from v_production_f_pweight y
  436. where y.bal_year_month=replace(substr('#today#',1,7),'-','')
  437. and y.proc_date<=replace('#today#','-','')
  438. and y.pline_code=x.pline_code) is not null or production_m is not null
  439. order by a.department_code_p,a.factory_code,a.pline_code)
  440. union all
  441. select * from (select '#today#' as productiondate,'G' as processcode
  442. ,a.department_desc_p,a.factoryname,a.pline_name as plinename
  443. ,to_char(production_d,'FM9,999,990.000') as production
  444. ,to_char(production_m,'FM9,999,990.000') as totalproduction
  445. ,(select to_char(sum(qualified_wt),'FM9,999,990.000')
  446. from v_production_g_pweight t --生产点
  447. where proc_date=replace('#today#','-','')
  448. and t.pline_code=a.pline_code) as outputweight
  449. ,(select to_char(sum(qualified_wt),'FM9,999,990.000')
  450. from v_production_g_pweight t --生产点
  451. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  452. and proc_date<=replace('#today#','-','')
  453. and t.pline_code=a.pline_code) as totaloutputweight
  454. ,'' as productionrate
  455. ,'' as firstgoodrate
  456. ,'' as productionrate_m
  457. ,'' as firstgoodrate_m
  458. ,y.input_d as input,y.output_d as output,y.firstgood_d as firstgood
  459. ,x.input_m as totalinput,x.output_m as totaloutput,x.firstgood_m as totalfirstgood
  460. from v_production_g_pline a
  461. left join
  462. (select t.pline_code,sum(t.input) as input_m
  463. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m,sum(t.output_weight) as outputweight_m
  464. from v_production_g t
  465. where substr(t.production_date,1,7)=substr('#today#',1,7)
  466. and t.production_date<='#today#'
  467. group by t.pline_code) x on x.pline_code=a.pline_code
  468. left join
  469. (select t.pline_code,sum(t.input) as input_d
  470. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d,sum(t.output_weight) as outputweight_d
  471. from v_production_g t
  472. where t.production_date='#today#'
  473. group by t.pline_code) y on y.pline_code=a.pline_code
  474. where (select sum(qualified_wt)
  475. from v_production_g_pweight t --生产点
  476. where t.bal_year_month=replace(substr('#today#',1,7),'-','')
  477. and proc_date<=replace('#today#','-','')
  478. and t.pline_code=a.pline_code) is not null or production_m is not null
  479. order by a.department_code_p,a.factory_code,a.pline_code)
  480. ]]>
  481. </query>
  482. <query id = "FrmrptTotalProduct.get_TotalProductionData1" desc = "A、B、D、E、F、G产量信息查询">
  483. <![CDATA[
  484. select * from (select nvl(y.production_date,'#today#') as productiondate,'A' as processcode
  485. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  486. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  487. ,round(production_d,3) as production
  488. ,round(production_m,3) as totalproduction
  489. ,to_number(null) as productionrate,to_number(null) as firstgoodrate
  490. ,to_number(null) as productionrate_m,to_number(null) as firstgoodrate_m
  491. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.production) as production_m
  492. from v_production_a t
  493. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  494. and substr(t.production_date,1,7)=substr('#today#',1,7)
  495. group by substr(t.production_date,1,7),t.pline_code) x
  496. left join (select t.production_date,t.pline_code,sum(t.production) as production_d
  497. from v_production_a t
  498. where t.production_date='#today#'
  499. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  500. order by x.pline_code)
  501. union all
  502. select * from (select nvl(y.production_date,'#today#') as productiondate,'B' as processcode
  503. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  504. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  505. ,round(production_d,3) as production
  506. ,round(production_m,3) as totalproduction
  507. ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.output_d,2) end as productionrate
  508. ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  509. ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.output_m,2) end as productionrate_m
  510. ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
  511. from (select substr(t.production_date,1,7) as ny,t.pline_code
  512. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  513. from v_production_b_new t
  514. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  515. and substr(t.production_date,1,7)=substr('#today#',1,7)
  516. group by substr(t.production_date,1,7),t.pline_code) x
  517. left join
  518. (select t.production_date,t.pline_code
  519. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  520. from v_production_b_new t
  521. where t.production_date='#today#'
  522. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  523. order by x.pline_code)
  524. union all
  525. select * from (select nvl(y.production_date,'#today#') as productiondate,'D' as processcode
  526. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  527. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  528. ,round(production_d,3) as production
  529. ,round(production_m,3) as totalproduction
  530. ,case when nvl(y.input_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.input_d,2) end as productionrate
  531. ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  532. ,case when nvl(x.input_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.input_m,2) end as productionrate_m
  533. ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
  534. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
  535. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  536. from v_production_d t
  537. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  538. and substr(t.production_date,1,7)=substr('#today#',1,7)
  539. group by substr(t.production_date,1,7),t.pline_code) x
  540. left join
  541. (select t.production_date,t.pline_code,sum(t.input) as input_d
  542. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  543. from v_production_d t
  544. where t.production_date='#today#'
  545. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  546. order by x.pline_code)
  547. union all
  548. select * from (select nvl(y.production_date,'#today#') as productiondate,'E' as processcode
  549. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  550. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  551. ,round(production_d,3) as production
  552. ,round(production_m,3) as totalproduction
  553. ,case when nvl(y.input_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.input_d,2) end as productionrate
  554. ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  555. ,case when nvl(x.input_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.input_m,2) end as productionrate_m
  556. ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
  557. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
  558. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  559. from v_production_e t
  560. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  561. and substr(t.production_date,1,7)=substr('#today#',1,7)
  562. group by substr(t.production_date,1,7),t.pline_code) x
  563. left join
  564. (select t.production_date,t.pline_code,sum(t.input) as input_d
  565. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  566. from v_production_e t
  567. where t.production_date='#today#'
  568. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  569. order by x.pline_code)
  570. union all
  571. select * from (select nvl(y.production_date,'#today#') as productiondate,'F' as processcode
  572. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  573. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  574. ,round(production_d,3) as production
  575. ,round(production_m,3) as totalproduction
  576. ,case when nvl(y.input_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.input_d,2) end as productionrate
  577. ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  578. ,case when nvl(x.input_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.input_m,2) end as productionrate_m
  579. ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
  580. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
  581. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  582. from v_production_f t
  583. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  584. and substr(t.production_date,1,7)=substr('#today#',1,7)
  585. group by substr(t.production_date,1,7),t.pline_code) x
  586. left join
  587. (select t.production_date,t.pline_code,sum(t.input) as input_d
  588. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  589. from v_production_f t
  590. where t.production_date='#today#'
  591. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  592. order by x.pline_code)
  593. union all
  594. select * from (select nvl(y.production_date,'#today#') as productiondate,'G' as processcode
  595. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  596. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  597. ,round(production_d,3) as production
  598. ,round(production_m,3) as totalproduction
  599. ,case when nvl(y.input_d,0.00)=0.00 then to_number(null) else round(y.production_d*100/y.input_d,2) end as productionrate
  600. ,case when nvl(y.output_d,0.00)=0.00 then to_number(null) else round(y.firstgood_d*100/y.output_d,2) end as firstgoodrate
  601. ,case when nvl(x.input_m,0.00)=0.00 then to_number(null) else round(x.production_m*100/x.input_m,2) end as productionrate_m
  602. ,case when nvl(x.output_m,0.00)=0.00 then to_number(null) else round(x.firstgood_m*100/x.output_m,2) end as firstgoodrate_m
  603. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
  604. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  605. from v_production_g t
  606. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  607. and substr(t.production_date,1,7)=substr('#today#',1,7)
  608. group by substr(t.production_date,1,7),t.pline_code) x
  609. left join
  610. (select t.production_date,t.pline_code,sum(t.input) as input_d
  611. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  612. from v_production_g t
  613. where t.production_date='#today#'
  614. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  615. order by x.pline_code)
  616. ]]>
  617. </query>
  618. <query id = "FrmrptTotalProduct.get_TotalProductionData_old" desc = "A、B、D、E、F、G产量信息查询">
  619. <![CDATA[
  620. select * from (select nvl(y.production_date,'#today#') as productiondate,'A' as processcode
  621. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  622. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  623. ,case when y.production_date is null then '' else to_char(round(production_d,3),'FM9999,999') end as production
  624. ,case when y.production_date is null then '' else to_char(round(production_m,3),'FM9999,999') end as totalproduction
  625. ,'' as productionrate,'' as firstgoodrate
  626. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.production) as production_m
  627. from v_production_a t
  628. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  629. and substr(t.production_date,1,7)=substr('#today#',1,7)
  630. group by substr(t.production_date,1,7),t.pline_code) x
  631. left join (select t.production_date,t.pline_code,sum(t.production) as production_d
  632. from v_production_a t
  633. where t.production_date='#today#'
  634. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  635. order by x.pline_code)
  636. union all
  637. select * from (select nvl(y.production_date,'#today#') as productiondate,'B' as processcode
  638. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  639. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  640. ,to_char(round(production_d,3),'FM999,999.000') as production
  641. ,to_char(round(production_m,3),'FM999,999.000') as totalproduction
  642. ,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.output_d,2),'FM999.00') || '%' end as productionrate
  643. ,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
  644. from (select substr(t.production_date,1,7) as ny,t.pline_code
  645. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  646. from v_production_b_new t
  647. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  648. and substr(t.production_date,1,7)=substr('#today#',1,7)
  649. group by substr(t.production_date,1,7),t.pline_code) x
  650. left join
  651. (select t.production_date,t.pline_code
  652. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  653. from v_production_b_new t
  654. where t.production_date='#today#'
  655. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  656. order by x.pline_code)
  657. union all
  658. select * from (select nvl(y.production_date,'#today#') as productiondate,'D' as processcode
  659. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  660. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  661. ,to_char(round(production_d,3),'FM999,999.000') as production
  662. ,to_char(round(production_m,3),'FM999,999.000') as totalproduction
  663. ,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.input_d,2),'FM999.00') || '%' end as productionrate
  664. ,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
  665. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
  666. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  667. from v_production_d t
  668. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  669. and substr(t.production_date,1,7)=substr('#today#',1,7)
  670. group by substr(t.production_date,1,7),t.pline_code) x
  671. left join
  672. (select t.production_date,t.pline_code,sum(t.input) as input_d
  673. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  674. from v_production_d t
  675. where t.production_date='#today#'
  676. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  677. order by x.pline_code)
  678. union all
  679. select * from (select nvl(y.production_date,'#today#') as productiondate,'E' as processcode
  680. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  681. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  682. ,to_char(round(production_d,3),'FM999,999.000') as production
  683. ,to_char(round(production_m,3),'FM999,999.000') as totalproduction
  684. ,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.input_d,2),'FM999.00') || '%' end as productionrate
  685. ,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
  686. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
  687. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  688. from v_production_e t
  689. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  690. and substr(t.production_date,1,7)=substr('#today#',1,7)
  691. group by substr(t.production_date,1,7),t.pline_code) x
  692. left join
  693. (select t.production_date,t.pline_code,sum(t.input) as input_d
  694. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  695. from v_production_e t
  696. where t.production_date='#today#'
  697. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  698. order by x.pline_code)
  699. union all
  700. select * from (select nvl(y.production_date,'#today#') as productiondate,'E' as processcode
  701. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  702. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  703. ,to_char(round(production_d,3),'FM999,999.000') as production
  704. ,to_char(round(production_m,3),'FM999,999.000') as totalproduction
  705. ,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.input_d,2),'FM999.00') || '%' end as productionrate
  706. ,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
  707. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
  708. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  709. from v_production_f t
  710. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  711. and substr(t.production_date,1,7)=substr('#today#',1,7)
  712. group by substr(t.production_date,1,7),t.pline_code) x
  713. left join
  714. (select t.production_date,t.pline_code,sum(t.input) as input_d
  715. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  716. from v_production_f t
  717. where t.production_date='#today#'
  718. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  719. order by x.pline_code)
  720. union all
  721. select * from (select nvl(y.production_date,'#today#') as productiondate,'G' as processcode
  722. ,(select a.department_desc_p from com_base_pline a where a.pline_code=x.pline_code) as area
  723. ,(select a.pline_name from com_base_pline a where a.pline_code=x.pline_code) as plinename
  724. ,to_char(round(production_d,3),'FM999,999.000') as production
  725. ,to_char(round(production_m,3),'FM999,999.000') as totalproduction
  726. ,case when y.production_date is null then '' else to_char(round(y.production_d*100/y.input_d,2),'FM999.00') || '%' end as productionrate
  727. ,case when y.production_date is null then '' else to_char(round(y.firstgood_d*100/y.output_d,2),'FM999.00') || '%' end as firstgoodrate
  728. from (select substr(t.production_date,1,7) as ny,t.pline_code,sum(t.input) as input_m
  729. ,sum(t.output) as output_m,sum(t.firstgood) as firstgood_m,sum(t.production) as production_m
  730. from v_production_g t
  731. where to_date(t.production_date,'yyyy-mm-dd')<=to_date('#today#','yyyy-mm-dd')
  732. and substr(t.production_date,1,7)=substr('#today#',1,7)
  733. group by substr(t.production_date,1,7),t.pline_code) x
  734. left join
  735. (select t.production_date,t.pline_code,sum(t.input) as input_d
  736. ,sum(t.output) as output_d,sum(t.firstgood) as firstgood_d,sum(t.production) as production_d
  737. from v_production_g t
  738. where t.production_date='#today#'
  739. group by t.production_date,t.pline_code) y on x.pline_code=y.pline_code
  740. order by x.pline_code)
  741. ]]>
  742. </query>
  743. <query id = "FrmrptTotalProduct.getA_ProductionData" desc = "炼钢产量信息查询">
  744. <![CDATA[
  745. select t.production_time as ptime,stove_no,'' as judge_stove_no,'' as batchno,to_number(null) as pcount
  746. ,to_char(round(production,3),'FM9,999,990.000') as pweight
  747. ,'' as pweightrate,'' as pfirtgoodrate,'A' as processcode_d,a.pline_name as plinename_d
  748. from v_production_a t,com_base_pline a
  749. where t.production_date={0}
  750. and a.pline_code=t.pline_code and a.pline_name={1}
  751. order by production_time,t.stove_no
  752. ]]>
  753. </query>
  754. <query id = "FrmrptTotalProduct.getB_ProductionData" desc = "铸造产量信息查询">
  755. <![CDATA[
  756. select t.production_time as ptime,stove_no,judge_stove_no,'' as batchno,t.production_count as pcount
  757. ,to_char(round(production,3),'FM9,999,990.000') as pweight
  758. ,to_char(round(t.production*100/t.output,2),'FM999.00') || '%' as pweightrate
  759. ,to_char(round(t.firstgood*100/t.output,2),'FM999.00') || '%' as pfirtgoodrate,'B' as processcode_d,a.pline_name as plinename_d
  760. from v_production_b_new t,com_base_pline a
  761. where t.production_date={0}
  762. and a.pline_code=t.pline_code and a.pline_name={1}
  763. order by production_time,t.stove_no,judge_stove_no
  764. ]]>
  765. </query>
  766. <query id = "FrmrptTotalProduct.getD_ProductionData" desc = "轧管产量信息查询">
  767. <![CDATA[
  768. select t.production_time as ptime,'' as stove_no,judge_stove_no,'' as batchno,t.production_count as pcount
  769. ,to_char(round(production,3),'FM9,999,990.000') as pweight
  770. ,to_char(round(production*100/input,2),'FM999.00') || '%' as pweightrate
  771. ,to_char(round(firstgood*100/output,2),'FM999.00') || '%' as pfirtgoodrate,'D' as processcode_d,a.pline_name as plinename_d
  772. from v_production_d t,com_base_pline a
  773. where t.production_date={0}
  774. and a.pline_code=t.pline_code and a.pline_name={1}
  775. order by production_time,judge_stove_no
  776. ]]>
  777. </query>E
  778. <query id = "FrmrptTotalProduct.getE_ProductionData" desc = "镦拔扩产量信息查询">
  779. <![CDATA[
  780. select t.production_time as ptime,'' as stove_no,judge_stove_no,batch_no as batchno,t.production_count as pcount
  781. ,to_char(round(production,3),'FM9,999,990.000') as pweight
  782. ,to_char(round(production*100/input,2),'FM999.00') || '%' as pweightrate
  783. ,to_char(round(firstgood*100/output,2),'FM999.00') || '%' as pfirtgoodrate,'E' as processcode_d,a.pline_name as plinename_d
  784. from v_production_E t,com_base_pline a
  785. where t.production_date={0}
  786. and a.pline_code=t.pline_code and a.pline_name={1}
  787. order by production_time,judge_stove_no,batch_no
  788. ]]>
  789. </query>
  790. <query id = "FrmrptTotalProduct.getF_ProductionData" desc = "热处理量信息查询">
  791. <![CDATA[
  792. select t.production_time as ptime,'' as stove_no,judge_stove_no,batch_no as batchno,t.production_count as pcount
  793. ,to_char(round(production,3),'FM9,999,990.000') as pweight
  794. ,to_char(round(production*100/input,2),'FM999.00') || '%' as pweightrate
  795. ,to_char(round(firstgood*100/output,2),'FM999.00') || '%' as pfirtgoodrate,'F' as processcode_d,a.pline_name as plinename_d
  796. from v_production_f t,com_base_pline a
  797. where t.production_date={0}
  798. and a.pline_code=t.pline_code and a.pline_name={1}
  799. order by production_time,judge_stove_no,batch_no
  800. ]]>
  801. </query>
  802. <query id = "FrmrptTotalProduct.getG_ProductionData" desc = "加工产产量信息查询">
  803. <![CDATA[
  804. select t.production_time as ptime,'' as stove_no,judge_stove_no,phy_batch_no as batchno,t.production_count as pcount
  805. ,to_char(round(production,3),'FM9,999,990.000') as pweight
  806. ,to_char(round(production*100/input,2),'FM999.00') || '%' as pweightrate
  807. ,to_char(round(firstgood*100/output,2),'FM999.00') || '%' as pfirtgoodrate,'G' as processcode_d,a.pline_name as plinename_d
  808. from v_production_G t,com_base_pline a
  809. where t.production_date={0}
  810. and a.pline_code=t.pline_code and a.pline_name={1}
  811. order by production_time,judge_stove_no,phy_batch_no
  812. ]]>
  813. </query>
  814. </queryMap>