Browse Source

添加自提部分接口

dev-warehouse
caoyizhong 2 years ago
parent
commit
61def800af
  1. 8
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionBillLadingScanEntity.java
  2. 5
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionDeliveryDetailsEntity.java
  3. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java
  4. 7
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java
  5. 5
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillStockEntity.java
  6. 2
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionDeliveryDetailsVO.java
  7. 9
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistrilbutionBillLadingAppVO.java
  8. 44
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistrilbutionBillLadingInventoryAppVO.java
  9. 26
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionBillLadingAppController.java
  10. 14
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryDetailsMapper.java
  11. 18
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryDetailsMapper.xml
  12. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.java
  13. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml
  14. 28
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAsyncService.java
  15. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryDetailsService.java
  16. 27
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistrilbutionBillLadingService.java
  17. 70
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  18. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryDetailsServiceImpl.java
  19. 216
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

8
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionBillLadingScanEntity.java

@ -45,7 +45,7 @@ public class DistributionBillLadingScanEntity extends BaseEntity {
@ApiModelProperty(value = "节点")
private Integer nodeType;
@ApiModelProperty(value = "扫码类型 1 pda扫码 2 手填")
@ApiModelProperty(value = "扫码类型 1 pda扫码 2 手填 3库存品 4 订单")
private Integer scanType;
@ApiModelProperty(value = "包件id")
@ -57,4 +57,10 @@ public class DistributionBillLadingScanEntity extends BaseEntity {
@ApiModelProperty(value = "订单id")
private Long stockArticleId;
@ApiModelProperty(value = "提货id")
private Long billLadingId;
@ApiModelProperty(value = "库存品id")
private Long stockListId;
}

5
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionDeliveryDetailsEntity.java

@ -76,5 +76,10 @@ public class DistributionDeliveryDetailsEntity extends TenantEntity {
*/
@ApiModelProperty(value = "数量")
private Integer quantity;
/**
* 状态
*/
@ApiModelProperty(value = "状态")
private String conditions;
}

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockArticleEntity.java

@ -199,7 +199,7 @@ public class DistributionStockArticleEntity extends TenantEntity {
* 状态;1 配送 2 待配送 3部分入库 4已入库
*/
@ApiModelProperty(value = "状态;1 配送 2 待配送 3部分入库 4已入库")
private Integer state;
private String state;
/**
* 状态;1 已通知 2 未通知

7
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistributionStockEntity.java

@ -80,7 +80,7 @@ public class DistributionStockEntity extends TenantEntity {
* 状态
*/
@ApiModelProperty(value = "状态")
private Integer conditions;
private String conditions;
/**
* 货物名称
*/
@ -141,6 +141,11 @@ public class DistributionStockEntity extends TenantEntity {
*/
@ApiModelProperty(value = "配送编号")
private Long deliveryListCode;
/**
* 提货Id
*/
@ApiModelProperty(value = "提货Id")
private Long billLadingId;
@ApiModelProperty(value = "备货区")
private String stockupArea;

5
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillStockEntity.java

@ -71,6 +71,11 @@ public class DistrilbutionBillStockEntity extends TenantEntity {
*/
@ApiModelProperty(value = "在库订单")
private Long stockArticleId;
/**
* 状态
*/
@ApiModelProperty(value = "状态")
private String conditions;
}

2
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionDeliveryDetailsVO.java

@ -31,5 +31,7 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
public class DistributionDeliveryDetailsVO extends DistributionDeliveryDetailsEntity {
private static final long serialVersionUID = 1L;
private Integer wholeNum; //全部
private Integer esauNum; //全部
}

9
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistrilbutionBillLadingAppVO.java

@ -60,8 +60,17 @@ public class DistrilbutionBillLadingAppVO extends DistrilbutionBillLadingEntity
private Integer orderNum;//订单总数
private Integer planNum;//自提件数
private Integer signedNum;//签收总数
private Integer inventoryNum;//签收总数
private Integer completeNum;//齐套总数
private String stockListId;//库存品id
private Integer quantity;//库存数量
private String descriptionGoods;//物品名称
private String cargoUnit;//单位
private String sku;//sku
private Integer deliveryNum;//备货数量
private Integer esauInventoryNum;//以扫备货数量
private List<DistrilbutionAppBillLadingDetailVO> list = new ArrayList<>();

44
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/app/DistrilbutionBillLadingInventoryAppVO.java

@ -0,0 +1,44 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.distribution.vo.app;
import com.logpm.distribution.entity.DistrilbutionBillLadingEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 提货单 视图实体类
*
* @author cyz
* @since 2023-06-14
*/
@Data
public class DistrilbutionBillLadingInventoryAppVO {
private static final long serialVersionUID = 1L;
private Long billLadingId;
private Long ldddId;
private Long stockArticleId;
private Long stockListId;
private Integer quantity;
}

26
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionBillLadingAppController.java

@ -31,6 +31,9 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
* 自提列表信息 app控制器
@ -86,4 +89,27 @@ public class DistributionBillLadingAppController extends BladeController {
return R.data(vo);
}
@ApiOperation(value = "自提订单列表库存品",notes = "自提订单列表库存品")
@GetMapping("/getInventory")
@ApiOperationSupport(order = 1)
public R<IPage<DistrilbutionBillLadingAppVO>> getInventory(@ApiIgnore @RequestParam Map<String, Object> distrilbutionBillLading, Query query){
IPage<DistrilbutionBillLadingAppVO> ladingAppVOIPage = distrilbutionBillLadingService.getInventory(Condition.getPage(query),distrilbutionBillLading);
return R.data(ladingAppVOIPage);
}
@ApiOperation(value = "自提订单列表库存品详细包件",notes = "自提订单列表库存品详细包件")
@GetMapping("/getInventory")
@ApiOperationSupport(order = 1)
public R<IPage<DistrilbutionBillLadingAppVO>> getInventoryNum(@ApiIgnore @RequestParam Map<String, Object> distrilbutionBillLading, Query query){
IPage<DistrilbutionBillLadingAppVO> ladingAppVOIPage = distrilbutionBillLadingService.getInventoryNum(Condition.getPage(query),distrilbutionBillLading);
return R.data(ladingAppVOIPage);
}
@ApiOperation(value = "扫描id")
@PutMapping("/scan")
public R getScan(@ApiIgnore @RequestParam Map<String, Object> distrilbutionBillLading){
R scan = distrilbutionBillLadingService.getScan(distrilbutionBillLading);
return scan;
}
}

14
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryDetailsMapper.java

@ -22,6 +22,7 @@ import com.logpm.distribution.excel.DistributionDeliveryDetailsExcel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.vo.app.DistrilbutionBillLadingInventoryAppVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -50,5 +51,18 @@ public interface DistributionDeliveryDetailsMapper extends BaseMapper<Distributi
* @return
*/
List<DistributionDeliveryDetailsExcel> exportDistributionDeliveryDetails(@Param("ew") Wrapper<DistributionDeliveryDetailsEntity> queryWrapper);
/**
* 查询自提库存品数据
* @param billLadingId
* @return
*/
DistributionDeliveryDetailsVO oneListNum(@Param("id") Long billLadingId);
/**
* 查询
* @param billLadingId
* @param coding
* @return
*/
DistrilbutionBillLadingInventoryAppVO listCode(@Param("billLadingId") String billLadingId,@Param("coding") String coding);
}

18
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryDetailsMapper.xml

@ -19,7 +19,7 @@
<result column="reserve4" property="reserve4"/>
<result column="reserve5" property="reserve5"/>
<result column="bill_lading_id" property="billLadingId"/>
<result column="stock_id" property="stockId"/>
<!-- <result column="stock_id" property="stockId"/>-->
<result column="quantity" property="quantity"/>
</resultMap>
@ -33,4 +33,20 @@
SELECT * FROM logpm_distribution_delivery_details ${ew.customSqlSegment}
</select>
<select id="oneListNum" resultType="com.logpm.distribution.vo.DistributionDeliveryDetailsVO">
select sum(lddd.quantity) wholeNum , (
select COUNT(1)
from logpm_distribution_delivery_details ldd
LEFT JOIN logpm_distribution_bill_lading_scan ldbls on ldd.id = ldbls.stock_article_id
where ldbls.scan_type = '3' and lddd.bill_lading_id = #{id} and ldd.is_deleted = 0
) esauNum
from logpm_distribution_delivery_details lddd
where lddd.bill_lading_id = #{id} and lddd.is_deleted = 0
</select>
<select id="listCode" resultType="com.logpm.distribution.vo.app.DistrilbutionBillLadingInventoryAppVO">
select lds.stock_list_id stockListId,lddd.quantity,lddd.stock_list_id stockListId,lddd.id ldddId
from logpm_distribution_delivery_details lddd LEFT JOIN logpm_distribution_stock lds on lddd.stock_list_id = lds.stock_list_id
where lddd.is_deleted = 0 and lddd.bill_lading_id = #{billLadingId} and lds.coding = #{coding}
</select>
</mapper>

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

@ -29,6 +29,7 @@ import com.logpm.distribution.vo.DistrilbutionBillLadingOwnVO;
import com.logpm.distribution.vo.DistrilbutionBillLadingVO;
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingDetailVO;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.mp.support.Query;
import java.util.List;
@ -75,4 +76,13 @@ public interface DistrilbutionBillLadingMapper extends BaseMapper<DistrilbutionB
IPage<DistrilbutionBillLadingOwnVO> getInventoryOwn(IPage<Object> page,@Param("id") Long id);
DistrilbutionBillLadingDetailsVO getDetailOne(@Param("id") Long id);
/**
* 查询自提库存品
* @param page
* @param distrilbutionBillLadingEntity
* @return
*/
IPage<DistrilbutionBillLadingAppVO> getInventory(IPage<Object> page,@Param("param") DistrilbutionBillLadingEntity distrilbutionBillLadingEntity);
}

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistrilbutionBillLadingMapper.xml

