|
@@ -6,16 +6,16 @@ import com.sckw.core.common.enums.enums.ErrorCodeEnum;
|
|
|
import com.sckw.core.exception.BusinessPlatfromException;
|
|
import com.sckw.core.exception.BusinessPlatfromException;
|
|
|
import com.sckw.core.model.enums.CarWaybillV1Enum;
|
|
import com.sckw.core.model.enums.CarWaybillV1Enum;
|
|
|
import com.sckw.core.model.enums.GatekeeperStatusEnum;
|
|
import com.sckw.core.model.enums.GatekeeperStatusEnum;
|
|
|
-import com.sckw.transport.model.KwtGatekeeperWaybillOrder;
|
|
|
|
|
-import com.sckw.transport.model.KwtWaybillOrder;
|
|
|
|
|
-import com.sckw.transport.model.KwtWaybillOrderSubtask;
|
|
|
|
|
-import com.sckw.transport.model.KwtWaybillOrderTicket;
|
|
|
|
|
|
|
+import com.sckw.fleet.api.model.vo.RTruckVo;
|
|
|
|
|
+import com.sckw.transport.model.*;
|
|
|
import com.sckw.transport.model.param.WaybillOrderLiftRodReleaseParam;
|
|
import com.sckw.transport.model.param.WaybillOrderLiftRodReleaseParam;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Author: donglang
|
|
* Author: donglang
|
|
@@ -49,6 +49,9 @@ public class LiftRodReleaseHandler extends AbstractWaybillOrderHandler<WaybillOr
|
|
|
|
|
|
|
|
//2. 修改门卫订单状态为:空载离场/离场
|
|
//2. 修改门卫订单状态为:空载离场/离场
|
|
|
updateGatekeeperOrderStatus(waybillOrder, isEmptyLoadLeave);
|
|
updateGatekeeperOrderStatus(waybillOrder, isEmptyLoadLeave);
|
|
|
|
|
+
|
|
|
|
|
+ //3. 创建门卫卸货订单
|
|
|
|
|
+ creatGatekeeperUnLoadingOrder(waybillOrder);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -90,6 +93,52 @@ public class LiftRodReleaseHandler extends AbstractWaybillOrderHandler<WaybillOr
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 创建卸货门卫订单
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param waybillOrder
|
|
|
|
|
+ */
|
|
|
|
|
+ private void creatGatekeeperUnLoadingOrder(KwtWaybillOrder waybillOrder) {
|
|
|
|
|
+ RTruckVo truck = remoteFleetService.findTruckByTruckNo(waybillOrder.getTruckNo());
|
|
|
|
|
+ if (truck == null || !Objects.equals(truck.getStatus(), 0)) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.TRUCK_STATUS_ERROR, "当前车辆非正常状态,不能接单!");
|
|
|
|
|
+ }
|
|
|
|
|
+ //查询子运单
|
|
|
|
|
+ KwtWaybillOrderSubtask waybillSubtask = getWaybillSubtask(waybillOrder.getId());
|
|
|
|
|
+
|
|
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
|
|
+ try {
|
|
|
|
|
+ KwtGatekeeperWaybillOrder gatekeeper = new KwtGatekeeperWaybillOrder();
|
|
|
|
|
+ gatekeeper.setEntId(waybillOrder.getEntId());
|
|
|
|
|
+ gatekeeper.setWOrderId(waybillOrder.getId());
|
|
|
|
|
+ gatekeeper.setWOrderNo(waybillOrder.getWOrderNo());
|
|
|
|
|
+ gatekeeper.setLOrderId(waybillOrder.getLOrderId());
|
|
|
|
|
+ // 查询商品信息
|
|
|
|
|
+ KwtLogisticsOrderGoods orderGoods = logisticsOrderGoodsRepository.queryByLogOrderId(waybillOrder.getLOrderId());
|
|
|
|
|
+ if (orderGoods != null) {
|
|
|
|
|
+ gatekeeper.setGoodsId(orderGoods.getGoodsId());
|
|
|
|
|
+ gatekeeper.setGoodsName(orderGoods.getGoodsName());
|
|
|
|
|
+ }
|
|
|
|
|
+ gatekeeper.setWaybillAcceptTime(waybillOrder.getCreateTime());
|
|
|
|
|
+ gatekeeper.setStatus(GatekeeperStatusEnum.UNLOADING_PENDING_ENTRY.getCode());
|
|
|
|
|
+ gatekeeper.setWaybillAcceptTime(waybillOrder.getCreateTime());
|
|
|
|
|
+ gatekeeper.setTruckType(truck.getTruckType());
|
|
|
|
|
+ gatekeeper.setEntrustAmount(waybillSubtask.getEntrustAmount());
|
|
|
|
|
+ gatekeeper.setCarAxis(truck.getCarAxis());
|
|
|
|
|
+ gatekeeper.setLegalLoad(truck.getLegalLoad());
|
|
|
|
|
+ gatekeeper.setCreateTime(new Date());
|
|
|
|
|
+ gatekeeper.setCreateUser(waybillOrder.getDriverId());
|
|
|
|
|
+ gatekeeper.setUpdateUser(waybillOrder.getDriverId());
|
|
|
|
|
+
|
|
|
|
|
+ log.debug("开始异步保存卸货门卫订单数据,运单ID:{}", waybillOrder.getId());
|
|
|
|
|
+ gatekeeperWaybillOrderRepository.save(gatekeeper);
|
|
|
|
|
+ log.debug("卸货门卫订单数据保存成功");
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("异步保存卸货门卫订单数据失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void calculateAutoDispatchScore(WaybillOrderLiftRodReleaseParam param, KwtWaybillOrder waybillOrder) {
|
|
protected void calculateAutoDispatchScore(WaybillOrderLiftRodReleaseParam param, KwtWaybillOrder waybillOrder) {
|