| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- package xin.glue.nui.F.F02;
- import xin.glue.user.common.GlobalConstants;
- import xin.glue.user.common.LogGpError;
- import com.posdata.glue.PosException;
- import com.posdata.glue.biz.activity.PosActivity;
- import com.posdata.glue.biz.constants.PosBizControlConstants;
- 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.PosMessage;
- //import java.lang.Long;
- /* Program Name MILLLvlSend (NIF024050)
- * Description MILL WORK INSTRUCTION LEVEL2 SEND
- * Write By KIM SUNG HO
- * Date 2008-11-13
- */
- public class MILLLvlSend extends PosActivity implements GlobalConstants {
-
- public String runActivity(PosContext context) {
-
- long V_ROLL_SLAB_SEQ_ST = 0 ;
- long V_ROLL_SLAB_SEQ_EN = 0 ;
- long V_ROLL_AFT_CNT = 0 ;
-
- String V_ROLL_MANA_NO = "" ;
- String V_ROLL_MANA_ST = "" ;
- String V_ROLL_MANA_EN = "" ;
-
- String V_TABLE_ID = "" ;
- String V_TABLE_MODE = "" ;
- String V_ERR_DESC = "" ;
- String V_RTN_NAME = "" ;
-
- PosMessage message = context.getMessage();
-
- //P_TYPE("R","S"), FROM/TO (ROLL NO/SLAB NO)
- String P_TYPE = (String)message.get("TYPE");
- String P_ST = (String)message.get("FROM");
- String P_EN = (String)message.get("TO");
-
- // try {
-
- if (P_TYPE.equals("R")) {
-
- if (P_ST.compareTo(P_EN) > 0) {
-
- //MESSAGE ERROR --> PROGRAM EXIT
- throw new PosException("MILLLvlSend..ROLL_MANA_NO ST > EN..");
- }
-
- } else if (P_TYPE.equals("S")) {
-
- if (P_ST.length() != 13 || P_EN.length() != 13) {
-
- //MESSAGE ERROR --> PROGRAM EXIT
- throw new PosException("MILLLvlSend..SLAB_NO ERROR..");
- }
- }
-
- if (P_TYPE.equals("R")) {
-
- //FIRST/LAST ROLL_MANA_NO FIRST/LAST ROLL_SLAB_SEQ CHECK
- PosParameter paramA = new PosParameter();
- paramA.setWhereClauseParameter(0, P_ST);
- paramA.setWhereClauseParameter(1, P_EN);
- PosRowSet RollSlabVO = getDao("mesdao").find("NIF024050_RollSlab.select",paramA);
- RollSlabVO.reset();
-
- if (RollSlabVO.hasNext()) {
-
- PosRow RollSlabRow = RollSlabVO.next();
- V_ROLL_MANA_ST = P_ST;
- V_ROLL_MANA_EN = P_EN;
- V_ROLL_SLAB_SEQ_ST = Long.parseLong((RollSlabRow.getAttribute("ROLL_SLAB_SEQ_ST")==null? "0":RollSlabRow.getAttribute("ROLL_SLAB_SEQ_ST")).toString());
- V_ROLL_SLAB_SEQ_EN = Long.parseLong((RollSlabRow.getAttribute("ROLL_SLAB_SEQ_EN")==null? "0":RollSlabRow.getAttribute("ROLL_SLAB_SEQ_EN")).toString());
-
- } else {
-
- V_ROLL_MANA_ST = "";
- V_ROLL_MANA_EN = "";
- V_ROLL_SLAB_SEQ_ST = 0;
- V_ROLL_SLAB_SEQ_EN = 0;
-
- }
-
- } else {
-
- //ROLL_SLAB_SEQ CHECK
- PosParameter param0 = new PosParameter();
- param0.setWhereClauseParameter(0, P_ST);
- param0.setWhereClauseParameter(1, P_EN);
- PosRowSet RollSlabSeqVO = getDao("mesdao").find("NIF024050_RollSlabSeq.select",param0);
- RollSlabSeqVO.reset();
-
- if (RollSlabSeqVO.hasNext()) {
-
- PosRow RollSlabSeqRow = RollSlabSeqVO.next();
- V_ROLL_MANA_ST = (String)RollSlabSeqRow.getAttribute("ROLL_MANA_ST");
- V_ROLL_MANA_EN = (String)RollSlabSeqRow.getAttribute("ROLL_MANA_EN");
- V_ROLL_SLAB_SEQ_ST = Long.parseLong((RollSlabSeqRow.getAttribute("ROLL_SLAB_SEQ_ST")==null? "0":RollSlabSeqRow.getAttribute("ROLL_SLAB_SEQ_ST")).toString());
- V_ROLL_SLAB_SEQ_EN = Long.parseLong((RollSlabSeqRow.getAttribute("ROLL_SLAB_SEQ_EN")==null? "0":RollSlabSeqRow.getAttribute("ROLL_SLAB_SEQ_EN")).toString());
-
- } else {
-
- V_ROLL_MANA_ST = "";
- V_ROLL_MANA_EN = "";
- V_ROLL_SLAB_SEQ_ST = 0;
- V_ROLL_SLAB_SEQ_EN = 0;
-
- }
- }
-
- if (V_ROLL_SLAB_SEQ_ST == 0 || V_ROLL_SLAB_SEQ_EN == 0){
-
- //MESSAGE ERROR --> PROGRAM EXIT
- throw new PosException("MILLLvlSend..ROLL_SLAB_SEQ ST/EN IS ZERO..");
- }
-
-
- //-------------------------------------------------------------------------------
- //INSERT MILL INSTRUCTION LEVEL2 SEND PROCESS -----------------------------------
-
- //TBH06_L2_ROLL_UNIT_INS SEND PROCESS
- PosParameter paramB = new PosParameter();
- paramB.setValueParamter(0, V_ROLL_MANA_ST);
- paramB.setValueParamter(1, V_ROLL_MANA_EN);
- int InsertQ = getDao("mesdao").insert("NIF024050_L2ROLLSend.insert",paramB);
-
- if (InsertQ == 0) {
-
- V_TABLE_ID = "TBH06_L2_ROLL_UNIT_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBH06_L2_ROLL_UNIT_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "MILLLvlSend TBH06_L2_ROLL_UNIT_INS INSERTQ " + V_ROLL_MANA_ST;
-
- LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
-
- //TBH06_L2_RHT_INS SEND PROCESS
- PosParameter paramC = new PosParameter();
- paramC.setValueParamter(0, V_ROLL_MANA_ST);
- paramC.setValueParamter(1, V_ROLL_MANA_EN);
- int InsertC = getDao("mesdao").insert("NIF024050_L2RHTSend.insert",paramC);
-
- // if (InsertC == 0) {
- //
- // V_TABLE_ID = "TBH06_L2_RHT_INS";
- // V_TABLE_MODE = "I";
- // V_ERR_DESC = "TBH06_L2_RHT_INS INSERT COUNT IS ZERO";
- // V_RTN_NAME = "MILLLvlSend TBH06_L2_RHT_INS INSERTC " + V_ROLL_MANA_ST;
- //
- // LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- // throw new PosException(V_RTN_NAME);
- // }
-
- //TBH06_L2_MILL_INS SEND PROCESS
- PosParameter paramD = new PosParameter();
- paramD.setValueParamter(0, V_ROLL_MANA_ST);
- paramD.setValueParamter(1, V_ROLL_MANA_EN);
- int InsertD = getDao("mesdao").insert("NIF024050_L2MILLSend.insert",paramD);
-
- // if (InsertD == 0) {
- //
- // V_TABLE_ID = "TBH06_L2_MILL_INS";
- // V_TABLE_MODE = "I";
- // V_ERR_DESC = "TBH06_L2_MILL_INS INSERT COUNT IS ZERO";
- // V_RTN_NAME = "MILLLvlSend TBH06_L2_MILL_INS INSERTD " + V_ROLL_MANA_ST;
- //
- // LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- // throw new PosException(V_RTN_NAME);
- // }
- //TBH06_L2_COIL_NO_INS SEND PROCESS
- PosParameter paramE = new PosParameter();
- paramE.setWhereClauseParameter(0, V_ROLL_MANA_ST);
- paramE.setWhereClauseParameter(1, V_ROLL_MANA_EN);
- PosRowSet RollManaNoVO = getDao("mesdao").find("NIF024050_RollManaNo.select",paramE);
- RollManaNoVO.reset();
-
- while(RollManaNoVO.hasNext()) {
-
- PosRow RollManaNoRow = RollManaNoVO.next();
- V_ROLL_MANA_NO = (String)RollManaNoRow.getAttribute("ROLL_MANA_NO");
-
- //SELECT NXET SET SEQUEANCE
- String nextSeqQr = "SELECT L2_COIL_NO_SET_SEQ.NEXTVAL SET_SEQ FROM DUAL ";
- PosRowSet nextSeqVO = getDao("mesdao").findByQueryStatement(nextSeqQr);
- nextSeqVO.reset();
- PosRow nextSeqRow = nextSeqVO.next();
- Number V_SET_SEQ = (Number)nextSeqRow.getAttribute("SET_SEQ");
-
- //TBH06_L2_COIL_NO_INS SEND PROCESS
- PosParameter paramG = new PosParameter();
- paramG.setValueParamter(0, V_SET_SEQ);
- paramG.setValueParamter(1, V_ROLL_MANA_NO);
- int InsertG = getDao("mesdao").insert("NIF024050_L2ROLLCOILSend.insert",paramG);
-
- if (InsertG == 0) {
-
- V_TABLE_ID = "TBH06_L2_COIL_NO_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBH06_L2_COIL_NO_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "MILLLvlSend TBH06_L2_COIL_NO_INS INSERTG " + V_ROLL_MANA_NO;
-
- LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
-
- } //RollManaNoVO while END
- //UPDATE TBF02_MILL_IDX L2_SEND = 'Y'
- PosParameter paramH = new PosParameter();
- paramH.setWhereClauseParameter(0, V_ROLL_MANA_ST);
- paramH.setWhereClauseParameter(1, V_ROLL_MANA_EN);
- int UpdCntH = getDao("mesdao").update("NIF024050_MillIdx.update",paramH);
-
- if (UpdCntH == 0) {
-
- V_TABLE_ID = "TBF02_MILL_IDX";
- V_TABLE_MODE = "U";
- V_ERR_DESC = "TBF02_MILL_IDX UPDATE COUNT IS ZERO";
- V_RTN_NAME = "MILLLvlSend TBF02_MILL_IDX UPDATEH " + V_ROLL_MANA_ST;
-
- LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
-
-
- //---------------------------------------------------------------------------------
- //UPDATE MILL INSTRUCTION LEVEL2 SEND PROCESS (V_ROLL_MANA_EN < ROLL_MANA_NO) <> 0
- PosParameter paramI = new PosParameter();
- paramI.setWhereClauseParameter(0, V_ROLL_MANA_EN);
- PosRowSet AftRollManaNoChkVO = getDao("mesdao").find("NIF024050_AftRollManaNoChk.select",paramI);
- AftRollManaNoChkVO.reset();
-
- if (AftRollManaNoChkVO.hasNext()) {
-
- PosRow AftRollManaNoChkRow = AftRollManaNoChkVO.next();
- V_ROLL_AFT_CNT = Long.parseLong((AftRollManaNoChkRow.getAttribute("ROLL_CNT")==null? "0":AftRollManaNoChkRow.getAttribute("ROLL_CNT")).toString());
-
- }
-
- //---------------------------------------------------------------------------------
- //MILL INSTRUCTION LEVEL2 RE-SEND(UPDATE) PROCESS
- if (V_ROLL_AFT_CNT != 0 && P_TYPE.equals("R")) {
-
- //TBH06_L2_ROLL_UNIT_INS RE-SEND(UPDATE) PROCESS
- PosParameter paramJ = new PosParameter();
- paramJ.setValueParamter(0, V_ROLL_MANA_EN);
- int InsertJ = getDao("mesdao").insert("NIF024050_L2ROLLReSend.insert",paramJ);
-
- if (InsertJ == 0) {
-
- V_TABLE_ID = "TBH06_L2_ROLL_UNIT_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBH06_L2_ROLL_UNIT_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "MILLLvlSend TBH06_L2_ROLL_UNIT_INS INSERTJ > " + V_ROLL_MANA_EN;
-
- LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
-
- //TBH06_L2_RHT_INS SEND PROCESS
- PosParameter paramK = new PosParameter();
- paramK.setValueParamter(0, V_ROLL_MANA_EN);
- int InsertK = getDao("mesdao").insert("NIF024050_L2RHTReSend.insert",paramK);
-
- if (InsertK == 0) {
-
- V_TABLE_ID = "TBH06_L2_RHT_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBH06_L2_RHT_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "MILLLvlSend TBH06_L2_RHT_INS INSERTK > " + V_ROLL_MANA_EN;
-
- LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
-
- //TBH06_L2_MILL_INS SEND PROCESS
- PosParameter paramL = new PosParameter();
- paramL.setValueParamter(0, V_ROLL_MANA_EN);
- int InsertL = getDao("mesdao").insert("NIF024050_L2MILLReSend.insert",paramL);
-
- if (InsertL == 0) {
-
- V_TABLE_ID = "TBH06_L2_MILL_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBH06_L2_MILL_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "MILLLvlSend TBH06_L2_MILL_INS INSERT L " + V_ROLL_MANA_EN;
-
- LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
- //TBH06_L2_COIL_NO_INS SEND PROCESS
- PosParameter paramM = new PosParameter();
- paramM.setWhereClauseParameter(0, V_ROLL_MANA_EN);
- PosRowSet ReRollManaNoVO = getDao("mesdao").find("NIF024050_ReRollManaNo.select",paramM);
- ReRollManaNoVO.reset();
- int x = 1;
- while(ReRollManaNoVO.hasNext()) {
-
- PosRow ReRollManaNoRow = ReRollManaNoVO.next();
- V_ROLL_MANA_NO = (String)ReRollManaNoRow.getAttribute("ROLL_MANA_NO");
-
- //SELECT NXET SET SEQUEANCE
- String RenextSeqQr = "SELECT L2_COIL_NO_SET_SEQ.NEXTVAL SET_SEQ FROM DUAL ";
- PosRowSet RenextSeqVO = getDao("mesdao").findByQueryStatement(RenextSeqQr);
- RenextSeqVO.reset();
- PosRow RenextSeqRow = RenextSeqVO.next();
- Number V_RESET_SEQ = (Number)RenextSeqRow.getAttribute("SET_SEQ");
-
- //TBH06_L2_COIL_NO_INS SEND PROCESS
- PosParameter paramN = new PosParameter();
- paramN.setValueParamter(0, V_RESET_SEQ);
- paramN.setValueParamter(1, V_ROLL_MANA_NO);
- int InsertN = getDao("mesdao").insert("NIF024050_L2ROLLCOILReSend.insert",paramN);
-
- x++;
- System.out.println("******************* " + x + " ****************");
-
- if (InsertN == 0) {
-
- System.out.println("_____________________________________________________________________");
-
- V_TABLE_ID = "TBH06_L2_COIL_NO_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBH06_L2_COIL_NO_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "MILLLvlSend TBH06_L2_COIL_NO_INS INSERT N " + V_ROLL_MANA_NO;
-
- LogGpError.logMessageToDB("MILLLvlSend", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME + "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
- }
-
- } //RollManaNoVO while END
-
- }
-
- // }
- // catch (PosException ex)
- // {
- // context.put(SERVICE_ERR_MSG, ex.getMessage());
- // throw ex;
- // }
- // catch (Throwable t)
- // {
- // context.put(SERVICE_ERR_MSG, t.getMessage());
- // throw new PosException(t.getMessage(), t);
- // }
- //
- return PosBizControlConstants.SUCCESS;
-
- }
- }
|