|
|
@@ -83,9 +83,15 @@ public class KwtWaybillOrderService {
|
|
|
List<SckwWaybillOrder> sckwWaybillOrders = (List<SckwWaybillOrder>) result.getData();
|
|
|
|
|
|
/**变更承运单状态(累计派车量等于剩余可运量)/已委托量entrust_amount**/
|
|
|
- setLogisticsBySendCar(logisticsOrder.getId(), ranksAmount);
|
|
|
+ //更新当前承运订单委派量entrustAmount
|
|
|
+ BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getEntrustAmount();
|
|
|
+ logisticsOrder.setEntrustAmount(entrustAmount.add(ranksAmount));
|
|
|
+ logisticsOrderDao.updateById(logisticsOrder);
|
|
|
+ //派车更新承运订单信息
|
|
|
+ setLogisticsBySendCar(logisticsOrder.getId());
|
|
|
|
|
|
/**Mongodb数据存储**/
|
|
|
+ //1车辆订单
|
|
|
for (SckwWaybillOrder waybillOrder:sckwWaybillOrders) {
|
|
|
//rabbitMq业务汇总数据发送/消费对象
|
|
|
SckwBusSum busSum = new SckwBusSum();
|
|
|
@@ -98,6 +104,10 @@ public class KwtWaybillOrderService {
|
|
|
streamBridge.send("sckw-busSum", busSum);
|
|
|
}
|
|
|
|
|
|
+ //2承运订单
|
|
|
+ SckwLogisticsOrder lOrder = new SckwLogisticsOrder();
|
|
|
+ editSckwLogisticsOrder(lOrder, logisticsOrder);
|
|
|
+
|
|
|
/**发送消息**/
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
@@ -421,6 +431,7 @@ public class KwtWaybillOrderService {
|
|
|
order.setCarrierPhone(carrierEnt.getPhone());
|
|
|
|
|
|
//装卸货地址相关信息
|
|
|
+ order.setLoadName(loadAddress.getName());
|
|
|
order.setLoadType(loadAddress.getType());
|
|
|
order.setLoadContacts(loadAddress.getContacts());
|
|
|
order.setLoadPhone(loadAddress.getPhone());
|
|
|
@@ -429,6 +440,7 @@ public class KwtWaybillOrderService {
|
|
|
order.setLoadDetailAddress(loadAddress.getDetailAddress());
|
|
|
order.setLoadLat(loadAddress.getLat());
|
|
|
order.setLoadLng(loadAddress.getLng());
|
|
|
+ order.setUnloadName(unloadAddress.getName());
|
|
|
order.setUnloadType(unloadAddress.getType());
|
|
|
order.setUnloadContacts(unloadAddress.getContacts());
|
|
|
order.setUnloadPhone(unloadAddress.getPhone());
|
|
|
@@ -452,12 +464,11 @@ public class KwtWaybillOrderService {
|
|
|
|
|
|
/**
|
|
|
* @param lOrderId 承运订单ID
|
|
|
- * @param ranksAmount 当前派车总量
|
|
|
* @description 派车更新承运订单信息
|
|
|
* @author zk
|
|
|
* @date 2023/7/24
|
|
|
**/
|
|
|
- public void setLogisticsBySendCar(Long lOrderId, BigDecimal ranksAmount) {
|
|
|
+ public void setLogisticsBySendCar(Long lOrderId) {
|
|
|
/**
|
|
|
状态判断是否是分包承运单(不考虑该承运单下级分包)
|
|
|
存在:更新当前承运订单状态及委派量entrustAmount,并且校验承运订单所有父级状态是否需要修改(是修改状态,否则不修改)
|
|
|
@@ -474,28 +485,23 @@ public class KwtWaybillOrderService {
|
|
|
for (String id : idArray) {
|
|
|
KwtLogisticsOrder order = logisticsOrderDao.selectById(id);
|
|
|
//承运订单-待派车
|
|
|
- if (logisticsOrder.getStatus() == LogisticsOrderEnum.WAIT_DELIVERY.getCode()) {
|
|
|
- //承运订单不存在分包:更新当前承运订单状态及委派量entrustAmount
|
|
|
- //if (order.getId() == logisticsOrder.getId()) {
|
|
|
- //承运订单已委派量
|
|
|
- BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getEntrustAmount();
|
|
|
- logisticsOrder.setEntrustAmount(entrustAmount.add(ranksAmount));
|
|
|
- //}
|
|
|
+ if (order.getStatus() == LogisticsOrderEnum.WAIT_DELIVERY.getCode()) {
|
|
|
+ //更新当前承运订单状态
|
|
|
/**承运订单:待派车->运输中**/
|
|
|
- logisticsOrder.setStatus(LogisticsOrderEnum.IN_TRANSIT.getCode());
|
|
|
- logisticsOrderDao.updateById(logisticsOrder);
|
|
|
+ order.setStatus(LogisticsOrderEnum.IN_TRANSIT.getCode());
|
|
|
+ logisticsOrderDao.updateById(order);
|
|
|
|
|
|
/**承运订单状态记录**/
|
|
|
KwtLogisticsOrderTrack orderTrack = new KwtLogisticsOrderTrack();
|
|
|
- orderTrack.setLOrderId(logisticsOrder.getId());
|
|
|
- orderTrack.setStatus(logisticsOrder.getStatus());
|
|
|
- orderTrack.setRemark(LogisticsOrderEnum.getName(logisticsOrder.getStatus()));
|
|
|
+ orderTrack.setLOrderId(order.getId());
|
|
|
+ orderTrack.setStatus(order.getStatus());
|
|
|
+ orderTrack.setRemark(LogisticsOrderEnum.getName(order.getStatus()));
|
|
|
logisticsOrderTrackDao.insert(orderTrack);
|
|
|
|
|
|
/**Mongodb数据更新**/
|
|
|
//2承运订单
|
|
|
SckwLogisticsOrder lOrder = new SckwLogisticsOrder();
|
|
|
- editSckwLogisticsOrder(lOrder, logisticsOrder);
|
|
|
+ editSckwLogisticsOrder(lOrder, order);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -681,6 +687,9 @@ public class KwtWaybillOrderService {
|
|
|
if (circulate == null) {
|
|
|
return HttpResult.error("车辆循环运单不存在!");
|
|
|
}
|
|
|
+ if (circulate.getWOrderId() != null) {
|
|
|
+ return HttpResult.error("车辆循环运单不能接单!");
|
|
|
+ }
|
|
|
|
|
|
/**获取基础信息**/
|
|
|
//装货地址
|
|
|
@@ -897,14 +906,23 @@ public class KwtWaybillOrderService {
|
|
|
/**2新增运单状态记录**/
|
|
|
setWaybillOrderTrack(waybillOrder.getId(), waybillOrder.getStatus(), params.getRemark());
|
|
|
|
|
|
- /**3回退承运订单entrustAmount**/
|
|
|
+ /**3循环派车重置派车信息kwt_logistics_order_circulate**/
|
|
|
+ if (waybillOrder.getType() == Global.NUMERICAL_TWO) {
|
|
|
+ //循环派车信息
|
|
|
+ KwtLogisticsOrderCirculate circulate = logisticsOrderCirculateDao.findCirculate(waybillOrder.getLOrderId(),
|
|
|
+ waybillOrder.getTruckId(), waybillOrder.getDriverId(), 0);
|
|
|
+ circulate.setStatus(Global.NUMERICAL_ONE);
|
|
|
+ logisticsOrderCirculateDao.updateById(circulate);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**4回退承运订单entrustAmount**/
|
|
|
KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
|
|
|
//承运订单已委派量=承运订单原委派量+当前车辆运单委派量
|
|
|
BigDecimal entrustAmount = logisticsOrder.getEntrustAmount() == null ? new BigDecimal(Global.AMOUNT) : logisticsOrder.getEntrustAmount();
|
|
|
logisticsOrder.setEntrustAmount(entrustAmount.subtract(waybillOrder.getEntrustAmount()));
|
|
|
logisticsOrderDao.updateById(logisticsOrder);
|
|
|
|
|
|
- /**4Mongodb数据更新**/
|
|
|
+ /**5Mongodb数据更新**/
|
|
|
//1车辆运单
|
|
|
SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
wOrder.set_id(waybillOrder.getId());
|
|
|
@@ -914,7 +932,7 @@ public class KwtWaybillOrderService {
|
|
|
SckwLogisticsOrder lOrder = new SckwLogisticsOrder();
|
|
|
editSckwLogisticsOrder(lOrder, logisticsOrder);
|
|
|
|
|
|
- /**5发送消息**/
|
|
|
+ /**6发送消息**/
|
|
|
|
|
|
return HttpResult.ok("拒绝出车成功!");
|
|
|
}
|
|
|
@@ -1097,7 +1115,16 @@ public class KwtWaybillOrderService {
|
|
|
ticket.setTime(params.getTime());
|
|
|
waybillOrderTicketDao.insert(ticket);
|
|
|
|
|
|
- /**4更新承运订单entrustAmount**/
|
|
|
+ /**4循环派车重置派车信息kwt_logistics_order_circulate**/
|
|
|
+ if (waybillOrder.getType() == Global.NUMERICAL_TWO) {
|
|
|
+ //循环派车信息
|
|
|
+ KwtLogisticsOrderCirculate circulate = logisticsOrderCirculateDao.findCirculate(waybillOrder.getLOrderId(),
|
|
|
+ waybillOrder.getTruckId(), waybillOrder.getDriverId(), 0);
|
|
|
+ circulate.setWOrderId(null);
|
|
|
+ logisticsOrderCirculateDao.updateByPrimaryKey(circulate);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**5更新承运订单entrustAmount**/
|
|
|
//更新卸货量/卸货时间/亏吨/亏吨扣款
|
|
|
KwtLogisticsOrder logisticsOrder = logisticsOrderDao.selectById(waybillOrder.getLOrderId());
|
|
|
//承运订单卸货量=承运订单原卸货量+当前车辆运单卸货量
|
|
|
@@ -1114,7 +1141,7 @@ public class KwtWaybillOrderService {
|
|
|
//校验当前承运订单是否运输完成(修改状态+统计量)
|
|
|
checkLogisticsByStatusV1(waybillOrder.getLOrderId());
|
|
|
|
|
|
- /**5Mongodb数据更新**/
|
|
|
+ /**6Mongodb数据更新**/
|
|
|
//1车辆运单
|
|
|
SckwWaybillOrder wOrder = new SckwWaybillOrder();
|
|
|
wOrder.set_id(waybillOrder.getId());
|
|
|
@@ -1131,7 +1158,7 @@ public class KwtWaybillOrderService {
|
|
|
lOrder.setDeficitPrice(logisticsOrder.getDeficitPrice());
|
|
|
editSckwLogisticsOrder(lOrder, logisticsOrder);
|
|
|
|
|
|
- /**6发送消息**/
|
|
|
+ /**7发送消息**/
|
|
|
|
|
|
return HttpResult.ok("卸货成功!");
|
|
|
}
|
|
|
@@ -1267,6 +1294,14 @@ public class KwtWaybillOrderService {
|
|
|
orderTrack.setStatus(logisticsOrder.getStatus());
|
|
|
orderTrack.setRemark(LogisticsOrderEnum.getName(logisticsOrder.getStatus()));
|
|
|
logisticsOrderTrackDao.insert(orderTrack);
|
|
|
+
|
|
|
+ /**1-4循环派车失效kwt_logistics_order_circulate**/
|
|
|
+ //循环派车信息
|
|
|
+ List<KwtLogisticsOrderCirculate> circulates = logisticsOrderCirculateDao.findCirculateList(logisticsOrder.getId(), null, null, 0);
|
|
|
+ for (KwtLogisticsOrderCirculate circulate:circulates) {
|
|
|
+ circulate.setStatus(Global.NUMERICAL_ONE);
|
|
|
+ logisticsOrderCirculateDao.updateById(circulate);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//车辆运单统计
|