From 68fae8cc33d80553355997554b06f5ac1395ef2c Mon Sep 17 00:00:00 2001
From: sgj <1442489573@qq.com>
Date: 星期四, 25 十二月 2025 11:39:37 +0800
Subject: [PATCH] 出库报表列宽调整,映射调整,查询调整,导出实现

---
 fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetailPR.java       |   14 ++++
 fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetailPR.java        |   10 ++
 fzzy-igdss-view/src/main/java/com/fzzy/igds/export/ReportController.java |   30 +++++++--
 fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportInDetail.view.xml      |    6 +
 fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetail.view.xml     |   73 ++++++++++++++++++------
 5 files changed, 102 insertions(+), 31 deletions(-)

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 f224179..60dd6bb 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
@@ -478,12 +478,13 @@
         <Button layoutConstraint="left">
           <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
 var param = {&#xD;
+	&quot;type&quot;:&quot;IN&quot;,&#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>
+window.parent.$.table.exportExcelDorado(&quot;./export/inOutReport-excel&quot;, &quot;鍏ュ簱鏁版嵁&quot;, param);</ClientEvent>
           <Property name="caption">瀵煎嚭EXCEL</Property>
           <Property name="exClassName">btn-q2</Property>
           <Property name="width">140</Property>
@@ -538,12 +539,13 @@
         <Button layoutConstraint="left">
           <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
 var param = {&#xD;
+	&quot;type&quot;:&quot;IN&quot;,&#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>
+window.parent.$.table.exportExcelDorado(&quot;./export/inOutReport-excel&quot;, &quot;鍏ュ簱鏁版嵁&quot;, param);</ClientEvent>
           <Property name="caption">瀵煎嚭EXCEL</Property>
           <Property name="exClassName">btn-q2</Property>
           <Property name="width">140</Property>
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 1f5cfa8..e0dc0e3 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
@@ -80,6 +80,12 @@
         if(StringUtils.isEmpty(param.getDeptId())){
             param.setDeptId(param.getCompanyId());
         }
+        if(StringUtils.isNotEmpty(param.getDeptId()) && StringUtils.isNotEmpty(param.getCompanyId())){
+            String substring = param.getDeptId().substring(0, (param.getDeptId().length() - 3));
+            if (!substring.equals(param.getCompanyId())){
+                return new ArrayList<InoutRecord>();
+            }
+        }
         param.setCompanyId(null);
         inoutReportService.listPageInout(corePage, param);
         //鑾峰彇鏌ヨ鍒板緱list鏁版嵁
@@ -93,11 +99,11 @@
         int index = 1;
         List<InoutRecord> list = new ArrayList<>();
         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)));
             }
+            list.add(record);
+            record.setRemarks(String.valueOf(index));
             emptyWeightSum += record.getEmptyWeight();
             fullWeightSum += record.getFullWeight();
             deOtherSum += record.getDeOther();
diff --git a/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetail.view.xml b/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetail.view.xml
index 3017b4d..584341d 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetail.view.xml
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetail.view.xml
@@ -13,6 +13,11 @@
       <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>
       <PropertyDef name="progress">
         <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>
@@ -469,6 +474,15 @@
           <Property name="caption">閲嶇疆</Property>
         </Button>
         <Button layoutConstraint="left">
