Browse Source

修改备货任务自提查询

training
caoyizhong 1 year ago
parent
commit
5bb964b070
  1. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  2. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockMapper.java
  3. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockMapper.xml
  4. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.java
  5. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml
  6. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockService.java
  7. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistrilbutionBillStockService.java
  8. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockServiceImpl.java
  9. 164
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java
  10. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java

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

@ -169,8 +169,15 @@
LEFT JOIN logpm_distribution_stock lds on lds.parcel_list_id = ldpl.id
LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = ldpl.id
<where>
ldpl.stock_article_id = #{param.stockArticleId}
<if test="param.allocationId != null and param.allocationId != ''"> and lwug.allocation_id = #{param.allocationId} </if>
<if test="param.stockArticleId != null and param.stockArticleId != ''"> and ldpl.stock_article_id = #{param.stockArticleId} </if>
<if test="param.stockArticleIdList != null ">
and ldpl.stock_article_id in
<foreach collection="param.stockArticleIdList" separator="," open="(" close=")" item="a" >
#{a}
</foreach>
</if>
</where>
</select>

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

@ -79,4 +79,5 @@ public interface DistributionStockMapper extends BaseMapper<DistributionStockEnt
DistributionStockVO selectStockupInfoSelf(@Param("pageId")Long pageId);
DistributionStockAllocationVO selectAllocation(@Param("reservationId") Long reservationId,@Param("stockupId") Long stockupId,@Param("parcelListId") Long parcelListId);
DistributionStockAllocationVO selectSelfAllocation(@Param("reservationId") Long reservationId,@Param("stockupId") Long stockupId,@Param("parcelListId") Long parcelListId);
}

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockMapper.xml

@ -99,11 +99,19 @@
<select id="selectAllocation" resultType="com.logpm.distribution.vo.DistributionStockAllocationVO">
select lwugl.position_code,lwugl.allocation_id
from logpm_distribution_stock lds
LEFT JOIN logpm_warehouse_updown_goods_log lwugl on lds.parcel_list_id = lwugl.association_id and lwugl.binding_type = 2
LEFT JOIN logpm_warehouse_updown_goods_log lwugl on lds.parcel_list_id = lwugl.association_id and lwugl.binding_type = 2 and lwugl.create_time >= DATE_SUB(NOW(), INTERVAL 1 HOUR)
where lds.reservation_id = #{reservationId} and lds.stockup_id = #{stockupId} and lds.parcel_list_id = #{parcelListId}
GROUP BY lwugl.create_time ,lwugl.position_code,lwugl.allocation_id
LIMIT 1
</select>
<select id="selectSelfAllocation" resultType="com.logpm.distribution.vo.DistributionStockAllocationVO">
select lwugl.position_code,lwugl.allocation_id
from logpm_distribution_stock lds
LEFT JOIN logpm_warehouse_updown_goods_log lwugl on lds.parcel_list_id = lwugl.association_id and lwugl.binding_type = 2 and lwugl.create_time >= DATE_SUB(NOW(), INTERVAL 1 HOUR)
where lds.bill_lading_id = #{reservationId} and lds.stockup_id = #{stockupId} and lds.parcel_list_id = #{parcelListId}
GROUP BY lwugl.create_time ,lwugl.position_code,lwugl.allocation_id
LIMIT 1
</select>
</mapper>

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.java

@ -59,9 +59,9 @@ public interface DistrilbutionBillStockMapper extends BaseMapper<DistrilbutionBi
List<DistributionStockupOrderListVO> selectDistrilbutionBillSelf(@Param("reservationId")Long reservationId);
DistributionStockupSelfVO selectDistrilbutionBillPackSelf(@Param("param") StockupDTO stockupDTO);
List<DistributionStockupSelfVO> selectDistrilbutionBillPackSelf(@Param("param") StockupDTO stockupDTO);
DistributionStockupSelfVO selectDistrilbutionBillPackWuSelf(@Param("reservationId")Long reservationId,@Param("stockupId") Long stockupId);
List<DistributionStockupSelfVO> selectDistrilbutionBillPackWuSelf(@Param("reservationId")Long reservationId,@Param("stockupId") Long stockupId);
DistributionStockupSelfVO selectDistrilbutionBillOverPackWuSelf(@Param("param")StockupDTO stockupDTO);
}

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillStockMapper.xml

