package xin.glue.ui.H.H02; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.SQLException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import xin.glue.nui.G.G02.SmsProgTcSend; import xin.glue.ui.common.ProduceFactory; 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; import com.posdata.glue.util.log.PosLog; import com.posdata.glue.util.log.PosLogFactory; public class PosSaveMillSubResult extends PosActivity { static PosLog logger = PosLogFactory.getLogger(PosSaveMillSubResult.class); public String runActivity(PosContext context) { logger.logInfo(" UIH020036 PosSaveMillSubResult save "); //从页面获取的数据 String[] OLD_SAMPL_NO = (String[])context.get("OLD_SAMPL_NO"); String[] COIL_NO = (String[])context.get("COIL_NO"); String[] COIL_LEN = (String[])context.get("COIL_LEN"); String[] ACT_WGT = (String[])context.get("ACT_WGT"); String[] MONTHJUAN = (String[])context.get("MONTHJUAN"); String[] COIL_INDIA = (String[])context.get("COIL_INDIA"); String[] COIL_OUTDIA = (String[])context.get("COIL_OUTDIA"); String[] UPD_REG = (String[])context.get("UPD_REG"); String[] UPD_DTIME = (String[])context.get("UPD_DTIME"); String[] BC = (String[])context.get("BC"); String[] BZ = (String[])context.get("BZ"); String[] DEC_UPD_DETAIL = (String[])context.get("DEC_UPD_DETAIL");//分卷备注 //String[] CUR_LOAD_LOC = (String[])context.get("CUR_LOAD_LOC"); String countCoil =""; String countFl = ""; //加入日志 PosParameter paramhis = new PosParameter(); paramhis.setValueParamter(0, COIL_NO[0]); paramhis.setValueParamter(1, ACT_WGT[0]); paramhis.setValueParamter(2, COIL_LEN[0]); paramhis.setValueParamter(3, COIL_INDIA[0]); paramhis.setValueParamter(4, COIL_OUTDIA[0]); getDao("mesdao").insert("UIH020036_08.insert", paramhis); PosParameter paramA = new PosParameter(); paramA.setWhereClauseParameter(0, MONTHJUAN[0]); PosRowSet rowSetA = getDao("mesdao").find("UIH020036_06.select", paramA); //发货状态中的卷不允许修改 while(rowSetA.hasNext()) { return PosBizControlConstants.SUCCESS; } PosParameter param5 = new PosParameter(); param5.setWhereClauseParameter(0, COIL_NO[0]); PosRowSet rowSet5 = getDao("mesdao").find("UIH020036_05.select", param5); //根据流水号获取实际钢卷号 while(rowSet5.hasNext()) { PosRow row = rowSet5.next(); countCoil = row.getAttribute("OLD_SAMPL_NO") == null?"":row.getAttribute("OLD_SAMPL_NO").toString(); } String coilOrdno = ""; String coilOrdseq = ""; PosParameter paramOrd = new PosParameter(); paramOrd.setWhereClauseParameter(0, COIL_NO[0]); PosRowSet rowSetOrd = getDao("mesdao").find("UIH020036_08.select", paramOrd); while(rowSetOrd.hasNext()) { PosRow ordRow = rowSetOrd.next(); coilOrdno = ordRow.getAttribute("ORD_NO") == null ? "":ordRow.getAttribute("ORD_NO").toString(); coilOrdseq = ordRow.getAttribute("ORD_SEQ") == null ? "":ordRow.getAttribute("ORD_SEQ").toString(); } if(countCoil.equals("") || countCoil == null) { if(ACT_WGT[0].equals("") || ACT_WGT[0] == null||ACT_WGT[0].equals("0")) return PosBizControlConstants.SUCCESS;//如果新增钢卷重量为空,不允许录入 20220301 PosParameter param = new PosParameter(); param.setValueParamter(0, COIL_NO[0]); param.setValueParamter(1, COIL_LEN[0]); param.setValueParamter(2, COIL_INDIA[0]); param.setValueParamter(3, COIL_OUTDIA[0]); param.setValueParamter(4, ACT_WGT[0]); param.setValueParamter(5, coilOrdno); param.setValueParamter(6, coilOrdseq); param.setValueParamter(7, COIL_NO[0]); param.setValueParamter(8, UPD_REG[0]); param.setValueParamter(9, UPD_DTIME[0]); param.setValueParamter(10, BC[0]); param.setValueParamter(11, BZ[0]); param.setValueParamter(12, DEC_UPD_DETAIL[0]); param.setValueParamter(13, COIL_NO[0]); PosParameter paramphy = new PosParameter(); paramphy.setValueParamter(0, COIL_NO[0]); paramphy.setValueParamter(1, COIL_NO[0]); PosParameter param8 = new PosParameter(); param8.setWhereClauseParameter(0, COIL_NO[0]); PosRowSet rowSet8 = getDao("mesdao").find("UIH020036_07.select", param8); //判断是否为订单才余材 while(rowSet8.hasNext()) { PosRow row = rowSet8.next(); countFl = row.getAttribute("ORD_FL").toString(); } //if(countFl.equals("1")) if(!"".equals(coilOrdno)&&!"".equals(coilOrdseq)) { getDao("mesdao").insert("UIH020036_01.insert", param); } else { getDao("mesdao").insert("UIH020036_07.insert", param); } getDao("mesdao").insert("UIH020036_phy.insert", paramphy);//写入判定表 1201 17:34 //调用存货异动点存储过程 ProduceFactory PD= new ProduceFactory(); PD.ErpDataCover("HCOIL",COIL_NO[0].substring(0, 12)+"0","11AD","0","O", UPD_REG[0],"热轧分卷母卷"); PD.ErpDataCoverFJ("HCOIL",COIL_NO[0],"11AD","0","N","N",ACT_WGT[0],COIL_NO[0].substring(0, 12)+"0",UPD_REG[0],"热轧分卷子卷"); } else { PosParameter param6 = new PosParameter(); param6.setValueParamter(0, COIL_LEN[0]); param6.setValueParamter(1, COIL_INDIA[0]); param6.setValueParamter(2, COIL_OUTDIA[0]); //param6.setValueParamter(3, ACT_WGT[0]); //更改数据不允许改重量 20220302 /*param6.setValueParamter(4, UPD_REG[0]); param6.setValueParamter(5, UPD_DTIME[0]); param6.setValueParamter(6, BC[0]); param6.setValueParamter(7, BZ[0]); param6.setValueParamter(8, coilOrdno); param6.setValueParamter(9, coilOrdseq); param6.setValueParamter(10, COIL_NO[0]);*/ param6.setValueParamter(3, UPD_REG[0]); param6.setValueParamter(4, UPD_DTIME[0]); param6.setValueParamter(5, BC[0]); param6.setValueParamter(6, BZ[0]); param6.setValueParamter(7, coilOrdno); param6.setValueParamter(8, coilOrdseq); param6.setValueParamter(9, COIL_NO[0]); getDao("mesdao").update("UIH020036_05.update", param6); PosParameter paramScd = new PosParameter(); paramScd.setValueParamter(0, COIL_NO[0]); getDao("mesdao").update("UIH020036_06.update", paramScd); PosParameter paramSpcd = new PosParameter(); paramSpcd.setValueParamter(0, COIL_NO[0]); paramSpcd.setValueParamter(1, COIL_NO[0]); paramSpcd.setValueParamter(2, COIL_NO[0]); getDao("mesdao").update("UIH020036_07.update", paramSpcd); return PosBizControlConstants.SUCCESS; } PosParameter param7 = new PosParameter(); param7.setValueParamter(0, COIL_NO[0]); param7.setValueParamter(1, COIL_NO[0]); getDao("mesdao").insert("UIH020036_06.insert", param7); String count = ""; PosParameter param1 = new PosParameter(); param1.setWhereClauseParameter(0, COIL_NO[0]); param1.setWhereClauseParameter(1, COIL_NO[0]); PosRowSet rowSet = getDao("mesdao").find("UIH020036_02.select", param1); while(rowSet.hasNext()) { PosRow row = rowSet.next(); count = row.getAttribute("COIL_NO").toString(); } if( count.equals("") || count == null) { PosParameter paramd = new PosParameter(); paramd.setValueParamter(0, COIL_NO[0]); paramd.setValueParamter(1, COIL_NO[0]); paramd.setValueParamter(2, COIL_NO[0]); getDao("mesdao").insert("UIH020036_02.insert", paramd); } String countYard = ""; PosParameter param4 = new PosParameter(); param4.setWhereClauseParameter(0, COIL_NO[0]); PosRowSet rowSet1 = getDao("mesdao").find("UIH020036_03.select", param4); while(rowSet1.hasNext()) { PosRow row = rowSet1.next(); countYard = row.getAttribute("CUR_LOAD_LOC") == null ? "":row.getAttribute("CUR_LOAD_LOC").toString(); } if( !countYard.equals("") && countYard != null) { PosParameter paramd = new PosParameter(); paramd.setValueParamter(0, countYard); paramd.setValueParamter(1, countYard); paramd.setValueParamter(2, countYard); paramd.setValueParamter(3, countYard); getDao("mesdao").update("UIH020036_02.update", paramd); } PosParameter param2 = new PosParameter(); param2.setValueParamter(0, UPD_REG[0]); param2.setValueParamter(1, UPD_DTIME[0]); param2.setValueParamter(2, COIL_NO[0]); getDao("mesdao").update("UIH020036_01.update", param2); //分析计划子表、总表状态 PosParameter paramScd = new PosParameter(); paramScd.setValueParamter(0, COIL_NO[0]); getDao("mesdao").update("UIH020036_06.update", paramScd); PosParameter paramSpcd = new PosParameter(); paramSpcd.setValueParamter(0, COIL_NO[0]); paramSpcd.setValueParamter(1, COIL_NO[0]); paramSpcd.setValueParamter(2, COIL_NO[0]); getDao("mesdao").update("UIH020036_07.update", paramSpcd); logger.logInfo(" UIH020036 PosSaveMillSubResult save success"); return PosBizControlConstants.SUCCESS; } }