hyworkorder_team.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package hyworkorder_team;
  2. import baseclass.PaoCust;
  3. import baseclass.tools.GetFieldsName;
  4. import p2.pao.PaoRemote;
  5. import p2.pao.PaoSet;
  6. import p2.pao.PaoSetRemote;
  7. import p2.util.P2AppException;
  8. import p2.util.P2Exception;
  9. public class hyworkorder_team extends PaoCust {
  10. /**
  11. * 构造函数
  12. *
  13. * @param arg0
  14. */
  15. public hyworkorder_team(PaoSet arg0) {
  16. super(arg0);
  17. }
  18. @Override
  19. public void init() throws P2Exception {
  20. super.init();
  21. if(getOwner()!=null){
  22. if(!getOwner().getString("fstatus").equals("待开始") && !getOwner().getString("fstatus").equals("待接单")){
  23. setFieldFlag(new GetFieldsName(getName()).getFields(), READONLY,true);
  24. }
  25. }
  26. }
  27. @Override
  28. public void add() throws P2Exception {
  29. super.add();
  30. setValue("fagentnum",getOwner().getString("fagentnum"),11l);
  31. }
  32. @Override
  33. public void fieldAction(Object paoField, String fieldname) throws P2Exception {
  34. super.fieldAction(paoField, fieldname);
  35. if(fieldname.equalsIgnoreCase("hyworkernum")){
  36. PaoSetRemote worker = getPaoSet("hyworker");
  37. if(worker.isEmpty()){
  38. throw new P2AppException("","该人员不存在");
  39. }
  40. setValue("workername",worker.getPao(0).getString("FNAME"),11l);
  41. setValue("ftype",worker.getPao(0).getString("role"),11l);
  42. setValue("workephone",worker.getPao(0).getString("workphone"),11l);
  43. }
  44. }
  45. @Override
  46. public void fieldValidate(Object paoField, String fieldname) throws P2Exception {
  47. super.fieldValidate(paoField, fieldname);
  48. if(fieldname.equalsIgnoreCase("workephone")){
  49. PaoSetRemote thisPaoSet = getThisPaoSet();
  50. for(int i=0;i< thisPaoSet.count();i++){
  51. PaoRemote pao = thisPaoSet.getPao(i);
  52. if(pao.getUniqueIDValue()!=getUniqueIDValue()&&pao.getString("workephone").equals(getString("workephone"))){
  53. throw new P2AppException("","手机号重复");
  54. }
  55. }
  56. }
  57. }
  58. }