package xin.glue.ui.B.B01; import xin.glue.ui.B.common.SaveModifyHistory; 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; /** * 客户参数号事项操作(增、删、改,对应界面ID:UIB010250) * @author 梅贵平{meiguiping} * @date 2008-10-27 */ public class SaveCustProceeding extends PosActivity { PosGenericDao dao = this.getDao("mesdao"); public String runActivity(PosContext context) { String INFID = "UIB010250"; String[] CUST_SPEC_NO = (String[])context.get("CUST_SPEC_NO");//客户参数号(主键) String[] CUST_SPEC_NO1 = (String[])context.get("CUST_SPEC_NO1");//客户参数号(主键) String[] CUST_SPEC_NO_INGR= (String[])context.get("CUST_SPEC_NO_INGR");//成分 String[] CUST_SPEC_NO_QLTY= (String[])context.get("CUST_SPEC_NO_QLTY");//性能 String[] CUST_SPEC_NO_DEL = (String[])context.get("CUST_SPEC_NO_DEL"); //公差 String[] SPEC_ABBSYM = (String[])context.get("SPEC_ABBSYM");//标准号 String[] SPEC_STL_GRD = (String[])context.get("SPEC_STL_GRD");//标准牌号 String[] THK_MIN = (String[])context.get("THK_MIN");//厚度min String[] THK_MAX = (String[])context.get("THK_MAX");//厚度max String[] WTH_MIN = (String[])context.get("WTH_MIN");//宽度min String[] WTH_MAX = (String[])context.get("WTH_MAX");//宽度max String[] ORD_USE_TP = (String[])context.get("ORD_USE_TP");//订单用途 String[] FAC_STL_GRD = (String[])context.get("FAC_STL_GRD");//厂内钢号 String[] SMS_STD_NO = (String[])context.get("SMS_STD_NO");//炼钢编码规范 String[] MILL_STD_NO = (String[])context.get("MILL_STD_NO");//热轧编码规范 String[] COLD_STD_NO = (String[])context.get("COLD_STD_NO");//冷轧生产规范 String[] SIZE_SPEC_CD = (String[])context.get("SIZE_SPEC_CD");//尺寸对应码 String[] DEV_SPEC_CD = (String[])context.get("DEV_SPEC_CD");//交付条件指定 String[] DEV_DGR_CD = (String[])context.get("DEV_DGR_CD");//公差代码 String[] REG_NM = (String[])context.get("REG_NM"); PosParameter param= null; String[] rowStuts = (String[])context.get("rowStuts"); if(rowStuts != null) { int len = rowStuts.length; int j = 0; for(int i = 0; i < len; i++) { j = 0; param = new PosParameter(); FAC_STL_GRD[i] = FAC_STL_GRD[i]; SMS_STD_NO[i] = SMS_STD_NO[i]; MILL_STD_NO[i] = MILL_STD_NO[i]; if("i".equals(rowStuts[i])) { // //若厂内钢号非空且不存与于表TBB01_FAC_INGR中则不能做插入操作 // if(!"".equals(FAC_STL_GRD[i]) && !beExist(FAC_STL_GRD[i], "UIB010250_01.SELECT")) // continue; // //若炼钢生产规范编码非空且不存在于TBB01_SMS_PROD // if(!"".equals(SMS_STD_NO[i]) && !beExist(SMS_STD_NO[i], "UIB010250_02.SELECT")) // continue; // //若轧钢生产规范编码非空且不存在于TBB01_MILL_PROD // if(!"".equals(MILL_STD_NO[i]) && !beExist(MILL_STD_NO[i], "UIB010250_03.SELECT")) // continue; param.setValueParamter(j++, CUST_SPEC_NO[i]); param.setValueParamter(j++, CUST_SPEC_NO_INGR[i]); param.setValueParamter(j++, CUST_SPEC_NO_QLTY[i]); param.setValueParamter(j++, CUST_SPEC_NO_DEL[i]); param.setValueParamter(j++, CUST_SPEC_NO[i].substring(0, 6)); param.setValueParamter(j++, SPEC_ABBSYM[i]); param.setValueParamter(j++, SPEC_STL_GRD[i]); param.setValueParamter(j++, THK_MIN[i]); param.setValueParamter(j++, THK_MAX[i]); param.setValueParamter(j++, WTH_MIN[i]); param.setValueParamter(j++, WTH_MAX[i]); param.setValueParamter(j++, ORD_USE_TP[i]); param.setValueParamter(j++, FAC_STL_GRD[i]); param.setValueParamter(j++, SMS_STD_NO[i]); param.setValueParamter(j++, MILL_STD_NO[i]); param.setValueParamter(j++, COLD_STD_NO[i]); param.setValueParamter(j++, DEV_SPEC_CD[i]); param.setValueParamter(j++, DEV_DGR_CD[i]); param.setValueParamter(j++, SIZE_SPEC_CD[i]); param.setValueParamter(j++, REG_NM[0]); dao.insert("UIB010250_01.INSERT", param); SaveModifyHistory.writeLog(dao, INFID, "I", "UIB010250_01.INSERT", param.getValueParameters(), "", REG_NM[0]); } else if("u".equals(rowStuts[i])) { // //若厂内钢号非空且不存与于表TBB01_FAC_INGR中则不能做插入操作 // if(!"".equals(FAC_STL_GRD[i]) && !beExist(FAC_STL_GRD[i], "UIB010250_01.SELECT")) // { // continue; // // } // //若炼钢生产规范编码非空且不存在于TBB01_SMS_PROD // if(!"".equals(SMS_STD_NO[i]) && !beExist(SMS_STD_NO[i], "UIB010250_02.SELECT")) // continue; // //若轧钢生产规范编码非空且不存在于TBB01_MILL_PROD // if(!"".equals(MILL_STD_NO[i]) && !beExist(MILL_STD_NO[i], "UIB010250_03.SELECT")) // continue; param.setWhereClauseParameter(j++, CUST_SPEC_NO[i]); param.setWhereClauseParameter(j++, CUST_SPEC_NO_INGR[i]); param.setWhereClauseParameter(j++, CUST_SPEC_NO_QLTY[i]); param.setWhereClauseParameter(j++, CUST_SPEC_NO_DEL[i]); param.setWhereClauseParameter(j++, CUST_SPEC_NO[i].substring(0, 6)); param.setWhereClauseParameter(j++, SPEC_ABBSYM[i]); param.setWhereClauseParameter(j++, SPEC_STL_GRD[i]); param.setWhereClauseParameter(j++, THK_MIN[i]); param.setWhereClauseParameter(j++, THK_MAX[i]); param.setWhereClauseParameter(j++, WTH_MIN[i]); param.setWhereClauseParameter(j++, WTH_MAX[i]); param.setWhereClauseParameter(j++, ORD_USE_TP[i]); param.setWhereClauseParameter(j++, FAC_STL_GRD[i]); param.setWhereClauseParameter(j++, SMS_STD_NO[i]); param.setWhereClauseParameter(j++, MILL_STD_NO[i]); param.setWhereClauseParameter(j++, COLD_STD_NO[i]); param.setWhereClauseParameter(j++, DEV_SPEC_CD[i]); param.setWhereClauseParameter(j++, DEV_DGR_CD[i]); param.setWhereClauseParameter(j++, SIZE_SPEC_CD[i]); param.setWhereClauseParameter(j++, REG_NM[0]); param.setWhereClauseParameter(j++, CUST_SPEC_NO1[i]); dao.update("UIB010250_01.UPDATE", param); SaveModifyHistory.writeLog(dao, INFID, "U", "UIB010250_01.UPDATE", param.getWhereClauseParamters(), "", REG_NM[0]); } else if("d".equals(rowStuts[i])) { param.setWhereClauseParameter(0 , CUST_SPEC_NO[i]); dao.delete("UIB010250_01.DELETE", param); SaveModifyHistory.writeLog(dao, INFID, "D", "UIB010250_01.DELETE", param.getWhereClauseParamters(), "", REG_NM[0]); } } } return PosBizControlConstants.SUCCESS; } /** * 判断厂内钢号、炼钢生产规范编号、轧钢生产规范编号是否存在 * @param str SQL中传入的参数 * @param sql 要执行的查询操作 * @return boolean 表有str参数的记录在数据库汇中是否存在 */ public boolean beExist(String str , String sql) { PosParameter pa = new PosParameter(); PosRowSet rowset = null; pa.setWhereClauseParameter(0, str); rowset = dao.find(sql, pa); if(rowset.count()==0 || rowset==null) return false; else return true; } }