Browse Source

Merge branch 'develop' into develop-green

郭齐峰 1 year ago
parent
commit
dfd699857b

+ 140 - 80
src/custom/restcontroller/webmanage/sale/order/ExportExcel.java

@@ -18,7 +18,7 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
 public class ExportExcel {
-	 /**
+    /**
      * 设置标题单元样式
      *
      * @param workbook
@@ -40,6 +40,7 @@ public class ExportExcel {
         cellStyle.setAlignment(HorizontalAlignment.LEFT); // 居左
         return cellStyle;
     }
+
     /**
      * 设置中文提示信息样式
      *
@@ -62,6 +63,7 @@ public class ExportExcel {
         cellStyle.setAlignment(HorizontalAlignment.LEFT); // 居左
         return cellStyle;
     }
+
     /**
      * 设置中文提示信息样式
      *
@@ -95,42 +97,52 @@ public class ExportExcel {
         XSSFCellStyle cellStyle = workbook.createCellStyle();
         XSSFFont font = workbook.createFont();
         font.setFontHeightInPoints((short) 12);
-		font.setFontName("微软雅黑");// 设置标题字体
-       // font.setFontName(HSSFFont.FONT_ARIAL);// 设置标题字体
+        font.setFontName("微软雅黑");// 设置标题字体
+        // font.setFontName(HSSFFont.FONT_ARIAL);// 设置标题字体
         cellStyle.setFont(font);
         cellStyle = workbook.createCellStyle();
         cellStyle.setAlignment(HorizontalAlignment.LEFT); // 居左
         return cellStyle;
-    } 
-     /**
+    }
+
+    /**
      * 2022-07-14 17:41:39
-               * 设置表格宽度(导入模板)
-     * **/
+     * 设置表格宽度(导入模板)
+     **/
     public static void setBatchDetailSheetColumn1(XSSFSheet sheet) {
         sheet.setDefaultRowHeight((short) 600);
         sheet.setColumnWidth((short) 0, (short) 5500);// 设置 品号 宽度
         sheet.setColumnWidth((short) 1, (short) 5500);// 设置 数量 宽度
+        sheet.setColumnWidth((short) 2, (short) 5500);// 设置 数量 宽度
+        sheet.setColumnWidth((short) 3, (short) 5500);// 设置 数量 宽度
+        sheet.setColumnWidth((short) 4, (short) 5500);// 设置 数量 宽度
+        sheet.setColumnWidth((short) 5, (short) 5500);// 设置 数量 宽度
     }
-    
-    
+
+
     /**
      * 2022-07-14 17:41:39
-              * 设置表格宽度(返回错误Excel的样式)
-     * **/
+     * 设置表格宽度(返回错误Excel的样式)
+     **/
     public static void setBatchDetailSheetColumn2(XSSFSheet sheet) {
         sheet.setDefaultRowHeight((short) 600);
         sheet.setColumnWidth((short) 0, (short) 5500);// 设置 品号 宽度
         sheet.setColumnWidth((short) 1, (short) 5500);// 设置 数量 宽度  
-        sheet.setColumnWidth((short) 2, (short) 5500);// 设置 数量 宽度  
+        sheet.setColumnWidth((short) 2, (short) 5500);// 设置 数量 宽度
+        sheet.setColumnWidth((short) 3, (short) 5500);// 设置 数量 宽度
+        sheet.setColumnWidth((short) 4, (short) 5500);// 设置 数量 宽度
+        sheet.setColumnWidth((short) 5, (short) 5500);// 设置 数量 宽度
+        sheet.setColumnWidth((short) 6, (short) 5500);// 设置 数量 宽度
     }
+
     /**
      * 2022-07-14 17:42:03
      * 设置表头
      * cellStyle1 中文提示信息样式
      * cellStyle2 标题提示信息样式
      * cellStyle3 正文提示信息样式
-     * **/
-    public static void batchDetail(XSSFSheet sheet, XSSFCellStyle cellStyle1, XSSFCellStyle cellStyle2, XSSFCellStyle cellStyle3, XSSFCellStyle cellStyle4,XSSFWorkbook workbook) {
+     **/
+    public static void batchDetail(XSSFSheet sheet, XSSFCellStyle cellStyle1, XSSFCellStyle cellStyle2, XSSFCellStyle cellStyle3, XSSFCellStyle cellStyle4, XSSFWorkbook workbook) {
 //        HSSFCellStyle bcs = ExportExcel.createTitleCellStyle1(workbook);
 //        bcs.setBorderBottom(BorderStyle.THIN); //下边框
 //        bcs.setBorderLeft(BorderStyle.THIN);//左边框
@@ -147,59 +159,91 @@ public class ExportExcel {
         cellStyle1.setBorderTop(BorderStyle.THIN);//上边框
         cellStyle1.setBorderRight(BorderStyle.THIN);//右边框
         cellStyle1.setWrapText(true);
-        
+
         cellStyle2.setBorderBottom(BorderStyle.THIN); //下边框
         cellStyle2.setBorderLeft(BorderStyle.THIN);//左边框
         cellStyle2.setBorderTop(BorderStyle.THIN);//上边框
         cellStyle2.setBorderRight(BorderStyle.THIN);//右边框
         cellStyle2.setWrapText(true);
 
-   	 /*第一行*/
-       sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 1));
-
-       /*第一行塞值*/
-       row = sheet.createRow(0);
-       cell = row.createCell(0);// ID
-       cell.setCellStyle(cellStyle4);
-       cell.setCellValue("订单导入");
-       /*第二行*/
-       sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 1));
-       /*第二行塞值*/
-       row = sheet.createRow(1);
-       cell = row.createCell(0);// ID
-       cell.setCellStyle(cellStyle1);
-       cell.setCellValue("注意:①请按照以下示例填写订单;②订单商品最多不超过5000行;③订单导入前,请记得删除示例行!");
-       /*第三行塞值*/
-       row = sheet.createRow(2);
-
-       cell = row.createCell(0);
-       cell.setCellStyle(cellStyle2);
-       cell.setCellValue(" 商品编号(必填)");
-
-       cell = row.createCell(1);
-       cell.setCellStyle(cellStyle2);
-       cell.setCellValue("数量(必填)");
-       
+        /*第一行*/
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 5));
+
+        /*第一行塞值*/
+        row = sheet.createRow(0);
+        cell = row.createCell(0);// ID
+        cell.setCellStyle(cellStyle4);
+        cell.setCellValue("订单导入");
+        /*第二行*/
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 5));
+        /*第二行塞值*/
+        row = sheet.createRow(1);
+        cell = row.createCell(0);// ID
+        cell.setCellStyle(cellStyle1);
+        cell.setCellValue("注意:①请按照以下示例填写订单;②订单商品最多不超过5000行;③订单导入前,请记得删除示例行!");
+        /*第三行塞值*/
+        row = sheet.createRow(2);
+
+        cell = row.createCell(0);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue(" 商品编号(必填)");
+
+        cell = row.createCell(1);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("数量(必填)");
+
+        cell = row.createCell(2);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("定制信息");
+
+        cell = row.createCell(3);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("长度");
+
+        cell = row.createCell(4);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("宽度");
+
+        cell = row.createCell(5);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("备注");
+
 
         /*第四行塞值*/
         row = sheet.createRow(3);
 
         cell = row.createCell(0);
         cell.setCellStyle(cellStyle3);
