diff --git a/src/main/java/com/gaotao/modules/otherInbound/controller/OtherInboundController.java b/src/main/java/com/gaotao/modules/otherInbound/controller/OtherInboundController.java index 33bd7d5..8211d6f 100644 --- a/src/main/java/com/gaotao/modules/otherInbound/controller/OtherInboundController.java +++ b/src/main/java/com/gaotao/modules/otherInbound/controller/OtherInboundController.java @@ -202,6 +202,7 @@ public class OtherInboundController extends AbstractController { * 2. 更改inbound_notification_head状态、入库状态(已入库) * 3. 将inventory_stock表中的标签状态改为"在库"、数量=实际入库数量 * 4. 生成入库事务记录 + * 5. 返回打印参数列表(每个标签调用UspPartLabelTemplate获取) */ @PostMapping("/confirmOtherInbound") @ApiOperation("确认其他入库") @@ -226,11 +227,12 @@ public class OtherInboundController extends AbstractController { // 获取当前登录用户 String userName = getUser().getUsername(); - // 调用存储过程GetSaveLabelVerification - boolean success = otherInboundService.confirmOtherInboundByProcedure(site, buNo, inboundNo, locationCode, documentType, userName); + // 调用存储过程GetSaveLabelVerification,返回包含打印数据的结果 + Map result = otherInboundService.confirmOtherInboundByProcedure(site, buNo, inboundNo, locationCode, documentType, userName); - if (success) { - return R.ok("入库成功"); + Boolean success = (Boolean) result.get("success"); + if (success != null && success) { + return R.ok("入库成功").put("printList", result.get("printList")); } else { return R.error("入库失败"); } diff --git a/src/main/java/com/gaotao/modules/otherInbound/service/OtherInboundService.java b/src/main/java/com/gaotao/modules/otherInbound/service/OtherInboundService.java index 0f15d44..7823ea7 100644 --- a/src/main/java/com/gaotao/modules/otherInbound/service/OtherInboundService.java +++ b/src/main/java/com/gaotao/modules/otherInbound/service/OtherInboundService.java @@ -79,9 +79,9 @@ public interface OtherInboundService { * @param locationCode 库位号 * @param documentType 单据类型 * @param userName 当前登录用户 - * @return 处理结果 + * @return 处理结果,包含success和printList */ - boolean confirmOtherInboundByProcedure(String site, String buNo, String inboundNo, + Map confirmOtherInboundByProcedure(String site, String buNo, String inboundNo, String locationCode, String documentType, String userName); /** diff --git a/src/main/java/com/gaotao/modules/otherInbound/service/impl/OtherInboundServiceImpl.java b/src/main/java/com/gaotao/modules/otherInbound/service/impl/OtherInboundServiceImpl.java index aef8071..773ad2b 100644 --- a/src/main/java/com/gaotao/modules/otherInbound/service/impl/OtherInboundServiceImpl.java +++ b/src/main/java/com/gaotao/modules/otherInbound/service/impl/OtherInboundServiceImpl.java @@ -13,6 +13,7 @@ import com.gaotao.modules.trans.entity.*; import com.gaotao.modules.trans.service.*; import com.gaotao.modules.trans.service.TransNoControlService; import com.gaotao.modules.erp.service.ErpInterfaceService; +import com.gaotao.modules.wms.dao.WmsPrintDao; import org.apache.shiro.SecurityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -65,6 +66,9 @@ public class OtherInboundServiceImpl implements OtherInboundService { @Autowired private ErpInterfaceService erpInterfaceService; + @Autowired + private WmsPrintDao wmsPrintDao; + @Override public void validateLabelWithOtherInbound(String site, String buNo, String inboundNo, String materialCode, Double actualQty, String batchNo, String warehouseId, @@ -140,12 +144,17 @@ public class OtherInboundServiceImpl implements OtherInboundService { @Override @Transactional(rollbackFor = Exception.class) - public boolean confirmOtherInboundByProcedure(String site, String buNo, String inboundNo, + public Map confirmOtherInboundByProcedure(String site, String buNo, String inboundNo, String locationCode, String documentType, String userName) { logger.info("调用GetSaveLabelVerification存储过程确认入库,站点: {}, 入库单: {}, 库位: {}, 单据类型: {}, 用户: {}", site, inboundNo, locationCode, documentType, userName); + Map returnResult = new HashMap<>(); + try { + // 先获取已扫描标签列表(用于打印) + List> scannedLabels = getScannedLabelList(site, buNo, inboundNo, documentType); + // 调用存储过程 GetSaveLabelVerification(参考采购入库功能) // 10个参数 List params = new ArrayList<>(); @@ -177,7 +186,44 @@ public class OtherInboundServiceImpl implements OtherInboundService { } logger.info("GetSaveLabelVerification存储过程调用成功,入库单: {}", inboundNo); - return true; + + // 获取打印参数 + List> printList = new ArrayList<>(); + if (scannedLabels != null && !scannedLabels.isEmpty()) { + for (Map label : scannedLabels) { + try { + String rollNo = (String) label.get("labelCode"); + String materialCode = (String) label.get("materialCode"); + + // 调用存储过程UspPartLabelTemplate获取打印参数 + Map printData = wmsPrintDao.callUspPartLabelTemplate( + site, // site + buNo, // buNo + "*", // menuID - PDA功能传 "*" + "", // relatedOrderNo - 关联单号 + "", // relatedOrderLineNo - 关联单号行号,传空字符串 + inboundNo, // documentNo - 入库单号 + materialCode, // PartNo - 物料编码 + "", // LabelNo - 标签模版编码,传空字符串(由存储过程返回) + rollNo // RollNo - 标签条码 + ); + + if (printData != null) { + printList.add(printData); + logger.info("获取标签 {} 的打印参数成功", rollNo); + } else { + logger.warn("获取标签 {} 的打印参数失败,跳过", rollNo); + } + } catch (Exception e) { + logger.warn("获取标签打印参数失败: {}", e.getMessage()); + } + } + } + + returnResult.put("success", true); + returnResult.put("printList", printList); + + return returnResult; } catch (Exception e) { logger.error("调用GetSaveLabelVerification存储过程失败,入库单: {}", inboundNo, e); throw new RuntimeException(e.getMessage(), e); diff --git a/src/main/resources/mapper/base/BaseMapper.xml b/src/main/resources/mapper/base/BaseMapper.xml index 9fde40c..5d3b1db 100644 --- a/src/main/resources/mapper/base/BaseMapper.xml +++ b/src/main/resources/mapper/base/BaseMapper.xml @@ -1994,9 +1994,14 @@