0d3d2f829001ef9a9adbadac609c6b1090b8790d.svn-base 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package xin.glue.ui.B.B02;
  2. import com.posdata.glue.biz.activity.PosActivity;
  3. import com.posdata.glue.biz.constants.PosBizControlConstants;
  4. import com.posdata.glue.context.PosContext;
  5. import com.posdata.glue.dao.PosGenericDao;
  6. import com.posdata.glue.dao.PosJdbcDao;
  7. import com.posdata.glue.dao.manager.PosQueryDefinition;
  8. import com.posdata.glue.dao.manager.PosQueryManager;
  9. import com.posdata.glue.dao.vo.PosParameter;
  10. import com.posdata.glue.dao.vo.PosRow;
  11. import com.posdata.glue.dao.vo.PosRowSet;
  12. /**
  13. *
  14. * @Description 查询各样片号对应的实绩及实际的样片号{界面ID:ID:UIB020132}
  15. * @author 梅贵平{meiguiping}
  16. * @date 2008-12-13 上午09:42:03
  17. * @JDK Version jdk1.4.2
  18. */
  19. public class FindSmpGrade extends PosActivity
  20. {
  21. public String runActivity(PosContext context)
  22. {
  23. ///ready
  24. MutilConditionFind mcf = new MutilConditionFind();
  25. PosGenericDao dao = this.getDao("mesdao");
  26. PosParameter param = null;
  27. PosRow row = null;
  28. ///get request data
  29. String[] P_SMPNO = (String[])context.get("SMPNO"); //样片号
  30. String[] P_SMPCUTLOC= (String[])context.get("SMPCUTLOC");//位置
  31. //查询某SMP_NO所对应的CONV_SMP_NO的CONV_SMP_NO_FLAG = 'Y'的相同材质的SMP_NO
  32. param = new PosParameter();
  33. param.setWhereClauseParameter(0, P_SMPNO[0]);
  34. param.setWhereClauseParameter(1, P_SMPCUTLOC[0]);
  35. PosRowSet rowset = dao.find("UIB020132_04.SELECT", param);
  36. int j = 1;
  37. String select = "";
  38. if("W".equals(P_SMPCUTLOC[0]))//若取样位置为W
  39. {
  40. select = mcf.getQuerySql("UIB020132_03_W.SELECT").toString();
  41. }
  42. else//若取样位置非W
  43. {
  44. select = mcf.getQuerySql("UIB020132_03_BT.SELECT").toString();
  45. }
  46. StringBuffer mid= new StringBuffer(300);
  47. String sql = "";
  48. String temp = mcf.getQuerySql("UIB020132_03.LOOP").toString();//获取SQL的动态部分
  49. StringBuffer sb = new StringBuffer(100);
  50. while(rowset.hasNext())
  51. {
  52. row = rowset.next();
  53. sql = temp.replaceAll("[{]+[0]+[}]+", row.getAttribute("SMP").toString());
  54. sql = sql.replaceAll("[{]+[1]+[}]+", new Integer(j++).toString());
  55. sb.append(", NULL");
  56. mid.append(sql+"\n");
  57. }
  58. param = new PosParameter();
  59. param.setWhereClauseParameter(0, P_SMPNO[0]);
  60. param.setWhereClauseParameter(1, P_SMPNO[0]);
  61. String sss = select.replaceFirst("[{]+[1]+[}]+", mid.toString()).replaceFirst("[{]+[2]+[}]+", sb.toString());
  62. PosRowSet rs = dao.findByQueryStatement(sss , param);
  63. context.put("GradeResult", rs);
  64. return PosBizControlConstants.SUCCESS;
  65. }
  66. }