-        cell.setCellValue("test123");
+        cell.setCellValue("80902142");
 
         cell = row.createCell(1);
         cell.setCellStyle(cellStyle3);
         cell.setCellValue("10");
-        
+
+        cell = row.createCell(2);
+        cell.setCellStyle(cellStyle3);
+        cell.setCellValue("尺寸:300*100");
+
+        cell = row.createCell(3);
+        cell.setCellStyle(cellStyle3);
+        cell.setCellValue("200");
+
+        cell = row.createCell(4);
+        cell.setCellStyle(cellStyle3);
+        cell.setCellValue("100");
+
+        cell = row.createCell(5);
+        cell.setCellStyle(cellStyle3);
+        cell.setCellValue("备注信息");
+
     }
-    
-    
+
+
     /**
      * 2022-07-14 17:42:03
      * 设置表头
-     * **/
-    public static void batchDetailErr(XSSFSheet sheet, XSSFCellStyle cellStyle1,XSSFCellStyle cellStyle2,XSSFCellStyle cellStyle3,XSSFWorkbook workbook) {
+     **/
+    public static void batchDetailErr(XSSFSheet sheet, XSSFCellStyle cellStyle1, XSSFCellStyle cellStyle2, XSSFCellStyle cellStyle3, XSSFWorkbook workbook) {
 //        HSSFCellStyle bcs = ExportExcel.createTitleCellStyle1(workbook);
 //        bcs.setBorderBottom(BorderStyle.THIN); //下边框
 //        bcs.setBorderLeft(BorderStyle.THIN);//左边框
@@ -216,38 +260,54 @@ public class ExportExcel {
         cellStyle1.setBorderTop(BorderStyle.THIN);//上边框
         cellStyle1.setBorderRight(BorderStyle.THIN);//右边框
         cellStyle1.setWrapText(true);
-        
-        
-
-      	 /*第一行*/
-          sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 2));
-
-          /*第一行塞值*/
-          row = sheet.createRow(0);
-          cell = row.createCell(0);// ID
-          cell.setCellStyle(cellStyle3);
-          cell.setCellValue("订单导入");
-          /*第二行*/
-          sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 2));
-          /*第二行塞值*/
-          row = sheet.createRow(1);
-          cell = row.createCell(0);// ID
-          cell.setCellStyle(cellStyle1);
-          cell.setCellValue("注意:①请按照以下示例填写订单;②订单商品最多不超过5000行;③订单导入前,请记得删除示例行!");
-          /*第三行塞值*/
-          row = sheet.createRow(2);
-
-          cell = row.createCell(0);
-          cell.setCellStyle(cellStyle2);
-          cell.setCellValue("商品编码(必填)");
-
-          cell = row.createCell(1);
-          cell.setCellStyle(cellStyle2);
-          cell.setCellValue("数量");
-
-          cell = row.createCell(2);
-          cell.setCellStyle(cellStyle2);
-          cell.setCellValue("错误信息");         
-      
+
+
+
+        /*第一行*/
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 6));
+
+        /*第一行塞值*/
+        row = sheet.createRow(0);
+        cell = row.createCell(0);// ID
+        cell.setCellStyle(cellStyle3);
+        cell.setCellValue("订单导入");
+        /*第二行*/
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 6));
+        /*第二行塞值*/
+        row = sheet.createRow(1);
+        cell = row.createCell(0);// ID
+        cell.setCellStyle(cellStyle1);
+        cell.setCellValue("注意:①请按照以下示例填写订单;②订单商品最多不超过5000行;③订单导入前,请记得删除示例行!");
+        /*第三行塞值*/
+        row = sheet.createRow(2);
+
+        cell = row.createCell(0);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("商品编码(必填)");
+
+        cell = row.createCell(1);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("数量(必填)");
+
+        cell = row.createCell(2);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("定制信息");
+
+        cell = row.createCell(3);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("长度");
+
+        cell = row.createCell(4);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("宽度");
+
+        cell = row.createCell(5);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("备注");
+
+        cell = row.createCell(6);
+        cell.setCellStyle(cellStyle2);
+        cell.setCellValue("错误信息");
+
     }
 }

