|
|
|
@ -16,6 +16,7 @@
|
|
|
|
|
*/ |
|
|
|
|
package com.logpm.distribution.service.impl; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
@ -130,13 +131,13 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
this.updateById(distrilbutionBillLading); |
|
|
|
|
//修改图片
|
|
|
|
|
List<DistributionPrintEntity> printEntityList = distributionPrintService.list(Wrappers.<DistributionPrintEntity>query().lambda().eq(DistributionPrintEntity::getBillLadingId, distrilbutionBillLading.getId())); |
|
|
|
|
if (printEntityList.size() > 0) { |
|
|
|
|
if (!printEntityList.isEmpty()) { |
|
|
|
|
if (distrilbutionBillLading.getMark()) { |
|
|
|
|
//要删除
|
|
|
|
|
List<Long> collect = printEntityList.stream().map(DistributionPrintEntity::getId).collect(Collectors.toList()); |
|
|
|
|
distributionPrintService.deleteLogic(collect); |
|
|
|
|
//操作图片
|
|
|
|
|
if (distrilbutionBillLading.getPrintList().size() > 0) { |
|
|
|
|
if (!distrilbutionBillLading.getPrintList().isEmpty()) { |
|
|
|
|
addPrint(distrilbutionBillLading); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -145,7 +146,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
List<DistributionDeliveryChargeEntity> list = distributionDeliveryChargeService.list(Wrappers.<DistributionDeliveryChargeEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryChargeEntity::getBillLading, distrilbutionBillLading.getId()) |
|
|
|
|
); |
|
|
|
|
if (list.size() > 0) { |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
list.forEach(i -> { |
|
|
|
|
String s = distrilbutionBillLading.getFei().get(i.getCost()); |
|
|
|
|
if (StringUtils.isNotBlank(s)) { |
|
|
|
@ -162,19 +163,19 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
//修改订单数据
|
|
|
|
|
if (distrilbutionBillLading.getStockArticleList().size() > 0) { |
|
|
|
|
if (!distrilbutionBillLading.getStockArticleList().isEmpty()) { |
|
|
|
|
boolean order = getOrder(distrilbutionBillLading.getStockArticleList(), distrilbutionBillLading.getId()); |
|
|
|
|
if (!order) { |
|
|
|
|
throw new ServiceException("修改失败!!"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//修改库存品
|
|
|
|
|
if (distrilbutionBillLading.getStockDTOList().size() > 0) { |
|
|
|
|
if (!distrilbutionBillLading.getStockDTOList().isEmpty()) { |
|
|
|
|
//全部库存品数据
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> listDetails = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, distrilbutionBillLading.getId()) |
|
|
|
|
); |
|
|
|
|
if (listDetails.size() > 0) { |
|
|
|
|
if (!listDetails.isEmpty()) { |
|
|
|
|
List<Long> ids = new ArrayList<>(); |
|
|
|
|
//有
|
|
|
|
|
//修改
|
|
|
|
@ -199,7 +200,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
distributionDeliveryDetailsService.updateById(deliveryDetails); |
|
|
|
|
Integer inventoryQuantity = next.getInventoryQuantity(); //修改数量
|
|
|
|
|
Integer quantity = i.getQuantity();//原来的数量
|
|
|
|
|
Integer num = 0; |
|
|
|
|
int num = 0; |
|
|
|
|
|
|
|
|
|
if (inventoryQuantity > quantity) { |
|
|
|
|
num = inventoryQuantity - quantity; //多 添加了数量
|
|
|
|
@ -937,8 +938,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
Object billLadingId = distrilbutionBillLading.get("id"); //提货ID
|
|
|
|
|
Object coding = distrilbutionBillLading.get("coding"); //包条码
|
|
|
|
|
Object type = distrilbutionBillLading.get("type"); //类型 2 订单 1 库存品
|
|
|
|
|
if (Func.isNull(billLadingId) || Func.isNull(coding) || Func.isNull(type)) { |
|
|
|
|
return (Resp) R.fail(3000, "参数不完整,你干啥呢!!"); |
|
|
|
|
if (Func.isNull(billLadingId) || ObjectUtil.isEmpty(coding) || Func.isNull(type)) { |
|
|
|
|
return Resp.scanFail("3000", "参数不完整,你干啥呢!!"); |
|
|
|
|
} else { |
|
|
|
|
DistrilbutionBillLadingEntity billLadingEntity1 = baseMapper.selectById((Serializable) billLadingId); |
|
|
|
|
if(ObjectUtils.isNotNull(billLadingEntity1) && billLadingEntity1.getConditions().equals("20")){ |
|
|
|
@ -1041,76 +1042,8 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//判断当前自提任务完成没有
|
|
|
|
|
//查询订单数
|
|
|
|
|
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda() |
|
|
|
|
.eq(DistrilbutionBillStockEntity::getBillLadingId, billLadingId) |
|
|
|
|
.apply("order_status in (1,2)") |
|
|
|
|
); |
|
|
|
|
AtomicReference<Integer> pake = new AtomicReference<>(0); // 包件数量
|
|
|
|
|
AtomicReference<Integer> pakeys = new AtomicReference<>(0); // 包件以扫数量
|
|
|
|
|
boolean apj = false; |
|
|
|
|
if(list.size() > 0){ |
|
|
|
|
//查询包件数量
|
|
|
|
|
list.forEach(i ->{ |
|
|
|
|
List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() |
|
|
|
|
.eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId()) |
|
|
|
|
); |
|
|
|
|
int size = list1.size(); |
|
|
|
|
pake.set(pake.get() + size); |
|
|
|
|
//查询扫码数量
|
|
|
|
|
List<DistributionBillLadingScanEntity> list2 = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda() |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId) |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getStockArticleId, i.getStockArticleId()) |
|
|
|
|
); |
|
|
|
|
int size2 = list2.size(); |
|
|
|
|
pakeys.set(pakeys.get() + size2); |
|
|
|
|
}); |
|
|
|
|
if(pake.get().equals(pakeys.get()+1)){ |
|
|
|
|
//订单完成备货
|
|
|
|
|
apj = true; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
//订单完成备货
|
|
|
|
|
apj = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询库存品数
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> list1 = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, billLadingId) |
|
|
|
|
); |
|
|
|
|
//
|
|
|
|
|
AtomicReference<Integer> kcq = new AtomicReference<>(0); // 库存全部数量
|
|
|
|
|
AtomicReference<Integer> kcs = new AtomicReference<>(0); // 库存以扫数量
|
|
|
|
|
boolean kc = false; |
|
|
|
|
if(list1.size() > 0){ |
|
|
|
|
list1.forEach( i -> { |
|
|
|
|
//查询以扫数量
|
|
|
|
|
List<DistributionBillLadingScanEntity> list2 = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda() |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId) |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getStockListId, i.getStockListId()) |
|
|
|
|
); |
|
|
|
|
kcq.set(kcq.get()+i.getQuantity());//全部数量
|
|
|
|
|
int size = list2.size(); |
|
|
|
|
kcs.set(kcs.get()+size);//以扫数量
|
|
|
|
|
}); |
|
|
|
|
//多个
|
|
|
|
|
if(kcq.get() == (kcs.get()+1)){ |
|
|
|
|
kc=true; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
kc = true; |
|
|
|
|
} |
|
|
|
|
if(apj && kc){ |
|
|
|
|
//完成
|
|
|
|
|
//已完成
|
|
|
|
|
//修改提货任务状态
|
|
|
|
|
DistrilbutionBillLadingEntity billLadingEntity = new DistrilbutionBillLadingEntity(); |
|
|
|
|
String bill = (String) billLadingId; |
|
|
|
|
billLadingEntity.setId(Long.valueOf(bill)); |
|
|
|
|
billLadingEntity.setConditions("20"); |
|
|
|
|
baseMapper.updateById(billLadingEntity); |
|
|
|
|
} |
|
|
|
|
String a= String.valueOf(billLadingId); |
|
|
|
|
distributionAsyncService.getStockUPstate(Long.parseLong(a)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*long count = list.stream().filter(e -> e.getConditions().equals("2")).count(); // 订 已签收的数
|
|
|
|
|