| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | 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.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.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | | 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.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-erp-clinic-warehousing") |
| | | public class TErpClinicWarehousingController { |
| | | |
| | | private final TErpClinicWarehousingService erpClinicWarehousingService; |
| | | private final TErpGoodsService erpGoodsService; |
| | | private final TokenService tokenService; |
| | | private final TCrmClinicService crmClinicService; |
| | | private final TCrmSupplierService crmSupplierService; |
| | | |
| | | @Autowired |
| | | public TErpClinicWarehousingController(TErpClinicWarehousingService erpClinicWarehousingService, TErpGoodsService erpGoodsService, TokenService tokenService, |
| | | TCrmClinicService crmClinicService,TCrmSupplierService crmSupplierService) { |
| | | this.erpClinicWarehousingService = erpClinicWarehousingService; |
| | | this.erpGoodsService = erpGoodsService; |
| | | this.tokenService = tokenService; |
| | | this.crmClinicService = crmClinicService; |
| | | this.crmSupplierService = crmSupplierService; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取erp问题上报管理列表 |
| | | */ |
| | | @ApiOperation(value = "展示获取库存分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TErpGoodsVO>> pageList(@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.pageList(query,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 盘点") |
| | | @PostMapping(value = "/pageInventoryList") |
| | | public R<PageInfo<PageInventoryListVo>> pageInventoryList(@RequestBody TErpInventoryQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | return R.ok(erpClinicWarehousingService.pageInventoryList(query,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 盘点详情") |
| | | @GetMapping(value = "/detailInventory/{id}") |
| | | public R<List<InventoryDetailVo>> detailInventory(@PathVariable String id) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | return R.ok(erpClinicWarehousingService.detailInventory(id,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 盘点 出库 商品选择") |
| | | @PostMapping(value = "/pageInventoryGoodsPageList") |
| | | public R<PageInfo<TErpGoodsInventoryVO>> pageInventoryGoodsPageList(@RequestBody @Valid TErpGoodsInventoryQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | return R.ok(erpGoodsService.pageInventoryGoodsPageList1(query,user)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 有效期预警商品选择") |
| | | @GetMapping(value = "/pageInventoryGoodsList") |
| | | public R<List<TErpGoodsInventoryVO>> pageInventoryGoodsList(String warehouseId,@RequestParam(required = false)String batchId) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | List<TErpGoodsInventoryVO> tErpGoodsInventoryVOS = erpGoodsService.pageInventoryGoodsList1(warehouseId, user); |
| | | if(batchId!=null && !"".equals(batchId)){ |
| | | tErpGoodsInventoryVOS = tErpGoodsInventoryVOS.stream().filter(e->e.getId().equals(batchId)).collect(Collectors.toList()); |
| | | } |
| | | return R.ok(tErpGoodsInventoryVOS); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 确认盘点") |
| | | @PostMapping(value = "/inventoryGoods") |
| | | public R<?> inventoryGoods(@RequestBody @Valid InventoryDto dto) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | erpGoodsService.inventoryGoods1(dto,user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "诊所 有效期预警") |
| | | @PostMapping(value = "/validityPeriodWarning") |
| | | public R<PageInfo<ValidityPeriodWarningVo>> validityPeriodWarning(@RequestBody ValidityPeriodWarningQuery query) { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | PageInfo<ValidityPeriodWarningVo> pageInfo =erpClinicWarehousingService.validityPeriodWarning(query,user); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |