package xin.glue.ui.D.D01; 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.vo.PosParameter; import com.posdata.glue.dao.vo.PosRowSet; /** * 板坏设计结果的保存 * @author 王黎 * @date 2008-9-6 */ public class SaveSlabResInfo extends PosActivity { public String runActivity(PosContext context) { //从页面获取一系列参数,供更新数据所用 String[] chk = (String[]) context.get("CHK"); String[] DSN_SLAB_NO = (String[]) context.get("DSN_SLAB_NO");//板坏号 String[] P_DSN_SLAB_NO = (String[]) context.get("P_DSN_SLAB_NO");//组合板坏号 String[] ORD_NO = (String[]) context.get("ORD_NO"); String[] ORD_SEQ = (String[]) context.get("ORD_SEQ"); String[] SLAB_WTH = (String[]) context.get("SLAB_WTH"); String[] SLAB_THK = (String[]) context.get("SLAB_THK"); String[] SLAB_LEN = (String[]) context.get("SLAB_LEN"); String[] SLAB_WGT = (String[]) context.get("SLAB_WGT"); String[] SLAB_TRMTH_TP = (String[]) context.get("SLAB_TRMTH_TP"); String[] AUTODSN_YN = (String[]) context.get("AUTODSN_YN"); String[] EMGMTR_YN = (String[]) context.get("EMGMTR_YN"); String[] COIL_PACK_WGT_MIN = (String[]) context.get("COIL_PACK_WGT_MIN"); String[] COIL_PACK_WGT_MAX = (String[]) context.get("COIL_PACK_WGT_MAX"); String[] HCR_YN = (String[]) context.get("HCR_YN"); String[] GRAVITY = (String[]) context.get("GRAVITY"); //String[] SPEC_ABBSYMBL = (String[]) context.get("SPEC_ABBSYMBL"); //String[] SPEC_STL_GRD = (String[]) context.get("SPEC_STL_GRD"); String[] FAC_STL_GRD = (String[]) context.get("FAC_STL_GRD"); //String[] PRDNM_CD = (String[]) context.get("PRDNM_CD"); String[] COIL_THK = (String[]) context.get("COIL_THK"); String[] COIL_WTH = (String[]) context.get("COIL_WTH"); String[] COIL_LEN = (String[]) context.get("COIL_LEN"); String[] COIL_WGT = (String[]) context.get("COIL_WGT"); String[] PROC_PATH = (String[]) context.get("PROC_PATH"); String[] FAC_STL_GRP = (String[]) context.get("FAC_STL_GRP"); String[] COMB_YN = (String[]) context.get("COMB_YN"); //组织三个参数群,分别供查询,更新和插入数据所用 PosParameter parameter = null; PosRowSet rowSet = null; if (chk != null) { for (int i = 0; i < chk.length; i++) { //更新参数 parameter = new PosParameter(); parameter.setValueParamter(0, SLAB_WTH[i]); parameter.setValueParamter(1, SLAB_THK[i]); parameter.setValueParamter(2, SLAB_LEN[i]); parameter.setValueParamter(3, SLAB_WGT[i]); parameter.setValueParamter(4, SLAB_TRMTH_TP[i]); parameter.setValueParamter(5, AUTODSN_YN[i]); parameter.setValueParamter(6, EMGMTR_YN[i]); parameter.setValueParamter(7, COIL_PACK_WGT_MIN[i]); parameter.setValueParamter(8, COIL_PACK_WGT_MAX[i]); //parameter.setValueParamter(7, "0"); //parameter.setValueParamter(8, "0"); parameter.setValueParamter(9, HCR_YN[i]); parameter.setValueParamter(10, GRAVITY[i]); //parameter.setValueParamter(11, SPEC_ABBSYMBL[i]); //parameter.setValueParamter(12, SPEC_STL_GRD[i]); parameter.setValueParamter(11, FAC_STL_GRD[i]); //parameter.setValueParamter(13, PRDNM_CD[i]); parameter.setValueParamter(12, COIL_THK[i]); parameter.setValueParamter(13, COIL_WTH[i]); parameter.setValueParamter(14, COIL_LEN[i]); parameter.setValueParamter(15, COIL_WGT[i]); parameter.setValueParamter(16, PROC_PATH[i]); if(P_DSN_SLAB_NO == null) { parameter.setValueParamter(17,""); } else { parameter.setValueParamter(17, P_DSN_SLAB_NO[i]); } parameter.setValueParamter(18, FAC_STL_GRP[i]); //parameter.setValueParamter(18, ""); parameter.setValueParamter(19, COMB_YN[i]); parameter.setValueParamter(20, ORD_SEQ[i]); parameter.setValueParamter(21, ORD_NO[i]); parameter.setValueParamter(22, DSN_SLAB_NO[i]); //先判断表中是否存在该主键的条记录,如果存在,则只用更新就可以,如果不存在,则需重新插入 String sql = "SELECT DSN_SLAB_NO FROM TBD01_SLABDN_RST WHERE DSN_SLAB_NO='"+DSN_SLAB_NO[i] +"'"; rowSet = getDao("mesdao").findByQueryStatement(sql); if(rowSet.hasNext()) { getDao("mesdao").update("tbd01_slabdn_rst.update", parameter); } else { getDao("mesdao").insert("tbd01_slabdn_rst.insert", parameter); } } } return PosBizControlConstants.SUCCESS; } }