| | |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.controller.params.AsnOrderAndItemsParams; |
| | | import com.vincent.rsf.server.manager.controller.params.BatchUpdateParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:list')") |
| | | @OperationLog("表单查询") |
| | | @GetMapping("/asnOrder/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(asnOrderService.getById(id)); |
| | |
| | | @PostMapping("/asnOrder/export") |
| | | @ApiOperation("导出") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(asnOrderService.list(), AsnOrder.class), response); |
| | | List<AsnOrder> orders = new ArrayList<>(); |
| | | if (!Objects.isNull(map.get("ids"))) { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>().in(AsnOrder::getId, map.get("ids")).eq(AsnOrder::getStatus, 1)); |
| | | } else { |
| | | orders = asnOrderService.list(new LambdaQueryWrapper<AsnOrder>().last("limit 1")); |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(orders, AsnOrder.class), response); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:list')") |
| | | public R getListByMatnr(@RequestBody Map<String, String> params){ |
| | | if (Objects.isNull(params)) { |
| | | throw new CoolException("查询条件不能为空!!"); |
| | | return R.error("查询条件不能为空!!"); |
| | | } |
| | | return R.ok(asnOrderService.getListByMatnr(params)); |
| | | } |
| | | |
| | | @PostMapping("/asnOrder/generate/barcode") |
| | | @ApiOperation("生成ASN标签") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:list')") |
| | | public R generateBarcode(@RequestBody List<AsnOrder> orders) { |
| | | if (orders.isEmpty()) { |
| | | return R.error("单据不能为空!!"); |
| | | |
| | | @PostMapping("/asnOrder/items/save") |
| | | @ApiOperation("保存主单及明细") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:save')") |
| | | public R orderAndItem(@RequestBody AsnOrderAndItemsParams params) throws Exception { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return asnOrderService.generateBarcode(orders); |
| | | return asnOrderService.saveOrderAndItems(params, getLoginUserId()); |
| | | } |
| | | |
| | | @ApiOperation("单据信息修改") |
| | | @PostMapping("/asnOrder/items/update") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:update')") |
| | | public R orderAndrItemUpdate(@RequestBody AsnOrderAndItemsParams params) throws Exception { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return asnOrderService.updateOrderItem(params, getLoginUserId()); |
| | | } |
| | | |
| | | @ApiOperation("单据批量修改") |
| | | @PostMapping("/asnOrder/batch/update") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:update')") |
| | | public R batchUpdate(@RequestBody BatchUpdateParam params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getOrder())) { |
| | | return R.error("修改参数不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getIds()) || params.getIds().isEmpty()) { |
| | | return R.error("修改ID不能为空!!"); |
| | | } |
| | | return R.ok(asnOrderService.batchUpdate(params, getLoginUserId())); |
| | | } |
| | | |
| | | @ApiOperation("一键收货") |
| | | @PostMapping("/asnOrder/complete/{id}") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:update')") |
| | | public R completeOrder(@PathVariable Long id) { |
| | | if (Objects.isNull(id)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return asnOrderService.completeOrder(id, getLoginUserId()); |
| | | } |
| | | |
| | | @ApiOperation("关闭收货单") |
| | | @PostMapping("/asnOrder/close/{id}") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:update')") |
| | | public R closeOrder(@PathVariable Long id) { |
| | | if (Objects.isNull(id)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return asnOrderService.closeOrder(id); |
| | | } |
| | | |
| | | } |