05e5bf9a7ada38dc15b4599d78eec994f4812ef9.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. package xin.glue.ui.G.G02;
  2. import java.math.BigDecimal;
  3. import com.posdata.glue.biz.activity.PosActivity;
  4. import com.posdata.glue.biz.constants.PosBizControlConstants;
  5. import com.posdata.glue.biz.control.PosBizControlIF;
  6. import com.posdata.glue.biz.control.PosBizProvider;
  7. import com.posdata.glue.context.PosContext;
  8. import com.posdata.glue.dao.vo.PosParameter;
  9. import com.posdata.glue.dao.vo.PosRow;
  10. import com.posdata.glue.dao.vo.PosRowSet;
  11. import com.posdata.glue.msg.PosMESMessageImpl;
  12. import com.posdata.glue.msg.PosMessage;
  13. /**
  14. * 转炉实绩录入信息
  15. *
  16. * BOF实绩查询后,按CHARGE_NO执行更新或插入操作 铁合金、辅料、废料数据更新或插入
  17. *
  18. * @author 梅贵平
  19. * @date 2008-9-1
  20. */
  21. public class PosSaveBofResut extends PosActivity {
  22. public String runActivity(PosContext context) {
  23. logger.logInfo("PosSaveBofResut START ");
  24. String[] rowStutsFlag = (String[]) context.get("rowStutsFlag");// 标记是否更新或插入BOF实绩(原料实绩除外)
  25. // PosGenericDao dao = this.getDao("mesdao");
  26. // rowStutsFlag若存在,即可以:若按CHARGE_NO查询出TBG02_BOF_RESULT中无该记录(即count为0),
  27. // 则执行插入语句, 否则执行更新语句
  28. if (rowStutsFlag != null && rowStutsFlag.length > 0) {
  29. String sql = "SELECT CHARGE_NO FROM TBG02_BOF_RESULT WHERE CHARGE_NO = ?";// 判断某条满足条件的记录是否存在
  30. String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");
  31. String[] PLAN_CHARGE_NO = (String[]) context.get("PLAN_CHARGE_NO");
  32. PosParameter param = new PosParameter();
  33. param.setWhereClauseParameter(0, CHARGE_NO[0]);
  34. PosRowSet rowset = getDao("mesdao").findByQueryStatement(sql, param);
  35. int count = rowset.count();
  36. PosParameter posparam = new PosParameter();
  37. String[] XIN_DATE = (String[]) context.get("XIN_DATE");// 统计日
  38. String[] BOF_NO = (String[]) context.get("BOF_NO"); // 转炉号
  39. String[] WKSHIFT = (String[]) context.get("WKSHIFT"); // 班次
  40. String[] WKGROUP = (String[]) context.get("WKGROUP"); // 组
  41. String[] EMP_ID = (String[]) context.get("EMP_ID"); // 作业人
  42. String[] TAPPING_WGT = (String[]) context.get("TAPPING_WGT"); // 出钢量
  43. String[] IRON_CHARGE_WGT = (String[]) context
  44. .get("IRON_CHARGE_WGT"); // 铁水装入量
  45. String[] SCRAP_CHARGE_WGT = (String[]) context
  46. .get("SCRAP_CHARGE_WGT");// 废钢装入量
  47. String[] SCRAP_ZINC_CHARGE_WGT = (String[]) context
  48. .get("SCRAP_ZINC_CHARGE_WGT");// 生铁装入量
  49. String[] SUBRAW_WGT = (String[]) context.get("SUBRAW_WGT"); // 辅原料用量
  50. String[] TAPPING_AFT_TEMP = (String[]) context
  51. .get("TAPPING_AFT_TEMP");// 出钢温度
  52. String[] O2_CONSUME = (String[]) context.get("O2_CONSUME");// 氧气用量
  53. String[] AR_CONSUME = (String[]) context.get("AR_CONSUME");// 氩气用量
  54. String[] N2_CONSUME = (String[]) context.get("N2_CONSUME");// 氮气用量
  55. String PlanChNo = null;
  56. if (PLAN_CHARGE_NO[0] == null || PLAN_CHARGE_NO[0].equals("")) {
  57. PlanChNo = '3' + CHARGE_NO[0].substring(1, 10);
  58. } else {
  59. PlanChNo = PLAN_CHARGE_NO[0];
  60. }
  61. String PRODNM_CD = null;
  62. String STL_GRD = null;
  63. String LINE_PROC_CD = null;
  64. String HCR_CLF = null;
  65. String SPEC_ABBSYM = null;
  66. String CAST_MANA_NO = null;
  67. String SLAB_RT = null;
  68. String STATUS_CD = null;
  69. Number CAST_CHARGE_SEQ = null;
  70. String CHARGE_MANA_NO = null;
  71. Number CAST_EDT_CHARGE_CNT = null;
  72. PosParameter paramA = new PosParameter();
  73. paramA.setWhereClauseParameter(0, PlanChNo);
  74. PosRowSet L2Send = this.getDao("mesdao").find("UIG020020_L2_SEND_CHARGE.select", paramA);
  75. if(!L2Send.hasNext()){
  76. context.put("MESSAGES", " 指示尚未下发!");
  77. return PosBizControlConstants.SUCCESS;
  78. }
  79. paramA = new PosParameter();
  80. paramA.setWhereClauseParameter(0, PlanChNo);
  81. PosRowSet specChVo = this.getDao("mesdao").find("NIG020200_SPEC_CHARGE.select", paramA);
  82. if (specChVo.hasNext()) {
  83. PosRow specChROW = specChVo.next();
  84. PRODNM_CD = (String) specChROW.getAttribute("PRODNM_CD");
  85. STL_GRD = (String) specChROW.getAttribute("STL_GRD");
  86. LINE_PROC_CD = (String) specChROW.getAttribute("LINE_PROC_CD");
  87. HCR_CLF = (String) specChROW.getAttribute("HCR_CLF");
  88. SPEC_ABBSYM = (String) specChROW.getAttribute("SPEC_ABBSYM");
  89. CAST_MANA_NO = (String) specChROW.getAttribute("CAST_MANA_NO");
  90. CAST_CHARGE_SEQ = (Number) specChROW.getAttribute("CAST_CHARGE_SEQ");
  91. CHARGE_MANA_NO = (String) specChROW.getAttribute("CHARGE_MANA_NO");
  92. CAST_EDT_CHARGE_CNT = (Number) specChROW.getAttribute("CAST_EDT_CHARGE_CNT");
  93. SLAB_RT = (String) specChROW.getAttribute("SLAB_RT");
  94. STATUS_CD = (String) specChROW.getAttribute("STATUS_CD");
  95. }
  96. // 判断查询是否有记录,无记录则count为0,进入if段插入某炉次号及实绩,否则进入else段更新某炉次号信息
  97. if (count == 0 ) {
  98. posparam.setValueParamter(0, CHARGE_NO[0]);
  99. posparam.setValueParamter(1, XIN_DATE[0]);
  100. posparam.setValueParamter(2, BOF_NO[0]);
  101. posparam.setValueParamter(3, WKSHIFT[0]);
  102. posparam.setValueParamter(4, WKGROUP[0]);
  103. posparam.setValueParamter(5, EMP_ID[0]);
  104. posparam.setValueParamter(6, TAPPING_WGT[0]);
  105. posparam.setValueParamter(7, IRON_CHARGE_WGT[0]);
  106. posparam.setValueParamter(8, SCRAP_CHARGE_WGT[0]);
  107. posparam.setValueParamter(9, SCRAP_ZINC_CHARGE_WGT[0]);
  108. posparam.setValueParamter(10, SUBRAW_WGT[0]);
  109. posparam.setValueParamter(11, TAPPING_AFT_TEMP[0]);
  110. posparam.setValueParamter(12, O2_CONSUME[0]);
  111. posparam.setValueParamter(13, AR_CONSUME[0]);
  112. posparam.setValueParamter(14, N2_CONSUME[0]);
  113. posparam.setValueParamter(15, PlanChNo);
  114. getDao("mesdao").insert("UIG020020_01.insert", posparam);// 按炉次号插入一条新记录到转炉实绩表中
  115. if ( STATUS_CD == null || (STATUS_CD != null && (STATUS_CD.equals("A") || STATUS_CD.equals("B")))) {
  116. PosParameter param5 = new PosParameter();
  117. //String sProgCd = "JBF";
  118. //param5.setValueParamter(0, sProgCd);
  119. //param5.setValueParamter(0, "B");
  120. //param5.setValueParamter(1, PlanChNo);
  121. PosParameter param6 = new PosParameter();
  122. param6.setValueParamter(0, "B");
  123. param6.setValueParamter(1, PlanChNo);
  124. this.getDao("mesdao").update("NIG020200_SPEC_PROG_02.update",param6);
  125. this.getDao("mesdao").update("NIG020200_SPEC_CHARGE_IDX.update", param6);
  126. if(STATUS_CD == null||(STATUS_CD != null&& STATUS_CD.equals("A"))){
  127. param6 = new PosParameter();
  128. param6.setWhereClauseParameter(0, "B");
  129. param6.setWhereClauseParameter(1, "BOF");
  130. param6.setWhereClauseParameter(2, PlanChNo);
  131. this.getDao("mesdao").update("NIG020610_SPEC_SLAB_COMM.update",param6);
  132. PosParameter param7 = new PosParameter();
  133. param7.setWhereClauseParameter(0, PlanChNo);
  134. PosRowSet specslabVo = this.getDao("mesdao").find("NIG020210_SPEC_SLAB.select", param7);
  135. while (specslabVo.hasNext()) {
  136. PosRow specslabROW = specslabVo.next();
  137. Number SlabEdtSeq = (Number) specslabROW.getAttribute("SLAB_EDT_SEQ");
  138. PosParameter param8 = new PosParameter();
  139. param8.setValueParamter(0, "B");
  140. param8.setValueParamter(1, SlabEdtSeq);
  141. this.getDao("mesdao").update("NIG020610_SPEC_SLAB_D.update", param8);
  142. }
  143. }
  144. }
  145. } else {
  146. posparam.setWhereClauseParameter(0, XIN_DATE[0]);
  147. posparam.setWhereClauseParameter(1, BOF_NO[0]);
  148. posparam.setWhereClauseParameter(2, WKSHIFT[0]);
  149. posparam.setWhereClauseParameter(3, WKGROUP[0]);
  150. posparam.setWhereClauseParameter(4, EMP_ID[0]);
  151. posparam.setWhereClauseParameter(5, TAPPING_WGT[0]);
  152. posparam.setWhereClauseParameter(6, IRON_CHARGE_WGT[0]);
  153. posparam.setWhereClauseParameter(7, SCRAP_CHARGE_WGT[0]);
  154. posparam.setWhereClauseParameter(8, SCRAP_ZINC_CHARGE_WGT[0]);
  155. posparam.setWhereClauseParameter(9, SUBRAW_WGT[0]);
  156. posparam.setWhereClauseParameter(10, TAPPING_AFT_TEMP[0]);
  157. posparam.setWhereClauseParameter(11, O2_CONSUME[0]);
  158. posparam.setWhereClauseParameter(12, AR_CONSUME[0]);
  159. posparam.setWhereClauseParameter(13, N2_CONSUME[0]);
  160. posparam.setWhereClauseParameter(14, CHARGE_NO[0]);
  161. getDao("mesdao").update("UIG020020_01.update", posparam);// 按炉次号对转炉实绩表中数据更新
  162. }
  163. //修改炉次公共表
  164. PosParameter param8 = new PosParameter();
  165. param8.setWhereClauseParameter(0, CHARGE_NO[0]);
  166. PosRowSet chComVo = this.getDao("mesdao").find( "UIG020020_CH_COM.select", param8);
  167. String BefProg = null;
  168. String CurrProg = null;
  169. String ChargeStat = null;
  170. if (chComVo.hasNext()) {
  171. PosRow chComROW = chComVo.next();
  172. CurrProg = (String) chComROW.getAttribute("CUR_PROG_CD");
  173. BefProg = (String) chComROW.getAttribute("BEF_PROG_CD");
  174. ChargeStat = (String) chComROW.getAttribute("CHARGE_STAT");
  175. if (ChargeStat != null && ChargeStat.equals("2")) {
  176. if (CurrProg == null) {
  177. CurrProg = "JBF";
  178. BefProg = "JBB";
  179. //防止修改转炉实绩时 物料进程退回为转炉处理
  180. } else if (CurrProg != null && !(CurrProg.equals("JCF") || CurrProg.equals("JLF") || CurrProg.equals("JRF") || CurrProg.equals("JJB"))) {
  181. BefProg = CurrProg;
  182. CurrProg = "JBF";
  183. }
  184. PosParameter param9 = new PosParameter();
  185. param9.setValueParamter(0, CurrProg);
  186. param9.setValueParamter(1, "UIG020020");
  187. param9.setValueParamter(2, BefProg );
  188. param9.setValueParamter(3, TAPPING_WGT[0]);
  189. param9.setValueParamter(4, TAPPING_WGT[0]);
  190. param9.setValueParamter(5, BOF_NO[0]);
  191. param9.setValueParamter(6, SLAB_RT);
  192. param9.setValueParamter(7, CHARGE_NO[0]);
  193. this.getDao("mesdao").update("UIG020020_CH_COM.update", param9);
  194. }
  195. } else {
  196. PosParameter param10 = new PosParameter();
  197. param10.setValueParamter(0, CHARGE_NO[0]);
  198. param10.setValueParamter(1, CHARGE_MANA_NO);
  199. param10.setValueParamter(2, STL_GRD);
  200. param10.setValueParamter(3, PRODNM_CD);
  201. param10.setValueParamter(4, LINE_PROC_CD);
  202. param10.setValueParamter(5, HCR_CLF);
  203. param10.setValueParamter(6, SPEC_ABBSYM);
  204. param10.setValueParamter(7, CAST_MANA_NO);
  205. param10.setValueParamter(8, CAST_CHARGE_SEQ);
  206. param10.setValueParamter(9, CAST_EDT_CHARGE_CNT);
  207. param10.setValueParamter(10, "JBF");
  208. param10.setValueParamter(11, "UIG020020");
  209. param10.setValueParamter(12, TAPPING_WGT[0]);
  210. param10.setValueParamter(13, TAPPING_WGT[0]);
  211. param10.setValueParamter(14, BOF_NO[0]);
  212. param10.setValueParamter(15, SLAB_RT);
  213. this.getDao("mesdao").update("UIG020020_CH_COM.insert", param10);
  214. }
  215. BigDecimal TapWgt = null;
  216. if (TAPPING_WGT[0] == null || TAPPING_WGT[0].equals("")) {
  217. TapWgt = new BigDecimal(0);
  218. } else {
  219. TapWgt = new BigDecimal(TAPPING_WGT[0]);
  220. }
  221. SendProg_NIE012070(PlanChNo, BefProg, TapWgt);
  222. SendProg_NIE012080();
  223. }
  224. String[] rowStuts4 = (String[]) context.get("rowStuts4");// UIG020020页面铁合金表传过来的值
  225. if (rowStuts4 != null)// 判断是否需对铁合金记录执行更新或录入
  226. {
  227. String[] MAINRAW_CD = (String[]) context.get("MAINRAW_CD");// 铁合金CODE
  228. // String[] MAINRAW_CD_DESC =
  229. // (String[])context.get("MAINRAW_CD_DESC");//铁合金CODE内容
  230. String[] MAINRAW_WGT = (String[]) context.get("MAINRAW_WGT");// 铁合金用量
  231. String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");// 炉次号
  232. for (int i = 0; i < rowStuts4.length; i++) {
  233. // 调用存储过程UP_IN_TBG03_MAINRAW ,对铁合金数据更新或插入
  234. PosParameter param1 = new PosParameter();
  235. param1.setWhereClauseParameter(0, CHARGE_NO[0]);
  236. param1.setWhereClauseParameter(1, MAINRAW_CD[i]);
  237. PosRowSet scrapVo = this.getDao("mesdao").find( "NIG020230_02.select", param1);
  238. if (scrapVo.hasNext()) {
  239. PosParameter param2 = new PosParameter();
  240. param2.setValueParamter(0, MAINRAW_WGT[i]);
  241. param2.setValueParamter(1, CHARGE_NO[0]);
  242. param2.setValueParamter(2, MAINRAW_CD[i]);
  243. this.getDao("mesdao").update("NIG020230_01.update", param2);
  244. } else {
  245. PosParameter param2 = new PosParameter();
  246. param2.setValueParamter(0, CHARGE_NO[0]);
  247. param2.setValueParamter(1, MAINRAW_CD[i]);
  248. param2.setValueParamter(2, MAINRAW_WGT[i]);
  249. this.getDao("mesdao").update("NIG020230_01.insert", param2);
  250. }
  251. }
  252. }
  253. String[] rowStuts5 = (String[]) context.get("rowStuts5");// UIG020020页面辅料表传过来的值
  254. if (rowStuts5 != null)// 判断是否需对辅料记录执行更新或录入
  255. {
  256. String[] MAINRAW_CD = (String[]) context.get("MAINRAW_CD");// 辅料CODE
  257. // String[] MAINRAW_CD_DESC =
  258. // (String[])context.get("MAINRAW_CD_DESC");//辅料CODE内容
  259. String[] MAINRAW_WGT = (String[]) context.get("MAINRAW_WGT");// 辅料用量
  260. String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");// 炉次号
  261. for (int i = 0; i < rowStuts5.length; i++) {
  262. PosParameter param1 = new PosParameter();
  263. param1.setWhereClauseParameter(0, CHARGE_NO[0]);
  264. param1.setWhereClauseParameter(1, MAINRAW_CD[i]);
  265. PosRowSet scrapVo = this.getDao("mesdao").find( "NIG020220_02.select", param1);
  266. if (scrapVo.hasNext()) {
  267. PosParameter param2 = new PosParameter();
  268. param2.setValueParamter(0, MAINRAW_WGT[i]);
  269. param2.setValueParamter(1, CHARGE_NO[0]);
  270. param2.setValueParamter(2, MAINRAW_CD[i]);
  271. this.getDao("mesdao").update("NIG020220_01.update", param2);
  272. } else {
  273. PosParameter param2 = new PosParameter();
  274. param2.setValueParamter(0, CHARGE_NO[0]);
  275. param2.setValueParamter(1, MAINRAW_CD[i]);
  276. param2.setValueParamter(2, MAINRAW_WGT[i]);
  277. this.getDao("mesdao").update("NIG020220_01.insert", param2);
  278. }
  279. }
  280. }
  281. String[] rowStuts8 = (String[]) context.get("rowStuts8");// UIG020020页面废料表传过来的值
  282. if (rowStuts8 != null)// 判断是否需要对废料数据更新或插入
  283. {
  284. String[] MAINRAW_CD = (String[]) context.get("MAINRAW_CD");// 废料CODE
  285. // String[] MAINRAW_CD_DESC =
  286. // (String[])context.get("MAINRAW_CD_DESC");//废料CODE内容
  287. String[] MAINRAW_WGT = (String[]) context.get("MAINRAW_WGT");// 废料重量
  288. String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");// 炉次号
  289. for (int i = 0; i < rowStuts8.length; i++) {
  290. PosParameter param1 = new PosParameter();
  291. param1.setWhereClauseParameter(0, CHARGE_NO[0]);
  292. param1.setWhereClauseParameter(1, MAINRAW_CD[i]);
  293. PosRowSet scrapVo = this.getDao("mesdao").find("NIG020220_02.select", param1);
  294. if (scrapVo.hasNext()) {
  295. PosParameter param2 = new PosParameter();
  296. param2.setValueParamter(0, MAINRAW_WGT[i]);
  297. param2.setValueParamter(1, CHARGE_NO[0]);
  298. param2.setValueParamter(2, MAINRAW_CD[i]);
  299. this.getDao("mesdao").update("NIG020220_01.update", param2);
  300. } else {
  301. PosParameter param2 = new PosParameter();
  302. param2.setValueParamter(0, CHARGE_NO[0]);
  303. param2.setValueParamter(1, MAINRAW_CD[i]);
  304. param2.setValueParamter(2, MAINRAW_WGT[i]);
  305. this.getDao("mesdao").update("NIG020220_01.insert", param2);
  306. }
  307. }
  308. }
  309. return PosBizControlConstants.SUCCESS;
  310. }
  311. public PosContext SendProg_NIE012070(String ChargeNo, String BefProg,
  312. BigDecimal wgt) {
  313. logger.logInfo("XinSaveBofResult wgt:" + wgt);
  314. // BigDecimal wgt = new BigDecimal();
  315. PosContext context = new PosContext();
  316. PosMessage message = new PosMESMessageImpl();
  317. String TcId = "NIE012070";
  318. message.setTCID(TcId);
  319. message.setObject("MSG_ID", TcId);
  320. message.setObject("BEF_ORD_NO", null);
  321. message.setObject("BEF_ORD_SEQ", null);
  322. message.setObject("ORD_NO", null);
  323. message.setObject("ORD_SEQ", null);
  324. message.setObject("BEF_PROG_CD", "JBB");
  325. message.setObject("PROG_CD", "JBF");
  326. message.setObject("MAT_TYPE", "CH");
  327. message.setObject("MAT_NO", ChargeNo);
  328. message.setObject("WGT", wgt);
  329. message.setObject("PGMID", "UIG020020");
  330. message.setObject("REG_ID", "UIG020020");
  331. message.setTCID(TcId);
  332. context.setMessage(message);
  333. String serviceName = "NIE012070";
  334. String SERVICE_POSTFIX = "-service";
  335. context.put(PosBizControlConstants.SERVICE_NAME, serviceName
  336. + SERVICE_POSTFIX);
  337. PosBizControlIF controller = PosBizProvider.getController();
  338. controller.doSubController(context, false);
  339. logger.logInfo("XinSaveBofResult---> NIE012070 TC SendProgress end");
  340. return null;
  341. }
  342. public PosContext SendProg_NIE012080() {
  343. logger.logInfo("XinSaveBofResult SendProg_NIE012080 ");
  344. PosContext context = new PosContext();
  345. PosMessage message = new PosMESMessageImpl();
  346. String TcId = "NIE012080";
  347. message.setTCID(TcId);
  348. message.setObject("MSG_ID", TcId);
  349. message.setObject("AA", null);
  350. message.setTCID(TcId);
  351. context.setMessage(message);
  352. // this.processComponent(PosConstants.CREATE_MESSAGE, context);
  353. // String transactionCode = context.getMessage().getTC();
  354. String serviceName = "NIE012080";
  355. String SERVICE_POSTFIX = "-service";
  356. context.put(PosBizControlConstants.SERVICE_NAME, serviceName
  357. + SERVICE_POSTFIX);
  358. // context.setMessage(message);
  359. PosBizControlIF controller = PosBizProvider.getController();
  360. controller.doSubController(context, false);
  361. logger.logInfo("XinSaveBofResult---> NIE012080 TC SendProgress end");
  362. return null;
  363. }
  364. }