预约单老系统数据导入;

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.LegacyReserveInDetailVO;
import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInOrderVO; import com.mhd.oms.domain.reserveStockInOrder.repository.vo.LegacyReserveInOrderVO;
import com.mhd.oms.domain.reserveStockInOrder.repository.vo.ReservedInventory; 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.SystemServiceFeign;
import com.mhd.system.api.UserServiceFeign; import com.mhd.system.api.UserServiceFeign;
import com.mhd.system.api.WmsServiceFeign; import com.mhd.system.api.WmsServiceFeign;
@@ -68,6 +69,8 @@ public class ReserveStockInOrderApplicationService {
@Autowired @Autowired
private ReserveStockInOrderMapper reserveStockInOrderMapper; private ReserveStockInOrderMapper reserveStockInOrderMapper;
@Autowired @Autowired
private ReserveStockOutOrderMapper reserveStockOutOrderMapper;
@Autowired
private ReservationMaterialInventoryMapper reservationMaterialInventoryMapper; private ReservationMaterialInventoryMapper reservationMaterialInventoryMapper;
@Autowired @Autowired
private UserServiceFeign userServiceFeign; private UserServiceFeign userServiceFeign;
@@ -2108,35 +2111,23 @@ public class ReserveStockInOrderApplicationService {
} }
} }
// 按仓库名称匹配仓库(查不到则按仓库类型兜底,再查不到则用名称兜底,不阻断导入 // 按仓库类型匹配仓库(老系统仓库类型 1=干仓 2=冬仓,查不到则用类型名兜底
String warehouseName = "";
WarehousePO warehouse = null; WarehousePO warehouse = null;
String warehouseName = StringUtils.trimToEmpty(orderRow.getWarehouseName()); String warehouseType = StringUtils.trimToEmpty(orderRow.getWarehouseType());
if (StringUtils.isNotBlank(warehouseName)) { if (StringUtils.isNotBlank(warehouseType)) {
warehouse = warehouseCache.get(warehouseName); warehouse = warehouseTypeCache.get(warehouseType);
if (warehouse == null) { if (warehouse == null) {
List<WarehousePO> warehousePOList = reserveStockInOrderMapper.getWarehouseByName(warehouseName); List<WarehousePO> warehousePOList = reserveStockOutOrderMapper.getWarehouseByType(warehouseType);
if (warehousePOList == null || warehousePOList.isEmpty()) { if (warehousePOList == null || warehousePOList.isEmpty()) {
// 名称匹配失败,尝试按仓库类型兜底匹配 warehouseName = "1".equals(warehouseType) ? "干仓" : ("2".equals(warehouseType) ? "冻仓" : "");
String warehouseType = StringUtils.trimToEmpty(orderRow.getWarehouseType()); errorList.add("出库单号【" + orderNumber + "】仓库类型【" + warehouseType + "】未找到对应仓库,将仅以名称导入");
if (StringUtils.isNotBlank(warehouseType)) { warehouseTypeCache.put(warehouseType, null);
if (warehouseTypeCache.containsKey(warehouseType)) { warehouse = null;
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 + "】未找到对应仓库,将仅以名称导入");
}
} else { } else {
warehouse = warehousePOList.get(0); warehouse = warehousePOList.get(0);
warehouseCache.put(warehouseName, warehouse); warehouseName = warehouse.getWarehouseName();
warehouseTypeCache.put(warehouseType, warehouse);
} }
} }
} }
@@ -815,7 +815,7 @@
where DEL_FLAG = 1 where DEL_FLAG = 1
and ( and (
WAREHOUSE_TYPE = #{warehouseType} 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> </select>
@@ -544,7 +544,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where DEL_FLAG = 1 where DEL_FLAG = 1
and ( and (
WAREHOUSE_TYPE = #{warehouseType} 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> </select>