maven
2025-11-11 cc0635fdc45d9b0e9396f76ed4074bdb1d81f9d3
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
package com.ruoyi.procurementrecord.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.procurementrecord.dto.*;
import com.ruoyi.procurementrecord.mapper.CustomStorageMapper;
import com.ruoyi.procurementrecord.pojo.CustomStorage;
import com.ruoyi.procurementrecord.service.ProcurementRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * @author :yys
 * @date : 2025/7/7 14:32
 */
@RestController
@Api(tags = "采购入库")
@RequestMapping("/stockin")
public class ProcurementRecordController extends BaseController {
 
 
    @Autowired
    private ProcurementRecordService procurementRecordService;
 
    @GetMapping("/productlist")
    @Log(title = "采购入库-入库管理-新增入库查询", businessType = BusinessType.OTHER)
    public AjaxResult list(ProcurementDto procurementDto) {
        List<ProcurementDto> result = procurementRecordService.listProcurementBySalesLedgerId(procurementDto);
        return AjaxResult.success(result);
    }
 
    @PostMapping("/add")
    @Log(title = "采购入库-入库管理-新增入库", businessType = BusinessType.INSERT)
    @Transactional
    public AjaxResult add(@RequestBody ProcurementAddDto procurementDto) {
        procurementDto.setType(1);
        procurementDto.setTypeName("采购入库");
        return AjaxResult.success(procurementRecordService.add(procurementDto));
    }
 
    @PostMapping("/addCustom")
    @Log(title = "自定义入库-入库管理-新增入库", businessType = BusinessType.INSERT)
    @Transactional
    public AjaxResult addCustom(@RequestBody List<CustomStorage> customStorage) {
        return procurementRecordService.addCustom(customStorage);
    }
 
    @PostMapping("/updateCustom")
    @Log(title = "自定义入库-入库管理-修改入库", businessType = BusinessType.UPDATE)
    @Transactional
    public AjaxResult updateCustom(@RequestBody CustomStorage customStorage) {
        return procurementRecordService.updateCustom(customStorage);
    }
 
    @Delete("/delteCustom")
    @Log(title = "自定义入库-入库管理-删除入库", businessType = BusinessType.DELETE)
    @Transactional
    public AjaxResult deleteCustom(@RequestBody List<Long> ids) {
        return procurementRecordService.deleteCustom(ids);
    }
 
    @PostMapping("/update")
    @Log(title = "采购入库-入库管理-修改入库", businessType = BusinessType.UPDATE)
    @Transactional
    public AjaxResult updatePro(@RequestBody ProcurementUpdateDto procurementDto) {
        return AjaxResult.success(procurementRecordService.updatePro(procurementDto));
    }
 
    @PostMapping("/updateManagement")
    @Log(title = "采购入库-库存台账-修改", businessType = BusinessType.UPDATE)
    @Transactional
    public AjaxResult updateManagement(@RequestBody ProcurementManagementUpdateDto procurementDto) {
        return AjaxResult.success(procurementRecordService.updateManagement(procurementDto));
    }
 
    @PostMapping("/del")
    @Log(title = "采购入库-入库管理-删除入库", businessType = BusinessType.DELETE)
    @Transactional
    public AjaxResult deletePro(@RequestBody ProcurementUpdateDto procurementDto) {
        return AjaxResult.success(procurementRecordService.deletePro(procurementDto));
    }
 
    @GetMapping("/listPage")
    @Log(title = "采购入库-入库管理-入库查询", businessType = BusinessType.OTHER)
    @ApiOperation(value = "入库查询")
    public AjaxResult listPage(Page page, ProcurementPageDto procurementDto) {
        IPage<ProcurementPageDto> result = procurementRecordService.listPage(page, procurementDto);
        return AjaxResult.success(result);
    }
 
    @GetMapping("/listPageByProduction")
    @Log(title = "生产入库-入库管理-入库查询", businessType = BusinessType.OTHER)
    @ApiOperation(value = "入库查询")
    public AjaxResult listPageByProduction(Page page, ProcurementPageDto procurementDto) {
        IPage<ProcurementPageDto> result = procurementRecordService.listPageByProduction(page, procurementDto);
        return AjaxResult.success(result);
    }
 
    @GetMapping("/listPageByCustom")
    @Log(title = "自定义入库-入库管理-入库查询", businessType = BusinessType.OTHER)
    @ApiOperation(value = "入库查询")
    public AjaxResult listPageByCustom(Page page, CustomStorage customStorage) {
        IPage<CustomStorage> result = procurementRecordService.listPageByCustom(page, customStorage);
        return AjaxResult.success(result);
    }
 
    @GetMapping("/listPageCopy")
    @Log(title = "采购入库-库存管理-分页查询", businessType = BusinessType.OTHER)
    public AjaxResult listPageCopy(Page page, ProcurementPageDto procurementDto) {
        IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopy(page, procurementDto);
        return AjaxResult.success(result);
    }
 
    @GetMapping("/listPageCopyByProduction")
    @Log(title = "生产入库-库存管理-分页查询", businessType = BusinessType.OTHER)
    public AjaxResult listPageCopyByProduction(Page page, ProcurementPageDto procurementDto) {
        IPage<ProcurementPageDtoCopy> result = procurementRecordService.listPageCopyByProduction(page, procurementDto);
        return AjaxResult.success(result);
    }
 
    @GetMapping("/listPageCopyByCustom")
    @Log(title = "自定义入库-库存管理-分页查询", businessType = BusinessType.OTHER)
    public AjaxResult listPageCopyByCustom(Page page, CustomStorage customStorage) {
        IPage<CustomStorage> result = procurementRecordService.listPageCopyByCustom(page, customStorage);
        return AjaxResult.success(result);
    }
 
    @GetMapping("/getReportList")
    @Log(title = "库存报表查询", businessType = BusinessType.OTHER)
    public AjaxResult getReportList(Page page, ProcurementPageDto procurementDto) {
        return AjaxResult.success(procurementRecordService.getReportList(page, procurementDto));
    }
 
    /**
     * 库存管理采购导出
     * @param response
     */
    @PostMapping("/exportCopy")
    public void exportCopy(HttpServletResponse response) {
        procurementRecordService.exportCopy(response,1);
    }
 
    /**
     * 库存管理生产导出
     * @param response
     */
    @PostMapping("/exportCopyOne")
    public void exportCopyOne(HttpServletResponse response) {
        procurementRecordService.exportCopy(response,2);
    }
 
    /**
     * 库存管理自定义导出
     * @param response
     */
    @PostMapping("/exportCopyTwo")
    public void exportCopyTwo(HttpServletResponse response) {
        procurementRecordService.exportCopyTwo(response,3);
    }
 
    /**
     * 入库,出库管理采购导出
     * @param response
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response) {
        procurementRecordService.export(response,1);
    }
 
    /**
     * 入库,出库管理生产导出
     * @param response
     */
    @PostMapping("/exportOne")
    public void exportOne(HttpServletResponse response) {
        procurementRecordService.export(response,2);
    }
 
    @Autowired
    private CustomStorageMapper customStorageMapper;
 
    /**
     * 入库,出库管理自定义导出
     * @param response
     */
    @PostMapping("/exportTwo")
    public void exportTwo(HttpServletResponse response) {
        List<CustomStorage> customStorages = customStorageMapper.selectList(null);
        ExcelUtil<CustomStorage> util = new ExcelUtil<CustomStorage>(CustomStorage.class);
        util.exportExcel(response, customStorages, "入库台账");
    }
 
 
}