bcc55d0aac6aab51c101a5fd7bb3438e8e66aa90.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. package xin.glue.ui.H.H05;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.sql.SQLException;
  5. import java.sql.Types;
  6. import xin.glue.ui.common.ProduceFactory;
  7. import xin.glue.ui.common.component.PosSiteLog;
  8. import com.posdata.glue.PosException;
  9. import com.posdata.glue.biz.activity.PosActivity;
  10. import com.posdata.glue.biz.constants.PosBizControlConstants;
  11. import com.posdata.glue.biz.control.PosBizControlIF;
  12. import com.posdata.glue.biz.control.PosBizProvider;
  13. import com.posdata.glue.component.PosConstants;
  14. import com.posdata.glue.context.PosContext;
  15. import com.posdata.glue.dao.vo.PosParameter;
  16. import com.posdata.glue.dao.vo.PosRow;
  17. import com.posdata.glue.dao.vo.PosRowSet;
  18. import com.posdata.glue.msg.PosMESMessageImpl;
  19. import com.posdata.glue.msg.PosMessage;
  20. /*
  21. * 冷轧移送确认处理
  22. * @author siy
  23. * @date 2010-12-9
  24. */
  25. public class SEND_LZ_CONFIRM extends PosActivity {
  26. public String runActivity(PosContext context) {
  27. // 钢卷号
  28. String[] COIL_NOS = (String[]) context.get("COIL_NOS");
  29. // 移送顺序
  30. String[] TRANSSEQS = (String[]) context.get("TRANSSEQS");
  31. // 移送方式
  32. String[] TRANSTYPES = (String[]) context.get("TRANSTYPES");
  33. // 步进梁号/车辆号
  34. String[] TRANSNOS = (String[]) context.get("TRANSNOS");
  35. // 操作时间
  36. String[] TRANSTIMES = (String[]) context.get("TRANSTIMES");
  37. String transFlag = "Y";// 是否移送确认
  38. if (null != COIL_NOS) {
  39. String[] coilNos = COIL_NOS[0].split("\\|");
  40. String[] transSeqs = TRANSSEQS[0].split("\\|");
  41. String[] transTypes = TRANSTYPES[0].split("\\|");
  42. String[] transNos = TRANSNOS[0].split("\\|");
  43. String[] transTimes = TRANSTIMES[0].split("\\|");
  44. for (int i = 0; i < coilNos.length; i++) {
  45. // 更新冷轧原料库钢卷公共表
  46. updateColdCoilComm(coilNos[i], transTypes[i], transNos[i],
  47. transTimes[i], transSeqs[i]);
  48. // 更新原料钢卷公共_D表
  49. updateColdCoilCommD(coilNos[i]);
  50. // 更新热轧成品库移送确认状态
  51. updateTbhConfirm(coilNos[i],transFlag);
  52. }
  53. }
  54. return PosBizControlConstants.SUCCESS;
  55. }
  56. /**
  57. * 将热轧库钢卷信息转移到冷轧原料库
  58. *
  59. * @param coilNo
  60. * 钢卷号
  61. * @param transType
  62. * 移送区分
  63. * @param transNo
  64. * 移送步进梁号/车辆号
  65. * @param transTime
  66. * 移送时间
  67. * @return boolean
  68. */
  69. private boolean updateColdCoilComm(String coilNo, String transType,
  70. String transNo, String transTime, String transSeq) {
  71. boolean addRs = false;
  72. if (null == coilNo || "".equals(coilNo)) {
  73. return addRs;
  74. }
  75. // 如果冷轧原料公共表中不存在此钢卷信息
  76. if (!hasCoilInTBK(coilNo)) {
  77. PosParameter param = new PosParameter();
  78. param.setValueParamter(0, transType);
  79. param.setValueParamter(1, transNo);
  80. param.setValueParamter(2, transTime);
  81. param.setValueParamter(3, transSeq);
  82. param.setValueParamter(4, coilNo);
  83. param.setWhereClauseParameter(0, coilNo);
  84. int count = getDao("mesdao").insert("UIH052400_01.insert", param);
  85. //调用存货异动点存储过程
  86. /*
  87. ProduceFactory PD= new ProduceFactory();
  88. PD.ErpDataCover("HCOIL",coilNo,"55A","1","O","蔡伟平","热轧转出");*/
  89. if (0 < count) {
  90. addRs = true;
  91. logger.logInfo("addColdCoil success ---SEND_LZ.java ");
  92. }
  93. } else {
  94. // 更新冷轧库钢卷信息,更新热轧库出库信息
  95. PosParameter param1 = new PosParameter();
  96. param1.setWhereClauseParameter(0, coilNo);
  97. PosRowSet rowSet = getDao("mesdao").find("UIH052400_07.select",
  98. param1);
  99. if (rowSet.hasNext()) {
  100. PosRow posRow = rowSet.next();
  101. PosParameter param2 = new PosParameter();
  102. param2.setValueParamter(0, posRow.getAttribute("SLAB_NO"));
  103. param2.setValueParamter(1, posRow.getAttribute("CUR_PROG_CD"));
  104. param2.setValueParamter(2, posRow
  105. .getAttribute("CUR_PROG_CD_DTIME"));
  106. param2.setValueParamter(3, posRow
  107. .getAttribute("CUR_PROG_CD_PGM"));
  108. param2.setValueParamter(4, posRow
  109. .getAttribute("INSTR_COIL_THK"));
  110. param2.setValueParamter(5, posRow
  111. .getAttribute("INSTR_COIL_WTH"));
  112. param2.setValueParamter(6, posRow
  113. .getAttribute("INSTR_COIL_LEN"));
  114. param2.setValueParamter(7, posRow
  115. .getAttribute("INSTR_COIL_INDIA"));
  116. param2.setValueParamter(8, posRow
  117. .getAttribute("INSTR_COIL_OUTDIA"));
  118. param2.setValueParamter(9, posRow
  119. .getAttribute("INSTR_COIL_WGT"));
  120. param2
  121. .setValueParamter(10, posRow
  122. .getAttribute("DEVLMT_DTIME"));
  123. param2.setValueParamter(11, posRow.getAttribute("DEST_CD"));
  124. param2.setValueParamter(12, posRow.getAttribute("ORDCUST_CD"));
  125. param2.setValueParamter(13, posRow.getAttribute("CUST_CD"));
  126. param2.setValueParamter(14, posRow.getAttribute("COIL_LEN"));
  127. param2.setValueParamter(15, posRow.getAttribute("COIL_INDIA"));
  128. param2.setValueParamter(16, posRow.getAttribute("COIL_OUTDIA"));
  129. param2.setValueParamter(17, posRow.getAttribute("COIL_THK"));
  130. param2.setValueParamter(18, posRow.getAttribute("COIL_WTH"));
  131. param2.setValueParamter(19, posRow.getAttribute("ACT_WGT"));
  132. param2.setValueParamter(20, posRow.getAttribute("ORD_FL"));
  133. param2.setValueParamter(21, posRow.getAttribute("ORD_NO"));
  134. param2.setValueParamter(22, posRow.getAttribute("ORD_SEQ"));
  135. param2.setValueParamter(23, posRow.getAttribute("PRODNM_CD"));
  136. param2.setValueParamter(24, posRow.getAttribute("SPEC_ABBSYM"));
  137. param2
  138. .setValueParamter(25, posRow
  139. .getAttribute("SPEC_STL_GRD"));
  140. param2.setValueParamter(26, posRow.getAttribute("ORD_USE_CD"));
  141. param2.setValueParamter(27, posRow.getAttribute("STL_GRD"));
  142. param2
  143. .setValueParamter(28, posRow
  144. .getAttribute("PATH_MILL_CD"));
  145. param2
  146. .setValueParamter(29, posRow
  147. .getAttribute("INGR_DEC_GRD"));
  148. param2.setValueParamter(30, posRow
  149. .getAttribute("EXTSHAPE_DEC_GRD"));
  150. param2
  151. .setValueParamter(31, posRow
  152. .getAttribute("SIZE_DEC_RST"));
  153. param2.setValueParamter(32, posRow.getAttribute("WGT_DEC_RST"));
  154. param2
  155. .setValueParamter(33, posRow
  156. .getAttribute("PROC_DEC_RST"));
  157. param2.setValueParamter(34, posRow
  158. .getAttribute("MATLQLTY_DEC_GRD"));
  159. param2.setValueParamter(35, posRow.getAttribute("TOT_DEC_GRD"));
  160. param2.setValueParamter(36, posRow.getAttribute("MILL_DTIME"));
  161. param2.setValueParamter(37, posRow.getAttribute("CRK_CD1"));
  162. param2.setValueParamter(38, posRow.getAttribute("CRK_CD2"));
  163. param2.setValueParamter(39, posRow.getAttribute("CRK_CD3"));
  164. param2.setValueParamter(40, posRow.getAttribute("CRK_CD4"));
  165. param2.setValueParamter(41, posRow.getAttribute("CRK_CD5"));
  166. param2.setValueParamter(42, posRow.getAttribute("CAL_WGT"));
  167. param2
  168. .setValueParamter(43, posRow
  169. .getAttribute("OLD_SAMPL_NO"));
  170. param2.setValueParamter(44, transType);
  171. param2.setValueParamter(45, transNo);
  172. param2.setValueParamter(46, transTime);
  173. param2.setValueParamter(47, posRow
  174. .getAttribute("FM_EXT_STRIP_THK_AVG"));
  175. param2.setValueParamter(48, posRow
  176. .getAttribute("FM_EXT_STRIP_TEMP_AVG"));
  177. param2.setValueParamter(49, posRow.getAttribute("DC_TEMP_AVG"));
  178. param2.setValueParamter(50, posRow
  179. .getAttribute("FM_EXT_STRIP_CROWN_AVG"));
  180. param2.setValueParamter(51, posRow
  181. .getAttribute("YARD_ENTRY_DTIME"));
  182. param2.setValueParamter(52, posRow.getAttribute("SAMPL_NO"));
  183. param2.setValueParamter(53, posRow
  184. .getAttribute("SAMPL_CUT_LOC"));
  185. param2.setValueParamter(54, posRow.getAttribute("ORD_FL"));// OLD_ORD_FL
  186. param2.setValueParamter(55, posRow.getAttribute("ORD_NO"));// OLD_ORD_NO
  187. param2.setValueParamter(56, posRow.getAttribute("ORD_SEQ"));// OLD_ORD_SEQ
  188. param2.setValueParamter(57, transSeq);
  189. param2.setWhereClauseParameter(0, coilNo);
  190. int count = getDao("mesdao").update("UIH052400_02.update",
  191. param2);
  192. if (count > 0) {
  193. addRs = true;
  194. logger.logInfo("updColdCoil success ---SEND_LZ.java ");
  195. }
  196. }
  197. }
  198. return addRs;
  199. }
  200. private void updateColdCoilCommD(String coilNo) {
  201. // 更新c_tbk02_comm_d表
  202. PosParameter param1 = new PosParameter();
  203. param1.setWhereClauseParameter(0, coilNo);
  204. PosRowSet rowSet = getDao("mesdao").find("UIH052400_05.select", param1);
  205. PosParameter param2 = new PosParameter();
  206. if (rowSet.hasNext()) {
  207. PosRowSet rowSet2 = getDao("mesdao").find("UIH052400_06.select",
  208. param1);
  209. if (rowSet2.hasNext()) {
  210. PosRow pRow = rowSet2.next();
  211. Object cut_seq = pRow.getAttribute("CUT_SEQ");
  212. Object ord_thk = pRow.getAttribute("ORD_THK");
  213. Object ord_wth = pRow.getAttribute("ORD_WTH");
  214. Object ord_len = pRow.getAttribute("ORD_LEN");
  215. Object ord_wgt = pRow.getAttribute("ORD_WGT");
  216. Object ord_wgt_min = pRow.getAttribute("ORD_WGT_MIN");
  217. Object ord_wgt_max = pRow.getAttribute("ORD_WGT_MAX");
  218. Object ord_india = pRow.getAttribute("ORD_INDIA");
  219. Object ord_outdia = pRow.getAttribute("ORD_OUTDIA");
  220. Object ord_no = pRow.getAttribute("ORD_NO");
  221. Object ord_seq = pRow.getAttribute("ORD_SEQ");
  222. Object ord_fl = pRow.getAttribute("ORD_FL");
  223. param2.setValueParamter(0, cut_seq);
  224. param2.setValueParamter(1, ord_thk);
  225. param2.setValueParamter(2, ord_wth);
  226. param2.setValueParamter(3, ord_len);
  227. param2.setValueParamter(4, ord_wgt);
  228. param2.setValueParamter(5, ord_wgt_min);
  229. param2.setValueParamter(6, ord_wgt_max);
  230. param2.setValueParamter(7, ord_india);
  231. param2.setValueParamter(8, ord_outdia);
  232. param2.setValueParamter(9, ord_no);
  233. param2.setValueParamter(10, ord_seq);
  234. param2.setValueParamter(11, ord_fl);
  235. param2.setWhereClauseParameter(0, coilNo);
  236. getDao("mesdao").update("UIH052400_01.update", param2);
  237. }
  238. } else {
  239. param2.setValueParamter(0, coilNo);
  240. getDao("mesdao").insert("UIH052400_02.insert", param2);
  241. }
  242. }
  243. /**
  244. * 查询冷轧原料库是否包含钢卷信息
  245. *
  246. * @param coilNo
  247. * 钢卷号
  248. * @return boolean
  249. */
  250. private boolean hasCoilInTBK(String coilNo) {
  251. boolean hasCoil = true;
  252. int count = 0;
  253. if (null != coilNo && !"".equals(coilNo)) {
  254. PosParameter param = new PosParameter();
  255. param.setWhereClauseParameter(0, coilNo);
  256. PosRowSet rowSet = getDao("mesdao").find("UIH052400_02.select",
  257. param);
  258. if (rowSet.hasNext()) {
  259. PosRow pRow = rowSet.next();
  260. count = Integer.parseInt(pRow.getAttribute("COUNT").toString());
  261. }
  262. if (0 == count) {
  263. hasCoil = false;
  264. }
  265. return hasCoil;
  266. } else {
  267. return hasCoil;
  268. }
  269. }
  270. /**
  271. * 更改热轧成口移送确认状态
  272. * @param coilNo
  273. * @param transFlag
  274. */
  275. private void updateTbhConfirm(String coilNo,String transFlag){
  276. if (null != coilNo && !"".equals(coilNo)) {
  277. PosParameter param = new PosParameter();
  278. param.setValueParamter(0, transFlag);
  279. param.setWhereClauseParameter(0, coilNo);
  280. getDao("mesdao").update("UIH052401_01.update", param);
  281. }
  282. }
  283. }