Browse Source

新增订单商品明细长宽

eganwu 1 year ago
parent
commit
e44eda14e3

+ 2 - 2
src/custom/restcontroller/webmanage/sale/dispatch/SQL/发货单明细列表查询.sql

@@ -21,8 +21,8 @@ SELECT t1.sa_dispatch_itemsid,
        t2.grossweight,
        t2.weight,
        t2.height,
-       t2.width,
-       t2.length,
+       t5.width,
+       t5.length,
        t2.k3outcode,
        t3.unitname,
        t5.price,

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

@@ -87,6 +87,15 @@ public class OrderItems extends Controller {
 
             //商品信息
             Row itemRow = getItemRow(itemid);
+            long width = itemRow.getLong("width");
+            long length = itemRow.getLong("length");
+            if (item.containsKey("width")) {
+                width = Long.parseLong(item.getString("width"));
+            }
+            if (item.containsKey("length")) {
+                length = Long.parseLong(item.getString("length"));
+            }
+
 
             if (sa_promotionid > 0 && dbConnect.runSqlQuery("SELECT 1 from sa_promotion_items WHERE  islimit=1 and groupqty <= saledqty  and  itemid=" + itemid + " and siteid='" + siteid + "' and sa_promotionid='" + sa_promotionid + "'").isNotEmpty()) {
                 return getErrReturnObject().setErrMsg("商品【" + itemRow.getString("itemno") + "】已售罄,不能添加。").toString();
@@ -158,9 +167,9 @@ public class OrderItems extends Controller {
                 return getErrReturnObject().setErrMsg("价格不可小于0").toString();
             }
             if (isInsert) {
-                sqlList.add(orderItemsHelper.getInsertSQL(customproperties, sa_orderitemsid, item, itemRow, type, defaultprice, price, saleprice, itemPrice.getMarketprice(), spec, promotionitems).getSQL());
+                sqlList.add(orderItemsHelper.getInsertSQL(customproperties, sa_orderitemsid, item, itemRow, type, defaultprice, price, saleprice, itemPrice.getMarketprice(), spec, promotionitems, width, length).getSQL());
             } else {
-                sqlList.add(orderItemsHelper.getUpdateSQL(sa_orderitemsid, item, itemRow, type, defaultprice, price, saleprice).getSQL());
+                sqlList.add(orderItemsHelper.getUpdateSQL(sa_orderitemsid, item, itemRow, type, defaultprice, price, saleprice, width, length).getSQL());
             }
 
 

+ 12 - 2
src/custom/restcontroller/webmanage/sale/order/OrderItemsHelper.java

@@ -567,7 +567,9 @@ public class OrderItemsHelper extends BaseClass {
 
     String sa_orderitems = "sa_orderitems";
 
-    public InsertSQL getInsertSQL(JSONArray customproperties, long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice, BigDecimal marketprice, String spec, Rows promotionitems) throws YosException {
+    public InsertSQL getInsertSQL(JSONArray customproperties, long sa_orderitemsid, JSONObject item, Row itemRow, String type,
+                                  BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice, BigDecimal marketprice,
+                                  String spec, Rows promotionitems,long width,long length) throws YosException {
         Long itemid = item.getLong("itemid");
         BigDecimal qty = item.getBigDecimalValue("qty");
         RowsMap promotionitemsRowsMap = promotionitems.toRowsMap("sa_promotion_itemsid");
@@ -656,10 +658,14 @@ public class OrderItemsHelper extends BaseClass {
         //牌价、市场价(元),标准订单牌价取商品价格,项目订单取合同里的牌价
         insertSQL.setValue("marketprice", marketprice);
 
+        insertSQL.setValue("length", width);
+
+        insertSQL.setValue("length", length);
+
         return insertSQL;
     }
 
-    public UpdateSQL getUpdateSQL(long sa_orderitemsid, JSONObject item, Row itemRow, String type, BigDecimal defaultprice, BigDecimal price, BigDecimal saleprice) 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");
 
         UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, sa_orderitems);
@@ -722,6 +728,10 @@ public class OrderItemsHelper extends BaseClass {
         updateSQL.setValue("defaultamount", defaultprice.multiply(qty));
         updateSQL.setValue("saleprice", saleprice);
 
+        updateSQL.setValue("width", width);
+
+        updateSQL.setValue("length", length);
+
         updateSQL.setWhere("siteid", controller.siteid);
         updateSQL.setWhere("sa_orderitemsid", sa_orderitemsid);
 

+ 2 - 0
src/custom/restcontroller/webmanage/sale/order/SQL/查询商品信息.sql

@@ -9,6 +9,8 @@ SELECT t1.itemid,
        t1.orderaddqty_auxunit,
        t1.orderaddqty,
        t1.iscustomsize,
+       t1.width,
+       t1.length,
        ifnull(t1.delivery,0) delivery,
        (SELECT unitname FROM plm_unit WHERE unitid = t1.unitid and siteid = t1.siteid)    unit,
        (SELECT unitname FROM plm_unit WHERE unitid = t2.auxunitid and siteid = t1.siteid) auxunit,