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(); } } 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; } ruoyi-system/src/main/java/com/ruoyi/system/query/TSysGoodsExchangeQuery.java
New file @@ -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; } 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; } 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; }