Browse Source

1.成本分摊广播发送

fix-sign
zhenghaoyu 4 months ago
parent
commit
e4c1e7acaa
  1. 1
      blade-biz-common/src/main/java/org/springblade/common/constant/WorkNodeEnums.java
  2. 12
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  3. 3
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java
  4. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ICarsLoadAsyncService.java
  5. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java
  6. 48
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/CarsLoadAsyncServiceImpl.java
  7. 29
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

1
blade-biz-common/src/main/java/org/springblade/common/constant/WorkNodeEnums.java

@ -45,6 +45,7 @@ public enum WorkNodeEnums implements Serializable {
SIGN_DIRECT_SHIPPER(105030,"直发商家签收"),
END_WAREHOUSE_UNLOADING(105040, "末端仓卸车确认"),
NO_STOCK_CAR(105050, "本车次少货"),
COST_SHARE(105060, "车次成本分摊"),
SORTING_TRAYS(201010, "分拣打托"),
UN_SORTING_TRAYS(201020, "包件解托"),

12
blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java

@ -39,6 +39,18 @@ public abstract class FanoutConstants {
}
}
interface COSTSHARE {
// 交换机
String EXCHANGE = "fanout.trunkline.costshare" + ModuleNameConstant.DEVAUTH;
interface QUEUE {
// 保存基础数据
String REPORT_COSTSHARE = "fanout.trunkline.reportdata.report.costshare" + ModuleNameConstant.DEVAUTH;
}
}

3
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/CarsLoadController.java

