Browse Source

1.开单逻辑优化

master
zhenghaoyu 10 months ago
parent
commit
cc3bcdbee2
  1. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderAsyncService.java
  2. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java
  3. 76
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java
  4. 51
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  5. 11
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java
  6. 10
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingWaybillServiceImpl.java
  7. 24
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/IOpenOrderAsyncService.java

@ -26,4 +26,6 @@ public interface IOpenOrderAsyncService {
void sendOpenWaybillFanout(WarehouseWaybillEntity waybillEntity, List<WarehouseWayBillDetail> details, List<Long> advanceIds);
void sendUpdateWaybillFanout(WarehouseWaybillEntity waybillEntity, List<WarehouseWayBillDetail> details, List<Long> advanceIds);
void dealwithBillladingInfo(List<Long> advanceIds,Long warehouseId,String warehouseName,Long waybillId,String waybillNo);
}

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java

@ -39,4 +39,6 @@ public interface ITrunklineBillladingWaybillService extends BaseService<Trunklin
List<TrunklineBillladingWaybillEntity> findNoFinishWaybillByBillladingId(Long billladingId);
TrunklineBillladingNumVO getNumVOByBillladingId(Long billladingId);
List<TrunklineBillladingWaybillEntity> getNoDataWaybillByBillladingIds(List<Long> billladingIds);
}

76
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderAsyncServiceImpl.java

@ -7,10 +7,9 @@ import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity;
import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient;
import com.logpm.trunkline.dto.InComingDTO;
import com.logpm.trunkline.entity.TrunklineCarsLoadEntity;
import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity;
import com.logpm.trunkline.entity.TrunklineWaybillTrackEntity;
import com.logpm.trunkline.entity.*;
import com.logpm.trunkline.service.*;
import com.logpm.trunkline.vo.BillladingPackageVO;
import com.logpm.trunkline.vo.LoadScanWaybillVO;
import com.logpm.trunkline.vo.TrunklineAdvanceDetailVO;
import com.logpm.warehouse.entity.WarehouseWayBillDetail;
@ -33,6 +32,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
@ -62,6 +62,10 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService {
private IBasicdataClientClient basicdataClientClient;
@Autowired
private IBasicdataStoreBusinessClient basicdataStoreBusinessClient;
@Autowired
private ITrunklineBillladingWaybillService trunklineBillladingWaybillService;
@Autowired
private ITrunklineBillladingService trunklineBillladingService;
@LogpmAsync("asyncExecutor")
@Override
@ -815,6 +819,72 @@ public class OpenOrderAsyncServiceImpl implements IOpenOrderAsyncService {
}
@LogpmAsync("asyncExecutor")
@Override
public void dealwithBillladingInfo(List<Long> advanceIds,Long warehouseId,String warehouseName,Long waybillId,String waybillNo) {
List<BillladingPackageVO> billladingPackageList = advanceDetailService.findBillladingPackageByAdvanceIdsAnd(advanceIds);
List<TrunklineBillladingWaybillEntity> addBillladingWaybillEntities = new ArrayList<>();
List<TrunklineBillladingWaybillEntity> updateBillladingWaybillEntities = new ArrayList<>();
List<TrunklineBillladingEntity> updateFeeBilllading = new ArrayList<>();
//把billladingPackageList转化成以billladingId为key的Map,以billladingId为key,value为BillladingPackageVO
Map<Long, BillladingPackageVO> billladingPackageMap = billladingPackageList.stream().collect(Collectors.toMap(BillladingPackageVO::getBillladingId, Function.identity()));
List<Long> billladingIds = new ArrayList<>(billladingPackageMap.keySet());
QueryWrapper<TrunklineBillladingEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", billladingIds)
.eq("is_deleted", 0)
.eq("billlading_status", "2");
List<TrunklineBillladingEntity> billladingEntities = trunklineBillladingService.list(queryWrapper);
//把billladingEntities转化成以id为key的Map
Map<Long, TrunklineBillladingEntity> billladingMap = billladingEntities.stream().collect(Collectors.toMap(TrunklineBillladingEntity::getId, Function.identity()));
List<TrunklineBillladingWaybillEntity> billladingWaybillEntities = trunklineBillladingWaybillService.getNoDataWaybillByBillladingIds(billladingIds);
//把billladingWaybillEntities转化成以billladingId为key的Map
Map<Long, TrunklineBillladingWaybillEntity> billladingWaybillMap = billladingWaybillEntities.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getId, Function.identity()));
billladingPackageMap.keySet().forEach(billladingId -> {
BillladingPackageVO billladingPackageVO = billladingPackageMap.get(billladingId);
Integer num = billladingPackageVO.getNum();
TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillMap.get(billladingId);
if(!Objects.isNull(billladingWaybillEntity)){
TrunklineBillladingEntity billladingEntity = billladingMap.get(billladingId);
Integer realNum = billladingWaybillEntity.getRealNum();
if (realNum > num) {
billladingWaybillEntity.setRealNum(realNum - num);
} else if (realNum.equals(num)) {
billladingWaybillEntity.setRealNum(0);
billladingWaybillEntity.setIsDeleted(1);
}
updateBillladingWaybillEntities.add(billladingWaybillEntity);
TrunklineBillladingWaybillEntity addbillladingWaybillEntity = new TrunklineBillladingWaybillEntity();
addbillladingWaybillEntity.setWarehouseId(warehouseId);
addbillladingWaybillEntity.setWarehouseName(warehouseName);
addbillladingWaybillEntity.setBillladingId(billladingId);
addbillladingWaybillEntity.setBilladingCode(billladingEntity.getBillladingCode());
addbillladingWaybillEntity.setWaybillId(waybillId);
addbillladingWaybillEntity.setWaybillNo(waybillNo);
addbillladingWaybillEntity.setRealNum(num);
addbillladingWaybillEntity.setRealVolume(BigDecimal.ZERO);
addbillladingWaybillEntity.setRealWeight(BigDecimal.ZERO);
addBillladingWaybillEntities.add(addbillladingWaybillEntity);
updateFeeBilllading.add(billladingEntity);
}
});
trunklineBillladingWaybillService.updateBatchById(updateBillladingWaybillEntities);
trunklineBillladingWaybillService.saveBatch(addBillladingWaybillEntities);
//更新提货单对应的运单的提货费用
for (TrunklineBillladingEntity billladingEntity : updateFeeBilllading) {
trunklineBillladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity);
}
}
}

