56da02804c0b13f8017f9fabf1eea3de3d3194fc.svn-base 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package xin.glue.ui.D.D01;
  2. import com.posdata.glue.biz.activity.PosActivity;
  3. import com.posdata.glue.context.PosContext;
  4. import com.posdata.glue.dao.vo.PosParameter;
  5. import com.posdata.glue.dao.vo.PosRowSet;
  6. /**
  7. * 厂内牌号组录入保存
  8. * @author 王黎
  9. * @date 2008-12-24
  10. */
  11. public class SaveTbStlGrdGrp extends PosActivity
  12. {
  13. public String runActivity(PosContext context)
  14. {
  15. String[] CHK = (String[])context.get("CHK");
  16. String[] FAC_STL_GRP = (String[])context.get("FAC_STL_GRP");//厂内牌号组
  17. String[] FAC_STL_GRPNM = (String[])context.get("FAC_STL_GRPNM");//厂内牌号组名称
  18. String[] CHGCNT_MIN = (String[])context.get("CHGCNT_MIN");//最小编制炉次数
  19. String[] CHGCNT_MAX = (String[])context.get("CHGCNT_MAX");//最大编制炉次数
  20. String[] CHGCNT_CHK_YN = (String[])context.get("CHGCNT_CHK_YN");//是否检查炉次编制数量
  21. String[] CHGCNT_CHK_TP = (String[])context.get("CHGCNT_CHK_TP");//检查炉次编制数量后处理区分
  22. String[] USE_YN = (String[])context.get("USE_YN");//使用与否
  23. //String[] REG_ID = (String[])context.get("REG_ID");//录入人
  24. //String[] REG_DTIME = (String[])context.get("REG_DTIME");//录入时间
  25. //String[] MOD_ID = (String[])context.get("MOD_ID");//修改人
  26. //String[] MOD_DTIME = (String[])context.get("MOD_DTIME");//修改时间
  27. String[] regId = (String[])context.get("regId");
  28. if(regId == null)
  29. {
  30. regId = new String[1];
  31. regId[0] = "admin";
  32. }
  33. PosParameter parameter = null;
  34. PosRowSet rowSet = null;
  35. if(CHK != null)
  36. {
  37. for(int i = 0; i< CHK.length; i++)
  38. {
  39. //先判断表中是否存在该主键的条记录,如果存在,则只用更新就可以,如果不存在,则需重新插入
  40. String sql = "SELECT FAC_STL_GRP FROM TBD00_STLGRD_GRP WHERE FAC_STL_GRP='"+FAC_STL_GRP[i]+"'";
  41. rowSet = getDao("mesdao").findByQueryStatement(sql);
  42. parameter = new PosParameter();
  43. if(rowSet.hasNext())
  44. {
  45. parameter.setValueParamter(0,FAC_STL_GRPNM[i]);
  46. parameter.setValueParamter(1,CHGCNT_MIN[i]);
  47. parameter.setValueParamter(2,CHGCNT_MAX[i]);
  48. parameter.setValueParamter(3,CHGCNT_CHK_YN[i]);
  49. parameter.setValueParamter(4,CHGCNT_CHK_TP[i]);
  50. parameter.setValueParamter(5,USE_YN[i]);
  51. parameter.setValueParamter(6,regId[0]);
  52. //parameter.setValueParamter(7,REG_DATETIME);
  53. parameter.setValueParamter(7,FAC_STL_GRP[i]);
  54. getDao("mesdao").update("tbd00_stlgrd_grp.update", parameter);
  55. }
  56. else
  57. {
  58. parameter.setValueParamter(0,FAC_STL_GRPNM[i]);
  59. parameter.setValueParamter(1,CHGCNT_MIN[i]);
  60. parameter.setValueParamter(2,CHGCNT_MAX[i]);
  61. parameter.setValueParamter(3,CHGCNT_CHK_YN[i]);
  62. parameter.setValueParamter(4,CHGCNT_CHK_TP[i]);
  63. parameter.setValueParamter(5,USE_YN[i]);
  64. parameter.setValueParamter(6,regId[0]);
  65. //parameter.setValueParamter(7,REG_DATETIME);
  66. parameter.setValueParamter(7,regId[0]);
  67. //parameter.setValueParamter(9,"");
  68. parameter.setValueParamter(8,FAC_STL_GRP[i]);
  69. getDao("mesdao").insert("tbd00_stlgrd_grp.insert", parameter);
  70. }
  71. }
  72. }
  73. return "success";
  74. }
  75. }