@ -2446,12 +2446,13 @@ public class CarsLoadController {
return R.fail(405,"多仓权限无法操作,请选择仓库");
}
loadCarsDTO.setWarehouseId(myCurrentWarehouse.getId());
loadCarsDTO.setWarehouseName(myCurrentWarehouse.getName());
if(Objects.isNull(loadId)){
log.warn(method+"配载id为空 loadId={}",loadId);
return R.fail(405,"配载id为空");
}
return carsLoadService.costShareByLoadId(loadId);
return carsLoadService.costShareByLoadId(loadId,loadCarsDTO);
}catch (CustomerException e){
log.error(e.message,e);
return R.fail(e.code,e.message);

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

@ -11,7 +11,7 @@ public interface ICarsLoadAsyncService {
void saveCostShareRecord(Long loadId, TrunklineCarsLoadEntity carsLoadEntity, Long userId, String tenantId, String deptId);
void costShareByLoadId(Long loadId,TrunklineCarsLoadEntity carsLoadEntity);
void costShareByLoadId(Long loadId,TrunklineCarsLoadEntity carsLoadEntity,Long warehouseId,String warehouseName);
void abnormalListStartCarByLoadIdAndWarehouseId(Long loadId, Long warehouseId,Long userId,Long deptId,String nickName,String tenantId,String warehouseName);

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineCarsLoadService.java

@ -188,7 +188,7 @@ public interface ITrunklineCarsLoadService extends BaseService<TrunklineCarsLoad
R findCostShareBefore(Long loadId);
R costShareByLoadId(Long loadId);
R costShareByLoadId(Long loadId,LoadCarsDTO loadCarsDTO);
R abnormalList(LoadCarsDTO loadCarsDTO);

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

@ -303,7 +303,7 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
@LogpmAsync("asyncExecutor")
@Override
public void costShareByLoadId(Long loadId, TrunklineCarsLoadEntity carsLoadEntity) {
public void costShareByLoadId(Long loadId, TrunklineCarsLoadEntity carsLoadEntity,Long warehouseId,String warehouseName) {
String proportion1 = DictBizCache.getValue(DictBizConstant.TRUNKLINE_COST_PROPORTION, "1");
String proportion2 = DictBizCache.getValue(DictBizConstant.TRUNKLINE_COST_PROPORTION, "2");
@ -385,6 +385,52 @@ public class CarsLoadAsyncServiceImpl implements ICarsLoadAsyncService {
warehouseWaybillClient.updateEntity(warehouseWaybillEntity);
}
sendReportCostShareData(list,AuthUtil.getUserId(),AuthUtil.getNickName(),warehouseId,warehouseName,carsLoadEntity);
}
private void sendReportCostShareData(List<TrunklineCostShareRecordEntity> list, Long userId, String nickName, Long warehouseId, String warehouseName, TrunklineCarsLoadEntity carsLoadEntity) {
NodeFanoutMsg nodeFanoutMsg = new NodeFanoutMsg();
nodeFanoutMsg.setNode(WorkNodeEnums.COST_SHARE);
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<>();
// list.forEach(costShareRecordEntity -> {
// PackageData packageData = new PackageData();
// Integer productType = costShareRecordEntity.getProductType();
// if(productType == 1){
//
// }else if(productType == 2){
//
// }
//
//
// packageData.setPackageCode(packageCode);
// packageData.setNumber(1);
// packageData.setPackageType(PackageTypeEnums.CMP);
// packageDataList.add(packageData);
// });
json.put("details", list);
nodeFanoutMsg.setMain(json);
FanoutMsg fanoutMsg = FanoutMsg.builder().exchange(FanoutConstants.trunkline.COSTSHARE.EXCHANGE).msg(JSONObject.toJSONString(nodeFanoutMsg)).build();
sendFanoutService.sendFanoutMsg(fanoutMsg);
}
@LogpmAsync("asyncExecutor")

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

@ -2316,6 +2316,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
public R findLinePhoto(LoadCarsDTO loadCarsDTO) {
Long loadId = loadCarsDTO.getLoadId();
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId);
if(Objects.isNull(carsLoadEntity)){
log.warn("#############findLinePhoto: 配载信息不存在 loadId={}",loadId);
return R.fail(405,"配载信息不存在");
}
List<TrunklineCarsLoadLinePhotoEntity> linePhotoEntityList = carsLoadLinePhotoService.findListByLoadIdAndWarehouseId(loadId, null, null, null);
Map<Long, List<TrunklineCarsLoadLinePhotoEntity>> linePhotoMap = linePhotoEntityList.stream().collect(Collectors.groupingBy(TrunklineCarsLoadLinePhotoEntity::getLoadLineId));
@ -2333,6 +2339,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Map<String,Object> map = new HashMap<>();
map.put("carsLoadLineEntity",loadLineEntity);
map.put("nowWarehouseId",carsLoadEntity.getNowWarehouseId());
List<TrunklineCarsLoadLinePhotoEntity> trunklineCarsLoadLinePhotoEntities = linePhotoMap.get(loadLineId);
@ -9208,11 +9215,12 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
Integer i = loadingZeroFlag.get();
if(i == 1){
return R.data(ls,"装车完成,但存在零担未装车,请去确认装车数量");
}else{
return R.data(ls,"装车完成");
}
// if(i == 1){
// return R.data(ls,"装车完成,但存在零担未装车,请去确认装车数量");
// }else{
// return R.data(ls,"装车完成");
// }
return R.data(ls,"装车完成");
}
@Override
@ -9707,7 +9715,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
@Override
public R costShareByLoadId(Long loadId) {
public R costShareByLoadId(Long loadId,LoadCarsDTO loadCarsDTO) {
TrunklineCarsLoadEntity carsLoadEntity = baseMapper.selectById(loadId);
if (Objects.isNull(carsLoadEntity)) {
@ -9720,6 +9728,13 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R.fail(405, "配载计划已做过成本分摊");
}
String carsNo = carsLoadEntity.getCarsNo();
List<AftersalesAbnormalRecordEntity> abnormalList = abnormalRecordClient.findAbnormalList(carsNo);
if(CollUtil.isNotEmpty(abnormalList)){
log.warn("#################costShareByLoadId: 该车次还有异常列表未处理 loadId={}", loadId);
return R.fail(405, "该车次还有异常列表未处理");
}
List<TrunklineCarsLoadScanEntity> noDataList = trunklineCarsLoadScanService.findListNoDataByLoadId(loadId);
int size = noDataList.size();
if (size != 0) {
@ -9738,7 +9753,7 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
return R.fail(405, "配载计划最终节点还未卸车确认");
}
carsLoadAsyncService.costShareByLoadId(loadId, carsLoadEntity);
carsLoadAsyncService.costShareByLoadId(loadId, carsLoadEntity,loadCarsDTO.getWarehouseId(),loadCarsDTO.getWarehouseName());
carsLoadEntity.setCostAllocationType("1");
carsLoadEntity.setCostAllocationAdminId(AuthUtil.getUserId());

Loading…
Cancel
Save