+ 33 - 3
src/custom/restcontroller/webmanage/sale/order/OrderImport.java

@@ -165,6 +165,10 @@ public class OrderImport extends Controller {
             ArrayList<String> sqllist = new ArrayList<>();
             keys.add("itemno");
             keys.add("qty");
+            keys.add("customproperties");
+            keys.add("length");
+            keys.add("width");
+            keys.add("remarks");
 
             HashMap<String, CellType> cellmap = new HashMap<>();
             cellmap.put("itemno", CellType.STRING);
@@ -241,9 +245,20 @@ public class OrderImport extends Controller {
                     sqlFactoryupload.addParameter("sa_orderid", sa_orderid);
                     sqlFactoryupload.addParameter("rowno", getRowNo(sa_orderid));
                     sqlFactoryupload.addParameter("itemid", row.getLong("itemid"));
-                    sqlFactoryupload.addParameter("remarks", "");
+                    sqlFactoryupload.addParameter("remarks", row.getString("remarks"));
+                    sqlFactoryupload.addParameter("customproperties",  row.getString("customproperties"));
+                    sqlFactoryupload.addParameter("sa_promotion_itemsid", 0);
                     // 商品信息
                     Row itemRow = getItemRow(row.getLong("itemid"));
+                    if(itemRow.getBoolean("iscustomsize")){
+                        sqlFactoryupload.addParameter("length", row.getLong("length"));
+                        sqlFactoryupload.addParameter("width",  row.getLong("width"));
+                    }else{
+                        sqlFactoryupload.addParameter("length", itemRow.getLong("length"));
+                        sqlFactoryupload.addParameter("width",  itemRow.getLong("width"));
+                    }
+
+
                     BigDecimal conversionrate = itemRow.getBigDecimal("conversionrate");
                     if (conversionrate.compareTo(BigDecimal.ZERO) <= 0) {
                         conversionrate = BigDecimal.valueOf(1);
@@ -308,14 +323,26 @@ public class OrderImport extends Controller {
                 HashMap<String, String> map = new HashMap<String, String>();
                 map.put("itemno", "商品编号");
                 map.put("qty", "数量");
+                map.put("customproperties", "定制信息");
+                map.put("length", "长度");
+                map.put("width", "宽度");
+                map.put("remarks", "备注");
                 map.put("msg", "错误信息");
                 ArrayList<String> colNameList = new ArrayList<String>();
                 HashMap<String, Class> keytypemap = new HashMap<String, Class>();
                 colNameList.add("itemno");
                 colNameList.add("qty");
+                colNameList.add("customproperties");
+                colNameList.add("length");
+                colNameList.add("width");
+                colNameList.add("remarks");
                 colNameList.add("msg");
                 keytypemap.put("itemno", String.class);
                 keytypemap.put("qty", String.class);
+                keytypemap.put("customproperties", String.class);
+                keytypemap.put("length", String.class);
+                keytypemap.put("width", String.class);
+                keytypemap.put("remarks", String.class);
                 keytypemap.put("msg", String.class);
                 rowserr.setFieldList(colNameList);
                 rowserr.setFieldTypeMap(keytypemap);
@@ -472,8 +499,11 @@ public class OrderImport extends Controller {
                     sqlFactoryupload.addParameter("sa_orderid", sa_orderid);
                     sqlFactoryupload.addParameter("rowno", getRowNo(sa_orderid));
                     sqlFactoryupload.addParameter("itemid", row.getLong("itemid"));
-                    sqlFactoryupload.addParameter("remarks", "");
-                    sqlFactoryupload.addParameter("customproperties", "");
+                    sqlFactoryupload.addParameter("remarks",  row.getString("remarks"));
+                    sqlFactoryupload.addParameter("customproperties",  row.getString("customproperties"));
+                    sqlFactoryupload.addParameter("width",  0);
+                    sqlFactoryupload.addParameter("length",  0);
+                    sqlFactoryupload.addParameter("sa_promotion_itemsid", 0);
 
                     // 商品信息
                     Row itemRow = getItemRow(row.getLong("itemid"));

+ 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,customproperties,sa_promotion_itemsid)
+                           batchno,customproperties,sa_promotion_itemsid,width,length)
 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$,$customproperties$,$sa_promotion_itemsid$);
+        $stockno$, $position$, $batchno$,$customproperties$,$sa_promotion_itemsid$,$width$,$length$);