@ -173,5 +173,18 @@
</where>
</select>
<select id="getInventory" resultType="com.logpm.distribution.vo.DistrilbutionBillLadingAppVO">
select ldbl.id ,lddd.stock_list_id stockListId,lddd.quantity,ldsl.description_goods descriptionGoods,ldsl.cargo_unit cargoUnit,ldsl.sku,(
select count(1)
from logpm_distribution_stock lds
where lds.bill_lading_id = #{param.id} and lds.is_deleted = 0
) deliveryNum
from logpm_distrilbution_bill_lading ldbl
LEFT JOIN logpm_distribution_delivery_details lddd on ldbl.id = lddd.bill_lading_id
LEFT JOIN logpm_distribution_stock_list ldsl on ldsl.id = lddd.stock_list_id
where ldbl.id = #{param.id} and lddd.is_deleted = '0'
</select>
</mapper>

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

@ -13,4 +13,32 @@ public interface IDistributionAsyncService {
* @return
*/
void makeSureByPackage(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO);
/**
* 修改订单状态
* @param id
* @return
*/
Boolean getSelfPickup(Long id);
/**
* 修改订单状态
* @param id
* @return
*/
Boolean getOrderSelfPickup(Long id);
/**
* 修改订单状态
* @param id
* @return
*/
Boolean getInventorySelfPickup(Long id);
/**
* 修改订单状态
* @param id
* @return
*/
Boolean getInventoryOrderSelfPickup(Long id);
Boolean getBillStock(Long id);
}

