Browse Source

修改转库存品限制

training
caoyizhong 1 year ago
parent
commit
72ddbef7e9
  1. 5
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockArticleGroundingVO.java
  2. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  4. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  5. 61
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

5
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionStockArticleGroundingVO.java

@ -8,7 +8,10 @@ import lombok.Data;
*/
@Data
public class DistributionStockArticleGroundingVO extends DistributionStockArticleEntity {
private String associationType;
private String associationType; //值
private Long trayId; //托盘ID
private String trayCode; //托盘码
private Long stockArticleId; //订单ID

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

@ -111,7 +111,7 @@ public interface DistributionStockArticleMapper extends BaseMapper<DistributionS
List<DistributionParcelNumberVO> getZeroOrderDetail(@Param("stockArticleId") Long id);
/**
*
* 查询订单的托盘信息
* @param ids
* @return
*/

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

@ -571,7 +571,7 @@
</where>
</select>
<select id="selectListGrounding" resultType="com.logpm.distribution.vo.DistributionStockArticleGroundingVO">
select ldsa.grounding_status groundingStatus,lwtg.association_type associationType
select ldsa.grounding_status groundingStatus,lwtg.association_type associationType,lwtg.tray_id trayId,lwtg.tray_code trayCode,ldsa.id stockArticleId
from logpm_distribution_stock_article ldsa
LEFT JOIN logpm_distribution_parcel_list ldpl on ldsa.id = ldpl.stock_article_id
LEFT JOIN logpm_warehouse_tray_goods lwtg on lwtg.association_id = ldpl.id

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

@ -247,7 +247,8 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
}else{
distributionParcelListDTO.setStockArticleIdsLike(trim);
}
if(ObjectUtils.isNotNull(o) && String.valueOf(o).equals("2")){
//转库存品限制
/*if(ObjectUtils.isNotNull(o) && String.valueOf(o).equals("2")){
//查询包件上架状态
//查询包件有没有上架,打托信息
List<DistributionStockArticleGroundingVO> list2 = distributionStockArticleMapper.selectListGrounding(list);
@ -262,7 +263,7 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
}
}
}
}
}*/
}
return baseMapper.pageOweList(page,distributionParcelListDTO);

61
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -40,6 +40,8 @@ import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.queryOrderVO;
import com.logpm.distribution.wrapper.DistributionParcelListWrapper;
import com.logpm.distribution.wrapper.DistributionStockArticleWrapper;
import com.logpm.warehouse.entity.WarehouseTrayGoodsEntity;
import com.logpm.warehouse.feign.IWarehouseTrayGoodsClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.DictBizConstant;
@ -118,7 +120,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
private final IDictBizClient dictBizClient;
private final IDistributionParcelNumberService parcelNumberService;
private final DistributionParcelNumberMapper distributionParcelNumberMapper;
private final IWarehouseTrayGoodsClient warehouseTrayGoodsClient;
@Override
@ -191,18 +193,57 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
.in(DistributionParcelListEntity::getStockArticleId, ids.split(","))
);
//查询包件有没有上架,打托信息
List<DistributionStockArticleGroundingVO> list2 = distributionStockArticleMapper.selectListGrounding(Arrays.asList(ids.split(",")));
/*List<DistributionStockArticleGroundingVO> list2 = distributionStockArticleMapper.selectListGrounding(Arrays.asList(ids.split(",")));
if(!list2.isEmpty()){
boolean b = list2.stream().anyMatch(i -> i.getGroundingStatus().equals(OrderPackageGroundingStatusConstant.yishangjia.getValue()));
if(b){
throw new ServiceException("选择的订单有上架的包件,请下架后在操作!");
}else{
boolean b1 = list2.stream().anyMatch(i -> ObjectUtils.isNotNull(i.getAssociationType()));
if(b1){
throw new ServiceException("选择的订单在托盘上面有包件,请解托后在操作!");
// boolean b = list2.stream().anyMatch(i -> i.getGroundingStatus().equals(OrderPackageGroundingStatusConstant.yishangjia.getValue()));
List<DistributionStockArticleGroundingVO> first = list2.stream().filter(i -> i.getGroundingStatus().equals(OrderPackageGroundingStatusConstant.yishangjia.getValue())).collect(Collectors.toList());
if(!first.isEmpty()){
// throw new ServiceException("选择的订单有上架的包件,请下架后在操作!");
List<WarehouseTrayGoodsEntity> tray = new ArrayList<>();
first.stream().forEach(distributionStockArticleGroundingVO -> {
//查询货架上面的货
List<WarehouseTrayGoodsEntity> trayIdList = warehouseTrayGoodsClient.getTrayIdList(distributionStockArticleGroundingVO.getTrayId().toString(), distributionStockArticleGroundingVO.getTrayCode());
trayIdList.addAll(tray);
});
List<WarehouseTrayGoodsEntity> collect = tray.stream().filter(i ->
{
//判断是否是相同的订单
switch (i.getAssociationType()){
case "1": //订单
if(!first.stream().anyMatch(q -> q.getStockArticleId().equals(i.getAssociationValue()))){
//不相同
return true;
}
return false;
case "2": //运单
break;
case "3": //包件
//查询订单信息
DistributionParcelListEntity byId = distributionParcelListService.getById(i.getAssociationId());
if(!first.stream().anyMatch(q -> q.getStockArticleId().equals(byId.getStockArticleId()))){
//不相同
return true;
}
return false;
case "4": //库存品
return true;
}
return true;
}
).collect(Collectors.toList());
if(!collect.isEmpty()){
throw new ServiceException("选择的订单在托盘上面有其他订单的包件,无法转为库存品,请解除其他包件后在操作!");
}
}
}
// else{
// boolean b1 = list2.stream().anyMatch(i -> ObjectUtils.isNotNull(i.getAssociationType()));
// if(b1){
// throw new ServiceException("选择的订单在托盘上面有包件,请解托后在操作!");
// }
// }
}*/
if (list1.size() > 0) {
list1.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getMaterialId))
.forEach((k ,v) ->{

Loading…
Cancel
Save