Explorar el Código

定制商品订单下单

hu hace 2 años
padre
commit
5307fe5d20

+ 4 - 0
src/custom/restcontroller/sale/item/SQL/查询商品列表.sql

@@ -17,6 +17,10 @@ SELECT t1.itemid,
        t1.color,
        t1.cheek,
        t1.delistingstatus,
+       t1.iscustomsize,
+       t1.widthschemeid,
+       t1.lengthschemeid,
+       t1.sa_customschemeid,
        t8.caliber,
        t8.pressure,
        t8.material,

+ 2 - 0
src/custom/restcontroller/sale/shoppingcart/SQL/购物车列表.sql

@@ -6,6 +6,8 @@ SELECT t1.sa_shoppingcartid,
        t1.tradefield tradefield_shoppingcart,
        t2.brandname,
        t1.qty,
+       t1.length,
+       t1.width,
        t3.model,
        t3.spec,
        t3.orderminqty,

+ 2 - 2
src/custom/restcontroller/sale/shoppingcart/SQL/购物车新增.sql

@@ -1,4 +1,4 @@
 insert into sa_shoppingcart (siteid, sa_shoppingcartid, createuserid, createby, createdate, changeby, changedate,
-                             sa_brandid, itemid, qty, itemno, sys_enterpriseid,tradefield)
+                             sa_brandid, itemid, qty, itemno, sys_enterpriseid,tradefield,length,width)
 values ($siteid$, $sa_shoppingcartid$, $userid$, $username$, current_time, $username$, current_time, $sa_brandid$,
-        $itemid$, $qty$, $itemno$, $sys_enterpriseid$,$tradefield$);
+        $itemid$, $qty$, $itemno$, $sys_enterpriseid$,$tradefield$,$length$,$width$);

+ 3 - 1
src/custom/restcontroller/sale/shoppingcart/SQL/购物车更新.sql

@@ -2,6 +2,8 @@ UPDATE sa_shoppingcart
 SET changeby=$username$,
     changedate = current_time,
     qty = qty + $qty$,
-    tradefield = $tradefield$
+    tradefield = $tradefield$,
+    length =$length$,
+    width=$width$
 WHERE sa_shoppingcartid = $sa_shoppingcartid$
   and siteid = $siteid$

+ 2 - 0
src/custom/restcontroller/sale/shoppingcart/SQL/购物车详情.sql

@@ -2,6 +2,8 @@ SELECT t1.sa_shoppingcartid,
        t1.sa_brandid,
        t1.itemid,
        t1.qty,
+       t1.length,
+       t1.width,
        t1.itemno,
        t1.tradefield,
        t2.brandname,

+ 4 - 0
src/custom/restcontroller/sale/shoppingcart/ShoppingCart.java

