jiangping
2023-08-18 af00e89990ae9757cc9261cbe560873c2066b69c
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
package doumeemes.api.ext;
 
import doumeemes.api.BaseController;
import doumeemes.core.annotation.pr.PreventRepeat;
import doumeemes.core.model.ApiResponse;
import doumeemes.core.model.PageWrap;
import doumeemes.core.model.PageData;
import doumeemes.dao.business.model.WTransfer;
import doumeemes.dao.ext.bean.WTransferBean;
import doumeemes.dao.ext.bean.WTransferConfirmBean;
import doumeemes.dao.ext.bean.WTransferRedisCodeBean;
import doumeemes.dao.ext.bean.WTransferRedisBean;
import doumeemes.dao.ext.beanDto.QueryWOutBoundDto;
import doumeemes.dao.ext.beanDto.QueryWTransferDto;
import doumeemes.dao.ext.beanDto.SubmitTransferInDTO;
import doumeemes.dao.ext.beanDto.SubmitTransferOutDTO;
import doumeemes.dao.ext.dto.ScanWTransferExtDTO;
import doumeemes.dao.ext.vo.WOutboundListCountVO;
import doumeemes.dao.ext.vo.WTransferExtListVO;
import doumeemes.dao.ext.vo.WTransferListCountVO;
import doumeemes.service.business.WTransferService;
import doumeemes.service.ext.WTransferExtService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;    
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
/**
 * 换库单信息接口
 * @author 江蹄蹄
 * @date 2022/04/20 10:56
 */
@RestController
@RequestMapping("/ext/wTransferExt")
@Api(tags = "换库单信息接口")
public class WTransferExtController extends BaseController {
 
    @Autowired
    private WTransferExtService wTransferExtService;
    
    @Autowired
    private WTransferService wTransferService;
 
//    @PreventRepeat
//    @ApiOperation("新建")
//    @PostMapping("/create")
//    @RequiresPermissions("ext:wtransferext:create")
//    public ApiResponse create(@RequestBody WTransfer wTransfer) {
//        return ApiResponse.success(wTransferService.create(wTransfer));
//    }
//
//    @ApiOperation("根据ID删除")
//    @GetMapping("/delete/{id}")
//    @RequiresPermissions("ext:wtransferext:delete")
//    public ApiResponse deleteById(@PathVariable Integer id) {
//        wTransferService.deleteById(id);
//        return ApiResponse.success(null);
//    }
//
//    @ApiOperation("批量删除")
//    @GetMapping("/delete/batch")
//    @RequiresPermissions("ext:wtransferext:delete")
//    public ApiResponse deleteByIds(@RequestParam String ids) {
//        String [] idArray = ids.split(",");
//        List<Integer> idList = new ArrayList<>();
//        for (String id : idArray) {
//            idList.add(Integer.valueOf(id));
//        }
//        wTransferService.deleteByIdInBatch(idList);
//        return ApiResponse.success(null);
//    }
//
//    @ApiOperation("根据ID修改")
//    @PostMapping("/updateById")
//    @RequiresPermissions("ext:wtransferext:update")
//    public ApiResponse updateById(@RequestBody WTransfer wTransfer) {
//        wTransferService.updateById(wTransfer);
//        return ApiResponse.success(null);
//    }
//
//    @ApiOperation("分页查询")
//    @PostMapping("/page")
//    @RequiresPermissions("ext:wtransferext:query")
//    public ApiResponse<PageData<WTransferExtListVO>> findPage (@RequestBody PageWrap<QueryWTransferExtDTO> pageWrap) {
//        return ApiResponse.success(wTransferExtService.findPage(pageWrap));
//    }
//
//    @ApiOperation("导出Excel")
//    @PostMapping("/exportExcel")
//    @RequiresPermissions("ext:wtransferext:exportExcel")
//    public void exportExcel (@RequestBody PageWrap<QueryWTransferExtDTO> pageWrap, HttpServletResponse response) {
//        ExcelExporter.build(WTransferExtListVO.class).export(wTransferExtService.findPage(pageWrap).getRecords(), "换库单信息", response);
//    }
//
//    @ApiOperation("根据ID查询")
//    @GetMapping("/{id}")
//    @RequiresPermissions("ext:wtransferext:query")
//    public ApiResponse findById(@PathVariable Integer id) {
//        return ApiResponse.success(wTransferService.findById(id));
//    }
//
 
 
 
    @PreventRepeat
    @ApiOperation("手动新建转库单 - PC")
    @PostMapping("/create")
    @RequiresPermissions("ext:wtransferext:create")
    public ApiResponse create(@Validated @RequestBody WTransferBean wTransferBean) {
        return wTransferService.saveBean(wTransferBean,getLoginUser());
    }
 
