Browse Source

1.干线提货逻辑更新

dist.1.3.0
zhenghaoyu 10 months ago
parent
commit
723aea9827
  1. 15
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingNumVO.java
  2. 1
      blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java
  3. 1
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java
  4. 2
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.xml
  5. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.java
  6. 32
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml
  7. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/ITrunklineBillladingWaybillService.java
  8. 21
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceServiceImpl.java
  9. 121
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingPackageServiceImpl.java
  10. 192
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java
  11. 15
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingWaybillServiceImpl.java
  12. 7
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

15
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingNumVO.java

@ -0,0 +1,15 @@
package com.logpm.trunkline.vo;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class TrunklineBillladingNumVO implements Serializable {
private Integer num;
private BigDecimal weight;
private BigDecimal volume;
}

1
blade-service-api/logpm-trunkline-api/src/main/java/com/logpm/trunkline/vo/TrunklineBillladingWaybillVO.java

@ -32,5 +32,6 @@ public class TrunklineBillladingWaybillVO extends TrunklineBillladingWaybillEnti
private Integer stockCount;
private Long billladingWaybillId;
private Integer totalPlanNum;
}

1
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseWaybillVO.java

@ -40,6 +40,7 @@ public class WarehouseWaybillVO extends WarehouseWaybillEntity {
private Integer handleNum;
private Integer planNum;
private Integer totalPlanNum;
private Long waybillId;

2
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingMapper.xml

@ -94,7 +94,7 @@
lww.customer_train customerTrain,
lww.shipper shipper,
lww.total_count totalCount,
lww.total_count-lww.billlading_num planNum,
lww.total_count-lww.billlading_num totalPlanNum,
lww.total_weight totalWeight,
lww.total_volume totalVolume,
lww.total_freight totalFreight,

7
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.java

@ -3,6 +3,7 @@ package com.logpm.trunkline.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.trunkline.entity.TrunklineBillladingWaybillEntity;
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity;
import com.logpm.trunkline.vo.TrunklineBillladingNumVO;
import com.logpm.trunkline.vo.TrunklineBillladingWaybillVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -25,5 +26,9 @@ public interface TrunklineBillladingWaybillMapper extends BaseMapper<TrunklineBi
TrunklineBillladingWaybillEntity getOneByBillladingIdAndWaybillNo(@Param("billladingId") Long billladingId, @Param("waybillNo") String waybillNo);
void updateByBillladingIdAndWaybillNo(@Param("billladingId") Long billladingId, @Param("waybillNo") String waybillNo);
void updateByBillladingIdAndWaybillNo(@Param("billladingId") Long billladingId, @Param("waybillNo") String waybillNo,@Param("planNum") Integer planNum);
List<TrunklineBillladingWaybillEntity> findNoFinishWaybillByBillladingId(@Param("billladingId") Long billladingId);
TrunklineBillladingNumVO getNumVOByBillladingId(@Param("billladingId") Long billladingId);
}

32
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineBillladingWaybillMapper.xml

