Browse Source

Merge branch 'dev' into pre-production

newStockUp
pref_mail@163.com 1 year ago
parent
commit
29ff3f6308
  1. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java
  2. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml
  3. 51
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  4. 47
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.java

@ -111,4 +111,11 @@ public interface DistributionStockListMapper extends BaseMapper<DistributionStoc
List<DistributionStockListVO> getStockListInfo(@Param("par")DistributionStockListEntity distributionStockListEntity);
DistributionStockListEntity selectStockInforByOrderPackageCode(@Param("orderPackageCode") String orderPackageCode);
/**
* 扣减库存品对应的在库数量
* @param inventoryId
* @param loadedNub
*/
int deductionQuantityStock(@Param("stockListId") Long inventoryId,@Param("decreaseNum") Integer loadedNub);
}

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockListMapper.xml

@ -290,6 +290,9 @@
outbound_quantity = outbound_quantity + #{num}
where id = #{stockListId}
</update>
<update id="deductionQuantityStock">
UPDATE logpm_distribution_stock_list SET quantity_stock = (quantity_stock - #{decreaseNum}) , quantity_occupied = (quantity_occupied - #{decreaseNum}) , outbound_quantity = (outbound_quantity + #{decreaseNum}) WHERE id = #{stockListId}
</update>
<select id="getAllStockMall" resultType="com.logpm.distribution.vo.app.StockMallVO">
select ldsl.market_id marketId,

51
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -486,6 +486,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
// synchronized
public R loadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
//查询该包件是否能够从库存品包件表中查到
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) {
throw new CustomerException(403, "仓库信息不能为空");
@ -495,6 +497,19 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// 属于该配送任务需要进行是否属于该客户进行判断
// 如果属于该客户则进行装车扫描
//
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
.eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode())
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(list)){
//满足条件此码必定为库存品
//判断该库存品是否属于当前客户
List<DisStockListDetailEntity> collect = list.stream().filter(l -> l.getReservationId().equals(distrilbutionloadingscanDTO.getReservationId())).collect(Collectors.toList());
if (Func.isNotEmpty(collect)){
return Resp.scanFail("请在库存品页面扫描此码", "请在库存品页面扫描此码");
}
return Resp.scanFail("此码不是订制品", "此码不是订制品");
}
//获取当前用户司机
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
//异步确认包条扫描信息
@ -559,20 +574,21 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
loadscanEntity.setScanUser(user.getNickName());
loadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId());
loadscanEntity.setIsAbnormalLoading(1);
loadscanEntity.setLoadedNub(parcelListEntity.getQuantity());
distributionLoadscanService.save(loadscanEntity);
//出库
warehouseUpdownTypeClient.downPackage(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId());
// warehouseUpdownTypeClient.downPackageOrDelTray(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId());
//订单扣减在库数量
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId());
stockArticleEntity.setHandQuantity(stockArticleEntity.getHandQuantity() - parcelListEntity.getQuantity());
distributionStockArticleService.updateById(stockArticleEntity);
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId());
// stockArticleEntity.setHandQuantity(stockArticleEntity.getHandQuantity() - parcelListEntity.getQuantity());
// distributionStockArticleService.updateById(stockArticleEntity);
//查询本车次是否第一次扫码,没有则更新上车时间
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//扣减订单的在库数量
Integer k = distributionStockArticleMapper.deductionHandQuantity(loadscanEntity.getOrderId(), loadscanEntity.getLoadedNub());
distributionLoadscanService.save(loadscanEntity);
//这里还需要一个维护状态的方法
//异步维护状态
// str.append("包件装车");
@ -594,7 +610,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
return R.fail(5000, "异常装车");
// return Resp.scanFail("装车失败","程序出错,请联系彪桑");
} else {
return Resp.scanFail("装车失败", "窜货");
if (parcelListEntity.getConditions() == 2){
return Resp.scanFail("此包件不是订制品", "此包件不是订制品");
}else {
return Resp.scanFail("装车失败", "窜货");
}
}
} else {
shangpeiFlag = reservationEntityList.stream().allMatch(r -> r.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue()));
@ -2093,15 +2114,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//异步处理状态信息
distributionAsyncService.changeMarketDeliveryListStatus(distributionLoadscaninvnEntity.getOrderPackageCode(), distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId());
//处理出库问题
DistributionStockListEntity distributionStockListEntity = distributionStockListMapper.selectOne(Wrappers.<DistributionStockListEntity>query().lambda().eq(DistributionStockListEntity::getId, distributionLoadscaninvnEntity.getInventoryId()));
BigDecimal quantityStock = new BigDecimal(distributionStockListEntity.getQuantityStock());
BigDecimal loadedNub = new BigDecimal(distributionLoadscaninvnEntity.getLoadedNub());
int stockListQuantityStock = quantityStock.subtract(loadedNub).intValue();
int stockListOutboundQuantity = quantityStock.add(loadedNub).intValue();
distributionStockListEntity.setQuantityStock(stockListQuantityStock);
distributionStockListEntity.setQuantityOccupied(stockListOutboundQuantity);
distributionStockListEntity.setOutboundQuantity(stockListOutboundQuantity);
distributionStockListMapper.updateById(distributionStockListEntity);
//扣减出库数量
distributionStockListMapper.deductionQuantityStock(distributionLoadscaninvnEntity.getInventoryId(),distributionLoadscaninvnEntity.getLoadedNub());
// DistributionStockListEntity distributionStockListEntity = distributionStockListMapper.selectOne(Wrappers.<DistributionStockListEntity>query().lambda().eq(DistributionStockListEntity::getId, distributionLoadscaninvnEntity.getInventoryId()));
// BigDecimal quantityStock = new BigDecimal(distributionStockListEntity.getQuantityStock());
// BigDecimal loadedNub = new BigDecimal(distributionLoadscaninvnEntity.getLoadedNub());
// int stockListQuantityStock = quantityStock.subtract(loadedNub).intValue();
// int stockListOutboundQuantity = quantityStock.add(loadedNub).intValue();
// distributionStockListEntity.setQuantityStock(stockListQuantityStock);
// distributionStockListEntity.setQuantityOccupied(stockListOutboundQuantity);
// distributionStockListEntity.setOutboundQuantity(stockListOutboundQuantity);
// distributionStockListMapper.updateById(distributionStockListEntity);
} else {
return Resp.scanFail("窜货", "窜货");
}

