From 1c6dd45e8cc074aa614d5e54cf93f3331119fbb8 Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Thu, 23 Oct 2025 19:38:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PdaLabelController.java | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/main/java/com/gaotao/modules/handlingunit/controller/PdaLabelController.java diff --git a/src/main/java/com/gaotao/modules/handlingunit/controller/PdaLabelController.java b/src/main/java/com/gaotao/modules/handlingunit/controller/PdaLabelController.java new file mode 100644 index 0000000..02f817c --- /dev/null +++ b/src/main/java/com/gaotao/modules/handlingunit/controller/PdaLabelController.java @@ -0,0 +1,87 @@ +package com.gaotao.modules.handlingunit.controller; + +import com.gaotao.common.utils.R; +import com.gaotao.modules.handlingunit.entity.HandlingUnit; +import com.gaotao.modules.handlingunit.service.HandlingUnitService; +import com.gaotao.modules.sys.controller.AbstractController; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +/** + * PDA标签查询控制器 + * + *

主要功能:

+ * + * + * @author System + * @since 2025-01-23 + */ +@Slf4j +@RestController +@RequestMapping("/pda/label") +public class PdaLabelController extends AbstractController { + + @Autowired + private HandlingUnitService handlingUnitService; + + /** + * @Author System + * @Description 查询标签信息 + * @Date 2025/01/23 + * @Param [Map] + * @return com.gaotao.common.utils.R + **/ + @PostMapping("query") + public R queryLabelInfo(@RequestBody Map params) { + try { + String site = (String) params.get("site"); + String labelCode = (String) params.get("labelCode"); + + log.info("=== 开始查询标签信息 ==="); + log.info("工厂: {}, 标签编码: {}", site, labelCode); + + // 参数验证 + if (site == null || site.trim().isEmpty()) { + return R.error("工厂编码不能为空"); + } + + if (labelCode == null || labelCode.trim().isEmpty()) { + return R.error("标签编码不能为空"); + } + + // 查询HandlingUnit信息 + HandlingUnit handlingUnit = handlingUnitService.lambdaQuery() + .eq(HandlingUnit::getSite, site) + .eq(HandlingUnit::getUnitId, labelCode.trim()) + .one(); + + if (handlingUnit == null) { + log.warn("标签不存在: site={}, labelCode={}", site, labelCode); + return R.error("标签不存在"); + } + + log.info("查询到标签信息: unitId={}, partNo={}, locationId={}, warehouseId={}, batchNo={}, wdr={}", + handlingUnit.getUnitId(), + handlingUnit.getPartNo(), + handlingUnit.getLocationId(), + handlingUnit.getWarehouseId(), + handlingUnit.getBatchNo(), + handlingUnit.getWdr()); + + log.info("=== 标签信息查询完成 ==="); + + return R.ok().put("data", handlingUnit); + + } catch (Exception e) { + log.error("=== 查询标签信息失败 === 错误信息: {}", e.getMessage(), e); + return R.error("查询失败: " + e.getMessage()); + } + } +} +