hu 2 лет назад
Родитель
Сommit
085951bbb2

+ 68 - 22
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -665,28 +665,53 @@ public class OrderItems extends Controller {
         }
 
         if (isExport) {
-            ExcelFactory excelFactory = new ExcelFactory("订单明细查询");
-
-            XSSFSheet sheet = excelFactory.getXssfWorkbook().createSheet("Sheet1");
-            XSSFWorkbook xssfFWorkbook = excelFactory.getXssfWorkbook();
-
-            CellStyle style = xssfFWorkbook.createCellStyle();
-            // 设置为文本格式,防止身份证号变成科学计数法
-            DataFormat format = xssfFWorkbook.createDataFormat();
-            style.setDataFormat(format.getFormat("@"));
-            // 对单独某一列进行样式赋值,第一个参数为列数,第二个参数为样式
-            sheet.setDefaultColumnStyle(0, style);
-            ExportDown.setBatchDetailSheetColumn1(sheet);// 设置工作薄列宽
-            XSSFCellStyle titleCellStyle2 = ExportDown.createTitleCellStyle2(xssfFWorkbook);
-            XSSFCellStyle titleCellStyle3 = ExportDown.createBodyCellStyle(xssfFWorkbook);
-            ExportDown.batchDetail(sheet, titleCellStyle2, titleCellStyle3, rows);// 写入标题
-
-            Rows uploadRows = uploadExcelToObs(excelFactory);
-            String url = "";
-            if (!uploadRows.isEmpty()) {
-                url = uploadRows.get(0).getString("url");
-            }
-            return getSucReturnObject().setData(url).toString();
+            //去除不需要导出项
+            rows.getFieldList().remove("sa_orderitemsid");
+            rows.getFieldList().remove("itemid");
+            rows.getFieldList().remove("batchcontrol");
+            rows.getFieldList().remove("model");
+            rows.getFieldList().remove("conversionrate");
+            rows.getFieldList().remove("marketprice");
+            rows.getFieldList().remove("defaultprice");
+            rows.getFieldList().remove("defaultamount");
+            rows.getFieldList().remove("auxqty");
+            rows.getFieldList().remove("needdate");
+            rows.getFieldList().remove("deliedqty");
+            rows.getFieldList().remove("rebateamount");
+            rows.getFieldList().remove("invoiceamount");
+            rows.getFieldList().remove("writeoffamount");
+            rows.getFieldList().remove("auxunit");
+            rows.getFieldList().remove("sa_orderid");
+            rows.getFieldList().remove("deliverydate");
+            rows.getFieldList().remove("returnqty");
+            rows.getFieldList().remove("stockno");
+            rows.getFieldList().remove("position");
+            rows.getFieldList().remove("batchno");
+            rows.getFieldList().remove("isfreeze");
+            rows.getFieldList().remove("candispatchqty");
+            rows.getFieldList().remove("cansaleqty");
+            rows.getFieldList().remove("totalaty");
+            rows.getFieldList().remove("orderminqty_auxunit");
+            rows.getFieldList().remove("orderminqty");
+            rows.getFieldList().remove("orderaddqty_auxunit");
+            rows.getFieldList().remove("orderaddqty");
+            rows.getFieldList().remove("spec");
+            rows.getFieldList().remove("packageqty");
+            rows.getFieldList().remove("delivery");
+            rows.getFieldList().remove("erpitemno");
+            rows.getFieldList().remove("erpitemname");
+            rows.getFieldList().remove("prodline");
+            rows.getFieldList().remove("material");
+            rows.getFieldList().remove("device");
+            rows.getFieldList().remove("specalnote");
+            rows.getFieldList().remove("standards");
+            rows.getFieldList().remove("agentnum");
+            rows.getFieldList().remove("enterprisename");
+            rows.getFieldList().remove("stockstatus");
+
+
+            Rows uploadRows = uploadExcelToObs("orderdetail", "订单明细列表", rows, getTitleMapAgent());
+            return getSucReturnObject().setData(uploadRows).toString();
         }
 
 
@@ -725,6 +750,27 @@ public class OrderItems extends Controller {
         return titleMap;
     }
 
+    //返回导出的标题
+    public HashMap<String, String> getTitleMapAgent() {
+        HashMap<String, String> titleMap = new HashMap<>();
+        titleMap.put("rowno", "行号");
+        titleMap.put("sonum", "订单号");
+        titleMap.put("status", "订单状态");
+        titleMap.put("type", "订单类型");
+        titleMap.put("billdate", "单据日期");
+        titleMap.put("tradefield", "领域");
+        titleMap.put("itemno", "产品编码");
+        titleMap.put("itemname", "品名");
+        titleMap.put("unit", "单位");
+        titleMap.put("qty", "数量");
+        titleMap.put("undeliqty", "未发货数量");
+        titleMap.put("price", "单价");
+        titleMap.put("amount", "金额");
+        titleMap.put("remarks", "订单行备注");
+
+        return titleMap;
+    }
+
     @API(title = "查询可添加商品列表", apiversion = R.ID20221109153502.v1.class)
     @CACHEING
     public String selectItemList() throws YosException {

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

@@ -1,30 +1,34 @@
 SELECT t1.sa_orderitemsid,
        t1.itemid,
        t1.rowno,
-       t1.batchcontrol,
+       t5.sonum,
+       t5.status,
+       t5.billdate,
+       t5.tradefield,
        t1.itemno,
        t1.itemname,
-       t1.model,
-       t1.conversionrate,
+       t1.unit,
+       t1.qty,
+       t1.undeliqty,
        t1.price,
        t1.amount,
+       t1.remarks,
+       t1.batchcontrol,
+       t1.model,
+       t1.conversionrate,
        t1.marketprice,
        t1.defaultprice,
        t1.defaultamount,
-       t1.qty,
        t1.auxqty,
        ifnull(t1.needdate, '')        needdate,
        t1.deliedqty,
        t1.rebateamount,
-       t1.undeliqty,
        t1.invoiceamount,
        t1.writeoffamount,
-       t1.unit,
        t1.auxunit,
        t1.sa_orderid,
        ifnull(t1.deliverydate, '')    deliverydate,
        t1.returnqty,
-       t1.remarks,
        t1.stockno,
        t1.position,
        t1.batchno,
@@ -46,11 +50,6 @@ SELECT t1.sa_orderitemsid,
        t4.device,
        t4.specalnote,
        t3.standards,
-       t5.type,
-       t5.billdate,
-       t5.status,
-       t5.sonum,
-       t5.tradefield,
        t6.agentnum,
        t7.enterprisename,
        (SELECT (case