serviceform.java 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package serviceform;
  2. import baseclass.PaoCust;
  3. import p2.pao.PaoRemote;
  4. import p2.pao.PaoSet;
  5. import p2.pao.PaoSetRemote;
  6. import p2.util.P2AppException;
  7. import p2.util.P2Exception;
  8. import java.util.Date;
  9. public class serviceform extends PaoCust {
  10. /**
  11. * 构造函数
  12. *
  13. * @param arg0
  14. */
  15. public serviceform(PaoSet arg0) {
  16. super(arg0);
  17. }
  18. @Override
  19. public void init() throws P2Exception {
  20. super.init();
  21. }
  22. @Override
  23. public void add() throws P2Exception {
  24. super.add();
  25. setValue("fservernum", getBillNum("SERFORM"),11l);
  26. setValue("fstatus","待指派",11l);
  27. setValue("Initiationtime",new Date(),11l);
  28. }
  29. @Override
  30. public void fieldAction(Object paoField, String fieldname) throws P2Exception {
  31. super.fieldAction(paoField, fieldname);
  32. if(fieldname.equalsIgnoreCase("FAGENTNUM")){
  33. if(!isNull("FAGENTNUM")){
  34. PaoSetRemote pw_assignments = getPaoSet("$pw_assignment",
  35. "pw_assignment","app='SERFORM' and ownertable='SERVICEFORM' and ownerid="+getUniqueIDValue());
  36. if(!pw_assignments.isEmpty()){
  37. PaoRemote pao = pw_assignments.getPao(0);
  38. pao.delete();
  39. pw_assignments.save();
  40. }
  41. }
  42. }
  43. }
  44. @Override
  45. public void fieldValidate(Object paoField, String fieldname) throws P2Exception {
  46. super.fieldValidate(paoField, fieldname);
  47. if(fieldname.equalsIgnoreCase("customerphone")){
  48. validatephone(getString("customerphone"));
  49. }
  50. }
  51. public void pushToNB() throws P2Exception {
  52. if(!getString("siteid").equals("GEN"))throw new P2AppException("","不是总站点");
  53. setValue("siteid","NB",11l);
  54. }
  55. public void pushToTZ() throws P2Exception {
  56. if(!getString("siteid").equals("GEN"))throw new P2AppException("","不是总站点");
  57. setValue("siteid","TZ",11l);
  58. }
  59. public void pushToHY() throws P2Exception {
  60. if(!getString("siteid").equals("GEN"))throw new P2AppException("","不是总站点");
  61. setValue("siteid","HY",11l);
  62. }
  63. public void tocheck(String type) throws P2Exception {
  64. PaoSetRemote workorder = getPaoSet("WORKORDER");
  65. workorder.setWhere("ftype='"+type+"' and fstatus<>'作废'");
  66. workorder.reset();
  67. if(!workorder.isEmpty())throw new P2AppException("","已存在重复工单类型");
  68. }
  69. }