Browse Source

1.干线bug修复

2.干线基础数据表逻辑完成
fix-sign
zhenghaoyu 4 months ago
parent
commit
eace6f9687
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  2. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenOrderToLoadListener.java
  3. 301
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/CarsLoadDealListener.java
  4. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java
  5. 84
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java
  6. 122
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -9,7 +9,7 @@ public interface ModuleNameConstant {
/**
* 如果不需要 ""
*/
public static final String DEVAUTH ="-zhy";
public static final String DEVAUTH ="";
/**
* 工厂对接服务名称

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/OpenOrderToLoadListener.java

@ -11,7 +11,6 @@ import com.rabbitmq.client.Channel;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
@ -148,8 +147,9 @@ public class OpenOrderToLoadListener {
List<TrunklineCarsLoadScanEntity> scanEntityList = warehouseIdMap.get(warehouseId);
TrunklineCarsLoadEntity carsLoadEntity = loadIdMap1.get(loadId);
//TODO 暂时注释
//发送干线发车广播
carsLoadAsyncService.sendReportCarsLoadSuppleFanout(AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,carsLoadEntity,scanEntityList);
// carsLoadAsyncService.sendReportCarsLoadSuppleFanout(AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,carsLoadEntity,scanEntityList);
});

301
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mq/report/CarsLoadDealListener.java

@ -83,6 +83,26 @@ public class CarsLoadDealListener {
}else{
log.warn(method+"未知的操作类型");
}
}else if(WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE.equals(node)){
if(BizOperationEnums.ADD.equals(bizOperation)){
}else if(BizOperationEnums.DELETE.equals(bizOperation)){
}else if(BizOperationEnums.MODIFY.equals(bizOperation)){
saveUnloadData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else{
log.warn(method+"未知的操作类型");
}
}else if(WorkNodeEnums.SIGN_DIRECT_SHIPPER.equals(node) || WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART.equals(node)){
if(BizOperationEnums.ADD.equals(bizOperation)){
}else if(BizOperationEnums.DELETE.equals(bizOperation)){
}else if(BizOperationEnums.MODIFY.equals(bizOperation)){
saveSignData(main, operator, operatorId,operatorTime,warehouse,warehouseId);
}else{
log.warn(method+"未知的操作类型");
}
}else {
log.warn(method+"未知的节点类型");
}
@ -91,6 +111,287 @@ public class CarsLoadDealListener {
}
private void saveSignData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
String method = "####################saveSignData: ";
JSONObject js = JSONUtil.toBean(JSONUtil.toJsonStr(main), JSONObject.class);
JSONArray details = js.getJSONArray("details");
List<PackageData> packageDataList = JSONUtil.toList(details, PackageData.class);
//把packageDataList通过packageType的code进行分组
Map<Integer, List<PackageData>> packageTypeEnumsListMap = packageDataList.stream().collect(Collectors.groupingBy(t->t.getPackageType().getCode()));
TrunklineCarsLoadEntity carsLoadEntity = JSONUtil.toBean(js, TrunklineCarsLoadEntity.class);
List<ReportPackageTrunklineEntity> addList = new ArrayList<>();
packageTypeEnumsListMap.keySet().forEach(packageTypeCode -> {
List<PackageData> packageDataListByPackageType = packageTypeEnumsListMap.get(packageTypeCode);
if(NumberUtil.equals(packageTypeCode,1)){
//把packageDataListByPackageType中所有元素的orderPackageCode放入一个List
List<String> packageCodes = packageDataListByPackageType.stream().map(PackageData::getPackageCode).collect(java.util.stream.Collectors.toList());
//把packageDataListByPackageType转化成以orderPackageCode为key的Map
Map<String, PackageData> packageDataMap = packageDataListByPackageType.stream().collect(Collectors.toMap(PackageData::getPackageCode, Function.identity()));
List<ReportPackageBasicEntity> packageBasicEntityList = reportPackageBasicService.findByOrderPackageCodes(packageCodes);
packageBasicEntityList.forEach(entity -> {
ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity();
reportPackageTrunklineEntity.setBasicId(entity.getId());
reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo());
reportPackageTrunklineEntity.setWaybillNo(entity.getWaybillNo());
reportPackageTrunklineEntity.setServiceNo(entity.getServiceNo());
reportPackageTrunklineEntity.setOrderCode(entity.getOrderCode());
String orderPackageCode = entity.getOrderPackageCode();
PackageData packageData = packageDataMap.get(orderPackageCode);
reportPackageTrunklineEntity.setOrderPackageCode(orderPackageCode);
reportPackageTrunklineEntity.setProductName(entity.getProductName());
reportPackageTrunklineEntity.setProductId(entity.getProductId());
reportPackageTrunklineEntity.setBrand(entity.getBrand());
reportPackageTrunklineEntity.setBrandId(entity.getBrandId());
Long departureWarehouseId = entity.getDepartureWarehouseId();
reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId);
reportPackageTrunklineEntity.setDepartureWarehouseName(entity.getDepartureWarehouseName());
Long destinationWarehouseId = entity.getDestinationWarehouseId();
reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId);
reportPackageTrunklineEntity.setDestinationWarehouseName(entity.getDestinationWarehouseName());
reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId);
reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse);
reportPackageTrunklineEntity.setLoadingUserId(operatorId);
reportPackageTrunklineEntity.setLoadingUserName(operator);
reportPackageTrunklineEntity.setFinalNodeId(packageData.getFinalNodeId());
reportPackageTrunklineEntity.setFinalNodeName(packageData.getFinalNodeName());
reportPackageTrunklineEntity.setIsStartWarehouse(0);
if(warehouseId.equals(departureWarehouseId)){
reportPackageTrunklineEntity.setIsStartWarehouse(1);
}
reportPackageTrunklineEntity.setIsEndWarehouse(0);
if(warehouseId.equals(destinationWarehouseId)){
reportPackageTrunklineEntity.setIsEndWarehouse(1);
}
reportPackageTrunklineEntity.setTrunklineStatus(3);
reportPackageTrunklineEntity.setIsCustomer(0);
reportPackageTrunklineEntity.setLoadingNum(entity.getNum());
reportPackageTrunklineEntity.setUnloadNum(0);
reportPackageTrunklineEntity.setSignNum(0);
addList.add(reportPackageTrunklineEntity);
});
}else if(NumberUtil.equals(packageTypeCode,2)){
//把packageDataListByPackageType中所有元素的orderCode放入一个List
List<String> orderCodeList = packageDataListByPackageType.stream().map(PackageData::getOrderCode).collect(java.util.stream.Collectors.toList());
List<ReportPackageBasicEntity> packageBasicEntityList = reportPackageBasicService.findListByOrderCodeList(orderCodeList);
//把packageBasicEntityList通过orderCode进行分组
Map<String, List<ReportPackageBasicEntity>> packageBasicEntityListMap = packageBasicEntityList.stream().collect(Collectors.groupingBy(ReportPackageBasicEntity::getOrderCode));
//把packageDataListByPackageType通过orderCode进行分组
Map<String, List<PackageData>> packageDataListMap = packageDataListByPackageType.stream().collect(Collectors.groupingBy(PackageData::getOrderCode));
packageDataListMap.keySet().forEach(orderCode -> {
List<PackageData> packageDataList1 = packageDataListMap.get(orderCode);
List<ReportPackageBasicEntity> packageBasicEntities = packageBasicEntityListMap.get(orderCode);
//把packageBasicEntities转化成以productName为key的Map
Map<String, ReportPackageBasicEntity> packageBasicEntityMap = packageBasicEntities.stream().collect(Collectors.toMap(ReportPackageBasicEntity::getProductName, Function.identity()));
packageDataList1.forEach(packageData1 -> {
String productName = packageData1.getProductName();
ReportPackageBasicEntity packageBasicEntity = packageBasicEntityMap.get(productName);
ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity();
reportPackageTrunklineEntity.setBasicId(packageBasicEntity.getId());
reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo());
reportPackageTrunklineEntity.setWaybillNo(packageBasicEntity.getWaybillNo());
reportPackageTrunklineEntity.setServiceNo(packageBasicEntity.getServiceNo());
reportPackageTrunklineEntity.setOrderCode(packageBasicEntity.getOrderCode());
reportPackageTrunklineEntity.setOrderPackageCode(packageBasicEntity.getOrderPackageCode());
reportPackageTrunklineEntity.setProductName(packageBasicEntity.getProductName());
reportPackageTrunklineEntity.setProductId(packageBasicEntity.getProductId());
reportPackageTrunklineEntity.setBrand(packageBasicEntity.getBrand());
reportPackageTrunklineEntity.setBrandId(packageBasicEntity.getBrandId());
Long departureWarehouseId = packageBasicEntity.getDepartureWarehouseId();
reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId);
reportPackageTrunklineEntity.setDepartureWarehouseName(packageBasicEntity.getDepartureWarehouseName());
Long destinationWarehouseId = packageBasicEntity.getDestinationWarehouseId();
reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId);
reportPackageTrunklineEntity.setDestinationWarehouseName(packageBasicEntity.getDestinationWarehouseName());
reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId);
reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse);
reportPackageTrunklineEntity.setLoadingUserId(operatorId);
reportPackageTrunklineEntity.setLoadingUserName(operator);
reportPackageTrunklineEntity.setFinalNodeId(packageData1.getFinalNodeId());
reportPackageTrunklineEntity.setFinalNodeName(packageData1.getFinalNodeName());
reportPackageTrunklineEntity.setIsStartWarehouse(0);
if(warehouseId.equals(departureWarehouseId)){
reportPackageTrunklineEntity.setIsStartWarehouse(1);
}
reportPackageTrunklineEntity.setIsEndWarehouse(0);
if(warehouseId.equals(destinationWarehouseId)){
reportPackageTrunklineEntity.setIsEndWarehouse(1);
}
reportPackageTrunklineEntity.setTrunklineStatus(3);
reportPackageTrunklineEntity.setIsCustomer(0);
reportPackageTrunklineEntity.setLoadingNum(packageData1.getNumber());
reportPackageTrunklineEntity.setUnloadNum(0);
reportPackageTrunklineEntity.setSignNum(0);
addList.add(reportPackageTrunklineEntity);
});
});
}
});
if(CollUtil.isNotEmpty(addList)){
reportPackageTrunklineService.saveBatch(addList);
}
}
private void saveUnloadData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
String method = "####################saveUnloadData: ";
JSONObject js = JSONUtil.toBean(JSONUtil.toJsonStr(main), JSONObject.class);
JSONArray details = js.getJSONArray("details");
List<PackageData> packageDataList = JSONUtil.toList(details, PackageData.class);
//把packageDataList通过packageType的code进行分组
Map<Integer, List<PackageData>> packageTypeEnumsListMap = packageDataList.stream().collect(Collectors.groupingBy(t->t.getPackageType().getCode()));
TrunklineCarsLoadEntity carsLoadEntity = JSONUtil.toBean(js, TrunklineCarsLoadEntity.class);
List<ReportPackageTrunklineEntity> addList = new ArrayList<>();
packageTypeEnumsListMap.keySet().forEach(packageTypeCode -> {
List<PackageData> packageDataListByPackageType = packageTypeEnumsListMap.get(packageTypeCode);
if(NumberUtil.equals(packageTypeCode,1)){
//把packageDataListByPackageType中所有元素的orderPackageCode放入一个List
List<String> packageCodes = packageDataListByPackageType.stream().map(PackageData::getPackageCode).collect(java.util.stream.Collectors.toList());
//把packageDataListByPackageType转化成以orderPackageCode为key的Map
Map<String, PackageData> packageDataMap = packageDataListByPackageType.stream().collect(Collectors.toMap(PackageData::getPackageCode, Function.identity()));
List<ReportPackageBasicEntity> packageBasicEntityList = reportPackageBasicService.findByOrderPackageCodes(packageCodes);
packageBasicEntityList.forEach(entity -> {
ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity();
reportPackageTrunklineEntity.setBasicId(entity.getId());
reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo());
reportPackageTrunklineEntity.setWaybillNo(entity.getWaybillNo());
reportPackageTrunklineEntity.setServiceNo(entity.getServiceNo());
reportPackageTrunklineEntity.setOrderCode(entity.getOrderCode());
String orderPackageCode = entity.getOrderPackageCode();
PackageData packageData = packageDataMap.get(orderPackageCode);
reportPackageTrunklineEntity.setOrderPackageCode(orderPackageCode);
reportPackageTrunklineEntity.setProductName(entity.getProductName());
reportPackageTrunklineEntity.setProductId(entity.getProductId());
reportPackageTrunklineEntity.setBrand(entity.getBrand());
reportPackageTrunklineEntity.setBrandId(entity.getBrandId());
Long departureWarehouseId = entity.getDepartureWarehouseId();
reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId);
reportPackageTrunklineEntity.setDepartureWarehouseName(entity.getDepartureWarehouseName());
Long destinationWarehouseId = entity.getDestinationWarehouseId();
reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId);
reportPackageTrunklineEntity.setDestinationWarehouseName(entity.getDestinationWarehouseName());
reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId);
reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse);
reportPackageTrunklineEntity.setLoadingUserId(operatorId);
reportPackageTrunklineEntity.setLoadingUserName(operator);
reportPackageTrunklineEntity.setFinalNodeId(packageData.getFinalNodeId());
reportPackageTrunklineEntity.setFinalNodeName(packageData.getFinalNodeName());
reportPackageTrunklineEntity.setIsStartWarehouse(0);
if(warehouseId.equals(departureWarehouseId)){
reportPackageTrunklineEntity.setIsStartWarehouse(1);
}
reportPackageTrunklineEntity.setIsEndWarehouse(0);
if(warehouseId.equals(destinationWarehouseId)){
reportPackageTrunklineEntity.setIsEndWarehouse(1);
}
reportPackageTrunklineEntity.setTrunklineStatus(2);
reportPackageTrunklineEntity.setIsCustomer(0);
reportPackageTrunklineEntity.setLoadingNum(entity.getNum());
reportPackageTrunklineEntity.setUnloadNum(0);
reportPackageTrunklineEntity.setSignNum(0);
addList.add(reportPackageTrunklineEntity);
});
}else if(NumberUtil.equals(packageTypeCode,2)){
//把packageDataListByPackageType中所有元素的orderCode放入一个List
List<String> orderCodeList = packageDataListByPackageType.stream().map(PackageData::getOrderCode).collect(java.util.stream.Collectors.toList());
List<ReportPackageBasicEntity> packageBasicEntityList = reportPackageBasicService.findListByOrderCodeList(orderCodeList);
//把packageBasicEntityList通过orderCode进行分组
Map<String, List<ReportPackageBasicEntity>> packageBasicEntityListMap = packageBasicEntityList.stream().collect(Collectors.groupingBy(ReportPackageBasicEntity::getOrderCode));
//把packageDataListByPackageType通过orderCode进行分组
Map<String, List<PackageData>> packageDataListMap = packageDataListByPackageType.stream().collect(Collectors.groupingBy(PackageData::getOrderCode));
packageDataListMap.keySet().forEach(orderCode -> {
List<PackageData> packageDataList1 = packageDataListMap.get(orderCode);
List<ReportPackageBasicEntity> packageBasicEntities = packageBasicEntityListMap.get(orderCode);
//把packageBasicEntities转化成以productName为key的Map
Map<String, ReportPackageBasicEntity> packageBasicEntityMap = packageBasicEntities.stream().collect(Collectors.toMap(ReportPackageBasicEntity::getProductName, Function.identity()));
packageDataList1.forEach(packageData1 -> {
String productName = packageData1.getProductName();
ReportPackageBasicEntity packageBasicEntity = packageBasicEntityMap.get(productName);
ReportPackageTrunklineEntity reportPackageTrunklineEntity = new ReportPackageTrunklineEntity();
reportPackageTrunklineEntity.setBasicId(packageBasicEntity.getId());
reportPackageTrunklineEntity.setLoadNo(carsLoadEntity.getCarsNo());
reportPackageTrunklineEntity.setWaybillNo(packageBasicEntity.getWaybillNo());
reportPackageTrunklineEntity.setServiceNo(packageBasicEntity.getServiceNo());
reportPackageTrunklineEntity.setOrderCode(packageBasicEntity.getOrderCode());
reportPackageTrunklineEntity.setOrderPackageCode(packageBasicEntity.getOrderPackageCode());
reportPackageTrunklineEntity.setProductName(packageBasicEntity.getProductName());
reportPackageTrunklineEntity.setProductId(packageBasicEntity.getProductId());
reportPackageTrunklineEntity.setBrand(packageBasicEntity.getBrand());
reportPackageTrunklineEntity.setBrandId(packageBasicEntity.getBrandId());
Long departureWarehouseId = packageBasicEntity.getDepartureWarehouseId();
reportPackageTrunklineEntity.setDepartureWarehouseId(departureWarehouseId);
reportPackageTrunklineEntity.setDepartureWarehouseName(packageBasicEntity.getDepartureWarehouseName());
Long destinationWarehouseId = packageBasicEntity.getDestinationWarehouseId();
reportPackageTrunklineEntity.setDestinationWarehouseId(destinationWarehouseId);
reportPackageTrunklineEntity.setDestinationWarehouseName(packageBasicEntity.getDestinationWarehouseName());
reportPackageTrunklineEntity.setLoadingWarehouseId(warehouseId);
reportPackageTrunklineEntity.setLoadingWarehouseName(warehouse);
reportPackageTrunklineEntity.setLoadingUserId(operatorId);
reportPackageTrunklineEntity.setLoadingUserName(operator);
reportPackageTrunklineEntity.setFinalNodeId(packageData1.getFinalNodeId());
reportPackageTrunklineEntity.setFinalNodeName(packageData1.getFinalNodeName());
reportPackageTrunklineEntity.setIsStartWarehouse(0);
if(warehouseId.equals(departureWarehouseId)){
reportPackageTrunklineEntity.setIsStartWarehouse(1);
}
reportPackageTrunklineEntity.setIsEndWarehouse(0);
if(warehouseId.equals(destinationWarehouseId)){
reportPackageTrunklineEntity.setIsEndWarehouse(1);
}
reportPackageTrunklineEntity.setTrunklineStatus(2);
reportPackageTrunklineEntity.setIsCustomer(0);
reportPackageTrunklineEntity.setLoadingNum(packageData1.getNumber());
reportPackageTrunklineEntity.setUnloadNum(0);
reportPackageTrunklineEntity.setSignNum(0);
addList.add(reportPackageTrunklineEntity);
});
});
}
});
if(CollUtil.isNotEmpty(addList)){
reportPackageTrunklineService.saveBatch(addList);
}
}
private void deleteCarsLoadData(Object main, String operator, Long operatorId, Date operatorTime, String warehouse, Long warehouseId) {
String method = "####################deleteCarsLoadData: ";

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java

@ -44,4 +44,8 @@ public interface ICarsLoadAsyncService {
void sendFactoryData(String orderCode, String orderPackageCode, Long warehouseId, String warehouseName);
void downPackageOrDelTray(String orderPackageCode, Long fromWarehouseId, String remark);
void sendReportPackageSignData(String nickName, Long userId, Long warehouseId, String warehouseName, TrunklineCarsLoadEntity carsLoadEntity, List<String> orderPackageCodeList);
void sendReportZeroPackageSignData(Long userId, String nickName, Long warehouseId, String warehouseName, List<TrunklineScanZeroDetailEntity> updateScanZeroDetailList, TrunklineCarsLoadScanEntity carsLoadScanEntity, TrunklineCarsLoadEntity carsLoadEntity);
}

84
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java

@ -1017,6 +1017,90 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
}
@LogpmAsync("asyncExecutor")
@Override
public void sendReportPackageSignData(String nickName, Long userId, Long warehouseId, String warehouseName, TrunklineCarsLoadEntity carsLoadEntity, List<String> orderPackageCodeList) {
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg();
String loadType = carsLoadEntity.getLoadType();
if("4".equals(loadType)){
nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART);
}else{
nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_DIRECT_SHIPPER);
}
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD);
nodeFanoutMsg.setOperator(nickName);
nodeFanoutMsg.setOperatorId(userId);
nodeFanoutMsg.setWarehouse(warehouseName);
nodeFanoutMsg.setWarehouseId(warehouseId);
nodeFanoutMsg.setOperatorTime(new Date());
//组装包件数据
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(carsLoadEntity));
List<PackageData> packageDataList = new ArrayList<>();
orderPackageCodeList.forEach(packageCode -> {
PackageData packageData = new PackageData();
packageData.setPackageCode(packageCode);
packageData.setNumber(1);
packageData.setPackageType(PackageTypeEnums.CMP);
packageDataList.add(packageData);
});
json.put("details", packageDataList);
nodeFanoutMsg.setMain(json);
FanoutMsg fanoutMsg = FanoutMsg.builder().exchange(FanoutConstants.trunkline.REPORTDATA.EXCHANGE).msg(JSONObject.toJSONString(nodeFanoutMsg)).build();
sendFanoutService.sendFanoutMsg(fanoutMsg);
}
@LogpmAsync("asyncExecutor")
@Override
public void sendReportZeroPackageSignData(Long userId, String nickName, Long warehouseId, String warehouseName, List<TrunklineScanZeroDetailEntity> sendList, TrunklineCarsLoadScanEntity carsLoadScanEntity, TrunklineCarsLoadEntity carsLoadEntity) {
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg();
String loadType = carsLoadEntity.getLoadType();
if("4".equals(loadType)){
nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_TRIPARTITE_TRANSFER_DEPART);
}else{
nodeFanoutMsg.setNode(WorkNodeEnums.SIGN_DIRECT_SHIPPER);
}
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD);
nodeFanoutMsg.setOperator(nickName);
nodeFanoutMsg.setOperatorId(userId);
nodeFanoutMsg.setWarehouse(warehouseName);
nodeFanoutMsg.setWarehouseId(warehouseId);
nodeFanoutMsg.setOperatorTime(new Date());
//组装包件数据
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(carsLoadEntity));
List<PackageData> packageDataList = new ArrayList<>();
sendList.forEach(zeroDetailVO -> {
PackageData packageData = new PackageData();
packageData.setOrderCode(carsLoadScanEntity.getOrderCode());
packageData.setNumber(zeroDetailVO.getUnloadNum());
packageData.setPackageType(PackageTypeEnums.LTL);
packageData.setWaybillNumber(carsLoadScanEntity.getWaybillNo());
packageData.setProductId(zeroDetailVO.getGoodsId());
packageData.setProductName(zeroDetailVO.getGoodsName());
packageDataList.add(packageData);
});
json.put("details", packageDataList);
nodeFanoutMsg.setMain(json);
FanoutMsg fanoutMsg = FanoutMsg.builder().exchange(FanoutConstants.trunkline.REPORTDATA.EXCHANGE).msg(JSONObject.toJSONString(nodeFanoutMsg)).build();
sendFanoutService.sendFanoutMsg(fanoutMsg);
}
@LogpmAsync("asyncExecutor")
@Override
public void sendReportCarsLoadSuppleFanout(Long userId, String nickName, Long warehouseId, TrunklineCarsLoadEntity carsLoadEntity, List<TrunklineCarsLoadScanEntity> scanEntityList) {

122
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -479,8 +479,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log.error("同步工厂数据失败", e);
}
//TODO 暂时注释
//发送干线发车广播
carsLoadAsyncService.sendReportCarsLoadStartFanout(AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,warehouseName,carsLoadEntity);
// carsLoadAsyncService.sendReportCarsLoadStartFanout(AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,warehouseName,carsLoadEntity);
log.info("##############startCarByLoadId: 发车成功 loadId={} startCarType={} warehouseId={}", loadId, startCarType, warehouseId);
}
@ -912,8 +913,9 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log.error("#############cancelStartCarByLoadId: 处理取消节点签收单 和 发车数量失败", e);
}
//TODO 暂时注释
//发送取消发车广播
carsLoadAsyncService.sendReportCancleStartData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity);
// carsLoadAsyncService.sendReportCancleStartData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity);
}
@ -1462,8 +1464,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Long scanId = carsLoadScanEntity.getId();
List<TrunklineScanZeroDetailVO> list = mapByScanId.get(scanId);
carsLoadAsyncService.sendReportZeroPackageUnloadData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseEntity.getName(),list,carsLoadScanEntity,carsLoadEntity);
//TODO 暂时注释
// carsLoadAsyncService.sendReportZeroPackageUnloadData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseEntity.getName(),list,carsLoadScanEntity,carsLoadEntity);
});
@ -5383,8 +5385,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
updateEntity.setId(scanId);
updateEntity.setUnloadCheck(1);
updateList.add(updateEntity);
carsLoadAsyncService.sendReportZeroPackageUnloadData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName,list,carsLoadScanEntity,carsLoadEntity);
//TODO 暂时注释
// carsLoadAsyncService.sendReportZeroPackageUnloadData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName,list,carsLoadScanEntity,carsLoadEntity);
});
@ -7841,6 +7843,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log.error("推送卸车失败{}", e);
}
}
//把newParcelListEntities中所有元素的orderPackageCode放入一个List
List<String> packageCodes = newParcelListEntities.stream().map(DistributionParcelListEntity::getOrderPackageCode).collect(Collectors.toList());
//TODO 暂时注释
//发送报表模块卸车数据
// carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,packageCodes);
}
trunklineCarsLoadScanService.updateBatchById(updateScanEntityList);
@ -8652,6 +8661,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
log.info("推送工厂数据:{}", JSONUtil.toJsonStr(msg));
factoryDataMessageSender.sendNodeDataByBrand(msg);
}
List<String> orderPackageCodeList = new ArrayList<>();
orderPackageCodeList.add(orderPackageCode);
//TODO 暂时注释
// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName, carsLoadEntity, orderPackageCodeList);
} catch (Exception e) {
log.error("推送签收数据给工厂失败 {}", e);
}
@ -8695,11 +8710,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Long loadId = signOrderEntity.getLoadId();
Long warehouseId = signOrderEntity.getWarehouseId();
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId);
if(Objects.isNull(carsLoadEntity)){
log.warn("##############signZeroOrder: 配载信息不存在 loadId={}", loadId);
return R.fail(405, "配载信息不存在");
}
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(warehouseId);
if(Objects.isNull(warehouseEntity)){
log.warn("##############signZeroOrder: 仓库信息不存在 warehouseId={}", warehouseId);
return R.fail(405, "仓库信息不存在");
}
String warehouseName = warehouseEntity.getName();
TrunklineCarsLoadScanEntity carsLoadScanEntity = trunklineCarsLoadScanService.getById(carsLoadScanId);
if (Objects.isNull(carsLoadScanEntity)) {
@ -8766,6 +8788,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
updateNumByLoadId(loadId);
//重新计算签收单的数量
updateSignOrderNumBySignOrderId(signOrderId);
//TODO 暂时注释
// carsLoadAsyncService.sendReportZeroPackageSignData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, updateScanZeroDetailList, carsLoadScanEntity, carsLoadEntity);
// Long waybillId = carsLoadScanEntity.getWaybillId();
// if(!Objects.isNull(waybillId)){
@ -8819,6 +8843,15 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
String warehouseName = loadCarsDTO.getWarehouseName();
List<TrunklineCarsLoadScanVO> list = trunklineCarsLoadScanService.findListHasSignOrderIdByIds(loadScanIds);
//把list中所有的loadId放入一个List
List<Long> loadIdList = list.stream().map(TrunklineCarsLoadScanVO::getLoadId).collect(Collectors.toList());
QueryWrapper<TrunklineCarsLoadEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", loadIdList);
List<TrunklineCarsLoadEntity> trunklineCarsLoadEntities = baseMapper.selectList(queryWrapper);
//trunklineCarsLoadEntities转化为以id为key的Map
Map<Long, TrunklineCarsLoadEntity> trunklineCarsLoadMap = trunklineCarsLoadEntities.stream().collect(Collectors.toMap(TrunklineCarsLoadEntity::getId, Function.identity()));
List<DistributionParcelListEntity> parcelListEntityList = trunklineCarsLoadScanService.findParceListByCarsLoadScanIds(loadScanIds);
//把parcelListEntityList通过orderPackageCode分组
Map<String, List<DistributionParcelListEntity>> parcelListMap = parcelListEntityList.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getOrderPackageCode));
@ -8845,6 +8878,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
// TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId);
List<TrunklineCarsLoadScanVO> trunklineCarsLoadScanVOS = map.get(e);//该签收单对应的包件
trunklineCarsLoadScanVOS.forEach(t -> {
Long loadId = t.getLoadId();
TrunklineCarsLoadScanEntity entity = new TrunklineCarsLoadScanEntity();
BeanUtil.copy(t, entity);
entity.setScanStatus("3");
@ -8858,25 +8892,42 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Integer type = entity.getType();
Long carsLoadScanId = t.getCarsLoadScanId();
if (type.equals(1)) {
List<String> orderPackageCodeList = new ArrayList<>();
String scanCode = entity.getScanCode();
List<DistributionParcelListEntity> parcelList = parcelListMap.get(scanCode);
if (!Objects.isNull(parcelList)) {
parcelList.forEach(p -> {
p.setOrderPackageStatus("70");
updateParcelList.add(p);
orderPackageCodeList.add(p.getOrderPackageCode());
});
}
orderPackageCodes.add(entity.getScanCode());
TrunklineCarsLoadEntity carsLoadEntity = trunklineCarsLoadMap.get(loadId);
//TODO 暂时注释
// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(),AuthUtil.getUserId() , warehouseId, warehouseName, carsLoadEntity, orderPackageCodeList);
}else if(type.equals(2)){
//零担
List<TrunklineScanZeroDetailVO> zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(carsLoadScanId);
List<TrunklineScanZeroDetailEntity> nowList = new ArrayList<>();
zeroDetailVOList.forEach(p -> {
TrunklineScanZeroDetailEntity scanZeroDetailEntity = new TrunklineScanZeroDetailEntity();
scanZeroDetailEntity.setId(p.getId());
scanZeroDetailEntity.setPackageId(p.getPackageId());
scanZeroDetailEntity.setGoodsId(p.getGoodsId());
scanZeroDetailEntity.setGoodsName(p.getGoodsName());
scanZeroDetailEntity.setLoadingNum(p.getLoadingNum());
scanZeroDetailEntity.setUnloadNum(p.getLoadingNum());
updateZerpPackageList.add(scanZeroDetailEntity);
nowList.add(scanZeroDetailEntity);
});
TrunklineCarsLoadEntity carsLoadEntity = trunklineCarsLoadMap.get(loadId);
//TODO 暂时注释
// carsLoadAsyncService.sendReportZeroPackageSignData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, nowList, entity, carsLoadEntity);
}
updateCarsLoadScanList.add(entity);
loadIds.add(entity.getLoadId());
@ -9569,6 +9620,39 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
// 推送签收数据给工厂
sendFactorySignTriparite(warehouseId, orderPackageCodes, warehouseEntity);
List<TrunklineCarsLoadScanEntity> loadScanEntityList = trunklineCarsLoadScanService.findListByIds(loadScanIds);
//把loadScanEntityList中所有元素通过type进行分组
Map<Integer, List<TrunklineCarsLoadScanEntity>> map = loadScanEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadScanEntity::getType));
map.keySet().forEach(type -> {
List<TrunklineCarsLoadScanEntity> trunklineCarsLoadScanEntities = map.get(type);
if(type == 1){
//定制
//把trunklineCarsLoadScanEntities中所有scanCode放入一个List
List<String> scanCodes = trunklineCarsLoadScanEntities.stream().map(TrunklineCarsLoadScanEntity::getScanCode).collect(Collectors.toList());
//TODO 暂时注释
// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,scanCodes);
}else{
trunklineCarsLoadScanEntities.forEach(carsLoadScanEntity -> {
Long scanId = carsLoadScanEntity.getId();
List<TrunklineScanZeroDetailVO> zeroDetailVOList = scanZeroDetailService.findListByCarsLoadScanId(scanId);
List<TrunklineScanZeroDetailEntity> zeroDetailList = new ArrayList<>();
zeroDetailVOList.forEach(zeroDetailVO -> {
TrunklineScanZeroDetailEntity entity = new TrunklineScanZeroDetailEntity();
BeanUtil.copy(zeroDetailVO, entity);
zeroDetailList.add(entity);
});
//TODO 暂时注释
// carsLoadAsyncService.sendReportZeroPackageSignData(AuthUtil.getUserId(), AuthUtil.getNickName(), warehouseId, warehouseName, zeroDetailList, carsLoadScanEntity, carsLoadEntity);
});
}
});
return R.success("签收成功");
}
@ -10946,7 +11030,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId);
carsLoadAsyncService.sendReportRemoveScanData(AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,warehouseName,carsLoadScanEntityList,carsLoadEntity);
//TODO 暂时注释
// carsLoadAsyncService.sendReportRemoveScanData(AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,warehouseName,carsLoadScanEntityList,carsLoadEntity);
// Long loadId = null;
// for (String str : split) {
@ -11299,6 +11384,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
String orderCode = null;
Integer isTransfer = 0;
//查询包件是否签收
DistributionParcelListEntity signDistributionParcelListEntity = distributionParcelListClient.findOrderPackageCodeAndStatus(orderPackageCode,"70");
if (!Objects.isNull(signDistributionParcelListEntity)) {
log.warn("##############unloadPackage: 包件已签收 orderPackageCode={} warehouseId={}", orderPackageCode, warehouseId);
return R.fail(405, "包件已签收");
}
//判断包件是否已入库
DistributionParcelListEntity distributionParcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
if (!Objects.isNull(distributionParcelListEntity)) {
@ -11309,13 +11401,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
}
//查询包件是否签收
DistributionParcelListEntity signDistributionParcelListEntity = distributionParcelListClient.findOrderPackageCodeAndStatus(orderPackageCode,"70");
if (!Objects.isNull(signDistributionParcelListEntity)) {
log.warn("##############unloadPackage: 包件已签收 orderPackageCode={} warehouseId={}", orderPackageCode, warehouseId);
return R.fail(405, "包件已签收");
}
QueryWrapper<TrunklineCarsLoadScanEntity> neloadScanQueryWrapper = new QueryWrapper<>();
neloadScanQueryWrapper.eq("load_id", loadId)
@ -12046,6 +12131,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
packageTrackLogAsyncService.addPackageTrackLog(AuthUtil.getTenantId(), AuthUtil.getUserId(), Func.firstLong(AuthUtil.getDeptId()), AuthUtil.getNickName(), orderPackageCodes, warehouseId, warehouseName, WorkNodeEnums.UNLOAD_INCOMING_WAREHOUSE.getCode(), content);
carsLoadAsyncService.sendFactoryData(orderCode,orderPackageCode,warehouseId,warehouseName);
//TODO 暂时注释
// carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,orderPackageCodes);
} catch (Exception e) {
log.warn("#########卸车存入日志失败");
}
@ -12059,10 +12146,6 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
// audio.append("异常卸车").append(abnormalUnloadNum).append("件");
// }
List<String> orderPackageCodeList = new ArrayList<>();
orderPackageCodeList.add(orderPackageCode);
carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,orderPackageCodeList);
if (isData == 0) {
return Resp.fail(4005,"系统无编码");
}
@ -12809,7 +12892,8 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
List<String> orderPackageCodeList = new ArrayList<>();
orderPackageCodeList.add(orderPackageCode);
carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,orderPackageCodeList);
//TODO 暂时注释
// carsLoadAsyncService.sendReportPackageUnloadData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,orderPackageCodeList);
if (isData == 0) {
return Resp.scanSuccess("卸车成功", "系统无编码");

Loading…
Cancel
Save