无关风月
2024-09-03 56dfe0d4bf81262622a1919cceb2b039fd356209
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package com.ruoyi.management.controller;
 
 
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.management.domain.InventoriesSupplies;
import com.ruoyi.management.domain.InventoriesSuppliesInfo;
import com.ruoyi.management.domain.SlStoreManagement;
import com.ruoyi.management.domain.dto.*;
import com.ruoyi.management.domain.vo.InventoriesSuppliesInfoVO;
import com.ruoyi.management.domain.vo.InventoriesSuppliesVO;
import com.ruoyi.management.domain.vo.PdInfoVO;
import com.ruoyi.management.mapper.SlVolumeProductionRkMapper;
import com.ruoyi.management.service.InventoriesSuppliesInfoService;
import com.ruoyi.management.service.InventoriesSuppliesService;
import com.ruoyi.management.service.SlGoodsMaterialsService;
import com.ruoyi.management.service.SlStoreManagementService;
import com.ruoyi.system.api.feignClient.SysUserClient;
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.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hjl
 * @since 2024-07-01
 */
@RestController
@RequestMapping("/inventories-supplies-info")
@Api(value = "物资盘点详情接口", tags = "物资盘点详情接口", description = "物资盘点详情接口")
public class InventoriesSuppliesInfoController {
    @Resource
    private SysUserClient sysUserClient;
    @Resource
    private TokenService tokenService;
 
    @Autowired
    private SlGoodsMaterialsService slGoodsMaterialsService;
    @Resource
    private InventoriesSuppliesInfoService inventoriesSuppliesInfoService;
    @Resource
    private InventoriesSuppliesService inventoriesSuppliesService;
    @Autowired
    private SlStoreManagementService slStoreManagementService;
    @GetMapping("/getInfoById")
    @ApiOperation(value = "根据盘点id获取盘点信息")
    public R<PdInfoVO> inventoriesSuppliesInfoService(Long id) {
        tokenService.getLoginUser();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        InventoriesSupplies byId = inventoriesSuppliesService.getById(id);
        String format = simpleDateFormat.format(byId.getPdTime());
        SlStoreManagement byId1 = slStoreManagementService.getById(byId.getMaterialsId());
        PdInfoVO pdInfoVO = new PdInfoVO();
        pdInfoVO.setManagementName(byId1.getStoreManagementName());
        pdInfoVO.setPdName(byId.getPdrName());
        pdInfoVO.setPdTime(format);
        return R.ok(pdInfoVO);
    }
    @PostMapping("/getInventoriesSuppliesInfoList")
    @ApiOperation(value = "分页获物资盘点详情")
    public R<PageDTO<InventoriesSuppliesInfoVO>> inventoriesSuppliesInfoService(@RequestBody InventoriesSuppliesInfoQuery inventoriesSuppliesInfoQuery) {
        tokenService.getLoginUser();
        return R.ok(inventoriesSuppliesInfoService.inventoriesSuppliesInfoService(inventoriesSuppliesInfoQuery));
    }
 
    @PostMapping("/addInventoriesSuppliesInfo")
    @ApiOperation(value = "添加/修改物资盘点详情")
    public R addInventoriesSuppliesInfo(@RequestBody List<InventoriesSuppliesInfoDTO> inventoriesSuppliesInfoDTO) {
        tokenService.getLoginUser();
        inventoriesSuppliesInfoService.addInventoriesSuppliesInfo(inventoriesSuppliesInfoDTO);
        return R.ok();
    }
 
    @PostMapping("/getInventoriesSuppliesInfo")
    @ApiOperation(value = "通过入库id查询是否已经有物资详情")
    public R<InventoriesSuppliesInfo> getInventoriesSuppliesInfo(@RequestBody InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) {
        tokenService.getLoginUser();
        return R.ok(   inventoriesSuppliesInfoService.getInventoriesSuppliesInfo(inventoriesSuppliesInfoDTO));
    }
 
    @PostMapping("/submitInventoriesSuppliesInfo")
    @ApiOperation(value = "提交物资盘点数据")
    public R submitInventoriesSuppliesInfo(@RequestBody ADDPdDTO dto) {
        tokenService.getLoginUser();
        return R.ok(inventoriesSuppliesInfoService.submitInventoriesSuppliesInfo(dto));
    }
 
    @PostMapping("/accomplishInventoriesSuppliesInfo")
    @ApiOperation(value = "完成物资盘点数据--更新库存")
    public R accomplishInventoriesSuppliesInfo(@RequestBody InventoriesSuppliesInfoDTO inventoriesSuppliesInfoDTO) {
        tokenService.getLoginUser();
        inventoriesSuppliesInfoService.accomplishInventoriesSuppliesInfo(inventoriesSuppliesInfoDTO);
        return R.ok();
    }
 
}