@ -40,18 +40,16 @@
lww.consignee_mobile consigneeMobile,
lww.consignee_address consigneeAddress,
lww.remark remark,
lww.total_count totalCount,
sum(ltbw2.real_num) stockCount,
lww.total_count-lww.billlading_num totalPlanNum,
ltbw.plan_num planNum,
ltbw.real_num realNum,
ltbw.billlading_fee billladingFee,
lww.collect_pay collectPay
from logpm_trunkline_billlading_waybill ltbw
left join logpm_trunkline_billlading_waybill ltbw2 on ltbw2.waybill_id = ltbw.waybill_id
left join logpm_trunkline_billlading ltb on ltb.id = ltbw.billlading_id
left join logpm_warehouse_waybill lww on lww.waybill_no = ltbw.waybill_no
left join logpm_trunkline_billlading ltb on ltb.id = ltbw.billlading_id
left join logpm_warehouse_waybill lww on lww.waybill_no = ltbw.waybill_no
where ltbw.billlading_id = #{billladingId}
and ltbw.is_deleted = 0
group by ltb.billlading_code,
ltbw.waybill_id
</select>
<update id="updateDataByBillladingWaybillId" >
@ -82,9 +80,27 @@
<update id="updateByBillladingIdAndWaybillNo">
update logpm_trunkline_billlading_waybill
set is_deleted = 0
set is_deleted = 0,
plan_num = #{planNum}
where billlading_id = #{billladingId}
and waybill_no = #{waybillNo}
</update>
<select id="findNoFinishWaybillByBillladingId" resultType="com.logpm.trunkline.entity.TrunklineBillladingWaybillEntity">
select *
from logpm_trunkline_billlading_waybill
where billlading_id = #{billladingId}
and real_num &lt; plan_num
and is_deleted = 0
</select>
<select id="getNumVOByBillladingId" resultType="com.logpm.trunkline.vo.TrunklineBillladingNumVO">
select IFNULL(sum(real_num),0) num,
IFNULL(sum(real_weight),0) weight,
IFNULL(sum(real_volume),0) volume
from logpm_trunkline_billlading_waybill
where billlading_id = #{billladingId}
and is_deleted = 0
</select>
</mapper>

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

@ -3,6 +3,7 @@ package com.logpm.trunkline.service;
import com.logpm.trunkline.entity.TrunklineBillladingEntity;
import com.logpm.trunkline.entity.TrunklineBillladingWaybillEntity;
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity;
import com.logpm.trunkline.vo.TrunklineBillladingNumVO;
import com.logpm.trunkline.vo.TrunklineBillladingWaybillVO;
import org.springblade.core.mp.base.BaseService;
@ -33,5 +34,9 @@ public interface ITrunklineBillladingWaybillService extends BaseService<Trunklin
TrunklineBillladingWaybillEntity getOneByBillladingIdAndWaybillNo(Long billladingId, String waybillNo);
void updateByBillladingIdAndWaybillNo(Long billladingId, String waybillNo);
void updateByBillladingIdAndWaybillNo(Long billladingId, String waybillNo,Integer planNum);
List<TrunklineBillladingWaybillEntity> findNoFinishWaybillByBillladingId(Long billladingId);
TrunklineBillladingNumVO getNumVOByBillladingId(Long billladingId);
}

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

@ -925,6 +925,7 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
if(warehouseId.equals(destinationWarehouseId)){
parcelList.setIsTransfer(0);
}
}
}
parcelList.setConditions(1);
@ -978,6 +979,26 @@ public class TrunklineAdvanceServiceImpl extends BaseServiceImpl<TrunklineAdvanc
parcelListClient.addBatch(parcelListEntityList);
//把parcelListEntityList中所有元素以waubillId分组
Map<String,List<DistributionParcelListEntity>> parcelListEntityMap = parcelListEntityList.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getWaybillNumber));
List<WarehouseWaybillEntity> updateWaybillList = new ArrayList<>();
parcelListEntityMap.keySet().forEach(waybillNo->{
WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo);
if(!Objects.isNull(waybillEntity)){
List<DistributionParcelListEntity> pl = parcelListEntityMap.get(waybillNo);
Integer size = 0;
if(!pl.isEmpty()){
size = pl.size();
}
waybillEntity.setStockCount(waybillEntity.getStockCount() + size);
updateWaybillList.add(waybillEntity);
}
});
warehouseWaybillClient.updateList(updateWaybillList);
orderCodeSet.forEach(orderCode->{
stockArticleClient.updateOrderInfo(orderCode,warehouseId);
});

121
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingPackageServiceImpl.java