47
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -122,6 +122,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
private final DistributionReservationMapper distributionReservationMapper;
private final IDisStockListDetailService disStockListDetailService;
private final IDistributionStockListService distributionStockListService;
private final DistributionStockListMapper distributionStockListMapper;
private final DistributionAddvalueMapper distributionAddvalueMapper;
private final IDistributionAddvalueService distributionAddvalueService;
private final IDistributionAddvaluePackageService distributionAddvaluePackageService;
@ -295,6 +296,21 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
if (Objects.isNull(myCurrentWarehouse)) {
throw new CustomerException(403, "仓库信息不能为空");
}
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
.eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode())
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
);
if (Func.isNotEmpty(list)){
//满足条件此码必定为库存品
//判断该库存品是否属于当前客户
List<DisStockListDetailEntity> collect = list.stream().filter(l -> l.getReservationId().equals(distrilbutionloadingscanDTO.getReservationId())).collect(Collectors.toList());
if (Func.isNotEmpty(collect)){
return Resp.scanFail("请在库存品页面扫描此码", "请在库存品页面扫描此码");
}
return Resp.scanFail("此码不是订制品", "此码不是订制品");
}
List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
//查询该客户是否存在该包件信息
List<DistributionParcelListEntity> collect = parcelListEntityList.stream().filter(p -> p.getOrderPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
@ -950,6 +966,18 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
// 1、查询配送任务是否存在库存品 ---- > 没有 此码无效
// 2、查询该客户是否存在满足的库存品 --- 没有 查看是否存在计划 窜货
// 3、是否异常签收
//判断扫码是否是包件
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
if (Func.isNotEmpty(parcelListEntities)){
boolean isHave = parcelListEntities.stream().map(DistributionParcelListEntity::getOrderPackageCode).anyMatch(c -> c.contains(distrilbutionloadingscanDTO.getBarcode()));
if (Func.isNotEmpty(isHave)){
return Resp.scanFail("请在订制品页面扫描此码", "请在订制品页面扫描此码");
}else {
return Resp.scanFail("扫描错误", "未知二维码");
}
}
List<DisStockListDetailEntity> detailEntities = distributionReservationMapper.selectInventoryListByReservation(distrilbutionloadingscanDTO.getReservationId());
if (Func.isEmpty(detailEntities)) {
return Resp.scanFail("此码无效", "此码无效");
@ -973,6 +1001,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
// 库存品进行装车,这里需要对库存品扫描数据进行签收的状态标记
loadscaninvnEntity.setSigningUserId(user.getUserId());
loadscaninvnEntity.setSigningUser(user.getUserName());
loadscaninvnEntity.setReceivedQuantity(inventory.get(0).getNum());
loadscaninvnEntity.setSignforState(LoadScanSigningStatusConstant.yiqianshou.getValue());
loadscaninvnEntity.setSigningTime(simpleDateFormat.format(new Date()));
loadscaninvnEntity.setOneQclick(1);
@ -1036,14 +1065,15 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
Integer j = distributionSignforMapper.updateSignforNum(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), distributionLoadscaninvnEntity.getPackageNub());
//更新签收人
Integer i = distributionSignforMapper.updateSignUser(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), AuthUtil.getUser());
//扣减库存
DistributionStockListEntity stockListEntity = distributionStockListService.getById(inventory.get(0).getStockListId());
stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - distributionLoadscaninvnEntity.getPackageNub());
stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - distributionLoadscaninvnEntity.getPackageNub());
stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + distributionLoadscaninvnEntity.getPackageNub());
distributionStockListService.updateById(stockListEntity);
distributionAsyncService.checkSignStatus(null, distributionLoadscaninvnEntity.getReservationId(),distributionLoadscaninvnEntity.getDeliveryId());
distributionStockListMapper.deductionQuantityStock(distributionLoadscaninvnEntity.getInventoryId(),distributionLoadscaninvnEntity.getLoadedNub());
// //扣减库存
// DistributionStockListEntity stockListEntity = distributionStockListService.getById(inventory.get(0).getStockListId());
// stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - distributionLoadscaninvnEntity.getPackageNub());
// stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - distributionLoadscaninvnEntity.getPackageNub());
// stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + distributionLoadscaninvnEntity.getPackageNub());
// distributionStockListService.updateById(stockListEntity);
// distributionAsyncService.checkSignStatus(null, distributionLoadscaninvnEntity.getReservationId(),distributionLoadscaninvnEntity.getDeliveryId());
}
} else if (inventory.size() == 0) {
@ -1068,7 +1098,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
return Resp.scanFail("操作失败", "操作失败");
}
distributionAsyncService.checkDeliverySignStatus(distrilbutionloadingscanDTO.getBarcode(), distrilbutionloadingscanDTO.getDeliveryId());
return Resp.scanSuccess("签收成功", "签收成功");
String str = checkSignNum(distrilbutionloadingscanDTO);
return Resp.scanSuccess("签收成功", str);
// List<DistributionLoadscaninvnEntity> distributionLoadscaninvnEntities = distributionLoadscaninvnMapper.selectList(new QueryWrapper<DistributionLoadscaninvnEntity>().lambda()

Loading…
Cancel
Save