7887e6bd449fadee78afb2b18e6ec810f8f31561.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. package xin.glue.ui.G.G04;
  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.context.PosContext;
  6. import com.posdata.glue.dao.vo.PosParameter;
  7. import com.posdata.glue.dao.vo.PosRow;
  8. import com.posdata.glue.dao.vo.PosRowSet;
  9. public class XinReceiveSlab extends PosActivity {
  10. public String runActivity(PosContext context) {
  11. String[] chargeNo = (String[])context.get("CHARGE_NO");
  12. String[] slabNo = (String[])context.get("SLAB_NO");
  13. String[] stlGrd = (String[])context.get("STL_GRD");
  14. String[] curLoc = (String[])context.get("CUR_LOAD_LOC");
  15. String[] slabThk = (String[])context.get("SLAB_THK");
  16. String[] slabWth = (String[])context.get("SLAB_WTH");
  17. String[] slabLen = (String[])context.get("SLAB_LEN");
  18. String[] slabWgt = (String[])context.get("SLAB_WGT");
  19. String[] trsTime = (String[])context.get("TRS_DTIME");
  20. String[] trsCd = (String[])context.get("TRS_CD");
  21. String[] chk = (String[])context.get("CHK");
  22. String[] cheCd = new String[53];
  23. String[] AL = (String[])context.get("AL");
  24. String[] ALS = (String[])context.get("ALS");
  25. String[] ALT = (String[])context.get("ALT");
  26. String[] AS = (String[])context.get("A_S");
  27. String[] B = (String[])context.get("B");
  28. String[] C = (String[])context.get("C");
  29. String[] CE1 = (String[])context.get("CE1");
  30. String[] CE2 = (String[])context.get("CE2");
  31. String[] CE3 = (String[])context.get("CE3");
  32. String[] CEV = (String[])context.get("CEV");
  33. String[] CA = (String[])context.get("CA");
  34. String[] CD = (String[])context.get("CD");
  35. String[] CR = (String[])context.get("CR");
  36. String[] CS = (String[])context.get("CS");
  37. String[] CU = (String[])context.get("CU");
  38. String[] FE = (String[])context.get("FE");
  39. String[] H = (String[])context.get("H");
  40. String[] I = (String[])context.get("I");
  41. String[] LA = (String[])context.get("LA");
  42. String[] MG = (String[])context.get("MG");
  43. String[] MN = (String[])context.get("MN");
  44. String[] MO = (String[])context.get("MO");
  45. String[] N = (String[])context.get("N");
  46. String[] NB = (String[])context.get("NB");
  47. String[] NI = (String[])context.get("NI");
  48. String[] O = (String[])context.get("O");
  49. String[] P = (String[])context.get("P");
  50. String[] PB = (String[])context.get("PB");
  51. String[] PCM = (String[])context.get("PCM");
  52. String[] PSR = (String[])context.get("PSR");
  53. String[] QA1 = (String[])context.get("QA1");
  54. String[] QA2 = (String[])context.get("QA2");
  55. String[] QA3 = (String[])context.get("QA3");
  56. String[] QA4 = (String[])context.get("QA4");
  57. String[] QA5 = (String[])context.get("QA5");
  58. String[] QA6 = (String[])context.get("QA6");
  59. String[] QA7 = (String[])context.get("QA7");
  60. String[] QA8 = (String[])context.get("QA8");
  61. String[] QA9 = (String[])context.get("QA9");
  62. String[] QB1 = (String[])context.get("QB1");
  63. String[] QB2 = (String[])context.get("QB2");
  64. String[] QB3 = (String[])context.get("QB3");
  65. String[] S = (String[])context.get("S");
  66. String[] SB = (String[])context.get("SB");
  67. String[] SE = (String[])context.get("SE");
  68. String[] SI = (String[])context.get("SI");
  69. String[] SN = (String[])context.get("SN");
  70. String[] TI = (String[])context.get("TI");
  71. String[] V = (String[])context.get("V");
  72. String[] W = (String[])context.get("W");
  73. String[] XTZ = (String[])context.get("XTZ");
  74. String[] ZN = (String[])context.get("ZN");
  75. String[] ZR = (String[])context.get("ZR");
  76. cheCd[0 ]="AL";
  77. cheCd[1 ]="ALS";
  78. cheCd[2 ]="ALT";
  79. cheCd[3 ]="AS";
  80. cheCd[4 ]="B";
  81. cheCd[5 ]="C";
  82. cheCd[6 ]="CE1";
  83. cheCd[7 ]="CE2";
  84. cheCd[8 ]="CE3";
  85. cheCd[9 ]="CEV";
  86. cheCd[10]="CA";
  87. cheCd[11]="CD";
  88. cheCd[12]="CR";
  89. cheCd[13]="CS";
  90. cheCd[14]="CU";
  91. cheCd[15]="FE";
  92. cheCd[16]="H";
  93. cheCd[17]="I";
  94. cheCd[18]="LA";
  95. cheCd[19]="MG";
  96. cheCd[20]="MN";
  97. cheCd[21]="MO";
  98. cheCd[22]="N";
  99. cheCd[23]="NB";
  100. cheCd[24]="NI";
  101. cheCd[25]="O";
  102. cheCd[26]="P";
  103. cheCd[27]="PB";
  104. cheCd[28]="PCM";
  105. cheCd[29]="PSR";
  106. cheCd[30]="QA1";
  107. cheCd[31]="QA2";
  108. cheCd[32]="QA3";
  109. cheCd[33]="QA4";
  110. cheCd[34]="QA5";
  111. cheCd[35]="QA6";
  112. cheCd[36]="QA7";
  113. cheCd[37]="QA8";
  114. cheCd[38]="QA9";
  115. cheCd[39]="QB1";
  116. cheCd[40]="QB2";
  117. cheCd[41]="QB3";
  118. cheCd[42]="S";
  119. cheCd[43]="SB";
  120. cheCd[44]="SE";
  121. cheCd[45]="SI";
  122. cheCd[46]="SN";
  123. cheCd[47]="TI";
  124. cheCd[48]="V";
  125. cheCd[49]="W";
  126. cheCd[50]="XTZ";
  127. cheCd[51]="ZN";
  128. cheCd[52]="ZR";
  129. String[][] chmCd = new String[chk.length][53];
  130. for(int i=0; i<chk.length; i++){
  131. chmCd[i][0] = AL[i];
  132. chmCd[i][1] = ALS[i];
  133. chmCd[i][2] = ALT[i];
  134. chmCd[i][3] = AS[i];
  135. chmCd[i][4] = B[i];
  136. chmCd[i][5] = C[i];
  137. chmCd[i][6] = CE1[i];
  138. chmCd[i][7] = CE2[i];
  139. chmCd[i][8] = CE3[i];
  140. chmCd[i][9] = CEV[i];
  141. chmCd[i][10] = CA[i];
  142. chmCd[i][11] = CD[i];
  143. chmCd[i][12] = CR[i];
  144. chmCd[i][13] = CS[i];
  145. chmCd[i][14] = CU[i];
  146. chmCd[i][15] = FE[i];
  147. chmCd[i][16] = H[i];
  148. chmCd[i][17] = I[i];
  149. chmCd[i][18] = LA[i];
  150. chmCd[i][19] = MG[i];
  151. chmCd[i][20] = MN[i];
  152. chmCd[i][21] = MO[i];
  153. chmCd[i][22] = N[i];
  154. chmCd[i][23] = NB[i];
  155. chmCd[i][24] = NI[i];
  156. chmCd[i][25] = O[i];
  157. chmCd[i][26] = P[i];
  158. chmCd[i][27] = PB[i];
  159. chmCd[i][28] = PCM[i];
  160. chmCd[i][29] = PSR[i];
  161. chmCd[i][30] = QA1[i];
  162. chmCd[i][31] = QA2[i];
  163. chmCd[i][32] = QA3[i];
  164. chmCd[i][33] = QA4[i];
  165. chmCd[i][34] = QA5[i];
  166. chmCd[i][35] = QA6[i];
  167. chmCd[i][36] = QA7[i];
  168. chmCd[i][37] = QA8[i];
  169. chmCd[i][38] = QA9[i];
  170. chmCd[i][39] = QB1[i];
  171. chmCd[i][40] = QB2[i];
  172. chmCd[i][41] = QB3[i];
  173. chmCd[i][42] = S[i];
  174. chmCd[i][43] = SB[i];
  175. chmCd[i][44] = SE[i];
  176. chmCd[i][45] = SI[i];
  177. chmCd[i][46] = SN[i];
  178. chmCd[i][47] = TI[i];
  179. chmCd[i][48] = V[i];
  180. chmCd[i][49] = W[i];
  181. chmCd[i][50] = XTZ[i];
  182. chmCd[i][51] = ZN[i];
  183. chmCd[i][52] = ZR[i];
  184. }
  185. PosParameter param ;
  186. PosRowSet rowSet;
  187. PosRow row;
  188. int udtCnt;
  189. for(int i=0; i<chk.length; i++){
  190. param = new PosParameter();
  191. param.setWhereClauseParameter(0, chargeNo[i]);
  192. rowSet = getDao("mesdao").find("UIG040080_CHARGE_EXIS.select", param);
  193. if(rowSet.hasNext()){
  194. row = rowSet.next();
  195. BigDecimal slabCnt = (BigDecimal)row.getAttribute("SLAB_CNT");
  196. BigDecimal chargeWgt = (BigDecimal)row.getAttribute("SLAB_WGT");
  197. slabCnt = slabCnt.add(new BigDecimal(1));
  198. chargeWgt = chargeWgt.add(new BigDecimal(slabWgt[i]));
  199. logger.logInfo("yayayayayayyayayayayayyayayaya----------------------->" + slabCnt);
  200. logger.logInfo("yayayayayayyayayayayayyayayaya----------------------->" + chargeWgt);
  201. param = new PosParameter();
  202. param.setWhereClauseParameter(0, slabCnt);
  203. param.setWhereClauseParameter(1, chargeWgt);
  204. param.setWhereClauseParameter(2, chargeNo[i]);
  205. udtCnt = getDao("mesdao").update("UIE012130.Charge.Update",param);
  206. }else{
  207. param = new PosParameter();
  208. param.setValueParamter(0, chargeNo[i]);
  209. param.setValueParamter(1, stlGrd[i]);
  210. param.setValueParamter(2, new BigDecimal(1));
  211. param.setValueParamter(3, slabWgt[i]);
  212. udtCnt = getDao("mesdao").insert("UIE012130.Charge.Insert", param);
  213. }
  214. param = new PosParameter();
  215. param.setWhereClauseParameter(0, slabNo[i]);
  216. rowSet = getDao("mesdao").find("UIG040080_SLAB_EXIS.select", param);
  217. if(rowSet.hasNext()){
  218. param = new PosParameter();
  219. param.setWhereClauseParameter(0, slabNo[i]);
  220. param.setWhereClauseParameter(1, slabThk[i]);
  221. param.setWhereClauseParameter(2, slabWth[i]);
  222. param.setWhereClauseParameter(3, slabLen[i]);
  223. param.setWhereClauseParameter(4, slabWgt[i]);
  224. param.setWhereClauseParameter(5, "H");
  225. param.setWhereClauseParameter(6, "");
  226. param.setWhereClauseParameter(7, slabNo[i]);
  227. udtCnt = getDao("mesdao").update("UIE012130.Slab.Update",param);
  228. }else{
  229. // 板坯号, 计划板坯号, 子板坯号, 钢号, 厚度, 宽度, 长度, 重量, 板坯去向,
  230. // -- 购入MAKER名称, 购入炉次, 购入板坯码, 作业班次, 作业组, 录入者
  231. param = new PosParameter();
  232. param.setValueParamter(0, slabNo[i]);
  233. param.setValueParamter(1, slabNo[i]);
  234. param.setValueParamter(2, slabNo[i]);
  235. param.setValueParamter(3, stlGrd[i]);
  236. param.setValueParamter(4, slabThk[i]);
  237. param.setValueParamter(5, slabWth[i]);
  238. param.setValueParamter(6, slabLen[i]);
  239. param.setValueParamter(7, slabWgt[i]);
  240. param.setValueParamter(8, "H");
  241. param.setValueParamter(9, trsCd[i]);
  242. param.setValueParamter(10, chargeNo[i]);
  243. param.setValueParamter(11, slabLen[i]);
  244. param.setValueParamter(12, "");
  245. param.setValueParamter(13, "");
  246. param.setValueParamter(14, "");
  247. param.setValueParamter(15, curLoc[i]);
  248. udtCnt = getDao("mesdao").insert("UIE012130.Slab.Insert", param);
  249. param = new PosParameter();
  250. param.setWhereClauseParameter(0, curLoc[i]);
  251. rowSet = getDao("mesdao").find("UIG040060_COMPLUS_TO_ADDR.select", param);
  252. if(rowSet.hasNext()) {
  253. PosRow CompToVoROW = rowSet.next();
  254. String StoreLay = (String)CompToVoROW.getAttribute("STORELAY");
  255. // TO Address SLAB NO Setting
  256. PosParameter param2 = new PosParameter();
  257. param2.setValueParamter(0, slabNo[i]);
  258. param2.setValueParamter(1, "UIG040080");
  259. param2.setValueParamter(2, "T001");
  260. param2.setValueParamter(3, StoreLay);
  261. param2.setValueParamter(4, curLoc[i]);
  262. getDao("mesdao").update("UIG040060_COMPLUS_MOVE.update",param2);
  263. }
  264. }
  265. for(int j=0; j<53; j++){
  266. param = new PosParameter();
  267. param.setWhereClauseParameter(0, new BigDecimal(chmCd[i][j]));
  268. param.setWhereClauseParameter(1, "USER003");
  269. param.setWhereClauseParameter(2, chargeNo[i]);
  270. param.setWhereClauseParameter(3, cheCd[j]);
  271. udtCnt = getDao("mesdao").update("UIE012130.WorkIngr.pdate", param);
  272. if(udtCnt == 0){
  273. param = new PosParameter();
  274. param.setValueParamter(0, chargeNo[i]);
  275. param.setValueParamter(1, cheCd[j]);
  276. param.setValueParamter(2, new BigDecimal(chmCd[i][j]));
  277. param.setValueParamter(3, "USER003");
  278. udtCnt = getDao("mesdao").insert("UIE012130.WorkIngr.Insert", param);
  279. }
  280. }
  281. }
  282. param = new PosParameter();
  283. getDao("mesdao").update("UIG040080_SLAB_RECEIVED.update", param);
  284. context.put("MESSAGES", "操作成功!");
  285. return PosBizControlConstants.SUCCESS;
  286. }
  287. }