Browse Source

Merge branch 'dev' into pre-production

# Conflicts:
#	blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/ZbFactoryAccountsInterceptor.java
newStockUp
zhenghaoyu 1 year ago
parent
commit
d6e048fb1a
  1. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java
  2. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.xml
  3. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java
  4. 158
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  5. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  6. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  7. 27
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  8. 25
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java
  9. 8
      blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/ZbFactoryAccountsInterceptor.java

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationPackageMapper.java

@ -141,4 +141,6 @@ public interface DistributionReservationPackageMapper extends BaseMapper<Distrib
List<DistributionStockPackageVO> listPackage(@Param("reservationId") Long reservationId);
List<DistributionParcelTrayVO> listPackageTray(@Param("reservationId") Long reservationId);
// void selectStockUpList(@Param("reservationId")Long reservationId);
}

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

@ -292,6 +292,9 @@ WHERE
</where>
GROUP BY lwtg.tray_id, lwtg.tray_code;
</select>
<!-- <select id="selectStockUpList" >-->
<!-- </select>-->
</mapper>

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java

@ -2,6 +2,7 @@ package com.logpm.distribution.service;
import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO;
import com.logpm.distribution.dto.app.StockupDTO;
import com.logpm.distribution.entity.DistributionParcelListEntity;
/**
@ -102,4 +103,16 @@ public interface IDistributionAsyncService {
* @param parcelListEntity
*/
void checkStockArticleLoadingStatus(DistributionParcelListEntity parcelListEntity);
/**
* 市的扫描修改 部分状态
* @param stockupDTO
*/
void stockupUpdateState(StockupDTO stockupDTO);
/**
* 自提的扫描修改 部分状态
* @param stockupDTO
*/
void stockupSelfUpdateState(StockupDTO stockupDTO);
}