+          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
+var param = {&#xD;
+	&quot;type&quot;:&quot;OUT&quot;,&#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/inOutReport-excel&quot;, &quot;鍑哄簱鏁版嵁&quot;, param);</ClientEvent>
           <Property name="caption">瀵煎嚭EXCEL</Property>
           <Property name="exClassName">btn-q2</Property>
           <Property name="width">140</Property>
@@ -484,8 +498,8 @@
         <Property name="hideMode">display</Property>
         <Property name="visible">false</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>
@@ -520,6 +534,15 @@
           <Property name="caption">閲嶇疆</Property>
         </Button>
         <Button layoutConstraint="left">
+          <ClientEvent name="onClick">var data = view.get(&quot;#dsQuery.data&quot;);&#xD;
+var param = {&#xD;
+	&quot;type&quot;:&quot;OUT&quot;,&#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/inOutReport-excel&quot;, &quot;鍑哄簱鏁版嵁&quot;, param);</ClientEvent>
           <Property name="caption">瀵煎嚭EXCEL</Property>
           <Property name="exClassName">btn-q2</Property>
           <Property name="width">140</Property>
@@ -603,59 +626,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">
@@ -675,55 +706,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/ReportOutDetailPR.java b/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetailPR.java
index 6754a71..fa40828 100644
--- a/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetailPR.java
+++ b/fzzy-igdss-view/src/main/java/com/fzzy/igds/ReportOutDetailPR.java
@@ -76,6 +76,17 @@
         param.setType(Constant.TYPE_OUT);
         //澶氬弬鏁板垎椤垫煡璇�
         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());
+        }
+        if(StringUtils.isNotEmpty(param.getDeptId()) && StringUtils.isNotEmpty(param.getCompanyId())){
+            String substring = param.getDeptId().substring(0, (param.getDeptId().length() - 3));
+            if (!substring.equals(param.getCompanyId())){
+                return new ArrayList<InoutRecord>();
+            }
+        }
+        param.setCompanyId(null);
         inoutReportService.listPageInout(corePage, param);
         //鑾峰彇鏌ヨ鍒板緱list鏁版嵁
         List<InoutRecord> result = corePage.getRecords();
@@ -88,6 +99,9 @@
         int index = 1;
         List<InoutRecord> list = new ArrayList<>();
         for (InoutRecord record : result) {
+            if(StringUtils.isNotBlank(record.getDeptId())){
+                record.setCompanyId(record.getDeptId().substring(0,(record.getDeptId().length()-3)));
+            }
             list.add(record);
             record.setRemarks(String.valueOf(index));
             emptyWeightSum += record.getEmptyWeight();
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
index 88f67e1..c3704b5 100644
--- 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
@@ -2,14 +2,15 @@
 
 
 import com.fzzy.igds.ReportInDetailPR;
+import com.fzzy.igds.ReportOutDetailPR;
 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.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -17,6 +18,7 @@
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 
@@ -25,7 +27,6 @@
  *
  * @author sgj
  * @date 2025/12/24
-
  */
 @Controller
 @RequestMapping("export")
@@ -41,20 +42,33 @@
     @Autowired
     private ReportInDetailPR reportInDetailPR;
 
+    @Autowired
+    private ReportOutDetailPR reportOutDetailPR;
+
 
 
     /**
      * 鍑哄叆搴撴姤琛ㄥ鍑�
      * @return
      */
-    @RequestMapping("/inReport-excel")
+    @RequestMapping("/inOutReport-excel")
     @ResponseBody
-    public AjaxResult inReportExcel(InoutParam param) {
-        //鏌ヨ鏁版嵁
-        List<InoutRecord> list = reportInDetailPR.listRecord(param);
-
+    public AjaxResult inOutReport(InoutParam param) {
         //璁剧疆鏍囬
-        String sheetName = "鍏ュ簱鎶ヨ〃鏁版嵁";
+        String sheetName = "鎶ヨ〃鏁版嵁";
+        //鏌ヨ鏁版嵁
+        List<InoutRecord> list = new ArrayList<>();
+
+        if (StringUtils.isNotEmpty(param.getType()) && "IN".equals(param.getType())) {
+            sheetName = "鍏ュ簱鎶ヨ〃鏁版嵁";
+            list = reportInDetailPR.listRecord(param);
+        }
+
+        if (StringUtils.isNotEmpty(param.getType()) && "OUT".equals(param.getType())) {
+            sheetName = "鍑哄簱鎶ヨ〃鏁版嵁";
+            list = reportOutDetailPR.listRecord(param);
+        }
+
         //鑾峰彇鍒嗗簱缂栫爜瀵瑰簲鐨勫垎搴撳悕绉�
         String deptName = "";
         SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null));

--
Gitblit v1.9.3