package xin.glue.ui.D.D01; import com.posdata.glue.biz.activity.PosActivity; import com.posdata.glue.context.PosContext; import com.posdata.glue.dao.vo.PosParameter; import com.posdata.glue.dao.vo.PosRowSet; /** * 厂内牌号组录入保存 * @author 王黎 * @date 2008-12-24 */ public class SaveTbStlGrdGrp extends PosActivity { public String runActivity(PosContext context) { String[] CHK = (String[])context.get("CHK"); String[] FAC_STL_GRP = (String[])context.get("FAC_STL_GRP");//厂内牌号组 String[] FAC_STL_GRPNM = (String[])context.get("FAC_STL_GRPNM");//厂内牌号组名称 String[] CHGCNT_MIN = (String[])context.get("CHGCNT_MIN");//最小编制炉次数 String[] CHGCNT_MAX = (String[])context.get("CHGCNT_MAX");//最大编制炉次数 String[] CHGCNT_CHK_YN = (String[])context.get("CHGCNT_CHK_YN");//是否检查炉次编制数量 String[] CHGCNT_CHK_TP = (String[])context.get("CHGCNT_CHK_TP");//检查炉次编制数量后处理区分 String[] USE_YN = (String[])context.get("USE_YN");//使用与否 //String[] REG_ID = (String[])context.get("REG_ID");//录入人 //String[] REG_DTIME = (String[])context.get("REG_DTIME");//录入时间 //String[] MOD_ID = (String[])context.get("MOD_ID");//修改人 //String[] MOD_DTIME = (String[])context.get("MOD_DTIME");//修改时间 String[] regId = (String[])context.get("regId"); if(regId == null) { regId = new String[1]; regId[0] = "admin"; } PosParameter parameter = null; PosRowSet rowSet = null; if(CHK != null) { for(int i = 0; i< CHK.length; i++) { //先判断表中是否存在该主键的条记录,如果存在,则只用更新就可以,如果不存在,则需重新插入 String sql = "SELECT FAC_STL_GRP FROM TBD00_STLGRD_GRP WHERE FAC_STL_GRP='"+FAC_STL_GRP[i]+"'"; rowSet = getDao("mesdao").findByQueryStatement(sql); parameter = new PosParameter(); if(rowSet.hasNext()) { parameter.setValueParamter(0,FAC_STL_GRPNM[i]); parameter.setValueParamter(1,CHGCNT_MIN[i]); parameter.setValueParamter(2,CHGCNT_MAX[i]); parameter.setValueParamter(3,CHGCNT_CHK_YN[i]); parameter.setValueParamter(4,CHGCNT_CHK_TP[i]); parameter.setValueParamter(5,USE_YN[i]); parameter.setValueParamter(6,regId[0]); //parameter.setValueParamter(7,REG_DATETIME); parameter.setValueParamter(7,FAC_STL_GRP[i]); getDao("mesdao").update("tbd00_stlgrd_grp.update", parameter); } else { parameter.setValueParamter(0,FAC_STL_GRPNM[i]); parameter.setValueParamter(1,CHGCNT_MIN[i]); parameter.setValueParamter(2,CHGCNT_MAX[i]); parameter.setValueParamter(3,CHGCNT_CHK_YN[i]); parameter.setValueParamter(4,CHGCNT_CHK_TP[i]); parameter.setValueParamter(5,USE_YN[i]); parameter.setValueParamter(6,regId[0]); //parameter.setValueParamter(7,REG_DATETIME); parameter.setValueParamter(7,regId[0]); //parameter.setValueParamter(9,""); parameter.setValueParamter(8,FAC_STL_GRP[i]); getDao("mesdao").insert("tbd00_stlgrd_grp.insert", parameter); } } } return "success"; } }