SqlCollectionVds.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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. /// <summary>
  12. /// vds sql 集合
  13. /// </summary>
  14. public class SqlCollectionVds
  15. {
  16. /// <summary>
  17. /// vds report sql
  18. /// </summary>
  19. public class VdsReportSqlCollection
  20. {
  21. /// <summary>
  22. /// vds 操作记录表
  23. /// </summary>
  24. /// <param name="sqlConditionList"></param>
  25. /// <returns></returns>
  26. public static string returnSqlOfVdsReportDailyOperation(ArrayList sqlConditionList)
  27. {
  28. string sqlStr = @"select distinct to_char(a.OPTDATE, 'yyyy-MM-dd hh24:mi') OPTDATE,
  29. a.HEATNO,
  30. decode(substr(a.shiftcode, 1, 1),
  31. '1',
  32. '早',
  33. '2',
  34. '中',
  35. '3',
  36. '晚') BC,
  37. decode(substr(a.shiftcode, 2, 1),
  38. '1',
  39. '甲',
  40. '2',
  41. '乙',
  42. '3',
  43. '丙',
  44. '4',
  45. '丁') BB,
  46. a.LMLTEMPT,
  47. b.MaxSPvalue,
  48. b.MinSPVALUE,
  49. b.AvgSPVALUE,
  50. a.PLANSTEEL,
  51. a.HEATPROCESSNO,
  52. to_char(a.ARRIVETIME,'hh24:mi:ss')ARRIVETIME,
  53. I.POTNO,
  54. I.POTDISTINCTION,
  55. a.WSID,
  56. a.RESIDUETHICKNESS,
  57. a.CLEARENCELHEIGHT,
  58. a.ARFTEMPT,
  59. to_char(a.VACBEGINTIME,'hh24:mi')VACBEGINTIME,
  60. a.ARRIVEH,
  61. a.VACUUMPRESS VAC_MIN,
  62. to_char(a.HYDGENSTARTTIME,'hh24:mi')HYDGENSTARTTIME,
  63. a.ARBTEMPT ARBTEMPT_A,
  64. to_char(a.VACLOSETIME,'hh24:mi')VACLOSETIME,
  65. a.LEAVEH,
  66. to_char(a.HYDGENENDTIME,'hh24:mi')HYDGENENDTIME,
  67. '' PROPHASE,
  68. '' INTERIM,
  69. '' LATE,
  70. a.FLEXIBLEBLOWTIME,
  71. --a.VACUUMPRESS,
  72. FLOOR(nvl(a.VAC_KEEP_TIME / 60, 0)) VAC_KEEP_TIME,
  73. a.VAC_TIME VACUUMTIME,
  74. a.STEAM_TEM,
  75. a.STEAM_PRES,
  76. a.STEAM_FLUX,
  77. to_char(a.LEAVETIME,'hh24:mi') LEAVETIME,
  78. p.PLAN_LINES,
  79. u.PFBALETEMPT,
  80. a.ARBTEMPT,
  81. p.HEAT_NUM,
  82. a.MEMO,
  83. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.c end) over(partition by a.HEATNO) Y_C,
  84. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.si end) over(partition by a.HEATNO) Y_SI,
  85. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.MN end) over(partition by a.HEATNO) Y_MN,
  86. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.P end) over(partition by a.HEATNO) Y_P,
  87. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.S end) over(partition by a.HEATNO) Y_S,
  88. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.ALS end) over(partition by a.HEATNO) Y_ALS,
  89. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.NB end) over(partition by a.HEATNO) Y_NB,
  90. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.V end) over(partition by a.HEATNO) Y_V,
  91. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.TI end) over(partition by a.HEATNO) Y_TI,
  92. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.CU end) over(partition by a.HEATNO) Y_CU,
  93. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.N end) over(partition by a.HEATNO) Y_N,
  94. max(case when a.HEATNO = w.HEATNO and w.xh = w.cnt then w.B end) over(partition by a.HEATNO) Y_B,
  95. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.c end) over(partition by a.HEATNO) C_C,
  96. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.SI end) over(partition by a.HEATNO) C_SI,
  97. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.MN end) over(partition by a.HEATNO) C_MN,
  98. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.P end) over(partition by a.HEATNO) C_P,
  99. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.S end) over(partition by a.HEATNO) C_S,
  100. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.ALS end) over(partition by a.HEATNO) C_ALS,
  101. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.NB end) over(partition by a.HEATNO) C_NB,
  102. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.V end) over(partition by a.HEATNO) C_V,
  103. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.TI end) over(partition by a.HEATNO) C_TI,
  104. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.CU end) over(partition by a.HEATNO) C_CU,
  105. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.N end) over(partition by a.HEATNO) C_N,
  106. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.B end) over(partition by a.HEATNO) C_B,
  107. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.N end) over(partition by a.HEATNO) C_NI,
  108. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.B end) over(partition by a.HEATNO) C_MO,
  109. max(case when a.HEATNO = t4.HEATNO and t4.xh = t4.cnt then t4.N end) over(partition by a.HEATNO) C_CR,
  110. GetStandardVaule(a.HEATNO,t4.MN,t4.NI,t4.MO,t4.NB,t4.V,t4.ALS,t4.CR,t4.CU) CFFC,
  111. '' ETGYEXRECORD
  112. from (select *
  113. from stl_vds_optinfo where 1 = 1 {0}
  114. union
  115. select * from j#stl_vds_optinfo where 1 = 1 {0} ) a,
  116. (select *
  117. from stl_BOF_OPTINFO where 1 = 1 {1}
  118. union
  119. select * from J#stl_BOF_OPTINFO where 1 = 1 {1}) I,
  120. (select *
  121. from STL_CCM_OPTINFO where 1 = 1 {1}
  122. union
  123. select * from J#stl_CCM_OPTINFO where 1 = 1 {1} ) u,
  124. (select HEATNO, maxSPvalue, MinSPVALUE, avgSPVALUE
  125. from (select max(SAMPLINGVALUE) maxSPvalue,
  126. min(SAMPLINGVALUE) MinSPVALUE,
  127. round(avg(SAMPLINGVALUE), 2) avgSPVALUE,
  128. HEATNO
  129. from stl_tempsampling where substr(samplingdepict,1,4)='中包温度'
  130. {2}
  131. group by HEATNO
  132. union
  133. select max(SAMPLINGVALUE) maxSPvalue,
  134. min(SAMPLINGVALUE) MinSPVALUE,
  135. round(avg(SAMPLINGVALUE), 2) avgSPVALUE,
  136. HEATNO
  137. from J#stl_tempsampling where substr(samplingdepict,1,4)='中包温度' {2}
  138. group by HEATNO)) b,
  139. (select *
  140. from ppc_steel_heat where 1 = 1 {3}
  141. union
  142. select * from J#ppc_steel_heat where 1 = 1 {3}) p,
  143. (select y.*
  144. from (select x.*,count(1) over(partition by x.HEATNO) cnt,
  145. row_number() over(partition by x.HEATNO order by x.ASSAYTYPECODE) xh
  146. from (select t.*
  147. from stl_chemelement t where upper(SUBSTR(CHECKNO, 12, 1)) = 'I'
  148. and upper(SUBSTR(CHECKNO, -1)) = 'S'
  149. {4}
  150. union
  151. select t.*
  152. from j#stl_CHEMELEMENT t where upper(SUBSTR(CHECKNO, 12, 1)) = 'I'
  153. and upper(SUBSTR(CHECKNO, -1)) = 'S'
  154. {4}
  155. ) x) y
  156. where y.xh in (1, round(y.cnt / 2), y.cnt)) w,
  157. (select y.*
  158. from (select x.*,count(1) over(partition by x.HEATNO) cnt,
  159. row_number() over (partition by x.HEATNO order by x.ASSAYTYPECODE) xh
  160. from (select t.*
  161. from stl_CHEMELEMENT t
  162. where upper(SUBSTR(CHECKNO, -1)) = 'S'
  163. and upper(SUBSTR(CHECKNO, 12, 2)) = 'GP'
  164. {4}
  165. union
  166. select t.*
  167. from J#stl_CHEMELEMENT t
  168. where upper(SUBSTR(CHECKNO, -1)) = 'S'
  169. and upper(SUBSTR(CHECKNO, 12, 2)) = 'GP'
  170. {4}
  171. ) x) y
  172. ) t4
  173. where a.HEATNO = p.HEATNO(+)
  174. and a.HEATNO = w.HEATNO(+)
  175. and a.HEATNO = t4.HEATNO(+)
  176. and a.HEATNO = u.HEATNO(+)
  177. and a.heatno = b.HEATNO(+)
  178. and a.heatno = I.HEATNO(+)
  179. order by OPTDATE";
  180. sqlStr = lgCommon.stringFormat(sqlStr,sqlConditionList);
  181. return sqlStr;
  182. }
  183. }
  184. }
  185. }