|
|
|
@ -2,21 +2,36 @@ package com.logpm.trunkline.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.logpm.trunkline.dto.OpenOrderDTO; |
|
|
|
|
import com.logpm.trunkline.dto.WaybillLogDTO; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity; |
|
|
|
|
import com.logpm.trunkline.mapper.TrunklineWaybillTrackMapper; |
|
|
|
|
import com.logpm.trunkline.service.IOpenOrderAsyncService; |
|
|
|
|
import com.logpm.trunkline.service.ITrunklineWaybillOrderService; |
|
|
|
|
import com.logpm.trunkline.service.ITrunklineWaybillTrackService; |
|
|
|
|
import com.logpm.trunkline.vo.TrunklineWaybillTrackVO; |
|
|
|
|
import com.logpm.warehouse.entity.WarehouseWaybillEntity; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseWaybillClient; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.common.utils.CommonUtil; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
@Slf4j |
|
|
|
|
@Service |
|
|
|
|
@AllArgsConstructor |
|
|
|
|
public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineWaybillTrackMapper, TrunklineWaybillTrackEntity> implements ITrunklineWaybillTrackService { |
|
|
|
|
|
|
|
|
|
private final IWarehouseWaybillClient warehouseWaybillClient; |
|
|
|
|
private final IOpenOrderAsyncService openOrderAsyncService; |
|
|
|
|
private final ITrunklineWaybillOrderService waybillOrderService; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<TrunklineWaybillTrackEntity> findWaybillLog(Long waybillId, String trackType) { |
|
|
|
|
return baseMapper.findWaybillLog(waybillId,trackType); |
|
|
|
@ -31,4 +46,137 @@ public class TrunklineWaybillTrackServiceImpl extends BaseServiceImpl<TrunklineW
|
|
|
|
|
public void deleteByWaybillNo(String waybillNo) { |
|
|
|
|
baseMapper.deleteByWaybillNo(waybillNo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void addSignWaybillLog(WaybillLogDTO waybillLogDTO) { |
|
|
|
|
|
|
|
|
|
String waybillNo = waybillLogDTO.getWaybillNo(); |
|
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(waybillNo)){ |
|
|
|
|
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo); |
|
|
|
|
Integer waybillType = warehouseWaybillEntity.getWaybillType(); |
|
|
|
|
Long waybillId = warehouseWaybillEntity.getId(); |
|
|
|
|
if(waybillType == 1){ |
|
|
|
|
//订制品运单
|
|
|
|
|
//加入零担运单签收日志
|
|
|
|
|
addPackageWaybillTrackLog(waybillLogDTO,waybillId); |
|
|
|
|
|
|
|
|
|
}else if(waybillType == 2){ |
|
|
|
|
//零担运单
|
|
|
|
|
addZeroWaybillTrackLog(waybillLogDTO,warehouseWaybillEntity); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void addZeroWaybillTrackLog(WaybillLogDTO waybillLogDTO, WarehouseWaybillEntity warehouseWaybillEntity) { |
|
|
|
|
Long waybillId = warehouseWaybillEntity.getId(); |
|
|
|
|
Integer num = waybillLogDTO.getNum(); |
|
|
|
|
String carNumber = waybillLogDTO.getCarNumber(); |
|
|
|
|
String driverName = waybillLogDTO.getDriverName(); |
|
|
|
|
String trainNumber = waybillLogDTO.getTrainNumber(); |
|
|
|
|
String waybillNo = waybillLogDTO.getWaybillNo(); |
|
|
|
|
Long warehouseId = waybillLogDTO.getWarehouseId(); |
|
|
|
|
String warehouseName = waybillLogDTO.getWarehouseName(); |
|
|
|
|
String loadingUser = waybillLogDTO.getLoadingUser(); |
|
|
|
|
Date deliveryTime = waybillLogDTO.getDeliveryTime(); |
|
|
|
|
String signUser = waybillLogDTO.getSignUser(); |
|
|
|
|
Date signTime = waybillLogDTO.getSignTime(); |
|
|
|
|
Integer type = waybillLogDTO.getType(); |
|
|
|
|
String nickName = waybillLogDTO.getNickName(); |
|
|
|
|
Long userId = waybillLogDTO.getUserId(); |
|
|
|
|
String signOrderCode = waybillLogDTO.getSignOrderCode(); |
|
|
|
|
|
|
|
|
|
String typeStr = ""; |
|
|
|
|
switch (type){ |
|
|
|
|
case 1: |
|
|
|
|
typeStr = "三方中转签收"; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
typeStr = "直发商家签收"; |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
typeStr = "配送签收"; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
typeStr = "未知签收"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(type == 3){ |
|
|
|
|
//如果是配送签收需要补录配送装车记录
|
|
|
|
|
String operationRemark = warehouseName+" 配送装车"+num+"件,车次号:"+trainNumber+",司机:"+driverName+",车牌号:"+carNumber+",装车人"+ loadingUser+",配送时间"+ CommonUtil.dateToStringGeneral(deliveryTime); |
|
|
|
|
openOrderAsyncService.saveLog(waybillId,waybillNo,"90",warehouseName+" 配送装车",operationRemark,nickName,userId,warehouseId,warehouseName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//存入签收日志
|
|
|
|
|
String operationRemark = warehouseName+" "+typeStr+num+"件,车次号:"+trainNumber+",司机:"+driverName+",车牌号:"+carNumber+",签收人"+ signUser+",签收单:"+signOrderCode+",签收时间"+ CommonUtil.dateToStringGeneral(signTime); |
|
|
|
|
openOrderAsyncService.saveLog(waybillId,waybillNo,"100",warehouseName+" "+typeStr,operationRemark,nickName,userId,warehouseId,warehouseName); |
|
|
|
|
|
|
|
|
|
warehouseWaybillEntity.setWaybillStatus("100"); |
|
|
|
|
|
|
|
|
|
//需要更新运单的状态
|
|
|
|
|
TrunklineWaybillOrderEntity waybillOrderEntity = waybillOrderService.findEntityByWaybillNoAndOrderCode(waybillNo, waybillNo); |
|
|
|
|
if(!Objects.isNull(waybillOrderEntity)){ |
|
|
|
|
int waybillStatusInt = Integer.parseInt(warehouseWaybillEntity.getWaybillStatus()); |
|
|
|
|
Integer totalCount = warehouseWaybillEntity.getTotalCount(); |
|
|
|
|
Integer handleNumber = waybillOrderEntity.getHandleNumber(); |
|
|
|
|
int i = handleNumber + num; |
|
|
|
|
if(waybillStatusInt < 90){ |
|
|
|
|
if(i == totalCount){ |
|
|
|
|
warehouseWaybillEntity.setWaybillStatus("100"); |
|
|
|
|
waybillOrderEntity.setHandleNumber(i); |
|
|
|
|
}else{ |
|
|
|
|
warehouseWaybillEntity.setWaybillStatus("90"); |
|
|
|
|
waybillOrderEntity.setHandleNumber(i); |
|
|
|
|
} |
|
|
|
|
warehouseWaybillClient.updateEntity(warehouseWaybillEntity); |
|
|
|
|
waybillOrderService.updateById(waybillOrderEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void addPackageWaybillTrackLog(WaybillLogDTO waybillLogDTO,Long waybillId) { |
|
|
|
|
Integer num = waybillLogDTO.getNum(); |
|
|
|
|
String carNumber = waybillLogDTO.getCarNumber(); |
|
|
|
|
String driverName = waybillLogDTO.getDriverName(); |
|
|
|
|
String trainNumber = waybillLogDTO.getTrainNumber(); |
|
|
|
|
String waybillNo = waybillLogDTO.getWaybillNo(); |
|
|
|
|
Long warehouseId = waybillLogDTO.getWarehouseId(); |
|
|
|
|
String warehouseName = waybillLogDTO.getWarehouseName(); |
|
|
|
|
String loadingUser = waybillLogDTO.getLoadingUser(); |
|
|
|
|
Date deliveryTime = waybillLogDTO.getDeliveryTime(); |
|
|
|
|
String signUser = waybillLogDTO.getSignUser(); |
|
|
|
|
Date signTime = waybillLogDTO.getSignTime(); |
|
|
|
|
Integer type = waybillLogDTO.getType(); |
|
|
|
|
String nickName = waybillLogDTO.getNickName(); |
|
|
|
|
Long userId = waybillLogDTO.getUserId(); |
|
|
|
|
String signOrderCode = waybillLogDTO.getSignOrderCode(); |
|
|
|
|
|
|
|
|
|
String typeStr = ""; |
|
|
|
|
switch (type){ |
|
|
|
|
case 1: |
|
|
|
|
typeStr = "三方中转签收"; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
typeStr = "直发商家签收"; |
|
|
|
|
break; |
|
|
|
|
case 3: |
|
|
|
|
typeStr = "配送签收"; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
typeStr = "未知签收"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(type == 3){ |
|
|
|
|
//如果是配送签收需要补录配送装车记录
|
|
|
|
|
String operationRemark = warehouseName+" 配送装车"+num+"件,车次号:"+trainNumber+",司机:"+driverName+",车牌号:"+carNumber+",装车人"+ loadingUser+",配送时间"+ CommonUtil.dateToStringGeneral(deliveryTime); |
|
|
|
|
openOrderAsyncService.saveLog(waybillId,waybillNo,"90",warehouseName+" 配送装车",operationRemark,nickName,userId,warehouseId,warehouseName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//存入签收日志
|
|
|
|
|
String operationRemark = warehouseName+" "+typeStr+num+"件,车次号:"+trainNumber+",司机:"+driverName+",车牌号:"+carNumber+",签收人"+ signUser+",签收单:"+signOrderCode+",签收时间"+ CommonUtil.dateToStringGeneral(signTime); |
|
|
|
|
openOrderAsyncService.saveLog(waybillId,waybillNo,"100",warehouseName+" "+typeStr,operationRemark,nickName,userId,warehouseId,warehouseName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|