From 6664ba895c7b2b5837f53cea44692610848ff60c Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期四, 23 十月 2025 16:53:31 +0800
Subject: [PATCH] 修改bug
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpClinicWarehousingController.java | 222 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 213 insertions(+), 9 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpClinicWarehousingController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpClinicWarehousingController.java
index 4e7a0dd..d967333 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpClinicWarehousingController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TErpClinicWarehousingController.java
@@ -1,25 +1,29 @@
package com.ruoyi.web.controller.api;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.common.core.domain.BaseModel;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.dto.ClinicOutboundGoodsDto;
import com.ruoyi.system.dto.InventoryDto;
-import com.ruoyi.system.model.TCrmClinic;
-import com.ruoyi.system.model.TCrmSupplier;
-import com.ruoyi.system.query.TErpGoodsInventoryQuery;
-import com.ruoyi.system.query.TErpGoodsQuery;
-import com.ruoyi.system.query.TErpInventoryQuery;
-import com.ruoyi.system.query.ValidityPeriodWarningQuery;
+import com.ruoyi.system.dto.WarehouseGoodsDto;
+import com.ruoyi.system.dto.clinicWarehouseGoodsDto;
+import com.ruoyi.system.model.*;
+import com.ruoyi.system.query.*;
import com.ruoyi.system.service.*;
import com.ruoyi.system.vo.*;
+import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
+import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -33,6 +37,7 @@
*/
@RestController
@RequestMapping("/t-erp-clinic-warehousing")
+@Api(tags = "诊所库存管理")
public class TErpClinicWarehousingController {
private final TErpClinicWarehousingService erpClinicWarehousingService;
@@ -40,15 +45,21 @@
private final TokenService tokenService;
private final TCrmClinicService crmClinicService;
private final TCrmSupplierService crmSupplierService;
+ private final TErpClinicWarehousingBatchService erpClinicWarehousingBatchService;
+ private final TErpGoodsUnitService erpGoodsUnitService;
+
@Autowired
public TErpClinicWarehousingController(TErpClinicWarehousingService erpClinicWarehousingService, TErpGoodsService erpGoodsService, TokenService tokenService,
- TCrmClinicService crmClinicService,TCrmSupplierService crmSupplierService) {
+ TCrmClinicService crmClinicService,TCrmSupplierService crmSupplierService,TErpClinicWarehousingBatchService erpClinicWarehousingBatchService,
+ TErpGoodsUnitService erpGoodsUnitService) {
this.erpClinicWarehousingService = erpClinicWarehousingService;
this.erpGoodsService = erpGoodsService;
this.tokenService = tokenService;
this.crmClinicService = crmClinicService;
this.crmSupplierService = crmSupplierService;
+ this.erpClinicWarehousingBatchService = erpClinicWarehousingBatchService;
+ this.erpGoodsUnitService = erpGoodsUnitService;
}
@@ -58,7 +69,7 @@
/**
* 获取erp问题上报管理列表
*/
- @ApiOperation(value = "展示获取库存分页列表")
+ @ApiOperation(value = "诊所 获取库存分页列表")
@PostMapping(value = "/pageList")
public R<PageInfo<TErpGoodsVO>> pageList(@RequestBody TErpGoodsQuery query) {
@@ -80,6 +91,33 @@
}
return R.ok(erpClinicWarehousingService.pageList(query,user));
+ }
+
+ /**
+ * 获取erp问题上报管理列表
+ */
+ @ApiOperation(value = "诊所 获取库存库存不足")
+ @PostMapping(value = "/pageNotInventoryGoodsList")
+ public R<List<TErpGoodsVO>> pageNotInventoryGoodsList(@RequestBody TErpGoodsQuery query) {
+
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ if(roleType == 4){
+ // 供应商
+ TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class)
+ .eq(TCrmSupplier::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ query.setSupplierClinicId(crmSupplier.getId());
+ }
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ query.setSupplierClinicId(crmClinic.getId());
+ }
+
+ return R.ok(erpClinicWarehousingService.pageList1(query,user));
}
@@ -104,7 +142,7 @@
- @ApiOperation(value = "诊所 盘点 出库 商品选择")
+ @ApiOperation(value = "诊所 盘点 出库 商品选择 患者诊疗商品选择")
@PostMapping(value = "/pageInventoryGoodsPageList")
public R<PageInfo<TErpGoodsInventoryVO>> pageInventoryGoodsPageList(@RequestBody @Valid TErpGoodsInventoryQuery query) {
SysUser user = tokenService.getLoginUser().getUser();
@@ -150,5 +188,171 @@
+
+ /**
+ * 获取erp问题上报管理列表
+ */
+ @ApiOperation(value = "诊所 入库列表")
+ @PostMapping(value = "/warehousePageList")
+ public R<PageInfo<TErpClinicWarehousePageListVO>> warehousePageList(@RequestBody TClinicWarehouseQuery query) {
+
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ String supplierClinicId =null;
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ supplierClinicId = crmClinic.getId();
+ }
+
+ return R.ok(erpClinicWarehousingService.warehousePageList(query,user,supplierClinicId));
+ }
+
+
+ @ApiOperation(value = "诊所 入库商品列表")
+ @PostMapping(value = "/warehouseGoodsPageList")
+ public R<Page<TErpGoods>> warehouseGoodsPageList(@RequestBody TClinicGoodsWarehouseQuery query) {
+
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ String supplierClinicId =null;
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ supplierClinicId = crmClinic.getId();
+ }
+
+ return R.ok(erpGoodsService.warehouseGoodsPageList(query,user,supplierClinicId));
+ }
+
+
+
+ @ApiOperation(value = "诊所 入库商品详情")
+ @GetMapping(value = "/warehouseGoodsDetail/{id}")
+ public R<WarehouseGoodsDetailVo> warehouseGoodsDetail(@PathVariable String id) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ String supplierClinicId =null;
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ supplierClinicId = crmClinic.getId();
+ }
+
+ return R.ok(erpGoodsService.warehouseGoodsDetail(id));
+ }
+
+
+ @ApiOperation(value = "诊所 出库商品详情")
+ @GetMapping(value = "/outboundGoodsDetail/{id}")
+ public R<OutboundGoodsDetailVo> outboundGoodsDetail(@PathVariable String id) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ String supplierClinicId =null;
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ supplierClinicId = crmClinic.getId();
+ }
+
+ return R.ok(erpGoodsService.outboundGoodsDetail(id));
+ }
+
+ @ApiOperation(value = "诊所 入库商品操作")
+ @PostMapping(value = "/warehouseGoods")
+ public R<?> warehouseGoods(@RequestBody @Valid WarehouseGoodsDto dto) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ String supplierClinicId =null;
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ supplierClinicId = crmClinic.getId();
+ }
+ erpClinicWarehousingService.warehouseGoods(dto,user,supplierClinicId);
+ return R.ok();
+ }
+ @ApiOperation(value = "诊所 获取草稿")
+ @GetMapping(value = "/getWarehouseGoodsDraft")
+ public R<List<TErpClinicWarehousingBatch>> getWarehouseGoodsDraft() {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ String supplierClinicId =null;
+ ArrayList<TErpClinicWarehousingBatch> clinicWarehouseGoodsDtos = new ArrayList<>();
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ supplierClinicId = crmClinic.getId();
+ List<TErpClinicWarehousing> list = erpClinicWarehousingService.list(new LambdaQueryWrapper<TErpClinicWarehousing>().eq(TErpClinicWarehousing::getClinicId, supplierClinicId).eq(TErpClinicWarehousing::getStatus, 1).orderByDesc(BaseModel::getCreateTime));
+ if(list.isEmpty()){
+ return R.ok(clinicWarehouseGoodsDtos);
+ }
+ List<TErpClinicWarehousingBatch> list1 = erpClinicWarehousingBatchService.list(new LambdaQueryWrapper<TErpClinicWarehousingBatch>().eq(TErpClinicWarehousingBatch::getWarehousingId, list.get(0).getId()));
+ for (TErpClinicWarehousingBatch tErpClinicWarehousingBatch : list1) {
+ String goodsId = tErpClinicWarehousingBatch.getGoodsId();
+ TErpGoods tErpGoods = erpGoodsService.getOne(new LambdaQueryWrapper<TErpGoods>().eq(TErpGoods::getId, goodsId));
+ TErpGoodsUnit byId = erpGoodsUnitService.getById(tErpGoods.getPackingUnitId());
+ tErpClinicWarehousingBatch.setUnitName(byId.getUnitName());
+ }
+ return R.ok(list1);
+ }
+ return R.ok(clinicWarehouseGoodsDtos);
+ }
+
+
+
+
+
+ /**
+ * 获取erp问题上报管理列表
+ */
+ @ApiOperation(value = "诊所 出库列表")
+ @PostMapping(value = "/outboundPageList")
+ public R<PageInfo<TErpClinicOutboundPageListVO>> outboundPageList(@RequestBody TClinicOutboundQuery query) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ String supplierClinicId =null;
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ supplierClinicId = crmClinic.getId();
+ }
+
+ return R.ok(erpClinicWarehousingService.outboundPageList(query,user,supplierClinicId));
+ }
+
+
+ @ApiOperation(value = "诊所 出库商品操作")
+ @PostMapping(value = "/outboundGoods")
+ public R<?> outboundGoods(@RequestBody @Valid ClinicOutboundGoodsDto dto) {
+ SysUser user = tokenService.getLoginUser().getUser();
+ Integer roleType = user.getRoleType();
+ String supplierClinicId =null;
+ if(roleType == 5){
+ // 诊所
+ TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class)
+ .eq(TCrmClinic::getUserId, user.getUserId())
+ .last("LIMIT 1"));
+ supplierClinicId = crmClinic.getId();
+ }
+ erpClinicWarehousingService.outboundGoods(dto,user,supplierClinicId);
+ return R.ok();
+ }
+
+
}
--
Gitblit v1.7.1