| | |
| | | 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.mes.controller.admin.wm.productsales.vo.MesWmProductSalesImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productsales.vo.MesWmProductSalesImportRespVO; |
| | | 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 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.*; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | |
| | | buildRespVOList(pageResult.getList())); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "获得销售出库单导入模板") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:import')") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | List<MesWmProductSalesImportExcelVO> list = Arrays.asList( |
| | | // 同一出库单号的两行 = 同一张出库单的两条明细 |
| | | MesWmProductSalesImportExcelVO.builder() |
| | | .code("PS202610310001").clientName("示例客户").name("示例客户-2026-10-31 出库") |
| | | .salesDate("2026-10-31").salesOrderCode("").contactName("张三") |
| | | .contactTelephone("13800138000").contactAddress("示例收货地址") |
| | | .itemCode("ITEM001").batchCode("").quantity(new BigDecimal("10")) |
| | | .oqcCheckFlag("否").remark("示例数据,导入前请替换").build(), |
| | | MesWmProductSalesImportExcelVO.builder() |
| | | .code("PS202610310001").clientName("示例客户").name("示例客户-2026-10-31 出库") |
| | | .salesDate("2026-10-31").salesOrderCode("").contactName("张三") |
| | | .contactTelephone("13800138000").contactAddress("示例收货地址") |
| | | .itemCode("ITEM002").batchCode("").quantity(new BigDecimal("5")) |
| | | .oqcCheckFlag("否").remark("示例数据,导入前请替换").build()); |
| | | ExcelUtils.write(response, "销售出库单导入模板.xls", "销售出库单", MesWmProductSalesImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入销售出库单", description = "导入后生成草稿状态的出库单,不提交、不占用库存") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-product-sales:import')") |
| | | public CommonResult<MesWmProductSalesImportRespVO> importProductSalesExcel( |
| | | @RequestParam("file") MultipartFile file) throws Exception { |
| | | List<MesWmProductSalesImportExcelVO> list = ExcelUtils.read(file, MesWmProductSalesImportExcelVO.class); |
| | | return success(productSalesService.importProductSalesList(list)); |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "提交销售出库单") |
| | | @Parameter(name = "id", description = "编号", required = true) |