Browse Source

Merge remote-tracking branch 'origin/dev' into dev

training
caoyizhong 1 year ago
parent
commit
45984ea613
  1. 8
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionReservationClient.java
  2. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java
  4. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueDetailMapper.java
  5. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueDetailMapper.xml
  6. 32
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml
  7. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  8. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupInfoMapper.java
  9. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupInfoMapper.xml
  10. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAddvalueService.java
  11. 453
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java
  12. 38
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  13. 182
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  14. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  15. 10
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseRetentionApiController.java
  16. 8
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionRecordService.java
  17. 64
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java

8
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionReservationClient.java

@ -57,4 +57,12 @@ public interface IDistributionReservationClient {
@GetMapping(TOP+"/retentionCancelReservationPack")
boolean retentionCancelReservationPack(@RequestBody DistributionRetentionScanVo distributionRetentionScanVo);
// /**
// * 根据配送任务ID查询配送司机信息
// * @param distributionRetentionScanVo
// * @return
// */
// @Post(TOP+"/retentionCancelReservationPack")
// boolean retentionCancelReservationPack(@RequestBody DistributionRetentionScanVo distributionRetentionScanVo);
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionDeliveryAppController.java

@ -284,7 +284,7 @@ public class DistributionDeliveryAppController {
/**
* 扫描查询配送任务下的包件信息
*/
@PostMapping("/getZeroPackageInfo")
@PostMapping("/getZeroPackageInfo")
@ApiOperationSupport(order = 11)
public R getZeroPackageInfo(@Valid @RequestBody DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
R distributionParcelListVOS = distributionDeliveryListService.getZeroPackageInfo(distrilbutionloadingscanDTO);

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSignforController.java

@ -341,7 +341,7 @@ public class DistributionSignforController extends BladeController {
@ApiOperationSupport(order = 7)
@ApiOperation(value = "PC查看增值服务列表", notes = "传入ids")
public R checkAddValuePackageList(@RequestBody DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
return distributionAddvalueService.saveAddvalueInfo(distributionAppAddvalueDTO);
return distributionAddvalueService.savePCAddvalueInfo(distributionAppAddvalueDTO);
}
/**

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueDetailMapper.java

@ -56,4 +56,10 @@ public interface DistributionAddvalueDetailMapper extends BaseMapper<Distributio
* @param addvalueId
*/
void deleteAddvalueDetail(@Param("addvalueId") Long addvalueId);
/**
* 删除增值服务详情
* @param addvalueDetailId
*/
void deleteAddvalueDetailById(@Param("id")Long addvalueDetailId);
}

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

@ -30,13 +30,15 @@
<delete id="deleteAddvalueDetail">
DELETE FROM logpm_distribution_addvalue_detail WHERE addvalue_id = #{addvalueId}
</delete>
<delete id="deleteAddvalueDetailById">
DELETE FROM logpm_distribution_addvalue_detail WHERE id = #{id}
</delete>
<select id="selectDistributionAddvalueDetailPage" resultMap="distributionAddvalueDetailResultMap">
select * from logpm_distribution_addvalue_detail where is_deleted = 0
</select>
<select id="exportDistributionAddvalueDetail"
resultType="com.logpm.distribution.excel.DistributionAddvalueDetailExcel">
SELECT * FROM logpm_distribution_addvalue_detail ${ew.customSqlSegment}

32
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionAddvalueMapper.xml

@ -127,7 +127,7 @@
ldpl.third_product AS third_product,
ldap.order_package_code AS order_package_code,
ldap.order_code AS order_code,
ldpl.quantity AS quantity,
ldap.quantity AS quantity,
ldrzp.quantity AS maxQuantity,
ldap.id AS id,
ldap.stock_article_id AS stockArticleId,
@ -199,7 +199,7 @@
<select id="selectAddvalueZeroPackageVO"
resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO">
SELECT
ldpl.id,
ldpl.id AS packageId,
ldpl.firsts,
ldpl.`second`,
ldpl.third_product,
@ -217,22 +217,22 @@
</select>
<select id="selectAddvalueInventoryPackageVO"
resultType="com.logpm.distribution.vo.DistributionAddvaluePackageVO">
SELECT
ldsld.sku,
ldsld.stock_package_code,
ldsld.reservation_id,
ldsld.stock_list_id,
ldsld.id AS packageId,
ldsld.num AS quantity,
ldsl.description_goods,
ldsl.cargo_number,
2 AS conditions,
'库存品' AS packageType
FROM
SELECT
ldsld.sku,
ldsld.stock_package_code AS orderPackageCode,
ldsld.reservation_id,
ldsld.stock_list_id,
ldsld.id AS packageId,
ldsld.num AS quantity,
ldsl.description_goods AS materialName,
ldsl.cargo_number AS materialCode,
2 AS conditions,
'库存品' AS packageType
FROM
logpm_dis_stock_list_detail AS ldsld
INNER JOIN logpm_distribution_stock_list AS ldsl ON ldsld.stock_list_id = ldsl.id
WHERE
ldsld.reservation_id = #{reservationId} AND ldsld.stock_package_status in ('1','3') AND ldsld.stock_list_id =#{stockListId}
WHERE
ldsld.reservation_id = #{reservationId} AND ldsld.stock_package_status in ('1','3') AND ldsld.stock_list_id =#{stockListId}
<if test="obj.orderPackageCode != null and obj.orderPackageCode != ''">
AND ldsld.stock_package_code like concat ('%',#{obj.orderPackageCode},'%')
</if>

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

@ -1050,7 +1050,7 @@
ldpn.delivery_quantity,
ldpn.signin_quantity,
ldpn.outbound_quantity,
ldpn.id AS id
ldpl.id AS id
FROM
logpm_distribution_reservation_stockarticle AS ldrs
LEFT JOIN logpm_distribution_reservation_zero_package AS ldrzp ON ldrs.stock_article_id = ldrzp.stock_article_id AND ldrzp.reservation_id = ldrs.reservation_id

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

@ -58,7 +58,7 @@ public interface DistributionStockupInfoMapper extends BaseMapper< Distribution
* 删除预约备货中间表
* @param id
*/
void deleteByReservationId(@Param("id") Long stockupId,@Param("reservationId") Long id);
void deleteByReservationId(@Param("stockupId") Long stockupId,@Param("reservationId") Long id);
/**
* 备货商 市查询库存品的数量

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockupInfoMapper.xml

@ -8,11 +8,11 @@
<delete id="deleteByReservationId">
DELETE FROM logpm_distribution_stockup_info
<where>
<if test="reservationId != null and reservationId != ''">
and reservation_id = #{reservationId}
<if test="stockupId != null and stockupId != ''">
and stockup_id = #{stockupId}
</if>
<if test="reservationId != null and reservationId != ''">
and if = #{id}
and reservation_id = #{reservationId}
</if>
</where>
</delete>

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAddvalueService.java

@ -78,6 +78,13 @@ public interface IDistributionAddvalueService extends IService<DistributionAddva
*/
R saveAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO);
/**
* 保存增值服务列表
* @param distributionAppAddvalueDTO
* @return
*/
R savePCAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO);
/**
* 查询出该客户下的所有包件信息
* @param distributionAppAddvalueDTO

453
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java

@ -189,13 +189,14 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
}
@Override
@Transactional
public R saveAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
List<DistributionAddvaluePackageDTO> packageEntityList = distributionAppAddvalueDTO.getPackageEntityList();
List<DistributionAddvaluePackageDTO> packageDTOList = packageEntityList.stream().filter(p -> Func.isNotEmpty(p.getQuantity()) && p.getQuantity() > 0).collect(Collectors.toList());
if (Func.isEmpty(packageDTOList)) {
return Resp.scanFail("操作失败", "无可用包件信息");
if (Func.isEmpty(packageDTOList)){
return Resp.scanFail("操作失败","无可用包件信息");
}
//查询是否重复添加
DistributionAddvalueEntity addvalueEntity = distributionAddvalueMapper.selectOne(Wrappers.<DistributionAddvalueEntity>query().lambda()
@ -203,17 +204,17 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
.eq(DistributionAddvalueEntity::getRefId, distributionAppAddvalueDTO.getReservationId())
.eq(DistributionAddvalueEntity::getRefType, 1));
if (Func.isNotEmpty(addvalueEntity)) {
if (Func.isNotEmpty(addvalueEntity)){
return Resp.scanFail("操作失败", "存在该类型增值服务项,如需更改请编辑");
}
DistributionAddvalueDetailEntity distributionAddvalueDetailEntity = new DistributionAddvalueDetailEntity();
if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) {
return Resp.scanFail("添加失败", "错误的包件数量");
} else {
}else {
distributionAddvalueDetailEntity.setNum(distributionAppAddvalueDTO.getNum());
}
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(distributionAppAddvalueDTO.getReservationId());
if (Func.isEmpty(reservationEntity)) {
if (Func.isEmpty(reservationEntity)){
return Resp.scanFail("添加失败", "客户信息错误");
}
// 上楼 超区 平移 搬运 分拣 专车
@ -244,7 +245,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) {
return Resp.scanFail("添加失败", "请输入件数");
} else {
distributionAddvalueDetailEntity.setNum(packageEntityList.stream().mapToInt(DistributionAddvaluePackageDTO::getQuantity).sum());
distributionAddvalueDetailEntity.setNum(packageEntityList.stream().mapToInt(DistributionAddvaluePackageEntity::getQuantity).sum());
}
break;
case "6":
@ -263,13 +264,116 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
distributionAddvalueEntity.setRefType(1);
distributionAddvalueEntity.setRefId(distributionAppAddvalueDTO.getReservationId());
distributionAddvalueEntity.setDeliveryListId(distributionAppAddvalueDTO.getDeliveryId());
this.save(distributionAddvalueEntity);
distributionAddvalueDetailEntity.setAddvalueId(distributionAddvalueEntity.getId());
distributionAddvalueDetailEntity.setRecordType(2);
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId());
if (parcelListEntities.size() == packageEntityList.size()){
distributionAddvalueDetailEntity.setRecordType(1);
}
distributionAddvalueDetailService.save(distributionAddvalueDetailEntity);
List<DistributionAddvaluePackageEntity> addvaluePackageEntities = new ArrayList<>();
packageEntityList.stream().forEach(p->{p.setAddvalueDetailId(distributionAddvalueDetailEntity.getId());p.setQuantity(p.getZeroQuantity());addvaluePackageEntities.add(Func.copy(p,DistributionAddvaluePackageEntity.class));});
distributionAddvaluePackageService.saveBatch(addvaluePackageEntities);
return Resp.scanSuccess("添加成功","添加成功");
}
@Override
@Transactional
public R savePCAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
List<DistributionAddvaluePackageDTO> packageEntityList = distributionAppAddvalueDTO.getPackageEntityList();
List<DistributionAddvaluePackageDTO> packageDTOList = packageEntityList.stream().filter(p -> Func.isNotEmpty(p.getQuantity()) && p.getQuantity() > 0).collect(Collectors.toList());
if (Func.isEmpty(packageDTOList)) {
return Resp.scanFail("操作失败", "无可用包件信息");
}
//查询是否重复添加
DistributionAddvalueEntity addvalueEntity = distributionAddvalueMapper.selectOne(Wrappers.<DistributionAddvalueEntity>query().lambda()
.eq(DistributionAddvalueEntity::getAddvalueId, distributionAppAddvalueDTO.getAddvalueType())
.eq(DistributionAddvalueEntity::getRefId, distributionAppAddvalueDTO.getReservationId())
.eq(DistributionAddvalueEntity::getRefType, 1));
if (Func.isNotEmpty(addvalueEntity)) {
return Resp.scanFail("操作失败", "存在该类型增值服务项,如需更改请编辑");
}
DistributionAddvalueDetailEntity distributionAddvalueDetailEntity = new DistributionAddvalueDetailEntity();
// if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) {
// return Resp.scanFail("添加失败", "错误的包件数量");
// } else {
// distributionAddvalueDetailEntity.setNum(distributionAppAddvalueDTO.getNum());
// }
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(distributionAppAddvalueDTO.getReservationId());
if (Func.isEmpty(reservationEntity)) {
return Resp.scanFail("添加失败", "客户信息错误");
}
// 上楼 超区 平移 搬运 分拣 专车
switch (distributionAppAddvalueDTO.getAddvalueType()) {
case "1":
if (Func.isEmpty(distributionAppAddvalueDTO.getFloolNum())) {
return Resp.scanFail("添加失败", "请输入楼层数");
} else {
distributionAddvalueDetailEntity.setFloolNum(distributionAppAddvalueDTO.getFloolNum());
}
break;
case "2":
if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) {
return Resp.scanFail("添加失败", "请输入超区公里数");
} else {
distributionAddvalueDetailEntity.setDistance(distributionAppAddvalueDTO.getDistance());
}
break;
case "3":
if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) {
return Resp.scanFail("添加失败", "请输入平移距离");
} else {
distributionAddvalueDetailEntity.setDistance(distributionAppAddvalueDTO.getDistance());
}
break;
// case "4":
// case "5":
// if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) {
// return Resp.scanFail("添加失败", "请输入件数");
// } else {
// distributionAddvalueDetailEntity.setNum(packageEntityList.stream().mapToInt(DistributionAddvaluePackageDTO::getQuantity).sum());
// }
// break;
// case "6":
// if (Func.isEmpty(distributionAppAddvalueDTO.getFee())) {
// return Resp.scanFail("添加失败", "请输入件数");
// } else {
// distributionAddvalueDetailEntity.setFee(distributionAppAddvalueDTO.getFee());
// }
// break;
default:
return Resp.scanFail("添加失败", "服务器正忙");
}
int total = packageEntityList.stream().mapToInt(DistributionAddvaluePackageDTO::getQuantity).sum();
if ( total == 0) {
return Resp.scanFail("添加失败", "包件数量错误");
} else {
distributionAddvalueDetailEntity.setNum(packageEntityList.stream().mapToInt(DistributionAddvaluePackageDTO::getQuantity).sum());
}
if (Func.isEmpty(distributionAppAddvalueDTO.getFee())) {
return Resp.scanFail("添加失败", "请输入费用");
} else {
distributionAddvalueDetailEntity.setFee(distributionAppAddvalueDTO.getFee());
}
DistributionAddvalueEntity distributionAddvalueEntity = new DistributionAddvalueEntity();
distributionAddvalueEntity.setAddvalueId(distributionAppAddvalueDTO.getAddvalueType());
distributionAddvalueEntity.setCode(reservationEntity.getReservationCode());
distributionAddvalueEntity.setRefType(1);
distributionAddvalueEntity.setRefId(distributionAppAddvalueDTO.getReservationId());
distributionAddvalueEntity.setDeliveryListId(distributionAppAddvalueDTO.getDeliveryId());
distributionAddvalueEntity.setWarehouseId(reservationEntity.getWarehouseId());
distributionAddvalueEntity.setWarehouseName(reservationEntity.getWarehouseName());
this.save(distributionAddvalueEntity);
distributionAddvalueDetailEntity.setAddvalueId(distributionAddvalueEntity.getId());
distributionAddvalueDetailEntity.setRecordType(2);
// List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId());
if (reservationEntity.getReservationNum()+reservationEntity.getReservationStockListNum() == packageEntityList.size()) {
if (reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum() == packageEntityList.size()) {
distributionAddvalueDetailEntity.setRecordType(1);
}
distributionAddvalueDetailService.save(distributionAddvalueDetailEntity);
@ -283,28 +387,36 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
case 1:
//判定该包件是否属于该客户
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distributionAppAddvalueDTO.getReservationId());
boolean packageFlag = parcelListEntities.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId()));
if (packageFlag){
// boolean packageFlag = parcelListEntities.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId()));
boolean packageFlag = parcelListEntities.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()).contains(p.getPackageId());
if (!packageFlag) {
throw new RuntimeException("不属于该客户包件");
}
break;
case 2:
List<DistributionParcelNumberDTO> distributionParcelNumberDTOS = distributionReservationMapper.selectZeroPackageListByReservationId(distributionAppAddvalueDTO.getReservationId());
boolean zeroPackageFlag = distributionParcelNumberDTOS.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId()));
if (zeroPackageFlag){
List<DisStockListDetailEntity> detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionAppAddvalueDTO.getReservationId());
// boolean inventoryPackageFlag = detailEntities.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId()));
boolean inventoryPackageFlag = detailEntities.stream().map(DisStockListDetailEntity::getId).collect(Collectors.toList()).contains(p.getPackageId());
if (!inventoryPackageFlag) {
throw new RuntimeException("不属于该客户包件");
}
break;
case 3:
List<DisStockListDetailEntity> detailEntities = distributionReservationMapper.selectInventoryListByReservation(distributionAppAddvalueDTO.getReservationId());
boolean inventoryPackageFlag = detailEntities.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId()));
if (inventoryPackageFlag){
List<DistributionParcelNumberDTO> distributionParcelNumberDTOS = distributionReservationMapper.selectZeroPackageListByReservationId(distributionAppAddvalueDTO.getReservationId());
// boolean zeroPackageFlag = distributionParcelNumberDTOS.stream().allMatch(pack -> !Func.equals(pack.getId(), p.getPackageId()));
boolean zeroPackageFlag = distributionParcelNumberDTOS.stream().map(DistributionParcelNumberDTO::getId).collect(Collectors.toList()).contains(p.getPackageId());
if (!zeroPackageFlag) {
throw new RuntimeException("不属于该客户包件");
}
break;
}
p.setAddvalueDetailId(distributionAddvalueDetailEntity.getId());
addvaluePackageEntities.add(Func.copy(p, DistributionAddvaluePackageEntity.class));
DistributionAddvaluePackageEntity addvaluePackageEntity = Func.copy(p, DistributionAddvaluePackageEntity.class);
if (Func.isNotEmpty(p.getZeroQuantity())){
addvaluePackageEntity.setQuantity(p.getZeroQuantity());
}
addvaluePackageEntities.add(addvaluePackageEntity);
}
});
distributionAddvaluePackageService.saveBatch(addvaluePackageEntities);
@ -552,13 +664,20 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
.eq(DistributionAddvaluePackageEntity::getReservationId, distributionAppAddvalueDTO.getReservationId())
.eq(DistributionAddvaluePackageEntity::getAddvalueDetailId, distributionAppAddvalueDTO.getAddvalueDetailId())
);
packageIds.forEach(id -> {
distributionAddvaluePackageMapper.deleteAddvaluePackage(distributionAppAddvalueDTO.getReservationId(), id);
});
if (packageIds.size() == addvaluePackageEntities.size()) {
//这里就需要对整个增值服务项进行删除
distributionAddvalueDetailMapper.deleteAddvalueDetail(distributionAppAddvalueDTO.getAddvalueDetailId());
distributionAddvalueMapper.deleteAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType());
//查看取消增值服务的保健是否存在该项增值服务中,存在才能继续执行
boolean isExistence = packageIds.stream().allMatch(id -> addvaluePackageEntities.stream().map(DistributionAddvaluePackageEntity::getPackageId).collect(Collectors.toList()).contains(id));
if (isExistence) {
if (packageIds.size() == addvaluePackageEntities.size()) {
//这里就需要对整个增值服务项进行删除
distributionAddvalueDetailMapper.deleteAddvalueDetailById(distributionAppAddvalueDTO.getAddvalueDetailId());
distributionAddvalueMapper.deleteAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType());
}
packageIds.forEach(id -> {
distributionAddvaluePackageMapper.deleteAddvaluePackage(distributionAppAddvalueDTO.getReservationId(), id);
});
} else {
log.error("###########该包件不存在增值服务项包件列表中");
return R.fail("取消包件失败,该包件不存在增值服务项列表中");
}
return R.success("操作成功");
}
@ -566,117 +685,207 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
@Override
public R updatePCAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
List<DistributionAddvaluePackageDTO> packageEntityList = distributionAppAddvalueDTO.getPackageEntityList();
if (Func.isEmpty(packageEntityList)){
if (Func.isEmpty(packageEntityList)) {
return R.fail("无包件信息");
}
Map<Long, DistributionAddvaluePackageDTO> packageDTOMap = packageEntityList.stream().collect(Collectors.toMap(DistributionAddvaluePackageDTO::getPackageId, Function.identity(), (k1, k2) -> k2));
List<Long> zeroPackageIds = packageEntityList.stream().filter(p -> p.getConditions() == 3).collect(Collectors.toList()).stream().map(DistributionAddvaluePackageDTO::getPackageId).collect(Collectors.toList());
//这里需要查询出原来的增值服务项详情
DistributionAddvalueDetailEntity detailEntity = distributionAddvalueDetailMapper.selectById(distributionAppAddvalueDTO.getAddvalueDetailId());
if (Func.isEmpty(detailEntity)){
log.error("###########查询增值服务详情错误:{}",detailEntity);
log.error("###########AddvalueDetailId>>>>>>>>>>>>>>>>>>>>>>>>>>>:{}",detailEntity);
return R.fail("服务器正忙............");
}
String addvalueType = distributionAppAddvalueDTO.getAddvalueType();
switch (addvalueType) {
case "1":
if (Func.isEmpty(distributionAppAddvalueDTO.getFloolNum())) {
return Resp.scanFail("添加失败", "请输入楼层数");
} else {
detailEntity.setFloolNum(distributionAppAddvalueDTO.getFloolNum());
}
break;
case "2":
if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) {
return Resp.scanFail("添加失败", "请输入超区公里数");
} else {
detailEntity.setDistance(distributionAppAddvalueDTO.getDistance());
}
break;
case "3":
if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) {
return Resp.scanFail("添加失败", "请输入平移距离");
} else {
detailEntity.setDistance(distributionAppAddvalueDTO.getDistance());
}
break;
case "4":
case "5":
if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) {
return Resp.scanFail("添加失败", "请输入件数");
} else {
detailEntity.setNum(distributionAppAddvalueDTO.getNum());
}
break;
case "6":
if (Func.isEmpty(distributionAppAddvalueDTO.getFee())) {
return Resp.scanFail("添加失败", "错误的包件数量");
} else {
detailEntity.setFee(distributionAppAddvalueDTO.getFee());
}
break;
default:
return Resp.scanFail("添加失败", "服务器正忙");
//查询出对应所有增值服务项的包件信息
List<DistributionAddvaluePackageEntity> addvaluePackageEntities = distributionAddvaluePackageMapper.selectList(Wrappers.<DistributionAddvaluePackageEntity>query().lambda()
.eq(DistributionAddvaluePackageEntity::getReservationId, distributionAppAddvalueDTO.getReservationId())
.eq(DistributionAddvaluePackageEntity::getAddvalueDetailId, distributionAppAddvalueDTO.getAddvalueDetailId()));
List<Long> increasePackage = packageEntityList.stream()
.map(DistributionAddvaluePackageDTO::getPackageId)
.filter(p -> !addvaluePackageEntities.stream()
.map(DistributionAddvaluePackageEntity::getPackageId)
.collect(Collectors.toList()).contains(p))
.collect(Collectors.toList());
if (Func.isNotEmpty(zeroPackageIds)){
increasePackage.addAll(zeroPackageIds);
}
distributionAddvalueDetailMapper.updateById(detailEntity);
//查询出原来的包件信息
DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), addvalueType);
String packageListIds = addvalueVO.getPackageListIds();
if (Func.isEmpty(packageListIds)){
log.error("##############查询增值服务包件列表DI错误:{}",packageListIds);
if (increasePackage.size() == 0) {
//添加包件都已经存在在增值服务列表
return Resp.scanFail("添加失败", "包件已存在");
}
List<DistributionAddvaluePackageEntity> distributionAddvaluePackageEntities = distributionAddvaluePackageService.list(Wrappers.<DistributionAddvaluePackageEntity>query().lambda()
.in(DistributionAddvaluePackageEntity::getPackageId, Func.toLongList(packageListIds))
.eq(DistributionAddvaluePackageEntity::getAddvalueDetailId, distributionAppAddvalueDTO.getAddvalueDetailId()));
Map<Long, List<DistributionAddvaluePackageEntity>> oldPackageList = distributionAddvaluePackageEntities.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId));
Map<Long, List<DistributionAddvaluePackageDTO>> newPackageList = packageEntityList.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId));
newPackageList.forEach((k, v) -> {
DistributionAddvaluePackageDTO distributionAddvaluePackageEntity = v.get(0);
//只要不存在与就是新增,这里PC操作是一个包件累加操作,如果已经存在列表之中那么不进行添加
if (Func.isEmpty(oldPackageList.get(k))) {
//从老的包件中无法进行获取,这里进行包件的新增
DistributionAddvaluePackageEntity addvaluePackageEntity = new DistributionAddvaluePackageEntity();
addvaluePackageEntity.setQuantity(distributionAddvaluePackageEntity.getZeroQuantity());
addvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageEntity.getAddvalueDetailId());
addvaluePackageEntity.setStockArticleId(distributionAddvaluePackageEntity.getStockArticleId());
addvaluePackageEntity.setMaterialName(distributionAddvaluePackageEntity.getMaterialName());
addvaluePackageEntity.setPackageId(distributionAddvaluePackageEntity.getPackageId());
addvaluePackageEntity.setReservationId(distributionAddvaluePackageEntity.getReservationId());
if (distributionAddvaluePackageEntity.getConditions() == 3) {
addvaluePackageEntity.setConditions(3);
addvaluePackageEntity.setRecordType("3");
distributionAddvaluePackageService.save(addvaluePackageEntity);
} else if (distributionAddvaluePackageEntity.getConditions() == 1) {
//新增订制品
addvaluePackageEntity.setOrderPackageCode(distributionAddvaluePackageEntity.getOrderPackageCode());
addvaluePackageEntity.setRecordType("1");
addvaluePackageEntity.setConditions(1);
} else {
//新增库存品
addvaluePackageEntity.setOrderPackageCode(distributionAddvaluePackageEntity.getOrderPackageCode());
addvaluePackageEntity.setRecordType("2");
addvaluePackageEntity.setConditions(2);
}
// distributionAddvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageEntities.get(0).getAddvalueDetailId());
distributionAddvaluePackageService.save(addvaluePackageEntity);
} else {
if (distributionAddvaluePackageEntity.getConditions() == 3) {
if (distributionAddvaluePackageEntity.getZeroQuantity() != 0) {
if (distributionAddvaluePackageEntity.getZeroQuantity() > 0) {
distributionAddvaluePackageEntity.setQuantity(distributionAddvaluePackageEntity.getZeroQuantity());
distributionAddvaluePackageService.updateById(distributionAddvaluePackageEntity);
} else {
log.error("###############零担品类录入数量有误:{}", distributionAddvaluePackageEntity.getZeroQuantity());
if (increasePackage.size() > 0) {
//统计该项增值服务包件数量
int num = detailEntity.getNum() + increasePackage.size();
detailEntity.setNum(num);
switch (distributionAppAddvalueDTO.getAddvalueType()) {
case "1":
if (Func.isEmpty(distributionAppAddvalueDTO.getFloolNum())) {
return Resp.scanFail("添加失败", "请输入楼层数");
} else {
detailEntity.setFloolNum(distributionAppAddvalueDTO.getFloolNum());
}
break;
case "2":
if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) {
return Resp.scanFail("添加失败", "请输入超区公里数");
} else {
detailEntity.setDistance(distributionAppAddvalueDTO.getDistance());
}
break;
case "3":
if (Func.isEmpty(distributionAppAddvalueDTO.getDistance())) {
return Resp.scanFail("添加失败", "请输入平移距离");
} else {
detailEntity.setDistance(distributionAppAddvalueDTO.getDistance());
}
break;
// case "4":
// case "5":
// if (Func.isEmpty(distributionAppAddvalueDTO.getNum())) {
// return Resp.scanFail("添加失败", "请输入件数");
// } else {
// detailEntity.setNum(num);
// }
// break;
// case "6":
// if (Func.isEmpty(distributionAppAddvalueDTO.getFee())) {
// return Resp.scanFail("添加失败", "错误的包件数量");
// } else {
// detailEntity.setFee(distributionAppAddvalueDTO.getFee());
// }
// break;
default:
return Resp.scanFail("添加失败", "服务器正忙");
}
detailEntity.setFee(distributionAppAddvalueDTO.getFee());
detailEntity.setNum(num);
distributionAddvalueDetailMapper.updateById(detailEntity);
//添加新的包件信息
increasePackage.forEach(ip -> {
if (Func.isNotEmpty(packageDTOMap.get(ip))) {
//新增包件
DistributionAddvaluePackageDTO distributionAddvaluePackageDTO = packageDTOMap.get(ip);
DistributionAddvaluePackageEntity distributionAddvaluePackageEntity = distributionAddvaluePackageMapper.selectOne(Wrappers.<DistributionAddvaluePackageEntity>query().lambda()
.eq(DistributionAddvaluePackageEntity::getReservationId, distributionAddvaluePackageDTO.getReservationId())
.eq(DistributionAddvaluePackageEntity::getPackageId, distributionAddvaluePackageDTO.getPackageId())
.eq(DistributionAddvaluePackageEntity::getAddvalueDetailId, distributionAddvaluePackageDTO.getAddvalueDetailId())
.eq(DistributionAddvaluePackageEntity::getStockArticleId, distributionAddvaluePackageDTO.getStockArticleId())
);
if (distributionAddvaluePackageDTO.getConditions() == 3) {
if (Func.isEmpty(distributionAddvaluePackageEntity)){
//新增零担
// DistributionAddvaluePackageEntity zeroAddvaluePackageEntity = new DistributionAddvaluePackageEntity();
if (distributionAddvaluePackageDTO.getZeroQuantity() > 0){
DistributionAddvaluePackageEntity zeroAddvaluePackageEntity = Func.copy(distributionAddvaluePackageDTO, DistributionAddvaluePackageEntity.class);
distributionAddvaluePackageEntity.setQuantity(distributionAddvaluePackageDTO.getZeroQuantity());
distributionAddvaluePackageService.updateById(zeroAddvaluePackageEntity);
}else {
log.error("###############零担品类录入数量0:{}", distributionAddvaluePackageDTO.getPackageId());
}
}else {
if (distributionAddvaluePackageDTO.getZeroQuantity() > 0) {
distributionAddvaluePackageEntity.setQuantity(distributionAddvaluePackageDTO.getZeroQuantity());
distributionAddvaluePackageService.updateById(distributionAddvaluePackageEntity);
} else {
log.error("###############零担品类录入数量0:{}", distributionAddvaluePackageDTO.getPackageId());
}
}
} else {
//删除对应的包件信息
distributionAddvaluePackageMapper.deleteAddvaluePackage(distributionAddvaluePackageEntity.getReservationId(), distributionAddvaluePackageEntity.getPackageId());
DistributionAddvaluePackageEntity addvaluePackageEntity = new DistributionAddvaluePackageEntity();
addvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageDTO.getAddvalueDetailId());
addvaluePackageEntity.setStockArticleId(distributionAddvaluePackageDTO.getStockArticleId());
addvaluePackageEntity.setAddvalueDetailId(distributionAppAddvalueDTO.getAddvalueDetailId());
addvaluePackageEntity.setOrderCode(distributionAddvaluePackageDTO.getOrderCode());
addvaluePackageEntity.setMaterialName(distributionAddvaluePackageDTO.getMaterialName());
addvaluePackageEntity.setPackageId(distributionAddvaluePackageDTO.getPackageId());
addvaluePackageEntity.setReservationId(distributionAddvaluePackageDTO.getReservationId());
addvaluePackageEntity.setQuantity(distributionAddvaluePackageDTO.getQuantity());
if (distributionAddvaluePackageDTO.getConditions() == 1) {
//新增订制品
addvaluePackageEntity.setOrderPackageCode(distributionAddvaluePackageDTO.getOrderPackageCode());
addvaluePackageEntity.setRecordType("3");
addvaluePackageEntity.setConditions(1);
} else {
//新增库存品
addvaluePackageEntity.setMaterialName(distributionAddvaluePackageDTO.getMaterialName());
addvaluePackageEntity.setOrderPackageCode(distributionAddvaluePackageDTO.getOrderPackageCode());
addvaluePackageEntity.setRecordType("3");
addvaluePackageEntity.setConditions(2);
}
distributionAddvaluePackageService.save(addvaluePackageEntity);
}
}
}
});
return R.status(true);
});
}
return R.status(true);
}
// if (Func.isEmpty(detailEntity)) {
// log.error("###########查询增值服务详情错误:{}", detailEntity);
// log.error("###########AddvalueDetailId>>>>>>>>>>>>>>>>>>>>>>>>>>>:{}", detailEntity);
// return R.fail("服务器正忙............");
// }
// String addvalueType = distributionAppAddvalueDTO.getAddvalueType();
//
// distributionAddvalueDetailMapper.updateById(detailEntity);
//查询出原来的包件信息
// DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), addvalueType);
// String packageListIds = addvalueVO.getPackageListIds();
// if (Func.isEmpty(packageListIds)) {
// log.error("##############查询增值服务包件列表DI错误:{}", packageListIds);
// }
// List<DistributionAddvaluePackageEntity> distributionAddvaluePackageEntities = distributionAddvaluePackageService.list(Wrappers.<DistributionAddvaluePackageEntity>query().lambda()
// .in(DistributionAddvaluePackageEntity::getPackageId, Func.toLongList(packageListIds))
// .eq(DistributionAddvaluePackageEntity::getAddvalueDetailId, distributionAppAddvalueDTO.getAddvalueDetailId()));
// Map<Long, List<DistributionAddvaluePackageEntity>> oldPackageList = distributionAddvaluePackageEntities.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId));
// Map<Long, List<DistributionAddvaluePackageDTO>> newPackageList = packageEntityList.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId));
// newPackageList.forEach((k, v) -> {
// DistributionAddvaluePackageDTO distributionAddvaluePackageEntity = v.get(0);
// //只要不存在与就是新增,这里PC操作是一个包件累加操作,如果已经存在列表之中那么不进行添加
// if (Func.isEmpty(oldPackageList.get(k))) {
// //从老的包件中无法进行获取,这里进行包件的新增
// DistributionAddvaluePackageEntity addvaluePackageEntity = new DistributionAddvaluePackageEntity();
// addvaluePackageEntity.setQuantity(distributionAddvaluePackageEntity.getZeroQuantity());
// addvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageEntity.getAddvalueDetailId());
// addvaluePackageEntity.setStockArticleId(distributionAddvaluePackageEntity.getStockArticleId());
// addvaluePackageEntity.setMaterialName(distributionAddvaluePackageEntity.getMaterialName());
// addvaluePackageEntity.setPackageId(distributionAddvaluePackageEntity.getPackageId());
// addvaluePackageEntity.setReservationId(distributionAddvaluePackageEntity.getReservationId());
// if (distributionAddvaluePackageEntity.getConditions() == 3) {
// addvaluePackageEntity.setConditions(3);
// addvaluePackageEntity.setRecordType("3");
// distributionAddvaluePackageService.save(addvaluePackageEntity);
// } else if (distributionAddvaluePackageEntity.getConditions() == 1) {
// //新增订制品
// addvaluePackageEntity.setOrderPackageCode(distributionAddvaluePackageEntity.getOrderPackageCode());
// addvaluePackageEntity.setRecordType("1");
// addvaluePackageEntity.setConditions(1);
// } else {
// //新增库存品
// addvaluePackageEntity.setOrderPackageCode(distributionAddvaluePackageEntity.getOrderPackageCode());
// addvaluePackageEntity.setRecordType("2");
// addvaluePackageEntity.setConditions(2);
// }
//// distributionAddvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageEntities.get(0).getAddvalueDetailId());
// distributionAddvaluePackageService.save(addvaluePackageEntity);
// } else {
// if (distributionAddvaluePackageEntity.getConditions() == 3) {
// if (distributionAddvaluePackageEntity.getZeroQuantity() != 0) {
// if (distributionAddvaluePackageEntity.getZeroQuantity() > 0) {
// distributionAddvaluePackageEntity.setQuantity(distributionAddvaluePackageEntity.getZeroQuantity());
// distributionAddvaluePackageService.updateById(distributionAddvaluePackageEntity);
// } else {
// log.error("###############零担品类录入数量有误:{}", distributionAddvaluePackageEntity.getZeroQuantity());
// }
// } else {
// //删除对应的包件信息
// distributionAddvaluePackageMapper.deleteAddvaluePackage(distributionAddvaluePackageEntity.getReservationId(), distributionAddvaluePackageEntity.getPackageId());
// }
// }
// }
// });
// return R.status(true);
// }
// @Override
// public List<DistributionAddvaluePackageEntity> getAddvalueBySignfor(DistributionAddvalueDTO distributionAddvalueDTO) {
// DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.getAddvalueBySignfor(distributionAddvalueDTO);

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

@ -5367,17 +5367,41 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
return Resp.scanFail("操作失败","不属于该配送任务!!!");
}
}
break;
case 2:
List<DistributionRetentionScanVo> distributionRetentionScanVos = baseMapper.selectRetentionZeroPackage(distrilbutionloadingscanDTO.getDeliveryId(),distrilbutionloadingscanDTO.getBarcode());
if (Func.isNotEmpty(distributionRetentionScanVos)){
retentionScanVos.addAll(distributionRetentionScanVos);
}
break;
case 2:
//托盘
break;
default:
log.info("################无满足滞留扫描类型");
break;
// //托盘
// TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeClient.selectListByTrayCode(distrilbutionloadingscanDTO.getBarcode());
// if (Func.isEmpty(trayTypeDataVO)){
// log.error("################查询托盘失败,托盘码为:{}",distrilbutionloadingscanDTO.getBarcode());
// return Resp.scanFail("扫描托盘失败","请扫描托盘码");
// }
// List<WarehouseTrayGoodsEntity> goodsLsit = trayTypeDataVO.getGoodsLsit();
// boolean flag = goodsLsit.stream().allMatch(good -> good.getAssociationType().equals("3"));
// if (!flag){
// log.error("#########托盘货物存在多种类型,:{}", goodsLsit.stream().distinct().map(WarehouseTrayGoodsEntity::getAssociationType).collect(Collectors.toList()));
// return Resp.scanFail("托盘存在多种货物","托盘存在多种货物");
// }
// //查询出配送任务所有包件
//// List<DistributionParcelListEntity> parcelListEntityList = baseMapper.selectPackageListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
// boolean isBelongTo = goodsLsit.stream().map(WarehouseTrayGoodsEntity::getAssociationId).allMatch(good -> parcelListEntities.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()).contains(good));
// if (isBelongTo){
// //判断包件是否都属于该配送计划
// goodsLsit.forEach(g->{
// DistributionRetentionScanVo retentionScanVo = baseMapper.selectRetentionPackage(g.getAssociationValue(), distrilbutionloadingscanDTO.getDeliveryId());
// retentionScanVos.add(retentionScanVo);
// });
// }else {
// log.error("####################托盘包件不完全属于该配送任务,isBelongTo:{}",isBelongTo);
// return Resp.scanFail("存在货物不属于该任务","存在货物不属于该任务");
// }
// break;
// default:
// log.info("################无满足滞留扫描类型");
// break;
}
// warehouseRetentionScanClient.saveRetentionScan();
if (Func.isEmpty(retentionScanVos)){

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

@ -3167,99 +3167,99 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
@Override
public boolean retentionCancelReservationPack(DistributionRetentionScanVo distributionRetentionScanVo) {
//滞留取消配送任务
Integer conditions = distributionRetentionScanVo.getConditions();
DistributionReservationEntity reservationEntity = this.getById(distributionRetentionScanVo.getReservationId());
if (Func.isEmpty(reservationEntity)){
log.error("###########查询预约计划错误,reservationId:{}",distributionRetentionScanVo.getReservationId());
return false;
}
switch (conditions){
// 1 定制 2-零担 3-库存品
case 1:
if (reservationEntity.getReservationNum() == distributionRetentionScanVo.getRetentionQuantity() && reservationEntity.getReservationStockListNum() == 0){
//该预约订单只存在该包件并且没有库存品
this.cancelReservation(Func.copy(reservationEntity,DistributionReservationDTO.class));
}else {
DistributionReservationPackageEntity reservationPackageEntity = distributionReservationPackageMapper.selectOne(Wrappers.<DistributionReservationPackageEntity>query().lambda()
.eq(DistributionReservationPackageEntity::getReservationId, distributionRetentionScanVo.getReservationId())
.eq(DistributionReservationPackageEntity::getStockArticleId, distributionRetentionScanVo.getOrderId())
.eq(DistributionReservationPackageEntity::getParceListId, distributionRetentionScanVo.getOrderPackageId())
.ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue()));
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue());
distributionReservationPackageMapper.updateById(reservationPackageEntity);
DistributionReservationStockarticleEntity reservationStockarticleEntity = distributionReservationStockarticleMapper.selectOne(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId, distributionRetentionScanVo.getReservationId())
.eq(DistributionReservationStockarticleEntity::getStockArticleId, distributionRetentionScanVo.getOrderId())
.eq(DistributionReservationStockarticleEntity::getIsZero, IsOrNoConstant.no.getValue())
.ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
Integer reservationNum = reservationStockarticleEntity.getReservationNum();
Integer retentionQuantity = distributionRetentionScanVo.getRetentionQuantity();
if ((reservationNum - retentionQuantity) == 0){
reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue());
}
reservationStockarticleEntity.setReservationNum(reservationNum - retentionQuantity);
distributionReservationStockarticleMapper.updateById(reservationStockarticleEntity);
reservationEntity.setReservationNum(reservationEntity.getReservationNum() - retentionQuantity);
this.updateById(reservationEntity);
}
break;
case 2:
if (reservationEntity.getReservationStockListNum() == distributionRetentionScanVo.getRetentionQuantity() && reservationEntity.getReservationNum() == 0){
this.cancelReservation(Func.copy(reservationEntity,DistributionReservationDTO.class));
}else {
DisStockListDetailEntity disStockListDetailEntity = disStockListDetailMapper.selectOne(Wrappers.<DisStockListDetailEntity>query().lambda()
.eq(DisStockListDetailEntity::getReservationId, distributionRetentionScanVo.getReservationId())
.eq(DisStockListDetailEntity::getStockListId, distributionRetentionScanVo.getInventoryId())
.eq(DisStockListDetailEntity::getId, distributionRetentionScanVo.getOrderPackageId())
);
disStockListDetailEntity.setStockPackageStatus(ReservationPackageStatusConstant.quxiao.getValue());
disStockListDetailMapper.updateById(disStockListDetailEntity);
DistributionReservationStocklistEntity reservationStocklistEntity = distributionReservationStocklistMapper.selectOne(Wrappers.<DistributionReservationStocklistEntity>query().lambda()
.eq(DistributionReservationStocklistEntity::getReservationId, distributionRetentionScanVo.getReservationId())
.eq(DistributionReservationStocklistEntity::getStocklistId, distributionRetentionScanVo.getInventoryId())
.ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationOrderStatusConstant.quxiao.getValue())
);
Integer reservationNum = reservationStocklistEntity.getReservationNum();
}
break;
case 3:
if (reservationEntity.getReservationNum() == distributionRetentionScanVo.getRetentionQuantity() && reservationEntity.getReservationStockListNum() == 0){
//该预约订单只存在该包件并且没有库存品
this.cancelReservation(Func.copy(reservationEntity,DistributionReservationDTO.class));
}else {
DistributionReservationZeroPackageEntity reservationZeroPackageEntity = distributionReservationZeroPackageMapper.selectOne(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
.eq(DistributionReservationZeroPackageEntity::getReservationId, distributionRetentionScanVo.getReservationId())
.eq(DistributionReservationZeroPackageEntity::getStockArticleId, distributionRetentionScanVo.getOrderId())
.eq(DistributionReservationZeroPackageEntity::getParcelListId, distributionRetentionScanVo.getOrderPackageId())
.ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()));
if (reservationZeroPackageEntity.getQuantity() == distributionRetentionScanVo.getRetentionQuantity()){
reservationZeroPackageEntity.setZeroPackageStatus(ReservationPackageStatusConstant.quxiao.getValue());
}
reservationZeroPackageEntity.setQuantity(reservationZeroPackageEntity.getQuantity() -distributionRetentionScanVo.getRetentionQuantity());
distributionReservationZeroPackageMapper.updateById(reservationZeroPackageEntity);
DistributionReservationStockarticleEntity reservationStockarticleEntity = distributionReservationStockarticleMapper.selectOne(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId, distributionRetentionScanVo.getReservationId())
.eq(DistributionReservationStockarticleEntity::getStockArticleId, distributionRetentionScanVo.getOrderId())
.eq(DistributionReservationStockarticleEntity::getIsZero, IsOrNoConstant.no.getValue())
.ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
Integer reservationNum = reservationStockarticleEntity.getReservationNum();
Integer retentionQuantity = distributionRetentionScanVo.getRetentionQuantity();
if ((reservationNum - retentionQuantity) == 0){
reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue());
}
reservationStockarticleEntity.setReservationNum(reservationNum - retentionQuantity);
distributionReservationStockarticleMapper.updateById(reservationStockarticleEntity);
reservationEntity.setReservationNum(reservationEntity.getReservationNum() - retentionQuantity);
this.updateById(reservationEntity);
}
break;
}
log.info("@@@@@@@@@@@@执行了包件滞留取消");
// //滞留取消配送任务
// Integer conditions = distributionRetentionScanVo.getConditions();
// DistributionReservationEntity reservationEntity = this.getById(distributionRetentionScanVo.getReservationId());
// if (Func.isEmpty(reservationEntity)){
// log.error("###########查询预约计划错误,reservationId:{}",distributionRetentionScanVo.getReservationId());
// return false;
// }
// switch (conditions){
// // 1 定制 2-零担 3-库存品
// case 1:
// if (reservationEntity.getReservationNum() == distributionRetentionScanVo.getRetentionQuantity() && reservationEntity.getReservationStockListNum() == 0){
// //该预约订单只存在该包件并且没有库存品
// this.cancelReservation(Func.copy(reservationEntity,DistributionReservationDTO.class));
// }else {
// DistributionReservationPackageEntity reservationPackageEntity = distributionReservationPackageMapper.selectOne(Wrappers.<DistributionReservationPackageEntity>query().lambda()
// .eq(DistributionReservationPackageEntity::getReservationId, distributionRetentionScanVo.getReservationId())
// .eq(DistributionReservationPackageEntity::getStockArticleId, distributionRetentionScanVo.getOrderId())
// .eq(DistributionReservationPackageEntity::getParceListId, distributionRetentionScanVo.getOrderPackageId())
// .ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue()));
// reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue());
// distributionReservationPackageMapper.updateById(reservationPackageEntity);
// DistributionReservationStockarticleEntity reservationStockarticleEntity = distributionReservationStockarticleMapper.selectOne(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
// .eq(DistributionReservationStockarticleEntity::getReservationId, distributionRetentionScanVo.getReservationId())
// .eq(DistributionReservationStockarticleEntity::getStockArticleId, distributionRetentionScanVo.getOrderId())
// .eq(DistributionReservationStockarticleEntity::getIsZero, IsOrNoConstant.no.getValue())
// .ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
// Integer reservationNum = reservationStockarticleEntity.getReservationNum();
// Integer retentionQuantity = distributionRetentionScanVo.getRetentionQuantity();
// if ((reservationNum - retentionQuantity) == 0){
// reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue());
// }
// reservationStockarticleEntity.setReservationNum(reservationNum - retentionQuantity);
// distributionReservationStockarticleMapper.updateById(reservationStockarticleEntity);
// reservationEntity.setReservationNum(reservationEntity.getReservationNum() - retentionQuantity);
// this.updateById(reservationEntity);
// }
// break;
// case 2:
// if (reservationEntity.getReservationStockListNum() == distributionRetentionScanVo.getRetentionQuantity() && reservationEntity.getReservationNum() == 0){
// this.cancelReservation(Func.copy(reservationEntity,DistributionReservationDTO.class));
// }else {
// DisStockListDetailEntity disStockListDetailEntity = disStockListDetailMapper.selectOne(Wrappers.<DisStockListDetailEntity>query().lambda()
// .eq(DisStockListDetailEntity::getReservationId, distributionRetentionScanVo.getReservationId())
// .eq(DisStockListDetailEntity::getStockListId, distributionRetentionScanVo.getInventoryId())
// .eq(DisStockListDetailEntity::getId, distributionRetentionScanVo.getOrderPackageId())
// );
// disStockListDetailEntity.setStockPackageStatus(ReservationPackageStatusConstant.quxiao.getValue());
// disStockListDetailMapper.updateById(disStockListDetailEntity);
// DistributionReservationStocklistEntity reservationStocklistEntity = distributionReservationStocklistMapper.selectOne(Wrappers.<DistributionReservationStocklistEntity>query().lambda()
// .eq(DistributionReservationStocklistEntity::getReservationId, distributionRetentionScanVo.getReservationId())
// .eq(DistributionReservationStocklistEntity::getStocklistId, distributionRetentionScanVo.getInventoryId())
// .ne(DistributionReservationStocklistEntity::getStockListStatus, ReservationOrderStatusConstant.quxiao.getValue())
// );
// Integer reservationNum = reservationStocklistEntity.getReservationNum();
//
// }
// break;
// case 3:
// if (reservationEntity.getReservationNum() == distributionRetentionScanVo.getRetentionQuantity() && reservationEntity.getReservationStockListNum() == 0){
// //该预约订单只存在该包件并且没有库存品
// this.cancelReservation(Func.copy(reservationEntity,DistributionReservationDTO.class));
// }else {
// DistributionReservationZeroPackageEntity reservationZeroPackageEntity = distributionReservationZeroPackageMapper.selectOne(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
// .eq(DistributionReservationZeroPackageEntity::getReservationId, distributionRetentionScanVo.getReservationId())
// .eq(DistributionReservationZeroPackageEntity::getStockArticleId, distributionRetentionScanVo.getOrderId())
// .eq(DistributionReservationZeroPackageEntity::getParcelListId, distributionRetentionScanVo.getOrderPackageId())
// .ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()));
// if (reservationZeroPackageEntity.getQuantity() == distributionRetentionScanVo.getRetentionQuantity()){
// reservationZeroPackageEntity.setZeroPackageStatus(ReservationPackageStatusConstant.quxiao.getValue());
// }
// reservationZeroPackageEntity.setQuantity(reservationZeroPackageEntity.getQuantity() -distributionRetentionScanVo.getRetentionQuantity());
// distributionReservationZeroPackageMapper.updateById(reservationZeroPackageEntity);
// DistributionReservationStockarticleEntity reservationStockarticleEntity = distributionReservationStockarticleMapper.selectOne(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
// .eq(DistributionReservationStockarticleEntity::getReservationId, distributionRetentionScanVo.getReservationId())
// .eq(DistributionReservationStockarticleEntity::getStockArticleId, distributionRetentionScanVo.getOrderId())
// .eq(DistributionReservationStockarticleEntity::getIsZero, IsOrNoConstant.no.getValue())
// .ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
// Integer reservationNum = reservationStockarticleEntity.getReservationNum();
// Integer retentionQuantity = distributionRetentionScanVo.getRetentionQuantity();
// if ((reservationNum - retentionQuantity) == 0){
// reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue());
// }
// reservationStockarticleEntity.setReservationNum(reservationNum - retentionQuantity);
// distributionReservationStockarticleMapper.updateById(reservationStockarticleEntity);
// reservationEntity.setReservationNum(reservationEntity.getReservationNum() - retentionQuantity);
// this.updateById(reservationEntity);
// }
// break;
//
// }
return false;
}
}

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

@ -2880,7 +2880,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
});
}
page.setTotal(addvaluePackageVOS.size());
return page.setRecords(addvaluePackageVOS);
}
}

10
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/api/WarehouseRetentionApiController.java

@ -85,6 +85,16 @@ public class WarehouseRetentionApiController {
}
@PostMapping("/updateRetentionList")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "保存滞留扫描列表", notes = "传入trayTypeDTO")
public R updateRetentionList(@RequestBody WarehouseRetentionRecordDTO warehouseRetentionScanDTOS) {
// R r = warehouseRetentionScanService.saveRetentionList(warehouseRetentionScanDTOS);
R r = warehouseRetentionRecordService.updateRetentionList(warehouseRetentionScanDTOS);
return r;
}
// @GetMapping("/initRetentionList")
// @ApiOperationSupport(order = 1)

8
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseRetentionRecordService.java

@ -73,4 +73,12 @@ public interface IWarehouseRetentionRecordService extends BaseService<WarehouseR
R saveRetentionList(WarehouseRetentionRecordDTO warehouseRetentionScanDTOS);
List<WarehouseRetentionRecordExcel> exportWarehouseRetentionRecord(Map<String, Object> paramMap);
/**
* 增加滞留包件
* @param warehouseRetentionScanDTOS
* @return
*/
R updateRetentionList(WarehouseRetentionRecordDTO warehouseRetentionScanDTOS);
}

64
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionRecordServiceImpl.java

@ -43,6 +43,7 @@ import com.logpm.warehouse.mapper.WarehouseRetentionRecordMapper;
import com.logpm.warehouse.service.IWarehouseRetentionRecordService;
import com.logpm.warehouse.service.IWarehouseRetentionScanService;
import com.logpm.warehouse.vo.WarehouseRetentionRecordVO;
import com.logpm.warehouse.vo.WarehouseRetentionScanVO;
import com.logpm.warehouse.vo.WarehouseWaybillDetentionVO;
import com.logpm.warehouse.wrapper.WarehouseRetentionRecordWrapper;
import com.logpm.warehouse.wrapper.WarehouseRetentionScanWrapper;
@ -62,6 +63,7 @@ import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -176,20 +178,26 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
warehouseRetentionRecordEntity.setRetentionCarId(warehouseRetentionRecordDTO.getLoadingId());
warehouseRetentionRecordEntity.setRetentionWarehouseId(myCurrentWarehouse.getId());
warehouseRetentionRecordEntity.setRetentionWarehouseName(myCurrentWarehouse.getName());
warehouseRetentionRecordEntity.setRetentionWarehouseName(myCurrentWarehouse.getName());
warehouseRetentionRecordEntity.setRetentionType(RetentionTypeConstant.peisongzhiliu.getValue());
warehouseRetentionRecordEntity.setRetentionCreateUserId(user.getUserId());
warehouseRetentionRecordEntity.setRetentionCreateUserName(user.getUserName());
this.save(warehouseRetentionRecordEntity);
AtomicInteger retentionTotal = new AtomicInteger();
warehouseRetentionScanDTOS.forEach(r->{
r.setRetentionScanTime(new Date());
r.setRetentionScanUserId(user.getUserId());
r.setRetentionScanUsername(user.getUserName());
r.setRetentionQuantity(r.getRetentionQuantity());
retentionTotal.getAndAdd(r.getRetentionQuantity());
r.setDeliveryId(warehouseRetentionRecordDTO.getDeliveryId());
r.setRefId(warehouseRetentionRecordEntity.getId());
warehouseRetentionScanService.save(Func.copy(r,WarehouseRetentionScanEntity.class));
//进行滞留操作的包件需要和原来订单 预约进行绑定解除
//TODO 需要一个取消配送包件的方法
// reservationClient.retentionCancelReservationPack();
});
warehouseRetentionRecordEntity.setRetentionQuantity(retentionTotal.get());
this.updateById(warehouseRetentionRecordEntity);
return Resp.scanSuccess("操作成功","操作成功");
}
@ -218,4 +226,58 @@ public class WarehouseRetentionRecordServiceImpl extends BaseServiceImpl<Warehou
return list;
}
@Override
public R updateRetentionList(WarehouseRetentionRecordDTO warehouseRetentionScanDTOS) {
// 获取当前登录的仓库信息
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(ObjectUtils.isNull(myCurrentWarehouse)){
return R.fail(403,"无仓库信息");
}
List<WarehouseRetentionScanDTO> warehouseRetentionScanDTOList = warehouseRetentionScanDTOS.getWarehouseRetentionScanDTOS();
if (Func.isEmpty(warehouseRetentionScanDTOList)){
log.error("##########缺少滞留包件列表:{}",warehouseRetentionScanDTOList);
return Resp.scanFail("无滞留包件信息","无滞留包件信息");
}
//如果滞留全部为空,这里执行删除操作
//查询出该滞留任务是否存在
List<WarehouseRetentionScanEntity> retentionScanEntityList = warehouseRetentionScanService.list(Wrappers.<WarehouseRetentionScanEntity>query().lambda()
.eq(WarehouseRetentionScanEntity::getDeliveryId, warehouseRetentionScanDTOS.getDeliveryId())
.eq(WarehouseRetentionScanEntity::getRefId, warehouseRetentionScanDTOS.getId()));
WarehouseRetentionRecordEntity retentionRecordEntity = this.getById(warehouseRetentionScanDTOS.getId());
if(Func.isNotEmpty(retentionScanEntityList)){
BladeUser user = AuthUtil.getUser();
Map<Long, WarehouseRetentionScanEntity> retentionPackageMap = retentionScanEntityList.stream().collect(Collectors.toMap(WarehouseRetentionScanEntity::getOrderPackageId, Function.identity(), (k1, k2) -> k2));
warehouseRetentionScanDTOList.forEach(rs->{
if (Func.isNotEmpty(retentionPackageMap.get(rs.getOrderPackageId()))){
//查看是否是零担,如果是零担需要查看是否发生数量修改
WarehouseRetentionScanEntity warehouseRetentionScanEntity = retentionPackageMap.get(rs.getOrderPackageId());
if (retentionPackageMap.get(rs.getOrderPackageId()).getConditions()==3){
//零担查看是否发生数据修改
if (warehouseRetentionScanEntity.getRetentionQuantity() != rs.getRetentionQuantity() && rs.getRetentionQuantity()>0){
warehouseRetentionScanEntity.setRetentionQuantity(rs.getRetentionQuantity());
warehouseRetentionScanService.updateById(warehouseRetentionScanEntity);
}
}
}else {
//在原列表中查询不到,这里视为新增滞留包件
rs.setRetentionScanTime(new Date());
rs.setRetentionScanUserId(user.getUserId());
rs.setRetentionScanUsername(user.getUserName());
// rs.setRetentionQuantity(r.getRetentionQuantity());
// retentionTotal.getAndAdd(r.getRetentionQuantity());
rs.setDeliveryId(warehouseRetentionScanDTOS.getDeliveryId());
rs.setRefId(retentionRecordEntity.getId());
warehouseRetentionScanService.save(Func.copy(rs,WarehouseRetentionScanEntity.class));
}
});
}
//统计该滞留任务的包件数量
int retentionTotal = warehouseRetentionScanService.list(Wrappers.<WarehouseRetentionScanEntity>query().lambda()
.eq(WarehouseRetentionScanEntity::getDeliveryId, warehouseRetentionScanDTOS.getDeliveryId())
.eq(WarehouseRetentionScanEntity::getRefId, warehouseRetentionScanDTOS.getId())).stream().mapToInt(WarehouseRetentionScanEntity::getRetentionQuantity).sum();
retentionRecordEntity.setRetentionQuantity(retentionTotal);
this.updateById(retentionRecordEntity);
return Resp.scanSuccess("操作成功","操作成功");
}
}

Loading…
Cancel
Save