Преглед изворни кода

订单详情返回套餐明细及订单明细查询增加参数仅查询数据(不对接erp)

hu пре 1 година
родитељ
комит
aa68d20f11

+ 3 - 1
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -650,7 +650,9 @@ public class Order extends Controller {
         row.replace("amount", row.getBigDecimal("amount").add(costamount));
         row.replace("defaultamount", row.getBigDecimal("defaultamount").add(costamount));
 
-
+        //订单套餐
+        Rows packagetypemxrows =dbConnect.runSqlQuery("select t2.packagetypemx,min(t1.qty/t2.orderminqty) packagetypeqty from sa_orderitems t1 inner join sa_promotion_items t2 on t1.sa_promotion_itemsid=t2.sa_promotion_itemsid and t1.siteid=t2.siteid where t1.siteid='"+siteid+"' and  t1.sa_orderid="+sa_orderid+" group by t2.packagetypemx");
+        row.put("packagetypemxrows",packagetypemxrows);
         return getSucReturnObject().setData(row).toString();
     }
 

+ 38 - 35
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -690,44 +690,46 @@ public class OrderItems extends Controller {
         RowsMap itempriceRowsMap = itempriceRows.toRowsMap("itemno");
 
         JSONArray jsonArray = new JSONArray();
-        if (siteid.equalsIgnoreCase("lsa")) {
-            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:8089/BYESB/jaxrs/webclientrest");
-            if (isJSONArray(result)) {
-                jsonArray = JSONArray.parseArray(result);
-            }
-            for (Object obj : jsonArray) {
-                JSONObject jsonObject = (JSONObject) obj;
-                if (rowsMap.containsKey(jsonObject.getString("fitemno"))) {
-                    if (rowsMap.get(jsonObject.getString("fitemno")).isNotEmpty()) {
-                        rowsMap.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("FQty"));
-                    }
+        if(content.getLongValue("onlyquery")==0){
+            if (siteid.equalsIgnoreCase("lsa")) {
+                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:8089/BYESB/jaxrs/webclientrest");
+                if (isJSONArray(result)) {
+                    jsonArray = JSONArray.parseArray(result);
                 }
-            }
-        } else {
-            ERPDocking erpDocking = new ERPDocking(siteid);
-            if (rows.toJsonArray("itemno").size() != 0) {
-                if (Parameter.get("system.ccerp_dockswitch").equalsIgnoreCase("true")) {
-                    jsonArray = erpDocking.getErpIcinvbalRows(1000, 1, rows.toJsonArray("itemno"));
-                }
-            }
-            if (!jsonArray.isEmpty()) {
-                for (Object object : jsonArray) {
-                    JSONObject jsonObject = (JSONObject) object;
+                for (Object obj : jsonArray) {
+                    JSONObject jsonObject = (JSONObject) obj;
                     if (rowsMap.containsKey(jsonObject.getString("fitemno"))) {
                         if (rowsMap.get(jsonObject.getString("fitemno")).isNotEmpty()) {
-                            for (Row row : rowsMap.get(jsonObject.getString("fitemno"))
-                            ) {
-                                row.put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
+                            rowsMap.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("FQty"));
+                        }
+                    }
+                }
+            } else {
+                ERPDocking erpDocking = new ERPDocking(siteid);
+                if (rows.toJsonArray("itemno").size() != 0) {
+                    if (Parameter.get("system.ccerp_dockswitch").equalsIgnoreCase("true")) {
+                        jsonArray = erpDocking.getErpIcinvbalRows(1000, 1, rows.toJsonArray("itemno"));
+                    }
+                }
+                if (!jsonArray.isEmpty()) {
+                    for (Object object : jsonArray) {
+                        JSONObject jsonObject = (JSONObject) object;
+                        if (rowsMap.containsKey(jsonObject.getString("fitemno"))) {
+                            if (rowsMap.get(jsonObject.getString("fitemno")).isNotEmpty()) {
+                                for (Row row : rowsMap.get(jsonObject.getString("fitemno"))
+                                ) {
+                                    row.put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
+                                }
                             }
                         }
                     }
@@ -736,6 +738,7 @@ public class OrderItems extends Controller {
         }
 
 
+
         //查询附件
         RowsMap attinfoRowsMap = getAttachmentUrl("plm_item", ids);
         for (Row row : rows) {