预约单老系统数据导入;

This commit is contained in:
王奎兴
2026-07-31 17:12:24 +08:00
parent 5fec54ac63
commit b8605c6b43
3 changed files with 17 additions and 26 deletions
@@ -31,6 +31,7 @@ import com.mhd.oms.domain.reserveStockInOrder.repository.vo.InAndOutListVo;
import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInDetailVO;
import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInOrderVO;
import com.mhd.oms.domain.reserveStockInOrder.repository.vo.ReservedInventory;
import com.mhd.oms.domain.reserveStockOutOrder.repository.mapper.ReserveStockOutOrderMapper;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.UserServiceFeign;
import com.mhd.system.api.WmsServiceFeign;
@@ -68,6 +69,8 @@ public class ReserveStockInOrderApplicationService {
@Autowired
private ReserveStockInOrderMapper reserveStockInOrderMapper;
@Autowired
private ReserveStockOutOrderMapper reserveStockOutOrderMapper;
@Autowired
private ReservationMaterialInventoryMapper reservationMaterialInventoryMapper;
@Autowired
private UserServiceFeign userServiceFeign;
@@ -2108,35 +2111,23 @@ public class ReserveStockInOrderApplicationService {
}
}
// 按仓库名称匹配仓库(查不到则按仓库类型兜底,再查不到则用名称兜底,不阻断导入
// 按仓库类型匹配仓库(老系统仓库类型 1=干仓 2=冬仓,查不到则用类型名兜底
String warehouseName = "";
WarehousePO warehouse = null;
String warehouseName = StringUtils.trimToEmpty(orderRow.getWarehouseName());
if (StringUtils.isNotBlank(warehouseName)) {
warehouse = warehouseCache.get(warehouseName);
String warehouseType = StringUtils.trimToEmpty(orderRow.getWarehouseType());
if (StringUtils.isNotBlank(warehouseType)) {
warehouse = warehouseTypeCache.get(warehouseType);
if (warehouse == null) {
List<WarehousePO> warehousePOList = reserveStockInOrderMapper.getWarehouseByName(warehouseName);
List<WarehousePO> warehousePOList = reserveStockOutOrderMapper.getWarehouseByType(warehouseType);
if (warehousePOList == null || warehousePOList.isEmpty()) {
// 名称匹配失败,尝试按仓库类型兜底匹配
String warehouseType = StringUtils.trimToEmpty(orderRow.getWarehouseType());
if (StringUtils.isNotBlank(warehouseType)) {
if (warehouseTypeCache.containsKey(warehouseType)) {
warehouse = warehouseTypeCache.get(warehouseType);
} else {
List<WarehousePO> typeList = reserveStockInOrderMapper.getWarehouseByType(warehouseType);
if (typeList != null && !typeList.isEmpty()) {
warehouse = typeList.get(0);
warehouseTypeCache.put(warehouseType, warehouse);
} else {
warehouseTypeCache.put(warehouseType, null);
}
}
}
if (warehouse == null) {
errorList.add("入库单号【" + orderNumber + "】仓库【" + warehouseName + "】未找到对应仓库,将仅以名称导入");
}
warehouseName = "1".equals(warehouseType) ? "干仓" : ("2".equals(warehouseType) ? "冻仓" : "");
errorList.add("出库单号【" + orderNumber + "】仓库类型【" + warehouseType + "】未找到对应仓库,将仅以名称导入");
warehouseTypeCache.put(warehouseType, null);
warehouse = null;
} else {
warehouse = warehousePOList.get(0);
warehouseCache.put(warehouseName, warehouse);
warehouseName = warehouse.getWarehouseName();
warehouseTypeCache.put(warehouseType, warehouse);
}
}
}
@@ -815,7 +815,7 @@
where DEL_FLAG = 1
and (
WAREHOUSE_TYPE = #{warehouseType}
or WAREHOUSE_TYPE_NAME = case when #{warehouseType} = '1' then '干仓' when #{warehouseType} = '2' then '仓' else null end
or WAREHOUSE_TYPE_NAME = case when #{warehouseType} = '1' then '干仓' when #{warehouseType} = '2' then '仓' else null end
)
</select>
@@ -544,7 +544,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where DEL_FLAG = 1
and (
WAREHOUSE_TYPE = #{warehouseType}
or WAREHOUSE_TYPE_NAME = case when #{warehouseType} = '1' then '干仓' when #{warehouseType} = '2' then '仓' else null end
or WAREHOUSE_TYPE_NAME = case when #{warehouseType} = '1' then '干仓' when #{warehouseType} = '2' then '仓' else null end
)
</select>