| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- package xin.glue.ui.G.G02;
- import java.math.BigDecimal;
- 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.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;
- /**
- * 转炉实绩录入信息
- *
- * BOF实绩查询后,按CHARGE_NO执行更新或插入操作 铁合金、辅料、废料数据更新或插入
- *
- * @author 梅贵平
- * @date 2008-9-1
- */
- public class PosSaveBofResut extends PosActivity {
- public String runActivity(PosContext context) {
- logger.logInfo("PosSaveBofResut START ");
- String[] rowStutsFlag = (String[]) context.get("rowStutsFlag");// 标记是否更新或插入BOF实绩(原料实绩除外)
- // PosGenericDao dao = this.getDao("mesdao");
- // rowStutsFlag若存在,即可以:若按CHARGE_NO查询出TBG02_BOF_RESULT中无该记录(即count为0),
- // 则执行插入语句, 否则执行更新语句
- if (rowStutsFlag != null && rowStutsFlag.length > 0) {
- String sql = "SELECT CHARGE_NO FROM TBG02_BOF_RESULT WHERE CHARGE_NO = ?";// 判断某条满足条件的记录是否存在
- String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");
- String[] PLAN_CHARGE_NO = (String[]) context.get("PLAN_CHARGE_NO");
- PosParameter param = new PosParameter();
- param.setWhereClauseParameter(0, CHARGE_NO[0]);
- PosRowSet rowset = getDao("mesdao").findByQueryStatement(sql, param);
- int count = rowset.count();
- PosParameter posparam = new PosParameter();
- String[] XIN_DATE = (String[]) context.get("XIN_DATE");// 统计日
- String[] BOF_NO = (String[]) context.get("BOF_NO"); // 转炉号
- String[] WKSHIFT = (String[]) context.get("WKSHIFT"); // 班次
- String[] WKGROUP = (String[]) context.get("WKGROUP"); // 组
- String[] EMP_ID = (String[]) context.get("EMP_ID"); // 作业人
- String[] TAPPING_WGT = (String[]) context.get("TAPPING_WGT"); // 出钢量
- String[] IRON_CHARGE_WGT = (String[]) context
- .get("IRON_CHARGE_WGT"); // 铁水装入量
- String[] SCRAP_CHARGE_WGT = (String[]) context
- .get("SCRAP_CHARGE_WGT");// 废钢装入量
- String[] SCRAP_ZINC_CHARGE_WGT = (String[]) context
- .get("SCRAP_ZINC_CHARGE_WGT");// 生铁装入量
- String[] SUBRAW_WGT = (String[]) context.get("SUBRAW_WGT"); // 辅原料用量
- String[] TAPPING_AFT_TEMP = (String[]) context
- .get("TAPPING_AFT_TEMP");// 出钢温度
- String[] O2_CONSUME = (String[]) context.get("O2_CONSUME");// 氧气用量
- String[] AR_CONSUME = (String[]) context.get("AR_CONSUME");// 氩气用量
- String[] N2_CONSUME = (String[]) context.get("N2_CONSUME");// 氮气用量
- String PlanChNo = null;
- if (PLAN_CHARGE_NO[0] == null || PLAN_CHARGE_NO[0].equals("")) {
- PlanChNo = '3' + CHARGE_NO[0].substring(1, 10);
- } else {
- PlanChNo = PLAN_CHARGE_NO[0];
- }
-
- String PRODNM_CD = null;
- String STL_GRD = null;
- String LINE_PROC_CD = null;
- String HCR_CLF = null;
- String SPEC_ABBSYM = null;
- String CAST_MANA_NO = null;
- String SLAB_RT = null;
- String STATUS_CD = null;
- Number CAST_CHARGE_SEQ = null;
- String CHARGE_MANA_NO = null;
- Number CAST_EDT_CHARGE_CNT = null;
-
- PosParameter paramA = new PosParameter();
- paramA.setWhereClauseParameter(0, PlanChNo);
- PosRowSet L2Send = this.getDao("mesdao").find("UIG020020_L2_SEND_CHARGE.select", paramA);
- if(!L2Send.hasNext()){
- context.put("MESSAGES", " 指示尚未下发!");
- return PosBizControlConstants.SUCCESS;
- }
-
- paramA = new PosParameter();
- paramA.setWhereClauseParameter(0, PlanChNo);
- PosRowSet specChVo = this.getDao("mesdao").find("NIG020200_SPEC_CHARGE.select", paramA);
- if (specChVo.hasNext()) {
- PosRow specChROW = specChVo.next();
- PRODNM_CD = (String) specChROW.getAttribute("PRODNM_CD");
- STL_GRD = (String) specChROW.getAttribute("STL_GRD");
- LINE_PROC_CD = (String) specChROW.getAttribute("LINE_PROC_CD");
- HCR_CLF = (String) specChROW.getAttribute("HCR_CLF");
- SPEC_ABBSYM = (String) specChROW.getAttribute("SPEC_ABBSYM");
- CAST_MANA_NO = (String) specChROW.getAttribute("CAST_MANA_NO");
- CAST_CHARGE_SEQ = (Number) specChROW.getAttribute("CAST_CHARGE_SEQ");
- CHARGE_MANA_NO = (String) specChROW.getAttribute("CHARGE_MANA_NO");
- CAST_EDT_CHARGE_CNT = (Number) specChROW.getAttribute("CAST_EDT_CHARGE_CNT");
- SLAB_RT = (String) specChROW.getAttribute("SLAB_RT");
- STATUS_CD = (String) specChROW.getAttribute("STATUS_CD");
- }
- // 判断查询是否有记录,无记录则count为0,进入if段插入某炉次号及实绩,否则进入else段更新某炉次号信息
- if (count == 0 ) {
- posparam.setValueParamter(0, CHARGE_NO[0]);
- posparam.setValueParamter(1, XIN_DATE[0]);
- posparam.setValueParamter(2, BOF_NO[0]);
- posparam.setValueParamter(3, WKSHIFT[0]);
- posparam.setValueParamter(4, WKGROUP[0]);
- posparam.setValueParamter(5, EMP_ID[0]);
- posparam.setValueParamter(6, TAPPING_WGT[0]);
- posparam.setValueParamter(7, IRON_CHARGE_WGT[0]);
- posparam.setValueParamter(8, SCRAP_CHARGE_WGT[0]);
- posparam.setValueParamter(9, SCRAP_ZINC_CHARGE_WGT[0]);
- posparam.setValueParamter(10, SUBRAW_WGT[0]);
- posparam.setValueParamter(11, TAPPING_AFT_TEMP[0]);
- posparam.setValueParamter(12, O2_CONSUME[0]);
- posparam.setValueParamter(13, AR_CONSUME[0]);
- posparam.setValueParamter(14, N2_CONSUME[0]);
- posparam.setValueParamter(15, PlanChNo);
- getDao("mesdao").insert("UIG020020_01.insert", posparam);// 按炉次号插入一条新记录到转炉实绩表中
-
- if ( STATUS_CD == null || (STATUS_CD != null && (STATUS_CD.equals("A") || STATUS_CD.equals("B")))) {
-
- PosParameter param5 = new PosParameter();
- //String sProgCd = "JBF";
- //param5.setValueParamter(0, sProgCd);
- //param5.setValueParamter(0, "B");
- //param5.setValueParamter(1, PlanChNo);
- PosParameter param6 = new PosParameter();
- param6.setValueParamter(0, "B");
- param6.setValueParamter(1, PlanChNo);
- this.getDao("mesdao").update("NIG020200_SPEC_PROG_02.update",param6);
- this.getDao("mesdao").update("NIG020200_SPEC_CHARGE_IDX.update", param6);
-
-
-
- if(STATUS_CD == null||(STATUS_CD != null&& STATUS_CD.equals("A"))){
- param6 = new PosParameter();
- param6.setWhereClauseParameter(0, "B");
- param6.setWhereClauseParameter(1, "BOF");
- param6.setWhereClauseParameter(2, PlanChNo);
- this.getDao("mesdao").update("NIG020610_SPEC_SLAB_COMM.update",param6);
-
- PosParameter param7 = new PosParameter();
- param7.setWhereClauseParameter(0, PlanChNo);
- PosRowSet specslabVo = this.getDao("mesdao").find("NIG020210_SPEC_SLAB.select", param7);
- while (specslabVo.hasNext()) {
- PosRow specslabROW = specslabVo.next();
- Number SlabEdtSeq = (Number) specslabROW.getAttribute("SLAB_EDT_SEQ");
- PosParameter param8 = new PosParameter();
- param8.setValueParamter(0, "B");
- param8.setValueParamter(1, SlabEdtSeq);
- this.getDao("mesdao").update("NIG020610_SPEC_SLAB_D.update", param8);
- }
- }
- }
- } else {
- posparam.setWhereClauseParameter(0, XIN_DATE[0]);
- posparam.setWhereClauseParameter(1, BOF_NO[0]);
- posparam.setWhereClauseParameter(2, WKSHIFT[0]);
- posparam.setWhereClauseParameter(3, WKGROUP[0]);
- posparam.setWhereClauseParameter(4, EMP_ID[0]);
- posparam.setWhereClauseParameter(5, TAPPING_WGT[0]);
- posparam.setWhereClauseParameter(6, IRON_CHARGE_WGT[0]);
- posparam.setWhereClauseParameter(7, SCRAP_CHARGE_WGT[0]);
- posparam.setWhereClauseParameter(8, SCRAP_ZINC_CHARGE_WGT[0]);
- posparam.setWhereClauseParameter(9, SUBRAW_WGT[0]);
- posparam.setWhereClauseParameter(10, TAPPING_AFT_TEMP[0]);
- posparam.setWhereClauseParameter(11, O2_CONSUME[0]);
- posparam.setWhereClauseParameter(12, AR_CONSUME[0]);
- posparam.setWhereClauseParameter(13, N2_CONSUME[0]);
- posparam.setWhereClauseParameter(14, CHARGE_NO[0]);
- getDao("mesdao").update("UIG020020_01.update", posparam);// 按炉次号对转炉实绩表中数据更新
- }
-
- //修改炉次公共表
- PosParameter param8 = new PosParameter();
- param8.setWhereClauseParameter(0, CHARGE_NO[0]);
- PosRowSet chComVo = this.getDao("mesdao").find( "UIG020020_CH_COM.select", param8);
- String BefProg = null;
- String CurrProg = null;
- String ChargeStat = null;
- if (chComVo.hasNext()) {
- PosRow chComROW = chComVo.next();
- CurrProg = (String) chComROW.getAttribute("CUR_PROG_CD");
- BefProg = (String) chComROW.getAttribute("BEF_PROG_CD");
- ChargeStat = (String) chComROW.getAttribute("CHARGE_STAT");
-
-
- if (ChargeStat != null && ChargeStat.equals("2")) {
-
- if (CurrProg == null) {
- CurrProg = "JBF";
- BefProg = "JBB";
- //防止修改转炉实绩时 物料进程退回为转炉处理
- } else if (CurrProg != null && !(CurrProg.equals("JCF") || CurrProg.equals("JLF") || CurrProg.equals("JRF") || CurrProg.equals("JJB"))) {
-
- BefProg = CurrProg;
- CurrProg = "JBF";
- }
-
- PosParameter param9 = new PosParameter();
- param9.setValueParamter(0, CurrProg);
- param9.setValueParamter(1, "UIG020020");
- param9.setValueParamter(2, BefProg );
- param9.setValueParamter(3, TAPPING_WGT[0]);
- param9.setValueParamter(4, TAPPING_WGT[0]);
- param9.setValueParamter(5, BOF_NO[0]);
- param9.setValueParamter(6, SLAB_RT);
- param9.setValueParamter(7, CHARGE_NO[0]);
- this.getDao("mesdao").update("UIG020020_CH_COM.update", param9);
- }
- } else {
- PosParameter param10 = new PosParameter();
- param10.setValueParamter(0, CHARGE_NO[0]);
- param10.setValueParamter(1, CHARGE_MANA_NO);
- param10.setValueParamter(2, STL_GRD);
- param10.setValueParamter(3, PRODNM_CD);
- param10.setValueParamter(4, LINE_PROC_CD);
- param10.setValueParamter(5, HCR_CLF);
- param10.setValueParamter(6, SPEC_ABBSYM);
- param10.setValueParamter(7, CAST_MANA_NO);
- param10.setValueParamter(8, CAST_CHARGE_SEQ);
- param10.setValueParamter(9, CAST_EDT_CHARGE_CNT);
- param10.setValueParamter(10, "JBF");
- param10.setValueParamter(11, "UIG020020");
- param10.setValueParamter(12, TAPPING_WGT[0]);
- param10.setValueParamter(13, TAPPING_WGT[0]);
- param10.setValueParamter(14, BOF_NO[0]);
- param10.setValueParamter(15, SLAB_RT);
- this.getDao("mesdao").update("UIG020020_CH_COM.insert", param10);
- }
- BigDecimal TapWgt = null;
- if (TAPPING_WGT[0] == null || TAPPING_WGT[0].equals("")) {
- TapWgt = new BigDecimal(0);
- } else {
- TapWgt = new BigDecimal(TAPPING_WGT[0]);
- }
- SendProg_NIE012070(PlanChNo, BefProg, TapWgt);
- SendProg_NIE012080();
- }
- String[] rowStuts4 = (String[]) context.get("rowStuts4");// UIG020020页面铁合金表传过来的值
- if (rowStuts4 != null)// 判断是否需对铁合金记录执行更新或录入
- {
- String[] MAINRAW_CD = (String[]) context.get("MAINRAW_CD");// 铁合金CODE
- // String[] MAINRAW_CD_DESC =
- // (String[])context.get("MAINRAW_CD_DESC");//铁合金CODE内容
- String[] MAINRAW_WGT = (String[]) context.get("MAINRAW_WGT");// 铁合金用量
- String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");// 炉次号
- for (int i = 0; i < rowStuts4.length; i++) {
- // 调用存储过程UP_IN_TBG03_MAINRAW ,对铁合金数据更新或插入
- PosParameter param1 = new PosParameter();
- param1.setWhereClauseParameter(0, CHARGE_NO[0]);
- param1.setWhereClauseParameter(1, MAINRAW_CD[i]);
- PosRowSet scrapVo = this.getDao("mesdao").find( "NIG020230_02.select", param1);
- if (scrapVo.hasNext()) {
- PosParameter param2 = new PosParameter();
- param2.setValueParamter(0, MAINRAW_WGT[i]);
- param2.setValueParamter(1, CHARGE_NO[0]);
- param2.setValueParamter(2, MAINRAW_CD[i]);
- this.getDao("mesdao").update("NIG020230_01.update", param2);
- } else {
- PosParameter param2 = new PosParameter();
- param2.setValueParamter(0, CHARGE_NO[0]);
- param2.setValueParamter(1, MAINRAW_CD[i]);
- param2.setValueParamter(2, MAINRAW_WGT[i]);
- this.getDao("mesdao").update("NIG020230_01.insert", param2);
- }
- }
- }
- String[] rowStuts5 = (String[]) context.get("rowStuts5");// UIG020020页面辅料表传过来的值
- if (rowStuts5 != null)// 判断是否需对辅料记录执行更新或录入
- {
- String[] MAINRAW_CD = (String[]) context.get("MAINRAW_CD");// 辅料CODE
- // String[] MAINRAW_CD_DESC =
- // (String[])context.get("MAINRAW_CD_DESC");//辅料CODE内容
- String[] MAINRAW_WGT = (String[]) context.get("MAINRAW_WGT");// 辅料用量
- String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");// 炉次号
- for (int i = 0; i < rowStuts5.length; i++) {
- PosParameter param1 = new PosParameter();
- param1.setWhereClauseParameter(0, CHARGE_NO[0]);
- param1.setWhereClauseParameter(1, MAINRAW_CD[i]);
- PosRowSet scrapVo = this.getDao("mesdao").find( "NIG020220_02.select", param1);
- if (scrapVo.hasNext()) {
- PosParameter param2 = new PosParameter();
- param2.setValueParamter(0, MAINRAW_WGT[i]);
- param2.setValueParamter(1, CHARGE_NO[0]);
- param2.setValueParamter(2, MAINRAW_CD[i]);
- this.getDao("mesdao").update("NIG020220_01.update", param2);
- } else {
- PosParameter param2 = new PosParameter();
- param2.setValueParamter(0, CHARGE_NO[0]);
- param2.setValueParamter(1, MAINRAW_CD[i]);
- param2.setValueParamter(2, MAINRAW_WGT[i]);
- this.getDao("mesdao").update("NIG020220_01.insert", param2);
- }
- }
- }
- String[] rowStuts8 = (String[]) context.get("rowStuts8");// UIG020020页面废料表传过来的值
- if (rowStuts8 != null)// 判断是否需要对废料数据更新或插入
- {
- String[] MAINRAW_CD = (String[]) context.get("MAINRAW_CD");// 废料CODE
- // String[] MAINRAW_CD_DESC =
- // (String[])context.get("MAINRAW_CD_DESC");//废料CODE内容
- String[] MAINRAW_WGT = (String[]) context.get("MAINRAW_WGT");// 废料重量
- String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");// 炉次号
- for (int i = 0; i < rowStuts8.length; i++) {
- PosParameter param1 = new PosParameter();
- param1.setWhereClauseParameter(0, CHARGE_NO[0]);
- param1.setWhereClauseParameter(1, MAINRAW_CD[i]);
- PosRowSet scrapVo = this.getDao("mesdao").find("NIG020220_02.select", param1);
- if (scrapVo.hasNext()) {
- PosParameter param2 = new PosParameter();
- param2.setValueParamter(0, MAINRAW_WGT[i]);
- param2.setValueParamter(1, CHARGE_NO[0]);
- param2.setValueParamter(2, MAINRAW_CD[i]);
- this.getDao("mesdao").update("NIG020220_01.update", param2);
- } else {
- PosParameter param2 = new PosParameter();
- param2.setValueParamter(0, CHARGE_NO[0]);
- param2.setValueParamter(1, MAINRAW_CD[i]);
- param2.setValueParamter(2, MAINRAW_WGT[i]);
- this.getDao("mesdao").update("NIG020220_01.insert", param2);
- }
- }
- }
- return PosBizControlConstants.SUCCESS;
- }
- public PosContext SendProg_NIE012070(String ChargeNo, String BefProg,
- BigDecimal wgt) {
- logger.logInfo("XinSaveBofResult wgt:" + wgt);
- // BigDecimal wgt = new BigDecimal();
- PosContext context = new PosContext();
- PosMessage message = new PosMESMessageImpl();
- String TcId = "NIE012070";
- message.setTCID(TcId);
- message.setObject("MSG_ID", TcId);
- message.setObject("BEF_ORD_NO", null);
- message.setObject("BEF_ORD_SEQ", null);
- message.setObject("ORD_NO", null);
- message.setObject("ORD_SEQ", null);
- message.setObject("BEF_PROG_CD", "JBB");
- message.setObject("PROG_CD", "JBF");
- message.setObject("MAT_TYPE", "CH");
- message.setObject("MAT_NO", ChargeNo);
- message.setObject("WGT", wgt);
- message.setObject("PGMID", "UIG020020");
- message.setObject("REG_ID", "UIG020020");
- message.setTCID(TcId);
- context.setMessage(message);
- String serviceName = "NIE012070";
- String SERVICE_POSTFIX = "-service";
- context.put(PosBizControlConstants.SERVICE_NAME, serviceName
- + SERVICE_POSTFIX);
- PosBizControlIF controller = PosBizProvider.getController();
- controller.doSubController(context, false);
- logger.logInfo("XinSaveBofResult---> NIE012070 TC SendProgress end");
- return null;
- }
- public PosContext SendProg_NIE012080() {
- logger.logInfo("XinSaveBofResult SendProg_NIE012080 ");
- PosContext context = new PosContext();
- PosMessage message = new PosMESMessageImpl();
- String TcId = "NIE012080";
- message.setTCID(TcId);
- message.setObject("MSG_ID", TcId);
- message.setObject("AA", null);
- message.setTCID(TcId);
- context.setMessage(message);
- // this.processComponent(PosConstants.CREATE_MESSAGE, context);
- // String transactionCode = context.getMessage().getTC();
- String serviceName = "NIE012080";
- String SERVICE_POSTFIX = "-service";
- context.put(PosBizControlConstants.SERVICE_NAME, serviceName
- + SERVICE_POSTFIX);
- // context.setMessage(message);
- PosBizControlIF controller = PosBizProvider.getController();
- controller.doSubController(context, false);
- logger.logInfo("XinSaveBofResult---> NIE012080 TC SendProgress end");
- return null;
- }
- }
|