You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
3.0 KiB
87 lines
3.0 KiB
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标签查询控制器
|
|
*
|
|
* <p><b>主要功能:</b></p>
|
|
* <ul>
|
|
* <li>扫描标签查询HandlingUnit信息</li>
|
|
* <li>显示物料编码、库位、仓库、批次号、wdr等信息</li>
|
|
* </ul>
|
|
*
|
|
* @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<String, Object>]
|
|
* @return com.gaotao.common.utils.R
|
|
**/
|
|
@PostMapping("query")
|
|
public R queryLabelInfo(@RequestBody Map<String, Object> 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());
|
|
}
|
|
}
|
|
}
|
|
|