| | |
| | | package com.ruoyi.management.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.management.domain.ManagementGoodsMaterials; |
| | | import com.ruoyi.management.domain.SlGoodsMaterials; |
| | | import com.ruoyi.management.domain.SlStoreManagement; |
| | | import com.ruoyi.management.domain.dto.SlGoodsMaterialsDTO; |
| | | import com.ruoyi.management.domain.dto.SlGoodsMaterialsQuery; |
| | | import com.ruoyi.management.domain.dto.SlGoodsShelfDTO; |
| | | import com.ruoyi.management.domain.dto.SlGoodsShelfQuery; |
| | | import com.ruoyi.management.domain.SlVolumeProductionRk; |
| | | import com.ruoyi.management.domain.dto.*; |
| | | import com.ruoyi.management.domain.vo.SlGoodsMaterialsVO; |
| | | import com.ruoyi.management.domain.vo.SlGoodsShelfVO; |
| | | import com.ruoyi.management.domain.vo.StoreManagementGoodSmaterialsVO; |
| | | import com.ruoyi.management.mapper.ManagementGoodsMaterialsMapper; |
| | | import com.ruoyi.management.mapper.SlVolumeProductionCkMapper; |
| | | import com.ruoyi.management.mapper.SlVolumeProductionRkMapper; |
| | | import com.ruoyi.management.mapper.SlVolumeProductionZyMapper; |
| | | import com.ruoyi.management.service.ManagementGoodsMaterialsService; |
| | | import com.ruoyi.management.service.SlGoodsMaterialsService; |
| | | import com.ruoyi.management.service.SlStoreManagementService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sl-goods-materials") |
| | | @Api(value = "物资管理接口", tags = "物资管理接口", description = "物资管理接口") |
| | | public class SlGoodsMaterialsController { |
| | | @Resource |
| | | private SlGoodsMaterialsService slGoodsMaterialsService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @PostMapping("/getGoodSmaterialsList") |
| | | @ApiOperation(value = "分页获物资管理") |
| | | public R<PageDTO<SlGoodsMaterialsVO>> getGoodSmaterialsList(@RequestBody SlGoodsMaterialsQuery slGoodsMaterialsQuery) { |
| | | tokenService.getLoginUser(); |
| | | return R.ok(slGoodsMaterialsService.getGoodSmaterialsList(slGoodsMaterialsQuery)); |
| | | } |
| | | |
| | | @PostMapping("/addGoodSmaterials") |
| | | @ApiOperation(value = "添加/修改物资管理") |
| | | public R addSlGoodsShelf(@RequestBody SlGoodsMaterialsDTO slGoodsMaterialsDTO) { |
| | | tokenService.getLoginUser(); |
| | | slGoodsMaterialsService.addSlGoodsShelf(slGoodsMaterialsDTO); |
| | | return R.ok(); |
| | | } |
| | | @Resource |
| | | private SlGoodsMaterialsService slGoodsMaterialsService; |
| | | |
| | | @Resource |
| | | private ManagementGoodsMaterialsMapper managementGoodsMaterialsMapper; |
| | | @Resource |
| | | private SlVolumeProductionRkMapper slVolumeProductionRkMapper; |
| | | @Resource |
| | | private SlVolumeProductionCkMapper slVolumeProductionCkMapper; |
| | | @Resource |
| | | private SlVolumeProductionZyMapper slVolumeProductionZyMapper; |
| | | @Resource |
| | | private SlStoreManagementService storeManagementService; |
| | | @ApiOperation("删除物资管理") |
| | | @DeleteMapping("/{id}") |
| | | public R<?> delStoreManagement( |
| | | @ApiParam(name = "id", value = "货架管理id", required = true) @PathVariable("id") Integer id) { |
| | | slGoodsMaterialsService.removeById(id); |
| | | @ApiParam(name = "id", value = "货架管理id", required = true) @PathVariable("id") Long id) { |
| | | tokenService.getLoginUser(); |
| | | // 判断当前物资有没有存在于入库 出库 转移记录 和库存 |
| | | List<ManagementGoodsMaterials> goodsMaterialsId = managementGoodsMaterialsMapper.selectList(new QueryWrapper<ManagementGoodsMaterials>() |
| | | .eq("goods_materials_id", id) |
| | | .eq("del_flag",0)); |
| | | |
| | | if (!goodsMaterialsId.isEmpty()){ |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (ManagementGoodsMaterials managementGoodsMaterials : goodsMaterialsId) { |
| | | if (managementGoodsMaterials.getManagementId() != null) { |
| | | SlStoreManagement byId1 = storeManagementService.getById(managementGoodsMaterials.getManagementId()); |
| | | stringBuilder.append(byId1.getStoreManagementName()).append(","); |
| | | } |
| | | } |
| | | // 去除最后一位字符 |
| | | stringBuilder.deleteCharAt(stringBuilder.length() - 1); |
| | | return R.fail("删除失败," + stringBuilder + "仓库还有当前物资"); |
| | | } |
| | | SlGoodsMaterials byId = slGoodsMaterialsService.getById(id); |
| | | byId.setDelFlag("1"); |
| | | slGoodsMaterialsService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/getGoodSmaterialsOne") |
| | | @GetMapping("/getGoodSmaterialsOne/{id}") |
| | | @ApiOperation(value = "物资管理詳情") |
| | | public R<SlGoodsMaterials> getGoodSmaterialsOne(@ApiParam(name = "id", value = "物资管理id", required = true) @PathVariable("id") Integer id) { |
| | | public R<SlGoodsMaterials> getGoodSmaterialsOne(@ApiParam(name = "id", value = "物资管理id", required = true) @PathVariable("id") Long id) { |
| | | tokenService.getLoginUser(); |
| | | return R.ok(slGoodsMaterialsService.getById(id)); |
| | | } |
| | | |
| | | @PostMapping("/getStoreManagementGoodSmaterialsOne") |
| | | @ApiOperation(value = "库存管理查看详情") |
| | | public R<PageDTO<StoreManagementGoodSmaterialsVO>> getStoreManagementGoodSmaterialsOne(@RequestBody StoreManagementGoodSmaterialsQuery storeManagementGoodSmaterialsQuery) { |
| | | tokenService.getLoginUser(); |
| | | return R.ok(slGoodsMaterialsService.getStoreManagementGoodSmaterialsOne(storeManagementGoodSmaterialsQuery)); |
| | | } |
| | | |
| | | @PostMapping("/getSmaterialsOne") |
| | | @ApiOperation(value = "感觉物资库存管理查看详情") |
| | | public R<StoreManagementGoodSmaterialsVO> getSmaterialsOne(@RequestBody StoreManagementGoodSmaterialsQuery storeManagementGoodSmaterialsQuery) { |
| | | tokenService.getLoginUser(); |
| | | return R.ok(slGoodsMaterialsService.getSmaterialsOne(storeManagementGoodSmaterialsQuery)); |
| | | } |
| | | |
| | | @GetMapping("/getGooManagementGoodSmaterials/{id}") |
| | | @ApiOperation(value = "库存管理查看物资詳情") |
| | | public R<StoreManagementGoodSmaterialsVO> getGooManagementGoodSmaterials(@ApiParam(name = "id", value = "物资管理id", required = true) @PathVariable("id") Long id) { |
| | | tokenService.getLoginUser(); |
| | | StoreManagementGoodSmaterialsVO storeManagementGoodSmaterialsVO=new StoreManagementGoodSmaterialsVO(); |
| | | LambdaQueryWrapper<ManagementGoodsMaterials> wrappers= Wrappers.lambdaQuery(); |
| | | wrappers.eq( ManagementGoodsMaterials::getGoodsMaterialsId,id); |
| | | ManagementGoodsMaterials managementGoodsMaterials = managementGoodsMaterialsMapper.selectById(id); |
| | | BeanUtils.copyProperties(managementGoodsMaterials, storeManagementGoodSmaterialsVO); |
| | | SlGoodsMaterials byId = slGoodsMaterialsService.getById(managementGoodsMaterials.getGoodsMaterialsId()); |
| | | storeManagementGoodSmaterialsVO.setGoodsMaterialsName(byId.getGoodsMaterialsName()); |
| | | storeManagementGoodSmaterialsVO.setIsConsume(byId.getIsConsume()); |
| | | return R.ok(storeManagementGoodSmaterialsVO); |
| | | } |
| | | |
| | | } |