@ -11,13 +11,13 @@
select * from logpm_distrilbution_bill_stock where is_deleted = 0
</select>
<select id="selectDistrilbutionBillPackSelf" resultType="com.logpm.distribution.vo.DistributionStockupSelfVO">
select
select DISTINCT
(
SELECT COUNT(lwug.id)
FROM logpm_distribution_parcel_list lpl
LEFT JOIN logpm_warehouse_updown_goods lwug on lwug.association_id = lpl.id
where
lpl.stock_article_id = ldbs.stock_article_id and lwug.allocation_id = #{param.allocationId}
lwug.allocation_id = #{param.allocationId}
) planNum ,(
SELECT COUNT(lt.id)
FROM logpm_distribution_stock lt

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockService.java

@ -84,4 +84,12 @@ public interface IDistributionStockService extends BaseService<DistributionStock
* @return
*/
DistributionStockAllocationVO selectAllocation(Long reservationId, Long stockupId, Long parcelListId);
/**
* 查询有无配货历史货位
* @param reservationId
* @param stockupId
* @param parcelListId
* @return
*/
DistributionStockAllocationVO selectSelfAllocation(Long reservationId, Long stockupId, Long parcelListId);
}

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistrilbutionBillStockService.java

@ -70,9 +70,9 @@ public interface IDistrilbutionBillStockService extends BaseService<Distrilbutio
*
* @param stockupDTO@return
*/
DistributionStockupSelfVO selectDistrilbutionBillPackSelf(StockupDTO stockupDTO);
List<DistributionStockupSelfVO> selectDistrilbutionBillPackSelf(StockupDTO stockupDTO);
DistributionStockupSelfVO selectDistrilbutionBillPackWuSelf(Long reservationId, Long stockupId);
List<DistributionStockupSelfVO> selectDistrilbutionBillPackWuSelf(Long reservationId, Long stockupId);
DistributionStockupSelfVO selectDistrilbutionBillOverPackWuSelf(StockupDTO stockupDTO);
}

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

@ -335,4 +335,9 @@ public class DistributionStockServiceImpl extends BaseServiceImpl<DistributionSt
return baseMapper.selectAllocation(reservationId,stockupId,parcelListId);
}
@Override
public DistributionStockAllocationVO selectSelfAllocation(Long reservationId, Long stockupId, Long parcelListId) {
return baseMapper.selectSelfAllocation(reservationId,stockupId,parcelListId);
}
}

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

