From 8cc5549850de625c7ef2d4c1f424ee2ff1310aae Mon Sep 17 00:00:00 2001 From: 86156 <823267011@qq.com> Date: Sat, 14 Mar 2026 15:06:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BF=AB=E9=80=9F=E6=8E=92?= =?UTF-8?q?=E6=9F=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ApsQuickSheetController.java | 55 ++ .../aps/domain/dto/ApsQuickSheetQueryReq.java | 20 + .../aps/domain/dto/ApsQuickSheetSaveReq.java | 35 + .../domain/entity/ApsQuickSheetEntity.java | 35 + .../klp/aps/domain/vo/ApsQuickSheetRowVo.java | 28 + .../klp/aps/mapper/ApsQuickSheetMapper.java | 73 ++ .../klp/aps/service/ApsQuickSheetService.java | 20 + .../impl/ApsQuickSheetServiceImpl.java | 214 +++++ .../mapper/aps/ApsQuickSheetMapper.xml | 44 ++ klp-ui/src/api/aps/quickSheet.js | 42 + klp-ui/src/views/aps/quickSheet.vue | 748 ++++++++++++++++++ klp-ui/src/views/aps/quickSheetPreview.vue | 225 ++++++ klp-ui/src/views/aps/sheets/templates.js | 2 +- 13 files changed, 1540 insertions(+), 1 deletion(-) create mode 100644 klp-aps/src/main/java/com/klp/aps/controller/ApsQuickSheetController.java create mode 100644 klp-aps/src/main/java/com/klp/aps/domain/dto/ApsQuickSheetQueryReq.java create mode 100644 klp-aps/src/main/java/com/klp/aps/domain/dto/ApsQuickSheetSaveReq.java create mode 100644 klp-aps/src/main/java/com/klp/aps/domain/entity/ApsQuickSheetEntity.java create mode 100644 klp-aps/src/main/java/com/klp/aps/domain/vo/ApsQuickSheetRowVo.java create mode 100644 klp-aps/src/main/java/com/klp/aps/mapper/ApsQuickSheetMapper.java create mode 100644 klp-aps/src/main/java/com/klp/aps/service/ApsQuickSheetService.java create mode 100644 klp-aps/src/main/java/com/klp/aps/service/impl/ApsQuickSheetServiceImpl.java create mode 100644 klp-aps/src/main/resources/mapper/aps/ApsQuickSheetMapper.xml create mode 100644 klp-ui/src/api/aps/quickSheet.js create mode 100644 klp-ui/src/views/aps/quickSheet.vue create mode 100644 klp-ui/src/views/aps/quickSheetPreview.vue diff --git a/klp-aps/src/main/java/com/klp/aps/controller/ApsQuickSheetController.java b/klp-aps/src/main/java/com/klp/aps/controller/ApsQuickSheetController.java new file mode 100644 index 00000000..3494968a --- /dev/null +++ b/klp-aps/src/main/java/com/klp/aps/controller/ApsQuickSheetController.java @@ -0,0 +1,55 @@ +package com.klp.aps.controller; + +import com.klp.aps.domain.dto.ApsQuickSheetQueryReq; +import com.klp.aps.domain.dto.ApsQuickSheetSaveReq; +import com.klp.aps.domain.vo.ApsQuickSheetRowVo; +import com.klp.aps.service.ApsQuickSheetService; +import com.klp.common.core.controller.BaseController; +import com.klp.common.core.domain.R; +import com.klp.common.helper.LoginHelper; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RequiredArgsConstructor +@RestController +@RequestMapping("/aps/quick-sheet") +public class ApsQuickSheetController extends BaseController { + + private final ApsQuickSheetService quickSheetService; + + @GetMapping("/list") + public R> list(@Validated ApsQuickSheetQueryReq req) { + return R.ok(quickSheetService.queryList(req)); + } + + @GetMapping("/preset") + public R> preset(@RequestParam(value = "lineId", required = false) Long lineId) { + String salesman = LoginHelper.getNickName(); + return R.ok(quickSheetService.buildPresetRows(lineId, salesman)); + } + + @PostMapping("/save") + public R save(@Validated @RequestBody ApsQuickSheetSaveReq req) { + quickSheetService.saveRows(req, getUsername()); + return R.ok(); + } + + @GetMapping("/export") + public void export(@Validated ApsQuickSheetQueryReq req, javax.servlet.http.HttpServletResponse response) { + quickSheetService.exportExcel(req, response); + } + + @PostMapping("/delete") + public R delete(@RequestParam("quickSheetId") Long quickSheetId) { + quickSheetService.deleteById(quickSheetId, getUsername()); + return R.ok(); + } +} diff --git a/klp-aps/src/main/java/com/klp/aps/domain/dto/ApsQuickSheetQueryReq.java b/klp-aps/src/main/java/com/klp/aps/domain/dto/ApsQuickSheetQueryReq.java new file mode 100644 index 00000000..0e84a1fa --- /dev/null +++ b/klp-aps/src/main/java/com/klp/aps/domain/dto/ApsQuickSheetQueryReq.java @@ -0,0 +1,20 @@ +package com.klp.aps.domain.dto; + +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +@Data +public class ApsQuickSheetQueryReq { + + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate startDate; + + @DateTimeFormat(pattern = "yyyy-MM-dd") + private LocalDate endDate; + + private Long lineId; + + private String customerName; +} diff --git a/klp-aps/src/main/java/com/klp/aps/domain/dto/ApsQuickSheetSaveReq.java b/klp-aps/src/main/java/com/klp/aps/domain/dto/ApsQuickSheetSaveReq.java new file mode 100644 index 00000000..9972949a --- /dev/null +++ b/klp-aps/src/main/java/com/klp/aps/domain/dto/ApsQuickSheetSaveReq.java @@ -0,0 +1,35 @@ +package com.klp.aps.domain.dto; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +@Data +public class ApsQuickSheetSaveReq { + + @NotEmpty(message = "rows 不能为空") + private List rows; + + @Data + public static class Row { + private Long quickSheetId; + private Long lineId; + private String lineName; + private String planCode; + private String orderCode; + private String customerName; + private String salesman; + private String productName; + private String rawMaterialId; + private String rawCoilNos; + private String rawLocation; + private String rawPackaging; + private String rawEdgeReq; + private String rawCoatingType; + private String rawNetWeight; + private String planQty; + private String startTime; + private String endTime; + } +} diff --git a/klp-aps/src/main/java/com/klp/aps/domain/entity/ApsQuickSheetEntity.java b/klp-aps/src/main/java/com/klp/aps/domain/entity/ApsQuickSheetEntity.java new file mode 100644 index 00000000..66806908 --- /dev/null +++ b/klp-aps/src/main/java/com/klp/aps/domain/entity/ApsQuickSheetEntity.java @@ -0,0 +1,35 @@ +package com.klp.aps.domain.entity; + +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Data +public class ApsQuickSheetEntity { + private Long quickSheetId; + private LocalDate planDate; + private Long lineId; + private String lineName; + private String planCode; + private String orderCode; + private String customerName; + private String salesman; + private String productName; + private String rawMaterialId; + private String rawCoilNos; + private String rawLocation; + private String rawPackaging; + private String rawEdgeReq; + private String rawCoatingType; + private BigDecimal rawNetWeight; + private BigDecimal planQty; + private LocalDateTime startTime; + private LocalDateTime endTime; + private String createBy; + private String updateBy; + private LocalDateTime createTime; + private LocalDateTime updateTime; + private Integer delFlag; +} diff --git a/klp-aps/src/main/java/com/klp/aps/domain/vo/ApsQuickSheetRowVo.java b/klp-aps/src/main/java/com/klp/aps/domain/vo/ApsQuickSheetRowVo.java new file mode 100644 index 00000000..324aa49d --- /dev/null +++ b/klp-aps/src/main/java/com/klp/aps/domain/vo/ApsQuickSheetRowVo.java @@ -0,0 +1,28 @@ +package com.klp.aps.domain.vo; + +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +@Data +public class ApsQuickSheetRowVo { + private Long quickSheetId; + private Long lineId; + private String lineName; + private String planCode; + private String orderCode; + private String customerName; + private String salesman; + private String productName; + private String rawMaterialId; + private String rawCoilNos; + private String rawLocation; + private String rawPackaging; + private String rawEdgeReq; + private String rawCoatingType; + private BigDecimal rawNetWeight; + private BigDecimal planQty; + private LocalDateTime startTime; + private LocalDateTime endTime; +} diff --git a/klp-aps/src/main/java/com/klp/aps/mapper/ApsQuickSheetMapper.java b/klp-aps/src/main/java/com/klp/aps/mapper/ApsQuickSheetMapper.java new file mode 100644 index 00000000..036d0b17 --- /dev/null +++ b/klp-aps/src/main/java/com/klp/aps/mapper/ApsQuickSheetMapper.java @@ -0,0 +1,73 @@ +package com.klp.aps.mapper; + +import com.klp.aps.domain.vo.ApsQuickSheetRowVo; +import com.klp.aps.domain.dto.ApsQuickSheetQueryReq; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface ApsQuickSheetMapper { + + List selectList(ApsQuickSheetQueryReq req); + + @Select("SELECT COUNT(1) FROM aps_quick_sheet WHERE del_flag = 0 AND plan_date = #{planDate}") + int countToday(@Param("planDate") java.time.LocalDate planDate); + + @Select("SELECT quick_sheet_id FROM aps_quick_sheet WHERE plan_code = #{planCode} AND del_flag = 0 LIMIT 1") + Long selectIdByPlanCode(@Param("planCode") String planCode); + + @org.apache.ibatis.annotations.Insert("INSERT INTO aps_quick_sheet (line_id, line_name, plan_date, plan_code, order_code, customer_name, salesman, product_name, raw_material_id, raw_coil_nos, raw_location, raw_packaging, raw_edge_req, raw_coating_type, raw_net_weight, plan_qty, start_time, end_time, create_by, update_by, create_time, update_time, del_flag) " + + "VALUES (#{lineId}, #{lineName}, #{planDate}, #{planCode}, #{orderCode}, #{customerName}, #{salesman}, #{productName}, #{rawMaterialId}, #{rawCoilNos}, #{rawLocation}, #{rawPackaging}, #{rawEdgeReq}, #{rawCoatingType}, #{rawNetWeight}, #{planQty}, #{startTime}, #{endTime}, #{createBy}, #{updateBy}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0)") + int insertRow(@Param("lineId") Long lineId, + @Param("lineName") String lineName, + @Param("planDate") java.time.LocalDate planDate, + @Param("planCode") String planCode, + @Param("orderCode") String orderCode, + @Param("customerName") String customerName, + @Param("salesman") String salesman, + @Param("productName") String productName, + @Param("rawMaterialId") String rawMaterialId, + @Param("rawCoilNos") String rawCoilNos, + @Param("rawLocation") String rawLocation, + @Param("rawPackaging") String rawPackaging, + @Param("rawEdgeReq") String rawEdgeReq, + @Param("rawCoatingType") String rawCoatingType, + @Param("rawNetWeight") java.math.BigDecimal rawNetWeight, + @Param("planQty") java.math.BigDecimal planQty, + @Param("startTime") java.time.LocalDateTime startTime, + @Param("endTime") java.time.LocalDateTime endTime, + @Param("createBy") String createBy, + @Param("updateBy") String updateBy); + + @org.apache.ibatis.annotations.Update("UPDATE aps_quick_sheet SET line_id = #{lineId}, line_name = #{lineName}, plan_code = #{planCode}, order_code = #{orderCode}, customer_name = #{customerName}, salesman = #{salesman}, product_name = #{productName}, raw_material_id = #{rawMaterialId}, raw_coil_nos = #{rawCoilNos}, raw_location = #{rawLocation}, raw_packaging = #{rawPackaging}, raw_edge_req = #{rawEdgeReq}, raw_coating_type = #{rawCoatingType}, raw_net_weight = #{rawNetWeight}, plan_qty = #{planQty}, start_time = #{startTime}, end_time = #{endTime}, update_by = #{updateBy}, update_time = CURRENT_TIMESTAMP WHERE quick_sheet_id = #{id}") + int updateRow(@Param("id") Long id, + @Param("lineId") Long lineId, + @Param("lineName") String lineName, + @Param("planCode") String planCode, + @Param("orderCode") String orderCode, + @Param("customerName") String customerName, + @Param("salesman") String salesman, + @Param("productName") String productName, + @Param("rawMaterialId") String rawMaterialId, + @Param("rawCoilNos") String rawCoilNos, + @Param("rawLocation") String rawLocation, + @Param("rawPackaging") String rawPackaging, + @Param("rawEdgeReq") String rawEdgeReq, + @Param("rawCoatingType") String rawCoatingType, + @Param("rawNetWeight") java.math.BigDecimal rawNetWeight, + @Param("planQty") java.math.BigDecimal planQty, + @Param("startTime") java.time.LocalDateTime startTime, + @Param("endTime") java.time.LocalDateTime endTime, + @Param("updateBy") String updateBy); + + @org.apache.ibatis.annotations.Update("UPDATE aps_quick_sheet SET del_flag = 1, update_by = #{updateBy}, update_time = CURRENT_TIMESTAMP WHERE quick_sheet_id = #{id}") + int deleteRow(@Param("id") Long id, @Param("updateBy") String updateBy); + + @org.apache.ibatis.annotations.Update("UPDATE aps_quick_sheet SET del_flag = 1, update_by = #{updateBy}, update_time = CURRENT_TIMESTAMP WHERE quick_sheet_id = #{id}") + int softDelete(@Param("id") Long id, + @Param("updateBy") String updateBy); + + @org.apache.ibatis.annotations.Update("UPDATE aps_quick_sheet SET del_flag = 1, update_by = #{updateBy}, update_time = CURRENT_TIMESTAMP WHERE quick_sheet_id = #{id}") + int deleteById(@Param("id") Long id, @Param("updateBy") String updateBy); +} diff --git a/klp-aps/src/main/java/com/klp/aps/service/ApsQuickSheetService.java b/klp-aps/src/main/java/com/klp/aps/service/ApsQuickSheetService.java new file mode 100644 index 00000000..4f88f233 --- /dev/null +++ b/klp-aps/src/main/java/com/klp/aps/service/ApsQuickSheetService.java @@ -0,0 +1,20 @@ +package com.klp.aps.service; + +import com.klp.aps.domain.dto.ApsQuickSheetQueryReq; +import com.klp.aps.domain.dto.ApsQuickSheetSaveReq; +import com.klp.aps.domain.vo.ApsQuickSheetRowVo; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +public interface ApsQuickSheetService { + List queryList(ApsQuickSheetQueryReq req); + + void saveRows(ApsQuickSheetSaveReq req, String operator); + + List buildPresetRows(Long lineId, String salesman); + + void exportExcel(ApsQuickSheetQueryReq req, HttpServletResponse response); + + void deleteById(Long id, String operator); +} diff --git a/klp-aps/src/main/java/com/klp/aps/service/impl/ApsQuickSheetServiceImpl.java b/klp-aps/src/main/java/com/klp/aps/service/impl/ApsQuickSheetServiceImpl.java new file mode 100644 index 00000000..82cc455b --- /dev/null +++ b/klp-aps/src/main/java/com/klp/aps/service/impl/ApsQuickSheetServiceImpl.java @@ -0,0 +1,214 @@ +package com.klp.aps.service.impl; + +import com.klp.aps.domain.dto.ApsQuickSheetSaveReq; +import com.klp.aps.domain.vo.ApsQuickSheetRowVo; +import com.klp.aps.mapper.ApsQuickSheetMapper; +import com.klp.aps.service.ApsQuickSheetService; +import com.klp.common.exception.ServiceException; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.List; + +@RequiredArgsConstructor +@Service +public class ApsQuickSheetServiceImpl implements ApsQuickSheetService { + + private final ApsQuickSheetMapper quickSheetMapper; + + private static final DateTimeFormatter DATE_CODE = DateTimeFormatter.ofPattern("yyyyMMdd"); + + @Override + public List queryList(com.klp.aps.domain.dto.ApsQuickSheetQueryReq req) { + return quickSheetMapper.selectList(req); + } + + @Override + public void saveRows(ApsQuickSheetSaveReq req, String operator) { + if (req == null || req.getRows() == null) { + throw new ServiceException("保存数据不能为空"); + } + for (ApsQuickSheetSaveReq.Row row : req.getRows()) { + if (row == null) continue; + Long id = row.getQuickSheetId(); + Long lineId = row.getLineId(); + String lineName = row.getLineName(); + String planCode = row.getPlanCode(); + String orderCode = row.getOrderCode(); + String customerName = row.getCustomerName(); + String salesman = row.getSalesman(); + String productName = row.getProductName(); + String rawMaterialId = row.getRawMaterialId(); + String rawCoilNos = row.getRawCoilNos(); + String rawLocation = row.getRawLocation(); + String rawPackaging = row.getRawPackaging(); + String rawEdgeReq = row.getRawEdgeReq(); + String rawCoatingType = row.getRawCoatingType(); + BigDecimal rawNetWeight = parseQty(row.getRawNetWeight()); + BigDecimal planQty = parseQty(row.getPlanQty()); + LocalDateTime startTime = parseTime(row.getStartTime()); + LocalDateTime endTime = parseTime(row.getEndTime()); + + boolean hasAny = lineId != null || isNotBlank(lineName) || isNotBlank(planCode) || isNotBlank(orderCode) + || isNotBlank(customerName) || isNotBlank(salesman) || isNotBlank(productName) + || isNotBlank(rawMaterialId) || isNotBlank(rawCoilNos) || isNotBlank(rawLocation) + || isNotBlank(rawPackaging) || isNotBlank(rawEdgeReq) || isNotBlank(rawCoatingType) + || rawNetWeight != null || planQty != null || startTime != null || endTime != null; + if (!hasAny) { + continue; + } + if (id == null) { + if (!isNotBlank(planCode)) { + planCode = buildPlanCode(); + } + quickSheetMapper.insertRow(lineId, lineName, LocalDate.now(), planCode, orderCode, customerName, salesman, productName, + rawMaterialId, rawCoilNos, rawLocation, rawPackaging, rawEdgeReq, rawCoatingType, rawNetWeight, planQty, startTime, endTime, operator, operator); + } else { + quickSheetMapper.updateRow(id, lineId, lineName, planCode, orderCode, customerName, salesman, productName, + rawMaterialId, rawCoilNos, rawLocation, rawPackaging, rawEdgeReq, rawCoatingType, rawNetWeight, planQty, startTime, endTime, operator); + } + } + } + + @Override + public List buildPresetRows(Long lineId, String salesman) { + List rows = new ArrayList<>(); + LocalDateTime now = LocalDateTime.now(); + LocalDateTime end = now.plusHours(1); + for (int i = 0; i < 3; i++) { + ApsQuickSheetRowVo row = new ApsQuickSheetRowVo(); + row.setLineId(lineId); + row.setLineName(lineId == null ? null : ("产线" + lineId)); + row.setSalesman(salesman); + row.setPlanQty(BigDecimal.ZERO); + row.setStartTime(now); + row.setEndTime(end); + row.setPlanCode(buildPlanCode()); + rows.add(row); + } + return rows; + } + + @Override + public void exportExcel(com.klp.aps.domain.dto.ApsQuickSheetQueryReq req, javax.servlet.http.HttpServletResponse response) { + List rows = queryList(req); + try (org.apache.poi.ss.usermodel.Workbook wb = new org.apache.poi.xssf.usermodel.XSSFWorkbook()) { + org.apache.poi.ss.usermodel.Sheet sheet = wb.createSheet("快速排产表"); + + int r = 0; + org.apache.poi.ss.usermodel.Row title = sheet.createRow(r++); + title.setHeightInPoints(36f); + org.apache.poi.ss.usermodel.Cell t0 = title.createCell(0); + t0.setCellValue("快速排产表(Excel录入)"); + sheet.addMergedRegion(new org.apache.poi.ss.util.CellRangeAddress(0, 0, 0, 14)); + + org.apache.poi.ss.usermodel.CellStyle titleStyle = wb.createCellStyle(); + titleStyle.setAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.CENTER); + titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER); + org.apache.poi.xssf.usermodel.XSSFFont titleFont = ((org.apache.poi.xssf.usermodel.XSSFWorkbook) wb).createFont(); + titleFont.setBold(true); + titleFont.setFontHeightInPoints((short) 15); + titleStyle.setFont(titleFont); + t0.setCellStyle(titleStyle); + + String[] headers = new String[]{ + "产线", "计划号", "订单号", "客户", "业务员", "产品", + "原料钢卷", "原料卷号", "钢卷位置", "包装要求", "切边要求", "镀层种类", + "原料净重", "计划数量", "开始时间", "结束时间" + }; + org.apache.poi.ss.usermodel.Row head = sheet.createRow(r++); + for (int i = 0; i < headers.length; i++) { + head.createCell(i).setCellValue(headers[i]); + } + + if (rows != null) { + for (ApsQuickSheetRowVo row : rows) { + org.apache.poi.ss.usermodel.Row rr = sheet.createRow(r++); + int cc = 0; + rr.createCell(cc++).setCellValue(nvl(row.getLineName(), row.getLineId())); + rr.createCell(cc++).setCellValue(nvl(row.getPlanCode(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getOrderCode(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getCustomerName(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getSalesman(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getProductName(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getRawMaterialId(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getRawCoilNos(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getRawLocation(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getRawPackaging(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getRawEdgeReq(), "")); + rr.createCell(cc++).setCellValue(nvl(row.getRawCoatingType(), "")); + rr.createCell(cc++).setCellValue(row.getRawNetWeight() == null ? "" : row.getRawNetWeight().toPlainString()); + rr.createCell(cc++).setCellValue(row.getPlanQty() == null ? "" : row.getPlanQty().toPlainString()); + rr.createCell(cc++).setCellValue(row.getStartTime() == null ? "" : row.getStartTime().toString()); + rr.createCell(cc++).setCellValue(row.getEndTime() == null ? "" : row.getEndTime().toString()); + } + } + + for (int i = 0; i < headers.length; i++) { + sheet.autoSizeColumn(i, true); + int w = sheet.getColumnWidth(i); + sheet.setColumnWidth(i, Math.min(Math.max(w, 3000), 12000)); + } + + String filename = "aps_quick_sheet_" + System.currentTimeMillis() + ".xlsx"; + String encoded = java.net.URLEncoder.encode(filename, java.nio.charset.StandardCharsets.UTF_8.name()); + response.setCharacterEncoding(java.nio.charset.StandardCharsets.UTF_8.name()); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encoded); + + try (javax.servlet.ServletOutputStream os = response.getOutputStream()) { + wb.write(os); + os.flush(); + } + } catch (java.io.IOException e) { + throw new ServiceException("导出失败:" + e.getMessage()); + } + } + + private String buildPlanCode() { + LocalDate today = LocalDate.now(); + int seq = quickSheetMapper.countToday(today) + 1; + return today.format(DATE_CODE) + String.format("%03d", seq); + } + + private String nvl(Object v, Object fallback) { + if (v == null) return String.valueOf(fallback); + String s = String.valueOf(v); + return s == null ? String.valueOf(fallback) : s; + } + + @Override + public void deleteById(Long id, String operator) { + if (id == null) return; + quickSheetMapper.deleteRow(id, operator); + } + + private BigDecimal parseQty(String val) { + if (val == null || val.trim().isEmpty()) return null; + try { + return new BigDecimal(val.trim()); + } catch (Exception e) { + return null; + } + } + + private boolean isNotBlank(String val) { + return val != null && !val.trim().isEmpty(); + } + + private LocalDateTime parseTime(String val) { + if (val == null || val.trim().isEmpty()) return null; + String v = val.trim(); + if (v.length() == 16) v = v + ":00"; + try { + return LocalDateTime.parse(v, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } catch (Exception e) { + return null; + } + } +} diff --git a/klp-aps/src/main/resources/mapper/aps/ApsQuickSheetMapper.xml b/klp-aps/src/main/resources/mapper/aps/ApsQuickSheetMapper.xml new file mode 100644 index 00000000..f20ba251 --- /dev/null +++ b/klp-aps/src/main/resources/mapper/aps/ApsQuickSheetMapper.xml @@ -0,0 +1,44 @@ + + + + + + + diff --git a/klp-ui/src/api/aps/quickSheet.js b/klp-ui/src/api/aps/quickSheet.js new file mode 100644 index 00000000..0b789785 --- /dev/null +++ b/klp-ui/src/api/aps/quickSheet.js @@ -0,0 +1,42 @@ +import request from '@/utils/request' + +export function fetchQuickSheetList(params) { + return request({ + url: '/aps/quick-sheet/list', + method: 'get', + params + }) +} + +export function fetchQuickSheetPreset(params) { + return request({ + url: '/aps/quick-sheet/preset', + method: 'get', + params + }) +} + +export function saveQuickSheet(data) { + return request({ + url: '/aps/quick-sheet/save', + method: 'post', + data + }) +} + +export function exportQuickSheet(params) { + return request({ + url: '/aps/quick-sheet/export', + method: 'get', + params, + responseType: 'blob' + }) +} + +export function deleteQuickSheetRow(quickSheetId) { + return request({ + url: '/aps/quick-sheet/delete', + method: 'post', + params: { quickSheetId } + }) +} diff --git a/klp-ui/src/views/aps/quickSheet.vue b/klp-ui/src/views/aps/quickSheet.vue new file mode 100644 index 00000000..d11b012c --- /dev/null +++ b/klp-ui/src/views/aps/quickSheet.vue @@ -0,0 +1,748 @@ + + + + + diff --git a/klp-ui/src/views/aps/quickSheetPreview.vue b/klp-ui/src/views/aps/quickSheetPreview.vue new file mode 100644 index 00000000..dc9f4bce --- /dev/null +++ b/klp-ui/src/views/aps/quickSheetPreview.vue @@ -0,0 +1,225 @@ + + + + + diff --git a/klp-ui/src/views/aps/sheets/templates.js b/klp-ui/src/views/aps/sheets/templates.js index 1e4ed4df..d4aeceb2 100644 --- a/klp-ui/src/views/aps/sheets/templates.js +++ b/klp-ui/src/views/aps/sheets/templates.js @@ -15,7 +15,7 @@ export const APS_SHEET_TEMPLATES = [ key: 'unified', name: '统一排产表', columns: [ - { label: '产线', prop: 'lineName', minWidth: 120 }, + { label: '产线', prop: 'lineName', minWidth: 140 }, { label: '计划号', prop: 'planCode', minWidth: 140 }, { label: '订单号', prop: 'orderCode', minWidth: 140 }, { label: '客户', prop: 'customerName', minWidth: 140 },