Browse Source

专用账户使用逻辑修改

hu 2 years ago
parent
commit
231514e602

+ 3 - 0
src/custom/restcontroller/webmanage/sale/accountclass/accountclass.java

@@ -160,6 +160,9 @@ public class accountclass extends Controller {
             if (whereObject.containsKey("isrebate") && !"".equals(whereObject.getString("isrebate"))) {
             if (whereObject.containsKey("isrebate") && !"".equals(whereObject.getString("isrebate"))) {
                 where = where + " and t1.isrebate=" + whereObject.getLong("isrebate");
                 where = where + " and t1.isrebate=" + whereObject.getLong("isrebate");
             }
             }
+            if (whereObject.containsKey("isnotspecialfund") && !"".equals(whereObject.getString("isnotspecialfund"))) {
+                where = where + " and JSON_TYPE(t1.bindingcategories) != 'NULL' and JSON_LENGTH(t1.bindingcategories) != 0 ";
+            }
 
 
         }
         }
         /*
         /*

+ 15 - 0
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -164,6 +164,21 @@ public class Order extends Controller {
             }
             }
         } else {
         } else {
             //订单更新时
             //订单更新时
+            if(content.getLongValue("sa_accountclassid")!=0){
+                Rows accountclassRows = dbConnect
+                        .runSqlQuery(
+                                "select accountno,accountname from sa_accountclass where sa_accountclassid=" + content.getLongValue("sa_accountclassid"));
+                if(accountclassRows.isNotEmpty()){
+                    if(accountclassRows.get(0).getString("accountname").equals("物料账户")){
+                        Rows wuliaoRows = dbConnect.runSqlQuery("select * from sa_orderitems t1 where exists(select 1 from sa_itemsaleclass t left join plm_itemclass t2 on t.itemclassid=t2.itemclassid and t.siteid=t2.siteid  where t.itemid=t1.itemid and t2.itemclassname='物料') and t1.sa_orderid="+sa_orderid);
+                        Rows itemRows = dbConnect.runSqlQuery("select * from sa_orderitems where sa_orderid="+sa_orderid);
+                        if(wuliaoRows.size()!=itemRows.size()){
+                            return getErrReturnObject().setErrMsg("物料账户只能添加物料商品,请检查").toString();
+                        }
+                    }
+                }
+                sqlFactory.addParameter("sa_accountclassid", content.getLongValue("sa_accountclassid"));
+            }
             if (billdate.equals("")) {
             if (billdate.equals("")) {
                 sqlFactory.addParameter_SQL("billdate", "createdate");
                 sqlFactory.addParameter_SQL("billdate", "createdate");
             } else {
             } else {