浏览代码

尾货促销功能

hu 2 年之前
父节点
当前提交
1930967c14

+ 1 - 0
src/custom/restcontroller/sale/promotion/SQL/促销方案商品查询.sql

@@ -9,6 +9,7 @@ SELECT
 	t1.islimit,
 	t1.isonsale,
 	t1.itemid,
+	t1.signaturecode,
 	t2.itemno,
 	t2.itemname,
 	t2.spec,

+ 16 - 1
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -126,7 +126,7 @@ public class OrderItems extends Controller {
                     }
                 }
             }
-
+            boolean isAdd =true;
             BigDecimal price1 = new BigDecimal(0);
             SQLFactory sqlFactory = new SQLFactory(this, "订单商品明细_新增");
             if (sa_orderitemsid <= 0) {
@@ -142,11 +142,13 @@ public class OrderItems extends Controller {
                         price1 = rows.get(0).getBigDecimal("price");
                         sa_orderitemsid = rows.get(0).getLong("sa_orderitemsid");
                         sqlFactory = new SQLFactory(this, "订单商品明细_更新");
+                        isAdd=false;
                     }
 
                 }
             } else {
                 sqlFactory = new SQLFactory(this, "订单商品明细_更新");
+                isAdd=false;
             }
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("userid", userid);
@@ -156,6 +158,19 @@ public class OrderItems extends Controller {
             sqlFactory.addParameter("rowno", 1);
             sqlFactory.addParameter("itemid", itemid);
             sqlFactory.addParameter("remarks", item.getStringValue("remarks"));
+            String signaturecode="";
+            if (type.equals("促销订单")) {
+                if (promotionitemsRowsMap.containsKey(item.getString("itemid"))) {
+                    if (promotionitemsRowsMap.get(item.getString("itemid")).isNotEmpty()) {
+                        signaturecode = promotionitemsRowsMap.get(item.getString("itemid")).get(0).getString("signaturecode");
+                    }
+                }
+            }
+            if(isAdd){
+                sqlFactory.addParameter("remarks", item.getStringValue("remarks")+signaturecode);
+            }else{
+                sqlFactory.addParameter("remarks", item.getStringValue("remarks"));
+            }
 
             BigDecimal conversionrate = itemRow.getBigDecimal("conversionrate");
             if (conversionrate.compareTo(BigDecimal.ZERO) <= 0) {

+ 17 - 5
src/custom/restcontroller/webmanage/sale/promotion/ExportExcel.java

@@ -113,6 +113,7 @@ public class ExportExcel {
         sheet.setColumnWidth((short) 6, (short) 5500);
         sheet.setColumnWidth((short) 7, (short) 5500);
         sheet.setColumnWidth((short) 8, (short) 5500);
+        sheet.setColumnWidth((short) 9, (short) 5500);
     }
 
 
@@ -132,6 +133,7 @@ public class ExportExcel {
         sheet.setColumnWidth((short) 7, (short) 5500);
         sheet.setColumnWidth((short) 8, (short) 5500);
         sheet.setColumnWidth((short) 9, (short) 5500);
+        sheet.setColumnWidth((short) 10, (short) 5500);
     }
 
     /**
@@ -159,7 +161,7 @@ public class ExportExcel {
         cellStyle2.setWrapText(true);
 
         /*第一行*/
-        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 8));
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 9));
 
         /*第一行塞值*/
         row = sheet.createRow(0);
@@ -167,7 +169,7 @@ public class ExportExcel {
         cell.setCellStyle(cellStyle4);
         cell.setCellValue("促销商品导入");
         /*第二行*/
-        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 8));
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 9));
         /*第二行塞值*/
         row = sheet.createRow(1);
         cell = row.createCell(0);// ID
@@ -212,7 +214,9 @@ public class ExportExcel {
         cell.setCellStyle(cellStyle2);
         cell.setCellValue("价格五活动价");
 
-
+        cell = row.createCell(9);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("特征码");
 
         /*第四行塞值*/
         row = sheet.createRow(3);
@@ -253,6 +257,10 @@ public class ExportExcel {
         cell.setCellStyle(cellStyle3);
         cell.setCellValue("0");
 
+        cell = row.createCell(9);
+        cell.setCellStyle(cellStyle3);
+        cell.setCellValue("特征码");
+
     }
 
 
@@ -281,7 +289,7 @@ public class ExportExcel {
 
 
         /*第一行*/
-        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 9));
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 10));
 
         /*第一行塞值*/
         row = sheet.createRow(0);
@@ -289,7 +297,7 @@ public class ExportExcel {
         cell.setCellStyle(cellStyle3);
         cell.setCellValue("促销商品导入");
         /*第二行*/
-        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 9));
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 10));
         /*第二行塞值*/
         row = sheet.createRow(1);
         cell = row.createCell(0);// ID
@@ -336,6 +344,10 @@ public class ExportExcel {
 
         cell = row.createCell(9);
         cell.setCellStyle(cellStyle2);
+        cell.setCellValue("特征码");
+
+        cell = row.createCell(10);
+        cell.setCellStyle(cellStyle2);
         cell.setCellValue("错误信息");
 
     }

+ 2 - 2
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案商品新增.sql

