From 5d4ebe6d0b7dda230b19f4913bdeb60556b46678 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 13 十月 2025 18:33:47 +0800
Subject: [PATCH] bug修改

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java |    4 +-
 ruoyi-system/src/main/java/com/ruoyi/system/query/TSysGoodsExchangeQuery.java                    |   27 +++++++++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java                  |   41 ++++++++++++++++++--
 ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java                         |    4 ++
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java   |    4 +-
 5 files changed, 71 insertions(+), 9 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
index 612a601..14a8778 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
@@ -10,17 +10,13 @@
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.framework.web.service.TokenService;
 import com.ruoyi.system.dto.TErpGoodsUpdateStatusDto;
-import com.ruoyi.system.dto.UpdateStatusProcurementDto;
 import com.ruoyi.system.model.*;
+import com.ruoyi.system.query.TSysGoodsExchangeQuery;
 import com.ruoyi.system.query.TSysGoodsQuery;
-import com.ruoyi.system.query.TSysOrderQuery;
 import com.ruoyi.system.service.*;
-import com.ruoyi.system.vo.TErpGoodsVO;
-import com.ruoyi.system.vo.TSysOrderPageVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.parameters.P;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
@@ -181,5 +177,40 @@
         return R.ok();
     }
 
+
+    // 获取兑换记录
+    @ApiOperation(value = "获取兑换记录")
+    @PostMapping(value = "/getExchangeRecord")
+    public R<PageInfo<TSysGoodsExchange>> getExchangeRecord(@RequestBody @Valid TSysGoodsExchangeQuery query) {
+        PageInfo<TSysGoodsExchange> page = new PageInfo<>(query.getPageNum(), query.getPageSize());
+        LambdaQueryWrapper<TSysGoodsExchange> wrapper = new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getGoodsId, query.getId());
+        if(query.getClinicName()!=null && !query.getClinicName().isEmpty()){
+            wrapper.like(TSysGoodsExchange::getClinicName, query.getClinicName());
+        }
+        if(query.getTime()!=null && !query.getTime().isEmpty()){
+            wrapper.between(TSysGoodsExchange::getCreateTime, query.getTime().split(" - ")[0]+ " 00:00:00", query.getTime().split(" - ")[1]+ " 23:59:59");
+        }
+        if(query.getStatus()!=null){
+            wrapper.eq(TSysGoodsExchange::getStatus, query.getStatus());
+        }
+        wrapper.orderByDesc(BaseModel::getCreateTime);
+        PageInfo<TSysGoodsExchange> page1 = sysGoodsExchangeService.page(page, wrapper);
+        return R.ok(page1);
+    }
+
+    // 获取兑换记录
+    @ApiOperation(value = "发货")
+    @PostMapping(value = "/sendGoods")
+    public R<?> sendGoods(@RequestBody @Valid TSysGoodsExchange exchange) {
+        TSysGoodsExchange exchange1 = sysGoodsExchangeService.getById(exchange.getId());
+        if(exchange1.getStatus()==2){
+            return R.fail("该订单已发货");
+        }
+        exchange1.setStatus(2);
+        exchange1.setLogisticsNumber(exchange1.getLogisticsNumber());
+        sysGoodsExchangeService.updateById(exchange1);
+        return R.ok();
+    }
+
 }
 
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java
index e33d2e7..1d5adde 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/TSysGoodsExchange.java
@@ -59,4 +59,8 @@
     @TableField("status")
     private Integer status;
 
+    @ApiModelProperty(value = "物流单号")
+    @TableField("logistics_number")
+    private String logisticsNumber;
+
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/TSysGoodsExchangeQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/TSysGoodsExchangeQuery.java
new file mode 100644
index 0000000..9a97d46
--- /dev/null
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/TSysGoodsExchangeQuery.java
@@ -0,0 +1,27 @@
+package com.ruoyi.system.query;
+
+import com.ruoyi.common.core.domain.BasePage;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+@ApiModel("兑换记录")
+public class TSysGoodsExchangeQuery extends BasePage {
+
+    @ApiModelProperty("商品id")
+    @NotBlank(message = "商品id不能为空")
+    private String id;
+    @ApiModelProperty("诊所名称")
+    private String clinicName;
+
+    @ApiModelProperty("兑换时间 2022-02-02 - 2023-02-02")
+    private String time;
+
+    @ApiModelProperty("状态 1=未发货 2=已发货")
+    private Integer status;
+}
+
+
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
index 2f8390a..742bfa3 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java
@@ -226,11 +226,11 @@
                         inventoryDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
 
 
-                        List<TErpClinicWarehousingBatch> tErpSupplierWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getBatchNumber, tErpSupplierWarehousingBatch.getBatchNumber()));
+                        List<TErpClinicWarehousingBatch> tErpSupplierWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getId, outboundGoods.getWarehousingBatchId()));
                         int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpClinicWarehousingBatch::getWarehousingNumber).sum();
                         List<String> collect = tErpSupplierWarehousingBatches.stream().map(TErpClinicWarehousingBatch::getId).collect(Collectors.toList());
                         if(!collect.isEmpty()){
-                            List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods1 = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getWarehousingBatchId, collect));
+                            List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods1 = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().in(TErpClinicOutboundGoods::getWarehousingBatchId, collect));
                             int sum1 = tErpSupplierOutboundGoods1.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum();
                             sum = sum-sum1;
                         }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
index 0cb18bd..1ee8e03 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
@@ -483,11 +483,11 @@
                         inventoryDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber());
 
 
-                        List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousingBatch>().eq(TErpSupplierWarehousingBatch::getBatchNumber, tErpSupplierWarehousingBatch.getBatchNumber()));
+                        List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousingBatch>().eq(TErpSupplierWarehousingBatch::getId, tErpSupplierOutboundGoods2.getWarehousingBatchId()));
                         int sum = tErpSupplierWarehousingBatches.stream().mapToInt(TErpSupplierWarehousingBatch::getWarehousingNumber).sum();
                         List<String> collect = tErpSupplierWarehousingBatches.stream().map(TErpSupplierWarehousingBatch::getId).collect(Collectors.toList());
                         if(!collect.isEmpty()){
-                            List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods1 = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getWarehousingBatchId, collect));
+                            List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods1 = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().in(TErpSupplierOutboundGoods::getWarehousingBatchId, collect));
                             int sum1 = tErpSupplierOutboundGoods1.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum();
                             sum = sum-sum1;
                         }

--
Gitblit v1.7.1