51
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -579,54 +579,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
advanceService.updateBatchById(advanceEntityList);
//计算扫码入库的包件是否需要把运单和提货单挂上
List<BillladingPackageVO> billladingPackageList = advanceDetailService.findBillladingPackageByAdvanceIdsAnd(advanceIds);
List<TrunklineBillladingWaybillEntity> billladingWaybillEntities = new ArrayList<>();
List<TrunklineBillladingEntity> updateFeeBilllading = new ArrayList<>();
for (BillladingPackageVO billladingPackageVO : billladingPackageList) {
Long billladingId = billladingPackageVO.getBillladingId();
QueryWrapper<TrunklineBillladingEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", billladingId)
.eq("is_deleted", 0)
.eq("billlading_status", "2");
TrunklineBillladingEntity billladingEntity = trunklineBillladingService.getOne(queryWrapper);
if (Objects.isNull(billladingEntity)) {
log.info("#################openWaybill: 提货单信息不存在 billladingId={}", billladingId);
continue;
}
Integer num = billladingPackageVO.getNum();
TrunklineBillladingWaybillEntity trunklineBillladingWaybillEntity = trunklineBillladingWaybillService.getNoDataWaybillByBillladingId(billladingId);
if (!Objects.isNull(trunklineBillladingWaybillEntity)) {
Integer realNum = trunklineBillladingWaybillEntity.getRealNum();
if (realNum > num) {
trunklineBillladingWaybillEntity.setRealNum(realNum - num);
} else if (realNum.equals(num)) {
trunklineBillladingWaybillEntity.setRealNum(0);
trunklineBillladingWaybillEntity.setIsDeleted(1);
}
trunklineBillladingWaybillService.updateById(trunklineBillladingWaybillEntity);
TrunklineBillladingWaybillEntity billladingWaybillEntity = new TrunklineBillladingWaybillEntity();
billladingWaybillEntity.setWarehouseId(warehouseId);
billladingWaybillEntity.setWarehouseName(basicdataWarehouseEntity.getName());
billladingWaybillEntity.setBillladingId(billladingId);
billladingWaybillEntity.setBilladingCode(billladingEntity.getBillladingCode());
billladingWaybillEntity.setWaybillId(waybillId);
billladingWaybillEntity.setWaybillNo(waybillNo);
billladingWaybillEntity.setRealNum(num);
billladingWaybillEntity.setRealVolume(BigDecimal.ZERO);
billladingWaybillEntity.setRealWeight(BigDecimal.ZERO);
billladingWaybillEntities.add(billladingWaybillEntity);
updateFeeBilllading.add(billladingEntity);
}
}
trunklineBillladingWaybillService.saveBatch(billladingWaybillEntities);
//更新提货单对应的运单的提货费用
for (TrunklineBillladingEntity billladingEntity : updateFeeBilllading) {
trunklineBillladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity);
}
openOrderAsyncService.dealwithBillladingInfo(advanceIds,warehouseId,warehouseName,waybillId,waybillNo);
//判断是否是开单及入库的配置
Boolean aBoolean = basicdataOpenIncomingClient.checkOpenIncoming(warehouseId, brandId);
@ -646,7 +599,7 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
Integer totalCount = waybillEntity.getTotalCount();
Integer stockCount = waybillEntity.getStockCount();
if (totalCount.equals(stockCount)) {
if (stockCount > 0) {
createOperationRemark = "运单入库:" + stockCount + "/" + totalCount + ",入库类型:【开单前已入库】,入库时间:" + CommonUtil.dateToStringGeneral(new Date());
openOrderAsyncService.saveLog(waybillId, waybillNo, "20", "已入库", createOperationRemark, nickName, userId, warehouseId, warehouseName);
}

11
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java

@ -675,7 +675,10 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
parcelListClient.addBatch(parcelListEntityList);
if(!Objects.isNull(waybillEntity)){
warehouseWaybillClient.updateEntity(waybillEntity);
WarehouseWaybillEntity updateWaybillEntity = new WarehouseWaybillEntity();
updateWaybillEntity.setId(waybillEntity.getId());
updateWaybillEntity.setStockCount(waybillEntity.getStockCount());
warehouseWaybillClient.updateEntity(updateWaybillEntity);
}
try {
@ -993,6 +996,7 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
List<WarehouseWaybillEntity> updateWaybillList = new ArrayList<>();
parcelListEntityMap.keySet().forEach(waybillNo->{
WarehouseWaybillEntity updateWaybill = new WarehouseWaybillEntity();
WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo);
if(!Objects.isNull(waybillEntity)){
@ -1001,8 +1005,9 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
if(!pl.isEmpty()){
size = pl.size();
}
waybillEntity.setStockCount(waybillEntity.getStockCount() + size);
updateWaybillList.add(waybillEntity);
updateWaybill.setId(waybillEntity.getId());
updateWaybill.setStockCount(waybillEntity.getStockCount() + size);
updateWaybillList.add(updateWaybill);
}
});

10
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingWaybillServiceImpl.java

@ -125,6 +125,7 @@ public class TrunklineBillladingWaybillServiceImpl extends BaseServiceImpl<Trunk
public TrunklineBillladingWaybillEntity getNoDataWaybillByBillladingId(Long billladingId) {
QueryWrapper<TrunklineBillladingWaybillEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("waybill_no","————")
.eq("billlading_id",billladingId)
.eq("is_deleted",0);
return baseMapper.selectOne(queryWrapper);
}
@ -149,4 +150,13 @@ public class TrunklineBillladingWaybillServiceImpl extends BaseServiceImpl<Trunk
return baseMapper.getNumVOByBillladingId(billladingId);
}
@Override
public List<TrunklineBillladingWaybillEntity> getNoDataWaybillByBillladingIds(List<Long> billladingIds) {
QueryWrapper<TrunklineBillladingWaybillEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("waybill_no","————")
.in("billlading_id",billladingIds)
.eq("is_deleted",0);
return baseMapper.selectList(queryWrapper);
}
}