10
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryDetailsService.java

@ -21,6 +21,8 @@ import com.logpm.distribution.entity.DistributionDeliveryDetailsEntity;
import com.logpm.distribution.vo.DistributionDeliveryDetailsVO;
import com.logpm.distribution.excel.DistributionDeliveryDetailsExcel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.vo.DistrilbutionBillLadingAppVO;
import com.logpm.distribution.vo.app.DistrilbutionBillLadingInventoryAppVO;
import org.springblade.core.mp.base.BaseService;
import java.util.List;
@ -49,4 +51,12 @@ public interface IDistributionDeliveryDetailsService extends BaseService<Distrib
*/
List<DistributionDeliveryDetailsExcel> exportDistributionDeliveryDetails(Wrapper<DistributionDeliveryDetailsEntity> queryWrapper);
/**
* 查询自提库存品数据
* @param billLadingId
* @return
*/
DistributionDeliveryDetailsVO oneListNum(Long billLadingId);
DistrilbutionBillLadingInventoryAppVO listCode(String billLadingId, String coding);
}

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

@ -28,6 +28,8 @@ import com.logpm.distribution.vo.DistrilbutionBillLadingOwnVO;
import com.logpm.distribution.vo.DistrilbutionBillLadingVO;
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingOrderMainVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
@ -93,8 +95,31 @@ public interface IDistrilbutionBillLadingService extends BaseService<Distrilbuti
/**
* 查询提货单详情数据
* @param queryWrapper
* @param distrilbutionBillLadingEntity
* @return
*/
DistrilbutionBillLadingDetailsVO getDetailOne(DistrilbutionBillLadingEntity distrilbutionBillLadingEntity);
/**
* 查询自提订单列表库存品
* @param page
* @param distrilbutionBillLading
* @return
*/
IPage<DistrilbutionBillLadingAppVO> getInventory(IPage<Object> page, Map<String, Object> distrilbutionBillLading);
/**
* pda扫描操作
* @param distrilbutionBillLading
* @return
*/
R getScan(Map<String, Object> distrilbutionBillLading);
/**
* 库存品包件
* @param page
* @param distrilbutionBillLading
* @return
*/
IPage<DistrilbutionBillLadingAppVO> getInventoryNum(IPage<Object> page, Map<String, Object> distrilbutionBillLading);
}

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