158
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -1,12 +1,11 @@
package com.logpm.distribution.service.impl;
import com.alibaba.druid.sql.visitor.functions.If;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO;
import com.logpm.distribution.dto.app.StockupDTO;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.mapper.*;
import com.logpm.distribution.service.*;
@ -22,6 +21,7 @@ import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant;
import org.springblade.common.constant.order.OrderStatusConstant;
import org.springblade.common.constant.reservation.ReservationLoadingStatusConstant;
import org.springblade.common.constant.reservation.ReservationSigningStatusConstant;
import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.core.tool.utils.Func;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -29,7 +29,7 @@ import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
import java.util.concurrent.atomic.AtomicReference;
@Log4j2
@ -47,8 +47,14 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
private final DistributionDeliveryListMapper distributionDeliveryListMapper;
private final DistributionSignforMapper distributionSignforMapper;
private final DistributionReservationMapper distributionReservationMapper;
private final DistributionReservationPackageMapper distributionReservationPackageMapper;
private final DistributionParcelListServiceImpl distributionParcelListService;
private final DistributionStockupMapper distributionStockupService;
private final DistributionStockupInfoMapper distributionStockupInfoMapper;
private final DistributionReservationStockarticleMapper distributionReservationStockarticleMapper;
private final DistributionReservationStocklistMapper distributionReservationStocklistMapper;
private final DistrilbutionBillStockMapper distrilbutionBillStockMapper;
private final DistributionDeliveryDetailsMapper distributionDeliveryDetailsMapper;
private final DistributionParcelListMapper distributionParcelListMapper;
@ -404,6 +410,150 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
}
}
distributionStockArticleService.updateById(stockArticleEntity);
}
/**
* 市的扫描修改 部分状态
* @param stockupDTO
*/
@Override
public void stockupUpdateState(StockupDTO stockupDTO) {
//查询备货状态
DistributionStockupEntity distributionStockupEntity = distributionStockupService.selectById(stockupDTO.getStockupId());
if(distributionStockupEntity.getStockupStatus().equals(StockupStatusConstant.beihuozhong.getValue())){
//备货中
//判断有几个预约
List<DistributionStockupInfoEntity> distributionStockupInfoEntities = distributionStockupInfoMapper.selectList(Wrappers.<DistributionStockupInfoEntity>query().lambda()
.eq(DistributionStockupInfoEntity::getStockupId, stockupDTO.getStockupId())
);
AtomicReference<Integer> nu = new AtomicReference<>(0); //全部
AtomicReference<Integer> nuy = new AtomicReference<>(0); // 以扫
AtomicReference<Integer> ku = new AtomicReference<>(0); // 库
distributionStockupInfoEntities.forEach( i ->{
//预约包件
//查询已扫描的数量
List<DistributionStockEntity> list = distributionStockService.selectList(Wrappers.<DistributionStockEntity>query().lambda()
.eq(DistributionStockEntity::getReservationId, i.getReservationId())
.eq(DistributionStockEntity::getStockupId, stockupDTO.getStockupId())
);
int size = list.size();
nuy.set(nuy.get() + size);
//查询全部数量
List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationStockarticleMapper.selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId, i.getReservationId())
.apply("stock_article_status in (1,3)")
);
if(distributionReservationStockarticleEntities.size() > 0 ){
int sum = distributionReservationStockarticleEntities.stream().mapToInt(DistributionReservationStockarticleEntity::getReservationNum).sum();
nu.set(nu.get() + sum);
}
//查询数量库存品
List<DistributionReservationStocklistEntity> distributionReservationStocklistEntities = distributionReservationStocklistMapper.selectList(Wrappers.<DistributionReservationStocklistEntity>query().lambda()
.eq(DistributionReservationStocklistEntity::getReservationId, i.getReservationId())
.apply("stock_list_status in (1,3)")
);
if(distributionReservationStocklistEntities.size() > 0){
int sum = distributionReservationStocklistEntities.stream().mapToInt(DistributionReservationStocklistEntity::getReservationNum).sum();
ku.set(ku.get()+ sum);
}
});
//判断数量
int i = (nu.get()+ ku.get()) - nuy.get();
if(i > 0){
// 有数量
}else if (i== 0){
//修改完成状态
//修改备货状态
DistributionStockupEntity distributionStockup = new DistributionStockupEntity();
distributionStockup.setId(stockupDTO.getStockupId());
distributionStockup.setStockupStatus(StockupStatusConstant.yibeihuo.getValue());
distributionStockupService.updateById(distributionStockup);
DistributionReservationEntity reservationEntity = new DistributionReservationEntity();
reservationEntity.setId(stockupDTO.getReservationId());
reservationEntity.setStockupStatus(StockupStatusConstant.yibeihuo.getValue());
distributionReservationMapper.updateById(reservationEntity);
}
}else {
//没有
//修改备货状态
DistributionStockupEntity distributionStockup = new DistributionStockupEntity();
distributionStockup.setId(stockupDTO.getStockupId());
distributionStockup.setStockupStatus(StockupStatusConstant.beihuozhong.getValue());
distributionStockupService.updateById(distributionStockup);
//修改预约状态
DistributionReservationEntity reservationEntity = new DistributionReservationEntity();
reservationEntity.setId(stockupDTO.getReservationId());
reservationEntity.setStockupStatus(StockupStatusConstant.beihuozhong.getValue());
distributionReservationMapper.updateById(reservationEntity);
}
}
/**
* 自提的扫描修改 部分状态
* @param stockupDTO
*/
@Override
public void stockupSelfUpdateState(StockupDTO stockupDTO) {
DistributionStockupEntity distributionStockupEntity = distributionStockupService.selectById(stockupDTO.getStockupId());
if(distributionStockupEntity.getStockupStatus().equals(StockupStatusConstant.yibeihuo)){
//查询全部订单数据
List<DistrilbutionBillStockEntity> distrilbutionBillStockEntities = distrilbutionBillStockMapper.selectList(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, stockupDTO.getReservationId())
.apply("order_status in (1,2)")
);
//查询包件数据
AtomicReference<Integer> nu = new AtomicReference<>(0); //全部包件数据
distrilbutionBillStockEntities.forEach( i -> {
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListMapper.selectList(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId())
);
int size = distributionParcelListEntities.size();
nu.set(nu.get()+ size);
});
//以备数量
List<DistributionStockEntity> list = distributionStockService.selectList(Wrappers.<DistributionStockEntity>query().lambda()
.eq(DistributionStockEntity::getBillLadingId, stockupDTO.getReservationId())
);
//查询库存品数据
List<DistributionDeliveryDetailsEntity> detailsEntities = distributionDeliveryDetailsMapper.selectList(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda()
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, stockupDTO.getReservationId())
.apply("inventory_status in (1,2)")
);
int sum = detailsEntities.stream().mapToInt(DistributionDeliveryDetailsEntity::getQuantity).sum();
int i = (sum + nu.get()) - list.size();
if(i > 0){
//有数据
}else if( i == 0){
//改为已完成
//修改备货状态
DistributionStockupEntity distributionStockup = new DistributionStockupEntity();
distributionStockup.setId(stockupDTO.getStockupId());
distributionStockup.setStockupStatus(StockupStatusConstant.yibeihuo.getValue());
distributionStockupService.updateById(distributionStockup);
}
}else{
//修改备货状态
DistributionStockupEntity distributionStockup = new DistributionStockupEntity();
distributionStockup.setId(stockupDTO.getStockupId());
distributionStockup.setStockupStatus(StockupStatusConstant.beihuozhong.getValue());
distributionStockupService.updateById(distributionStockup);
}
}
}

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