@ -264,10 +264,10 @@ public class TrunklineBillladingPackageServiceImpl extends BaseServiceImpl<Trunk
int diff = 0;
int all = stockCount + size;
if(all > totalCount){
waybillEntity.setStockCount(totalCount);
// waybillEntity.setStockCount(totalCount);
diff = totalCount - stockCount;
}else{
waybillEntity.setStockCount(all);
// waybillEntity.setStockCount(all);
diff = size;
}
Integer integer = waybillNoMNumMap.get(waybillNo);
@ -281,65 +281,69 @@ public class TrunklineBillladingPackageServiceImpl extends BaseServiceImpl<Trunk
}
});
// QueryWrapper<TrunklineBillladingWaybillEntity> billladingWaybillEntityQueryWrapper = new QueryWrapper<>();
// billladingWaybillEntityQueryWrapper.in("waybill_no",waybillNoSet)
// .eq("billlading_id",billladingId)
// .eq("is_deleted",0);
//
// List<TrunklineBillladingWaybillEntity> billladingWaybillEntityList = trunklineBillladingWaybillService.list(billladingWaybillEntityQueryWrapper);
//
// //把billladingWaybillEntityList转化成waybillNo为key的Map
// Map<String, TrunklineBillladingWaybillEntity> billladingWaybillEntityMap = billladingWaybillEntityList.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getWaybillNo, Function.identity()));
//
// List<TrunklineBillladingWaybillEntity> addList = new ArrayList<>();
// List<TrunklineBillladingWaybillEntity> updateList = new ArrayList<>();
//
// final TrunklineBillladingWaybillEntity[] noWaybillData = {trunklineBillladingWaybillService.findNoWaybillNoData(billladingId)};
//
//
// waybillNoSet.forEach(waybillNo -> {
// Integer integer = waybillNoMNumMap.get(waybillNo);
// TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillEntityMap.get(waybillNo);
// if(Objects.isNull(billladingWaybillEntity)){
// //查询是否有一条无运单的数据
// if(Objects.isNull(noWaybillData[0])){
// noWaybillData[0] = new TrunklineBillladingWaybillEntity();
// noWaybillData[0].setWarehouseId(warehouseId);
// noWaybillData[0].setWarehouseName(warehouseEntity.getName());
// noWaybillData[0].setBillladingId(billladingId);
// noWaybillData[0].setBilladingCode(trunklineBillladingEntity.getBillladingCode());
// noWaybillData[0].setWaybillNo("————");
// noWaybillData[0].setRealNum(integer);
// noWaybillData[0].setRealWeight(BigDecimal.ZERO);
// noWaybillData[0].setRealVolume(BigDecimal.ZERO);
// }else{
// Integer realNum = noWaybillData[0].getRealNum();
// noWaybillData[0].setRealNum(realNum+integer);
// }
// }else{
// Integer realNum = billladingWaybillEntity.getRealNum();
// billladingWaybillEntity.setRealNum(realNum + integer);
// updateList.add(billladingWaybillEntity);
// }
// });
//
// addList.add(noWaybillData[0]);
//
// trunklineBillladingWaybillService.saveBatch(addList);
// trunklineBillladingWaybillService.updateBatchById(updateList);
//
// TrunklineBillladingEntity billladingEntity = trunklineBillladingService.getById(billladingId);
// if(!Objects.isNull(billladingEntity)){
// int realNum = billladingEntity.getRealNum();
// Integer all = waybillNoMNumMap.values().stream().reduce(Integer::sum).get();
// billladingEntity.setRealNum(realNum+all);
// trunklineBillladingService.updateById(billladingEntity);
// }
QueryWrapper<TrunklineBillladingWaybillEntity> billladingWaybillEntityQueryWrapper = new QueryWrapper<>();
billladingWaybillEntityQueryWrapper.in("waybill_no",waybillNoSet)
.eq("billlading_id",billladingId)
.eq("is_deleted",0);
List<TrunklineBillladingWaybillEntity> billladingWaybillEntityList = trunklineBillladingWaybillService.list(billladingWaybillEntityQueryWrapper);
//把billladingWaybillEntityList转化成waybillNo为key的Map
Map<String, TrunklineBillladingWaybillEntity> billladingWaybillEntityMap = billladingWaybillEntityList.stream().collect(Collectors.toMap(TrunklineBillladingWaybillEntity::getWaybillNo, Function.identity()));
List<TrunklineBillladingWaybillEntity> addList = new ArrayList<>();
List<TrunklineBillladingWaybillEntity> updateList = new ArrayList<>();
TrunklineBillladingWaybillEntity noWaybillNoData = trunklineBillladingWaybillService.findNoWaybillNoData(billladingId);
for (String waybillNo : waybillNoSet) {
Integer integer = waybillNoMNumMap.get(waybillNo);
TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillEntityMap.get(waybillNo);
if(Objects.isNull(billladingWaybillEntity)){
//查询是否有一条无运单的数据
if(Objects.isNull(noWaybillNoData)){
noWaybillNoData = new TrunklineBillladingWaybillEntity();
noWaybillNoData.setWarehouseId(warehouseId);
noWaybillNoData.setWarehouseName(warehouseEntity.getName());
noWaybillNoData.setBillladingId(billladingId);
noWaybillNoData.setBilladingCode(trunklineBillladingEntity.getBillladingCode());
noWaybillNoData.setWaybillNo("————");
noWaybillNoData.setRealNum(integer);
noWaybillNoData.setRealWeight(BigDecimal.ZERO);
noWaybillNoData.setRealVolume(BigDecimal.ZERO);
addList.add(noWaybillNoData);
}else{
Integer realNum = noWaybillNoData.getRealNum();
noWaybillNoData.setRealNum(realNum+integer);
updateList.add(noWaybillNoData);
}
}else{
Integer realNum = billladingWaybillEntity.getRealNum();
billladingWaybillEntity.setRealNum(realNum + integer);
updateList.add(billladingWaybillEntity);
}
}
if(!addList.isEmpty()){
trunklineBillladingWaybillService.saveBatch(addList);
}
trunklineBillladingWaybillService.updateBatchById(updateList);
TrunklineBillladingEntity billladingEntity = trunklineBillladingService.getById(billladingId);
if(!Objects.isNull(billladingEntity)){
int realNum = billladingEntity.getRealNum();
Integer all = waybillNoMNumMap.values().stream().reduce(Integer::sum).get();
billladingEntity.setRealNum(realNum+all);
trunklineBillladingService.updateById(billladingEntity);
}
List<WarehouseWaybillEntity> warehouseWaybillEntities = new ArrayList<>();
waybillEntityMap.keySet().forEach(waybillNo -> {
WarehouseWaybillEntity waybillEntity = waybillEntityMap.get(waybillNo);
if(Objects.isNull(waybillEntity)){
if(!Objects.isNull(waybillEntity)){
Integer totalCount = waybillEntity.getTotalCount();
Integer stockCount = waybillEntity.getStockCount();
if(stockCount.equals(totalCount)){
@ -360,10 +364,9 @@ public class TrunklineBillladingPackageServiceImpl extends BaseServiceImpl<Trunk
}else{
waybillEntity.setWaybillStatus(WaybillStatusEnum.BUFENRUKU.getCode());
}
warehouseWaybillEntities.add(waybillEntity);
}
});
List<WarehouseWaybillEntity> warehouseWaybillEntities = new ArrayList<>(waybillEntityMap.values());
warehouseWaybillClient.updateList(warehouseWaybillEntities);
//根据提货单id重新计算每个运单的费用

192
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineBillladingServiceImpl.java

@ -105,6 +105,8 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
trunklineBillladingEntity.setLineNameTitle(lineTitle);
updateById(trunklineBillladingEntity);
List<TrunklineBillladingWaybillEntity> saveBillladingWaybillList = new ArrayList<>();
Map<Long, Integer> waybillBillladingNumMap = new HashMap<>();
//保存提货运单
List<TrunklineBillladingWaybillVO> billladingWaybillList = billladingDTO.getBillladingWaybillList();
for (TrunklineBillladingWaybillVO billladingWaybillVO:billladingWaybillList){
@ -117,12 +119,28 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
billladingWaybillEntity.setRealVolume(BigDecimal.ZERO);
billladingWaybillEntity.setBillladingFee(BigDecimal.ZERO);
billladingWaybillEntity.setPlanNum(billladingWaybillVO.getPlanNum());
billladingWaybillService.save(billladingWaybillEntity);
saveBillladingWaybillList.add(billladingWaybillEntity);
waybillBillladingNumMap.put(billladingWaybillVO.getWaybillId(),billladingWaybillVO.getPlanNum());
}
billladingWaybillService.saveBatch(saveBillladingWaybillList);
//
Set<Long> waybillIds = waybillBillladingNumMap.keySet();
List<WarehouseWaybillEntity> waybillEntityList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(waybillIds));
waybillEntityList.forEach(waybillEntity -> {
Long waybillEntityId = waybillEntity.getId();
Integer planNum = waybillBillladingNumMap.get(waybillEntityId);
if(Objects.isNull(planNum)){
planNum = 0;
}
Integer billladingNum = waybillEntity.getBillladingNum();
if(Objects.isNull(billladingNum)){
billladingNum = 0;
}
waybillEntity.setBillladingNum(billladingNum+planNum);
});
warehouseWaybillClient.updateList(waybillEntityList);
TrunklineBillladingLogEntity logEntity = new TrunklineBillladingLogEntity();
@ -205,18 +223,42 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
billladingEntity.setLineNameTitle(lineTitle);
updateById(billladingEntity);
Map<Long,Integer> oldWaybillBillladingNumMap = new HashMap<>();
List<TrunklineBillladingWaybillVO> billladingWaybillVOList = billladingWaybillService.findWaybillInfoListByBillladingId(billladingId);
billladingWaybillVOList.forEach(billladingWaybillVO -> {
oldWaybillBillladingNumMap.put(billladingWaybillVO.getWaybillId(),billladingWaybillVO.getPlanNum());
});
Set<Long> oldWaybillIdSet = oldWaybillBillladingNumMap.keySet();
List<WarehouseWaybillEntity> oldWaybillList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(oldWaybillIdSet));
oldWaybillList.forEach(waybillEntity -> {
Long waybillEntityId = waybillEntity.getId();
Integer planNum = oldWaybillBillladingNumMap.get(waybillEntityId);
if(Objects.isNull(planNum)){
planNum = 0;
}
Integer billladingNum = waybillEntity.getBillladingNum();
if(Objects.isNull(billladingNum)){
billladingNum = 0;
}
waybillEntity.setBillladingNum(Math.max(billladingNum - planNum, 0));
});
warehouseWaybillClient.updateList(oldWaybillList);
//先删除所有对应的运单
billladingWaybillService.deletedByBillladingId(billladingId);
Map<Long,Integer> newWaybillBillladingNumMap = new HashMap<>();
//保存提货运单
List<TrunklineBillladingWaybillVO> billladingWaybillList = billladingDTO.getBillladingWaybillList();
for (TrunklineBillladingWaybillVO billladingWaybillVO:billladingWaybillList){
String waybillNo = billladingWaybillVO.getWaybillNo();
Integer planNum = billladingWaybillVO.getPlanNum();
//查询运单以前是否挂在当前提货单下
TrunklineBillladingWaybillEntity one = billladingWaybillService.getOneByBillladingIdAndWaybillNo(billladingId,waybillNo);
if(!Objects.isNull(one)){
billladingWaybillService.updateByBillladingIdAndWaybillNo(billladingId,waybillNo);
billladingWaybillService.updateByBillladingIdAndWaybillNo(billladingId,waybillNo,planNum);
}else{
TrunklineBillladingWaybillEntity billladingWaybillEntity = new TrunklineBillladingWaybillEntity();
BeanUtil.copy(billladingWaybillVO,billladingWaybillEntity);
@ -228,8 +270,25 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
billladingWaybillEntity.setBillladingFee(BigDecimal.ZERO);
billladingWaybillService.save(billladingWaybillEntity);
}
newWaybillBillladingNumMap.put(billladingWaybillVO.getWaybillId(),billladingWaybillVO.getPlanNum());
}
Set<Long> newWaybillIdSet = newWaybillBillladingNumMap.keySet();
List<WarehouseWaybillEntity> newWaybillList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(newWaybillIdSet));
newWaybillList.forEach(waybillEntity -> {
Long waybillEntityId = waybillEntity.getId();
Integer planNum = newWaybillBillladingNumMap.get(waybillEntityId);
if(Objects.isNull(planNum)){
planNum = 0;
}
Integer billladingNum = waybillEntity.getBillladingNum();
if(Objects.isNull(billladingNum)){
billladingNum = 0;
}
waybillEntity.setBillladingNum(billladingNum + planNum);
});
warehouseWaybillClient.updateList(newWaybillList);
logEntity.setAfterOpreation(JSON.toJSONString(billladingEntity));
trunklineBillladingLogService.save(logEntity);
@ -364,6 +423,28 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
billladingEntity.setSettlementId(AuthUtil.getUserId());
billladingEntity.setSettlementName(AuthUtil.getUserName());
stringBuffer.append(",提货完成变更为已结算,时间").append(CommonUtil.dateToString(date)).append(",变更人").append(AuthUtil.getUserName());
List<TrunklineBillladingWaybillEntity> billladingWaybillEntities = billladingWaybillService.findNoFinishWaybillByBillladingId(billladingId);
Map<Long,Integer> map = new HashMap<>();
billladingWaybillEntities.forEach(billladingWaybillEntity -> {
map.put(billladingWaybillEntity.getWaybillId(),billladingWaybillEntity.getPlanNum() - billladingWaybillEntity.getRealNum());
});
Set<Long> waybillIdSet = map.keySet();
List<WarehouseWaybillEntity> waybillEntityList = warehouseWaybillClient.findListByWaybillIds(new ArrayList<>(waybillIdSet));
waybillEntityList.forEach(waybillEntity -> {
Integer integer = map.get(waybillEntity.getId());
if(Objects.isNull(integer)){
integer = 0;
}
Integer billladingNum = waybillEntity.getBillladingNum();
if(Objects.isNull(billladingNum)){
billladingNum = 0;
}
waybillEntity.setBillladingNum(Math.max(billladingNum - integer, 0));
});
warehouseWaybillClient.updateList(waybillEntityList);
} else {
log.warn("##################updateBillladingStatus: 提货单不能更新为已结算 billladingStatus={}", billladingStatus);
throw new CustomerException(405, "提货单不能更新为提货中");
@ -371,16 +452,16 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
break;
case 5:
//取消结算
if ("4".equals(billladingStatus)) {
billladingEntity.setBillladingStatus("3");
billladingEntity.setSettlementTime(null);
billladingEntity.setSettlementId(null);
billladingEntity.setSettlementName(null);
stringBuffer.append(",已结算变更为提货完成,时间").append(CommonUtil.dateToString(new Date())).append(",变更人").append(AuthUtil.getUserName());
} else {
log.warn("##################updateBillladingStatus: 提货单不能更新为提货完成 billladingStatus={}", billladingStatus);
throw new CustomerException(405, "提货单不能更新为提货完成");
}
// if ("4".equals(billladingStatus)) {
// billladingEntity.setBillladingStatus("3");
// billladingEntity.setSettlementTime(null);
// billladingEntity.setSettlementId(null);
// billladingEntity.setSettlementName(null);
// stringBuffer.append(",已结算变更为提货完成,时间").append(CommonUtil.dateToString(new Date())).append(",变更人").append(AuthUtil.getUserName());
// } else {
// log.warn("##################updateBillladingStatus: 提货单不能更新为提货完成 billladingStatus={}", billladingStatus);
// throw new CustomerException(405, "提货单不能更新为提货完成");
// }
break;
case 6:
//取消提货
@ -461,55 +542,64 @@ public class TrunklineBillladingServiceImpl extends BaseServiceImpl<TrunklineBil
TrunklineBillladingWaybillEntity billladingWaybillEntity = billladingWaybillService.getById(billladingWaybillId);
Long waybillId = billladingWaybillEntity.getWaybillId();
String waybillNo = billladingWaybillEntity.getWaybillNo();
Integer planNum = billladingWaybillEntity.getPlanNum();
Integer realNum = billladingWaybillEntity.getRealNum();
BigDecimal realWeight = billladingWaybillEntity.getRealWeight();
BigDecimal realVolume = billladingWaybillEntity.getRealVolume();
Integer enterNum = billladingWaybillDTO.getEnterNum();
BigDecimal enterWeight = billladingWaybillDTO.getEnterWeight();
BigDecimal enterVolume = billladingWaybillDTO.getEnterVolume();
Integer tNum = billladingWaybillService.getFinishNumByWaybillIdNotBillladingWaybillId(waybillId,billladingWaybillId);
// Integer tNum = billladingWaybillService.getFinishNumByWaybillIdNotBillladingWaybillId(waybillId,billladingWaybillId);
//这个运单总件数不应该查询运单上的总件数,应该取统计运单下暂存单的包件数量,因为运单可能会涉及到改单 总数会变
Integer totalCount = trunklineWaybillOrderService.getOrderPackageNumByWaybillId(waybillId);
// Integer totalCount = trunklineWaybillOrderService.getOrderPackageNumByWaybillId(waybillId);
Integer enterNum = billladingWaybillDTO.getEnterNum();
if(tNum+enterNum > totalCount){
log.warn("###############updateBillladingWaybillNum: 运单提货数量已经大于总数 waybillId={} totalCount={}",waybillId,totalCount);
throw new CustomerException(405,"【"+waybillNo+"】运单提货数量已经大于总数");
if(enterNum > planNum){
log.warn("###############updateBillladingWaybillNum: 运单提货数量已经大于计划数 waybillId={} planNum={}",waybillId,planNum);
throw new CustomerException(405,"【"+waybillNo+"】运单提货数量已经大于计划数");
}
BigDecimal enterWeight = billladingWaybillDTO.getEnterWeight();
BigDecimal enterVolume = billladingWaybillDTO.getEnterVolume();
stockNum = stockNum + enterNum;
stockWeight = stockWeight.add(enterWeight);
stockVolume = stockVolume.add(enterVolume);
billladingWaybillService.updateDataByBillladingWaybillId(billladingWaybillId,enterNum,enterWeight,enterVolume);
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId);
waybillEntity.setStockCount(enterNum);
waybillEntity.setStockWeight(enterWeight);
waybillEntity.setStockVolume(enterVolume);
if(totalCount.equals(enterNum)){
waybillEntity.setWaybillStatus("10");
try{
TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity();
waybillTrackEntity.setWarehouseId(billladingEntity.getWarehouseId());
waybillTrackEntity.setWarehouseName(billladingEntity.getWarehouseName());
waybillTrackEntity.setWaybillId(waybillId);
waybillTrackEntity.setWaybillNo(waybillNo);
waybillTrackEntity.setTrackType("20");
waybillTrackEntity.setRefer("已入库");
waybillTrackEntity.setOperationRemark("运单入库:"+enterNum+"/"+totalCount+",入库类型:【批量入库】,入库时间:"+ CommonUtil.dateToString(new Date()));
trunklineWaybillTrackService.save(waybillTrackEntity);
}catch (Exception e){
log.warn("#################updateBillladingWaybillNum: 存入日志失败");
}
}
warehouseWaybillClient.updateEntity(waybillEntity);
// Integer diffNum = enterNum-realNum;
// BigDecimal diffWeight = realWeight.subtract(enterWeight);
// BigDecimal diffVolume = realVolume.subtract(enterVolume);
// WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId);
// waybillEntity.setStockCount(Math.max(waybillEntity.getStockCount() + diffNum, 0));
// waybillEntity.setStockWeight(waybillEntity.getStockWeight().add(diffWeight).compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : diffWeight);
// waybillEntity.setStockVolume(waybillEntity.getStockVolume().add(diffVolume).compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : diffVolume);
// Integer totalCount = waybillEntity.getTotalCount();
// Integer stockCount = waybillEntity.getStockCount();
// if(totalCount.equals(stockCount)){
// waybillEntity.setWaybillStatus("10");
// try{
// TrunklineWaybillTrackEntity waybillTrackEntity = new TrunklineWaybillTrackEntity();
// waybillTrackEntity.setWarehouseId(billladingEntity.getWarehouseId());
// waybillTrackEntity.setWarehouseName(billladingEntity.getWarehouseName());
// waybillTrackEntity.setWaybillId(waybillId);
// waybillTrackEntity.setWaybillNo(waybillNo);
// waybillTrackEntity.setTrackType("20");
// waybillTrackEntity.setRefer("已入库");
// waybillTrackEntity.setOperationRemark("运单入库:"+enterNum+"/"+totalCount+",入库类型:【批量入库】,入库时间:"+ CommonUtil.dateToString(new Date()));
// trunklineWaybillTrackService.save(waybillTrackEntity);
// }catch (Exception e){
// log.warn("#################updateBillladingWaybillNum: 存入日志失败");
// }
// }
// warehouseWaybillClient.updateEntity(waybillEntity);
}
billladingEntity.setRealNum(stockNum);
billladingEntity.setRealWeight(stockWeight);
billladingEntity.setRealVolume(stockVolume);
TrunklineBillladingNumVO numVO = billladingWaybillService.getNumVOByBillladingId(billladingId);
billladingEntity.setRealNum(numVO.getNum());
billladingEntity.setRealWeight(numVO.getWeight());
billladingEntity.setRealVolume(numVO.getVolume());
updateById(billladingEntity);
billladingWaybillService.updateBillladingFeeByBillladingId(billladingEntity);

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