24
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineWaybillPackageServiceImpl.java

@ -74,6 +74,8 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl<Trunklin
@Override
public void updateWaybillStatus(WarehouseWaybillEntity waybillEntity) {
WarehouseWaybillEntity updateWaybillEntity = new WarehouseWaybillEntity();
updateWaybillEntity.setId(waybillEntity.getId());
QueryWrapper<TrunklineWaybillPackageEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("waybill_no",waybillEntity.getWaybillNo())
.eq("is_deleted",0);
@ -104,44 +106,44 @@ public class TrunklineWaybillPackageServiceImpl extends BaseServiceImpl<Trunklin
if(signNum > 0){
if(signNum == size){
waybillEntity.setWaybillStatus("100");
updateWaybillEntity.setWaybillStatus("100");
}else{
waybillEntity.setWaybillStatus("90");
updateWaybillEntity.setWaybillStatus("90");
}
}else{
if(deliveryNum > 0){
if (deliveryNum == size){
waybillEntity.setWaybillStatus("80");
updateWaybillEntity.setWaybillStatus("80");
}else {
waybillEntity.setWaybillStatus("70");
updateWaybillEntity.setWaybillStatus("70");
}
}else{
if(unloadNum > 0){
if (unloadNum == size){
waybillEntity.setWaybillStatus("60");
updateWaybillEntity.setWaybillStatus("60");
}else {
waybillEntity.setWaybillStatus("50");
updateWaybillEntity.setWaybillStatus("50");
}
}else{
if(transferNum > 0){
if (transferNum == size){
waybillEntity.setWaybillStatus("40");
updateWaybillEntity.setWaybillStatus("40");
}else {
waybillEntity.setWaybillStatus("30");
updateWaybillEntity.setWaybillStatus("30");
}
}else{
if(incomingNum > 0){
if (incomingNum == size){
waybillEntity.setWaybillStatus("20");
updateWaybillEntity.setWaybillStatus("20");
}else {
waybillEntity.setWaybillStatus("10");
updateWaybillEntity.setWaybillStatus("10");
}
}
}
}
}
}
warehouseWaybillClient.updateEntity(waybillEntity);
warehouseWaybillClient.updateEntity(updateWaybillEntity);
}
@Override

Loading…
Cancel
Save