package xin.glue.ui.H.H05; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.SQLException; import java.sql.Types; import xin.glue.ui.common.ProduceFactory; import xin.glue.ui.common.component.PosSiteLog; import com.posdata.glue.PosException; import com.posdata.glue.biz.activity.PosActivity; import com.posdata.glue.biz.constants.PosBizControlConstants; import com.posdata.glue.biz.control.PosBizControlIF; import com.posdata.glue.biz.control.PosBizProvider; import com.posdata.glue.component.PosConstants; import com.posdata.glue.context.PosContext; import com.posdata.glue.dao.vo.PosParameter; import com.posdata.glue.dao.vo.PosRow; import com.posdata.glue.dao.vo.PosRowSet; import com.posdata.glue.msg.PosMESMessageImpl; import com.posdata.glue.msg.PosMessage; /* * 冷轧移送确认处理 * @author siy * @date 2010-12-9 */ public class SEND_LZ_CONFIRM extends PosActivity { public String runActivity(PosContext context) { // 钢卷号 String[] COIL_NOS = (String[]) context.get("COIL_NOS"); // 移送顺序 String[] TRANSSEQS = (String[]) context.get("TRANSSEQS"); // 移送方式 String[] TRANSTYPES = (String[]) context.get("TRANSTYPES"); // 步进梁号/车辆号 String[] TRANSNOS = (String[]) context.get("TRANSNOS"); // 操作时间 String[] TRANSTIMES = (String[]) context.get("TRANSTIMES"); String transFlag = "Y";// 是否移送确认 if (null != COIL_NOS) { String[] coilNos = COIL_NOS[0].split("\\|"); String[] transSeqs = TRANSSEQS[0].split("\\|"); String[] transTypes = TRANSTYPES[0].split("\\|"); String[] transNos = TRANSNOS[0].split("\\|"); String[] transTimes = TRANSTIMES[0].split("\\|"); for (int i = 0; i < coilNos.length; i++) { // 更新冷轧原料库钢卷公共表 updateColdCoilComm(coilNos[i], transTypes[i], transNos[i], transTimes[i], transSeqs[i]); // 更新原料钢卷公共_D表 updateColdCoilCommD(coilNos[i]); // 更新热轧成品库移送确认状态 updateTbhConfirm(coilNos[i],transFlag); } } return PosBizControlConstants.SUCCESS; } /** * 将热轧库钢卷信息转移到冷轧原料库 * * @param coilNo * 钢卷号 * @param transType * 移送区分 * @param transNo * 移送步进梁号/车辆号 * @param transTime * 移送时间 * @return boolean */ private boolean updateColdCoilComm(String coilNo, String transType, String transNo, String transTime, String transSeq) { boolean addRs = false; if (null == coilNo || "".equals(coilNo)) { return addRs; } // 如果冷轧原料公共表中不存在此钢卷信息 if (!hasCoilInTBK(coilNo)) { PosParameter param = new PosParameter(); param.setValueParamter(0, transType); param.setValueParamter(1, transNo); param.setValueParamter(2, transTime); param.setValueParamter(3, transSeq); param.setValueParamter(4, coilNo); param.setWhereClauseParameter(0, coilNo); int count = getDao("mesdao").insert("UIH052400_01.insert", param); //调用存货异动点存储过程 /* ProduceFactory PD= new ProduceFactory(); PD.ErpDataCover("HCOIL",coilNo,"55A","1","O","蔡伟平","热轧转出");*/ if (0 < count) { addRs = true; logger.logInfo("addColdCoil success ---SEND_LZ.java "); } } else { // 更新冷轧库钢卷信息,更新热轧库出库信息 PosParameter param1 = new PosParameter(); param1.setWhereClauseParameter(0, coilNo); PosRowSet rowSet = getDao("mesdao").find("UIH052400_07.select", param1); if (rowSet.hasNext()) { PosRow posRow = rowSet.next(); PosParameter param2 = new PosParameter(); param2.setValueParamter(0, posRow.getAttribute("SLAB_NO")); param2.setValueParamter(1, posRow.getAttribute("CUR_PROG_CD")); param2.setValueParamter(2, posRow .getAttribute("CUR_PROG_CD_DTIME")); param2.setValueParamter(3, posRow .getAttribute("CUR_PROG_CD_PGM")); param2.setValueParamter(4, posRow .getAttribute("INSTR_COIL_THK")); param2.setValueParamter(5, posRow .getAttribute("INSTR_COIL_WTH")); param2.setValueParamter(6, posRow .getAttribute("INSTR_COIL_LEN")); param2.setValueParamter(7, posRow .getAttribute("INSTR_COIL_INDIA")); param2.setValueParamter(8, posRow .getAttribute("INSTR_COIL_OUTDIA")); param2.setValueParamter(9, posRow .getAttribute("INSTR_COIL_WGT")); param2 .setValueParamter(10, posRow .getAttribute("DEVLMT_DTIME")); param2.setValueParamter(11, posRow.getAttribute("DEST_CD")); param2.setValueParamter(12, posRow.getAttribute("ORDCUST_CD")); param2.setValueParamter(13, posRow.getAttribute("CUST_CD")); param2.setValueParamter(14, posRow.getAttribute("COIL_LEN")); param2.setValueParamter(15, posRow.getAttribute("COIL_INDIA")); param2.setValueParamter(16, posRow.getAttribute("COIL_OUTDIA")); param2.setValueParamter(17, posRow.getAttribute("COIL_THK")); param2.setValueParamter(18, posRow.getAttribute("COIL_WTH")); param2.setValueParamter(19, posRow.getAttribute("ACT_WGT")); param2.setValueParamter(20, posRow.getAttribute("ORD_FL")); param2.setValueParamter(21, posRow.getAttribute("ORD_NO")); param2.setValueParamter(22, posRow.getAttribute("ORD_SEQ")); param2.setValueParamter(23, posRow.getAttribute("PRODNM_CD")); param2.setValueParamter(24, posRow.getAttribute("SPEC_ABBSYM")); param2 .setValueParamter(25, posRow .getAttribute("SPEC_STL_GRD")); param2.setValueParamter(26, posRow.getAttribute("ORD_USE_CD")); param2.setValueParamter(27, posRow.getAttribute("STL_GRD")); param2 .setValueParamter(28, posRow .getAttribute("PATH_MILL_CD")); param2 .setValueParamter(29, posRow .getAttribute("INGR_DEC_GRD")); param2.setValueParamter(30, posRow .getAttribute("EXTSHAPE_DEC_GRD")); param2 .setValueParamter(31, posRow .getAttribute("SIZE_DEC_RST")); param2.setValueParamter(32, posRow.getAttribute("WGT_DEC_RST")); param2 .setValueParamter(33, posRow .getAttribute("PROC_DEC_RST")); param2.setValueParamter(34, posRow .getAttribute("MATLQLTY_DEC_GRD")); param2.setValueParamter(35, posRow.getAttribute("TOT_DEC_GRD")); param2.setValueParamter(36, posRow.getAttribute("MILL_DTIME")); param2.setValueParamter(37, posRow.getAttribute("CRK_CD1")); param2.setValueParamter(38, posRow.getAttribute("CRK_CD2")); param2.setValueParamter(39, posRow.getAttribute("CRK_CD3")); param2.setValueParamter(40, posRow.getAttribute("CRK_CD4")); param2.setValueParamter(41, posRow.getAttribute("CRK_CD5")); param2.setValueParamter(42, posRow.getAttribute("CAL_WGT")); param2 .setValueParamter(43, posRow .getAttribute("OLD_SAMPL_NO")); param2.setValueParamter(44, transType); param2.setValueParamter(45, transNo); param2.setValueParamter(46, transTime); param2.setValueParamter(47, posRow .getAttribute("FM_EXT_STRIP_THK_AVG")); param2.setValueParamter(48, posRow .getAttribute("FM_EXT_STRIP_TEMP_AVG")); param2.setValueParamter(49, posRow.getAttribute("DC_TEMP_AVG")); param2.setValueParamter(50, posRow .getAttribute("FM_EXT_STRIP_CROWN_AVG")); param2.setValueParamter(51, posRow .getAttribute("YARD_ENTRY_DTIME")); param2.setValueParamter(52, posRow.getAttribute("SAMPL_NO")); param2.setValueParamter(53, posRow .getAttribute("SAMPL_CUT_LOC")); param2.setValueParamter(54, posRow.getAttribute("ORD_FL"));// OLD_ORD_FL param2.setValueParamter(55, posRow.getAttribute("ORD_NO"));// OLD_ORD_NO param2.setValueParamter(56, posRow.getAttribute("ORD_SEQ"));// OLD_ORD_SEQ param2.setValueParamter(57, transSeq); param2.setWhereClauseParameter(0, coilNo); int count = getDao("mesdao").update("UIH052400_02.update", param2); if (count > 0) { addRs = true; logger.logInfo("updColdCoil success ---SEND_LZ.java "); } } } return addRs; } private void updateColdCoilCommD(String coilNo) { // 更新c_tbk02_comm_d表 PosParameter param1 = new PosParameter(); param1.setWhereClauseParameter(0, coilNo); PosRowSet rowSet = getDao("mesdao").find("UIH052400_05.select", param1); PosParameter param2 = new PosParameter(); if (rowSet.hasNext()) { PosRowSet rowSet2 = getDao("mesdao").find("UIH052400_06.select", param1); if (rowSet2.hasNext()) { PosRow pRow = rowSet2.next(); Object cut_seq = pRow.getAttribute("CUT_SEQ"); Object ord_thk = pRow.getAttribute("ORD_THK"); Object ord_wth = pRow.getAttribute("ORD_WTH"); Object ord_len = pRow.getAttribute("ORD_LEN"); Object ord_wgt = pRow.getAttribute("ORD_WGT"); Object ord_wgt_min = pRow.getAttribute("ORD_WGT_MIN"); Object ord_wgt_max = pRow.getAttribute("ORD_WGT_MAX"); Object ord_india = pRow.getAttribute("ORD_INDIA"); Object ord_outdia = pRow.getAttribute("ORD_OUTDIA"); Object ord_no = pRow.getAttribute("ORD_NO"); Object ord_seq = pRow.getAttribute("ORD_SEQ"); Object ord_fl = pRow.getAttribute("ORD_FL"); param2.setValueParamter(0, cut_seq); param2.setValueParamter(1, ord_thk); param2.setValueParamter(2, ord_wth); param2.setValueParamter(3, ord_len); param2.setValueParamter(4, ord_wgt); param2.setValueParamter(5, ord_wgt_min); param2.setValueParamter(6, ord_wgt_max); param2.setValueParamter(7, ord_india); param2.setValueParamter(8, ord_outdia); param2.setValueParamter(9, ord_no); param2.setValueParamter(10, ord_seq); param2.setValueParamter(11, ord_fl); param2.setWhereClauseParameter(0, coilNo); getDao("mesdao").update("UIH052400_01.update", param2); } } else { param2.setValueParamter(0, coilNo); getDao("mesdao").insert("UIH052400_02.insert", param2); } } /** * 查询冷轧原料库是否包含钢卷信息 * * @param coilNo * 钢卷号 * @return boolean */ private boolean hasCoilInTBK(String coilNo) { boolean hasCoil = true; int count = 0; if (null != coilNo && !"".equals(coilNo)) { PosParameter param = new PosParameter(); param.setWhereClauseParameter(0, coilNo); PosRowSet rowSet = getDao("mesdao").find("UIH052400_02.select", param); if (rowSet.hasNext()) { PosRow pRow = rowSet.next(); count = Integer.parseInt(pRow.getAttribute("COUNT").toString()); } if (0 == count) { hasCoil = false; } return hasCoil; } else { return hasCoil; } } /** * 更改热轧成口移送确认状态 * @param coilNo * @param transFlag */ private void updateTbhConfirm(String coilNo,String transFlag){ if (null != coilNo && !"".equals(coilNo)) { PosParameter param = new PosParameter(); param.setValueParamter(0, transFlag); param.setWhereClauseParameter(0, coilNo); getDao("mesdao").update("UIH052401_01.update", param); } } }