@ -6,6 +6,7 @@ import com.logpm.trunkline.entity.TrunklineBillladingWaybillEntity;
import com.logpm.trunkline.entity.TrunklineWaybillOrderEntity;
import com.logpm.trunkline.mapper.TrunklineBillladingWaybillMapper;
import com.logpm.trunkline.service.ITrunklineBillladingWaybillService;
import com.logpm.trunkline.vo.TrunklineBillladingNumVO;
import com.logpm.trunkline.vo.TrunklineBillladingWaybillVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -134,8 +135,18 @@ public class TrunklineBillladingWaybillServiceImpl extends BaseServiceImpl<Trunk
}
@Override
public void updateByBillladingIdAndWaybillNo(Long billladingId, String waybillNo) {
baseMapper.updateByBillladingIdAndWaybillNo(billladingId,waybillNo);
public void updateByBillladingIdAndWaybillNo(Long billladingId, String waybillNo,Integer planNum) {
baseMapper.updateByBillladingIdAndWaybillNo(billladingId,waybillNo,planNum);
}
@Override
public List<TrunklineBillladingWaybillEntity> findNoFinishWaybillByBillladingId(Long billladingId) {
return baseMapper.findNoFinishWaybillByBillladingId(billladingId);
}
@Override
public TrunklineBillladingNumVO getNumVOByBillladingId(Long billladingId) {
return baseMapper.getNumVOByBillladingId(billladingId);
}
}

7
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -884,8 +884,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
//判断该包件是否已存在与其他托盘上
QueryWrapper<WarehouseTrayGoodsEntity> qw = new QueryWrapper<>();
qw.eq("association_value",orderPackageCode)
.eq("tenant_id","627683");
qw.eq("association_value",orderPackageCode);
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(qw);
if(!Objects.isNull(trayGoodsEntity)){
@ -900,8 +899,7 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
}
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsEntityQueryWrapper = new QueryWrapper<>();
updownGoodsEntityQueryWrapper.eq("association_value",orderPackageCode)
.eq("tenant_id","627683");
updownGoodsEntityQueryWrapper.eq("association_value",orderPackageCode);
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(updownGoodsEntityQueryWrapper);
if(!Objects.isNull(updownGoodsEntity)){
String positionCode = updownGoodsEntity.getPositionCode();
@ -957,7 +955,6 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
//查询打托方式信息
QueryWrapper<WarehouseTrayTypeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_code",trayCode)
.eq("tenant_id","627683")
.eq("is_deleted",0);
WarehouseTrayTypeEntity trayTypeEntity = baseMapper.selectOne(queryWrapper);
if(Objects.isNull(trayTypeEntity)){

Loading…
Cancel
Save