| | |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.vo.MesQcImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.vo.MesQcQualityExportVO; |
| | | import cn.iocoder.yudao.module.srm.api.supplier.SrmSupplierApi; |
| | | import cn.iocoder.yudao.module.srm.api.supplier.dto.SrmSupplierRespDTO; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | |
| | | ExcelUtils.write(response, "来料检验单.xls", "数据", MesQcQualityExportVO.class, exportList); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得导入来料检验单模板") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-iqc:import')") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | List<MesQcIqcImportExcelVO> list = Collections.singletonList( |
| | | MesQcIqcImportExcelVO.builder() |
| | | .name("示例-物料A来料检验").itemCode("WL0001").vendorName("示例供应商有限公司") |
| | | .vendorBatch("VB20260101").templateName("") |
| | | .receivedQuantity(new BigDecimal("100")).qualifiedQuantity(new BigDecimal("99")) |
| | | .unqualifiedQuantity(new BigDecimal("1")).checkResult("校验通过").inspectorName("") |
| | | .inspectDate("2026-01-01 10:00:00").receiveDate("2026-01-01 09:00:00") |
| | | .remark("示例数据,导入前请替换") |
| | | .build()); |
| | | ExcelUtils.write(response, "来料检验单导入模板.xls", "来料检验", MesQcIqcImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入来料检验单") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-iqc:import')") |
| | | public CommonResult<MesQcImportRespVO> importIqcExcel(@RequestParam("file") MultipartFile file) throws Exception { |
| | | List<MesQcIqcImportExcelVO> list = ExcelUtils.read(file, MesQcIqcImportExcelVO.class); |
| | | return success(iqcService.importIqcList(list)); |
| | | } |
| | | |
| | | // ==================== 拼接 VO ==================== |
| | | |
| | | private List<MesQcIqcRespVO> buildIqcRespVOList(List<MesQcIqcDO> list) { |