From 00957f0c836b80d9052a6ccf673d3b454b646081 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期一, 29 九月 2025 18:17:54 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java | 4 ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierWarehousingBatch.java | 1 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java | 19 +++ ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpClinicWarehousingMapper.java | 2 ruoyi-system/src/main/java/com/ruoyi/system/vo/PageInventoryListVo.java | 3 ruoyi-system/src/main/resources/mapper/system/TErpIssueReportingMapper.xml | 4 ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml | 12 + ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpMaintenanceReminderMapper.java | 1 ruoyi-system/src/main/java/com/ruoyi/system/query/TErpInventoryQuery.java | 3 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpIssueReportingController.java | 16 ++ ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java | 4 ruoyi-system/src/main/java/com/ruoyi/system/vo/OutboundGoodsDetailVo.java | 3 ruoyi-system/src/main/java/com/ruoyi/system/query/TErpIssueReportingQuery.java | 1 ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryDetailVo.java | 3 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java | 35 +++++ ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsAdminQuery.java | 28 ++++ ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java | 8 + ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml | 50 +++++++ ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java | 22 +++ ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpClinicWarehousingServiceImpl.java | 73 ++++++++++++ ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml | 36 ++++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java | 18 ++ 22 files changed, 330 insertions(+), 16 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java index 73441fe..3d3cd00 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpGoodsController.java @@ -22,6 +22,7 @@ import com.ruoyi.system.dto.*; import com.ruoyi.system.importExcel.TErpGoodsExcel; import com.ruoyi.system.model.*; +import com.ruoyi.system.query.TErpGoodsAdminQuery; import com.ruoyi.system.query.TErpGoodsQuery; import com.ruoyi.system.service.*; import com.ruoyi.system.vo.TErpGoodsVO; @@ -115,6 +116,21 @@ query.setSupplierClinicId(crmClinic.getId()); } return R.ok(erpGoodsService.pageList(query,user)); + } + + /** + * 获取erp问题上报管理列表 + */ + @ApiOperation(value = "平台获取商品分页列表") + @PostMapping(value = "/pageAdminList") + public R<PageInfo<TErpGoodsVO>> pageAdminList(@RequestBody TErpGoodsAdminQuery query) { + SysUser user = tokenService.getLoginUser().getUser(); + Integer roleType = user.getRoleType(); + if(roleType == 1){ + // 平台 + return R.ok(erpGoodsService.pageAdminList(query)); + } + return R.ok(); } @@ -417,7 +433,7 @@ return R.ok(erpGoodsService.updateById(goods)); } - @ApiOperation(value = "供应商商品详情") + @ApiOperation(value = "商品详情") @GetMapping(value = "/detail/{id}") public R<TErpGoods> detail( @PathVariable String id) { TErpGoods goods = erpGoodsService.getById(id); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpIssueReportingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpIssueReportingController.java index 3066075..97efe19 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpIssueReportingController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpIssueReportingController.java @@ -59,6 +59,22 @@ @ApiOperation(value = "获取erp问题上报分页列表") @PostMapping(value = "/pageList") public R<PageInfo<TErpIssueReportingVO>> pageList(@RequestBody TErpIssueReportingQuery query) { + Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); + Long userId = tokenService.getLoginUser().getUserId(); + if(roleType == 4){ + query.setReportType(1); + TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) + .eq(TCrmSupplier::getUserId, userId) + .last("LIMIT 1")); + query.setReportUserId(crmSupplier.getId()); + } + if(roleType == 5){ + query.setReportType(2); + TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) + .eq(TCrmClinic::getUserId, userId) + .last("LIMIT 1")); + query.setReportUserId(crmClinic.getId()); + } return R.ok(erpIssueReportingService.pageList(query)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java index 1cf9c4e..76a45c9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpProcurementController.java @@ -27,6 +27,7 @@ import javax.validation.Valid; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -54,12 +55,13 @@ private final TErpClinicWarehousingService erpClinicWarehousingService; private final TErpClinicWarehousingBatchService erpClinicWarehousingBatchService; private final TCrmSupplierService crmSupplierService; + private final TErpMaintenanceReminderService erpMaintenanceReminderService; @Autowired public TErpProcurementController(TErpProcurementService erpProcurementService, TokenService tokenService,TCrmClinicService crmClinicService,TErpProcurementGoodsService erpProcurementGoodsService , TErpGoodsService erpGoodsService,TErpClinicWarehousingService erpClinicWarehousingService,TErpClinicWarehousingBatchService erpClinicWarehousingBatchService, - TCrmSupplierService crmSupplierService) { + TCrmSupplierService crmSupplierService,TErpMaintenanceReminderService erpMaintenanceReminderService) { this.erpProcurementService = erpProcurementService; this.tokenService = tokenService; this.crmClinicService = crmClinicService; @@ -68,6 +70,7 @@ this.erpClinicWarehousingService = erpClinicWarehousingService; this.erpClinicWarehousingBatchService = erpClinicWarehousingBatchService; this.crmSupplierService = crmSupplierService; + this.erpMaintenanceReminderService = erpMaintenanceReminderService; } @@ -248,6 +251,20 @@ tErpClinicWarehousingGoods.setSalesAmount(tErpProcurementGoods.getSalesAmount()); erpClinicWarehousingBatchService.save(tErpClinicWarehousingGoods); + + if(erpGoods.getMaintenanceInterval()!=null){ + TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); + tErpMaintenanceReminder.setClinicSupplierId(clinicSupplierId); + tErpMaintenanceReminder.setMaintenanceType(2); + tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingGoods.getId()); + Integer day = Integer.valueOf(erpGoods.getMaintenanceInterval()); + // 当前时间+day天 + LocalDateTime time1 = LocalDateTime.now().plusDays(day); + tErpMaintenanceReminder.setMaintenanceTime(time1); + erpMaintenanceReminderService.save(tErpMaintenanceReminder); + } + + } return R.ok(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpClinicWarehousingMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpClinicWarehousingMapper.java index 1a85ba5..0e69f6c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpClinicWarehousingMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpClinicWarehousingMapper.java @@ -24,7 +24,7 @@ List<PageInventoryListVo> pageInventoryList(@Param("pageInfo") PageInfo<PageInventoryListVo> pageInfo, @Param("query") TErpInventoryQuery query, @Param("user") SysUser user, @Param("sTime") String sTime, @Param("eTime") String eTime, @Param("supplierClinicId") String supplierClinicId); - PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(@Param("pageInfo") PageInfo<ValidityPeriodWarningVo> pageInfo, @Param("query") ValidityPeriodWarningQuery query, @Param("user") SysUser user, @Param("nineMonthLater") LocalDateTime nineMonthLater, @Param("supplierClinicId") String supplierClinicId); + PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(@Param("pageInfo") PageInfo<ValidityPeriodWarningVo> pageInfo, @Param("query") ValidityPeriodWarningQuery query, @Param("user") SysUser user, @Param("time") LocalDateTime nineMonthLater, @Param("supplierClinicId") String supplierClinicId); List<TErpGoodsVO> pageList(@Param("query") TErpGoodsQuery query, @Param("pageInfo") PageInfo<TErpGoodsVO> pageInfo, @Param("user") SysUser user); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java index c3e9b0e..ba1ec8d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpGoodsMapper.java @@ -4,6 +4,7 @@ import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.system.model.TErpGoods; +import com.ruoyi.system.query.TErpGoodsAdminQuery; import com.ruoyi.system.query.TErpGoodsInventoryQuery; import com.ruoyi.system.query.TErpGoodsQuery; import com.ruoyi.system.vo.TErpGoodsInventoryVO; @@ -37,5 +38,8 @@ List<TErpGoodsInventoryVO> pageInventoryGoodsPageList1(@Param("query") TErpGoodsInventoryQuery query, @Param("pageInfo") PageInfo<TErpGoodsInventoryVO> pageInfo, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("endDate") Date endDate); + TErpGoods getGoodsById(@Param("goodsId") String goodsId); + + List<TErpGoodsVO> pageAdminList(@Param("query") TErpGoodsAdminQuery query, @Param("pageInfo") PageInfo<TErpGoodsVO> pageInfo); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpMaintenanceReminderMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpMaintenanceReminderMapper.java index 295551f..35133bc 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpMaintenanceReminderMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/TErpMaintenanceReminderMapper.java @@ -22,4 +22,5 @@ public interface TErpMaintenanceReminderMapper extends BaseMapper<TErpMaintenanceReminder> { List<TErpMaintenanceReminderListVo> pageList(@Param("page") PageInfo<TErpMaintenanceReminderListVo> page, @Param("query") TErpMaintenanceReminderQuery query, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("tomorrow") LocalDateTime tomorrow ); + List<TErpMaintenanceReminderListVo> pageList1(@Param("page") PageInfo<TErpMaintenanceReminderListVo> page, @Param("query") TErpMaintenanceReminderQuery query, @Param("user") SysUser user, @Param("supplierClinicId") String supplierClinicId, @Param("tomorrow") LocalDateTime tomorrow ); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierWarehousingBatch.java b/ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierWarehousingBatch.java index 0bdeaf6..9b77c58 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierWarehousingBatch.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/model/TErpSupplierWarehousingBatch.java @@ -54,6 +54,7 @@ @TableField("expiry_date") private LocalDateTime expiryDate; + @TableField(exist = false) private String goodsId; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsAdminQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsAdminQuery.java new file mode 100644 index 0000000..f1042c6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpGoodsAdminQuery.java @@ -0,0 +1,28 @@ +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; + +@Data +@ApiModel(value = "erp商品平台查询参数query") +public class TErpGoodsAdminQuery extends BasePage { + + @ApiModelProperty(value = "供应商名称") + private String supplierName; + + @ApiModelProperty(value = "商品名称") + private String goodsName; + + @ApiModelProperty(value = "商品类型id") + private String typeId; + + @ApiModelProperty(value = "国药准字号") + private String quasiNumber; + + + @ApiModelProperty(value = "1启用 2禁用") + private Integer state; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpInventoryQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpInventoryQuery.java index a8aa496..845d5b9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpInventoryQuery.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpInventoryQuery.java @@ -18,4 +18,7 @@ @ApiModelProperty(value = "操作时间 2022-02-02 - 2023-06-06") private String time; + @ApiModelProperty(value = "盘点单号") + private String inventoryNumber; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpIssueReportingQuery.java b/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpIssueReportingQuery.java index 5a28c1e..350d978 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpIssueReportingQuery.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/query/TErpIssueReportingQuery.java @@ -30,4 +30,5 @@ @ApiModelProperty(value = "处理人") private String handlerPerson; + private String reportUserId; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java index 4213712..69a61ff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/TErpGoodsService.java @@ -8,6 +8,7 @@ import com.ruoyi.system.dto.InventoryGoodsDto; import com.ruoyi.system.model.TErpGoods; import com.ruoyi.system.query.TClinicGoodsWarehouseQuery; +import com.ruoyi.system.query.TErpGoodsAdminQuery; import com.ruoyi.system.query.TErpGoodsInventoryQuery; import com.ruoyi.system.query.TErpGoodsQuery; import com.ruoyi.system.vo.OutboundGoodsDetailVo; @@ -75,4 +76,7 @@ PageInfo<TErpGoodsVO> pageList1(TErpGoodsQuery query, SysUser user); + PageInfo<TErpGoodsVO> pageAdminList(TErpGoodsAdminQuery query); + + } 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 fc7aad7..badeda8 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 @@ -13,6 +13,7 @@ import com.ruoyi.system.mapper.*; import com.ruoyi.system.model.*; import com.ruoyi.system.query.*; +import com.ruoyi.system.service.TCrmSupplierService; import com.ruoyi.system.service.TErpClinicWarehousingService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.system.vo.*; @@ -68,6 +69,11 @@ @Resource private TErpGoodsTypeMapper erpGoodsTypeMapper; + @Resource + private TErpMaintenanceReminderMapper erpMaintenanceReminderMapper; + + @Resource + private TCrmSupplierMapper crmSupplierMapper; @Override @@ -162,6 +168,16 @@ TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(tErpSupplierInventoryGood.getWarehousingId()); String goodsId = tErpSupplierInventoryGood.getGoodsId(); TErpGoods goods = erpGoodsMapper.selectById(goodsId); + + if(goods.getGoodsSource()==1){ + TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId()); + if(supplier!=null){ + inventoryDetailVo.setSupplierName(supplier.getSupplierName()); + } + }else { + inventoryDetailVo.setSupplierName(goods.getSupplierName()); + } + inventoryDetailVo.setGoodsName(goods.getGoodsName()); TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); @@ -183,6 +199,49 @@ inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount()); inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType()); inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount()); + }else { + TErpClinicOutbound tErpSupplierOutbound = erpClinicOutboundMapper.selectById(tErpSupplierInventoryGood.getWarehousingId()); + List<TErpClinicOutboundGoods> tErpSupplierOutboundGoods = erpClinicOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpClinicOutboundGoods>().eq(TErpClinicOutboundGoods::getOutboundId, tErpSupplierOutbound.getId())); + for (TErpClinicOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) { + String warehousingId = tErpSupplierOutboundGood.getWarehousingId(); + TErpClinicWarehousing tErpSupplierWarehousing = erpClinicWarehousingMapper.selectById(warehousingId); + String goodsId = tErpSupplierInventoryGood.getGoodsId(); + TErpGoods goods = erpGoodsMapper.selectById(goodsId); + if(goods.getGoodsSource()==1){ + TCrmSupplier supplier = crmSupplierMapper.selectById(goods.getSupplierClinicId()); + if(supplier!=null){ + inventoryDetailVo.setSupplierName(supplier.getSupplierName()); + } + }else { + inventoryDetailVo.setSupplierName(goods.getSupplierName()); + } + + inventoryDetailVo.setGoodsName(goods.getGoodsName()); + TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); + inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); + inventoryDetailVo.setWarehouseNo(tErpSupplierWarehousing.getWarehouseNo()); + TErpClinicOutboundGoods outboundGoods = erpClinicOutboundGoodsMapper.selectById(tErpSupplierInventoryGood.getWarehousingBatchId()); + + TErpClinicWarehousingBatch tErpSupplierWarehousingBatch = erpClinicWarehousingBatchMapper.selectById(outboundGoods.getWarehousingBatchId()); + inventoryDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); + + + List<TErpClinicWarehousingBatch> tErpSupplierWarehousingBatches = erpClinicWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getBatchNumber, tErpSupplierWarehousingBatch.getBatchNumber())); + 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)); + int sum1 = tErpSupplierOutboundGoods1.stream().mapToInt(TErpClinicOutboundGoods::getOutboundCount).sum(); + sum = sum-sum1; + } + + // sum = 剩余库存 + inventoryDetailVo.setNowCount(sum); + inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount()); + inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType()); + inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount()); + } + } inventoryDetailVos.add(inventoryDetailVo); @@ -336,6 +395,20 @@ tErpClinicWarehousingBatch.setPurchaseCount(dto.getPurchaseCount()); erpClinicWarehousingBatchMapper.insert(tErpClinicWarehousingBatch); + + if(goods.getMaintenanceInterval()!=null){ + TErpMaintenanceReminder tErpMaintenanceReminder = new TErpMaintenanceReminder(); + tErpMaintenanceReminder.setClinicSupplierId(supplierClinicId); + tErpMaintenanceReminder.setMaintenanceType(2); + tErpMaintenanceReminder.setWarehousingBatchId(tErpClinicWarehousingBatch.getId()); + Integer day = Integer.valueOf(goods.getMaintenanceInterval()); + // 当前时间+day天 + LocalDateTime time1 = LocalDateTime.now().plusDays(day); + tErpMaintenanceReminder.setMaintenanceTime(time1); + erpMaintenanceReminderMapper.insert(tErpMaintenanceReminder); + } + + totalPrice = totalPrice.add(dto.getSalesAmount().multiply(new BigDecimal(dto.getPurchaseCount()))); } tErpClinicWarehousing.setTotalPrice(totalPrice); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java index 58a0076..27daf7c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpGoodsServiceImpl.java @@ -14,6 +14,7 @@ import com.ruoyi.system.mapper.*; import com.ruoyi.system.model.*; import com.ruoyi.system.query.TClinicGoodsWarehouseQuery; +import com.ruoyi.system.query.TErpGoodsAdminQuery; import com.ruoyi.system.query.TErpGoodsInventoryQuery; import com.ruoyi.system.query.TErpGoodsQuery; import com.ruoyi.system.service.TErpGoodsService; @@ -128,6 +129,24 @@ } pageInfo.setRecords(list); + return pageInfo; + } + + @Override + public PageInfo<TErpGoodsVO> pageAdminList(TErpGoodsAdminQuery query) { + PageInfo<TErpGoodsVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); + List<TErpGoodsVO> list = this.baseMapper.pageAdminList(query, pageInfo); + if (list.isEmpty()) { + return pageInfo; + } + List<String> typeIds = list.stream().map(TErpGoods::getTypeId).collect(Collectors.toList()); + if (!typeIds.isEmpty()) { + List<TErpGoodsType> typeList = erpGoodsTypeMapper.selectBatchIds(typeIds); + for (TErpGoodsVO tErpGoodsVO : list) { + typeList.stream().filter(t -> t.getId().equals(tErpGoodsVO.getTypeId())).findFirst().ifPresent(t -> tErpGoodsVO.setTypeName(t.getTypeName())); + } + } + pageInfo.setRecords( list); return pageInfo; } @@ -415,6 +434,7 @@ outboundGoodsDetailVo.setCreateBy(tErpClinicOutbound.getCreateBy()); outboundGoodsDetailVo.setOutboundType(tErpClinicOutbound.getOutboundType()); outboundGoodsDetailVo.setOrderNumber(tErpClinicOutbound.getOrderNumber()); + outboundGoodsDetailVo.setOutboundReason(tErpClinicOutbound.getOutboundReason()); if(tErpClinicOutbound.getOutboundType()==6){ TErpClinicInventory tErpClinicInventory = erpClinicInventoryMapper.selectById(tErpClinicOutbound.getInventoryId()); outboundGoodsDetailVo.setInventoryNumber(tErpClinicInventory.getInventoryNumber()); @@ -429,7 +449,7 @@ outboundGoodsDetailNextVo.setWarehouseNo(tErpClinicWarehousing.getWarehouseNo()); outboundGoodsDetailNextVo.setGoodsId(outboundGoods.getGoodsId()); - TErpGoods goods = erpGoodsMapper.selectById(outboundGoods.getGoodsId()); + TErpGoods goods = erpGoodsMapper.getGoodsById(outboundGoods.getGoodsId()); outboundGoodsDetailNextVo.setGoodsName(goods.getGoodsName()); outboundGoodsDetailNextVo.setTypeId(goods.getTypeId()); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java index 84e79c4..f055b0c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpMaintenanceReminderServiceImpl.java @@ -15,6 +15,7 @@ import javax.annotation.Resource; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -79,8 +80,13 @@ // 获取明天的时间 LocalDateTime tomorrow = LocalDateTime.now().plusDays(1); + List<TErpMaintenanceReminderListVo> list=new ArrayList<>(); + if(roleType==4){ + list = baseMapper.pageList(page, query, user,supplierClinicId,tomorrow); + }else { + list = baseMapper.pageList1(page, query, user,supplierClinicId,tomorrow); + } - List<TErpMaintenanceReminderListVo> list = baseMapper.pageList(page, query, user,supplierClinicId,tomorrow); if(list.isEmpty()){ return page; } 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 254a3e1..d7da666 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 @@ -464,6 +464,41 @@ inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount()); inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType()); inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount()); + }else { + TErpSupplierOutbound tErpSupplierOutbound = erpSupplierOutboundMapper.selectById(tErpSupplierInventoryGood.getWarehousingId()); + List<TErpSupplierOutboundGoods> tErpSupplierOutboundGoods = erpSupplierOutboundGoodsMapper.selectList(new LambdaQueryWrapper<TErpSupplierOutboundGoods>().eq(TErpSupplierOutboundGoods::getOutboundId, tErpSupplierOutbound.getId())); + for (TErpSupplierOutboundGoods tErpSupplierOutboundGood : tErpSupplierOutboundGoods) { + String warehousingId = tErpSupplierOutboundGood.getWarehousingId(); + TErpSupplierWarehousing tErpSupplierWarehousing = erpSupplierWarehousingMapper.selectById(warehousingId); + String goodsId = tErpSupplierWarehousing.getGoodsId(); + TErpGoods goods = erpGoodsMapper.selectById(goodsId); + inventoryDetailVo.setGoodsName(goods.getGoodsName()); + TErpGoodsUnit tErpGoodsUnit = erpGoodsUnitMapper.selectById(goods.getPackingUnitId()); + inventoryDetailVo.setUnitName(tErpGoodsUnit.getUnitName()); + inventoryDetailVo.setWarehouseNo(tErpSupplierWarehousing.getWarehouseNo()); + + TErpSupplierOutboundGoods tErpSupplierOutboundGoods2 = erpSupplierOutboundGoodsMapper.selectById(tErpSupplierInventoryGood.getWarehousingBatchId()); + + TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = erpSupplierWarehousingBatchMapper.selectById(tErpSupplierOutboundGoods2.getWarehousingBatchId()); + inventoryDetailVo.setBatchNumber(tErpSupplierWarehousingBatch.getBatchNumber()); + + + List<TErpSupplierWarehousingBatch> tErpSupplierWarehousingBatches = erpSupplierWarehousingBatchMapper.selectList(new LambdaQueryWrapper<TErpSupplierWarehousingBatch>().eq(TErpSupplierWarehousingBatch::getBatchNumber, tErpSupplierWarehousingBatch.getBatchNumber())); + 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)); + int sum1 = tErpSupplierOutboundGoods1.stream().mapToInt(TErpSupplierOutboundGoods::getOutboundCount).sum(); + sum = sum-sum1; + } + + // sum = 剩余库存 + inventoryDetailVo.setNowCount(sum); + inventoryDetailVo.setInventoryCount(tErpSupplierInventoryGood.getInventoryCount()); + inventoryDetailVo.setInventoryType(tErpSupplierInventoryGood.getInventoryType()); + inventoryDetailVo.setDamagedCount(tErpSupplierInventoryGood.getDamagedCount()); + } + } inventoryDetailVos.add(inventoryDetailVo); diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryDetailVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryDetailVo.java index c57dfdd..90bdfd5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryDetailVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/InventoryDetailVo.java @@ -39,5 +39,8 @@ @ApiModelProperty(value = "破损数量") private Integer damagedCount; + @ApiModelProperty(value = "供应商名称") + private String supplierName; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/OutboundGoodsDetailVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/OutboundGoodsDetailVo.java index ff3f89a..77e89c8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/OutboundGoodsDetailVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/OutboundGoodsDetailVo.java @@ -31,6 +31,9 @@ @ApiModelProperty(value = "订单号") private String orderNumber; + @ApiModelProperty(value = "出库原因") + private String outboundReason; + @ApiModelProperty(value = "出库商品") private List<OutboundGoodsDetailNextVo> list; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/vo/PageInventoryListVo.java b/ruoyi-system/src/main/java/com/ruoyi/system/vo/PageInventoryListVo.java index b0724a7..c6e418c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/vo/PageInventoryListVo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/vo/PageInventoryListVo.java @@ -16,6 +16,9 @@ @ApiModelProperty(value = "盘点id") private String id; + @ApiModelProperty(value = "盘点单号") + private String inventoryNumber; + @ApiModelProperty(value = "仓库名称") diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml index 339e59e..3d21851 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TErpClinicWarehousingMapper.xml @@ -27,12 +27,14 @@ id, procurement_id, clinic_id, goods_id, goods_name, supplier_name, quasi_number, sales_amount, purchase_count, total_price, warehousing_type, create_time, update_time, create_by, update_by, disabled </sql> <select id="pageInventoryList" resultType="com.ruoyi.system.vo.PageInventoryListVo"> - select t1.id,t1.create_time,t2.user_name createBy,t3.warehouse_name + select t1.id,t1.create_time,t2.user_name createBy,t1.inventory_number from t_erp_clinic_inventory t1 left join sys_user t2 on t1.create_id = t2.user_id - left join t_crm_warehouse t3 on t1.warehouse_id =t3.id where t1.disabled = 0 <if test="user.roleType !=null and user.roleType ==5"> and t1.clinic_id = #{supplierClinicId} + </if> + <if test="query.inventoryNumber !=null and query.inventoryNumber !=''"> + and t1.inventory_number like concat('%',#{query.inventoryNumber},'%') </if> <if test="query.createBy != null and query.createBy != ''"> and t2.user_name like concat('%',#{query.createBy},'%') @@ -53,7 +55,7 @@ from t_erp_clinic_warehousing_batch t1 left join t_erp_clinic_warehousing t2 on t1.warehousing_id = t2.id LEFT JOIN t_erp_clinic_outbound_goods t3 on t3.warehousing_batch_id = t1.id - LEFT JOIN t_erp_goods t4 on t2.goods_id = t4.id + LEFT JOIN t_erp_goods t4 on t1.goods_id = t4.id left join t_erp_goods_type t5 on t4.type_id = t5.id left join t_erp_goods_unit t6 on t4.packing_unit_id = t6.id where #{time} > t1.expiry_date @@ -147,7 +149,7 @@ <select id="outboundPageList" resultType="com.ruoyi.system.vo.TErpClinicOutboundPageListVO"> select t1.id,t1.outbound_number,t1.order_number,t1.total_money allTotalPrice,t1.create_time ,t1.outbound_type,t2.user_name,t1.type_num from t_erp_clinic_outbound t1 left join sys_user t2 on t1.create_by = t2.user_id - where t1.disabled = 0 and t1.clinic_id = #{query.supplierClinicId} + where t1.disabled = 0 and t1.clinic_id = #{supplierClinicId} <if test="query.outboundNumber != null and query.outboundNumber != ''"> and t1.outbound_number like concat('%',#{query.outboundNumber},'%') </if> @@ -157,7 +159,7 @@ <if test="query.userName != null and query.userName !=''"> and t2.user_name like concat('%',#{query.userName},'%') </if> - <if test="type != null"> + <if test="query.type != null"> and t1.outbound_type = #{query.type} </if> order by t1.create_time desc diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml index 3a8f164..1dcb6f4 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TErpGoodsMapper.xml @@ -178,11 +178,11 @@ t1.warehousing_number, t2.create_time, t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num, - t2.unit_amount as sales_amount, + t1.unit_amount as sales_amount, t1.expiry_date from t_erp_clinic_warehousing_batch t1 LEFT JOIN t_erp_clinic_warehousing t2 on t1.warehousing_id = t2.id - LEFT JOIN t_erp_goods t3 on t2.goods_id = t3.id + LEFT JOIN t_erp_goods t3 on t1.goods_id = t3.id LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id LEFT JOIN t_erp_clinic_outbound_goods t5 on t5.warehousing_batch_id =t1.id where t2.disabled = 0 and t2.clinic_id =#{supplierClinicId} @@ -262,11 +262,11 @@ t1.warehousing_number, t2.create_time, t1.warehousing_number - coalesce(sum(t5.outbound_count),0) as num, - t2.unit_amount as sales_amount, + t1.unit_amount as sales_amount, t1.expiry_date from t_erp_clinic_warehousing_batch t1 LEFT JOIN t_erp_clinic_warehousing t2 on t1.warehousing_id = t2.id - LEFT JOIN t_erp_goods t3 on t2.goods_id = t3.id + LEFT JOIN t_erp_goods t3 on t1.goods_id = t3.id LEFT JOIN t_crm_supplier t4 on t3.supplier_clinic_id = t4.id LEFT JOIN t_erp_supplier_outbound_goods t5 on t5.warehousing_batch_id =t1.id where t2.disabled = 0 @@ -283,5 +283,47 @@ where (o.warehousing_number -o.outbound_count) >0 order by o.create_time desc </select> + <select id="getGoodsById" resultType="com.ruoyi.system.model.TErpGoods"> + select <include refid="Base_Column_List"/> from t_erp_goods where id = #{goodsId} + </select> + <select id="pageAdminList" resultType="com.ruoyi.system.vo.TErpGoodsVO"> + select + t1.id + , t1.supplier_clinic_id, t1.goods_source, t1.goods_name, t1.goods_id_code, t1.quasi_number,t1.manufacturer, t1.formulation_spec, t1.packing_spec, t1.type_id, t1.goods_yards, + t1.maintenance_interval,t1.maintenance_interval_unit, t1.low_purchase_quantity, t1.low_unit_id, t1.is_prescription_drug, t1.goods_spec, t1.warning_inventory, + t1.sales_amount, t1.packing_unit_id, t1.instructions_use, t1.side_effect, t1.clinic_purchase_price, t1.platform_commission_price, t1.create_time, t1.update_time, t1.create_by, + t1.`state`, t1.update_by, t1.disabled, + t1.simplified_code, + t1.dosage_form, + t1.usage_classification, + t1.product_brand, + t1.place_of_origin, + t1.ingredient, + t1.trait, + t1.indication, + t1.taboo, + t1.precautions, + t1.interaction, + t1.storage, + t2.supplier_name + from t_erp_goods t1 left join t_crm_supplier t2 on t1.supplier_clinic_id = t2.id and t1.goods_source =1 + where t1.disabled = 0 and t1.goods_source =1 + <if test="query.supplierName != null and query.supplierName != ''"> + and t2.supplier_name like concat('%',#{query.supplierName},'%') + </if> + <if test="query.goodsName != null and query.goodsName != ''"> + and t1.goods_name like concat('%',#{query.goodsName},'%') + </if> + <if test="query.typeId != null and query.typeId != ''"> + and t1.type_id = #{query.typeId} + </if> + <if test="query.quasiNumber != null and query.quasiNumber != ''"> + and t1.quasi_number like concat('%',#{query.quasiNumber},'%') + </if> + <if test="query.state != null "> + and t1.state = #{query.state} + </if> + order by t1.create_time desc + </select> </mapper> diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpIssueReportingMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpIssueReportingMapper.xml index 1c952cd..ce31a5a 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TErpIssueReportingMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TErpIssueReportingMapper.xml @@ -38,8 +38,8 @@ <if test="query.status != null"> AND status = #{query.status} </if> - <if test="query.reportType != null"> - AND report_type = #{query.reportType} + <if test="query.reportType != null and query.query.reportUserId !=null"> + AND report_type = #{query.reportType} and report_user_id =#{query.reportUserId} </if> <if test="query.createBy != null and query.createBy != ''"> AND create_by LIKE concat('%',#{query.createBy},'%') diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml index 8fa456d..d4b980c 100644 --- a/ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/TErpMaintenanceReminderMapper.xml @@ -59,5 +59,41 @@ and t1.`status` = #{query.status} </if> </select> + <select id="pageList1" resultType="com.ruoyi.system.vo.TErpMaintenanceReminderListVo"> + select t1.id, + t4.goods_name, + t4.type_id, + t2.batch_number, + t1.maintenance_person_id, + t1.maintenance_time, + t1.`status`, + t3.warehouse_no + from t_erp_maintenance_reminder t1 + LEFT JOIN t_erp_clinic_warehousing_batch t2 on t1.warehousing_batch_id = t2.id + left join t_erp_clinic_warehousing t3 on t2.warehousing_id = t3.id + left join t_erp_goods t4 on t2.goods_id = t4.id + where t1.disabled = 0 and #{tomorrow} >= t1.maintenance_time + <if test="user.roleType !=null and user.roleType==4"> + and t1.clinic_supplier_id = #{supplierClinicId} and t1.maintenance_type=1 + </if> + <if test="user.roleType !=null and user.roleType==5"> + and t1.clinic_supplier_id = #{supplierClinicId} and t1.maintenance_type=2 + </if> + <if test="query.warehouseNo != null and query.warehouseNo != ''"> + and t3.warehouse_no =#{query.warehouseNo} + </if> + <if test="query.goodsName != null and query.goodsName != ''"> + and t4.goods_name like concat('%',#{query.goodsName},'%') + </if> + <if test="query.typeId != null and query.typeId != '' "> + and t4.type_id = #{query.typeId} + </if> + <if test="query.batchNumber != null and query.batchNumber != ''"> + and t2.batch_number = #{query.batchNumber} + </if> + <if test="query.status != null "> + and t1.`status` = #{query.status} + </if> + </select> </mapper> -- Gitblit v1.7.1