From cb248506e5944f49fef18c6e973fbd650b45dc03 Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期三, 24 十二月 2025 17:35:19 +0800
Subject: [PATCH] 入库报表列宽调整,映射调整,查询调整,导出实现

---
 fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/InoutRecord.java      |    9 +++
 fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetailPR.java        |    8 ++
 fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java |   70 +++++++++++++++++++++++
 fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetail.view.xml      |   77 ++++++++++++++++++-------
 4 files changed, 142 insertions(+), 22 deletions(-)

diff --git a/fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/InoutRecord.java b/fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/InoutRecord.java
index 7cdff1f..b96abdf 100644
--- a/fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/InoutRecord.java
+++ b/fzzy-igdss-core/src/main/java/com/fzzy/igds/domain/InoutRecord.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fzzy.igds.constant.Constant;
+import com.ruoyi.common.annotation.Excel;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import javax.persistence.Column;
@@ -33,6 +34,7 @@
     public static String SORT_PROP = "id";
 
     @Id
+    @Excel(name = "娴佹按鍙�",sort = 1)
     @Column(name = "id", columnDefinition = "varchar(14) COMMENT '娴佹按鍙�'")
     @TableField("id")
     private String id;
@@ -144,6 +146,8 @@
 
     @Column(name = "full_weight", columnDefinition = "decimal(20,2) COMMENT '婊¤溅绉伴噸(鍗曚綅KG)'")
     @TableField("full_weight")
+
+    @Excel(name = "婊¤溅绉伴噸",sort = 2)
     private Double fullWeight = 0.0;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -157,6 +161,7 @@
 
     @Column(name = "empty_weight", columnDefinition = "decimal(20,2) COMMENT '绌鸿溅绉伴噸(鍗曚綅KG)'")
     @TableField("empty_weight")
+    @Excel(name = "绌鸿溅绉伴噸",sort = 3)
     private Double emptyWeight = 0.0;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -170,18 +175,22 @@
 
     @Column(name = "net_weight", columnDefinition = "decimal(20,2) COMMENT '鍑�閲�(鍗曚綅KG)'")
     @TableField("net_weight")
+    @Excel(name = "鍑�閲�",sort = 5)
     private Double netWeight = 0.0;
 
     @Column(name = "de_other", columnDefinition = "decimal(20,2) COMMENT '鎵i噸(鍗曚綅KG)'")
     @TableField("de_other")
+    @Excel(name = "鎵i噸",sort = 4)
     private Double deOther = 0.0;
 
     @Column(name = "settle_weight", columnDefinition = "decimal(20,2) COMMENT '缁撶畻閲嶉噺(鍗曚綅KG)'")
     @TableField("settle_weight")
+    @Excel(name = "缁撶畻閲嶉噺",sort = 6)
     private Double settleWeight = 0.0;
 
     @Column(name = "record_weight", columnDefinition = "decimal(20,2) COMMENT '鍏ュ簱閲嶉噺(鍗曚綅KG)'")
     @TableField("record_weight")
+    @Excel(name = "鍏ュ簱閲嶉噺",sort = 7)
     private Double recordWeight = 0.0;
 
 
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetail.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetail.view.xml
index e4c9085..f224179 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetail.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetail.view.xml
@@ -12,7 +12,12 @@
       </PropertyDef>
       <PropertyDef name="companyId">
         <Property></Property>