@ -1541,6 +1541,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
log.error("deliveryListDTO参数异常+{" + deliveryListDTO + "}");
return R.fail("服务器正忙!!");
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Func.isEmpty(myCurrentWarehouse)){
return R.fail("无仓库信息!!!");
}
//首先对配送任务进行修改
//查询出配送任务的基本信息
DistributionDeliveryListEntity deliveryListEntity = this.getById(deliveryListDTO.getId());
@ -1643,6 +1647,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
reservationEntity.setDeliveryType(DistributionTypeConstant.shangpei.getValue());
reservationEntity.setPeriodOfTime(ServiceConstant.RESERVATION_PERIOED_TIME_DAY);
reservationEntity.setStockupStatus(ReservationStockupStatusConstant.daibeihuo.getValue());
reservationEntity.setWarehouseId(myCurrentWarehouse.getId());
BladeUser user = AuthUtil.getUser();
reservationEntity.setCreateUser(user.getUserId());
reservationEntity.setDeliveryWay(reservation.getDeliveryWay());

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -112,7 +112,9 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
Object o = distributionParcelList.get("id");
IPage<DistributionParcelListVO> parcelListOwn = baseMapper.getParcelListOwn(page, Long.parseLong((String) o));
parcelListOwn.getRecords().forEach(i ->{
if(ObjectUtils.isNotNull(i) && ObjectUtils.isNotNull(i.getStockupStatus())){
i.setStockupStatusName(DictBizCache.getValue(DictBizConstant.STOCKUP_STATUS,i.getStockupStatus()));
}
});
return parcelListOwn;
}

