Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/develop' into develop

沈静伟 2 gadi atpakaļ
vecāks
revīzija
18816778ea

+ 9 - 1
src/custom/restcontroller/webmanage/sale/itemgroup/itemgroup.java

@@ -16,6 +16,7 @@ import common.data.Row;
 import common.data.Rows;
 import common.data.RowsMap;
 import common.data.SQLFactory;
+import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
 
 import java.util.ArrayList;
@@ -237,17 +238,24 @@ public class itemgroup extends Controller {
 //        SQLFactory sqlFactoryquery = new SQLFactory(this, "商品组状态查询");
 //        sqlFactoryquery.addParameter("siteid", siteid);
 //        sqlFactoryquery.addParameter_in("sa_itemgroupids", stringArray);
-        String whereSql = "select isonsale,groupname,sa_itemgroupid from sa_itemgroup where sa_itemgroupid in " + list + " and  siteid='" + siteid + "'";
+        String whereSql = "select isonsale,groupname,sa_itemgroupid,itemno from sa_itemgroup where sa_itemgroupid in " + list + " and  siteid='" + siteid + "'";
         whereSql = whereSql.replace("[", "(").replace("]", ")");
         Rows rows = dbConnect.runSqlQuery(whereSql);
         for (Row row : rows) {
             if (row.getBoolean("isonsale")) {
                 return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组已上架,无法再次上架").toString();
             }
+            if (StringUtils.isBlank(row.getString("itemno"))) {
+                return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组不存在默认商品,无法再次上架").toString();
+            }
             Rows rowscount = dbConnect.runSqlQuery("select distinct ifnull(t2.sa_customschemeid,0) sa_customschemeid from sa_itemgroupmx t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.siteid='"+siteid+"' and t1.sa_itemgroupid="+row.getLong("sa_itemgroupid"));
             if(rowscount.size()>1){
                 return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组存在两个以上方案的商品,无法上架").toString();
             }
+            Rows rowsdetailcount = dbConnect.runSqlQuery("select * from sa_itemgroupmx t1 where t1.sa_itemgroupid="+row.getLong("sa_itemgroupid"));
+            if(rowsdetailcount.size()==0){
+                return getErrReturnObject().setErrMsg("【" + row.getString("groupname") + "】商品组下没有商品,无法上架").toString();
+            }
 
         }
 

+ 19 - 13
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -29,6 +29,7 @@ import restcontroller.webmanage.sale.rebate.Rebate;
 import restcontroller.webmanage.sale.toolbill.ToolBilItem;
 import restcontroller.webmanage.sale.toolbill.ToolBill;
 import utility.ERPDocking;
+import utility.tools.WebRequest;
 
 import java.io.IOException;
 import java.math.BigDecimal;
@@ -684,21 +685,26 @@ public class OrderItems extends Controller {
         Rows sumUnQtyRows = dbConnect.runSqlQuery(sqlFactory2);
         RowsMap sumUnQtyRowsMap = sumUnQtyRows.toRowsMap("itemno");
 
-        ERPDocking erpDocking = new ERPDocking();
         JSONArray jsonArray = new JSONArray();
-        if (rows.toJsonArray("itemno").size() != 0) {
-            if (Parameter.get("system.ccerp_dockswitch").equalsIgnoreCase("true") && siteid.equalsIgnoreCase("ccyosg")) {
-                jsonArray = erpDocking.getErpIcinvbalRows(200000, 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()) {
-                        rowsMap.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
-                    }
+        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:8092/BYESB/jaxrs/webclientrest");
+        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"));
                 }
             }
         }