@ -4,13 +4,15 @@ package com.logpm.distribution.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.logpm.distribution.dto.app.DistrilbutionloadingscanDTO;
import com.logpm.distribution.entity.DistributionLoadscanEntity;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.distribution.entity.*;
import com.logpm.distribution.mapper.DistributionLoadscanMapper;
import com.logpm.distribution.mapper.DistributionParcelListMapper;
import com.logpm.distribution.service.IDistributionAsyncService;
import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.DistributionStockupVO;
import com.logpm.distribution.vo.DistrilbutionBillStockVO;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
@ -27,6 +29,10 @@ import java.util.stream.Collectors;
public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
private final DistributionLoadscanMapper distributionLoadscanMapper;
private final IDistributionStockArticleService distributionStockArticleService;
private final IDistributionStockService distributionStockService;
private final IDistrilbutionBillStockService distrilbutionBillStockService;
private final IDistributionDeliveryDetailsService distributionDeliveryDetailsService;
private final DistributionParcelListServiceImpl distributionParcelListService;
@ -58,4 +64,62 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
//.eq(DistributionParcelListEntity::get)
);
}
/**
* 修改包件状态
* @param id
* @return
*/
@Override
@Async
@Transactional(rollbackFor = Exception.class)
public Boolean getSelfPickup(Long id) {
DistributionParcelListEntity entity = new DistributionParcelListEntity();
entity.setId(id);
entity.setDeliveryState("40");
return distributionParcelListService.updateById(entity);
}
/**
* 修改订单状态
* @param id
* @return
*/
@Override
@Async
@Transactional(rollbackFor = Exception.class)
public Boolean getOrderSelfPickup(Long id) {
DistributionStockArticleEntity entity = new DistributionStockArticleEntity();
entity.setId(id);
entity.setState("60");
return distributionStockArticleService.updateById(entity);
}
@Override
@Async
@Transactional(rollbackFor = Exception.class)
public Boolean getInventorySelfPickup(Long id) {
DistributionStockEntity distributionStock = new DistributionStockEntity();
distributionStock.setId(id);
distributionStock.setConditions("3");
return distributionStockService.updateById(distributionStock);
}
@Override
@Async
@Transactional(rollbackFor = Exception.class)
public Boolean getInventoryOrderSelfPickup(Long id) {
DistributionDeliveryDetailsEntity deliveryDetails = new DistributionDeliveryDetailsEntity();
deliveryDetails.setConditions("2");
deliveryDetails.setId(id);
return distributionDeliveryDetailsService.updateById(deliveryDetails);
}
@Override
public Boolean getBillStock(Long id) {
DistrilbutionBillStockEntity distrilbutionBillStock = new DistrilbutionBillStockVO();
distrilbutionBillStock.setId(id);
distrilbutionBillStock.setConditions("2");
return distrilbutionBillStockService.updateById(distrilbutionBillStock);
}
}

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryDetailsServiceImpl.java