@@ -1,2 +1,2 @@
-insert into sa_promotion_items (siteid, sa_promotion_itemsid,sa_promotionid,sa_promotion_itemgroupid,groupqty,itemid, orderaddqty,orderminqty,islimit)
-values ($siteid$, $sa_promotion_itemsid$,$sa_promotionid$,$sa_promotion_itemgroupid$, $groupqty$, $itemid$, $orderaddqty$, $orderminqty$, $islimit$);
+insert into sa_promotion_items (siteid, sa_promotion_itemsid,sa_promotionid,sa_promotion_itemgroupid,groupqty,itemid, orderaddqty,orderminqty,islimit,signaturecode)
+values ($siteid$, $sa_promotion_itemsid$,$sa_promotionid$,$sa_promotion_itemgroupid$, $groupqty$, $itemid$, $orderaddqty$, $orderminqty$, $islimit$,$signaturecode$);

+ 2 - 1
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案商品更新.sql

@@ -5,5 +5,6 @@ SET
     orderaddqty= $orderaddqty$,
     orderminqty= $orderminqty$,
     islimit= $islimit$,
-    isonsale= $isonsale$
+    isonsale= $isonsale$,
+    signaturecode=$signaturecode$
 WHERE sa_promotion_itemsid = $sa_promotion_itemsid$ and siteid=$siteid$

+ 1 - 0
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案商品查询.sql

@@ -8,6 +8,7 @@ SELECT t1.sa_promotion_itemsid,
        t1.islimit,
        t1.isonsale,
        t1.itemid,
+       t1.signaturecode,
        t2.itemno,
        t2.itemname,
        t2.spec,

+ 11 - 1
src/custom/restcontroller/webmanage/sale/promotion/promotionItems.java

@@ -152,6 +152,7 @@ public class promotionItems extends Controller {
                     saleFactory.addParameter("orderminqty", 1);
                 }
                 saleFactory.addParameter("islimit", iteminfo.getLong("islimit"));
+                saleFactory.addParameter("signaturecode", iteminfo.getStringValue("signaturecode"));
                 sqlList.add(saleFactory.getSQL());
                 Rows rows = itempricerowsMap.get(iteminfo.getLong("itemid"));
                 if (!rows.isEmpty()) {
@@ -181,6 +182,7 @@ public class promotionItems extends Controller {
                 saleFactory.addParameter("orderminqty", iteminfo.getBigDecimal("orderminqty"));
                 saleFactory.addParameter("islimit", iteminfo.getLong("islimit"));
                 saleFactory.addParameter("isonsale", iteminfo.getBooleanValue("isonsale"));
+                saleFactory.addParameter("signaturecode", iteminfo.getStringValue("signaturecode"));
                 sqlList.add(saleFactory.getSQL());
             }
 
@@ -314,6 +316,7 @@ public class promotionItems extends Controller {
             keys.add("price3");
             keys.add("price4");
             keys.add("price5");
+            keys.add("signaturecode");
 
             int i = 0;
             int a = 0;
@@ -338,6 +341,7 @@ public class promotionItems extends Controller {
                 String price3 = row.getString("price3");
                 String price4 = row.getString("price4");
                 String price5 = row.getString("price5");
+                String signaturecode = row.getString("signaturecode");
                 if (StringUtils.isEmpty(itemno)) {
                     iserr = true;
                     row.put("msg", "产品编码不能为空");
@@ -390,6 +394,8 @@ public class promotionItems extends Controller {
                 row.put("oldprice3", item.getDouble("price3"));
                 row.put("oldprice4", item.getDouble("price4"));
                 row.put("oldprice5", item.getDouble("price5"));
+
+
                 rowssuc.add(row);
             }
             if (iserr) {
@@ -404,6 +410,7 @@ public class promotionItems extends Controller {
                 map.put("price3", "价格三活动价");
                 map.put("price4", "价格四活动价");
                 map.put("price5", "价格五活动价");
+                map.put("signaturecode", "特征码");
                 map.put("msg", "错误信息");
                 ArrayList<String> colNameList = new ArrayList<String>();
                 HashMap<String, Class> keytypemap = new HashMap<String, Class>();
@@ -416,6 +423,7 @@ public class promotionItems extends Controller {
                 colNameList.add("price3");
                 colNameList.add("price4");
                 colNameList.add("price5");
+                colNameList.add("signaturecode");
                 colNameList.add("msg");
                 keytypemap.put("itemno", String.class);
                 keytypemap.put("orderminqty", String.class);
@@ -426,6 +434,7 @@ public class promotionItems extends Controller {
                 keytypemap.put("price3", String.class);
                 keytypemap.put("price4", String.class);
                 keytypemap.put("price5", String.class);
+                keytypemap.put("signaturecode", String.class);
                 keytypemap.put("msg", String.class);
                 rowserr.setFieldList(colNameList);
                 rowserr.setFieldTypeMap(keytypemap);
@@ -453,6 +462,7 @@ public class promotionItems extends Controller {
                     sqlFactory.addParameter("orderaddqty", row.getString("orderaddqty"));
                     sqlFactory.addParameter("orderminqty", row.getString("orderminqty"));
                     sqlFactory.addParameter("islimit", row.getString("islimit"));
+                    sqlFactory.addParameter("signaturecode", row.getString("signaturecode"));
                     sqllist.add(sqlFactory.getSQL());
                     for (int o = 1; o <= 5; o++) {
                         long sa_promotion_itempriceid = sa_promotion_itempriceids[a];
@@ -518,7 +528,7 @@ public class promotionItems extends Controller {
                 } else {
                     datarow.createCell(i1).setCellValue(row.getString((String) keylist.get(i1)));
                 }
-                if (i1 == 9) {
+                if (i1 == 10) {
                     datarow.getCell(i1).setCellStyle(xssfCellStyle1);
                 }
             }