    @ApiOperation("分页查询 - PC")
    @PostMapping("/page")
    @RequiresPermissions("ext:wtransferext:query")
    public ApiResponse<PageData<WTransferExtListVO>>page(@RequestBody PageWrap<QueryWTransferDto> pageWrap) {
        return ApiResponse.success(wTransferExtService.findListPage(pageWrap));
    }
 
 
    @ApiOperation("根据ID查询 - PC ")
    @GetMapping("/{id}")
    @RequiresPermissions("ext:wtransferext:query")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "主键" , required = true),
    })
    public ApiResponse<WTransfer> getBeanById(@PathVariable Integer id) {
        return ApiResponse.success(wTransferService.getBeanById(id));
    }
 
 
    @ApiOperation("分页查询 - H5")
    @PostMapping("/pageList")
    public ApiResponse<PageData<WTransferExtListVO>>pageList(@RequestBody PageWrap<QueryWTransferDto> pageWrap) {
        return ApiResponse.success(wTransferExtService.findListPage(pageWrap));
    }
 
 
    @ApiOperation("转库列表统计 - H5")
    @PostMapping("/pageCount")
    @RequiresPermissions("ext:wtransferext:query")
    public ApiResponse<WTransferListCountVO> pageCount (@RequestBody QueryWTransferDto queryWTransferDto) {
        return ApiResponse.success(wTransferExtService.pageCount(queryWTransferDto));
    }
 
 
    @ApiOperation("单据取消")
    @GetMapping("/cancel")
    @RequiresPermissions("ext:wtransferext:cancel")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "主键" , required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "detail", value = "取消描述" , required = true),
    })
    public ApiResponse cancel(@RequestParam Integer id,@RequestParam String detail) {
        return wTransferService.cancel(id,detail,getLoginUser());
    }
 
    @ApiOperation("备料确认详情页面 - H5 ")
    @GetMapping("/wTransferConfirm")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "转库单主键" , required = true),
    })
    public ApiResponse<WTransferConfirmBean> wTransferConfirm(@RequestParam Integer id) {
        return wTransferService.wTransferConfirm(id);
    }
 
    @ApiOperation("备料确认 - 接受备料 - H5 ")
    @GetMapping("/acceptWTransfer")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "转库单编码" , required = true),
    })
    public ApiResponse acceptWTransfer(@RequestParam Integer id) {
        return wTransferService.acceptWTransfer(id,getLoginUser());
    }
 
 
    @ApiOperation(value = "获取转库单信息", notes = "转库单进行出入库操作 - H5")
    @GetMapping("/wTransferForInOut")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "转库单主键" , required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "wTransferType", value = "转库单类别 0:转出;1转入" , required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "optType", value = "操作类别:1 添加 2 移除" , required = false),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "jsonBean", value = "添加条码类" , required = false)
    }) //, @RequestBody WTransferRedisCodeBean codeBean
    public ApiResponse<WTransferRedisBean> wTransferForInOut(@RequestParam Integer id, @RequestParam Integer wTransferType, Integer optType, String jsonBean) {
        return ApiResponse.success(wTransferService.wTransferForInOut(id,wTransferType,optType,jsonBean));
    }
 
 
 
    @ApiOperation(value = "提交转库单出入库", notes = "转库单进行出入库提交 - H5")
    @GetMapping("/wTransferForInOutUpload")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "转库单主键" , required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "wTransferType", value = "转库单类别 0:转出;1转入" , required = true)
    })
    public ApiResponse wTransferForInOutUpload(@RequestParam Integer id, @RequestParam Integer wTransferType) {
        wTransferService.wTransferForInOutUpload(id,wTransferType,getLoginUser());
        return ApiResponse.success("操作成功");
    }
 
    @ApiOperation("转库退回 ")
    @GetMapping("/wTransferReturn")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "转库单主键" , required = true),
    })
    public ApiResponse wTransferReturn(@RequestParam Integer id) {
        return wTransferService.wTransferReturnForStandard(id,getLoginUser());
    }
 
 
    @ApiOperation("手工转库 - H5")
    @PostMapping("/scanTransfer")
    public ApiResponse scanTransfer(@RequestBody ScanWTransferExtDTO scanWTransferExtDTO) {
        this.wTransferService.scanTransfer(scanWTransferExtDTO,getLoginUser());
        return ApiResponse.success("操作成功");
    }
 
 
    @ApiOperation(value = "测试转库类别", notes = "测试转库类别")
    @GetMapping("/testWarehouse")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Long", name = "outWarehouseId", value = "出库仓库主键" , required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Long", name = "inWarehouseId", value = "入库仓库主键" , required = true)
    })
    public ApiResponse<Integer> testWarehouse(@RequestParam Integer outWarehouseId, @RequestParam Integer inWarehouseId) {
        return ApiResponse.success(wTransferService.testWarehouse(outWarehouseId,inWarehouseId));
    }
 
 
 
    /********************************************************************* 调整业务 开始 *********************************************************************/
 
    @ApiOperation("转库出库业务 - H5")
    @PostMapping("/transferToOutNew")
    public ApiResponse transferToOutNew(@RequestBody SubmitTransferOutDTO submitTransferOutDTO) {
        this.wTransferService.wTransferForOutUpload(submitTransferOutDTO,getLoginUser());
        return ApiResponse.success("操作成功");
    }
 
    @ApiOperation("转库入库业务 - H5")
    @PostMapping("/transferToInNew")
    public ApiResponse transferToInNew(@RequestBody SubmitTransferInDTO submitTransferInDTO) {
        this.wTransferService.wTransferForInUpload(submitTransferInDTO,getLoginUser());
        return ApiResponse.success("操作成功");
    }
 
    /********************************************************************* 调整业务 结束 *********************************************************************/
 
}