package hyworkorder_team; import baseclass.PaoCust; import baseclass.tools.GetFieldsName; import p2.pao.PaoRemote; import p2.pao.PaoSet; import p2.pao.PaoSetRemote; import p2.util.P2AppException; import p2.util.P2Exception; public class hyworkorder_team extends PaoCust { /** * 构造函数 * * @param arg0 */ public hyworkorder_team(PaoSet arg0) { super(arg0); } @Override public void init() throws P2Exception { super.init(); if(getOwner()!=null){ if(!getOwner().getString("fstatus").equals("待开始") && !getOwner().getString("fstatus").equals("待接单")){ setFieldFlag(new GetFieldsName(getName()).getFields(), READONLY,true); } } } @Override public void add() throws P2Exception { super.add(); setValue("fagentnum",getOwner().getString("fagentnum"),11l); } @Override public void fieldAction(Object paoField, String fieldname) throws P2Exception { super.fieldAction(paoField, fieldname); if(fieldname.equalsIgnoreCase("hyworkernum")){ PaoSetRemote worker = getPaoSet("hyworker"); if(worker.isEmpty()){ throw new P2AppException("","该人员不存在"); } setValue("workername",worker.getPao(0).getString("FNAME"),11l); setValue("ftype",worker.getPao(0).getString("role"),11l); setValue("workephone",worker.getPao(0).getString("workphone"),11l); } } @Override public void fieldValidate(Object paoField, String fieldname) throws P2Exception { super.fieldValidate(paoField, fieldname); if(fieldname.equalsIgnoreCase("workephone")){ PaoSetRemote thisPaoSet = getThisPaoSet(); for(int i=0;i< thisPaoSet.count();i++){ PaoRemote pao = thisPaoSet.getPao(i); if(pao.getUniqueIDValue()!=getUniqueIDValue()&&pao.getString("workephone").equals(getString("workephone"))){ throw new P2AppException("","手机号重复"); } } } } }