a1da8bcb1560b0117e7f081574801fd66f5093a9.svn-base 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package xin.glue.ui.G.G04;
  2. import java.sql.CallableStatement;
  3. import java.sql.SQLException;
  4. import org.apache.commons.lang.StringUtils;
  5. import com.posdata.glue.biz.activity.PosActivity;
  6. import com.posdata.glue.biz.constants.PosBizControlConstants;
  7. import com.posdata.glue.context.PosContext;
  8. import com.posdata.glue.dao.PosGenericDao;
  9. public class SaveL2Wgt_new extends PosActivity{
  10. public String runActivity(PosContext context)
  11. {
  12. PosGenericDao dao = this.getDao("mesdao");
  13. CallableStatement cstm= null;
  14. String[] SlabNo = (String[])context.get("SLAB_NO");
  15. String[] User = (String[])context.get("USER");
  16. String[] weightWgt = (String[])context.get("WEIGHT_WGT");
  17. String[] samplingid = (String[])context.get("SAMPLINGID");
  18. String[] CHK = (String[])context.get("CHK");
  19. String[] type = (String[])context.get("TYPE");
  20. String[] upwgt= (String[])context.get("WIGHT_UPDATE");
  21. String[] CHK2 = (String[])context.get("CHK2");
  22. String[] remark = (String[])context.get("REMARK");
  23. if(SlabNo.length == 0){
  24. return PosBizControlConstants.SUCCESS;
  25. }
  26. StringBuffer slabNOs = new StringBuffer();
  27. for(int i = 0 ; i < SlabNo.length;i++){
  28. if(!CHK[i].equals("Y"))continue;
  29. try
  30. {
  31. cstm = dao.getCallableStatement("UIG050021_01.call");
  32. cstm.setString(1, SlabNo[i]);
  33. cstm.setString(2, weightWgt[i]);
  34. cstm.setString(3, samplingid[i]);
  35. cstm.setString(4, User[0]);
  36. cstm.setString(5, type[0]);
  37. cstm.setString(6, upwgt[i]);
  38. cstm.setString(7, CHK2[i]);
  39. cstm.setString(8, remark[i]);
  40. cstm.registerOutParameter(9, java.sql.Types.VARCHAR);
  41. cstm.execute();
  42. if(!StringUtils.isBlank(cstm.getString(9))){
  43. context.put("MESSAGES", cstm.getString(9));
  44. }else{
  45. context.put("MESSAGES", "²Ù×÷³É¹¦!");
  46. }
  47. }
  48. catch(Exception ex)
  49. {
  50. logger.logDebug(ex.getMessage());
  51. return PosBizControlConstants.SUCCESS;
  52. }finally
  53. {
  54. if (cstm != null)
  55. {
  56. try
  57. {
  58. cstm.close();
  59. }
  60. catch (SQLException e)
  61. {
  62. logger.logWarn(e.getMessage(), e);
  63. }
  64. }
  65. }
  66. }
  67. return PosBizControlConstants.SUCCESS;
  68. }
  69. }