| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- package xin.glue.ui.D.D08;
- import java.math.BigDecimal;
- import java.sql.CallableStatement;
- import java.sql.SQLException;
- import java.sql.Types;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- 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.PosRow;
- import com.posdata.glue.dao.vo.PosRowSet;
- import com.posdata.glue.msg.PosMESMessageImpl;
- import com.posdata.glue.msg.PosMessage;
- /**
- *
- * @author 王黎
- * @date 2010-01-21
- */
- public class UpdateRollWorkSlabByTianShi extends PosActivity
- {
- public String runActivity(PosContext context)
- {
- String[] slabNo1 = (String[]) context.get("slabNo1"); //计划中的板坯号
- String[] slabNo2 = (String[]) context.get("slabNo2"); //可以替换的板坯号
- String[] reg_id = (String[]) context.get("REG_ID");
- String useName = "";
- if(reg_id != null)
- {
- if(reg_id[0] == "" || "".equals(reg_id[0]))
- {
- useName = "UID08";
- }
- else
- {
- useName = reg_id[0];
- }
-
- }
- else
- {
- useName = "UID08";
- }
- // if(slabNo1 != null && slabNo2 != null && !"".equals(slabNo1[0]) && !"".equals(slabNo2[0]))
- // {
- // if(!checkSlabStat(slabNo1[0],slabNo2[0]))
- // {
- // context.put("errorData", "板坯状态已变化,请刷新您查询的轧制计划!!!");
- // return PosBizControlConstants.SUCCESS;
- // }
- // }
-
- CallableStatement cStmt = null;
- try {
- //替换现在的存储过程
- // cStmt = this.getDao("mesdao").getCallableStatement("L2SENDREPLACE.REP_L2_SEND_MAIN");
- cStmt = this.getDao("mesdao").getCallableStatement("UID080010_CALL");
- cStmt.setString(1, slabNo1[0]);
- cStmt.setString(2, slabNo2[0]);
- cStmt.setString(3, useName);
- cStmt.registerOutParameter(4, Types.VARCHAR);
- cStmt.execute();
- context.put("AYY", cStmt.getString(4));
- // System.out.println("############################"+ cStmt.getString(1));
- } catch (Exception e) {
- return PosBizControlConstants.FAILURE;
- } finally {
- if (cStmt != null)
- {
- try
- {
- cStmt.close();
- }
- catch (Exception e)
- {
- logger.logWarn(e.getMessage(), e);
- return PosBizControlConstants.FAILURE;
- }
- }
- }
- // NIE012080_CALL(); zhushi by mgp 2014/3/11
-
-
- return PosBizControlConstants.SUCCESS;
- }
-
-
- /**
- * //板坯替换时候检查板坯状态是否正确,避免出现同一轧制计划中出现两块板坯的现象
- */
- public boolean checkSlabStat(String slabNo1, String slabNo2)
- {
- //String sql = "";
- boolean falg = true;
- PosRowSet posRowSet = null;
- PosRowSet posRowSet2 = null;
- PosRow posRow = null;
- PosRow posRow2 = null;
- Map map = new HashMap();
- Map map2 = new HashMap();
- String coufac = "";
- String sqlOne = "SELECT COUNT(*) SLABYN FROM TBF02_SPEC_MILL A WHERE A.SLAB_NO = '"+slabNo1+"' AND A.STATUS_CD = 'A'";
- posRowSet = getDao("mesdao").findByQueryStatement(sqlOne);
- while (posRowSet.hasNext())
- {
- posRow = (PosRow) posRowSet.next();
- map = posRow.getAttributes();
- coufac = ((BigDecimal)map.get("SLABYN")).toString();
- if("0".equals(coufac))
- {
- falg = false;
- break;
- }
- }
-
- if(falg)
- {
- String sqlTwo = "SELECT COUNT(*) SLABYN FROM TBF02_SPEC_MILL A WHERE A.SLAB_NO = '"+slabNo2+"' AND A.STATUS_CD IN ('A','B') ";
- posRowSet2 = getDao("mesdao").findByQueryStatement(sqlTwo);
- while (posRowSet2.hasNext())
- {
- posRow2 = (PosRow) posRowSet2.next();
- map2 = posRow2.getAttributes();
- coufac = ((BigDecimal)map2.get("SLABYN")).toString();
- if(!"0".equals(coufac))
- {
- falg = false;
- break;
- }
- }
- }
-
- return falg;//最终返回TURE则表示验证通过。为FALSE则验证不通过。
- }
-
- 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;
- }
- }
|