|
|
|
@ -38,23 +38,7 @@ import com.logpm.distribution.dto.DistributionReservationPackageDTO;
|
|
|
|
|
import com.logpm.distribution.dto.DistributionStockArticleDTO; |
|
|
|
|
import com.logpm.distribution.dto.DistributionStockListDTO; |
|
|
|
|
import com.logpm.distribution.dto.DistributionStockupDTO; |
|
|
|
|
import com.logpm.distribution.entity.DisStockListDetailEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionDeliveryListEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionDeliverySelfEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionDeliveryTripartiteEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionLoadscanEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionParcelListEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionParcelNumberEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionReservationEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionReservationPackageEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionReservationStockarticleEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionReservationStocklistEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionReservationZeroPackageEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionSignforEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionStockArticleEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionStockListEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionStockupEntity; |
|
|
|
|
import com.logpm.distribution.entity.DistributionStockupInfoEntity; |
|
|
|
|
import com.logpm.distribution.entity.*; |
|
|
|
|
import com.logpm.distribution.excel.DistributionReservationExcel; |
|
|
|
|
import com.logpm.distribution.mapper.DisStockListDetailMapper; |
|
|
|
|
import com.logpm.distribution.mapper.DistributionLoadscanMapper; |
|
|
|
@ -69,24 +53,7 @@ import com.logpm.distribution.mapper.DistributionStockListMapper;
|
|
|
|
|
import com.logpm.distribution.mapper.DistributionStockMapper; |
|
|
|
|
import com.logpm.distribution.mapper.DistributionStockupInfoMapper; |
|
|
|
|
import com.logpm.distribution.mapper.DistributionStockupMapper; |
|
|
|
|
import com.logpm.distribution.service.IDisStockListDetailService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionAsyncService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionDeliveryListService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionDeliverySelfService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionDeliveryTripartiteService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionLoadscaninvnService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionParcelListService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionParcelNumberService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionReservationPackageService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionReservationService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionReservationStockarticleService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionReservationStocklistService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionReservationZeroPackageService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionSignforService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionStockArticleService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionStockListService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionStockupInfoService; |
|
|
|
|
import com.logpm.distribution.service.IDistributionStockupService; |
|
|
|
|
import com.logpm.distribution.service.*; |
|
|
|
|
import com.logpm.distribution.vo.DistributionParcelListVO; |
|
|
|
|
import com.logpm.distribution.vo.DistributionParcelNumberVO; |
|
|
|
|
import com.logpm.distribution.vo.DistributionReservationOrderPackageVO; |
|
|
|
@ -301,6 +268,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseGoodsAllocationClient warehouseGoodsAllocationClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IDistributionPlanLogService distributionPlanLogService; |
|
|
|
|
|
|
|
|
|
// @Autowired
|
|
|
|
|
// private IWarehouseWaybillClient warehouseWaybillClient;
|
|
|
|
|
|
|
|
|
@ -1285,6 +1256,12 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
String collect = reservationEntityList.stream().filter(r -> ReservationStatusConstant.daipeisong.getValue().equals(r.getReservationStatus())).map(DistributionReservationEntity::getReservationCode).collect(Collectors.joining(",")); |
|
|
|
|
return R.fail(collect + "已进行配送 请移除"); |
|
|
|
|
} |
|
|
|
|
//判断是否存在有取消的预约计划
|
|
|
|
|
boolean cancelMatch = reservationEntityList.stream().anyMatch(r -> ReservationStatusConstant.yiquexiao.getValue().equals(r.getReservationStatus())); |
|
|
|
|
if (cancelMatch) { |
|
|
|
|
String collect = reservationEntityList.stream().filter(r -> ReservationStatusConstant.yiquexiao.getValue().equals(r.getReservationStatus())).map(DistributionReservationEntity::getReservationCode).collect(Collectors.joining(",")); |
|
|
|
|
return R.fail(collect + "已进行配送 请移除"); |
|
|
|
|
} |
|
|
|
|
boolean flag = reservationEntityList.stream().anyMatch(s -> s.getStockupStatus().equals(ReservationStockupStatusConstant.weibeihuo.getValue())); |
|
|
|
|
DistributionStockupEntity stockupEntity = null; |
|
|
|
|
if (flag) { |
|
|
|
@ -1479,9 +1456,45 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
distributionAsyncService.recordsReservationDeliveryLog(reservationEntityList, myCurrentWarehouse, user, distributionDeliveryListEntity, WorkNodeEnums.PLAN_DISTRIBUTION.getCode(), content); |
|
|
|
|
//处理广播数据
|
|
|
|
|
handleBroadcast(distributionDeliveryListEntity,AuthUtil.getUser().getNickName(),new Date()); |
|
|
|
|
//日志记录
|
|
|
|
|
handleCreatedDistributionLog(distributionDeliveryListEntity,myCurrentWarehouse,user,reservationEntityList); |
|
|
|
|
return R.status(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void handleCreatedDistributionLog(DistributionDeliveryListEntity distributionDeliveryListEntity, BasicdataWarehouseEntity myCurrentWarehouse, BladeUser user, List<DistributionReservationEntity> reservationEntityList) { |
|
|
|
|
List<DistributionPlanLogEntity> reservationLogList = new ArrayList<>(); |
|
|
|
|
//进行预约计划日志
|
|
|
|
|
for (DistributionReservationEntity reservationEntity : reservationEntityList) { |
|
|
|
|
String reservationContent =user.getNickName()+"在"+myCurrentWarehouse.getName() |
|
|
|
|
+"进行预约计划转配送;预约计划:"+reservationEntity.getReservationCode() |
|
|
|
|
+"车次号:"+distributionDeliveryListEntity.getTrainNumber(); |
|
|
|
|
DistributionPlanLogEntity reservationPlanLogEntity = new DistributionPlanLogEntity(); |
|
|
|
|
reservationPlanLogEntity.setContent(reservationContent); |
|
|
|
|
reservationPlanLogEntity.setRefId(reservationEntity.getId()); |
|
|
|
|
reservationPlanLogEntity.setRefCode(reservationEntity.getReservationCode()); |
|
|
|
|
reservationPlanLogEntity.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
reservationPlanLogEntity.setWarehouseName(myCurrentWarehouse.getName()); |
|
|
|
|
reservationPlanLogEntity.setOperator(user.getNickName()); |
|
|
|
|
reservationPlanLogEntity.setType(1); |
|
|
|
|
reservationLogList.add(reservationPlanLogEntity); |
|
|
|
|
} |
|
|
|
|
if (!reservationLogList.isEmpty()) { |
|
|
|
|
distributionPlanLogService.saveBatch(reservationLogList); |
|
|
|
|
} |
|
|
|
|
String distributionContent =user.getNickName()+"在"+myCurrentWarehouse.getName() |
|
|
|
|
+"创建市配配送计划;车次号:"+distributionDeliveryListEntity.getTrainNumber() |
|
|
|
|
+"预约编号:["+reservationEntityList.stream().map(DistributionReservationEntity::getReservationCode).collect(Collectors.joining(","))+"],总件数:"+distributionDeliveryListEntity.getDeliveryNumber(); |
|
|
|
|
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity(); |
|
|
|
|
distributionPlanLogEntity.setContent(distributionContent); |
|
|
|
|
distributionPlanLogEntity.setRefId(distributionDeliveryListEntity.getId()); |
|
|
|
|
distributionPlanLogEntity.setRefCode(distributionDeliveryListEntity.getTrainNumber()); |
|
|
|
|
distributionPlanLogEntity.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
distributionPlanLogEntity.setWarehouseName(myCurrentWarehouse.getName()); |
|
|
|
|
distributionPlanLogEntity.setOperator(user.getNickName()); |
|
|
|
|
distributionPlanLogEntity.setType(3); |
|
|
|
|
distributionPlanLogService.save(distributionPlanLogEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 处理广播数据 |
|
|
|
|
* @param distributionDeliveryListEntity |
|
|
|
@ -1579,6 +1592,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
//推翻原有的
|
|
|
|
|
Long id = distributionReservationDTO.getId(); |
|
|
|
|
DistributionReservationEntity reservationEntity = this.getById(id); |
|
|
|
|
DistributionReservationEntity oldReservation = BeanUtil.copy(reservationEntity, DistributionReservationEntity.class); |
|
|
|
|
//这里需要查询出这个预约原来的订单、包件信息
|
|
|
|
|
List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationStockarticleService.getBaseMapper().selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, id).ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue())); |
|
|
|
|
Map<Long, List<DistributionReservationStockarticleEntity>> oldStockArticle = distributionReservationStockarticleEntities.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId)); |
|
|
|
@ -2129,9 +2143,41 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
reservationEntity.setIsUrgent(distributionReservationDTO.getIsUrgent()); |
|
|
|
|
reservationEntity.setIsInstall(distributionReservationDTO.getIsInstall()); |
|
|
|
|
this.updateById(reservationEntity); |
|
|
|
|
compareReservation(reservationEntity,oldReservation,AuthUtil.getUser(),myCurrentWarehouse); |
|
|
|
|
|
|
|
|
|
return R.status(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 比对预约计划 |
|
|
|
|
* @param reservationEntity |
|
|
|
|
* @param oldReservation |
|
|
|
|
* @param user |
|
|
|
|
* @param myCurrentWarehouse |
|
|
|
|
*/ |
|
|
|
|
private void compareReservation(DistributionReservationEntity reservationEntity, DistributionReservationEntity oldReservation, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse) { |
|
|
|
|
Integer newPlanNum = reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum(); |
|
|
|
|
Integer oldPlanNum = oldReservation.getReservationNum() + oldReservation.getReservationStockListNum(); |
|
|
|
|
String planContent = user.getNickName()+"在"+myCurrentWarehouse.getName() |
|
|
|
|
+"修改预约计划;预约计划编号:"+reservationEntity.getReservationCode() |
|
|
|
|
+";收货单位:"+(reservationEntity.getReceivingUnit().equals(oldReservation.getReceivingUnit())?reservationEntity.getReceivingUnit():"由"+oldReservation.getReceivingUnit()+"变更为-->"+reservationEntity.getReceivingUnit()) |
|
|
|
|
+",收货人:"+(reservationEntity.getConsignee().equals(oldReservation.getConsignee())?reservationEntity.getConsignee():"由"+oldReservation.getConsignee()+"变更为-->"+reservationEntity.getConsignee()) |
|
|
|
|
+",联系电话:"+(reservationEntity.getDeliveryPhone().equals(oldReservation.getDeliveryPhone())?reservationEntity.getDeliveryPhone():"由"+oldReservation.getDeliveryPhone()+"变更为-->"+reservationEntity.getDeliveryPhone()) |
|
|
|
|
+",收货地址:"+(reservationEntity.getDeliveryAddress().equals(oldReservation.getDeliveryAddress())?reservationEntity.getDeliveryAddress():"由"+oldReservation.getDeliveryAddress()+"变更为-->"+reservationEntity.getDeliveryAddress()) |
|
|
|
|
+",计划件数:"+(newPlanNum.equals(oldPlanNum)?newPlanNum:"由"+oldPlanNum+"变更为-->"+newPlanNum); |
|
|
|
|
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity(); |
|
|
|
|
distributionPlanLogEntity.setContent(planContent); |
|
|
|
|
distributionPlanLogEntity.setRefId(reservationEntity.getId()); |
|
|
|
|
distributionPlanLogEntity.setRefCode(reservationEntity.getReservationCode()); |
|
|
|
|
distributionPlanLogEntity.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
distributionPlanLogEntity.setWarehouseName(myCurrentWarehouse.getName()); |
|
|
|
|
distributionPlanLogEntity.setOperator(user.getNickName()); |
|
|
|
|
distributionPlanLogEntity.setType(1); |
|
|
|
|
distributionPlanLogService.save(distributionPlanLogEntity); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional |
|
|
|
|
public R deliveryBusinessTask(DistributionDeliveryAllocationDTO allocationDTO) { |
|
|
|
@ -3390,9 +3436,32 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
reservationEntity.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue()); |
|
|
|
|
reservationEntity.setWarehouseId(myCurrentWarehouse.getId()); |
|
|
|
|
distributionReservationMapper.updateById(reservationEntity); |
|
|
|
|
//进行日志的添加
|
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
handleCreatedReservationPlanLog(reservationEntity,user,myCurrentWarehouse); |
|
|
|
|
return R.status(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void handleCreatedReservationPlanLog(DistributionReservationEntity reservationEntity, BladeUser user,BasicdataWarehouseEntity warehouse) { |
|
|
|
|
String planContent = user.getNickName()+"在"+warehouse.getName() |
|
|
|
|
+"创建预约计划;预约计划编号:"+reservationEntity.getReservationCode() |
|
|
|
|
+";收货单位:"+reservationEntity.getReceivingUnit() |
|
|
|
|
+",收货人:"+reservationEntity.getConsignee() |
|
|
|
|
+",联系电话:"+reservationEntity.getDeliveryPhone() |
|
|
|
|
+",收货地址:"+reservationEntity.getDeliveryAddress() |
|
|
|
|
+",计划件数:"+(reservationEntity.getReservationNum()+reservationEntity.getReservationStockListNum()) |
|
|
|
|
+",配送类型:"+(reservationEntity.getDeliveryWay().equals(DistributionTypeConstant.shangpei.getValue())?"商配":"市配"); |
|
|
|
|
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity(); |
|
|
|
|
distributionPlanLogEntity.setContent(planContent); |
|
|
|
|
distributionPlanLogEntity.setRefId(reservationEntity.getId()); |
|
|
|
|
distributionPlanLogEntity.setRefCode(reservationEntity.getReservationCode()); |
|
|
|
|
distributionPlanLogEntity.setWarehouseId(warehouse.getId()); |
|
|
|
|
distributionPlanLogEntity.setWarehouseName(warehouse.getName()); |
|
|
|
|
distributionPlanLogEntity.setOperator(user.getNickName()); |
|
|
|
|
distributionPlanLogEntity.setType(1); |
|
|
|
|
distributionPlanLogService.save(distributionPlanLogEntity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 自提查询库存数量 |
|
|
|
|
* |
|
|
|
|