|
|
@@ -6,6 +6,7 @@ import com.sckw.core.exception.BusinessPlatfromException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.AddressTypeEnum;
|
|
|
import com.sckw.core.model.enums.CarWaybillV1Enum;
|
|
|
+import com.sckw.core.model.enums.LogisticsOrderV1Enum;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.DateUtils;
|
|
|
import com.sckw.core.utils.DistanceUtils;
|
|
|
@@ -40,10 +41,20 @@ public class UnloadingHandler extends AbstractWaybillOrderHandler<WaybillOrderUn
|
|
|
@Autowired
|
|
|
private KwtWaybillOrderSubtaskRepository waybillOrderSubtaskRepository;
|
|
|
|
|
|
-
|
|
|
//用于存储动态状态
|
|
|
private Integer targetStatus;
|
|
|
|
|
|
+ // 定义运单未完结的状态集合
|
|
|
+ private static final List<Integer> UNFINISHED_STATUSES = Arrays.asList(
|
|
|
+ CarWaybillV1Enum.PENDING_VEHICLE.getCode(),
|
|
|
+ CarWaybillV1Enum.REFUSE_TRAFFIC.getCode(),
|
|
|
+ CarWaybillV1Enum.EXIT_COMPLETED.getCode(),
|
|
|
+ CarWaybillV1Enum.WEIGHT_TRAFFIC.getCode(),
|
|
|
+ CarWaybillV1Enum.WAIT_LOADING.getCode(),
|
|
|
+ CarWaybillV1Enum.COMPLETION_LOADING.getCode(),
|
|
|
+ CarWaybillV1Enum.REVIEW_REJECTION.getCode()
|
|
|
+ );
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
protected KwtWaybillOrder getWaybillOrder(WaybillOrderUnloadParam param) {
|
|
|
@@ -160,6 +171,14 @@ public class UnloadingHandler extends AbstractWaybillOrderHandler<WaybillOrderUn
|
|
|
BigDecimal totalEntrustAmount = currentEntrust.subtract(subtractAmount);
|
|
|
// 确保已委托量不为负数
|
|
|
logisticsOrder.setEntrustAmount(totalEntrustAmount.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : totalEntrustAmount);
|
|
|
+ //如果当前运单的物流订单下没有其它进行中的运单,则修改运单状态已完成
|
|
|
+ if (Objects.equals(LogisticsOrderV1Enum.NEARING_COMPLETION.getCode(), logisticsOrder.getStatus())) {
|
|
|
+ List<KwtWaybillOrder> waybillOrderList = waybillOrderRepository
|
|
|
+ .findOneByLogOrderIdAndStatus(logisticsOrder.getId(), UNFINISHED_STATUSES, subtask.getWOrderId());
|
|
|
+ if (CollectionUtils.isEmpty(waybillOrderList)) {
|
|
|
+ logisticsOrder.setStatus(LogisticsOrderV1Enum.COMPLETED.getCode());
|
|
|
+ }
|
|
|
+ }
|
|
|
logisticsOrderRepository.updateById(logisticsOrder);
|
|
|
}
|
|
|
|