| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- package xin.glue.nui.F.F01;
- import java.math.BigDecimal;
- 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.biz.control.PosBizProvider;
- 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;
- /* Program Name SMSLvlCancel (NIF012140)
- * Description SMS WORK INSTRUCTION LEVEL2 CANCEL CHARGE PLAN
- * Write By KIM SUNG HO
- * Date 2008-11-05
- */
- public class SMSLvlCan extends PosActivity implements GlobalConstants {
-
- public String runActivity(PosContext context) {
- long V_CHARGE_EDT_SEQ = 0 ;
- long V_STS_CNT = 0 ;
- long V_CHG_SEQ = 0 ;
- long V_PREV_CHARGE_WGT = 0 ;
-
- String V_CHARGE_MANA_NO = "" ;
-
- String V_TABLE_ID = "";
- String V_TABLE_MODE = "";
- String V_ERR_DESC = "";
- String V_RTN_NAME = "";
-
- PosMessage message = context.getMessage();
-
- String P_CHARGE_MANA_NO_ST = (String)message.get("CHARGE_MANA_NO_ST");
- String P_REG_ID = (String)message.get("REG_ID");
- //String PRC_LINE_ST = P_CHARGE_MANA_NO_ST.substring(3, 4);
- String PRC_LINE_ST = P_CHARGE_MANA_NO_ST.substring(2, 3);
-
- //P_CHARGE_MANA_NO_EN IS NULL CHECK
- if (P_CHARGE_MANA_NO_ST == null || P_CHARGE_MANA_NO_ST.equals("") ) {
- //MESSAGE ERROR --> PROGRAM EXIT
- //throw new PosException("SMSLvlCancel..CHARGE_MANA_NO_ST IS NULL");
- logger.logInfo("SMSLvlCancel..CHARGE_MANA_NO_ST IS NULL");
- context.put("errorMsg", "SMSLvlCancel..CHARGE_MANA_NO_ST IS NULL");
- return PosBizControlConstants.FAILURE;
- }
-
- //SELECT CHG_SEQ
- PosParameter paramA = new PosParameter();
- paramA.setWhereClauseParameter(0, PRC_LINE_ST);
- paramA.setWhereClauseParameter(1, P_CHARGE_MANA_NO_ST);
- PosRowSet ChgSeqInfVO = getDao("mesdao").find("NIF012140_ChgSeqInf.select",paramA);
- ChgSeqInfVO.reset();
-
- if (ChgSeqInfVO.hasNext()) {
- PosRow ChgSeqInfRow = ChgSeqInfVO.next();
- V_CHG_SEQ = Long.parseLong((ChgSeqInfRow.getAttribute("CHG_SEQ")==null? "0":ChgSeqInfRow.getAttribute("CHG_SEQ")).toString());
-
- } else {
- //MESSAGE ERROR --> PROGRAM EXIT
- throw new PosException("SMSLvlCancel..Not Found ChgSeqInf");
-
- }
-
- //SELECT COUNT(STATUS_CD <> "A")
- PosParameter param0 = new PosParameter();
- param0.setWhereClauseParameter(0, PRC_LINE_ST);
- param0.setWhereClauseParameter(1, String.valueOf(V_CHG_SEQ));
- PosRowSet ChgCntChkVO = getDao("mesdao").find("NIF012140_ChgCntChk.select",param0);
- ChgCntChkVO.reset();
-
- if (ChgCntChkVO.hasNext()) {
- PosRow ChgCntChkRow = ChgCntChkVO.next();
- V_STS_CNT = Long.parseLong((ChgCntChkRow.getAttribute("STATUS_CNT")==null? "0":ChgCntChkRow.getAttribute("STATUS_CNT")).toString());
-
- if (V_STS_CNT != 0) {
- //MESSAGE ERROR --> PROGRAM EXIT
- throw new PosException("SMSLvlCancel..Not Found ChgCntChk");
- }
- }
-
- PosParameter param2 = new PosParameter();
- param2.setValueParamter(0, PRC_LINE_ST);
- param2.setValueParamter(1, String.valueOf(V_CHG_SEQ));
- int InsCnt1 = getDao("mesdao").insert("NIF012140_L2Charge.insert",param2);
-
- if (InsCnt1 == 0) {
-
- V_TABLE_ID = "TBG06_L2_CHARGE_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBG06_L2_CHARGE_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "SMSLvlCancel TBG06_L2_CHARGE_INS INSERT1 " + String.valueOf(V_CHARGE_EDT_SEQ);
-
- LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
- PosParameter param3 = new PosParameter();
- param3.setValueParamter(0, PRC_LINE_ST);
- param3.setValueParamter(1, String.valueOf(V_CHG_SEQ));
- int InsCnt2 = getDao("mesdao").insert("NIF012140_L2Ccm.insert",param3);
-
- if (InsCnt2 == 0) {
-
- V_TABLE_ID = "TBG06_L2_CCM_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBG06_L2_CCM_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "SMSLvlCancel TBG06_L2_CCM_INS INSERT2 " + String.valueOf(V_CHARGE_EDT_SEQ);
-
- LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
-
- PosParameter param4 = new PosParameter();
- param4.setValueParamter(0, PRC_LINE_ST);
- param4.setValueParamter(1, String.valueOf(V_CHG_SEQ));
- int InsCnt3 = getDao("mesdao").insert("NIF012140_L2SlabCut.insert",param4);
- if (InsCnt3 == 0) {
-
- V_TABLE_ID = "TBG06_L2_SLAB_CUT_INS";
- V_TABLE_MODE = "I";
- V_ERR_DESC = "TBG06_L2_SLAB_CUT_INS INSERT COUNT IS ZERO";
- V_RTN_NAME = "SMSLvlCancel TBG06_L2_SLAB_CUT_INS INSERT3 " + String.valueOf(V_CHARGE_EDT_SEQ);
-
- LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
-
- //UPDATE TBF01_SPEC_CHARGE (PROG_CD="JBA")
- PosParameter param5 = new PosParameter();
- param5.setWhereClauseParameter(0, PRC_LINE_ST);
- param5.setWhereClauseParameter(1, String.valueOf(V_CHG_SEQ));
- int UptCnt1 = getDao("mesdao").update("NIF012140_ChargeProgUpd.update",param5);
-
- if (UptCnt1 == 0) {
-
- V_TABLE_ID = "TBF01_SPEC_CHARGE";
- V_TABLE_MODE = "U";
- V_ERR_DESC = "TBF01_SPEC_CHARGE UPDATE COUNT IS ZERO";
- V_RTN_NAME = "SMSLvlCancel TBF01_SPEC_CHARGE UPDATE1 " + String.valueOf(V_CHARGE_EDT_SEQ);
-
- LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
- //SELECT CHARGE INFORMATION
- PosParameter param1 = new PosParameter();
- param1.setWhereClauseParameter(0, PRC_LINE_ST);
- param1.setWhereClauseParameter(1, String.valueOf(V_CHG_SEQ));
- PosRowSet ChargeInfVO = getDao("mesdao").find("NIF012140_ChargeInf.select",param0);
- ChargeInfVO.reset();
-
- while(ChargeInfVO.hasNext()) {
-
- PosRow ChargeInfRow = ChargeInfVO.next();
- V_CHARGE_EDT_SEQ = Long.parseLong((ChargeInfRow.getAttribute("CHARGE_EDT_SEQ")==null? "0":ChargeInfRow.getAttribute("CHARGE_EDT_SEQ")).toString());
- V_CHARGE_MANA_NO = (String)ChargeInfRow.getAttribute("CHARGE_MANA_NO");
- V_PREV_CHARGE_WGT = Long.parseLong((ChargeInfRow.getAttribute("PREV_CHARGE_WGT")==null? "0":ChargeInfRow.getAttribute("PREV_CHARGE_WGT")).toString());
-
- //CALL NIE012070_SaveOrdSts
- NIE012070_CALL(V_CHARGE_MANA_NO, V_PREV_CHARGE_WGT, P_REG_ID);
-
- } //ChargeInfVO while END
- //UPDATE TBF01_CHARGE_IDX (LEVEL2 CANCEL MARKING)
- PosParameter param6 = new PosParameter();
- param6.setWhereClauseParameter(0, PRC_LINE_ST);
- param6.setWhereClauseParameter(1, String.valueOf(V_CHG_SEQ));
- int UptCnt2 = getDao("mesdao").update("NIF012140_ChargeIdxUpd.update",param6);
-
- if (UptCnt2 == 0) {
-
- V_TABLE_ID = "TBF01_CHARGE_IDX";
- V_TABLE_MODE = "U";
- V_ERR_DESC = "TBF01_CHARGE_IDX UPDATE COUNT IS ZERO";
- V_RTN_NAME = "SMSLvlCancel TBF01_CHARGE_IDX UPDATE2 " + String.valueOf(V_CHARGE_EDT_SEQ);
-
- LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
- throw new PosException(V_RTN_NAME);
- }
-
- //------------------------------------------------------------------------------------------------
- //CALL NIE012080_OrdStsMain
- NIE012080_CALL();
-
-
- //------------------------------------------------------------------------------------------------
- //LEVEL2 JOB SCHEDULE CALL
-
- return PosBizControlConstants.SUCCESS;
-
- }
-
- public PosContext NIE012070_CALL(String V_CHARGE_MANA_NO, long V_WGT, String V_REG_ID)
- {
- PosContext context = new PosContext();
- PosMessage message = new PosMESMessageImpl();
-
- //SaveOrdSts
- String TcId = "NIE012070";
- message.setTCID(TcId);
- message.setObject("MSG_ID", TcId);
- message.setObject("BEF_ORD_NO", "");
- message.setObject("BEF_ORD_SEQ", "");
- message.setObject("ORD_NO", "");
- message.setObject("ORD_SEQ", "");
- message.setObject("BEF_PROG_CD", "JBB");
- message.setObject("PROG_CD", "JBA");
- message.setObject("MAT_TYPE", "CH");
- message.setObject("MAT_NO", V_CHARGE_MANA_NO);
- message.setObject("WGT", new BigDecimal(V_WGT));
- message.setObject("PGMID", "SMSLvlCan");
- message.setObject("REG_ID", V_REG_ID);
- context.setMessage(message);
- message.setTCID(TcId);
-
- String SERVICE_POSTFIX = "-service";
- context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
- PosBizProvider.getController().doSubController(context, false);
-
- String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
-
- if (SERVICE_ERR_MSG != null)
- {
- throw new PosException(SERVICE_ERR_MSG);
- }
-
- return context;
- }
- public PosContext NIE012080_CALL()
- {
- PosContext context = new PosContext();
- PosMessage message = new PosMESMessageImpl();
-
- //OrdStsMain
- String TcId = "NIE012080";
- message.setTCID(TcId);
- message.setObject("MSG_ID", TcId);
- message.setObject("AA", "");
- context.setMessage(message);
- message.setTCID(TcId);
-
- String SERVICE_POSTFIX = "-service";
- context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
- PosBizProvider.getController().doSubController(context, false);
-
- String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
-
- if (SERVICE_ERR_MSG != null)
- {
- throw new PosException(SERVICE_ERR_MSG);
- }
-
- return context;
- }
- }
|