admin пре 1 месец
родитељ
комит
7a2d1a8c25
1 измењених фајлова са 22 додато и 18 уклоњено
  1. 22 18
      src/custom/restcontroller/webmanage/sale/order/OrderItemsHelper.java

+ 22 - 18
src/custom/restcontroller/webmanage/sale/order/OrderItemsHelper.java

@@ -103,7 +103,7 @@ public class OrderItemsHelper extends BaseClass {
 
 
         Rows rebatecategorys = dbConnect.runSqlQuery("select itemclassid from sa_rebatecategory where siteid='" + controller.siteid + "' and sa_rebateschemeid=" + sa_rebateschemeid);
         Rows rebatecategorys = dbConnect.runSqlQuery("select itemclassid from sa_rebatecategory where siteid='" + controller.siteid + "' and sa_rebateschemeid=" + sa_rebateschemeid);
         Rows rebateunproducts = dbConnect.runSqlQuery("select itemid from sa_rebateunproducts where siteid='" + controller.siteid + "' and sa_rebateschemeid=" + sa_rebateschemeid);
         Rows rebateunproducts = dbConnect.runSqlQuery("select itemid from sa_rebateunproducts where siteid='" + controller.siteid + "' and sa_rebateschemeid=" + sa_rebateschemeid);
-        Rows rebateunjoinproducts = dbConnect.runSqlQuery("select * from sa_rebateunjoinproducts where siteid='" +  controller.siteid + "' and sa_rebateschemeid=" + sa_rebateschemeid);
+        Rows rebateunjoinproducts = dbConnect.runSqlQuery("select * from sa_rebateunjoinproducts where siteid='" + controller.siteid + "' and sa_rebateschemeid=" + sa_rebateschemeid);
 
 
         ArrayList<Long> itemclsids = rebatecategorys.toArrayList("itemclassid", new ArrayList<Long>());
         ArrayList<Long> itemclsids = rebatecategorys.toArrayList("itemclassid", new ArrayList<Long>());
 
 
@@ -112,9 +112,9 @@ public class OrderItemsHelper extends BaseClass {
         ArrayList<Long> itemids = rebateunproducts.toArrayList("itemid", new ArrayList<Long>());
         ArrayList<Long> itemids = rebateunproducts.toArrayList("itemid", new ArrayList<Long>());
         itemids.add(0l);
         itemids.add(0l);
         ArrayList<Long> joinitemids = rebateunjoinproducts.toArrayList("itemid", new ArrayList<Long>());
         ArrayList<Long> joinitemids = rebateunjoinproducts.toArrayList("itemid", new ArrayList<Long>());
-        String where =" 1=1 ";
-        if(!joinitemids.isEmpty()){
-            where=where+" and t1.itemid in"+joinitemids;
+        String where = " 1=1 ";
+        if (!joinitemids.isEmpty()) {
+            where = where + " and t1.itemid in" + joinitemids;
         }
         }
         SQLFactory sqlFactory = new SQLFactory(controller, "查询返利数据");
         SQLFactory sqlFactory = new SQLFactory(controller, "查询返利数据");
         sqlFactory.addParameter("sa_orderid", sa_orderid);
         sqlFactory.addParameter("sa_orderid", sa_orderid);
@@ -307,13 +307,13 @@ public class OrderItemsHelper extends BaseClass {
         sqlFactory.addParameter("siteid", controller.siteid);
         sqlFactory.addParameter("siteid", controller.siteid);
         sqlFactory.addParameter("sa_orderid", sa_orderid);
         sqlFactory.addParameter("sa_orderid", sa_orderid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
-        if(rows.isEmpty()){
+        if (rows.isEmpty()) {
             //清空费用表
             //清空费用表
             DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(controller, "sa_order_cost");
             DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(controller, "sa_order_cost");
             deleteSQL.setWhere("sa_orderid", sa_orderid);
             deleteSQL.setWhere("sa_orderid", sa_orderid);
             deleteSQL.delete();
             deleteSQL.delete();
         }
         }
-        if(rows.isNotEmpty()){
+        if (rows.isNotEmpty()) {
             DataFunction df = DataFunction.get(controller, rows.get(0).getString("functionname"));
             DataFunction df = DataFunction.get(controller, rows.get(0).getString("functionname"));
             df.addParameter("sa_orderid", sa_orderid);
             df.addParameter("sa_orderid", sa_orderid);
             df.action();
             df.action();
@@ -386,9 +386,9 @@ public class OrderItemsHelper extends BaseClass {
             }
             }
         }
         }
         RowsMap pRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
         RowsMap pRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
-        long sa_promotionid =0;
-        if(promotionitems.isNotEmpty()){
-             sa_promotionid = promotionitems.get(0).getLong("sa_promotionid");
+        long sa_promotionid = 0;
+        if (promotionitems.isNotEmpty()) {
+            sa_promotionid = promotionitems.get(0).getLong("sa_promotionid");
         }
         }
         if (type.equals("促销订单")) {
         if (type.equals("促销订单")) {
             if (pRowsMap.containsKey(item.getString("sa_promotion_itemsid"))) {
             if (pRowsMap.containsKey(item.getString("sa_promotion_itemsid"))) {
@@ -399,9 +399,9 @@ public class OrderItemsHelper extends BaseClass {
                     BigDecimal orderaddqty = pRowsMap.get(saPromotionItemsid).get(0).getBigDecimal("orderaddqty");
                     BigDecimal orderaddqty = pRowsMap.get(saPromotionItemsid).get(0).getBigDecimal("orderaddqty");
                     BigDecimal orderminqty = pRowsMap.get(saPromotionItemsid).get(0).getBigDecimal("orderminqty");
                     BigDecimal orderminqty = pRowsMap.get(saPromotionItemsid).get(0).getBigDecimal("orderminqty");
                     boolean islimit = pRowsMap.get(saPromotionItemsid).get(0).getBoolean("islimit");
                     boolean islimit = pRowsMap.get(saPromotionItemsid).get(0).getBoolean("islimit");
-                    Rows rows =dbConnect.runSqlQuery("select * from sa_promotion where sa_promotionid="+sa_promotionid);
-                    if(rows.isNotEmpty()){
-                        if(!rows.get(0).getString("type").equals("套餐活动")){
+                    Rows rows = dbConnect.runSqlQuery("select * from sa_promotion where sa_promotionid=" + sa_promotionid);
+                    if (rows.isNotEmpty()) {
+                        if (!rows.get(0).getString("type").equals("套餐活动")) {
                             if (orderaddqty.compareTo(BigDecimal.ZERO) != 0) {
                             if (orderaddqty.compareTo(BigDecimal.ZERO) != 0) {
                                 if (((qty.subtract(orderminqty)).remainder(orderaddqty)).compareTo(BigDecimal.ZERO) != 0 || qty.compareTo(orderminqty) < 0) {
                                 if (((qty.subtract(orderminqty)).remainder(orderaddqty)).compareTo(BigDecimal.ZERO) != 0 || qty.compareTo(orderminqty) < 0) {
                                     throw new YosException(false, "品号为" + itemRowsMap.get(itemid).get(0).getString("itemno") + "的商品数量不符合该商品的起订量和增量");
                                     throw new YosException(false, "品号为" + itemRowsMap.get(itemid).get(0).getString("itemno") + "的商品数量不符合该商品的起订量和增量");
@@ -506,8 +506,8 @@ public class OrderItemsHelper extends BaseClass {
 
 
         if (!length.equals("0") && !width.equals("0")) {
         if (!length.equals("0") && !width.equals("0")) {
             String size = "尺寸:" + length + "×" + width;
             String size = "尺寸:" + length + "×" + width;
-            if(!height.equals("0")){
-                size=size+"×"+height;
+            if (!height.equals("0")) {
+                size = size + "×" + height;
             }
             }
             if (str.isEmpty()) {
             if (str.isEmpty()) {
                 str = size;
                 str = size;
@@ -539,6 +539,10 @@ public class OrderItemsHelper extends BaseClass {
                     spec = itemRowsMap.get(itemid).get(0).getString("spec");
                     spec = itemRowsMap.get(itemid).get(0).getString("spec");
                 } else {
                 } else {
                     spec = item.getStringValue("length") + "*" + item.getStringValue("width");
                     spec = item.getStringValue("length") + "*" + item.getStringValue("width");
+                    if (!item.getStringValue("height").isEmpty()) {
+                        spec = spec + "*" + item.getStringValue("height");
+                    }
+
                 }
                 }
 
 
             }
             }
@@ -591,7 +595,7 @@ public class OrderItemsHelper extends BaseClass {
 
 
     public InsertSQL getInsertSQL(JSONArray customproperties, long sa_orderitemsid, JSONObject item, Row itemRow, String type,
     public InsertSQL getInsertSQL(JSONArray customproperties, long sa_orderitemsid, JSONObject item, Row itemRow, String type,
                                   BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice, BigDecimal marketprice,
                                   BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice, BigDecimal marketprice,
-                                  String spec, Rows promotionitems,long width,long length) throws YosException {
+                                  String spec, Rows promotionitems, long width, long length) throws YosException {
         Long itemid = item.getLong("itemid");
         Long itemid = item.getLong("itemid");
         BigDecimal qty = item.getBigDecimalValue("qty");
         BigDecimal qty = item.getBigDecimalValue("qty");
         RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
         RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
@@ -687,7 +691,7 @@ public class OrderItemsHelper extends BaseClass {
         return insertSQL;
         return insertSQL;
     }
     }
 
 
-    public UpdateSQL getUpdateSQL(long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice,long width,long length) throws YosException {
+    public UpdateSQL getUpdateSQL(long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice, long width, long length) throws YosException {
         BigDecimal qty = item.getBigDecimalValue("qty");
         BigDecimal qty = item.getBigDecimalValue("qty");
 
 
         UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_orderitems);
         UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_orderitems);
@@ -771,7 +775,7 @@ public class OrderItemsHelper extends BaseClass {
         BigDecimal price;
         BigDecimal price;
         switch (type) {
         switch (type) {
             case "促销订单":
             case "促销订单":
-                price = itemPrice.getPromotionPrice(sa_promotionid,item.getLong("sa_promotion_itemsid"));
+                price = itemPrice.getPromotionPrice(sa_promotionid, item.getLong("sa_promotion_itemsid"));
                 if (itemRowsMap.containsKey(item.getString("itemid"))) {
                 if (itemRowsMap.containsKey(item.getString("itemid"))) {
                     if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
                     if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
                         if (itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize") && itemRowsMap.get(item.getString("itemid")).get(0).getLong("pricingmetod") == 1) {
                         if (itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize") && itemRowsMap.get(item.getString("itemid")).get(0).getLong("pricingmetod") == 1) {
@@ -796,7 +800,7 @@ public class OrderItemsHelper extends BaseClass {
         return price;
         return price;
     }
     }
 
 
-    public BigDecimal getSalePrice(Row orderRow, ItemPrice itemPrice,JSONObject item,RowsMap itemRowsMap) throws YosException {
+    public BigDecimal getSalePrice(Row orderRow, ItemPrice itemPrice, JSONObject item, RowsMap itemRowsMap) throws YosException {
         BigDecimal price = itemPrice.getGraderateprice();
         BigDecimal price = itemPrice.getGraderateprice();
         if (itemRowsMap.containsKey(item.getString("itemid"))) {
         if (itemRowsMap.containsKey(item.getString("itemid"))) {
             if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
             if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {