package xin.glue.ui.G.G04; import java.sql.CallableStatement; import java.sql.SQLException; 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 SaveReturnSlabLoc extends PosActivity { public String runActivity(PosContext context) { String MESSAGES = null; String[] yardAddr = (String[])context.get("RTN_CUR_STORE_LOC"); String[] slabNo = (String[])context.get("SLAB_NO"); String[] PLT_TRS_EMP_ID = (String[])context.get("PLT_TRS_EMP_ID"); String[] PLT_TRS_EMP_NM = (String[]) context.get("PLT_TRS_EMP_NM"); String[] storelay = new String[10]; PosParameter param = new PosParameter(); PosRowSet rowset = null; PosGenericDao dao = getDao("mesdao"); if(slabNo == null){ return PosBizControlConstants.SUCCESS; } for(int i = 0 ; i< slabNo.length; i++){ param = new PosParameter(); param.setWhereClauseParameter(0, yardAddr[i]); PosRowSet rowSet = getDao("mesdao").find("UIG040090_STORELAY.select", param); if(rowSet.hasNext()){ PosRow row = rowSet.next(); storelay[i] = (String)row.getAttribute("STORELAY"); } param = new PosParameter(); param.setWhereClauseParameter(0, slabNo[i]); String querysql = "SELECT * FROM KCG_STUFFLIST@XGCX T WHERE T.BILLETNO = ? AND ZXISJS = '0'"; rowset = dao.findByQueryStatement(querysql, param); if(!rowset.hasNext()){ continue; } //板坯从中厚板退回后也要删除产销的未接收的板坯数据 JIANGXIN 20210105 param = new PosParameter(); param.setWhereClauseParameter(0, slabNo[i]); int count1 = getDao("mesdao").update("UIG040090_06.update", param); //写出库撤销履历 JIANGXIN 20210113 param = new PosParameter(); param.setWhereClauseParameter(0, slabNo[i]); int count2 = getDao("mesdao").update("UIG040090_07.update", param); //删除TBG04_SLAB_TRANSF param = new PosParameter(); param.setWhereClauseParameter(0, slabNo[i]); int count3 = getDao("mesdao").update("UIG040090_08.update", param); /*if(storelay[i] == null){ MESSAGES = " 退回失败 !"; context.put("MESSEGES", MESSAGES); return PosBizControlConstants.SUCCESS; }*/ //跺位更新 param = new PosParameter(); param.setWhereClauseParameter(0, yardAddr[i] + storelay[i]); param.setWhereClauseParameter(1, slabNo[i]); int uptCnt = getDao("mesdao").update("UIG040090_03.update", param); param = new PosParameter(); param.setWhereClauseParameter(0, slabNo[i]); param.setWhereClauseParameter(1, yardAddr[i]); param.setWhereClauseParameter(2, storelay[i]); int uptCnt2 = getDao("mesdao").update("UIG040090_SLAB_YARD_02.update",param); /*param = new PosParameter(); param.setValueParamter(0, slabNo[i]); int uptCnt3 = getDao("mesdao").delete("UIG040090_SLAB_TRANSF.delete", param); if(!(uptCnt > 0)||!(uptCnt2 > 0)){ MESSAGES = " 退回失败 !"; context.put("MESSEGES", MESSAGES); return PosBizControlConstants.SUCCESS; }*/ CallableStatement cstm = null; /*财务数据上抛*/ try{ cstm = this.getDao("mesdao").getCallableStatement("UPLOAD_DATA.CAL"); cstm.setString(1, slabNo[i]); cstm.setString(2, "55A"); cstm.setString(3, "D"); cstm.setString(4, "板坯移送中厚板撤销"); cstm.setString(5, PLT_TRS_EMP_NM == null?"3qAdmin00":PLT_TRS_EMP_NM[0]); cstm.registerOutParameter(6, java.sql.Types.VARCHAR); cstm.execute(); String err = cstm.getString(6); }catch (Exception e) { // TODO: handle exception }finally{ if (cstm != null){ try{ cstm.close(); } catch (SQLException e){ logger.logWarn(e.getMessage(), e); } } } } return PosBizControlConstants.SUCCESS; } }