From dea9852bb63dd54331819ac18d623143fc086b0c Mon Sep 17 00:00:00 2001
From: zhangchao <zc857179121@qq.com>
Date: 星期二, 05 十一月 2024 09:11:57 +0800
Subject: [PATCH] Excel导出优化

---
 src/main/java/com/zy/asrs/controller/ReportDownloadController.java |    1 -
 src/main/java/com/zy/asrs/entity/ViewWorkInBean.java               |   47 ++++++++++++++++++++++++++++++++---------------
 src/main/java/com/zy/asrs/entity/ViewWorkCountInView.java          |   10 ++++++++--
 3 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/ReportDownloadController.java b/src/main/java/com/zy/asrs/controller/ReportDownloadController.java
index d95f358..e6cf1d5 100644
--- a/src/main/java/com/zy/asrs/controller/ReportDownloadController.java
+++ b/src/main/java/com/zy/asrs/controller/ReportDownloadController.java
@@ -219,7 +219,6 @@
             String fileName = URLEncoder.encode("鏃ュ叆搴撴槑缁嗙粺璁�", "UTF-8").replaceAll("\\+", "%20");
             response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
             List<ViewWorkInBean> list = reportQueryMapper.queryViewWorkInList(bean);
-            String s = "1";
             // 杩欓噷闇�瑕佽缃笉鍏抽棴娴�
             EasyExcel.write(response.getOutputStream(), ViewWorkInBean.class).autoCloseStream(Boolean.FALSE).sheet("sheet1").doWrite(list);
         } catch (Exception e) {
diff --git a/src/main/java/com/zy/asrs/entity/ViewWorkCountInView.java b/src/main/java/com/zy/asrs/entity/ViewWorkCountInView.java
index 0e331e2..90e4e62 100644
--- a/src/main/java/com/zy/asrs/entity/ViewWorkCountInView.java
+++ b/src/main/java/com/zy/asrs/entity/ViewWorkCountInView.java
@@ -1,19 +1,25 @@
 package com.zy.asrs.entity;
 
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.format.NumberFormat;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import lombok.Data;
 
 @Data
 public class ViewWorkCountInView {
+    @ColumnWidth(25)
     @ExcelProperty("鍏ュ簱鏃ユ湡")
     private String oneday;
 
+    @ColumnWidth(25)
     @ExcelProperty("鐗╂枡鍙�")
     private String matnr;
 
-    @ExcelProperty("鏃ユ湡鏍囬")
+    @ColumnWidth(50)
+    @ExcelProperty("鐗╂枡鍚嶇О")
     private String maktx;
 
+    @ColumnWidth(25)
     @ExcelProperty("鏁伴噺")
-    private String anfme;
+    private Double anfme;
 }
diff --git a/src/main/java/com/zy/asrs/entity/ViewWorkInBean.java b/src/main/java/com/zy/asrs/entity/ViewWorkInBean.java
index bed53c0..96f6f30 100644
--- a/src/main/java/com/zy/asrs/entity/ViewWorkInBean.java
+++ b/src/main/java/com/zy/asrs/entity/ViewWorkInBean.java
@@ -3,6 +3,7 @@
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.format.DateTimeFormat;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.core.common.Cools;
 import com.core.common.SpringUtils;
 import com.zy.system.entity.User;
@@ -23,36 +24,49 @@
 
     @ExcelIgnore
     private int pageNumber;
+
     @ExcelIgnore
     private int pageSize;
-    @ExcelIgnore
 
+    @ExcelIgnore
     private int stay_time;
-    @ExcelIgnore
 
+    @ExcelIgnore
     private String begin_date;
+
     @ExcelIgnore
     private String end_date;
+
     @ExcelIgnore
     private String query_date;
-    @ExcelIgnore
 
+    @ExcelIgnore
     private Integer row;
-    @ExcelIgnore
 
+    @ExcelIgnore
     private String crn_str_time;
+
     @ExcelIgnore
     private String crn_end_time;
-    @ExcelIgnore
 
+    @ColumnWidth(15)
+    @ExcelProperty(value = "閿�鍞崟鍙�")
+    private String three_code;
+
+    @ExcelIgnore
     @ExcelProperty(value = "宸ヤ綔鍙�")
     private Integer wrk_no;
 
-    @ExcelProperty(value = "宸ヤ綔鏃堕棿")
+    @ColumnWidth(20)
+    @ExcelProperty(value = "鍏ュ簱鏃堕棿")
     private Date io_time;
 
+    @ColumnWidth(20)
     @ExcelProperty(value = "搴撲綅鍙�")
     private String loc_no;
+
+    @ExcelProperty(value = "璐х珯鐮�")
+    private String supp_code;
 
     @ExcelProperty(value = "璐ф灦鏉$爜")
     private String zpallet;
@@ -60,10 +74,12 @@
     @ExcelProperty(value = "鏁伴噺")
     private Double anfme;
 
+    @ColumnWidth(15)
     @ExcelProperty(value = "鐗╂枡鍙�")
     private String matnr;
 
-    @ExcelProperty(value = "鐗╂枡鍙�")
+    @ColumnWidth(35)
+    @ExcelProperty(value = "鐗╂枡鍚嶇О")
     private String maktx;
 
     @ExcelProperty(value = "搴忓垪鐮�")
@@ -78,7 +94,7 @@
     @ExcelProperty(value = "鎵规")
     private String model;
 
-    @ExcelProperty(value = "棰滆壊")
+    @ExcelIgnore
     private String color;
 
     @ExcelProperty(value = "鍝佺墝")
@@ -87,20 +103,21 @@
     @ExcelProperty(value = "鍗曚綅")
     private String unit;
 
-    @ExcelProperty(value = "鍗曚环")
+    @ExcelIgnore
     private Double price;
 
     @ExcelProperty(value = "sku")
     private String sku;
 
-    @ExcelProperty(value = "鍖呮暟")
+    @ExcelIgnore
     private Double units;
 
     @ExcelProperty(value = "鏉$爜")
     private String barcode;
 
-    @ExcelProperty(value = "鐗╂枡鐘舵��")
+    @ExcelIgnore
     private String origin;
+
     @ExcelIgnore
     @ExcelProperty(value = "鍘傚")
     private String manu;
@@ -123,17 +140,17 @@
     @ExcelProperty(value = "浣撶Н")
     private Double volume;
 
-    @ExcelProperty(value = "閿�鍞崟鍙�")
-    private String three_code;
+
 
     @ExcelProperty(value = "渚涘簲鍟�")
     private String supp;
 
-    @ExcelProperty(value = "璐х珯鐮�")
-    private String supp_code;
+
+
     @ExcelIgnore
     @ExcelProperty(value = "鏄惁鎵规 1: 鏄�  0: 鍚�  ")
     private Integer be_batch;
+
     @ExcelIgnore
     @ExcelProperty(value = "淇濊川鏈�")
     private String dead_time;

--
Gitblit v1.9.1