From 5f39a6af8917e522a0f2cb915b4cc2e0e41cf47e Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期五, 19 十二月 2025 17:29:54 +0800
Subject: [PATCH] yys  移动仓储物流

---
 src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml |  125 ++++++++++++++++++++
 src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java          |    5 
 src/main/java/com/ruoyi/common/enums/FileNameType.java                     |    3 
 src/main/java/com/ruoyi/other/pojo/TempFile.java                           |    2 
 src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml    |  181 +++++++++++++++++++++++++++++-
 src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java      |    2 
 src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java        |    2 
 7 files changed, 306 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/ruoyi/common/enums/FileNameType.java b/src/main/java/com/ruoyi/common/enums/FileNameType.java
index 16d51f6..55cc472 100644
--- a/src/main/java/com/ruoyi/common/enums/FileNameType.java
+++ b/src/main/java/com/ruoyi/common/enums/FileNameType.java
@@ -11,7 +11,8 @@
     MEASURING(5),  //璁¢噺鍣ㄥ叿鍙拌处
     MEASURINGRecord(6),//璁¢噺鍣ㄥ叿鍙拌处璁板綍
     ApproveNode(7),  //鍗忓悓瀹℃壒鑺傜偣瀹℃牳
-    ApproveProcess(8);  //鍗忓悓瀹℃壒涓绘暟鎹�
+    ApproveProcess(8),
+    Inventory(9);  //鍗忓悓瀹℃壒涓绘暟鎹�
 
     private final int value;
 
diff --git a/src/main/java/com/ruoyi/other/pojo/TempFile.java b/src/main/java/com/ruoyi/other/pojo/TempFile.java
index bff7805..ab36da3 100644
--- a/src/main/java/com/ruoyi/other/pojo/TempFile.java
+++ b/src/main/java/com/ruoyi/other/pojo/TempFile.java
@@ -16,5 +16,5 @@
     private String originalName;   // 鍘熷鏂囦欢鍚�
     private String tempPath;       // 涓存椂瀛樺偍璺緞
     private LocalDateTime expireTime; // 杩囨湡鏃堕棿
-    private Integer type;       // 鍏宠仈琛ㄧ被鍨�
+    private Integer type;       // 鍏宠仈琛ㄧ被鍨� 9-搴撳瓨
 }
diff --git a/src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java b/src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java
index 40098d5..6f39755 100644
--- a/src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java
+++ b/src/main/java/com/ruoyi/other/service/impl/TempFileServiceImpl.java
@@ -155,7 +155,7 @@
         }
     }
 
-    @Scheduled(cron = "0 0 3 * * ?") // 姣忓ぉ鍑屾櫒3鐐规墽琛�
+//    @Scheduled(cron = "0 0 3 * * ?") // 姣忓ぉ鍑屾櫒3鐐规墽琛�
     public void cleanupExpiredTempFiles() {
         LambdaQueryWrapper<TempFile> wrapper = new LambdaQueryWrapper<>();
         wrapper.lt(TempFile::getExpireTime, LocalDateTime.now()); // expireTime < 褰撳墠鏃堕棿
diff --git a/src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java b/src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java
index c9930a2..9aa7fd7 100644
--- a/src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java
+++ b/src/main/java/com/ruoyi/procurementrecord/pojo/CustomStorage.java
@@ -38,6 +38,11 @@
     @Excel(name = "寰呭嚭搴撴暟閲�")
     @TableField(exist = false)
     private BigDecimal inboundNum0;
+
+    /**
+     * 鍥剧墖
+     */
+    private String url;
     /**
      * 鍑哄簱鏁伴噺
      */
diff --git a/src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java
index 06bd40e..de64eb4 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java
@@ -2,6 +2,7 @@
 
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.enums.FileNameType;
 import com.ruoyi.other.mapper.TempFileMapper;
 import com.ruoyi.other.pojo.TempFile;
 import com.ruoyi.sales.mapper.CommonFileMapper;
@@ -133,7 +134,6 @@
                 Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING);
                 Files.deleteIfExists(Paths.get(tempFile.getTempPath()));
                 log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
-
                 // 鏇存柊鏂囦欢璁板綍锛堝叧鑱斿埌涓氬姟ID锛�
                 CommonFile fileRecord = new CommonFile();
                 fileRecord.setCommonId(businessId);
diff --git a/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml b/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
index c378c6a..6119edd 100644
--- a/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ProcurementRecordMapper.xml
@@ -42,6 +42,8 @@
         t2.tax_inclusive_unit_price,
         (t1.inbound_num * t2.tax_inclusive_unit_price) as taxInclusiveTotalPrice,
         (t1.inbound_num * t2.tax_inclusive_unit_price - t1.inbound_num * t2.tax_inclusive_unit_price * t2.tax_rate / 100) as taxExclusiveTotalPrice,
