diff --git a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillLadingEntity.java b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillLadingEntity.java index af5c6a970..01c2495d0 100644 --- a/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillLadingEntity.java +++ b/blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/DistrilbutionBillLadingEntity.java @@ -106,6 +106,7 @@ public class DistrilbutionBillLadingEntity extends TenantEntity { * 证件类型 */ @ApiModelProperty(value = "证件类型") + @TableField(exist = false) private String certificateTypeName; /** * 费用合计 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java index 32d696ec9..d46840243 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java @@ -111,7 +111,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl { boolean b = distrilbutionBillLading.getStockDTOList().stream().anyMatch(a -> i.getStockListId().equals(a.getId())); + List list1 = distributionStockService.list(Wrappers.query().lambda() + .eq(DistributionStockEntity::getBillLadingId, distrilbutionBillLading.getId()) + .eq(DistributionStockEntity::getStockListId, i.getStockListId()) + .eq(DistributionStockEntity::getType, "2") + ); + + if (b) { //有 Iterator iterator = distrilbutionBillLading.getStockDTOList().iterator(); @@ -179,31 +188,70 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl quantity){ - num = inventoryQuantity - quantity; //多 + num = inventoryQuantity - quantity; //多 添加了数量 //修改库存占用数量 distributionAsyncService.getInventoryNumUpdate(i.getStockListId(),num,1); + //kk备货 + if (i.getConditions().equals("2")) { + //xiugai + DistributionDeliveryDetailsEntity d = new DistributionDeliveryDetailsEntity(); + d.setId(i.getId()); + d.setConditions("1"); + distributionDeliveryDetailsService.updateById(d); + } }else if(inventoryQuantity < quantity){ - num = quantity - inventoryQuantity; //少 - //修改库存占用数量 - distributionAsyncService.getInventoryNumUpdate(i.getStockListId(),num,2); + num = quantity - inventoryQuantity; //少 减少了数量 + /*if(list1.size() < 1){ + + }else{ + //有备货 + }*/ + + if(i.getConditions().equals("2")){ + //todo 已完成 + + }else{ + //todo 未完成 + int size = list1.size(); //扫描的数量 + int i1 = quantity - size; //未扫的数量 + if(i1 > num){ + //可以减少 + //修改库存占用数量 + distributionAsyncService.getInventoryNumUpdate(i.getStockListId(),num,2); + }else{ + //todo 未扫小于减少 + + } + + } + } iterator.remove(); } } } else { + + if(list1.size() < 1){ + //取消库存占用数量 + distributionAsyncService.getInventoryNumUpdate(i.getStockListId(),i.getQuantity(),2); + } //没有 删除 ids.add(i.getId()); - //取消库存占用数量 - distributionAsyncService.getInventoryNumUpdate(i.getStockListId(),i.getQuantity(),2); + } }); //删除没有的库存品 if(ids.size() > 0){ - distributionDeliveryDetailsService.deleteLogic(ids); + ids.forEach( a ->{ + DistributionDeliveryDetailsEntity deliveryDetails = new DistributionDeliveryDetailsEntity(); + deliveryDetails.setId(a); + deliveryDetails.setInventoryStatus("3"); + distributionDeliveryDetailsService.updateById(deliveryDetails); + }); } - } } } else { @@ -243,12 +291,18 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl 0){ //没有 List detailsEntities = new ArrayList<>(); + Boolean finalLas = las; distrilbutionBillLading.getStockDTOList().forEach(i -> { DistributionDeliveryDetailsEntity details = new DistributionDeliveryDetailsEntity(); details.setBillLadingId(distrilbutionBillLading.getId()); details.setStockListId(i.getId()); details.setQuantity(i.getInventoryQuantity()); details.setConditions("1"); + if(finalLas){ + details.setInventoryStatus("2"); + }else{ + details.setInventoryStatus("1"); + } detailsEntities.add(details); //修改库存数量 distributionAsyncService.getInventoryNumUpdate(i.getId(),i.getInventoryQuantity(),1);