| | |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesShippingReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesScanReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesScanRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.salesnotice.MesWmSalesNoticeDO; |
| | | import cn.iocoder.yudao.module.mes.service.wm.productsales.MesWmProductSalesService; |
| | |
| | | private MesWmProductSalesService productSalesService; |
| | | @Resource |
| | | private CrmCustomerApi crmCustomerApi; |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private MesWmSalesNoticeService salesNoticeService; |
| | | |
| | |
| | | return success(productSalesService.checkProductSalesQuantity(id)); |
| | | } |
| | | |
| | | @PostMapping("/scan") |
| | | @Operation(summary = "扫码拣货") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:stock')") |
| | | public CommonResult<MesWmProductSalesScanRespVO> scanProductSales( |
| | | @Valid @RequestBody MesWmProductSalesScanReqVO reqVO) { |
| | | return success(productSalesService.scanProductSales(reqVO)); |
| | | } |
| | | |
| | | @PutMapping("/stock") |
| | | @Operation(summary = "执行拣货") |
| | | @Parameter(name = "id", description = "编号", required = true) |
| | |
| | | convertSet(list, MesWmProductSalesDO::getClientId)); |
| | | Map<Long, MesWmSalesNoticeDO> noticeMap = salesNoticeService.getSalesNoticeMap( |
| | | convertSet(list, MesWmProductSalesDO::getNoticeId)); |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| | | convertSet(list, MesWmProductSalesDO::getOutboundUserId)); |
| | | // 2. 构建结果 |
| | | return BeanUtils.toBean(list, MesWmProductSalesRespVO.class, vo -> { |
| | | MapUtils.findAndThen(customerMap, vo.getClientId(), customer -> |
| | | vo.setClientName(customer.getName())); |
| | | if (vo.getClientName() == null) { |
| | | MapUtils.findAndThen(customerMap, vo.getClientId(), customer -> vo.setClientName(customer.getName())); |
| | | } |
| | | MapUtils.findAndThen(noticeMap, vo.getNoticeId(), |
| | | notice -> vo.setNoticeCode(notice.getCode())); |
| | | MapUtils.findAndThen(userMap, vo.getOutboundUserId(), |
| | | user -> vo.setOutboundUserName(user.getNickname())); |
| | | }); |
| | | } |
| | | |