| | |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.MesWmItemReceiptAuditReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.MesWmItemReceiptPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.MesWmItemReceiptRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.itemreceipt.vo.MesWmItemReceiptSaveReqVO; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.qc.iqc.MesQcIqcService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.arrivalnotice.MesWmArrivalNoticeService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.itemreceipt.MesWmItemReceiptService; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.srm.api.supplier.SrmSupplierApi; |
| | | import cn.iocoder.yudao.module.srm.api.supplier.dto.SrmSupplierRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | |
| | | @Resource |
| | | private MesWmItemReceiptService itemReceiptService; |
| | | @Resource |
| | | private ErpSupplierApi supplierApi; |
| | | private SrmSupplierApi srmSupplierApi; |
| | | @Resource |
| | | private MesQcIqcService iqcService; |
| | | @Resource |
| | |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "提交采购入库单") |
| | | @Operation(summary = "提交采购入库单审批(草稿→待上架),审核人由审批配置统一指定") |
| | | @Parameter(name = "id", description = "编号", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-item-receipt:update')") |
| | | public CommonResult<Boolean> submitItemReceipt(@RequestParam("id") Long id) { |
| | | itemReceiptService.submitItemReceipt(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/audit") |
| | | @Operation(summary = "审核采购入库单(待上架→待执行入库/草稿),仅审批人本人可操作") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-item-receipt:audit')") |
| | | public CommonResult<Boolean> auditItemReceipt(@Valid @RequestBody MesWmItemReceiptAuditReqVO auditReqVO) { |
| | | itemReceiptService.auditItemReceipt(auditReqVO.getId(), auditReqVO.getPass(), auditReqVO.getReviewRemark()); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/approver-ids") |
| | | @Operation(summary = "获得采购入库单的审核人编号集合,供前端判断是否展示审核按钮") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-item-receipt:query')") |
| | | public CommonResult<Set<Long>> approverIds() { |
| | | return success(itemReceiptService.getItemReceiptApproverUserIds()); |
| | | } |
| | | |
| | | @PutMapping("/stock") |
| | |
| | | return success(itemReceiptService.generateItemReceiptFromArrivalNotice(arrivalNoticeId)); |
| | | } |
| | | |
| | | @PutMapping("/submit-approval") |
| | | @Operation(summary = "提交采购入库单审批") |
| | | @Parameter(name = "id", description = "入库单编号", required = true) |
| | | @Parameter(name = "processDefinitionKey", description = "流程定义 Key", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-item-receipt:update')") |
| | | public CommonResult<Boolean> submitApproval(@RequestParam("id") Long id, |
| | | @RequestParam("processDefinitionKey") String processDefinitionKey) { |
| | | itemReceiptService.submitItemReceiptApproval(id, processDefinitionKey); |
| | | return success(true); |
| | | } |
| | | |
| | | // ==================== 拼接 VO ==================== |
| | | |
| | | private List<MesWmItemReceiptRespVO> buildRespVOList(List<MesWmItemReceiptDO> list) { |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. 获得关联数据(采购入库使用 ERP 供应商) |
| | | Map<Long, ErpSupplierRespDTO> supplierMap = supplierApi.getSupplierList( |
| | | Map<Long, SrmSupplierRespDTO> supplierMap = srmSupplierApi.getSupplierList( |
| | | convertSet(list, MesWmItemReceiptDO::getVendorId)).getCheckedData().stream() |
| | | .collect(java.util.stream.Collectors.toMap(ErpSupplierRespDTO::getId, v -> v, (a, b) -> a)); |
| | | .collect(java.util.stream.Collectors.toMap(SrmSupplierRespDTO::getId, v -> v, (a, b) -> a)); |
| | | Map<Long, MesQcIqcDO> iqcMap = iqcService.getIqcMap( |
| | | convertSet(list, MesWmItemReceiptDO::getIqcId)); |
| | | Map<Long, MesWmArrivalNoticeDO> noticeMap = arrivalNoticeService.getArrivalNoticeMap( |