27
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -254,6 +254,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationEntity.setReservationStatus(ReservationStatusConstant.daiqueren.getValue());
//新建预约单订单处于未备货状态
reservationEntity.setStockupStatus(ReservationStockupStatusConstant.weibeihuo.getValue());
reservationEntity.setWarehouseId(myCurrentWarehouse.getId());
this.save(reservationEntity);
//获取新增预约信息的编号
Long reservationId = reservationEntity.getId();
@ -275,6 +276,12 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
AtomicReference<BigDecimal> initTotal = new AtomicReference<>(BigDecimal.ZERO);
//存在订单构建预约订单关联信息
if (!Func.isEmpty(stockArticleList)) {
boolean flag = stockArticleList.stream().anyMatch(s -> s.getReservationStatus().equals(OrderReservationStatusConstant.yiyueyue.getValue()));
if (flag){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
log.error("预约选择订单被多次预约");
return R.fail("订单已预约!!!");
}
//存在订单的情况下才会对预约和包件的关系进行维护
//选择了订单但是未进行包件的选择,默认选择了订单下的所有在库包件
stockArticleList.forEach(s -> {
@ -542,6 +549,11 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
log.error("参数异常:+{" + stockUpInfo + "}");
return R.fail("服务器正忙!!!");
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Func.isEmpty(myCurrentWarehouse)){
log.error("myCurrentWarehouse参数异常:+{"+myCurrentWarehouse+"}");
return R.fail("请先选择作业仓库!!!");
}
boolean result = false;
try {
//获取前端携带批量转备货的id
@ -567,6 +579,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
stockupEntity.setTypeService(DistributionTypeConstant.shipie.getValue());
//设置备货任务备货时间
stockupEntity.setStockupDate(date);
//设置仓库
stockupEntity.setWarehouseId(myCurrentWarehouse.getId());
//保存备货任务数据获取备货数据ID
result = distributionStockupService.save(stockupEntity);
Long id = stockupEntity.getId();
@ -712,6 +726,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionStockupEntity.setTypeService(DistributionTypeConstant.shipie.getValue());
//编码生成规则 BH+仓库编码+年月日+序号00001
distributionStockupEntity.setStockupCode(bianMa());
distributionStockupEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionStockupService.save(distributionStockupEntity);
}
HashSet<String> warehouseNames = new HashSet<>();
@ -1220,6 +1235,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//1、添加配送任务
DistributionStockupDTO stockup = allocationDTO.getStockup();
DistributionStockupEntity stockupEntity = Func.copy(stockup, DistributionStockupEntity.class);
stockupEntity.setWarehouseId(myCurrentWarehouse.getId());
if (!Func.isBlank(stockup.getForkliftName())) {
stockupEntity.setAssignTime(new Date());
stockupEntity.setForkliftId(stockupEntity.getForkliftId());
@ -1233,6 +1249,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
BladeUser user = AuthUtil.getUser();
stockupEntity.setStockupUser(user.getUserName());
stockupEntity.setStockupUserId(user.getUserId());
stockupEntity.setWarehouseId(myCurrentWarehouse.getId());
stockupEntity.setLoaderId(stockup.getLoaderId());
stockupEntity.setStockupArea(stockup.getGoodsAreaName());
stockupEntity.setOutboundDate(stockup.getOutboundDate());
@ -1255,8 +1272,6 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliveryListService.save(distributionDeliveryListEntity);
//获取所有订单
List<DistributionStockArticleDTO> stockArticle = allocationDTO.getStockArticle();
//根据运单号进行分组
//TODO 这里先根据运单号进行运单信息查询,后期根据运单进行
Map<String, List<DistributionStockArticleDTO>> mallClient = stockArticle.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getWaybillNumber));
@ -1279,6 +1294,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
DistributionReservationDTO reservation = allocationDTO.getReservation();
DistributionReservationEntity reservationEntity = Func.copy(reservation, DistributionReservationEntity.class);
reservationEntity.setWaybillNo(k);
reservationEntity.setWarehouseId(myCurrentWarehouse.getId());
reservationEntity.setReservationStatus(ReservationStatusConstant.daipeisong.getValue());
//这里采用订单上的收货信息
this.save(reservationEntity);
@ -1808,6 +1824,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
if (Func.isEmpty(myCurrentWarehouse)){
return R.fail("无仓库信息!!!");
}
//构建预约单
DistributionReservationEntity reservationEntity = new DistributionReservationEntity();
Func.copy(distributionReservationDTO, reservationEntity);
@ -1847,6 +1864,12 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
if (!Func.isEmpty(stockArticleList)) {
//存在订单的情况下才会对预约和包件的关系进行维护
//选择了订单但是未进行包件的选择,默认选择了订单下的所有在库包件
boolean flag = stockArticleList.stream().anyMatch(s -> s.getReservationStatus().equals(OrderReservationStatusConstant.yiyueyue.getValue()));
if (flag){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
log.error("预约选择订单被多次预约");
return R.fail("订单已预约!!!");
}
stockArticleList.forEach(s -> {
// storeName.add(s.getStoreName());
// mallName.add(s.getMallName());

25
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java

@ -127,6 +127,9 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
@Autowired
private IDisStockListDetailService disStockListDetailService;
@Autowired
private IDistributionAsyncService distributionAsyncService;
@Override
public IPage<DistributionStockupVO> selectDistributionStockupPage(IPage<DistributionStockupVO> page, DistributionStockupVO distributionStockup) {
@ -584,8 +587,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
public IPage<DistributionStockupVO> detailOrderOwn(IPage<Object> page, Long id) {
IPage<DistributionStockupVO> distributionStockupVOIPage = baseMapper.detailOrderOwn(page, id);
distributionStockupVOIPage.getRecords().forEach(o -> {
if(ObjectUtils.isNotNull(o.getStockArticleId())){
Integer integer = distributionStockService.selectCount(Long.parseLong(o.getStockArticleId()));
o.setNumber(integer);
}
});
return distributionStockupVOIPage;
}
@ -844,11 +849,10 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
return 2;
}else{
//扫描操作
//修改备货状态
DistributionStockupEntity distributionStockup = new DistributionStockupEntity();
distributionStockup.setId(distributionStockupEntity.getId());
distributionStockup.setStockupStatus(StockupStatusConstant.beihuozhong.getValue());
return distributionStockupService.updateById(distributionStockup);
distributionAsyncService.stockupSelfUpdateState(stockupDTO);
return 1;
}
}else{
@ -924,10 +928,13 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
return 2;
} else {
//修改备货状态
DistributionStockupEntity distributionStockup = new DistributionStockupEntity();
distributionStockup.setId(distributionStockupEntity.getId());
distributionStockup.setStockupStatus(StockupStatusConstant.beihuozhong.getValue());
return distributionStockupService.updateById(distributionStockup);
// DistributionStockupEntity distributionStockup = new DistributionStockupEntity();
// distributionStockup.setId(distributionStockupEntity.getId());
// distributionStockup.setStockupStatus(StockupStatusConstant.beihuozhong.getValue());
// distributionStockupService.updateById(distributionStockup);
distributionAsyncService.stockupUpdateState(stockupDTO);
return 1;
}
} else {

8
blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/ZbFactoryAccountsInterceptor.java

@ -49,8 +49,12 @@ public class ZbFactoryAccountsInterceptor implements HandlerInterceptor {
params.put("sign_method",signMethod);
params.put("timestamp",timestamp);
params.put("v",v);
log.info(" 验证参数 {}",bodyJson);
String s = body.replaceAll(" +", "");
String s = body.replaceAll("\\s+", "");
log.info("################### params={}",params);
log.info("################### secretkey={}",zbFactoryProperties.getSecretkey());
log.info("################### signMethod={}",signMethod);
String newSign = QmSignUntil.signTopRequest(params, zbFactoryProperties.getSecretkey(), signMethod, s);
log.info(" 签名 old {}",sign);
log.info(" 新签名 old {}",newSign);

Loading…
Cancel
Save