@ -21,6 +21,7 @@ import com.logpm.distribution.vo.DistributionDeliveryDetailsVO;
import com.logpm.distribution.excel.DistributionDeliveryDetailsExcel;
import com.logpm.distribution.mapper.DistributionDeliveryDetailsMapper;
import com.logpm.distribution.service.IDistributionDeliveryDetailsService;
import com.logpm.distribution.vo.app.DistrilbutionBillLadingInventoryAppVO;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -51,4 +52,19 @@ public class DistributionDeliveryDetailsServiceImpl extends BaseServiceImpl<Dist
return distributionDeliveryDetailsList;
}
/**
* 查询自提库存品数据
* @param billLadingId
* @return
*/
@Override
public DistributionDeliveryDetailsVO oneListNum(Long billLadingId) {
return baseMapper.oneListNum(billLadingId);
}
@Override
public DistrilbutionBillLadingInventoryAppVO listCode(String billLadingId, String coding) {
return baseMapper.listCode(billLadingId,coding) ;
}
}

216
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -24,7 +24,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.dto.DistributionStockListDTO;
import com.logpm.distribution.dto.DistrilbutionBillLadingDTO;
import com.logpm.distribution.dto.app.BillLadingAppDTO;
@ -36,10 +35,13 @@ import com.logpm.distribution.vo.*;
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingDetailVO;
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingOrderMainVO;
import com.logpm.distribution.vo.app.DistrilbutionAppBillLadingOrderVO;
import com.logpm.distribution.vo.app.DistrilbutionBillLadingInventoryAppVO;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@ -47,6 +49,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
/**
@ -76,6 +79,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
private final IDistributionStockupScanService distributionStockupScanService;
private final IDistributionStockListService distributionStockListService;
private final IDistributionAsyncService distributionAsyncService;
private final IDistrilbutionBillLadingService distrilbutionBillLadingService;
private final IDistributionStockService distributionStockService;
@Override
@ -184,7 +190,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
for (String s : split) {
DistributionStockArticleEntity distributionStockArticle = new DistributionStockArticleEntity();
distributionStockArticle.setId(Long.parseLong(s));
distributionStockArticle.setState(2);
distributionStockArticle.setState("2");
distributionStockArticleService.updateById(distributionStockArticle);
//添加订单和提货单关联
DistrilbutionBillStockEntity distrilbutionBillStock = new DistrilbutionBillStockVO();
@ -285,7 +291,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
public IPage<DistrilbutionBillLadingAppVO> pageListApp(IPage<Object> page, BillLadingAppDTO billLadingAppDTO) {
IPage<DistrilbutionBillLadingAppVO> pageList = baseMapper.pageListApp(page, billLadingAppDTO);
List<DistrilbutionBillLadingAppVO> records = pageList.getRecords();
for (DistrilbutionBillLadingAppVO vo:records){
for (DistrilbutionBillLadingAppVO vo : records){
//有可能存在多个订单所以需要拆分
String stockArticleId = vo.getStockArticleId();
@ -312,6 +318,16 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
int sn = ls.size();
signedNum = signedNum +sn;
}
//查询库存品的件数量
DistributionDeliveryDetailsVO list = distributionDeliveryDetailsService.oneListNum(vo.getBillLadingId());
if(ObjectUtils.isNotNull(list)){
planNum += list.getWholeNum();
signedNum += list.getEsauNum();
vo.setInventoryNum(list.getWholeNum());
}else{
vo.setInventoryNum(0);
}
vo.setOrderNum(orderNum);
vo.setPlanNum(planNum);
vo.setSignedNum(signedNum);
@ -396,6 +412,10 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
}
}
//查询库存品的订单
DistrilbutionAppBillLadingOrderMainVO mainVO = new DistrilbutionAppBillLadingOrderMainVO();
mainVO.setOrderNum(orderNum);
mainVO.setPlanNum(planNum);
@ -428,7 +448,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
//查询所有的包件列表并且附带状态
List<DistrilbutionAppBillLadingDetailVO> details = baseMapper.selectDetailList(Long.parseLong(s),scanStatus,orderSelfNumbering);
for (DistrilbutionAppBillLadingDetailVO detailVO:details){
for (DistrilbutionAppBillLadingDetailVO detailVO : details){
Integer ss = detailVO.getScanStatus();
Integer errorStatus = detailVO.getErrorStatus();
if(ss == 1){
@ -631,5 +651,193 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
return detailOne;
}
/**
* 查询自提任务库存品
* @param page
* @param distrilbutionBillLading
* @return
*/
@Override
public IPage<DistrilbutionBillLadingAppVO> getInventory(IPage<Object> page, Map<String, Object> distrilbutionBillLading) {
DistrilbutionBillLadingEntity distrilbutionBillLadingEntity = JSONObject.parseObject(JSONObject.toJSONString(distrilbutionBillLading), DistrilbutionBillLadingEntity.class);
IPage<DistrilbutionBillLadingAppVO> inventory = baseMapper.getInventory(page, distrilbutionBillLadingEntity);
inventory.getRecords().forEach( i ->{
if(i.getQuantity().equals(i.getDeliveryNum())){
//已备货
List<DistributionBillLadingScanEntity> list = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda()
.eq(DistributionBillLadingScanEntity::getBillLadingId, distrilbutionBillLadingEntity.getId())
.eq(DistributionBillLadingScanEntity::getScanType, '3')
);
i.setEsauInventoryNum(list.size());
}else{
//没有备货完成
i.setEsauInventoryNum(0);
}
});
return inventory;
}
/**
* pda扫描
* @param distrilbutionBillLading
* @return
*/
@Override
public R getScan(Map<String, Object> distrilbutionBillLading) {
Object billLadingId = distrilbutionBillLading.get("id"); //提货ID
Object coding = distrilbutionBillLading.get("coding"); //包条码
Object type = distrilbutionBillLading.get("type"); //类型 4 订单 3 库存品
if(Func.isNull(billLadingId) || Func.isNull(coding ) || Func.isNull(type) ){
return R.fail(3000,"参数不完整,你干啥呢!!");
}else{
//添加扫描记录
DistributionBillLadingScanEntity distributionBillLadingScan = new DistributionBillLadingScanEntity();
distributionBillLadingScan.setScanType((Integer) type);
distributionBillLadingScan.setBillLadingId((Long) billLadingId);
if(type.equals("3")){
//库存品
DistrilbutionBillLadingInventoryAppVO inventoryAppVO = distributionDeliveryDetailsService.listCode(String.valueOf(billLadingId), String.valueOf(coding));
if(ObjectUtils.isNotNull(inventoryAppVO)){
//查询签收数量
List<DistributionBillLadingScanEntity> list = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda()
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId)
.eq(DistributionBillLadingScanEntity::getScanType, "3")
.eq(DistributionBillLadingScanEntity::getStockListId, inventoryAppVO.getStockListId())
);
if(list.size() == inventoryAppVO.getQuantity()+1){
//修改完成状态
distributionAsyncService.getInventoryOrderSelfPickup(inventoryAppVO.getLdddId());
}
//修改库存品签收
distributionAsyncService.getInventorySelfPickup(inventoryAppVO.getStockArticleId());
distributionBillLadingScan.setPacketBarCode((String) coding);
distributionBillLadingScan.setStockListId(inventoryAppVO.getStockListId());
distributionBillLadingScanService.save(distributionBillLadingScan);
}else {
return R.fail(3000,"包件信息不存在");
}
}else{
//查询订单存在吗
List<DistrilbutionBillStockEntity> list= distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId)
);
if(list.size()> 0){
R.fail(3000,"当前提货任务,订单不存在!");
}else{
AtomicBoolean n = new AtomicBoolean(false);
list.forEach(so ->{
//查询包件信息
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getStockArticleId, so.getStockArticleId())
.eq(DistributionParcelListEntity::getPacketBarCode, coding)
);
if(list1.size() > 0){
n.set(true);
//查询订单包件数量签收的信息
DistributionStockArticleEntity one = distributionStockArticleService.getOne(Wrappers.<DistributionStockArticleEntity>query().lambda()
.eq(DistributionStockArticleEntity::getId, so.getStockArticleId())
);
List<DistributionBillLadingScanEntity> list2 = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda()
.eq(DistributionBillLadingScanEntity::getStockArticleId, so.getStockArticleId())
.eq(DistributionBillLadingScanEntity::getScanType, "4")
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId)
);
//判断当前签收数
if(one.getTotalNumber().equals(list2.size()+1)){
DistrilbutionBillStockEntity one1 = distrilbutionBillStockService.getOne(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId)
.eq(DistrilbutionBillStockEntity::getStockArticleId, one.getId())
.eq(DistrilbutionBillStockEntity::getConditions, "1")
);
distributionAsyncService.getOrderSelfPickup(list1.get(0).getId());
distributionAsyncService.getBillStock(one1.getId());
}
//修改包件状态
distributionAsyncService.getSelfPickup(list1.get(0).getId());
distributionBillLadingScan.setParcelListId(list1.get(0).getId());
distributionBillLadingScan.setPacketBarCode(String.valueOf(coding) );
//订单
distributionBillLadingScan.setStockArticleId(one.getId());
distributionBillLadingScan.setBillLadingId(Long.parseLong((String) billLadingId));
}
});
if(n.get()){
distributionBillLadingScanService.save(distributionBillLadingScan);
}else{
//
return R.fail(3000,"当前订单,包件不存在!!");
}
}
}
//判断当前自提任务完成没有
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId)
);
List<DistributionDeliveryDetailsEntity> list1 = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda()
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, billLadingId)
);
long count = list.stream().filter(e -> e.getConditions().equals("2")).count();
long count2 = list1.stream().filter(e -> e.getConditions().equals("2")).count();
if(Integer.parseInt(String.valueOf(count)) == list.size() && Integer.parseInt(String.valueOf(count2)) == list1.size()){
//修改提货任务状态
DistrilbutionBillLadingEntity billLadingEntity = new DistrilbutionBillLadingEntity();
billLadingEntity.setId((Long) billLadingId);
billLadingEntity.setConsignee("2");
distrilbutionBillLadingService.updateById(billLadingEntity);
}
return R.fail(200,"签收成功");
}
}
/**
* 查询包件
* @param page
* @param distrilbutionBillLading
* @return
*/
@Override
public IPage<DistrilbutionBillLadingAppVO> getInventoryNum(IPage<Object> page, Map<String, Object> distrilbutionBillLading) {
DistrilbutionBillLadingEntity distrilbutionBillLadingEntity = JSONObject.parseObject(JSONObject.toJSONString(distrilbutionBillLading), DistrilbutionBillLadingEntity.class);
IPage<DistrilbutionBillLadingAppVO> inventory = baseMapper.getInventory(page, distrilbutionBillLadingEntity);
inventory.getRecords().forEach( i ->{
if(i.getQuantity().equals(i.getDeliveryNum())){
//已备货
List<DistributionBillLadingScanEntity> list = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda()
.eq(DistributionBillLadingScanEntity::getBillLadingId, distrilbutionBillLadingEntity.getId())
.eq(DistributionBillLadingScanEntity::getScanType, '3')
);
i.setEsauInventoryNum(list.size());
List<DistrilbutionAppBillLadingDetailVO> ladingDetailVOS = new ArrayList<>();
List<DistributionStockEntity> list1 = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda()
.eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId())
.eq(DistributionStockEntity::getType, "2")
);
list1.forEach( di ->{
DistrilbutionAppBillLadingDetailVO billLadingDetailVO = new DistrilbutionAppBillLadingDetailVO();
billLadingDetailVO.setPacketBarCode(di.getCoding());
billLadingDetailVO.setScanStatus(Integer.parseInt(di.getConditions()));
switch (di.getConditions()){
case "2":
billLadingDetailVO.setScanStatusStr("待签收");
break;
case "3":
billLadingDetailVO.setScanStatusStr("已签收");
break;
}
ladingDetailVOS.add(billLadingDetailVO);
});
i.setList(ladingDetailVOS);
}else{
//没有备货完成
i.setEsauInventoryNum(0);
}
});
return inventory;
}
}

Loading…
Cancel
Save