| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- package xin.glue.ui.G.G04;
- import java.sql.CallableStatement;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import org.apache.commons.lang.StringUtils;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- 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.PosGenericDao;
- import com.posdata.glue.dao.vo.PosParameter;
- import com.posdata.glue.dao.vo.PosRow;
- import com.posdata.glue.dao.vo.PosRowSet;
- public class XinSaveSlabYd extends PosActivity {
- public String runActivity(PosContext context) {
- String[] toBefStoreLoc =(String[]) context.get("TO_BEF_STORE_LOC");
- String[] toSlabNo =(String[]) context.get("TO_SLAB_NO");
- String[] toYardAddr =(String[]) context.get("TO_YARD_ADDR");
- String[] toStorelay =(String[]) context.get("TO_STORELAY");
- String[] fromyardAddr =(String[]) context.get("FROM_YARD_ADDR");
- String[] fromStorelay =(String[]) context.get("FROM_STORELAY");
- PosParameter param = new PosParameter();
- PosGenericDao dao = getDao("mesdao");
- YardHandle yardhand = new YardHandle(getDao("mesdao"));
- JSONObject hmOut = new JSONObject();
- JSONArray hmListOut = new JSONArray();
- JSONObject hmIn = new JSONObject();
- JSONArray hmListIn = new JSONArray();
-
- String nowDate = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
-
- if(toYardAddr == null || toYardAddr.length == 0 ||toYardAddr.length > 8)return PosBizControlConstants.SUCCESS;;
- for(int i = 0 ; i < toYardAddr.length ; i++){
- param = new PosParameter();
- param = new PosParameter();
- param.setWhereClauseParameter(0, toSlabNo[i]);
- PosRowSet rowSet = getDao("mesdao").find("UIG040061_MOVEALBE_SLAB.select", param);
- while(rowSet.hasNext()){
- PosRow row = rowSet.next();
- String slabStat = (String)row.getAttribute("SLAB_STAT");
- String missionClf = (String)row.getAttribute("MISSNO_CLF");
- String lstIngrCd = (String)row.getAttribute("LST_INGR_CD");
- String slabIngrGrd = (String)row.getAttribute("SLAB_INGR_DEC_GRD");
- String slabTotDecGrd = (String)row.getAttribute("SLAB_TOT_DEC_GRD");
- String slabOutTp = (String)row.getAttribute("SLAB_OUT_TP");
- if(slabStat.equals("3")){
- context.put("MESSAGES", " 板坯状态已经结束! ");
- return PosBizControlConstants.SUCCESS;
- }
-
- if(!(missionClf == null)&&(missionClf.equals("3") || missionClf.equals("2"))){
- context.put("MESSAGES", " 加回,轧回,吊销坯! ");
- return PosBizControlConstants.SUCCESS;
- }
- if(!slabOutTp.equals("Y")){
- context.put("MESSAGES", " 出库状态不允许出库,不能出库! ");
- return PosBizControlConstants.SUCCESS;
- }
- if(lstIngrCd == null){
- context.put("MESSAGES", " 无成份实绩,不能出库! ");
- return PosBizControlConstants.SUCCESS;
- }
- if(slabIngrGrd == null || (!slabIngrGrd.equals("1"))){
- if(slabTotDecGrd == null || !(slabTotDecGrd.equals("1") ||slabTotDecGrd.equals("3") ||slabTotDecGrd.equals("4") ||slabTotDecGrd.equals("9"))){
- context.put("MESSAGES", " 成份等级不合格,不能出库! ");
- return PosBizControlConstants.SUCCESS;
- }
- }
- if((StringUtils.isBlank(slabTotDecGrd))){
- context.put("MESSAGES", " 板坯未进行综合判定,不能出库! ");
- return PosBizControlConstants.SUCCESS;
- }
- }
-
- if(Integer.parseInt(toStorelay[i]) > 6){
- context.put("MESSAGES", " 台车垛位层数最大不得超过6层,移库失败");
- return PosBizControlConstants.SUCCESS;
- }
-
- if(toStorelay[i].length() < 2)toStorelay[i] = "0" + toStorelay[i];
-
- int updateCnt = yardhand.clearFromAddr(fromyardAddr[i], fromStorelay[i]);
- int updateCnt2 = yardhand.setToAddr(toSlabNo[i], fromyardAddr[i], fromStorelay[i], toYardAddr[i], toStorelay[i], "", "");
- int updateCnt3 = yardhand.setExtSlabComm(toSlabNo[i],fromyardAddr[i],fromStorelay[i],toYardAddr[i], toStorelay[i]);
- logger.logDebug("---------" + updateCnt + " updateCnt2= " + updateCnt2 + " uddateCnt3 = " + updateCnt3);
-
- String activityId = "",AppId = "",Exeejob = "";
- int flag = 1;
-
- //入热轧原料库
- if( (fromyardAddr[i].substring(0,1).equals("L") || (fromyardAddr[i].substring(0,1).equals("H") && !fromyardAddr[i].equals("H516"))
- || fromyardAddr[i].substring(0,2).equals("A0") || fromyardAddr[i].substring(0,2).equals("C0"))//在库跺位
- //出库跺位
- && (toYardAddr[i].substring(0,1).equals("Z") || toYardAddr[i].substring(0,1).equals("T") || toYardAddr[i].equals("H516"))
- ){
- hmOut = new JSONObject();
- hmOut.put("SLAB_NO", toSlabNo[i]);
- hmOut.put("LAYER", Integer.parseInt(toStorelay[i]));
- hmListOut.add(hmOut);
-
- activityId = "55A";
- AppId = "板坯入热轧库";
- Exeejob = "N";
- flag = 0;
- //配重自动审核
- CallableStatement cstm = null;
- try
- {
- cstm = this.getDao("mesdao").getCallableStatement("WEIGHT_CHECK.CAL");
- cstm.setString(1, toSlabNo[i]);
- cstm.registerOutParameter(2, java.sql.Types.VARCHAR);
- cstm.execute();
- //String err = cstm.getString(2);
- }catch(Exception ex){
- ex.printStackTrace();
- }
- finally{
- if(cstm != null){
- try{
- cstm.close();
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- //退库
- if( (fromyardAddr[i].substring(0,1).equals("T") || fromyardAddr[0].equals("H516") || fromyardAddr[i].substring(0,1).equals("Z"))
-
- && ((toYardAddr[i].substring(0,1).equals("L") || (toYardAddr[i].substring(0,1).equals("H") && !toYardAddr[i].substring(0,1).equals("H516"))
- || toYardAddr[i].substring(0,2).equals("A0") || toYardAddr[i].substring(0,2).equals("C0"))) ){
- activityId = "55A";
- AppId = "板坯退热轧库";
- Exeejob = "D";
- flag = 0;
- }
-
- //从板坯库移跺到台车的信息要发给1580 jiangxin 20240927
- if( fromyardAddr[i].substring(0,1).equals("Z") && toYardAddr[i].substring(0,1).equals("T")){
- hmIn = new JSONObject();
- hmIn.put("SLAB_NO", toSlabNo[i]);
- hmIn.put("LAYER", Integer.parseInt(toStorelay[i]));
- hmListIn.add(hmIn);
- }
-
- if(flag == 0){
- /*财务数据上抛*/
- CallableStatement cstm = null;
- try
- {
- cstm = this.getDao("mesdao").getCallableStatement("UPLOAD_DATA.CAL");
- cstm.setString(1, toSlabNo[i]);
- cstm.setString(2, activityId);
- cstm.setString(3, Exeejob);
- cstm.setString(4, AppId);
- cstm.setString(5, "3qrlzbp003");
- cstm.registerOutParameter(6, java.sql.Types.VARCHAR);
- cstm.execute();
-
- String err = cstm.getString(6);
- if(!org.apache.commons.lang.StringUtils.isBlank(cstm.getString(6))){
- context.put("MESSAGES","数据上传失败:" + err);
- return PosBizControlConstants.SUCCESS;
- }
- }catch(Exception ex){
- ex.printStackTrace();
- context.put("MESSAGES","Exception:" + ex.getMessage());
- return PosBizControlConstants.SUCCESS;
- }
- finally{
- if(cstm != null){
- try{
- cstm.close();
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- }
- }
-
- }
-
- //将数据发给1580系统
- //炼钢库上台车
- if(hmListOut.size() > 0){
- param = new PosParameter();
- param.setWhereClauseParameter(0, "I");//SLAB_NO
- param.setWhereClauseParameter(1, hmListOut.toString());
- param.setWhereClauseParameter(2, nowDate);
- dao.update("UIG04COMM_MEWM02.insert", param);
- }
- //板坯库上台车
- if(hmListIn.size() > 0){
- param = new PosParameter();
- param.setWhereClauseParameter(0, "O");//SLAB_NO
- param.setWhereClauseParameter(1, hmListIn.toString());
- param.setWhereClauseParameter(2, nowDate);
- dao.update("UIG04COMM_MEWM02.insert", param);
- }
-
- context.put("MESSAGES", " 操作成功! ");
- return PosBizControlConstants.SUCCESS;
- }
- }
|