oms修改
This commit is contained in:
+86
-86
@@ -10,7 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.linke.transport.interfaces.dto.warehouse.inBoundOrder.InboundOrderDTO;
|
||||
//import com.linke.transport.interfaces.dto.warehouse.inBoundOrder.InboundOrderDTO;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.oms.domain.reservationOrder.entity.ReservationAddressMulti;
|
||||
import com.mhd.oms.domain.reservationOrder.entity.ReservationCargoInfo;
|
||||
@@ -22,7 +22,7 @@ import com.mhd.oms.domain.reservationOrder.repository.facade.IOmsAddressMultiSer
|
||||
import com.mhd.oms.domain.reservationOrder.repository.mapper.*;
|
||||
import com.mhd.oms.enums.*;
|
||||
import com.mhd.oms.infrastructure.feign.ThirdPartyServiceFeign;
|
||||
import com.mhd.oms.infrastructure.feign.TransportServiceFeign;
|
||||
//import com.mhd.oms.infrastructure.feign.TransportServiceFeign;
|
||||
import com.mhd.oms.interfaces.dto.resevationOrder.*;
|
||||
import com.mhd.oms.util.DictDataUtils;
|
||||
import com.mhd.oms.util.OrderSequence;
|
||||
@@ -32,7 +32,7 @@ import com.mhd.system.api.UserServiceFeign;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.user.domain.userAggregate.repository.po.UserShipperPo;
|
||||
import com.mhd.common.core.domain.po.UserShipperPo;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -69,8 +69,8 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
@Resource
|
||||
private UserServiceFeign userServiceFeign;
|
||||
|
||||
@Resource
|
||||
private TransportServiceFeign transportServiceFeign;
|
||||
// @Resource
|
||||
// private TransportServiceFeign transportServiceFeign;
|
||||
|
||||
|
||||
@Resource
|
||||
@@ -546,7 +546,7 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
OmsCargoInfoDTO tmsCargoInfoDTO = allCargoList.get(0);
|
||||
String goodsTypeId = tmsCargoInfoDTO.getGoodsTypeId();
|
||||
if (ObjectUtil.isNotEmpty(goodsTypeId)) {
|
||||
processMaterialInventoryInbound(Long.valueOf(swzlUserId), orderCode, allCargoList);
|
||||
// processMaterialInventoryInbound(Long.valueOf(swzlUserId), orderCode, allCargoList);
|
||||
}
|
||||
}
|
||||
//保存付款方
|
||||
@@ -933,91 +933,91 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
return sysDepartInterfaceInfoPos.get(0).getInterfaceTypeValue();
|
||||
}
|
||||
|
||||
private void processMaterialInventoryInbound(Long swzlUserId, String tmsOrderNo, List<OmsCargoInfoDTO> allCargoList) {
|
||||
// 1. 库存货物:cargoType = STOCK
|
||||
List<OmsCargoInfoDTO> stockCargoList = allCargoList.stream()
|
||||
.filter(cargoInfo -> CargoTypeEnum.STOCK.getCode().equals(cargoInfo.getCargoType()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 物料货物:cargoType = MATERIAL
|
||||
List<OmsCargoInfoDTO> materialCargoList = allCargoList.stream()
|
||||
.filter(cargoInfo -> CargoTypeEnum.MATERIAL.getCode().equals(cargoInfo.getCargoType()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 3. 手动输入货物:cargoType = MANUAL
|
||||
List<OmsCargoInfoDTO> manualCargoList = allCargoList.stream()
|
||||
.filter(cargoInfo -> CargoTypeEnum.MANUAL.getCode().equals(cargoInfo.getCargoType()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.info("货物分类统计 - 总数: {}, 库存货物: {}, 物料货物: {}, 手动输入货物: {}",
|
||||
allCargoList.size(), stockCargoList.size(), materialCargoList.size(), manualCargoList.size());
|
||||
|
||||
// 只对物料货物执行自动入库逻辑
|
||||
if (!materialCargoList.isEmpty()) {
|
||||
log.info("开始处理物料货物入库,物料数量: {}", materialCargoList.size());
|
||||
|
||||
InboundOrderDTO.Create stockCreateDTO = new InboundOrderDTO.Create();
|
||||
stockCreateDTO.setOwnerId(swzlUserId);
|
||||
stockCreateDTO.setTmsOrderNo(tmsOrderNo);
|
||||
stockCreateDTO.setRemarks("TMS自动入库");
|
||||
stockCreateDTO.setDetails(getStockCreateDetailForMaterials(materialCargoList));
|
||||
|
||||
R<Long> r = transportServiceFeign.createInboundOrder(stockCreateDTO);
|
||||
if (r.getCode() != 200 || Objects.isNull(r.getData())) {
|
||||
throw new ServiceException(r.getMsg());
|
||||
}
|
||||
|
||||
R<List<com.mhd.oms.infrastructure.feign.po.Inventory>> inventoryResult = transportServiceFeign.getInventoryItemByInboundOrderId(
|
||||
r.getData());
|
||||
if (inventoryResult.getCode() != 200 || CollectionUtil.isEmpty(inventoryResult.getData())) {
|
||||
throw new ServiceException(r.getMsg());
|
||||
}
|
||||
|
||||
Map<Long, Long> materialToInventoryMap = inventoryResult
|
||||
.getData()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(com.mhd.oms.infrastructure.feign.po.Inventory::getMaterialId, com.mhd.oms.infrastructure.feign.po.Inventory::getId));
|
||||
|
||||
// 更新物料货物的goodsTypeId
|
||||
for (OmsCargoInfoDTO cargoInfo : materialCargoList) {
|
||||
if (Objects.nonNull(cargoInfo.getGoodsTypeId())) {
|
||||
Long materialId = Long.valueOf(cargoInfo.getGoodsTypeId());
|
||||
Long inventoryId = materialToInventoryMap.get(materialId);
|
||||
if (Objects.nonNull(inventoryId)) {
|
||||
cargoInfo.setGoodsTypeId(String.valueOf(inventoryId));
|
||||
log.info("物料货物goodsTypeId已更新: 物料ID {} -> 库存ID {}", materialId, inventoryId);
|
||||
} else {
|
||||
log.warn("未找到物料ID {} 对应的库存ID", materialId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log.info("物料货物入库处理完成,并已更新goodsTypeId为对应的inventoryId");
|
||||
}
|
||||
|
||||
// 手动输入货物直接跳过入库操作,后续会直接保存到数据库
|
||||
if (!manualCargoList.isEmpty()) {
|
||||
log.info("发现 {} 个手动输入的货物条目,将跳过入库操作直接保存", manualCargoList.size());
|
||||
}
|
||||
}
|
||||
// private void processMaterialInventoryInbound(Long swzlUserId, String tmsOrderNo, List<OmsCargoInfoDTO> allCargoList) {
|
||||
// // 1. 库存货物:cargoType = STOCK
|
||||
// List<OmsCargoInfoDTO> stockCargoList = allCargoList.stream()
|
||||
// .filter(cargoInfo -> CargoTypeEnum.STOCK.getCode().equals(cargoInfo.getCargoType()))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 2. 物料货物:cargoType = MATERIAL
|
||||
// List<OmsCargoInfoDTO> materialCargoList = allCargoList.stream()
|
||||
// .filter(cargoInfo -> CargoTypeEnum.MATERIAL.getCode().equals(cargoInfo.getCargoType()))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// // 3. 手动输入货物:cargoType = MANUAL
|
||||
// List<OmsCargoInfoDTO> manualCargoList = allCargoList.stream()
|
||||
// .filter(cargoInfo -> CargoTypeEnum.MANUAL.getCode().equals(cargoInfo.getCargoType()))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// log.info("货物分类统计 - 总数: {}, 库存货物: {}, 物料货物: {}, 手动输入货物: {}",
|
||||
// allCargoList.size(), stockCargoList.size(), materialCargoList.size(), manualCargoList.size());
|
||||
//
|
||||
// // 只对物料货物执行自动入库逻辑
|
||||
// if (!materialCargoList.isEmpty()) {
|
||||
// log.info("开始处理物料货物入库,物料数量: {}", materialCargoList.size());
|
||||
//
|
||||
// InboundOrderDTO.Create stockCreateDTO = new InboundOrderDTO.Create();
|
||||
// stockCreateDTO.setOwnerId(swzlUserId);
|
||||
// stockCreateDTO.setTmsOrderNo(tmsOrderNo);
|
||||
// stockCreateDTO.setRemarks("TMS自动入库");
|
||||
// stockCreateDTO.setDetails(getStockCreateDetailForMaterials(materialCargoList));
|
||||
//
|
||||
// R<Long> r = transportServiceFeign.createInboundOrder(stockCreateDTO);
|
||||
// if (r.getCode() != 200 || Objects.isNull(r.getData())) {
|
||||
// throw new ServiceException(r.getMsg());
|
||||
// }
|
||||
//
|
||||
// R<List<com.mhd.oms.infrastructure.feign.po.Inventory>> inventoryResult = transportServiceFeign.getInventoryItemByInboundOrderId(
|
||||
// r.getData());
|
||||
// if (inventoryResult.getCode() != 200 || CollectionUtil.isEmpty(inventoryResult.getData())) {
|
||||
// throw new ServiceException(r.getMsg());
|
||||
// }
|
||||
//
|
||||
// Map<Long, Long> materialToInventoryMap = inventoryResult
|
||||
// .getData()
|
||||
// .stream()
|
||||
// .collect(Collectors.toMap(com.mhd.oms.infrastructure.feign.po.Inventory::getMaterialId, com.mhd.oms.infrastructure.feign.po.Inventory::getId));
|
||||
//
|
||||
// // 更新物料货物的goodsTypeId
|
||||
// for (OmsCargoInfoDTO cargoInfo : materialCargoList) {
|
||||
// if (Objects.nonNull(cargoInfo.getGoodsTypeId())) {
|
||||
// Long materialId = Long.valueOf(cargoInfo.getGoodsTypeId());
|
||||
// Long inventoryId = materialToInventoryMap.get(materialId);
|
||||
// if (Objects.nonNull(inventoryId)) {
|
||||
// cargoInfo.setGoodsTypeId(String.valueOf(inventoryId));
|
||||
// log.info("物料货物goodsTypeId已更新: 物料ID {} -> 库存ID {}", materialId, inventoryId);
|
||||
// } else {
|
||||
// log.warn("未找到物料ID {} 对应的库存ID", materialId);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// log.info("物料货物入库处理完成,并已更新goodsTypeId为对应的inventoryId");
|
||||
// }
|
||||
//
|
||||
// // 手动输入货物直接跳过入库操作,后续会直接保存到数据库
|
||||
// if (!manualCargoList.isEmpty()) {
|
||||
// log.info("发现 {} 个手动输入的货物条目,将跳过入库操作直接保存", manualCargoList.size());
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 为物料货物创建入库单明细
|
||||
* @param materialCargoList 物料货物列表
|
||||
// * @param materialCargoList 物料货物列表
|
||||
* @return 入库单明细列表
|
||||
*/
|
||||
private static List<InboundOrderDTO.Detail> getStockCreateDetailForMaterials(List<OmsCargoInfoDTO> materialCargoList) {
|
||||
return materialCargoList
|
||||
.stream()
|
||||
.map((item) -> {
|
||||
InboundOrderDTO.Detail detail = new InboundOrderDTO.Detail();
|
||||
detail.setMaterialId(Long.valueOf(item.getGoodsTypeId()));
|
||||
detail.setQuantity(item.getCargoNum());
|
||||
detail.setMachineSerialNo(item.getMachineCode());
|
||||
return detail;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// private static List<InboundOrderDTO.Detail> getStockCreateDetailForMaterials(List<OmsCargoInfoDTO> materialCargoList) {
|
||||
// return materialCargoList
|
||||
// .stream()
|
||||
// .map((item) -> {
|
||||
// InboundOrderDTO.Detail detail = new InboundOrderDTO.Detail();
|
||||
// detail.setMaterialId(Long.valueOf(item.getGoodsTypeId()));
|
||||
// detail.setQuantity(item.getCargoNum());
|
||||
// detail.setMachineSerialNo(item.getMachineCode());
|
||||
// return detail;
|
||||
// })
|
||||
// .collect(Collectors.toList());
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean saveBatch(Collection<ReservationOrder> entityList, int batchSize) {
|
||||
|
||||
Reference in New Issue
Block a user