+        t1.unit_price,
+        t1.total_price,
         t1.inbound_batches,
         t1.inbound_num,
         t1.inbound_num as inboundNum0,
@@ -50,17 +52,21 @@
         t1.create_by,
         t2.warn_num
         from  procurement_record_storage t1
-                  left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
+                  left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2
                   left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
         <where>
-            1 = 1
+            t1.type = 1
             <if test="req.supplierName != null and req.supplierName != ''">
                 and t3.supplier_name like  concat('%',#{req.supplierName},'%')
+            </if>
+            <if test="req.productCategory != null and req.productCategory != ''">
+                and t2.product_category like  concat('%',#{req.productCategory},'%')
             </if>
             <if test="req.timeStr != null and req.timeStr != ''">
                 and t1.create_time like  concat('%',#{req.timeStr},'%')
             </if>
         </where>
+        order by t1.create_time desc
     </select>
     <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto">
         select
@@ -84,6 +90,32 @@
         from  procurement_record_storage t1
                   left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
                   left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
+                where t1.type = 1
+    </select>
+    <select id="listOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto">
+        select
+            t3.customer_contract_no,
+            t3.sales_contract_no,
+            t3.customer_name,
+            t2.product_category,
+            t1.id,
+            t2.specification_model,
+            t2.unit,
+            t2.quantity,
+            t2.quantity as quantity0,
+            t2.tax_rate,
+            t2.tax_inclusive_unit_price,
+            t2.tax_inclusive_total_price,
+            t2.tax_exclusive_total_price,
+            t1.inbound_batches,
+            t1.inbound_num,
+            t1.create_time,
+            t1.create_time as time,
+            t1.create_by
+        from  procurement_record_storage t1
+            left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
+            left join sales_ledger t3 on t3.id = t2.sales_ledger_id
+        where t1.type = 2
     </select>
     <select id="listPageCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
         select
@@ -101,20 +133,24 @@
         t2.tax_inclusive_total_price,
         t2.tax_exclusive_total_price,
         t1.inbound_batches,
+        t1.unit_price as unitPrice,
+        sum(t1.total_price) as totalPrice,
         sum(t1.inbound_num) as inboundNum,
         sum(t1.inbound_num) as inboundNum0,
-        t1.inbound_num as totalInboundNum,
         t1.create_time,
         t1.update_time,
         t1.create_by,
         t2.warn_num
         from  procurement_record_storage t1
-        left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
+        left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2
         left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
         <where>
-            1 = 1
+            t1.type = 1
             <if test="req.supplierName != null and req.supplierName != ''">
                 and t3.supplier_name like  concat('%',#{req.supplierName},'%')
+            </if>
+            <if test="req.productCategory != null and req.productCategory != ''">
+                and t2.product_category like  concat('%',#{req.productCategory},'%')
             </if>
             <if test="req.timeStr != null and req.timeStr != ''">
                 and t1.create_time like  concat('%',#{req.timeStr},'%')
@@ -135,7 +171,8 @@
                 and t1.create_time &lt;= #{req.endDate}
             </if>
         </where>
-        group by t3.supplier_name,t2.product_category,t2.specification_model
+        group by t2.product_category,t2.specification_model,t1.unit_price
+        order by t1.create_time desc
     </select>
     <select id="listCopy" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
         select
@@ -160,7 +197,137 @@
             t1.update_time as uTime,
             t1.create_by
         from  procurement_record_storage t1
-                  left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
+                  left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2
                   left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
+        where t1.type = 1
+        group by t3.supplier_name,t2.product_category,t2.specification_model
+    </select>
+    <select id="listCopyOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
+        select
+            t3.customer_contract_no,
+            t3.sales_contract_no,
+            t3.customer_name,
+            t2.product_category,
+            t1.id,
+            t1.sales_ledger_product_id,
+            t1.create_user,
+            t2.specification_model,
+            t2.unit,
+            t2.tax_rate,
+            t2.tax_inclusive_unit_price,
+            t2.tax_inclusive_total_price,
+            t2.tax_exclusive_total_price,
+            t1.inbound_batches,
+            t1.inbound_num,
+            t1.inbound_num as inboundNum0,
+            t1.create_time,
+            t1.update_time,
+            t1.create_time as cTime,
+            t1.update_time as uTime,
+            t1.create_by
+        from  procurement_record_storage t1
+                  left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1
+                  left join sales_ledger t3 on t3.id = t2.sales_ledger_id
+        where t1.type = 2
+        group by t3.customer_name,t2.product_category,t2.specification_model
+    </select>
+    <select id="listPageByProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDto">
+        select
+        t3.customer_contract_no,
+        t3.sales_contract_no,
+        t3.customer_name,
+        t2.product_category,
+        t1.id,
+        t1.sales_ledger_product_id,
+        t1.create_user,
+        t2.specification_model,
+        t2.unit,
+        t2.tax_rate,
+        t2.tax_inclusive_unit_price,
+        (t1.inbound_num * t2.tax_inclusive_unit_price) as taxInclusiveTotalPrice,
+        (t1.inbound_num * t2.tax_inclusive_unit_price - t1.inbound_num * t2.tax_inclusive_unit_price * t2.tax_rate / 100) as taxExclusiveTotalPrice,
+        t1.unit_price,
+        t1.total_price,
+        t1.inbound_batches,
+        t1.inbound_num,
+        t1.inbound_num as inboundNum0,
+        t1.create_time,
+        t1.update_time,
+        t1.create_by,
+        t2.warn_num
+        from  procurement_record_storage t1
+        left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1
+        left join sales_ledger t3 on t3.id = t2.sales_ledger_id
+        <where>
+            t1.type = 2
+            <if test="req.customerName != null and req.customerName != ''">
+                and t3.customer_name like  concat('%',#{req.customerName},'%')
+            </if>
+            <if test="req.productCategory != null and req.productCategory != ''">
+                and t2.product_category like  concat('%',#{req.productCategory},'%')
+            </if>
+            <if test="req.timeStr != null and req.timeStr != ''">
+                and t1.create_time like  concat('%',#{req.timeStr},'%')
+            </if>
+        </where>
+        order by t1.create_time desc
+    </select>
+    <select id="listPageCopyByProduction" resultType="com.ruoyi.procurementrecord.dto.ProcurementPageDtoCopy">
+        select
+        t3.customer_contract_no,
+        t3.sales_contract_no,
+        t3.customer_name,
+        t2.product_category,
+        t1.id,
+        t1.sales_ledger_product_id,
+        t1.create_user,
+        t2.specification_model,
+        t2.unit,
+        t2.min_stock,
+        t2.tax_rate,
+        t2.tax_inclusive_unit_price,
+        t2.tax_inclusive_total_price,
+        t2.tax_exclusive_total_price,
+        t1.inbound_batches,
+        sum(t1.total_price) as totalPrice,
+        t1.unit_price,
+        sum(t1.inbound_num) as inboundNum,
+        sum(t1.inbound_num) as inboundNum0,
+        t1.create_time,
+        t1.update_time,
+        t1.create_by,
+        t2.warn_num
+        from  procurement_record_storage t1
+        left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1
+        left join sales_ledger t3 on t3.id = t2.sales_ledger_id
+        <where>
+            t1.type = 2
+            <if test="req.customerName != null and req.customerName != ''">
+                and t3.customer_name like  concat('%',#{req.customerName},'%')
+            </if>
+            <if test="req.productCategory != null and req.productCategory != ''">
+                and t2.product_category like  concat('%',#{req.productCategory},'%')
+            </if>
+            <if test="req.timeStr != null and req.timeStr != ''">
+                and t1.create_time like  concat('%',#{req.timeStr},'%')
+            </if>
+            <if test="req.reportDate != null">
+                and t1.create_time >= #{req.reportDate} and t1.create_time &lt; DATE_ADD(#{req.reportDate}, INTERVAL 1 DAY)
+            </if>
+            <if test="req.startMonth != null">
+                and t1.create_time >= #{req.startMonth}
+            </if>
+            <if test="req.endMonth != null">
+                and t1.create_time &lt;= #{req.endMonth}
+            </if>
+            <if test="req.startDate != null">
+                and t1.create_time >= #{req.startDate}
+            </if>
+            <if test="req.endDate != null">
+                and t1.create_time &lt;= #{req.endDate}
+            </if>
+        </where>
+        group by t2.product_category,t2.specification_model,t1.unit_price
+        order by t1.create_time desc
     </select>
 </mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml b/src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml
index ec91c53..9330aac 100644
--- a/src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml
+++ b/src/main/resources/mapper/procurementrecord/ProcurementRecordOutMapper.xml
@@ -17,19 +17,26 @@
         t1.inbound_num,
         t1.create_time,
         t1.create_by,
-        t2.warn_num
+        t2.warn_num,
+        t4.unit_price,
+        t4.unit_price *  t1.inbound_num as totalPrice
         from  procurement_record_out t1
-        left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
+        left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 2
         left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
+        left join procurement_record_storage t4 on t4.id = t1.procurement_record_storage_id
         <where>
-            1 = 1
+            and t1.type = 1
             <if test="req.supplierName != null and req.supplierName != ''">
                 and t3.supplier_name like  concat('%',#{req.supplierName},'%')
+            </if>
+            <if test="req.productCategory != null and req.productCategory != ''">
+                and t2.product_category like  concat('%',#{req.productCategory},'%')
             </if>
             <if test="req.timeStr != null and req.timeStr != ''">
                 and t1.create_time like  concat('%',#{req.timeStr},'%')
             </if>
         </where>
+        order by t1.create_time desc
     </select>
     <select id="list" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
         select
@@ -49,5 +56,117 @@
         from  procurement_record_out t1
                   left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
                   left join purchase_ledger t3 on t3.id = t2.sales_ledger_id
+            where t1.type = 1
+    </select>
+
+    <select id="listOne" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+        select
+            t3.customer_contract_no,
+            t3.sales_contract_no,
+            t3.customer_name,
+            t2.product_category,
+            t1.id,
+            t2.specification_model,
+            t2.unit,
+            t2.tax_rate,
+            t2.tax_inclusive_unit_price,
+            t2.tax_inclusive_total_price,
+            t2.tax_exclusive_total_price,
+            t1.inbound_num,
+            t1.create_time,
+            t1.create_time as time,
+            t1.create_by
+        from  procurement_record_out t1
+            left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id
+            left join sales_ledger t3 on t3.id = t2.sales_ledger_id
+        where t1.type = 2
+    </select>
+
+    <select id="listTwo" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+        select
+            t1.supplier_name,
+            t1.product_category,
+            t1.id,
+            t1.specification_model,
+            t1.unit,
+            t1.tax_rate,
+            t1.tax_inclusive_unit_price,
+            t1.tax_inclusive_total_price,
+            t1.tax_exclusive_total_price,
+            t1.inbound_num,
+            t1.create_time,
+            t1.create_time as time,
+            t1.create_by
+        from  procurement_record_out t1
+        where t1.type = 3
+    </select>
+    <select id="listPageByProduct" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+        select
+        t3.customer_contract_no,
+        t3.sales_contract_no,
+        t3.customer_name,
+        t2.product_category,
+        t1.id,
+        t1.code,
+        t2.specification_model,
+        t2.unit,
+        t2.tax_rate,
+        t2.tax_inclusive_unit_price,
+        t2.tax_inclusive_total_price,
+        t2.tax_exclusive_total_price,
+        t1.inbound_num,
+        t1.create_time,
+        t1.create_by,
+        t4.unit_price,
+        t4.unit_price *  t1.inbound_num as totalPrice
+        from  procurement_record_out t1
+        left join sales_ledger_product t2 on t2.id = t1.sales_ledger_product_id and t2.type = 1
+        left join sales_ledger t3 on t3.id = t2.sales_ledger_id
+        left join procurement_record_storage t4 on t4.id = t1.procurement_record_storage_id
+        <where>
+            and t1.type = 2
+            <if test="req.customerName != null and req.customerName != ''">
+                and t3.customer_name like  concat('%',#{req.customerName},'%')
+            </if>
+            <if test="req.productCategory != null and req.productCategory != ''">
+                and t2.product_category like  concat('%',#{req.productCategory},'%')
+            </if>
+            <if test="req.timeStr != null and req.timeStr != ''">
+                and t1.create_time like  concat('%',#{req.timeStr},'%')
+            </if>
+        </where>
+        order by t1.create_time desc
+    </select>
+    <select id="listPageByCustom" resultType="com.ruoyi.procurementrecord.dto.ProcurementRecordOutPageDto">
+        select
+        t2.supplier_name,
+        t2.product_category,
+        t1.id,
+        t1.code,
+        t2.specification_model,
+        t2.unit,
+        t2.tax_rate,
+        t2.tax_inclusive_unit_price,
+        t2.tax_inclusive_unit_price * t1.inbound_num as totalPrice,
+        t2.tax_exclusive_total_price,
+        t1.inbound_num,
+        t1.create_time,
+        t1.create_by,
+        t2.item_type
+        from  procurement_record_out t1
+        left join custom_storage t2 on t2.id = t1.procurement_record_storage_id
+        <where>
+            t1.type = 3
+            <if test="req.supplierName != null and req.supplierName != ''">
+                and t2.supplier_name like  concat('%',#{req.supplierName},'%')
+            </if>
+            <if test="req.productCategory != null and req.productCategory != ''">
+                and t2.product_category like  concat('%',#{req.productCategory},'%')
+            </if>
+            <if test="req.timeStr != null and req.timeStr != ''">
+                and t1.create_time like  concat('%',#{req.timeStr},'%')
+            </if>
+        </where>
+        order by t1.create_time desc
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3