@@ -36,6 +36,8 @@ public class ShoppingCart extends Controller {
         Long sa_brandid = content.getLongValue("sa_brandid");
         Long itemid = content.getLong("itemid");
         BigDecimal qty = content.getBigDecimal("qty");
+        BigDecimal length = content.getBigDecimal("length");
+        BigDecimal width = content.getBigDecimal("width");
         String itemno = content.getString("itemno");
         String tradefield = content.getStringValue("tradefield");
         SQLFactory sqlFactory = new SQLFactory(this, "购物车新增");
@@ -65,6 +67,8 @@ public class ShoppingCart extends Controller {
         sqlFactory.addParameter("username", username);
         sqlFactory.addParameter("userid", userid);
         sqlFactory.addParameter("itemno", itemno);
+        sqlFactory.addParameter("length", length);
+        sqlFactory.addParameter("width", width);
         sqlFactory.addParameter("tradefield", tradefield);
         sqlFactory.addParameter("sa_shoppingcartid", sa_shoppingcartid);
         sqlFactory.addParameter("sa_brandid", sa_brandid);

+ 42 - 2
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -72,7 +72,7 @@ public class OrderItems extends Controller {
         //查询erp库存
 //        Invbal.selectErpInvbal(this, items);
 
-        Rows itemRows = dbConnect.runSqlQuery("select itemid,orderaddqty,orderminqty,itemno from plm_item where siteid='" + siteid + "'");
+        Rows itemRows = dbConnect.runSqlQuery("select t1.*,t2.material from plm_item t1 left join plm_itemextend t2 ON t2.itemid = t1.itemid AND t2.siteid = t1.siteid where t1.siteid='" + siteid + "'");
         RowsMap itemRowsMap = itemRows.toRowsMap("itemid");
         BigDecimal sumqty = BigDecimal.ZERO;
         for (Object obj : items) {
@@ -89,7 +89,6 @@ public class OrderItems extends Controller {
                         if (((qty.subtract(orderminqty)).remainder(orderaddqty)).compareTo(BigDecimal.ZERO) != 0) {
                             return getErrReturnObject().setErrMsg("品号为" + itemRowsMap.get(item.getString("itemid")).get(0).getString("itemno") + "的商品数量不符合该商品的起订量和增量").toString();
                         }
-
                     }
                 }
             }
@@ -138,6 +137,36 @@ public class OrderItems extends Controller {
             } else {
                 sqlFactory = new SQLFactory(this, "订单商品明细_更新");
             }
+            Rows customschemeRows= dbConnect.runSqlQuery("select * from sa_customscheme_items where siteid='"+siteid+"'");
+            RowsMap customschemeRowsMap= customschemeRows.toRowsMap("sa_customschemeid");
+            String customproperties="";
+            if (itemRowsMap.containsKey(item.getString("itemid"))) {
+                if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
+                    if(itemRowsMap.get(item.getString("itemid")).get(0).getLong("sa_customschemeid")>0 && !itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize")){
+                        if(customschemeRowsMap.containsKey(itemRowsMap.get(item.getString("itemid")).get(0).getString("sa_customschemeid"))){
+                            for (Row customschemeItem:(customschemeRowsMap.get(itemRowsMap.get(item.getString("itemid")).get(0).getString("sa_customschemeid")))) {
+                                customproperties=customproperties+customschemeItem.getString("description")+":"+itemRowsMap.get(item.getString("itemid")).get(0).getString(customschemeItem.getString("value"))+",";
+                            }
+                        }
+                    }
+                    if(itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize")){
+                        if(customschemeRowsMap.containsKey(itemRowsMap.get(item.getString("itemid")).get(0).getString("sa_customschemeid"))){
+                            for (Row customschemeItem:(customschemeRowsMap.get(itemRowsMap.get(item.getString("itemid")).get(0).getString("sa_customschemeid")))) {
+                                if(!customschemeItem.getString("description").equals("spec")){
+                                    customproperties=customproperties+customschemeItem.getString("description")+":"+itemRowsMap.get(item.getString("itemid")).get(0).getString(customschemeItem.getString("value"))+",";
+                                }else{
+                                    customproperties=customproperties+",尺寸:"+item.getString("length")+"*"+item.getString("width");
+                                }
+
+                            }
+                        }
+
+                    }
+
+                }
+
+            }
+            sqlFactory.addParameter("customproperties", customproperties);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("userid", userid);
             sqlFactory.addParameter("username", username);
@@ -199,6 +228,17 @@ public class OrderItems extends Controller {
                     default:
                         defaultprice = itemPrice.getGraderateprice();
                         price = itemPrice.getGraderateprice();
+                        if (itemRowsMap.containsKey(item.getString("itemid"))) {
+                            if (itemRowsMap.get(item.getString("itemid")).isNotEmpty()) {
+                                if(itemRowsMap.get(item.getString("itemid")).get(0).getBoolean("iscustomsize")){
+                                     System.out.println(price);
+                                     price=price.multiply(item.getBigDecimal("length").multiply(item.getBigDecimal("width")).divide(new BigDecimal("1000000"),4,BigDecimal.ROUND_HALF_UP));
+                                     System.out.println(price);
+                                }
+
+                            }
+
+                        }
                 }
             } else {
                 price = item.getBigDecimalValue("price");

+ 4 - 0
src/custom/restcontroller/webmanage/sale/order/SQL/查询可添加商品列表.sql

@@ -12,6 +12,10 @@ SELECT t1.itemid,
        t1.delistingstatus,
        t1.marketprice,
        t1.packageqty,
+       t1.iscustomsize,
+       t1.widthschemeid,
+       t1.lengthschemeid,
+       t1.sa_customschemeid,
        t4.unitname unit,
        t5.unitname auxunit,
        t2.conversionrate,

+ 4 - 0
src/custom/restcontroller/webmanage/sale/order/SQL/查询可添加商品列表_总部订单.sql

@@ -10,6 +10,10 @@ SELECT t1.itemid,
        t1.spec,
        t1.standards,
        t1.marketprice,
+       t1.iscustomsize,
+       t1.widthschemeid,
+       t1.lengthschemeid,
+       t1.sa_customschemeid,
        t4.unitname unit,
        t5.unitname auxunit,
        t2.conversionrate,

+ 4 - 0
src/custom/restcontroller/webmanage/sale/order/SQL/查询可添加商品列表_特殊订单.sql

@@ -12,6 +12,10 @@ SELECT t1.itemid,
        t1.delistingstatus,
        t1.marketprice,
        t1.packageqty,
+       t1.iscustomsize,
+       t1.widthschemeid,
+       t1.lengthschemeid,
+       t1.sa_customschemeid,
        t4.unitname unit,
        t5.unitname auxunit,
        t2.conversionrate,

+ 1 - 0
src/custom/restcontroller/webmanage/sale/order/SQL/订单商品明细_列表.sql

@@ -25,6 +25,7 @@ SELECT t1.sa_orderitemsid,
        ifnull(t1.deliverydate, '')    deliverydate,
        t1.returnqty,
        t1.remarks,
+       t1.customproperties,
        t1.stockno,
        t1.position,
        t1.batchno,

+ 1 - 0
src/custom/restcontroller/webmanage/sale/order/SQL/订单商品明细_所有列表.sql

@@ -16,6 +16,7 @@ SELECT t1.sa_orderitemsid,
        t1.price,
        t1.amount,
        t1.remarks,
+       t1.customproperties,
        t1.batchcontrol,
        t1.model,
        t1.conversionrate,

+ 2 - 2
src/custom/restcontroller/webmanage/sale/order/SQL/订单商品明细_新增.sql

@@ -2,8 +2,8 @@ insert into sa_orderitems (sa_orderitemsid, siteid, createby, createdate, change
                            createuserid, itemid, rowno, batchcontrol, itemno, itemname, model, unit, auxunit,
                            isclose, conversionrate, price, amount, marketprice,
                            defaultprice, defaultamount, qty, auxqty, undeliqty, sa_orderid, remarks, stockno, position,
-                           batchno)
+                           batchno,customproperties)
 values ($sa_orderitemsid$, $siteid$, $username$, current_time, $userid$, $username$, current_time, $userid$, $itemid$,
         $rowno$, $batchcontrol$, $itemno$, $itemname$, $model$, $unit$, $auxunit$, 0, $conversionrate$, $price$,
         $amount$, $marketprice$, $defaultprice$, $defaultamount$, $qty$, $auxqty$, $qty$, $sa_orderid$, $remarks$,
-        $stockno$, $position$, $batchno$);
+        $stockno$, $position$, $batchno$,$customproperties$);

+ 9 - 0
src/custom/restcontroller/webmanage/sale/sizecustomizedscheme/sizecustomizedscheme.java

@@ -91,7 +91,16 @@ public class sizecustomizedscheme extends Controller {
         SQLFactory sqlFactory = new SQLFactory(this, "尺寸定制方案详情查询");
         sqlFactory.addParameter("sa_sizecustomizedschemeid", sa_sizecustomizedschemeid);
         sqlFactory.addParameter("siteid", siteid);
+
+
+        SQLFactory sqlFactorydetail = new SQLFactory(this, "尺寸定制方案明细列表查询");
+        sqlFactorydetail.addParameter("sa_sizecustomizedschemeid", sa_sizecustomizedschemeid);
+        sqlFactorydetail.addParameter("siteid", siteid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
+        Rows rowsdetail = dbConnect.runSqlQuery(sqlFactorydetail);
+        if(rows.isNotEmpty()){
+            rows.get(0).put("rowsdetail",rowsdetail);
+        }
         Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
 
         return getSucReturnObject().setData(row).toString();