@ -65,7 +65,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.function.Predicate;
@ -515,9 +514,17 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
y.setScanNum(y.getScanNum()+1);
}
//t托盘信息
if(ObjectUtils.isNotNull(y.getTrayId()) && y.getTrayId().equals(i.getTrayId())){
if(ObjectUtils.isNotNull(y.getTrayId()) && !y.getTrayId().equals(i.getTrayId())){
y.setPallet(y.getPallet()+","+i.getPallet());
}
//订单自编号信息
if(ObjectUtils.isNotNull(y.getOrderCode()) && !y.getOrderCode().equals(i.getOrderCode())){
y.setOrderCode(y.getOrderCode()+","+i.getOrderCode());
}
//订单Id信息
if(ObjectUtils.isNotNull(y.getStockArticleId()) && !y.getStockArticleId().equals(i.getStockArticleId())){
y.setStockArticleId(y.getStockArticleId()+","+i.getStockArticleId());
}
}
} );
}else{
@ -542,23 +549,50 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
} );
//获取没有货位的数据
List<DistributionStockupOrderListVO> collect22 = list.stream().filter(o -> ObjectUtils.isNull(o.getAllocationId())).collect(Collectors.toList());
List<DistributionStockupOrderListVO> listLi = new ArrayList<>(); //历史
if(!collect22.isEmpty()){
collect22.forEach( i -> {
boolean b = listYou.stream().anyMatch(ii -> ObjectUtils.isNull(ii.getAllocationId()));
DistributionStockAllocationVO stockAllocationVO = distributionStockService.selectSelfAllocation(stockupDTO.getReservationId(),stockupDTO.getStockupId(),i.getParcelListId());
if(ObjectUtils.isNotNull(stockAllocationVO)){
//添加以扫货位信息
i.setAllocation(stockAllocationVO.getPositionCode());
i.setAllocationId(stockAllocationVO.getAllocationId());
listLi.add(i);
}else{
listLi.add(i);
}
});
}
List<DistributionStockupOrderListVO> collectY = listLi.stream().filter(o -> ObjectUtils.isNotNull(o.getAllocationId())).collect(Collectors.toList());
List<DistributionStockupOrderListVO> collectW = listLi.stream().filter(o -> ObjectUtils.isNull(o.getAllocationId())).collect(Collectors.toList());
//有
if(!collectY.isEmpty()){
collectY.forEach( i -> {
boolean b = listYou.stream().anyMatch(ii ->ii.getAllocationId().equals(i.getAllocationId()));
if(b){
listYou.forEach( wu -> {
if(ObjectUtils.isNull(wu.getAllocationId())){
if(wu.getAllocationId().equals(i.getAllocationId())){
//相同
wu.setPlanNum(wu.getPlanNum()+1);
if(ObjectUtils.isNotNull(i.getStockId())){
wu.setScanNum(wu.getScanNum()+1);
}
//托盘信息
if(ObjectUtils.isNotNull(wu.getTrayId()) && wu.getTrayId().equals(i.getTrayId())){
if(ObjectUtils.isNotNull(wu.getTrayId()) && !wu.getTrayId().equals(i.getTrayId())){
wu.setPallet(wu.getPallet()+","+i.getPallet());
}
//订单自编号信息
if(ObjectUtils.isNotNull(wu.getOrderCode()) && !wu.getOrderCode().equals(i.getOrderCode())){
wu.setOrderCode(wu.getOrderCode()+","+i.getOrderCode());
}
//订单ID信息
if(ObjectUtils.isNotNull(wu.getStockArticleId()) && !wu.getStockArticleId().equals(i.getStockArticleId())){
wu.setStockArticleId(wu.getStockArticleId()+","+i.getStockArticleId());
}
if(wu.getPlanNum().equals(wu.getScanNum())){
wu.setCompleteStact(true);
}else{
wu.setCompleteStact(false);
}
}
});
@ -566,6 +600,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
i.setPlanNum(1);
if(ObjectUtils.isNotNull(i.getStockId())){
i.setScanNum(1);
i.setCompleteStact(true);
}else{
i.setScanNum(0);
}
@ -573,6 +608,48 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
}
});
}
collectW.forEach(i ->{
boolean b = listYou.stream().anyMatch(ko -> ObjectUtils.isNull(ko.getAllocationId()));
if(b){
listYou.forEach( wu -> {
if(ObjectUtils.isNull(wu.getAllocationId())){
//相同
wu.setPlanNum(wu.getPlanNum()+1);
if(ObjectUtils.isNotNull(i.getStockId())){
wu.setScanNum(wu.getScanNum()+1);
}
//托盘信息
if(ObjectUtils.isNotNull(wu.getTrayId()) && !wu.getTrayId().equals(i.getTrayId())){
wu.setPallet(wu.getPallet()+","+i.getPallet());
}
//订单自编号信息
if(ObjectUtils.isNotNull(wu.getOrderCode()) && !wu.getOrderCode().equals(i.getOrderCode())){
wu.setOrderCode(wu.getOrderCode()+","+i.getOrderCode());
}
//订单id信息
if(ObjectUtils.isNotNull(wu.getStockArticleId()) && !wu.getStockArticleId().equals(i.getStockArticleId())){
wu.setStockArticleId(wu.getStockArticleId()+","+i.getStockArticleId());
}
if(wu.getPlanNum().equals(wu.getScanNum())){
wu.setCompleteStact(true);
}else{
wu.setCompleteStact(false);
}
}
});
}else{
i.setPlanNum(1);
if(ObjectUtils.isNotNull(i.getStockId())){
i.setScanNum(1);
i.setCompleteStact(true);
}else{
i.setScanNum(0);
}
listYou.add(i);
}
});
// List<DistributionStockupOrderListVO> collect = list.stream().filter(o -> ObjectUtils.isNotNull(o.getAllocationId())).collect(Collectors.toList());//不为空
// List<DistributionStockupOrderListVO> collect2 = collect.stream().filter(distinctByKey(person -> person.getAllocationId())).collect(Collectors.toList()); //去重
// List<DistributionStockupOrderListVO> collect1 = list.stream().filter(o -> ObjectUtils.isNull(o.getAllocationId())).collect(Collectors.toList());//为空
@ -598,7 +675,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
y.setScanNum(y.getScanNum()+1);
}
//t托盘信息
if(ObjectUtils.isNotNull(y.getTrayId()) && y.getTrayId().equals(p.getTrayId())){
if(ObjectUtils.isNotNull(y.getTrayId()) && !y.getTrayId().equals(p.getTrayId())){
y.setPallet(y.getPallet()+","+p.getPallet());
}
}
@ -655,7 +732,7 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
y.setScanNum(y.getScanNum()+1);
}
//t托盘信息
if(ObjectUtils.isNotNull(y.getTrayId()) && y.getTrayId().equals(p.getTrayId())){
if(ObjectUtils.isNotNull(y.getTrayId()) && !y.getTrayId().equals(p.getTrayId())){
y.setPallet(y.getPallet()+","+p.getPallet());
}
if(y.getPlanNum().equals(y.getScanNum())){
@ -878,10 +955,16 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
public DistributionStockupOrderInfoVO selectOrderInfoSelf(StockupDTO stockupDTO) {
DistributionStockArticleEntity byId = distributionStockArticleService.getById(stockupDTO.getStockArticleId());
if(stockupDTO.getStatus().equals(1)){
//已备货
DistributionStockupSelfVO distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillOverPackWuSelf(stockupDTO);
// DistributionStockupSelfVO distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId());
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("stock_article_id", stockupDTO.getStockArticleId());
if(stockupDTO.getStockArticleId().contains(",")){
queryWrapper.in("stock_article_id", stockupDTO.getStockArticleId().split(","));
}else{
queryWrapper.eq("stock_article_id", stockupDTO.getStockArticleId());
}
if(!stockupDTO.getTypeService().equals("3")){
queryWrapper.eq("order_package_reservation_status", OrderPackageReservationStatusConstant.yiyueyue.getValue());
}
@ -926,12 +1009,71 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
DistributionStockupSelfVO distributionStockupSelfVO = new DistributionStockupSelfVO();
if(ObjectUtils.isNotNull(stockupDTO.getAllocationId())){
//查询订单数量 有库位
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackSelf(stockupDTO);
List<DistributionStockupSelfVO> distributionStockupSelfVOS = distrilbutionBillStockService.selectDistrilbutionBillPackSelf(stockupDTO);
DistributionStockupSelfVO distributionStockup= new DistributionStockupSelfVO();
AtomicReference<Integer> j = new AtomicReference<>(0);
AtomicReference<Integer> y = new AtomicReference<>(0);
distributionStockupSelfVOS.forEach(i -> {
j.updateAndGet(v -> v + i.getPlanNum());
y.updateAndGet(v -> v + i.getScanNum());
if(ObjectUtils.isNull(distributionStockup.getConsignee())){
distributionStockup.setConsignee(i.getConsignee());
}else{
if(ObjectUtils.isNotNull(i.getConsignee())){
String s = distributionStockup.getConsignee() + i.getConsignee();
distributionStockup.setConsignee(s);
}
}
if(ObjectUtils.isNull(distributionStockup.getTrays())){
distributionStockup.setTrays(i.getTrays());
}else{
if(ObjectUtils.isNotNull(i.getTrays())){
String s = distributionStockup.getTrays() + i.getTrays();
distributionStockup.setTrays(s);
}
}
});
distributionStockup.setPlanNum(j.get());
distributionStockup.setScanNum(y.get());
distributionStockupSelfVO = distributionStockup;
}else{
//查询订单数量 无库位
distributionStockupSelfVO = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId());
List<DistributionStockupSelfVO> distributionStockupSelfVOS = distrilbutionBillStockService.selectDistrilbutionBillPackWuSelf(stockupDTO.getReservationId(), stockupDTO.getStockupId());
DistributionStockupSelfVO distributionStockup= new DistributionStockupSelfVO();
AtomicReference<Integer> j = new AtomicReference<>(0);
AtomicReference<Integer> y = new AtomicReference<>(0);
distributionStockupSelfVOS.forEach(i -> {
j.updateAndGet(v -> v + i.getPlanNum());
y.updateAndGet(v -> v + i.getScanNum());
if(ObjectUtils.isNull(distributionStockup.getConsignee())){
distributionStockup.setConsignee(i.getConsignee());
}else{
if(ObjectUtils.isNotNull(i.getConsignee())){
String s = distributionStockup.getConsignee() + i.getConsignee();
distributionStockup.setConsignee(s);
}
}
if(ObjectUtils.isNull(distributionStockup.getTrays())){
distributionStockup.setTrays(i.getTrays());
}else{
if(ObjectUtils.isNotNull(i.getTrays())){
String s = distributionStockup.getTrays() + i.getTrays();
distributionStockup.setTrays(s);
}
}
});
distributionStockup.setPlanNum(j.get());
distributionStockup.setScanNum(y.get());
distributionStockupSelfVO = distributionStockup;
}
if(stockupDTO.getStockArticleId().contains(",")){
stockupDTO.setStockArticleIdList(stockupDTO.getStockArticleId().split(","));
stockupDTO.setStockArticleId(null);
}
// if(stockupDTO.getOrderCode().contains(",")){
// stockupDTO.setOrderCodeList(stockupDTO.getOrderCode().split(","));
// stockupDTO.setOrderCode(null);
// }
List<PackageStockupVO> list = distributionParcelListService.selectOrderInfoSelfList(stockupDTO);
Iterator<PackageStockupVO> iterator = list.iterator();

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillStockServiceImpl.java

@ -92,12 +92,12 @@ public class DistrilbutionBillStockServiceImpl extends BaseServiceImpl<Distrilbu
* @param stockupDTO@return
*/
@Override
public DistributionStockupSelfVO selectDistrilbutionBillPackSelf(StockupDTO stockupDTO) {
public List<DistributionStockupSelfVO> selectDistrilbutionBillPackSelf(StockupDTO stockupDTO) {
return baseMapper.selectDistrilbutionBillPackSelf(stockupDTO);
}
@Override
public DistributionStockupSelfVO selectDistrilbutionBillPackWuSelf(Long reservationId, Long stockupId) {
public List<DistributionStockupSelfVO> selectDistrilbutionBillPackWuSelf(Long reservationId, Long stockupId) {
return baseMapper.selectDistrilbutionBillPackWuSelf(reservationId,stockupId);
}

Loading…
Cancel
Save