|
|
|
@ -1350,6 +1350,18 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public DistrilbutionAppBillLadingOrderMainVO selectOrderList(Long billLadingId, Integer orderStatus, String orderSelfNumbering) { |
|
|
|
|
DistrilbutionAppBillLadingOrderMainVO mainVO =baseMapper.getBillLadingOrderMainVO(billLadingId); |
|
|
|
|
//查询订单数量,
|
|
|
|
|
//查询齐套数
|
|
|
|
|
//查询字体件数
|
|
|
|
|
//查询签收件数
|
|
|
|
|
//查询库存品数
|
|
|
|
|
// 查询签收完成订单数
|
|
|
|
|
List<Boolean> num = baseMapper.getCompleteNum(billLadingId); |
|
|
|
|
if (Func.isNotEmpty(num)){ |
|
|
|
|
int size = num.stream().filter(f -> f.equals(true)).collect(Collectors.toList()).size(); |
|
|
|
|
mainVO.setCompleteNum(size); |
|
|
|
|
} |
|
|
|
|
DistrilbutionBillLadingAppVO main = baseMapper.selectDataByBillLadingId(billLadingId); |
|
|
|
|
if (Objects.isNull(main)) { |
|
|
|
|
return null; |
|
|
|
@ -1358,122 +1370,122 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
|
|
|
|
|
//有可能存在多个订单所以需要拆分
|
|
|
|
|
String stockArticleId = main.getStockArticleId(); |
|
|
|
|
|
|
|
|
|
Integer orderNum = 0; |
|
|
|
|
Integer planNum = 0; |
|
|
|
|
Integer conpleteNum = 0; |
|
|
|
|
Integer signedNum = 0; |
|
|
|
|
// Integer orderNum = 0;
|
|
|
|
|
// Integer planNum = 0;
|
|
|
|
|
// Integer conpleteNum = 0;
|
|
|
|
|
// Integer signedNum = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询零担数据
|
|
|
|
|
List<DistributionReservationZeroPackageEntity> listZero = distributionZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationZeroPackageEntity::getReservationId, main.getBillLadingId()) |
|
|
|
|
.eq(DistributionReservationZeroPackageEntity::getIsDeleted, 0) |
|
|
|
|
.in(DistributionReservationZeroPackageEntity::getZeroPackageStatus, "1", "3") |
|
|
|
|
); |
|
|
|
|
if (!listZero.isEmpty()) { |
|
|
|
|
int sum = listZero.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum(); |
|
|
|
|
planNum += sum; |
|
|
|
|
} |
|
|
|
|
// //查询零担数据
|
|
|
|
|
// List<DistributionReservationZeroPackageEntity> listZero = distributionZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
|
|
|
|
|
// .eq(DistributionReservationZeroPackageEntity::getReservationId, main.getBillLadingId())
|
|
|
|
|
// .eq(DistributionReservationZeroPackageEntity::getIsDeleted, 0)
|
|
|
|
|
// .in(DistributionReservationZeroPackageEntity::getZeroPackageStatus, "1", "3")
|
|
|
|
|
// );
|
|
|
|
|
// if (!listZero.isEmpty()) {
|
|
|
|
|
// int sum = listZero.stream().mapToInt(DistributionReservationZeroPackageEntity::getQuantity).sum();
|
|
|
|
|
// planNum += sum;
|
|
|
|
|
// }
|
|
|
|
|
String[] split = stockArticleId.split(","); |
|
|
|
|
|
|
|
|
|
List<DistrilbutionAppBillLadingOrderVO> l = new ArrayList<>(); |
|
|
|
|
for (String s : split) { |
|
|
|
|
if (StringUtil.isBlank(s)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
DistrilbutionAppBillLadingOrderVO vo = new DistrilbutionAppBillLadingOrderVO(); |
|
|
|
|
vo.setStockArticleId(Long.parseLong(s)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderNum++; |
|
|
|
|
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
queryWrapper.eq("stock_article_id", Long.parseLong(s)) |
|
|
|
|
.eq("is_deleted", 0) |
|
|
|
|
.isNotNull("order_package_code"); |
|
|
|
|
if (!StringUtil.isBlank(orderSelfNumbering)) { |
|
|
|
|
queryWrapper.ne("order_self_numbering", orderSelfNumbering); |
|
|
|
|
} |
|
|
|
|
List<DistributionParcelListEntity> list = distributionParcelListService.list(queryWrapper); |
|
|
|
|
int pn = 0; |
|
|
|
|
if (!list.isEmpty() && ObjectUtils.isNotNull(list.get(0))) { |
|
|
|
|
vo.setOrderSelfNumbering(list.get(0).getOrderCode()); |
|
|
|
|
pn = list.size(); |
|
|
|
|
vo.setPlanNum(pn); |
|
|
|
|
planNum = planNum + pn; |
|
|
|
|
} |
|
|
|
|
//通过订单id查询扫描表中有多少数据
|
|
|
|
|
QueryWrapper<DistributionBillLadingScanEntity> qw = new QueryWrapper<>(); |
|
|
|
|
qw.eq("stock_article_id", Long.parseLong(s)) |
|
|
|
|
.eq("is_deleted", 0); |
|
|
|
|
qw.eq("bill_lading_id", main.getBillLadingId()); |
|
|
|
|
List<DistributionBillLadingScanEntity> ls = distributionBillLadingScanService.list(qw); |
|
|
|
|
int sn = ls.stream().mapToInt(DistributionBillLadingScanEntity::getQuantity).sum(); |
|
|
|
|
vo.setSignedNum(sn); |
|
|
|
|
signedNum = signedNum + sn; |
|
|
|
|
|
|
|
|
|
if (pn == sn) { |
|
|
|
|
conpleteNum++; |
|
|
|
|
} |
|
|
|
|
if (pn == sn) { |
|
|
|
|
vo.setOrderStatusStr("齐套"); |
|
|
|
|
} else if (sn < pn && sn > 0) { |
|
|
|
|
vo.setOrderStatusStr("部分扫"); |
|
|
|
|
} else if (sn == 0) { |
|
|
|
|
vo.setOrderStatusStr("未扫"); |
|
|
|
|
} |
|
|
|
|
//不添加订单数
|
|
|
|
|
if (list.isEmpty() || !list.isEmpty() && ObjectUtils.isNull(list.get(0))) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//0 全部 1 齐套 2部分扫 3未扫
|
|
|
|
|
if (orderStatus == 0) { |
|
|
|
|
l.add(vo); |
|
|
|
|
} else if (orderStatus == 1) { |
|
|
|
|
if (pn == sn) { |
|
|
|
|
l.add(vo); |
|
|
|
|
} |
|
|
|
|
} else if (orderStatus == 2) { |
|
|
|
|
if (sn < pn && sn > 0) { |
|
|
|
|
l.add(vo); |
|
|
|
|
} |
|
|
|
|
} else if (orderStatus == 3) { |
|
|
|
|
if (sn == 0) { |
|
|
|
|
l.add(vo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// for (String s : split) {
|
|
|
|
|
// if (StringUtil.isBlank(s)) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// DistrilbutionAppBillLadingOrderVO vo = new DistrilbutionAppBillLadingOrderVO();
|
|
|
|
|
// vo.setStockArticleId(Long.parseLong(s));
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// orderNum++;
|
|
|
|
|
// QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
// queryWrapper.eq("stock_article_id", Long.parseLong(s))
|
|
|
|
|
// .eq("is_deleted", 0)
|
|
|
|
|
// .isNotNull("order_package_code");
|
|
|
|
|
// if (!StringUtil.isBlank(orderSelfNumbering)) {
|
|
|
|
|
// queryWrapper.ne("order_self_numbering", orderSelfNumbering);
|
|
|
|
|
// }
|
|
|
|
|
// List<DistributionParcelListEntity> list = distributionParcelListService.list(queryWrapper);
|
|
|
|
|
// int pn = 0;
|
|
|
|
|
// if (!list.isEmpty() && ObjectUtils.isNotNull(list.get(0))) {
|
|
|
|
|
// vo.setOrderSelfNumbering(list.get(0).getOrderCode());
|
|
|
|
|
// pn = list.size();
|
|
|
|
|
// vo.setPlanNum(pn);
|
|
|
|
|
// planNum = planNum + pn;
|
|
|
|
|
// }
|
|
|
|
|
// //通过订单id查询扫描表中有多少数据
|
|
|
|
|
// QueryWrapper<DistributionBillLadingScanEntity> qw = new QueryWrapper<>();
|
|
|
|
|
// qw.eq("stock_article_id", Long.parseLong(s))
|
|
|
|
|
// .eq("is_deleted", 0);
|
|
|
|
|
// qw.eq("bill_lading_id", main.getBillLadingId());
|
|
|
|
|
// List<DistributionBillLadingScanEntity> ls = distributionBillLadingScanService.list(qw);
|
|
|
|
|
// int sn = ls.stream().mapToInt(DistributionBillLadingScanEntity::getQuantity).sum();
|
|
|
|
|
// vo.setSignedNum(sn);
|
|
|
|
|
// signedNum = signedNum + sn;
|
|
|
|
|
//
|
|
|
|
|
// if (pn == sn) {
|
|
|
|
|
// conpleteNum++;
|
|
|
|
|
// }
|
|
|
|
|
// if (pn == sn) {
|
|
|
|
|
// vo.setOrderStatusStr("齐套");
|
|
|
|
|
// } else if (sn < pn && sn > 0) {
|
|
|
|
|
// vo.setOrderStatusStr("部分扫");
|
|
|
|
|
// } else if (sn == 0) {
|
|
|
|
|
// vo.setOrderStatusStr("未扫");
|
|
|
|
|
// }
|
|
|
|
|
// //不添加订单数
|
|
|
|
|
// if (list.isEmpty() || !list.isEmpty() && ObjectUtils.isNull(list.get(0))) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// //0 全部 1 齐套 2部分扫 3未扫
|
|
|
|
|
// if (orderStatus == 0) {
|
|
|
|
|
// l.add(vo);
|
|
|
|
|
// } else if (orderStatus == 1) {
|
|
|
|
|
// if (pn == sn) {
|
|
|
|
|
// l.add(vo);
|
|
|
|
|
// }
|
|
|
|
|
// } else if (orderStatus == 2) {
|
|
|
|
|
// if (sn < pn && sn > 0) {
|
|
|
|
|
// l.add(vo);
|
|
|
|
|
// }
|
|
|
|
|
// } else if (orderStatus == 3) {
|
|
|
|
|
// if (sn == 0) {
|
|
|
|
|
// l.add(vo);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//查询库存品
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> list = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, billLadingId) |
|
|
|
|
); |
|
|
|
|
// List<DistributionDeliveryDetailsEntity> list = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda()
|
|
|
|
|
// .eq(DistributionDeliveryDetailsEntity::getBillLadingId, billLadingId)
|
|
|
|
|
// );
|
|
|
|
|
//查询是否签收完成
|
|
|
|
|
List<DistributionDeliveryDetailsEntity> list1 = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda() |
|
|
|
|
.eq(DistributionDeliveryDetailsEntity::getBillLadingId, billLadingId) |
|
|
|
|
); |
|
|
|
|
if (!list1.isEmpty()) { |
|
|
|
|
long count = list1.stream().filter(i -> i.getConditions().equals("2")).count(); |
|
|
|
|
signedNum += (int) count; |
|
|
|
|
} |
|
|
|
|
// List<DistributionDeliveryDetailsEntity> list1 = distributionDeliveryDetailsService.list(Wrappers.<DistributionDeliveryDetailsEntity>query().lambda()
|
|
|
|
|
// .eq(DistributionDeliveryDetailsEntity::getBillLadingId, billLadingId)
|
|
|
|
|
// );
|
|
|
|
|
// if (!list1.isEmpty()) {
|
|
|
|
|
// long count = list1.stream().filter(i -> i.getConditions().equals("2")).count();
|
|
|
|
|
// signedNum += (int) count;
|
|
|
|
|
// }
|
|
|
|
|
//查询签收件数
|
|
|
|
|
List<DistributionBillLadingScanEntity> list2 = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda() |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId) |
|
|
|
|
.eq(DistributionBillLadingScanEntity::getMaterialType, "1") |
|
|
|
|
); |
|
|
|
|
if (!list2.isEmpty()) { |
|
|
|
|
signedNum += list2.size(); |
|
|
|
|
} |
|
|
|
|
// List<DistributionBillLadingScanEntity> list2 = distributionBillLadingScanService.list(Wrappers.<DistributionBillLadingScanEntity>query().lambda()
|
|
|
|
|
// .eq(DistributionBillLadingScanEntity::getBillLadingId, billLadingId)
|
|
|
|
|
// .eq(DistributionBillLadingScanEntity::getMaterialType, "1")
|
|
|
|
|
// );
|
|
|
|
|
// if (!list2.isEmpty()) {
|
|
|
|
|
// signedNum += list2.size();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// planNum += list.stream().mapToInt(DistributionDeliveryDetailsEntity::getQuantity).sum();
|
|
|
|
|
DistrilbutionAppBillLadingOrderMainVO mainVO = new DistrilbutionAppBillLadingOrderMainVO(); |
|
|
|
|
mainVO.setOrderNum(orderNum); |
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
mainVO.setInventoryNub(list.stream().mapToInt(DistributionDeliveryDetailsEntity::getQuantity).sum()); |
|
|
|
|
} else { |
|
|
|
|
mainVO.setInventoryNub(0); |
|
|
|
|
} |
|
|
|
|
mainVO.setPlanNum(planNum);//自提件数
|
|
|
|
|
mainVO.setSignedNum(signedNum);//签收总数
|
|
|
|
|
mainVO.setCompleteNum(conpleteNum);//订单总数
|
|
|
|
|
// DistrilbutionAppBillLadingOrderMainVO mainVO = new DistrilbutionAppBillLadingOrderMainVO();
|
|
|
|
|
// mainVO.setOrderNum(orderNum);
|
|
|
|
|
// if (!list.isEmpty()) {
|
|
|
|
|
// mainVO.setInventoryNub(list.stream().mapToInt(DistributionDeliveryDetailsEntity::getQuantity).sum());
|
|
|
|
|
// } else {
|
|
|
|
|
// mainVO.setInventoryNub(0);
|
|
|
|
|
// }
|
|
|
|
|
// mainVO.setPlanNum(planNum);//自提件数
|
|
|
|
|
// mainVO.setSignedNum(signedNum);//签收总数
|
|
|
|
|
// mainVO.setCompleteNum(conpleteNum);//订单总数
|
|
|
|
|
// mainVO.setAssembleNum(list.stream().mapToInt( DistributionDeliveryDetailsEntity::getQuantity ).sum());
|
|
|
|
|
mainVO.setList(l); |
|
|
|
|
return mainVO; |
|
|
|
|