SqlCollectionBof.cs 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using CoreFS.CA06;
  6. using System.Data;
  7. using System.Collections;
  8. using Core.Mes.Client.Common;
  9. namespace Core.LgMes.Client.lgServiceMgt.LgSqlCollection.LgReportSql
  10. {
  11. public class SqlCollectionBof
  12. {
  13. /// <summary>
  14. /// 查询转炉炉前铁水信息
  15. /// </summary>
  16. /// <param name="sqlConditionList"></param>
  17. /// <returns></returns>
  18. public static string returnSqlOfBofForwardReport(ArrayList sqlConditionList)
  19. {
  20. string sqlStr = "";
  21. sqlStr = @"select distinct t.HEATNO, --炉次号
  22. t.IRONPOTID, --铁水编号
  23. t4.aim_grade_code PLANSTEEL, --钢种计划
  24. nvl(t.IRONPOTWGT, '0') IRONPOTWGT,--铁水重量
  25. t.IRONTEMPERATURE, --铁水温度
  26. case substr(t.SHIFTCODE, 2, 1) --班组
  27. when '1' then
  28. '甲'
  29. when '2' then
  30. '乙'
  31. when '3' then
  32. '丙'
  33. when '4' then
  34. '丁'
  35. end BB,
  36. case substr(t.SHIFTCODE, 1, 1) --班次
  37. when '1' then
  38. '早'
  39. when '2' then
  40. '中'
  41. when '3' then
  42. '夜'
  43. end BC,
  44. --入炉铁水信息
  45. max(case
  46. when t.MOLIRNSOURCE = t10.HEATNO then
  47. t10.Mn
  48. end) over(partition by t.MOLIRNSOURCE) R_MN,
  49. max(case
  50. when t.MOLIRNSOURCE = t10.HEATNO then
  51. t10.C
  52. end) over(partition by t.MOLIRNSOURCE) R_C,
  53. max(case
  54. when t.MOLIRNSOURCE = t10.HEATNO then
  55. t10.P
  56. end) over(partition by t.MOLIRNSOURCE) R_P,
  57. max(case
  58. when t.MOLIRNSOURCE = t10.HEATNO then
  59. t10.S
  60. end) over(partition by t.MOLIRNSOURCE) R_S,
  61. max(case
  62. when t.MOLIRNSOURCE = t10.HEATNO then
  63. t10.si
  64. end) over(partition by t.MOLIRNSOURCE) R_SI,
  65. --TSO试样
  66. max(case
  67. when t.HEATNO = t9.HEATNO and t9.xh = t9.cnt then
  68. t9.Mn
  69. end) over(partition by t.HEATNO) Z_MN,
  70. max(case
  71. when t.HEATNO = t9.HEATNO and t9.xh = t9.cnt then
  72. t9.C
  73. end) over(partition by t.HEATNO) Z_C,
  74. max(case
  75. when t.HEATNO = t9.HEATNO and t9.xh = t9.cnt then
  76. t9.P
  77. end) over(partition by t.HEATNO) Z_P,
  78. to_char(t.optdate, 'yyyy-MM-dd hh24:mi') OPTDISP --操作时间
  79. from (select *
  80. from stl_bof_optinfo
  81. where 1 = 1
  82. {0}
  83. union
  84. select *
  85. from J#stl_bof_optinfo
  86. where 1 = 1
  87. {0}
  88. ) t
  89. left join (select y.*
  90. from (select x.*,
  91. row_number() over(partition by x.heatno order by x.assaytypecode) xh
  92. from (select *
  93. from stl_chemelement
  94. where upper(substr(assaytypecode, 1, 1)) = 'C'
  95. {1}
  96. union
  97. select *
  98. from J#stl_chemelement
  99. where upper(substr(ASSAYTYPECODE, 1, 1)) = 'C'
  100. {1}
  101. ) x) y) t1 on t.heatno = t1.heatno
  102. left join (select y.*
  103. from (select x.*,
  104. count(1) over(partition by x.HEATNO) cnt,
  105. row_number() over(partition by x.HEATNO order by x.ASSAYTYPECODE asc, x.assaydate asc) xh,
  106. substr(x.assaytypecode, 1, 1) gw
  107. from (select *
  108. from STL_CHEMELEMENT
  109. where 1 = 1
  110. and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
  111. and upper(SUBSTR(CHECKNO, -1)) = 'S'
  112. {1}
  113. union
  114. select *
  115. from J#STL_CHEMELEMENT
  116. where 1 = 1
  117. {1}
  118. and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
  119. and upper(SUBSTR(CHECKNO, -1)) = 'S') x) y) t9 on t9.heatno = t.heatno
  120. left join (select *
  121. from stl_chemelement where 1 = 1 {2}
  122. union
  123. select * from J#stl_chemelement where 1 = 1 {2}) t10 on t10.heatno = t.MOLIRNSOURCE
  124. left join (select *
  125. from ppc_steel_heat where 1 = 1 {3}
  126. union
  127. select * from J#ppc_steel_heat where 1 = 1 {3}) t4 on t.heatno = t4.heatno
  128. order by OPTDISP";
  129. sqlStr = lgCommon.stringFormat(sqlStr, sqlConditionList);
  130. return sqlStr;
  131. }
  132. /// <summary>
  133. /// 返回转炉操作记录报表查询
  134. /// </summary>
  135. /// <param name="sqlConditionList"></param>
  136. /// <returns></returns>
  137. public static string returnSqlOfBofOperatioReport(ArrayList sqlConditionList)
  138. {
  139. string sqlStr = "";
  140. sqlStr = @"select distinct t.heatno,
  141. t4.aim_grade_code plansteel,
  142. t.stationcode,
  143. t.sage,
  144. t.gage,
  145. t.o2consume,
  146. nvl(t.ironpotwgt, '0') ironpotwgt,
  147. t.wsteelwgt,
  148. t.pigironwgt,
  149. /*case when t6.baleleavewgt is not null then round(((nvl(t.ironpotwgt, '0')+nvl(t.wsteelwgt, '0')+nvl(t.pigironwgt, '0')))*1000/(t6.pfbalewgt - t6.baleleavewgt),2) else 0 end iron_sum,*/
  150. case when t6.baleleavewgt is not null then round(((nvl(t.ironpotwgt, '0')+nvl(t.wsteelwgt, '0')+nvl(t.pigironwgt, '0')))*1000/(decode(t6.pfbalewgt - t6.baleleavewgt,null,1,0,1,t6.pfbalewgt - t6.baleleavewgt)),2) else 0 end iron_sum,
  151. t.brpstime,
  152. t.potno,
  153. t.potdistinction,
  154. t.potwrapstate,
  155. t6.pfbalewgt - t6.baleleavewgt tappingwgt,
  156. decode(substr(t.shiftcode, 1, 1), '1', '早', '2', '中', '3', '晚') bc,
  157. decode(substr(t.shiftcode, 2, 1), '1', '甲', '2', '乙', '3', '丙', '4', '丁') bb,
  158. decode(blkredeffects, '0', '失败', '1', '成功', '2', '未投', '3', '一般') blkredeffects,
  159. t.subage,
  160. t.changestarttime,
  161. t.openoxygentime,
  162. round(t.tappingmaxangle,2) tappingmaxangle,round(t.psmaxangle,2) psmaxangle,
  163. t.irontemperature,
  164. t.wsteelwgt_fg,
  165. t.yakuaiwgt_fg,
  166. t.zhasteelwgt_fg,
  167. t.ironwgt_fg,
  168. t.broken_fg,
  169. t.terminusc,
  170. t.terminuso2,
  171. (select nvl(temperature,0)
  172. from (select *
  173. from (SELECT *
  174. FROM stl_bof_subsampling
  175. WHERE samplingtype = 'TSC'
  176. union
  177. SELECT *
  178. FROM j#stl_bof_subsampling
  179. WHERE samplingtype = 'TSC')
  180. order by samplingdate desc)
  181. WHERE heatno = t.heatno
  182. AND rownum = 1) b1temperature,
  183. (select nvl(temperature,0)
  184. from (select *
  185. from (SELECT *
  186. FROM stl_bof_subsampling
  187. WHERE samplingtype = 'TSO'
  188. union
  189. SELECT *
  190. FROM j#stl_bof_subsampling
  191. WHERE samplingtype = 'TSO')
  192. order by samplingdate desc)
  193. WHERE heatno = t.heatno
  194. AND rownum = 1) b2temperature,
  195. nvl(t.n2consume, 0) + nvl(t.topn2consume, 0) n2sum,
  196. t.irontemperature,
  197. '0.9' o2press,
  198. nvl(t.b2time, 0) + nvl(t.b3time, 0) + nvl(t.b4time, 0) +
  199. nvl(t.b5time, 0) dctime,
  200. to_char(t.changestarttime, 'HH24:mi') changestarttime,
  201. to_char(t.openoxygentime, 'HH24:mi') openoxygentime,
  202. round(nvl(t.supplyoxygentime / 60, 0), 1) supplyoxygentime,
  203. round(t.supplyoxygentime, 1) supplyoxygentime_s,
  204. t4.plan_lines plan_lines,
  205. t.terminustept tappingtemperature,
  206. t.tappingtime,
  207. to_char(t.tappingstarttime, 'HH24:mi') tappingstarttime,
  208. max(case
  209. when t.heatno = t2.heatno
  210. and t2.xh = t2.cnt then
  211. t2.c
  212. end) over(partition by t.heatno) f_c,
  213. max(case
  214. when t.heatno = t2.heatno
  215. and t2.xh = t2.cnt then
  216. t2.mn
  217. end) over(partition by t.heatno) f_mn,
  218. max(case
  219. when t.heatno = t2.heatno
  220. and t2.xh = t2.cnt then
  221. t2.si
  222. end) over(partition by t.heatno) f_si,
  223. max(case
  224. when t.heatno = t2.heatno
  225. and t2.xh = t2.cnt then
  226. t2.s
  227. end) over(partition by t.heatno) f_s,
  228. max(case
  229. when t.heatno = t2.heatno
  230. and t2.xh = t2.cnt then
  231. t2.p
  232. end) over(partition by t.heatno) f_p,
  233. max(case
  234. when t.heatno = t2.heatno
  235. and t2.xh = t2.cnt then
  236. t2.als
  237. end) over(partition by t.heatno) f_als,
  238. max(case
  239. when t.molirnsource = t10.heatno then
  240. t10.mn
  241. end) over(partition by t.molirnsource) r_mn,
  242. max(case
  243. when t.molirnsource = t10.heatno then
  244. t10.c
  245. end) over(partition by t.molirnsource) r_c,
  246. max(case
  247. when t.molirnsource = t10.heatno then
  248. t10.p
  249. end) over(partition by t.molirnsource) r_p,
  250. max(case
  251. when t.molirnsource = t10.heatno then
  252. t10.s
  253. end) over(partition by t.molirnsource) r_s,
  254. max(case
  255. when t.molirnsource = t10.heatno then
  256. t10.si
  257. end) over(partition by t.molirnsource) r_si,
  258. max(case
  259. when t.heatno = t9.heatno
  260. and t9.xh = t9.cnt then
  261. t9.mn
  262. end) over(partition by t.heatno) z_mn,
  263. max(case
  264. when t.heatno = t9.heatno
  265. and t9.xh = t9.cnt then
  266. t9.c
  267. end) over(partition by t.heatno) z_c,
  268. max(case
  269. when t.heatno = t9.heatno
  270. and t9.xh = t9.cnt then
  271. t9.p
  272. end) over(partition by t.heatno) z_p,
  273. max(case
  274. when t.heatno = t9.heatno
  275. and t9.xh = t9.cnt then
  276. t9.s
  277. end) over(partition by t.heatno) z_s,
  278. max(case
  279. when t.heatno = t9.heatno
  280. and t9.xh = t9.cnt then
  281. t9.si
  282. end) over(partition by t.heatno) z_si,
  283. case when max(case
  284. when t.molirnsource = t10.heatno then
  285. t10.mn
  286. end) over(partition by t.molirnsource) is not null then
  287. round(max(case
  288. when t.heatno = t9.heatno and t9.xh = t9.cnt then
  289. t9.mn
  290. end) over(partition by t.heatno)/max(case
  291. when t.molirnsource = t10.heatno then
  292. decode(t10.mn,null,1,0,1) --t10.mn 铁水mn元素有可能为0
  293. end) over(partition by t.molirnsource),2) else 0 end mn_harvest_rate,
  294. t4.cast_id ccmno,
  295. (t4.cast_id) || '-' || (t4.cast_seq) ccmno,
  296. t.memo,
  297. to_char(t.optdate, 'yyyy-MM-dd hh24:mi') optdisp,
  298. t.remark2
  299. from (select *
  300. from stl_bof_optinfo
  301. where 1 = 1
  302. {0}
  303. union all
  304. select *
  305. from j#stl_bof_optinfo
  306. where 1 = 1
  307. {0}) t
  308. left join (select y.*
  309. from (select x.*,
  310. row_number() over(partition by x.heatno order by x.assaytypecode) xh
  311. from (select *
  312. from stl_chemelement
  313. where upper(substr(assaytypecode, 1, 1)) = 'C'
  314. {1}
  315. union all
  316. select *
  317. from j#stl_chemelement
  318. where upper(substr(assaytypecode, 1, 1)) = 'C'
  319. {1}) x) y) t1 on t.heatno =
  320. t1.heatno
  321. left join (select y.*
  322. from (select x.*,
  323. count(1) over(partition by x.heatno) cnt,
  324. row_number() over(partition by x.heatno order by x.assaytypecode desc, x.assaydate desc) xh,
  325. substr(x.assaytypecode, 1, 1) gw
  326. from (select *
  327. from stl_chemelement
  328. where 1 = 1
  329. {1}
  330. and upper(substr(checkno, -1)) = 'S'
  331. and upper(substr(checkno, 12, 2)) = 'GP'
  332. union all
  333. select *
  334. from j#stl_chemelement
  335. where 1 = 1
  336. {1}
  337. and upper(substr(checkno, -1)) = 'S'
  338. and upper(substr(checkno, 12, 2)) = 'GP') x) y) t2 on t2.heatno =
  339. t.heatno
  340. left join (select y.*
  341. from (select x.*,
  342. count(1) over(partition by x.heatno) cnt,
  343. row_number() over(partition by x.heatno order by x.assaytypecode desc, x.assaydate desc) xh,
  344. substr(x.assaytypecode, 1, 1) gw
  345. from (select *
  346. from stl_chemelement
  347. where 1 = 1
  348. {1}
  349. and upper(substr(checkno, 12, 1)) = 'C'
  350. and upper(substr(checkno, -1)) = 'I'
  351. and upper(substr(checkno, 13, 1)) <> 'P'
  352. union all
  353. select *
  354. from j#stl_chemelement
  355. where 1 = 1
  356. {1}
  357. and upper(substr(checkno, 12, 1)) = 'C'
  358. and upper(substr(checkno, -1)) = 'I'
  359. and upper(substr(checkno, 13, 1)) <> 'P') x) y) t3 on t3.heatno =
  360. t.heatno
  361. left join (select y.*
  362. from (select x.*,
  363. count(1) over(partition by x.heatno) cnt,
  364. row_number() over(partition by x.heatno order by x.assaytypecode) xh,
  365. substr(x.assaytypecode, 1, 1) gw
  366. from (select *
  367. from stl_chemelement
  368. where 1 = 1
  369. {1}
  370. and upper(substr(checkno, 12, 1)) = 'C'
  371. and upper(substr(checkno, -1)) = 'S'
  372. union all
  373. select *
  374. from j#stl_chemelement
  375. where 1 = 1
  376. {1}
  377. and upper(substr(checkno, 12, 1)) = 'C'
  378. and upper(substr(checkno, -1)) = 'S') x) y) t9 on t9.heatno =
  379. t.heatno
  380. left join (select *
  381. from stl_chemelement where 1 = 1 {1}
  382. union all
  383. select * from j#stl_chemelement where 1 = 1 {1}) t10 on t10.heatno =
  384. t.molirnsource
  385. left join (select *
  386. from ppc_steel_heat where 1 = 1 {3}
  387. union all
  388. select * from j#ppc_steel_heat where 1 = 1 {3}) t4 on t.heatno =
  389. t4.heatno
  390. /*left join (select *
  391. from ppc_steel_heat where 1 = 1 {3}
  392. union all
  393. select * from j#ppc_steel_heat where 1 = 1 {3}) t5 on t.heatno =
  394. t5.heatno*/
  395. left join (select heatno,
  396. pfbalewgt,
  397. baleleavewgt,
  398. isrs,
  399. mwrapno,
  400. billetfixsize
  401. from stl_ccm_optinfo
  402. where 1 = 1
  403. {2}
  404. union all
  405. select heatno,
  406. pfbalewgt,
  407. baleleavewgt,
  408. isrs,
  409. mwrapno,
  410. billetfixsize
  411. from j#stl_ccm_optinfo
  412. where 1 = 1
  413. {2}) t6 on t.heatno = t6.heatno
  414. order by optdisp
  415. ";
  416. sqlStr = lgCommon.stringFormat(sqlStr, sqlConditionList);
  417. return sqlStr;
  418. }
  419. /// <summary>
  420. /// 返回转炉出钢c报表查询sql
  421. /// </summary>
  422. /// <param name="sqlCondition"></param>
  423. /// <returns></returns>
  424. public static string returnSqlOfBofTapping(ArrayList sqlConditionList)
  425. {
  426. string sqlStr = "";
  427. sqlStr = @" select distinct t.HEATNO, --炉号
  428. t4.aim_grade_code PLANSTEEL, --钢种
  429. case substr(t.SHIFTCODE, 2, 1)--班组
  430. when '1' then
  431. '甲'
  432. when '2' then
  433. '乙'
  434. when '3' then
  435. '丙'
  436. when '4' then
  437. '丁'
  438. end BB,
  439. case substr(t.SHIFTCODE, 1, 1)--班次
  440. when '1' then
  441. '早'
  442. when '2' then
  443. '中'
  444. when '3' then
  445. '夜'
  446. end BC,
  447. nvl(t.B2TIME,0) B2TIME, --2#吹时间(s)
  448. nvl(t.B3TIME,0) B3TIME, --3#吹时间(s)
  449. nvl(t.B4TIME,0) B4TIME, --4#吹时间(s)
  450. nvl(t.B5TIME,0) B5TIME, --5#吹时间(s)
  451. --LD2(第二次取样)
  452. max(case
  453. when t.HEATNO = t3.HEATNO and t3.xh = t3.cnt then
  454. t3.Mn
  455. end) over(partition by t.HEATNO) Z_MN,
  456. max(case
  457. when t.HEATNO = t3.HEATNO and t3.xh = t3.cnt then
  458. t3.C
  459. end) over(partition by t.HEATNO) Z_C,
  460. max(case
  461. when t.HEATNO = t3.HEATNO and t3.xh = t3.cnt then
  462. t3.P
  463. end) over(partition by t.HEATNO) Z_P,
  464. max(case
  465. when t.HEATNO = t3.HEATNO and t3.xh = t3.cnt then
  466. t3.S
  467. end) over(partition by t.HEATNO) Z_S,
  468. to_char(t.optdate, 'yyyy-MM-dd hh24:mi') OPTDISP --操作时间
  469. from (select *
  470. from STL_bof_optinfo
  471. where 1 = 1
  472. {0}
  473. union
  474. select *
  475. from J#STL_bof_optinfo
  476. where 1 = 1
  477. {0}
  478. ) t
  479. left join (select y.*
  480. from (select x.*,
  481. count(1) over(partition by x.HEATNO) cnt,
  482. row_number() over(partition by x.HEATNO order by x.ASSAYTYPECODE asc, x.assaydate asc) xh,
  483. substr(x.assaytypecode, 1, 1) gw
  484. from (select *
  485. from STL_CHEMELEMENT
  486. where 1 = 1
  487. and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
  488. and upper(SUBSTR(CHECKNO, -1)) = 'S'
  489. {1}
  490. union
  491. select *
  492. from J#STL_CHEMELEMENT
  493. where 1 = 1 {1}
  494. and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
  495. and upper(SUBSTR(CHECKNO, -1)) = 'S') x) y ) t3 on t.heatno = t3.heatno
  496. left join (select *
  497. from ppc_steel_heat where 1 = 1 {2}
  498. union
  499. select * from J#ppc_steel_heat where 1 = 1 {2}) t4 on t.heatno = t4.heatno
  500. order by OPTDISP";
  501. sqlStr = Core.Mes.Client.Common.lgCommon.stringFormat(sqlStr,sqlConditionList);
  502. return sqlStr;
  503. }
  504. /// <summary>
  505. /// 终点MN考核报表
  506. /// </summary>
  507. /// <param name="sqlConditonList"></param>
  508. /// <returns></returns>
  509. public static string ReturnSqlOfBofChecnNmReport(ArrayList sqlConditonList)
  510. {
  511. string sqlStr = "";
  512. sqlStr = @"select distinct t.HEATNO,--炉号
  513. t.STATIONCODE, --岗位编号
  514. substr(t.SHIFTCODE, 2, 1) SHIFTCODE, --班组(甲、乙、丙、丁)
  515. max(case
  516. when t.HEATNO = t1.HEATNO and t1.xh = t1.cnt then
  517. t1.Mn
  518. end) over(partition by t.HEATNO) Z_MN,
  519. t2.stdmin, --最小值(内控)
  520. t2.stdmax, --最大值(内控)
  521. to_char(t.optdate, 'yyyy-MM-dd') OPTDISP --日期
  522. from (select * from stl_bof_optinfo where 1 = 1
  523. {0}
  524. union all select * from j#stl_bof_optinfo where 1 = 1
  525. {0}
  526. ) t
  527. left join (select y.*
  528. from (select x.*,
  529. count(1) over(partition by x.HEATNO) cnt,
  530. row_number() over(partition by x.HEATNO order by x.ASSAYTYPECODE asc, x.assaydate asc) xh,
  531. substr(x.assaytypecode, 1, 1) gw
  532. from (select *
  533. from STL_CHEMELEMENT
  534. where 1 = 1 {1}
  535. and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
  536. and upper(SUBSTR(CHECKNO, -1)) = 'S'
  537. union all
  538. select *
  539. from J#STL_CHEMELEMENT
  540. where 1 = 1 {1}
  541. and upper(SUBSTR(CHECKNO, 12, 1)) = 'C'
  542. and upper(SUBSTR(CHECKNO, -1)) = 'S') x) y) t1 on t1.heatno = t.heatno
  543. left join ( select distinct t3.gycode,t4.itemcode,t4.stdmin,t4.stdmax --decode(t1.itemcode,'Mn',t1.stdmin,'') MN_Min, decode(t1.itemcode,'Mn',t1.stdmax,'') MN_Max
  544. from scm_sortcode_chem t3, scm_standard_chem t4
  545. where t3.cic = t4.cic
  546. and t3.stdstyle = '1'
  547. and t4.itemcode= 'Mn' {2}) t2 on t2.gycode = t.heatno
  548. order by substr(OPTDISP,9,2) ";
  549. sqlStr = Core.Mes.Client.Common.lgCommon.stringFormat(sqlStr,sqlConditonList);
  550. return sqlStr;
  551. }
  552. /// <summary>
  553. /// 钢铁物料消耗报表
  554. /// </summary>
  555. /// <returns></returns>
  556. public static string ReturnSqlOfSteelAdditStats(ArrayList sqlConditionList)
  557. {
  558. string sqlStr = "";
  559. sqlStr = @"select A.HEATNO, --炉号
  560. A.station STATIONCODE, --岗位编码
  561. nvl(round(B.CPL, 3), 0) CPL, --合格铸坯量(T)
  562. case
  563. when (nvl(A.PFBALEWGT, 0) - nvl(A.BALELEAVEWGT, 0)) > 0 then
  564. round((nvl(A.PFBALEWGT, 0) - nvl(A.BALELEAVEWGT, 0)), 3)
  565. else
  566. 0
  567. end GSL, --GSL(合格钢水量) = (上台大包重量-下台大包重量)
  568. (select substr(mes_lg_common.getlgshift1(A.RecFlag), 2, 1) from dual) SHIFTCODE,--班组
  569. case
  570. when to_char(A.RecFlag, 'yyyy-MM-dd HH24:mi') between '{2}' and '{3}' then
  571. '1'
  572. else
  573. '0'
  574. end BECURR --1#吹开始时刻(操作时间)
  575. from (select *
  576. from (select t.*,
  577. row_number() over(partition by HEATNO order by RecFlag) XH
  578. from (select t.recflag,station, t2.*
  579. from (select t.heatno,
  580. case
  581. when B1STARTTIME is not null then
  582. B1STARTTIME
  583. else
  584. OPTDATE
  585. end RecFlag,t.stationcode station
  586. from STL_bof_optinfo t
  587. where 1 = 1 {0}
  588. union all
  589. select t.heatno,
  590. case
  591. when B1STARTTIME is not null then
  592. B1STARTTIME
  593. else
  594. OPTDATE
  595. end RecFlag,t.stationcode station
  596. from J#STL_bof_optinfo t
  597. where 1 = 1 {0}) t,
  598. (select *
  599. from STL_ccm_optinfo where 1 = 1 {1}
  600. union
  601. select * from J#STL_Ccm_Optinfo where 1 = 1 {1}) t2
  602. where t.heatno = t2.heatno) t)
  603. where XH = 1) A,
  604. (select distinct substr(CHARGE_NO, 1, 10) HEATNO,
  605. sum(nvl(SLAB_WGT, 0)) over(partition by substr(CHARGE_NO, 1, 10)) CPL
  606. from (select CHARGE_NO, (SLAB_WGT/1000) SLAB_WGT --合格铸坯量(T)
  607. from stl_incision_view
  608. where 1 = 1 and to_char(to_date(substr(SLAB_CUT_DTIME,1,8),'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd') between '{4}' and '{5}'
  609. ) t) B
  610. where A.HEATNO = B.HEATNO(+) ";
  611. sqlStr = Core.Mes.Client.Common.lgCommon.stringFormat(sqlStr,sqlConditionList);
  612. return sqlStr;
  613. }
  614. public static string ReturnSqlOfBofQueryInfo(ArrayList sqlConditionList)
  615. {
  616. string sqlStr = "";
  617. sqlStr = @"select distinct b.HEATNO, --炉号
  618. b.STATIONCODE, --岗位编号
  619. substr(b.SHIFTCODE, 2, 1) SHIFTCODE,--班组(甲、乙、丙、丁)
  620. nvl(b.IRONPOTWGT, 0) TSL, --装入铁水量
  621. nvl(b.PIGIRONWGT, 0) STL, --装入生铁量(T)
  622. nvl(b.WSTEELWGT, 0) FGL, --装入废钢量(T)
  623. nvl(b.RSWGT, 0) HLL, --回炉重量(T)
  624. nvl(h.jmwgt,0) HJL, --加入合金量(Kg)
  625. to_char(b.CHANGESTARTTIME,'yyyy-mm-dd hh24:mi:ss') starttime, --兑铁开始时刻
  626. to_char(b.TAPPINGENDTIME,'yyyy-mm-dd hh24:mi:ss') endtime, --出钢结束时刻
  627. nvl((b.TAPPINGENDTIME-b.CHANGESTARTTIME )*24*60,0) time, --作业时间(min)
  628. case
  629. when to_char(RecFlag, 'yyyy-MM-dd HH24:mi') between '{0}' and '{1}' then
  630. '1'
  631. else
  632. '0'
  633. end BECURR --1#吹开始时刻(操作时间)
  634. from (select *
  635. from (select t.*,
  636. row_number() over(partition by t.HEATNO order by t.RecFlag) XH
  637. from (select t.*,
  638. case
  639. when B1STARTTIME is not null then
  640. B1STARTTIME
  641. else
  642. OPTDATE
  643. end RecFlag
  644. from STL_BOF_OPTINFO t
  645. where 1 = 1
  646. and optdate >= trunc(to_date('{2}','yyyy-mm-dd'))
  647. and optdate < trunc(to_date('{3}','yyyy-mm-dd')) + 1
  648. union all
  649. select t.*,
  650. case
  651. when B1STARTTIME is not null then
  652. B1STARTTIME
  653. else
  654. OPTDATE
  655. end RecFlag
  656. from J#STL_BOF_OPTINFO t
  657. where 1 = 1
  658. and optdate >= trunc(to_date('{2}','yyyy-mm-dd'))
  659. and optdate < trunc(to_date('{3}','yyyy-mm-dd')) + 1 ) t) v where XH = 1) b,
  660. (select distinct s.heatno,
  661. sum(s.jmwgt) over(partition by s.heatno order by s.heatno) jmwgt,
  662. s.materieltype,
  663. substr(s.stationcode, 2, 2) code
  664. from stl_additives s
  665. where s.materieltype = 'HJ'
  666. and substr(s.stationcode, 1, 1) = 'C'
  667. and jmdate >= trunc(to_date('{2}','yyyy-mm-dd'))
  668. and jmdate < trunc(to_date('{3}','yyyy-mm-dd')) + 1
  669. union
  670. select distinct s.heatno,
  671. sum(s.jmwgt) over(partition by s.heatno order by s.heatno) jmwgt,
  672. s.materieltype,
  673. substr(s.stationcode, 2, 2) code
  674. from j#stl_additives s
  675. where s.materieltype = 'HJ'
  676. and jmdate >= trunc(to_date('{2}','yyyy-mm-dd'))
  677. and jmdate < trunc(to_date('{3}','yyyy-mm-dd')) + 1
  678. and substr(s.stationcode, 1, 1) = 'C') h
  679. where b.heatno = h.heatno(+) order by b.heatno";
  680. sqlStr = Core.Mes.Client.Common.lgCommon.stringFormat(sqlStr, sqlConditionList);
  681. return sqlStr;
  682. }
  683. }
  684. }