|
|
|
@ -72,31 +72,39 @@ public class CrossAreaTransferServiceImpl extends ServiceImpl<CrossAreaTransferM |
|
|
|
|
|
|
|
try { |
|
|
|
if ("label".equals(transferMode)) { |
|
|
|
// 按标签调拨:获取标签信息 |
|
|
|
Map<String, Object> stockInfo = crossAreaTransferMapper.getStockInfoByLabelCode(scanCode, site, warehouseId); |
|
|
|
// 按标签调拨:支持单标签和父标签(多子标签)两种查询结果 |
|
|
|
List<Map<String, Object>> stockInfoList = crossAreaTransferMapper.getStockInfoByLabelCode(scanCode, site, warehouseId); |
|
|
|
|
|
|
|
if (stockInfo == null) { |
|
|
|
if (stockInfoList == null || stockInfoList.isEmpty()) { |
|
|
|
logger.warn("未找到标签库存信息,标签条码: {}", scanCode); |
|
|
|
result.put("code", 1); |
|
|
|
result.put("msg", "未找到该标签的库存信息"); |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
// 格式化返回数据 |
|
|
|
Map<String, Object> labelInfo = new HashMap<>(); |
|
|
|
labelInfo.put("labelCode", stockInfo.get("label_code")); |
|
|
|
labelInfo.put("quantity", stockInfo.get("quantity")); |
|
|
|
labelInfo.put("warehouseName", stockInfo.get("warehouse_name")); |
|
|
|
labelInfo.put("locationId", stockInfo.get("location_id")); |
|
|
|
labelInfo.put("status", stockInfo.get("status")); |
|
|
|
labelInfo.put("productionDate", stockInfo.get("production_date")); |
|
|
|
labelInfo.put("expiryDate", stockInfo.get("expiry_date")); |
|
|
|
labelInfo.put("orderRef1", stockInfo.get("order_ref1")); |
|
|
|
labelInfo.put("orderRef2", stockInfo.get("order_ref2")); |
|
|
|
labelInfo.put("batchNo", stockInfo.get("batch_no")); |
|
|
|
labelInfo.put("buNo", stockInfo.get("buNo")); |
|
|
|
// 统一格式化返回字段,供前端按单条/多条展示 |
|
|
|
List<Map<String, Object>> labelInfoList = new ArrayList<>(); |
|
|
|
for (Map<String, Object> stockInfo : stockInfoList) { |
|
|
|
Map<String, Object> labelInfo = new HashMap<>(); |
|
|
|
labelInfo.put("labelCode", stockInfo.get("label_code")); |
|
|
|
labelInfo.put("partNo", stockInfo.get("part_no")); |
|
|
|
labelInfo.put("unit", stockInfo.get("unit")); |
|
|
|
labelInfo.put("quantity", stockInfo.get("quantity")); |
|
|
|
labelInfo.put("warehouseName", stockInfo.get("warehouse_name")); |
|
|
|
labelInfo.put("locationId", stockInfo.get("location_id")); |
|
|
|
labelInfo.put("status", stockInfo.get("status")); |
|
|
|
labelInfo.put("productionDate", stockInfo.get("production_date")); |
|
|
|
labelInfo.put("expiryDate", stockInfo.get("expiry_date")); |
|
|
|
labelInfo.put("orderRef1", stockInfo.get("order_ref1")); |
|
|
|
labelInfo.put("orderRef2", stockInfo.get("order_ref2")); |
|
|
|
labelInfo.put("batchNo", stockInfo.get("batch_no")); |
|
|
|
labelInfo.put("buNo", stockInfo.get("buNo")); |
|
|
|
labelInfoList.add(labelInfo); |
|
|
|
} |
|
|
|
|
|
|
|
result.put("code", 0); |
|
|
|
result.put("data", labelInfo); |
|
|
|
// 兼容旧前端:单条时仍返回对象;多条时返回列表 |
|
|
|
result.put("data", labelInfoList.size() == 1 ? labelInfoList.get(0) : labelInfoList); |
|
|
|
|
|
|
|
} else if ("location".equals(transferMode)) { |
|
|
|
// 按库位调拨:获取库位下的所有标签 |
|
|
|
|