Browse Source

Merge branch 'dev' into pre-production

newStockUp
zhenghaoyu 1 year ago
parent
commit
c73cb05fce
  1. 7
      blade-service-api/logpm-patch-api/src/main/java/com/logpm/patch/entity/SyncInventoryEntity.java
  2. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  3. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  4. 124
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  5. 4
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/AsyncDataServiceImpl.java

7
blade-service-api/logpm-patch-api/src/main/java/com/logpm/patch/entity/SyncInventoryEntity.java

@ -7,7 +7,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@ -52,18 +51,12 @@ public class SyncInventoryEntity extends TenantEntity {
private Integer inventoryId;
@ApiModelProperty(value = "同步开始时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date syncStartDate;
@ApiModelProperty(value = "同步结束时间")
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)

1
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml

@ -436,6 +436,7 @@
</if>
<if test="param.stockArticleIdsLike != null and param.stockArticleIdsLike != ''" >and ldpl.stock_article_id = #{param.stockArticleIdsLike} </if>
<if test="param.stockArticleId != null and param.stockArticleId != ''" >and ldpl.stock_article_id = #{param.stockArticleId} </if>
<if test="param.conditions != null and param.conditions != ''" >and ldpl.conditions = #{param.conditions} </if>
</where>

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml

@ -416,18 +416,18 @@
<if test=" param.availableQuantity != null ">and ldsa.available_quantity like
concat('%',#{param.availableQuantity},'%')
</if>
<if test=" param.groundingStatus != null ">and ldsa.grounding_status = #{param.groundingStatus}</if>
<if test=" param.genre != null ">and ldsa.genre = #{param.genre}</if>
<if test=" param.freezeStatus != null ">and ldsa.freeze_status = #{param.freezeStatus}</if>
<if test=" param.orderStatus != null ">and ldsa.order_status = #{param.orderStatus}</if>
<if test=" param.reservationStatus != null ">and ldsa.reservation_status = #{param.reservationStatus}</if>
<if test=" param.stockupStatus != null ">and ldsa.stockup_status = #{param.stockupStatus}</if>
<if test=" param.orderReceiveStatus != null ">and ldsa.order_receive_status =
<if test=" param.groundingStatus != null and param.groundingStatus != '' ">and ldsa.grounding_status = #{param.groundingStatus}</if>
<if test=" param.genre != null and param.groundingStatus != '' ">and ldsa.genre = #{param.genre}</if>
<if test=" param.freezeStatus != null and param.groundingStatus != '' ">and ldsa.freeze_status = #{param.freezeStatus}</if>
<if test=" param.orderStatus != null and param.groundingStatus != '' ">and ldsa.order_status = #{param.orderStatus}</if>
<if test=" param.reservationStatus != null and param.groundingStatus != '' ">and ldsa.reservation_status = #{param.reservationStatus}</if>
<if test=" param.stockupStatus != null and param.groundingStatus != '' ">and ldsa.stockup_status = #{param.stockupStatus}</if>
<if test=" param.orderReceiveStatus != null and param.groundingStatus != '' ">and ldsa.order_receive_status =
#{param.orderReceiveStatus}
</if>
<if test=" param.completeSet != null ">and ldsa.complete_set like concat('%',#{param.completeSet},'%')
</if>
<if test=" param.typeService != null ">and ldsa.type_service like concat('%',#{param.typeService},'%')
<if test=" param.typeService != null and param.groundingStatus != '' ">and ldsa.type_service like concat('%',#{param.typeService},'%')
</if>
<if test=" param.customerName != null and param.customerName != '' ">and ldsa.customer_name like
concat('%',#{param.customerName},'%')

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

@ -395,6 +395,10 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
if(ObjectUtils.isNull(o)){
return R.fail("参数不完整!");
}
BasicdataWarehouseEntity myCurrentWarehouse = basicdataWarehouseClient.getMyCurrentWarehouse();
if(ObjectUtils.isNull(myCurrentWarehouse)){
throw new ServiceException("请选择仓库!");
}
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
String s = String.valueOf(o);
if(s.contains(",")){
@ -403,55 +407,79 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
}else{
queryWrapper.eq("id",o);
}
queryWrapper.eq("conditions",1);
List<DistributionParcelListEntity> list1 = baseMapper.selectList(queryWrapper);
// if (!list1.isEmpty()) {
// list1.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getMaterialId))
// .forEach((k ,v) ->{
// int sum = v.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum();
// v.stream().forEach( i -> {
// //查询有没有打托数据
//
// //查询包件有没有物料
// List<DistributionParcelDetailsEntity> list = distributionParcelDetailsService.list(Wrappers.<DistributionParcelDetailsEntity>query().lambda()
// .eq(DistributionParcelDetailsEntity::getParcelListId, i.getId())
// );
// if (!list.isEmpty()) {
// //有
// list.stream().collect(Collectors.groupingBy(DistributionParcelDetailsEntity::getEncoded))
// .forEach((kk,vv) ->{
// DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity();
// BeanUtil.copyProperties(vv.get(0),parcelListEntity);
// parcelListEntity.setQuantity(sum);
// parcelListEntity.setMaterialName(vv.get(0).getName());
// parcelListEntity.setMaterialCode(vv.get(0).getEncoded());
// parcelListEntity.setMaterialUnit(vv.get(0).getUnit());
// // 添加库存品信息
// addStockList(parcelListEntity, 1);
// });
// }
// DistributionParcelListEntity parcelList = new DistributionParcelListEntity();
// parcelList.setId(i.getId());
// parcelList.setConditions(2);
// baseMapper.updateById(parcelList);
//
// });
// DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity();
// BeanUtil.copyProperties(v.get(0),parcelListEntity);
// parcelListEntity.setQuantity(sum);
// // 添加库存品信息
// addStockList(parcelListEntity, 1);
// });
//
//// for (int i = 0; i < split.length; i++) {
//// //修改订单状态
//// DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity();
//// stockArticleEntity.setId(Long.parseLong(split[i]));
//// stockArticleEntity.setGenre(2);
//// baseMapper.updateById(stockArticleEntity);
//// }
// return R.success("操作成功!");
// }
return null;
if (!list1.isEmpty()) {
Set<Long> listString = new HashSet<>();
list1.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getMaterialId))
.forEach((k ,v) ->{
int sum = v.stream().mapToInt(DistributionParcelListEntity::getQuantity).sum();
v.stream().forEach( i -> {
//查询有没有打托数据
//查询包件有没有物料
List<DistributionParcelDetailsEntity> list = distributionParcelDetailsService.list(Wrappers.<DistributionParcelDetailsEntity>query().lambda()
.eq(DistributionParcelDetailsEntity::getParcelListId, i.getId())
);
if (!list.isEmpty()) {
//有
list.stream().collect(Collectors.groupingBy(DistributionParcelDetailsEntity::getEncoded))
.forEach((kk,vv) ->{
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity();
BeanUtil.copyProperties(vv.get(0),parcelListEntity);
parcelListEntity.setQuantity(sum);
parcelListEntity.setMaterialName(vv.get(0).getName());
parcelListEntity.setMaterialCode(vv.get(0).getEncoded());
parcelListEntity.setMaterialUnit(vv.get(0).getUnit());
// 添加库存品信息
addStockList(parcelListEntity, 1);
});
}
//修改状态
DistributionParcelListEntity parcelList = new DistributionParcelListEntity();
parcelList.setId(i.getId());
parcelList.setConditions(2);
baseMapper.updateById(parcelList);
listString.add(i.getStockArticleId());
});
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity();
BeanUtil.copyProperties(v.get(0),parcelListEntity);
parcelListEntity.setQuantity(sum);
// 添加库存品信息
addStockList(parcelListEntity, 1);
});
listString.forEach( oo -> {
DistributionStockArticleEntity stockArticleEntity1 = distributionStockArticleMapper.selectById(oo);
if(ObjectUtils.isNull(stockArticleEntity1)){
throw new ServiceException("订单不存在!");
}
if(stockArticleEntity1.getTotalNumber().equals(list1.size())){
//修改订单状态
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity();
//修改
stockArticleEntity.setId(oo);
stockArticleEntity.setGenre(2);
distributionStockArticleMapper.updateById(stockArticleEntity);
}
//查询库存品的订单
List<DistributionParcelListEntity> distributionParcelListEntities = baseMapper.selectList(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getStockArticleId, oo)
.eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId())
.eq(DistributionParcelListEntity::getConditions, 2)
);
if(!distributionParcelListEntities.isEmpty() && stockArticleEntity1.getTotalNumber().equals(distributionParcelListEntities.size())){
//修改订单状态
DistributionStockArticleEntity stockArticleEntity = new DistributionStockArticleEntity();
//修改
stockArticleEntity.setId(oo);
stockArticleEntity.setGenre(2);
distributionStockArticleMapper.updateById(stockArticleEntity);
}
});
return R.success("操作成功!");
}
return R.fail("没有可用数据!");
}

4
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/AsyncDataServiceImpl.java

@ -70,7 +70,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
currentPage = one.getCurrentPage();
}else{
//查询本次同步一共多少的个订单
Integer totalNum = orderClient.getTotalCountBy(null,oldWarehouseId);
Integer totalNum = orderClient.getTotalCountBy("",oldWarehouseId);
if(totalNum == 0){
log.info("################syncOrderInfo: 暂无需要执行的数据");
throw new CustomerException(403,"暂无需要执行的数据");
@ -104,7 +104,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
for (int j = currentPage; j < totalPage; j++) {
log.info("##################syncOrderInfo: 当前同步的第{}页的数据",j+1);
try{
List<String> orderCodeList = orderClient.findOrderCodeListByPage(null,oldWarehouseId,j,pageSize);
List<String> orderCodeList = orderClient.findOrderCodeListByPage("",oldWarehouseId,j,pageSize);
syncOrderInfoService.handleData(orderCodeList,oldWarehouseId,newWarehouseId,inventoryId);

Loading…
Cancel
Save