|
|
@@ -0,0 +1,52 @@
|
|
|
+package tagentsales;
|
|
|
+
|
|
|
+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;
|
|
|
+import tagents.tagents;
|
|
|
+
|
|
|
+public class tagentsales extends PaoCust{
|
|
|
+
|
|
|
+ public tagentsales(PaoSet arg0) {
|
|
|
+ super(arg0);
|
|
|
+ // TODO Auto-generated constructor stub
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void add() throws P2Exception {
|
|
|
+ super.add();
|
|
|
+ if(getOwner()!=null) {
|
|
|
+ setValue("fagentnum", getOwner().getString("fagentnum"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void init() throws P2Exception {
|
|
|
+ super.init();
|
|
|
+ if (!toBeAdded() && getOwner() instanceof tagents
|
|
|
+ && !"新建".equals(getOwner().getString("fstatus")) && getOwner().getThisPaoSet().getApp() != null) {
|
|
|
+ setFieldFlag(new GetFieldsName(getName()).getFields(), READONLY, true);
|
|
|
+ setFieldFlag(new String[] { "FSALENUM" }, READONLY, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void fieldValidate(Object paoField, String fieldname) throws P2Exception {
|
|
|
+ super.fieldValidate(paoField, fieldname);
|
|
|
+ if(fieldname.equalsIgnoreCase("FSALENUM")){
|
|
|
+ PaoSetRemote thisPaoSet = getThisPaoSet();
|
|
|
+ for(int i=0;i< thisPaoSet.count();i++){
|
|
|
+ PaoRemote pao = thisPaoSet.getPao(i);
|
|
|
+ if(pao.getUniqueIDValue()!=getUniqueIDValue()&&pao.getString("FSALENUM").equals(getString("FSALENUM"))){
|
|
|
+ throw new P2AppException("","该销售助理已经添加过了");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|