package serviceform; import baseclass.PaoCust; import p2.pao.PaoRemote; import p2.pao.PaoSet; import p2.pao.PaoSetRemote; import p2.util.P2AppException; import p2.util.P2Exception; import java.util.Date; public class serviceform extends PaoCust { /** * 构造函数 * * @param arg0 */ public serviceform(PaoSet arg0) { super(arg0); } @Override public void init() throws P2Exception { super.init(); } @Override public void add() throws P2Exception { super.add(); setValue("fservernum", getBillNum("SERFORM"),11l); setValue("fstatus","待指派",11l); setValue("Initiationtime",new Date(),11l); } @Override public void fieldAction(Object paoField, String fieldname) throws P2Exception { super.fieldAction(paoField, fieldname); if(fieldname.equalsIgnoreCase("FAGENTNUM")){ if(!isNull("FAGENTNUM")){ PaoSetRemote pw_assignments = getPaoSet("$pw_assignment", "pw_assignment","app='SERFORM' and ownertable='SERVICEFORM' and ownerid="+getUniqueIDValue()); if(!pw_assignments.isEmpty()){ PaoRemote pao = pw_assignments.getPao(0); pao.delete(); pw_assignments.save(); } } } } @Override public void fieldValidate(Object paoField, String fieldname) throws P2Exception { super.fieldValidate(paoField, fieldname); if(fieldname.equalsIgnoreCase("customerphone")){ validatephone(getString("customerphone")); } } public void pushToNB() throws P2Exception { if(!getString("siteid").equals("GEN"))throw new P2AppException("","不是总站点"); setValue("siteid","NB",11l); } public void pushToTZ() throws P2Exception { if(!getString("siteid").equals("GEN"))throw new P2AppException("","不是总站点"); setValue("siteid","TZ",11l); } public void pushToHY() throws P2Exception { if(!getString("siteid").equals("GEN"))throw new P2AppException("","不是总站点"); setValue("siteid","HY",11l); } public void tocheck(String type) throws P2Exception { PaoSetRemote workorder = getPaoSet("WORKORDER"); workorder.setWhere("ftype='"+type+"' and fstatus<>'作废'"); workorder.reset(); if(!workorder.isEmpty())throw new P2AppException("","已存在重复工单类型"); } }