-        <Property name="label">缁勭粐缂栫爜</Property>
+        <Property name="label">鏀跺偍鍏徃</Property>
+        <Property name="mapping">
+          <Property name="mapValues">${dorado.getDataProvider(&quot;companyPR#getData&quot;).getResult()}</Property>
+          <Property name="keyProperty">id</Property>
+          <Property name="valueProperty">dwmc</Property>
+        </Property>
       </PropertyDef>
       <PropertyDef name="progress">
         <Property></Property>
@@ -180,7 +185,7 @@
         <Property></Property>
         <Property name="label">瑁呭嵏浠撳簱</Property>
         <Property name="mapping">
-          <Property name="mapValues">${dorado.getDataProvider(&quot;depotPR#getAllCache&quot;).getResult()}</Property>
+          <Property name="mapValues">${dorado.getDataProvider(&quot;depotPR#getData&quot;).getResult()}</Property>
           <Property name="keyProperty">id</Property>
           <Property name="valueProperty">name</Property>
         </Property>
@@ -315,7 +320,7 @@
         <Property></Property>
         <Property name="label">瑁呭嵏浠撳簱</Property>
         <Property name="mapping">
-          <Property name="mapValues">${dorado.getDataProvider(&quot;depotPR#getAllCache&quot;).getResult()}</Property>
+          <Property name="mapValues">${dorado.getDataProvider(&quot;depotPR#getData&quot;).getResult()}</Property>
           <Property name="keyProperty">id</Property>
           <Property name="valueProperty">name</Property>
         </Property>
@@ -358,15 +363,6 @@
         <Property name="label">鎴鏃堕棿</Property>
         <Property name="dataType">Date</Property>
       </PropertyDef>
-      <PropertyDef name="customerName">
-        <Property></Property>
-        <Property name="label">鍗曚綅</Property>
-        <Property name="mapping">
-          <Property name="mapValues">${dorado.getDataProvider(&quot;companyPR#getData&quot;).getResult()}</Property>
-          <Property name="keyProperty">id</Property>
-          <Property name="valueProperty">dwmc</Property>
-        </Property>
-      </PropertyDef>
       <PropertyDef name="unit">
         <Property></Property>
         <Property name="label">鍗曚綅</Property>
@@ -380,6 +376,15 @@
       </PropertyDef>
       <PropertyDef name="none">
         <Property></Property>
+      </PropertyDef>
+      <PropertyDef name="companyId">
+        <Property></Property>
+        <Property name="label">鏀跺偍鍏徃</Property>
+        <Property name="mapping">
+          <Property name="mapValues">${dorado.getDataProvider(&quot;companyPR#getData&quot;).getResult()}</Property>
+          <Property name="keyProperty">id</Property>
+          <Property name="valueProperty">dwmc</Property>
+        </Property>
       </PropertyDef>
     </DataType>
   </Model>
@@ -471,6 +476,14 @@
           <Property name="caption">閲嶇疆</Property>
         </Button>
         <Button layoutConstraint="left">
+          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
+var param = {&#xD;
+    &quot;depotId&quot;:data.get(&quot;depotId&quot;),&#xD;
+	&quot;foodVariety&quot;:data.get(&quot;foodVariety&quot;),&#xD;
+    &quot;start&quot;:data.get(&quot;start&quot;),&#xD;
+    &quot;end&quot;:data.get(&quot;end&quot;)&#xD;
+}&#xD;
+window.parent.$.table.exportExcelDorado(&quot;./export/inReport-excel&quot;, &quot;鍏ュ簱鏁版嵁&quot;, param);</ClientEvent>
           <Property name="caption">瀵煎嚭EXCEL</Property>
           <Property name="exClassName">btn-q2</Property>
           <Property name="width">140</Property>
@@ -487,8 +500,8 @@
         <Property name="visible">false</Property>
         <Property name="hideMode">display</Property>
         <AutoFormElement>
-          <Property name="name">customerName</Property>
-          <Property name="property">customerName</Property>
+          <Property name="name">companyId</Property>
+          <Property name="property">companyId</Property>
           <Property name="label">鏀跺偍鍏徃</Property>
           <Editor/>
         </AutoFormElement>
@@ -523,6 +536,14 @@
           <Property name="caption">閲嶇疆</Property>
         </Button>
         <Button layoutConstraint="left">
+          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
+var param = {&#xD;
+    &quot;deptId&quot;:data.get(&quot;deptId&quot;),&#xD;
+	&quot;companyId&quot;:data.get(&quot;companyId&quot;),&#xD;
+    &quot;start&quot;:data.get(&quot;start&quot;),&#xD;
+    &quot;end&quot;:data.get(&quot;end&quot;)&#xD;
+}&#xD;
+window.parent.$.table.exportExcelDorado(&quot;./export/inReport-excel&quot;, &quot;鍏ュ簱鏁版嵁&quot;, param);</ClientEvent>
           <Property name="caption">瀵煎嚭EXCEL</Property>
           <Property name="exClassName">btn-q2</Property>
           <Property name="width">140</Property>
@@ -606,59 +627,67 @@
         <RowNumColumn/>
         <DataColumn name="id">
           <Property name="property">id</Property>
-          <Property name="width">130</Property>
+          <Property name="width">150</Property>
           <Property name="align">center</Property>
         </DataColumn>
         <DataColumn name="plateNum">
           <Property name="property">plateNum</Property>
           <Property name="align">center</Property>
+          <Property name="width">120</Property>
         </DataColumn>
         <DataColumn name="depotId">
           <Property name="property">depotId</Property>
           <Property name="caption">浠撳簱</Property>
-          <Property name="width">80</Property>
           <Property name="align">center</Property>
         </DataColumn>
         <DataColumn>
           <Property name="name">foodVariety</Property>
           <Property name="property">foodVariety</Property>
           <Property name="align">center</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn name="fullWeight">
           <Property name="property">fullWeight</Property>
           <Property name="caption">姣涢噸</Property>
           <Property name="align">center</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn name="emptyWeight">
           <Property name="property">emptyWeight</Property>
           <Property name="caption">鐨噸</Property>
           <Property name="align">center</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn name="netWeight">
           <Property name="property">netWeight</Property>
           <Property name="align">center</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn>
           <Property name="name">deOther</Property>
           <Property name="property">deOther</Property>
           <Property name="align">center</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn name="settleWeight">
           <Property name="property">settleWeight</Property>
           <Property name="caption">缁撶畻閲嶉噺</Property>
           <Property name="align">center</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn>
           <Property name="property">recordWeight</Property>
           <Property name="align">center</Property>
           <Property name="name">recordWeight</Property>
           <Property name="caption">鍏ュ簱閲嶉噺</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn>
           <Property name="property">completeTime</Property>
           <Property name="align">center</Property>
           <Property name="name">completeTime</Property>
           <Property name="caption">绂诲簱鏃堕棿</Property>
+          <Property name="width">150</Property>
         </DataColumn>
       </DataGrid>
       <DataGrid id="dataGridMain2" layoutConstraint="padding:8">
@@ -678,55 +707,59 @@
           <Property name="caption">搴忓彿</Property>
         </RowNumColumn>
         <DataColumn>
-          <Property name="property">customerName</Property>
+          <Property name="property">companyId</Property>
           <Property name="caption">鏀跺偍鍏徃</Property>
-          <Property name="width">80</Property>
           <Property name="align">center</Property>
-          <Property name="name">customerName</Property>
+          <Property name="name">companyId</Property>
         </DataColumn>
         <DataColumn>
           <Property name="property">deptId</Property>
           <Property name="caption">搴撳尯鍚嶇О</Property>
-          <Property name="width">80</Property>
+          <Property name="width">250</Property>
           <Property name="align">center</Property>
           <Property name="name">deptId</Property>
         </DataColumn>
         <DataColumn name="id">
           <Property name="property">id</Property>
-          <Property name="width">130</Property>
+          <Property name="width">150</Property>
           <Property name="align">center</Property>
         </DataColumn>
         <DataColumn name="plateNum">
           <Property name="property">plateNum</Property>
           <Property name="align">center</Property>
+          <Property name="width">120</Property>
         </DataColumn>
         <DataColumn name="depotId">
           <Property name="property">depotId</Property>
           <Property name="caption">浠撳簱</Property>
-          <Property name="width">80</Property>
+          <Property name="width">120</Property>
           <Property name="align">center</Property>
         </DataColumn>
         <DataColumn>
           <Property name="name">foodVariety</Property>
           <Property name="property">foodVariety</Property>
           <Property name="align">center</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn name="settleWeight">
           <Property name="property">settleWeight</Property>
           <Property name="caption">缁撶畻閲嶉噺</Property>
           <Property name="align">center</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn>
           <Property name="property">recordWeight</Property>
           <Property name="align">center</Property>
           <Property name="name">recordWeight</Property>
           <Property name="caption">鍏ュ簱閲嶉噺</Property>
+          <Property name="width">100</Property>
         </DataColumn>
         <DataColumn>
           <Property name="property">completeTime</Property>
           <Property name="align">center</Property>
           <Property name="name">completeTime</Property>
           <Property name="caption">绂诲簱鏃堕棿</Property>
+          <Property name="width">150</Property>
         </DataColumn>
         <DataColumn>
           <ClientEvent name="onRenderCell">//arg.dom.innerHTML = &quot;&lt;a href='javascript:;' onClick='detail()' class='a-btn1'>鏌ョ湅璇︽儏&lt;/a>&quot;;</ClientEvent>
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetailPR.java b/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetailPR.java
index caa9ed9..1f5cfa8 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetailPR.java
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetailPR.java
@@ -76,6 +76,11 @@
         param.setType(Constant.TYPE_IN);
         //澶氬弬鏁板垎椤垫煡璇�
         com.baomidou.mybatisplus.extension.plugins.pagination.Page<InoutRecord> corePage = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(0, 10000);
+        //鏀跺偍鍏徃鏌ヨ澶勭悊
+        if(StringUtils.isEmpty(param.getDeptId())){
+            param.setDeptId(param.getCompanyId());
+        }
+        param.setCompanyId(null);
         inoutReportService.listPageInout(corePage, param);
         //鑾峰彇鏌ヨ鍒板緱list鏁版嵁
         List<InoutRecord> result = corePage.getRecords();
@@ -90,6 +95,9 @@
         for (InoutRecord record : result) {
             list.add(record);
             record.setRemarks(String.valueOf(index));
+            if(StringUtils.isNotBlank(record.getDeptId())){
+                record.setCompanyId(record.getDeptId().substring(0,(record.getDeptId().length()-3)));
+            }
             emptyWeightSum += record.getEmptyWeight();
             fullWeightSum += record.getFullWeight();
             deOtherSum += record.getDeOther();
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java b/fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java
new file mode 100644
index 0000000..88f67e1
--- /dev/null
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java
@@ -0,0 +1,70 @@
+package com.fzzy.igds.export;
+
+
+import com.fzzy.igds.ReportInDetailPR;
+import com.fzzy.igds.data.InoutParam;
+import com.fzzy.igds.domain.Dept;
+import com.fzzy.igds.domain.InoutRecord;
+import com.fzzy.igds.service.InoutRecordService;
+import com.fzzy.igds.service.SysDeptService;
+import com.fzzy.igds.utils.ContextUtil;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDept;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+
+/**
+ * 鏁版嵁瀵煎嚭EXCEL鍏ュ彛
+ *
+ * @author sgj
+ * @date 2025/12/24
+
+ */
+@Controller
+@RequestMapping("export")
+public class ReportController {
+
+
+    @Resource
+    private InoutRecordService inoutReportService;
+
+    @Resource
+    private SysDeptService sysDeptService;
+
+    @Autowired
+    private ReportInDetailPR reportInDetailPR;
+
+
+
+    /**
+     * 鍑哄叆搴撴姤琛ㄥ鍑�
+     * @return
+     */
+    @RequestMapping("/inReport-excel")
+    @ResponseBody
+    public AjaxResult inReportExcel(InoutParam param) {
+        //鏌ヨ鏁版嵁
+        List<InoutRecord> list = reportInDetailPR.listRecord(param);
+
+        //璁剧疆鏍囬
+        String sheetName = "鍏ュ簱鎶ヨ〃鏁版嵁";
+        //鑾峰彇鍒嗗簱缂栫爜瀵瑰簲鐨勫垎搴撳悕绉�
+        String deptName = "";
+        SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));
+        if (null != subDept) {
+            deptName = subDept.getDeptName();
+        }
+
+        //瀵煎嚭
+        ExcelUtil<InoutRecord> util = new ExcelUtil<InoutRecord>(InoutRecord.class);
+        return util.exportExcel(list, sheetName, deptName);
+    }
+
+}

--
Gitblit v1.9.3