From 653251253b4c564db95bc27ed09956e09a7fdada Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Tue, 28 Oct 2025 15:04:10 +0800 Subject: [PATCH] =?UTF-8?q?2025-10-28=20pda=E7=94=9F=E4=BA=A7=E9=A2=86?= =?UTF-8?q?=E9=80=80=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProductionIssueReturnController.java | 182 +++++++++++ .../dao/ProductionIssueReturnMapper.java | 93 ++++++ .../service/ProductionIssueReturnService.java | 34 ++ .../ProductionIssueReturnServiceImpl.java | 307 ++++++++++++++++++ .../modules/production/vo/IssueReturnVO.java | 195 +++++++++++ .../wms/service/impl/WmsPrintServiceImpl.java | 18 +- .../ProductionIssueReturnMapper.xml | 280 ++++++++++++++++ 7 files changed, 1108 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/gaotao/modules/production/controller/ProductionIssueReturnController.java create mode 100644 src/main/java/com/gaotao/modules/production/dao/ProductionIssueReturnMapper.java create mode 100644 src/main/java/com/gaotao/modules/production/service/ProductionIssueReturnService.java create mode 100644 src/main/java/com/gaotao/modules/production/service/impl/ProductionIssueReturnServiceImpl.java create mode 100644 src/main/java/com/gaotao/modules/production/vo/IssueReturnVO.java create mode 100644 src/main/resources/mapper/production/ProductionIssueReturnMapper.xml diff --git a/src/main/java/com/gaotao/modules/production/controller/ProductionIssueReturnController.java b/src/main/java/com/gaotao/modules/production/controller/ProductionIssueReturnController.java new file mode 100644 index 0000000..2f7f522 --- /dev/null +++ b/src/main/java/com/gaotao/modules/production/controller/ProductionIssueReturnController.java @@ -0,0 +1,182 @@ +package com.gaotao.modules.production.controller; + +import com.gaotao.common.utils.R; +import com.gaotao.modules.production.service.ProductionIssueReturnService; +import com.gaotao.modules.production.vo.IssueReturnVO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +/** + * 生产领退料Controller + */ +@RestController +@RequestMapping("/production/issueReturn") +public class ProductionIssueReturnController { + + private static final Logger logger = LoggerFactory.getLogger(ProductionIssueReturnController.class); + + @Autowired + private ProductionIssueReturnService productionIssueReturnService; + + /** + * 搜索领料工单(模糊查询,top3) + */ + @PostMapping("/searchOrders") + public R searchOrders(@RequestBody Map params) { + logger.info("搜索领料工单,参数: {}", params); + + try { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String searchKey = (String) params.get("searchKey"); + Integer limit = params.get("limit") != null ? (Integer) params.get("limit") : 3; + + if (site == null || site.isEmpty()) { + return R.error("站点不能为空"); + } + if (buNo == null || buNo.isEmpty()) { + return R.error("BU编码不能为空"); + } + if (searchKey == null || searchKey.isEmpty()) { + return R.error("搜索关键词不能为空"); + } + + List> orders = productionIssueReturnService.searchIssueOrders(site, buNo, searchKey, limit); + + return R.ok() + .put("code", 0) + .put("msg", "查询成功") + .put("orders", orders); + + } catch (Exception e) { + logger.error("搜索领料工单失败", e); + return R.error("搜索失败: " + e.getMessage()); + } + } + + /** + * 获取工单详情 + */ + @PostMapping("/getOrderDetail") + public R getOrderDetail(@RequestBody Map params) { + logger.info("获取工单详情,参数: {}", params); + + try { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String orderNo = (String) params.get("orderNo"); + + if (site == null || site.isEmpty()) { + return R.error("站点不能为空"); + } + if (buNo == null || buNo.isEmpty()) { + return R.error("BU编码不能为空"); + } + if (orderNo == null || orderNo.isEmpty()) { + return R.error("工单号不能为空"); + } + + Map orderDetail = productionIssueReturnService.getOrderDetail(site, buNo, orderNo); + + return R.ok() + .put("code", 0) + .put("msg", "查询成功") + .put("orderDetail", orderDetail); + + } catch (Exception e) { + logger.error("获取工单详情失败", e); + return R.error("查询失败: " + e.getMessage()); + } + } + + /** + * 扫描标签获取信息 + */ + @PostMapping("/scanLabel") + public R scanLabel(@RequestBody Map params) { + logger.info("扫描标签,参数: {}", params); + + try { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String warehouseId = (String) params.get("warehouseId"); + String labelCode = (String) params.get("labelCode"); + + if (site == null || site.isEmpty()) { + return R.error("站点不能为空"); + } + if (buNo == null || buNo.isEmpty()) { + return R.error("BU编码不能为空"); + } + if (warehouseId == null || warehouseId.isEmpty()) { + return R.error("仓库不能为空"); + } + if (labelCode == null || labelCode.isEmpty()) { + return R.error("标签条码不能为空"); + } + + Map labelInfo = productionIssueReturnService.getLabelInfo(site, buNo, warehouseId, labelCode); + + return R.ok() + .put("code", 0) + .put("msg", "查询成功") + .put("labelInfo", labelInfo); + + } catch (Exception e) { + logger.error("扫描标签失败", e); + return R.error("扫描失败: " + e.getMessage()); + } + } + + /** + * 提交生产领退料 + * 包含:退仓+领料申请+过账+回传ERP + */ + @PostMapping("/submit") + public R submit(@RequestBody IssueReturnVO issueReturnVO) { + logger.info("提交生产领退料,参数: {}", issueReturnVO); + + try { + // 参数验证 + if (issueReturnVO.getSite() == null || issueReturnVO.getSite().isEmpty()) { + return R.error("站点不能为空"); + } + if (issueReturnVO.getBuNo() == null || issueReturnVO.getBuNo().isEmpty()) { + return R.error("BU编码不能为空"); + } + if (issueReturnVO.getWarehouseId() == null || issueReturnVO.getWarehouseId().isEmpty()) { + return R.error("仓库不能为空"); + } + if (issueReturnVO.getUserName() == null || issueReturnVO.getUserName().isEmpty()) { + return R.error("用户名不能为空"); + } + if (issueReturnVO.getReturnOrderNo() == null || issueReturnVO.getReturnOrderNo().isEmpty()) { + return R.error("退库工单号不能为空"); + } + if (issueReturnVO.getIssueOrderNo() == null || issueReturnVO.getIssueOrderNo().isEmpty()) { + return R.error("领料工单号不能为空"); + } + if (issueReturnVO.getLabelList() == null || issueReturnVO.getLabelList().isEmpty()) { + return R.error("标签列表不能为空"); + } + + // 提交领退料 + String notifyNo = productionIssueReturnService.submitIssueReturn(issueReturnVO); + + return R.ok() + .put("code", 0) + .put("msg", "提交成功") + .put("notifyNo", notifyNo); + + } catch (Exception e) { + logger.error("提交生产领退料失败", e); + return R.error("提交失败: " + e.getMessage()); + } + } +} + diff --git a/src/main/java/com/gaotao/modules/production/dao/ProductionIssueReturnMapper.java b/src/main/java/com/gaotao/modules/production/dao/ProductionIssueReturnMapper.java new file mode 100644 index 0000000..c0b6985 --- /dev/null +++ b/src/main/java/com/gaotao/modules/production/dao/ProductionIssueReturnMapper.java @@ -0,0 +1,93 @@ +package com.gaotao.modules.production.dao; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 生产领退料Mapper + */ +@Mapper +public interface ProductionIssueReturnMapper { + + /** + * 搜索领料工单(模糊查询,top3) + */ + List> searchIssueOrders(@Param("site") String site, + @Param("buNo") String buNo, + @Param("searchKey") String searchKey, + @Param("limit") Integer limit); + + /** + * 获取工单详情 + */ + Map getOrderDetail(@Param("site") String site, + @Param("buNo") String buNo, + @Param("orderNo") String orderNo); + + /** + * 获取工单的工序列表 + */ + List> getOrderOperations(@Param("site") String site, + @Param("orderNo") String orderNo); + + /** + * 根据标签条码查询库存信息 + */ + Map getLabelInfo(@Param("site") String site, + @Param("buNo") String buNo, + @Param("warehouseId") String warehouseId, + @Param("labelCode") String labelCode); + + /** + * 生成申请单号 + */ + String generateNotifyNo(@Param("site") String site, + @Param("buNo") String buNo, + @Param("type") String type); + + /** + * 生成过账单号 + */ + String generateTransId(@Param("site") String site, + @Param("buNo") String buNo, + @Param("type") String type); + + /** + * 保存领料申请单主表 + */ + int saveNotifyHeader(Map params); + + /** + * 保存领料申请单明细 + */ + int saveNotifyOrderList(Map params); + + /** + * 保存领料申请材料明细 + */ + int saveNotifyMaterialList(Map params); + + /** + * 保存过账单主表 + */ + int saveTransHeader(Map params); + + /** + * 保存过账单明细 + */ + int saveTransDetail(Map params); + + /** + * 保存过账单子明细 + */ + int saveTransDetailSub(Map params); + + /** + * 保存库存事务日志 + */ + int saveStockTransactionLog(Map params); +} + diff --git a/src/main/java/com/gaotao/modules/production/service/ProductionIssueReturnService.java b/src/main/java/com/gaotao/modules/production/service/ProductionIssueReturnService.java new file mode 100644 index 0000000..bf2e6de --- /dev/null +++ b/src/main/java/com/gaotao/modules/production/service/ProductionIssueReturnService.java @@ -0,0 +1,34 @@ +package com.gaotao.modules.production.service; + +import com.gaotao.modules.production.vo.IssueReturnVO; + +import java.util.List; +import java.util.Map; + +/** + * 生产领退料Service + */ +public interface ProductionIssueReturnService { + + /** + * 搜索领料工单(模糊查询,top3) + */ + List> searchIssueOrders(String site, String buNo, String searchKey, Integer limit); + + /** + * 获取工单详情 + */ + Map getOrderDetail(String site, String buNo, String orderNo); + + /** + * 根据标签条码查询库存信息 + */ + Map getLabelInfo(String site, String buNo, String warehouseId, String labelCode); + + /** + * 提交生产领退料 + * 包含:退仓+领料申请+过账+回传ERP + */ + String submitIssueReturn(IssueReturnVO issueReturnVO) throws Exception; +} + diff --git a/src/main/java/com/gaotao/modules/production/service/impl/ProductionIssueReturnServiceImpl.java b/src/main/java/com/gaotao/modules/production/service/impl/ProductionIssueReturnServiceImpl.java new file mode 100644 index 0000000..ab13785 --- /dev/null +++ b/src/main/java/com/gaotao/modules/production/service/impl/ProductionIssueReturnServiceImpl.java @@ -0,0 +1,307 @@ +package com.gaotao.modules.production.service.impl; + +import com.gaotao.modules.production.dao.ProductionIssueReturnMapper; +import com.gaotao.modules.production.service.ProductionIssueReturnService; +import com.gaotao.modules.production.vo.IssueReturnVO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 生产领退料Service实现类 + */ +@Service("productionIssueReturnService") +public class ProductionIssueReturnServiceImpl implements ProductionIssueReturnService { + + private static final Logger logger = LoggerFactory.getLogger(ProductionIssueReturnServiceImpl.class); + + @Autowired + private ProductionIssueReturnMapper productionIssueReturnMapper; + + @Override + public List> searchIssueOrders(String site, String buNo, String searchKey, Integer limit) { + logger.info("搜索领料工单,站点: {}, BU: {}, 搜索关键词: {}, 限制数量: {}", site, buNo, searchKey, limit); + try { + List> orders = productionIssueReturnMapper.searchIssueOrders(site, buNo, searchKey, limit); + logger.info("搜索到工单数量: {}", orders != null ? orders.size() : 0); + return orders; + } catch (Exception e) { + logger.error("搜索领料工单失败,错误信息: {}", e.getMessage(), e); + throw new RuntimeException("搜索领料工单失败: " + e.getMessage(), e); + } + } + + @Override + public Map getOrderDetail(String site, String buNo, String orderNo) { + logger.info("获取工单详情,站点: {}, BU: {}, 工单号: {}", site, buNo, orderNo); + try { + Map orderDetail = productionIssueReturnMapper.getOrderDetail(site, buNo, orderNo); + if (orderDetail == null) { + logger.warn("未找到工单详情"); + throw new RuntimeException("未找到工单详情"); + } + + // 获取工序列表 + List> operations = productionIssueReturnMapper.getOrderOperations(site, orderNo); + orderDetail.put("operations", operations); + + logger.info("获取工单详情成功,工序数量: {}", operations != null ? operations.size() : 0); + return orderDetail; + } catch (Exception e) { + logger.error("获取工单详情失败,错误信息: {}", e.getMessage(), e); + throw new RuntimeException("获取工单详情失败: " + e.getMessage(), e); + } + } + + @Override + public Map getLabelInfo(String site, String buNo, String warehouseId, String labelCode) { + logger.info("查询标签信息,站点: {}, BU: {}, 仓库: {}, 标签条码: {}", site, buNo, warehouseId, labelCode); + try { + Map labelInfo = productionIssueReturnMapper.getLabelInfo(site, buNo, warehouseId, labelCode); + if (labelInfo == null) { + logger.warn("未找到标签信息"); + throw new RuntimeException("未找到标签信息"); + } + logger.info("查询标签信息成功"); + return labelInfo; + } catch (Exception e) { + logger.error("查询标签信息失败,错误信息: {}", e.getMessage(), e); + throw new RuntimeException("查询标签信息失败: " + e.getMessage(), e); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public String submitIssueReturn(IssueReturnVO issueReturnVO) throws Exception { + logger.info("开始提交生产领退料,退库工单: {}, 领料工单: {}", + issueReturnVO.getReturnOrderNo(), issueReturnVO.getIssueOrderNo()); + + try { + // 步骤0: 执行退仓逻辑 + // TODO: 调用生产退仓的退仓逻辑 + logger.info("执行退仓逻辑..."); + // processReturn(issueReturnVO); + + // 步骤1: 生成领料申请记录 + String notifyNo = generateIssueNotify(issueReturnVO); + logger.info("生成领料申请单号: {}", notifyNo); + + // 步骤2: 生成过账记录 + String transId = generateTransaction(issueReturnVO, notifyNo); + logger.info("生成过账单号: {}", transId); + + // 步骤3: 生成库存事务日志 + generateStockTransactionLog(issueReturnVO, notifyNo, transId); + logger.info("生成库存事务日志成功"); + + // 步骤4: 回传ERP(用户说不用写) + // sendToERP(notifyNo); + + logger.info("提交生产领退料成功,申请单号: {}", notifyNo); + return notifyNo; + + } catch (Exception e) { + logger.error("提交生产领退料失败,错误信息: {}", e.getMessage(), e); + throw new Exception("提交生产领退料失败: " + e.getMessage(), e); + } + } + + /** + * 生成领料申请记录 + */ + private String generateIssueNotify(IssueReturnVO issueReturnVO) { + logger.info("生成领料申请记录..."); + + // 1. 生成申请单号 + String notifyNo = productionIssueReturnMapper.generateNotifyNo( + issueReturnVO.getSite(), + issueReturnVO.getBuNo(), + "LT" + ); + + if (notifyNo == null || notifyNo.isEmpty()) { + throw new RuntimeException("生成申请单号失败"); + } + + // 2. 保存申请单主表 + Map headerParams = new HashMap<>(); + headerParams.put("site", issueReturnVO.getSite()); + headerParams.put("buNo", issueReturnVO.getBuNo()); + headerParams.put("notifyNo", notifyNo); + headerParams.put("userName", issueReturnVO.getUserName()); + headerParams.put("remark", issueReturnVO.getRemark()); + + int headerResult = productionIssueReturnMapper.saveNotifyHeader(headerParams); + if (headerResult <= 0) { + throw new RuntimeException("保存申请单主表失败"); + } + logger.info("保存申请单主表成功"); + + // 3. 获取工单详情 + Map orderDetail = productionIssueReturnMapper.getOrderDetail( + issueReturnVO.getSite(), + issueReturnVO.getBuNo(), + issueReturnVO.getIssueOrderNo() + ); + + if (orderDetail == null) { + throw new RuntimeException("获取工单详情失败"); + } + + // 4. 计算申请总数量 + float totalQty = 0f; + for (IssueReturnVO.LabelInfo label : issueReturnVO.getLabelList()) { + totalQty += label.getQuantity(); + } + + // 5. 保存申请单明细 + Map orderListParams = new HashMap<>(); + orderListParams.put("notifyNo", notifyNo); + orderListParams.put("site", issueReturnVO.getSite()); + orderListParams.put("itemNo", 1); + orderListParams.put("fgPartNo", orderDetail.get("partNo")); + orderListParams.put("soOrderNo", issueReturnVO.getIssueOrderNo()); + orderListParams.put("opsItemNo", orderDetail.get("operationNo")); + orderListParams.put("seqNo", orderDetail.get("seqNo")); + orderListParams.put("issureQty", totalQty); + orderListParams.put("locationNo", issueReturnVO.getLabelList().get(0).getLocationId()); + orderListParams.put("resourceId", ""); + + int orderListResult = productionIssueReturnMapper.saveNotifyOrderList(orderListParams); + if (orderListResult <= 0) { + throw new RuntimeException("保存申请单明细失败"); + } + logger.info("保存申请单明细成功"); + + // 6. 保存材料明细(为每个标签生成一条记录) + int materialItemNo = 1; + for (IssueReturnVO.LabelInfo label : issueReturnVO.getLabelList()) { + Map materialParams = new HashMap<>(); + materialParams.put("notifyNo", notifyNo); + materialParams.put("site", issueReturnVO.getSite()); + materialParams.put("itemNo", materialItemNo++); + materialParams.put("componentPartNo", label.getPartNo()); + materialParams.put("partDesc", label.getPartDesc()); + materialParams.put("qtyToIssue", label.getQuantity()); + materialParams.put("rollNo", label.getRollNo()); + materialParams.put("warehouseId", label.getWarehouseId()); + materialParams.put("locationId", label.getLocationId()); + + int materialResult = productionIssueReturnMapper.saveNotifyMaterialList(materialParams); + if (materialResult <= 0) { + throw new RuntimeException("保存材料明细失败"); + } + } + logger.info("保存材料明细成功,共 {} 条", issueReturnVO.getLabelList().size()); + + return notifyNo; + } + + /** + * 生成过账记录 + */ + private String generateTransaction(IssueReturnVO issueReturnVO, String notifyNo) { + logger.info("生成过账记录..."); + + // 1. 生成过账单号 + String transId = productionIssueReturnMapper.generateTransId( + issueReturnVO.getSite(), + issueReturnVO.getBuNo(), + "TR" + ); + + if (transId == null || transId.isEmpty()) { + throw new RuntimeException("生成过账单号失败"); + } + + // 2. 保存过账单主表 + Map headerParams = new HashMap<>(); + headerParams.put("site", issueReturnVO.getSite()); + headerParams.put("buNo", issueReturnVO.getBuNo()); + headerParams.put("transId", transId); + headerParams.put("notifyNo", notifyNo); + headerParams.put("orderNo", issueReturnVO.getIssueOrderNo()); + headerParams.put("userName", issueReturnVO.getUserName()); + + int headerResult = productionIssueReturnMapper.saveTransHeader(headerParams); + if (headerResult <= 0) { + throw new RuntimeException("保存过账单主表失败"); + } + logger.info("保存过账单主表成功"); + + // 3. 保存过账单明细和子明细 + int detailItemNo = 1; + for (IssueReturnVO.LabelInfo label : issueReturnVO.getLabelList()) { + // 保存过账单明细 + Map detailParams = new HashMap<>(); + detailParams.put("site", issueReturnVO.getSite()); + detailParams.put("transId", transId); + detailParams.put("itemNo", detailItemNo); + detailParams.put("partNo", label.getPartNo()); + detailParams.put("quantity", label.getQuantity()); + detailParams.put("warehouseId", label.getWarehouseId()); + detailParams.put("locationId", label.getLocationId()); + detailParams.put("rollNo", label.getRollNo()); + + int detailResult = productionIssueReturnMapper.saveTransDetail(detailParams); + if (detailResult <= 0) { + throw new RuntimeException("保存过账单明细失败"); + } + + // 保存过账单子明细 + Map subParams = new HashMap<>(); + subParams.put("site", issueReturnVO.getSite()); + subParams.put("transId", transId); + subParams.put("itemNo", detailItemNo); + subParams.put("subItemNo", 1); + subParams.put("partNo", label.getPartNo()); + subParams.put("quantity", label.getQuantity()); + subParams.put("rollNo", label.getRollNo()); + + int subResult = productionIssueReturnMapper.saveTransDetailSub(subParams); + if (subResult <= 0) { + throw new RuntimeException("保存过账单子明细失败"); + } + + detailItemNo++; + } + logger.info("保存过账单明细和子明细成功,共 {} 条", issueReturnVO.getLabelList().size()); + + return transId; + } + + /** + * 生成库存事务日志 + */ + private void generateStockTransactionLog(IssueReturnVO issueReturnVO, String notifyNo, String transId) { + logger.info("生成库存事务日志..."); + + for (IssueReturnVO.LabelInfo label : issueReturnVO.getLabelList()) { + Map logParams = new HashMap<>(); + logParams.put("site", issueReturnVO.getSite()); + logParams.put("buNo", issueReturnVO.getBuNo()); + logParams.put("transId", transId); + logParams.put("partNo", label.getPartNo()); + logParams.put("quantity", label.getQuantity()); + logParams.put("warehouseId", label.getWarehouseId()); + logParams.put("locationId", label.getLocationId()); + logParams.put("rollNo", label.getRollNo()); + logParams.put("orderNo", issueReturnVO.getIssueOrderNo()); + logParams.put("notifyNo", notifyNo); + logParams.put("userName", issueReturnVO.getUserName()); + + int logResult = productionIssueReturnMapper.saveStockTransactionLog(logParams); + if (logResult <= 0) { + throw new RuntimeException("保存库存事务日志失败"); + } + } + logger.info("保存库存事务日志成功,共 {} 条", issueReturnVO.getLabelList().size()); + } +} + diff --git a/src/main/java/com/gaotao/modules/production/vo/IssueReturnVO.java b/src/main/java/com/gaotao/modules/production/vo/IssueReturnVO.java new file mode 100644 index 0000000..5e59ce3 --- /dev/null +++ b/src/main/java/com/gaotao/modules/production/vo/IssueReturnVO.java @@ -0,0 +1,195 @@ +package com.gaotao.modules.production.vo; + +import java.util.List; + +/** + * 生产领退料VO + */ +public class IssueReturnVO { + + /** + * 站点 + */ + private String site; + + /** + * BU编码 + */ + private String buNo; + + /** + * 仓库ID + */ + private String warehouseId; + + /** + * 用户名 + */ + private String userName; + + /** + * 退库工单号 + */ + private String returnOrderNo; + + /** + * 领料工单号 + */ + private String issueOrderNo; + + /** + * 工序名称 + */ + private String operationName; + + /** + * 备注说明 + */ + private String remark; + + /** + * 标签列表 + */ + private List labelList; + + public static class LabelInfo { + private String labelCode; + private String rollNo; + private String partNo; + private String partDesc; + private Float quantity; + private String warehouseId; + private String locationId; + + // Getters and Setters + public String getLabelCode() { + return labelCode; + } + + public void setLabelCode(String labelCode) { + this.labelCode = labelCode; + } + + public String getRollNo() { + return rollNo; + } + + public void setRollNo(String rollNo) { + this.rollNo = rollNo; + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; + } + + public String getPartDesc() { + return partDesc; + } + + public void setPartDesc(String partDesc) { + this.partDesc = partDesc; + } + + public Float getQuantity() { + return quantity; + } + + public void setQuantity(Float quantity) { + this.quantity = quantity; + } + + public String getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(String warehouseId) { + this.warehouseId = warehouseId; + } + + public String getLocationId() { + return locationId; + } + + public void setLocationId(String locationId) { + this.locationId = locationId; + } + } + + // Getters and Setters + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getBuNo() { + return buNo; + } + + public void setBuNo(String buNo) { + this.buNo = buNo; + } + + public String getWarehouseId() { + return warehouseId; + } + + public void setWarehouseId(String warehouseId) { + this.warehouseId = warehouseId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getReturnOrderNo() { + return returnOrderNo; + } + + public void setReturnOrderNo(String returnOrderNo) { + this.returnOrderNo = returnOrderNo; + } + + public String getIssueOrderNo() { + return issueOrderNo; + } + + public void setIssueOrderNo(String issueOrderNo) { + this.issueOrderNo = issueOrderNo; + } + + public String getOperationName() { + return operationName; + } + + public void setOperationName(String operationName) { + this.operationName = operationName; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public List getLabelList() { + return labelList; + } + + public void setLabelList(List labelList) { + this.labelList = labelList; + } +} + diff --git a/src/main/java/com/gaotao/modules/wms/service/impl/WmsPrintServiceImpl.java b/src/main/java/com/gaotao/modules/wms/service/impl/WmsPrintServiceImpl.java index 51d160b..4da6402 100644 --- a/src/main/java/com/gaotao/modules/wms/service/impl/WmsPrintServiceImpl.java +++ b/src/main/java/com/gaotao/modules/wms/service/impl/WmsPrintServiceImpl.java @@ -213,7 +213,23 @@ public class WmsPrintServiceImpl implements WmsPrintService { // 标签数量(roll_qty)- 第2列(索引1) if (row.getCell(1) != null) { - saveData.setRollQty(new BigDecimal(row.getCell(1).getNumericCellValue())); + try { + // 尝试按不同类型读取 + if (row.getCell(1).getCellType() == org.apache.poi.ss.usermodel.CellType.NUMERIC) { + saveData.setRollQty(new BigDecimal(row.getCell(1).getNumericCellValue())); + } else if (row.getCell(1).getCellType() == org.apache.poi.ss.usermodel.CellType.STRING) { + // 如果是字符串类型,尝试转换为数字 + String strValue = row.getCell(1).getStringCellValue().trim(); + if (strValue.isEmpty()) { + throw new RuntimeException("第" + (j + 1) + "行:标签数量不能为空"); + } + saveData.setRollQty(new BigDecimal(strValue)); + } else { + throw new RuntimeException("第" + (j + 1) + "行:标签数量格式不正确"); + } + } catch (NumberFormatException e) { + throw new RuntimeException("第" + (j + 1) + "行:标签数量必须是有效的数字"); + } } else { throw new RuntimeException("第" + (j + 1) + "行:标签数量不能为空"); } diff --git a/src/main/resources/mapper/production/ProductionIssueReturnMapper.xml b/src/main/resources/mapper/production/ProductionIssueReturnMapper.xml new file mode 100644 index 0000000..2617cf3 --- /dev/null +++ b/src/main/resources/mapper/production/ProductionIssueReturnMapper.xml @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO SOIssueNotifyHeader ( + site, + bu_no, + notify_no, + notify_date, + entered_date, + user_name, + user_display, + remark, + plan_issue_date, + status + ) VALUES ( + #{site}, + #{buNo}, + #{notifyNo}, + GETDATE(), + GETDATE(), + #{userName}, + #{userName}, + #{remark}, + GETDATE(), + '已完成' + ) + + + + + INSERT INTO SOIssueNotifyOrderList ( + notify_no, + site, + item_no, + fg_part_no, + so_order_no, + ops_item_no, + seq_no, + issure_qty, + out_work_order_flag, + need_date, + location_no, + resource_id + ) VALUES ( + #{notifyNo}, + #{site}, + #{itemNo}, + #{fgPartNo}, + #{soOrderNo}, + #{opsItemNo}, + #{seqNo}, + #{issureQty}, + 'N', + GETDATE(), + #{locationNo}, + #{resourceId} + ) + + + + + INSERT INTO SOIssueNotifyOrderMaterialList ( + notify_no, + site, + item_no, + component_part_no, + part_desc, + qty_to_issue, + roll_no, + warehouse_id, + location_id, + issue_type + ) VALUES ( + #{notifyNo}, + #{site}, + #{itemNo}, + #{componentPartNo}, + #{partDesc}, + #{qtyToIssue}, + #{rollNo}, + #{warehouseId}, + #{locationId}, + '正常' + ) + + + + + INSERT INTO TransHeader ( + site, + bu_no, + trans_id, + trans_type, + trans_date, + status, + notify_no, + order_no, + user_name + ) VALUES ( + #{site}, + #{buNo}, + #{transId}, + 'ISSUE', + GETDATE(), + '已完成', + #{notifyNo}, + #{orderNo}, + #{userName} + ) + + + + + INSERT INTO TransDetail ( + site, + trans_id, + item_no, + part_no, + quantity, + warehouse_id, + location_id, + roll_no + ) VALUES ( + #{site}, + #{transId}, + #{itemNo}, + #{partNo}, + #{quantity}, + #{warehouseId}, + #{locationId}, + #{rollNo} + ) + + + + + INSERT INTO TransDetailSub ( + site, + trans_id, + item_no, + sub_item_no, + part_no, + quantity, + roll_no + ) VALUES ( + #{site}, + #{transId}, + #{itemNo}, + #{subItemNo}, + #{partNo}, + #{quantity}, + #{rollNo} + ) + + + + + INSERT INTO StockTransactionLog ( + site, + bu_no, + trans_id, + trans_type, + trans_date, + part_no, + quantity, + warehouse_id, + location_id, + roll_no, + order_no, + notify_no, + user_name + ) VALUES ( + #{site}, + #{buNo}, + #{transId}, + 'ISSUE', + GETDATE(), + #{partNo}, + #{quantity}, + #{warehouseId}, + #{locationId}, + #{rollNo}, + #{orderNo}, + #{notifyNo}, + #{userName} + ) + + + +