李林
2023-10-07 658d4927d468c47208fd012d9128b09249c07eff
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/*
 *    Copyright (c) 2018-2025, ztt All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: ztt
 */
 
package com.chinaztt.mes.warehouse.controller;
 
 
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaztt.mes.basic.entity.Part;
import com.chinaztt.mes.basic.service.PartService;
import com.chinaztt.mes.common.wrapper.QueryWrapperUtil;
import com.chinaztt.mes.warehouse.dto.InventoryMainDTO;
import com.chinaztt.mes.warehouse.entity.InventoryDetail;
import com.chinaztt.mes.warehouse.entity.InventoryMain;
import com.chinaztt.mes.warehouse.service.InventoryDetailService;
import com.chinaztt.mes.warehouse.service.InventoryMainService;
import com.chinaztt.ztt.common.core.util.R;
import com.chinaztt.ztt.common.log.annotation.SysLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
 
 
/**
 * 新盘点主表
 *
 * @author yangyao
 * @date 2022-10-13 11:06:00
 */
@RestController
@AllArgsConstructor
@RequestMapping("/inventoryMain" )
@Api(value = "inventoryMain", tags = "新盘点主表管理")
public class InventoryMainController {
 
    private final InventoryMainService inventoryMainService;
 
    private final InventoryDetailService inventoryDetailService;
 
    private final PartService partService;
 
 
 
    /**
     * 盘点主表分页查询
     *
     * @param page    分页对象
     * @param inventoryMain 盘点主表
     * @return
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @GetMapping("/page")
    public R getInventoryMainPage(Page page, InventoryMain inventoryMain) {
        return R.ok(inventoryMainService.page(page, QueryWrapperUtil.gen(inventoryMain).orderByDesc("create_time")));
    }
 
 
    /**
     * 通过id删除盘点主表记录
     *
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id删除盘点主表记录", notes = "通过id删除盘点主表记录")
    @SysLog("通过id删除盘点主表记录")
    @DeleteMapping("/{id}")
    public R removeById(@PathVariable Long id) {
        return R.ok(inventoryMainService.remove(id));
    }
 
 
 
    /**
     * 通过id修改盘点主表记录
     *
     * @param inventoryMain 盘点主表
     * @return R
     */
    @ApiOperation(value = "通过id修改盘点主表记录", notes = "通过id修改盘点主表记录")
    @SysLog("通过id修改盘点主表记录")
    @PutMapping
    public R updateById(@RequestBody InventoryMain inventoryMain) {
        return R.ok(inventoryMainService.updateById(inventoryMain));
    }
 
 
    /**
     * 新增盘点
     *
     * @param inventoryMainDTO 新增盘点
     * @return R
     */
    @ApiOperation(value = "新增盘点", notes = "新增盘点")
    @SysLog("新增盘点")
    @PostMapping
    public R save(@RequestBody InventoryMainDTO inventoryMainDTO) {
        return R.ok(inventoryMainService.fullSave(inventoryMainDTO));
    }
 
 
 
    /**
     * 盘点明细分页查询
     *
     * @param page    分页对象
     * @param inventoryDetail 盘点明细
     * @return
     */
    @ApiOperation(value = "盘点明细分页查询", notes = "盘点明细分页查询")
    @GetMapping("/detail/page")
    public R getInventoryDetailPage(Page page, InventoryDetail inventoryDetail) {
        return R.ok(inventoryDetailService.page(page, QueryWrapperUtil.gen(inventoryDetail)));
    }
 
 
    /**
     * 新增盘点明细
     *
     * @param inventoryDetail 盘点明细
     * @return R
     */
    @ApiOperation(value = "新增盘点明细", notes = "新增盘点明细")
    @SysLog("新增盘点明细")
    @PostMapping("/detail")
    public R saveInventoryDetail(@RequestBody InventoryDetail inventoryDetail) {
        return R.ok(inventoryDetailService.fullSave(inventoryDetail));
    }
 
 
 
 
    /**
     * 批量删除盘点明细
     *
     * @param ids ids
     * @return R
     */
    @ApiOperation(value = "批量删除盘点明细", notes = "批量删除盘点明细")
    @SysLog("批量删除盘点明细")
    @DeleteMapping("/detail")
    public R batchDeleteDetail(@RequestBody List<Long> ids) {
        return R.ok(inventoryDetailService.removeByIds(ids));
    }
 
 
    /**
     * 批量编辑盘点明细
     *
     * @param id id
     * @return R
     */
    @ApiOperation(value = "批量编辑盘点明细", notes = "批量编辑盘点明细")
    @SysLog("批量编辑盘点明细")
    @PutMapping("/detail")
    public R batchUpdateDetail(@RequestBody List<InventoryDetail> inventoryDetails) {
        return R.ok(inventoryDetailService.updateBatch(inventoryDetails));
    }
 
 
 
    /**
     * 盘点没有差异按钮
     *
     * @param id id
     * @return R
     */
    @ApiOperation(value = "盘点没有差异按钮", notes = "盘点没有差异按钮")
    @SysLog("盘点没有差异按钮")
    @PostMapping("/detail/noDiff")
    public R noDiff(@RequestBody List<Long> ids) {
        return R.ok(inventoryDetailService.noDiff(ids));
    }
 
 
    /**
     * 取消未盘点的行
     *
     * @param id id
     * @return R
     */
    @ApiOperation(value = "取消未盘点的行", notes = "取消未盘点的行")
    @SysLog("取消未盘点的行")
    @PostMapping("/detail/cancelNoIny")
    public R cancelNoIny(@RequestBody List<Long> ids) {
        return R.ok(inventoryDetailService.cancelNoIny(ids));
    }
 
 
    /**
     * 新增pda盘点前check
     *
     * @param inventoryDetail 新增pda盘点前check
     * @return R
     */
    @ApiOperation(value = "新增pda盘点前check", notes = "新增pda盘点前check")
    @SysLog("新增pda盘点前check")
    @PostMapping("/checkSavePda")
    public R checkSavePda(@RequestBody InventoryDetail inventoryDetail) {
        return R.ok(inventoryDetailService.checkSavePda(inventoryDetail));
    }
 
 
    /**
     * 新增pda盘点
     *
     * @param inventoryDetail pda盘点
     * @return R
     */
    @ApiOperation(value = "新增pda盘点", notes = "新增pda盘点")
    @SysLog("新增pda盘点")
    @PostMapping("/pda")
    public R savePda(@RequestBody InventoryDetail inventoryDetail) {
        return R.ok(inventoryDetailService.savePda(inventoryDetail));
    }
 
 
 
    /**
     * 导出
     *
     * @return
     */
    @ApiOperation(value = "导出", notes = "导出")
    @GetMapping("/export")
    public void export(HttpServletResponse response,@RequestParam List<Long> ids) throws IOException {
        inventoryMainService.export(response, ids);
    }
 
 
    @ApiOperation(value = "根据零件号获取零件信息", notes = "根据零件号获取零件信息")
    @GetMapping("/getPartNo")
    public R getPartNo(@RequestParam("partNo")String partNo) {
        return R.ok(partService.getOne(Wrappers.<Part>lambdaQuery().eq(Part::getPartNo, partNo)));
    }
 
 
 
    @ApiOperation(value = "判断标签是否是盘点时打印", notes = "判断标签是否是盘点时打印")
    @PostMapping("/judgeLabelMark")
    public R judgeLabelMark(@RequestBody List<String> snList) {
        return R.ok(inventoryDetailService.judgeLabelMark(snList));
    }
 
 
 
 
}