Просмотр исходного кода

返利结算单结算报错修复

hu 2 лет назад
Родитель
Сommit
9ae46c6c08

+ 2 - 2
src/custom/restcontroller/webmanage/sale/dispatch/dispatch.java

@@ -477,7 +477,7 @@ public class dispatch extends Controller {
 
         WebRequest request = new WebRequest();
         String result = request.doPost(object.toString(),
-                "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
+                "http://60.190.151.198:8101/BYESB/jaxrs/webclientrest");
         JSONArray jsonArray = JSONArray.parseArray(result);
         if(!jsonArray.isEmpty()){
             return getErrReturnObject().setErrMsg("中间表存在未同步的销售出库单,无法手工关闭")
@@ -756,7 +756,7 @@ public class dispatch extends Controller {
 
         WebRequest request = new WebRequest();
         String result = request.doPost(object.toString(),
-                "http://60.190.151.198:8089/BYESB/jaxrs/webclientrest");
+                "http://60.190.151.198:8101/BYESB/jaxrs/webclientrest");
         if(result.equals("true")){
             return getErrReturnObject().setErrMsg("K3发货单为非删除状态,无法反复核")
                     .toString();

+ 17 - 0
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -22,6 +22,7 @@ import org.apache.poi.xssf.usermodel.*;
 import restcontroller.R;
 import restcontroller.webmanage.sale.itemgroup.itemgroup;
 import utility.ERPDocking;
+import utility.tools.WebRequest;
 
 
 import java.io.IOException;
@@ -311,8 +312,24 @@ public class Item extends Controller {
 
             }
         }
+        JSONObject object = new JSONObject();
+        object.put("classname", "getIcinvbal");
+        object.put("method", "getMsg");
 
+        JSONObject content = new JSONObject();
+        content.put("fitemnos",  rows.toJsonArray("itemno"));
+        object.put("content", content);
+
+        WebRequest request = new WebRequest();
+        String result = request.doPost(object.toString(),
+                "http://60.190.151.198:8101/BYESB/jaxrs/webclientrest");
         for (Row row : rows) {
+            JSONArray jsonArrayResult = JSONArray.parseArray(result);
+            if(!jsonArrayResult.isEmpty()){
+                row.put("invbal_qty",((JSONObject)jsonArrayResult.get(0)).getBigDecimal("fqty"));
+            }else{
+                row.put("invbal_qty",0);
+            }
             if (attRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isEmpty()) {
                 row.put("attinfos", defaultImageRows);
             } else {

+ 12 - 6
src/custom/restcontroller/webmanage/sale/rebateaccount/rebateaccounthead.java

@@ -493,17 +493,19 @@ public class rebateaccounthead extends Controller {
     public BigDecimal CalculateAmount(String begindate, String enddate, long sys_enterpriseid, ArrayList<Long> itemclsids,String agentitemclsnums,
                                   String itemids) throws YosException {
         Rows rows = null;
+        itemclsids.addAll(ItemClass.getSubItemClassIds(this,itemclsids));
+        itemclsids.add(0l);
         if (itemids .equals("()")) {
             rows = dbConnect.runSqlQuery("select SUM(if(t1.isclose,t1.amount,t1.price*(t1.qty-t1.undeliqty))) amount from sa_orderitems t1 \n" +
                     "inner join sa_order t2 on  t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
                     "inner join plm_item t3 on  t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
-                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
+                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
 
         } else {
             rows = dbConnect.runSqlQuery("select SUM(if(t1.isclose,t1.amount,t1.price*(t1.qty-t1.undeliqty))) amount from sa_orderitems t1 \n" +
                     "inner join sa_order t2 on  t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
                     "inner join plm_item t3 on  t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
-                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid not in" + itemids + " and  t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" )   and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
+                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid not in" + itemids + " and  t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" )   and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
 
         }
         if (rows.isEmpty()) {
@@ -516,17 +518,19 @@ public class rebateaccounthead extends Controller {
     public Rows QuerySaorderNum(String begindate, String enddate, long sys_enterpriseid, ArrayList<Long> itemclsids,String agentitemclsnums,
                                 String itemids) throws YosException {
         Rows rows = null;
+        itemclsids.addAll(ItemClass.getSubItemClassIds(this,itemclsids));
+        itemclsids.add(0l);
         if (itemids .equals("()")) {
             rows = dbConnect.runSqlQuery("select t2.sa_orderid,SUM(if(t1.isclose,t1.amount,t1.price*(t1.qty-t1.undeliqty))) amount from sa_orderitems t1 \n" +
                     "inner join sa_order t2 on  t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
                     "inner join plm_item t3 on  t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
-                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" )  and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"' group by t2.sa_orderid ");
+                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" )  and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"' group by t2.sa_orderid ");
 
         } else {
             rows = dbConnect.runSqlQuery("select t2.sa_orderid,SUM(if(t1.isclose,t1.amount,t1.price*(t1.qty-t1.undeliqty))) amount from sa_orderitems t1 \n" +
                     "inner join sa_order t2 on  t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
                     "inner join plm_item t3 on  t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
-                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid not in" + itemids + " and  t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" )  and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"' group by t2.sa_orderid");
+                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid not in" + itemids + " and  t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" )  and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"' group by t2.sa_orderid");
 
 
         }
@@ -536,17 +540,19 @@ public class rebateaccounthead extends Controller {
     public String QuerySaorderDetailId(String begindate, String enddate, long sys_enterpriseid, ArrayList<Long> itemclsids,String agentitemclsnums,
                                        String itemids) throws YosException {
         Rows rows = null;
+        itemclsids.addAll(ItemClass.getSubItemClassIds(this,itemclsids));
+        itemclsids.add(0l);
         if (itemids .equals("()")) {
             rows = dbConnect.runSqlQuery("select t1.sa_orderitemsid  from sa_orderitems t1 \n" +
                     "inner join sa_order t2 on  t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
                     "inner join plm_item t3 on  t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
-                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" )  and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
+                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" + itemclsids.toString().replace("[", "(").replace("]", ")")+" )  and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
 
         } else {
             rows = dbConnect.runSqlQuery("select t1.sa_orderitemsid from sa_orderitems t1 \n" +
                     "inner join sa_order t2 on  t1.sa_orderid=t2.sa_orderid and t1.siteid=t2.siteid\n" +
                     "inner join plm_item t3 on  t1.itemid=t3.itemid and t1.siteid=t3.siteid where '"+begindate+"'<=DATE_FORMAT(t2.closedate, '%Y-%m-%d') and '"+enddate+"'>=DATE_FORMAT(t2.closedate, '%Y-%m-%d') " +
-                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid not in" + itemids + " and  t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" +ItemClass.getSubItemClassIds(this,itemclsids).toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
+                    "and t2.type !='促销订单' and t2.sa_accountclassid!=0 and t2.sys_enterpriseid ='"+sys_enterpriseid+"'  and t2.status in('关闭') and t1.itemid not in" + itemids + " and  t1.itemid in(select itemid from sa_itemsaleclass where itemclassid in" +itemclsids.toString().replace("[", "(").replace("]", ")")+" ) and t1.DECORATIONREBATEFLAG=0 and t1.siteid='"+siteid+"'");
 
 
         }