Explorar el Código

海盐销售助理功能更新

hu hace 4 años
padre
commit
dc3d967fef

+ 3 - 0
src/apps/ficashbill/ficashbill.java

@@ -351,6 +351,9 @@ public class ficashbill extends PaoCust {
         }
 
         if ((isincom && "收入".equals(getString("ftype"))) || (!isincom && "支出".equals(getString("ftype")))) {
+        	if(famount > 0){
+        	    sendEmail(getMailBySalesGroup(getString("fagentnum")), "经销商有新的收入到账", "经销商有新的收入凭证,收入金额:"+famount);
+        	}
             setValue("ftaccbalbalance", taccbal.getDouble("fbalance"), 11L);
             setValue("fstatus", "审核", 11L);
             setValue("checkby", getUserName(), 11L);

+ 5 - 0
src/apps/ficashbill/ficashbillAppBean.java

@@ -33,6 +33,11 @@ public class ficashbillAppBean extends AppBeanCust {
                     if ("RECBILL".equalsIgnoreCase(appname)) {
                         databean.setAppWhere("((createflag=1 or fstatus!='新建') and isnull(ftypemx,'')!='返利金') or (isnull(ftypemx,'')='返利金' and fstatus!='新建')");
                     }
+                	String hrid =getPao().getUserName();
+                	String salenum = ((PaoCust) getPao()).getSalenumByHrid(getPao().getUserName());
+                	if("RECBILL".equalsIgnoreCase(appname) && salenum!=null && salenum.equals("销售助理")){
+                	    databean.setAppWhere("fagentnum in (select fagentnum from tagents where siteid='HY' and fsalenum='"+hrid+"') and fstatus='审核'");
+                	}
                     if ("RECBILL2".equalsIgnoreCase(appname)) {
                         if (agentnum != null) {
                             databean.setAppWhere("fagentnum='" + agentnum + "' and (createflag=0 or fstatus!='新建') ");

+ 22 - 0
src/apps/salesassistant/salesassistant.java

@@ -0,0 +1,22 @@
+package salesassistant;
+
+import baseclass.PaoCust;
+import p2.pao.PaoSet;
+import p2.util.P2Exception;
+
+public class salesassistant extends PaoCust{
+
+
+		public salesassistant(PaoSet arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+		@Override
+	public void fieldValidate(Object paoField, String fieldname) throws P2Exception {
+	    super.fieldValidate(paoField, fieldname);
+	    if(fieldname.equalsIgnoreCase("FSALENUM")){
+	        distinctfieldcheckfsalenum("FSALENUM");
+	    }
+	}
+}

+ 27 - 0
src/apps/twriteoffbill/twriteoffbillAppBean.java

@@ -1,11 +1,38 @@
 package twriteoffbill;
 
+import java.util.Calendar;
+import baseclass.PaoCust;
 import baseclass.AppBeanCust;
 import p2.util.P2Exception;
+import p2.webclient.system.beans.DataBean;
 import tsafeqtyadj.tsafeqtyadj;
 
 public class twriteoffbillAppBean extends AppBeanCust {
+	@Override
+public void initializeApp() throws P2Exception {
+    if (!(this.app.inAppLinkMode())) {
+        DataBean databean = this.app.getGridBean();
+        if (getPao() == null) {
+            super.initializeApp();
+        } else {
+            if (getPao().getThisPaoSet().getApp() == null) {
+                super.initializeApp();
+            } else {
+                String appname = getPao().getThisPaoSet().getApp();
+                String hrid = getPao().getUserName();
+                String salenum = ((PaoCust) getPao()).getSalenumByHrid(getPao().getUserName());
+                if("WRITEOFF".equalsIgnoreCase(appname)  && salenum!=null && salenum.equals("ÏúÊÛÖúÀí")){
+                    databean.setAppWhere("fagentnum in (select fagentnum from tagents where siteid='HY' and fsalenum='"+hrid+"') and siteid ='HY'");
+                }
 
+                int year = Calendar.getInstance().get(Calendar.YEAR);
+                databean.setDefaultQbe("createdate", ">=" + (year - 1) + "-01-01");
+                databean.reset();
+                super.initializeApp();
+            }
+        }
+    }
+}
     @Override
     public int CHECK() throws P2Exception {
         this.SAVE();

+ 43 - 1
src/base/baseclass/PaoCust.java

@@ -1279,5 +1279,47 @@ public class PaoCust extends Pao implements PaoRemote {
         }
         return map;
     }
-
+	public String[] getMailBySalesGroup(String fagentnum) throws P2Exception {
+	    PaoSetRemote email = getPaoSet("$sales_email", "salesassistant", "fsalenum in (select tagents.fsalenum from tagents where fagentnum = '"+fagentnum+"') and sales_email is not null");
+	    String[] emailaddress = getStrings(email, "sales_email");
+	    return emailaddress;
+	}
+
+	public String getSalenumByHrid(String hrid) throws P2Exception {
+	    PaoSetRemote pp_users = P2Server.getP2Server().getPaoSet(
+	            "pp_users", P2Server.getP2Server().getSystemUserInfo());
+	    pp_users.setWhere("hrid='" + hrid + "'");
+	    pp_users.reset();
+	    if (pp_users.count() == 1) {
+	        String fusertype = pp_users.getPao(0).getString("fusertype");
+	        pp_users.close();
+	        if(fusertype != null && fusertype.length()!=0){
+	            return fusertype;
+	        }else{
+	            return null;
+	        }
+
+	    } else {
+	        pp_users.close();
+	        return null;
+	    }
+	}
+
+	public void distinctfieldcheckfsalenum(String fieldname) throws P2Exception {
+	    PaoSetRemote paoset = P2Server.getP2Server().getPaoSet(getName(),
+	            getUserInfo());
+	    paoset.setWhere(fieldname + "='" + getString(fieldname)
+	            + "' and siteid='" + getString("siteid") + "'");
+
+	    System.out.println(fieldname + "='" + getString(fieldname)
+	            + "' and siteid='" + getString("siteid") + "'");
+
+	    paoset.reset();
+	    if (!paoset.isEmpty()) {
+	        paoset.close();
+	        throw new P2AppException("", "¸Ã"
+	                + getPaoField(fieldname).getColumnTitle() + "ÒÑ´æÔÚ");
+	    }
+	    paoset.close();
+	}
 }

+ 1 - 1
src/rest/openapi/restcontroller/wechatapp/orderform/SQL/订单审核明细.sql

@@ -5,7 +5,7 @@ inner join saorderdetail t2 on t1.siteid=t2.siteid and t1.saorderid=t2.fparentid
 inner join pp_hr on pp_hr.hrid=t1.fsaler and pp_hr.siteid=@siteid
 inner join tunit on tunit.FUNITID=t2.FUNITID
 left join SAINVOICEDETAIL  on SAINVOICEDETAIL.FSOURCEID=t2.SAORDERDETAILID and SAINVOICEDETAIL.siteid=t2.siteid
-inner join SAINVOICE on SAINVOICEDETAIL.fparentid=SAINVOICE.sainvoiceid and SAINVOICEDETAIL.siteid=SAINVOICE.siteid
+left join SAINVOICE on SAINVOICEDETAIL.fparentid=SAINVOICE.sainvoiceid and SAINVOICEDETAIL.siteid=SAINVOICE.siteid
 inner join titem t3 on  t2.fitemno=t3.fitemno and t2.siteid=t3.siteid
 left join TPROJECT on TPROJECT.fprojectnum=t1.fprojectnum and TPROJECT.siteid=t1.siteid
 left join (select saorderdetail.SAORDERDETAILID,max(TINVOICEAPPLY.checkdate) kaipiaodate from  saorderdetail left join TINVOICEAPPLYORDER  on saorderdetail.SAORDERDETAILID=TINVOICEAPPLYORDER.SAORDERDETAILID and saorderdetail.siteid=TINVOICEAPPLYORDER.siteid