| | |
| | | @RequestMapping("/mes/wm/product-sales") |
| | | @Validated |
| | | public class MesWmProductSalesController { |
| | | @Resource private cn.iocoder.yudao.module.mes.dal.mysql.wm.productsales.MesWmProductSalesShipmentMapper shipmentMapper; |
| | | |
| | | @Resource |
| | | private MesWmProductSalesService productSalesService; |
| | |
| | | return success(productSalesService.checkProductSalesQuantity(id)); |
| | | } |
| | | |
| | | @GetMapping("/shipments") |
| | | @Operation(summary = "查询出库单发货记录") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:query')") |
| | | public CommonResult<List<cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesShipmentDO>> getShipments(@RequestParam("id") Long id) { |
| | | return success(productSalesService.getShipments(id)); |
| | | } |
| | | |
| | | @PostMapping("/scan") |
| | | @Operation(summary = "扫码拣货") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:stock')") |
| | |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/close-remaining") |
| | | @Operation(summary = "关闭部分发货单的剩余数量") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:cancel')") |
| | | public CommonResult<Boolean> closeRemaining(@RequestParam("id") Long id, @RequestParam("reason") String reason) { |
| | | productSalesService.closeRemaining(id, reason); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/cancel-shipment") |
| | | @Operation(summary = "取消本次未出库发货并释放占用") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:cancel')") |
| | | public CommonResult<Boolean> cancelShipment(@RequestParam("id") Long id) { |
| | | productSalesService.cancelShipment(id); |
| | | return success(true); |
| | | } |
| | | |
| | | // ==================== 拼接 VO ==================== |
| | | |
| | | private List<MesWmProductSalesRespVO> buildRespVOList(List<MesWmProductSalesDO> list) { |
| | |
| | | convertSet(list, MesWmProductSalesDO::getNoticeId)); |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| | | convertSet(list, MesWmProductSalesDO::getOutboundUserId)); |
| | | var partiallyShippedIds = convertSet(shipmentMapper.selectCompletedBySalesIds(convertSet(list, MesWmProductSalesDO::getId)), |
| | | cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesShipmentDO::getSalesId); |
| | | // 2. 构建结果 |
| | | return BeanUtils.toBean(list, MesWmProductSalesRespVO.class, vo -> { |
| | | vo.setPartiallyShipped(partiallyShippedIds.contains(vo.getId()) && (Integer.valueOf(2).equals(vo.getStatus()) |
| | | || Integer.valueOf(10).equals(vo.getStatus()) || Integer.valueOf(3).equals(vo.getStatus()))); |
| | | MapUtils.findAndThen(customerMap, vo.getClientId(), customer -> |
| | | vo.setClientName(customer.getName())); |
| | | if (vo.getClientName() == null) { |