非通宇 保税仓出口订单推送;

This commit is contained in:
王奎兴
2026-06-11 17:27:06 +08:00
parent 889f5f34bc
commit e9a56f5a31
4 changed files with 68 additions and 78 deletions
@@ -57,9 +57,14 @@ public interface ReservationOutMaterialDetailMapper extends BaseMapper<Reservati
public Long getKcId(@Param("lotNo") String lotNo); public Long getKcId(@Param("lotNo") String lotNo);
public String getLot(@Param("uniqueId") Long uniqueId);
public Long getkcIdByUniqueId(@Param("uniqueId") Long uniqueId);
public String getInOrderNumber(@Param("id") Long id); public String getInOrderNumber(@Param("id") Long id);
public String getWarehouse(@Param("id") Long id); public String getWarehouse(@Param("id") Long id);
public String getOpWhLoc(@Param("id") Long id); public String getOpWhLoc(@Param("id") Long id);
public String getLotByKcId(@Param("id") Long id);
public String getInLotNo(@Param("inOrderNumber") String inOrderNumber, @Param("baseId") Long baseId); public String getInLotNo(@Param("inOrderNumber") String inOrderNumber, @Param("baseId") Long baseId);
} }
@@ -1143,7 +1143,11 @@ public class ReservationStockOutOrderApplicationService {
String[] split = lotNo.split("-"); String[] split = lotNo.split("-");
if (split.length == 2) { if (split.length == 2) {
item.put("lineNum", split[1]); item.put("lineNum", split[1]);
} else {
item.put("lineNum", 1);
} }
} else {
item.put("lineNum", 1);
} }
item.put("qty", detail.getQuantity()); item.put("qty", detail.getQuantity());
@@ -1168,54 +1172,40 @@ public class ReservationStockOutOrderApplicationService {
} }
// 库存关联信息(实体默认值 + WMS覆盖) // 库存关联信息(实体默认值 + WMS覆盖)
item.put("orderINo", detail.getInOrderNumber() != null ? detail.getInOrderNumber() : ""); Long kcId = reservationOutMaterialDetailMapper.getkcIdByUniqueId(detail.getUniqueId());
if (detail.getLotNo() != null && detail.getLotNo().contains("-")) { if (kcId != null) {
String lotNumStr = detail.getLotNo().substring(detail.getLotNo().lastIndexOf("-") + 1); String inOrderNumber = reservationOutMaterialDetailMapper.getInOrderNumber(kcId);
try { String warehouseCode = reservationOutMaterialDetailMapper.getWarehouse(kcId);
Integer lotRowNum = Integer.valueOf(lotNumStr); String opWhLoc = reservationOutMaterialDetailMapper.getOpWhLoc(kcId);
item.put("orderIRow", lotRowNum); String inLotNo = reservationOutMaterialDetailMapper.getLotByKcId(kcId);
item.put("billIRow", lotRowNum);
} catch (NumberFormatException ignored) {}
}
item.put("warehouse", detail.getWarehouseName() != null ? detail.getWarehouseName() : "");
item.put("opWhLoc", detail.getStorageLocationName() != null ? detail.getStorageLocationName() : "");
// WMS仓储数据(如有则覆盖)
if (detail.getLotNo() != null) {
Long kcId = reservationOutMaterialDetailMapper.getKcId(detail.getLotNo());
if (kcId != null) {
String inOrderNumber = reservationOutMaterialDetailMapper.getInOrderNumber(kcId);
String inLotNo = inOrderNumber != null ? reservationOutMaterialDetailMapper.getInLotNo(inOrderNumber, detail.getMaterialBaseInfoId()) : null;
String warehouse = reservationOutMaterialDetailMapper.getWarehouse(kcId);
String opWhLoc = reservationOutMaterialDetailMapper.getOpWhLoc(kcId);
if (inOrderNumber != null) { if (inOrderNumber != null) {
item.put("orderINo", inOrderNumber); item.put("orderINo", inOrderNumber);
} }
if (warehouse != null) { if (warehouseCode != null) {
item.put("warehouse", warehouse); item.put("warehouse", warehouseCode);
}
if (opWhLoc != null) {
item.put("opWhLoc", opWhLoc);
} }
item.put("opWhLoc", opWhLoc != null ? opWhLoc : "");
// billI = 入库单号 // billI = 入库单号
if (inOrderNumber != null) { if (inOrderNumber != null) {
item.put("billI", inOrderNumber); item.put("billI", inOrderNumber);
} }
if (inLotNo != null) { if (inLotNo != null && inLotNo.contains("-")) {
if (inLotNo.contains("-")) { String[] split = inLotNo.split("-");
String numStr = inLotNo.substring(inLotNo.lastIndexOf("-") + 1); if (split.length == 2) {
try { item.put("orderIRow", split[1]);
Integer result = Integer.valueOf(numStr); item.put("billIRow", split[1]);
item.put("orderIRow", result); } else {
item.put("billIRow", result); item.put("orderIRow", 1);
} catch (NumberFormatException e) { item.put("billIRow", 1);
}
} }
} else {
item.put("orderIRow", 1);
item.put("billIRow", 1);
} }
}
} }
orderList.add(item); orderList.add(item);
} }
order.put("orderList", orderList); order.put("orderList", orderList);
@@ -412,16 +412,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getInOrderNumber" parameterType="java.lang.Long" resultType="java.lang.String"> <select id="getInOrderNumber" parameterType="java.lang.Long" resultType="java.lang.String">
select IN_ORDER_NUMBER from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id} select IN_ORDER_NUMBER from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id}
</select> </select>
<select id="getInOrderNumber" parameterType="java.lang.Long" resultType="java.lang.String">
select IN_ORDER_NUMBER from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id}
</select>
<select id="getWarehouse" parameterType="java.lang.Long" resultType="java.lang.String"> <select id="getWarehouse" parameterType="java.lang.Long" resultType="java.lang.String">
select WAREHOUSE_NAME from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id} select WAREHOUSE_CODE from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id}
</select> </select>
<select id="getOpWhLoc" parameterType="java.lang.Long" resultType="java.lang.String"> <select id="getOpWhLoc" parameterType="java.lang.Long" resultType="java.lang.String">
select STORAGE_LOCATION_NAME from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id} select STORAGE_LOCATION_CODE from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id}
</select>
<select id="getLotByKcId" parameterType="java.lang.Long" resultType="java.lang.String">
select LOT_NUMBER from "NGWL_TEST_WMS".MATERIAL_INVENTORY where MATERIAL_INVENTORY_ID = #{id}
</select> </select>
<select id="getInLotNo" resultType="java.lang.String"> <select id="getInLotNo" resultType="java.lang.String">
select LOT_NO from "NGWL_TEST_WMS".IN_MATERIAL_DETAIL where MATERIAL_BASE_INFO_ID = #{baseId} and IN_ORDER_NUMBER = #{inOrderNumber} select LOT_NO from "NGWL_TEST_WMS".IN_MATERIAL_DETAIL where MATERIAL_BASE_INFO_ID = #{baseId} and IN_ORDER_NUMBER = #{inOrderNumber}
</select> </select>
<select id="getLot" parameterType="java.lang.Long" resultType="java.lang.String">
select LOT_NO from "NGWL_TEST_WMS".OUT_MATERIAL_DETAIL where UNIQUE_ID = #{uniqueId}
</select>
<select id="getkcIdByUniqueId" parameterType="java.lang.Long" resultType="java.lang.Long">
select MATERIAL_INVENTORY_ID from "NGWL_TEST_WMS".OUT_MATERIAL_DETAIL where UNIQUE_ID = #{uniqueId}
</select>
</mapper> </mapper>
@@ -1549,10 +1549,8 @@ public class StockOutOrderApplicationService {
item.put("lineNum", split[1]); item.put("lineNum", split[1]);
} }
} }
item.put("itemNo", detail.getMaterialBaseInfoId() != null ? detail.getMaterialBaseInfoId().toString() : ""); item.put("itemNo", detail.getMaterialCode() != null ? detail.getMaterialCode().toString() : "");
item.put("itemName", detail.getMaterialName() != null ? detail.getMaterialName() : ""); item.put("itemName", detail.getMaterialName() != null ? detail.getMaterialName() : "");
item.put("spec", detail.getSpecificationModel() != null ? detail.getSpecificationModel() : "");
item.put("unit", detail.getUnit() != null ? detail.getUnit() : "");
item.put("qty", detail.getQuantity()); item.put("qty", detail.getQuantity());
// 获取物料详情 // 获取物料详情
@@ -1561,7 +1559,8 @@ public class StockOutOrderApplicationService {
if (materialBaseInfoPO != null) { if (materialBaseInfoPO != null) {
item.put("erpCurr", materialBaseInfoPO.getCurrency() != null ? materialBaseInfoPO.getCurrency() : ""); item.put("erpCurr", materialBaseInfoPO.getCurrency() != null ? materialBaseInfoPO.getCurrency() : "");
item.put("erpPrice", materialBaseInfoPO.getUnitPrice()); item.put("erpPrice", materialBaseInfoPO.getUnitPrice());
item.put("spec", materialBaseInfoPO.getSpecificationModel() != null ? materialBaseInfoPO.getSpecificationModel() : "");
item.put("unit", materialBaseInfoPO.getDeclarationUnit() != null ? materialBaseInfoPO.getDeclarationUnit() : "");
// 计算金额 // 计算金额
BigDecimal unitPrice = materialBaseInfoPO.getUnitPrice(); BigDecimal unitPrice = materialBaseInfoPO.getUnitPrice();
BigDecimal quantity = detail.getQuantity(); BigDecimal quantity = detail.getQuantity();
@@ -1572,55 +1571,45 @@ public class StockOutOrderApplicationService {
} }
} }
// 库存关联信息(实体默认值 + WMS覆盖) Long materialInventoryId = detail.getMaterialInventoryId();
item.put("orderINo", detail.getInOrderNumber() != null ? detail.getInOrderNumber() : ""); MaterialInventory materialInventory = materialInventoryMapper.selectById(materialInventoryId);
if (detail.getLotNo() != null && detail.getLotNo().contains("-")) {
String lotNumStr = detail.getLotNo().substring(detail.getLotNo().lastIndexOf("-") + 1);
try {
Integer lotRowNum = Integer.valueOf(lotNumStr);
item.put("orderIRow", lotRowNum);
item.put("billIRow", lotRowNum);
} catch (NumberFormatException ignored) {}
}
item.put("warehouse", detail.getWarehouseName() != null ? detail.getWarehouseName() : "");
item.put("opWhLoc", detail.getStorageLocationName() != null ? detail.getStorageLocationName() : "");
// WMS仓储数据(如有则覆盖) // WMS仓储数据(如有则覆盖)
if (detail.getLotNo() != null) { if (materialInventory != null) {
String inOrderNumber = materialInventory.getInOrderNumber();
String warehouseCode = materialInventory.getWarehouseCode();
String storageLocationCode = materialInventory.getStorageLocationCode();
String inLotNo = materialInventory.getLotNumber();
Long kcId = stockOutOrderMapper.getKcId(detail.getLotNo()); Long kcId = stockOutOrderMapper.getKcId(detail.getLotNo());
if (kcId != null) { if (kcId != null) {
String inOrderNumber = stockOutOrderMapper.getInOrderNumber(kcId);
String inLotNo = inOrderNumber != null ? stockOutOrderMapper.getInLotNo(inOrderNumber, detail.getMaterialBaseInfoId()) : null;
String warehouse = stockOutOrderMapper.getWarehouse(kcId);
String opWhLoc = stockOutOrderMapper.getOpWhLoc(kcId);
if (inOrderNumber != null) { if (inOrderNumber != null) {
item.put("orderINo", inOrderNumber); item.put("orderINo", inOrderNumber);
} }
if (warehouse != null) { if (warehouseCode != null) {
item.put("warehouse", warehouse); item.put("warehouse", warehouseCode);
}
if (storageLocationCode != null) {
item.put("opWhLoc", storageLocationCode);
} }
item.put("opWhLoc", opWhLoc != null ? opWhLoc : "");
// billI = 入库单号 // billI = 入库单号
if (inOrderNumber != null) { if (inOrderNumber != null) {
item.put("billI", inOrderNumber); item.put("billI", inOrderNumber);
} }
if (inLotNo != null) { if (inLotNo != null && inLotNo.contains("-")) {
if (inLotNo.contains("-")) { String[] split = inLotNo.split("-");
String numStr = inLotNo.substring(inLotNo.lastIndexOf("-") + 1); if (split.length == 2) {
try { item.put("orderIRow", split[1]);
Integer result = Integer.valueOf(numStr); item.put("billIRow", split[1]);
item.put("orderIRow", result); } else {
item.put("billIRow", result); item.put("orderIRow", 1);
} catch (NumberFormatException e) { item.put("billIRow", 1);
}
} }
} else {
item.put("orderIRow", 1);
item.put("billIRow", 1);
} }
} }
} }
orderList.add(item); orderList.add(item);
} }
order.put("orderList", orderList); order.put("orderList", orderList);