|
|
@ -779,6 +779,7 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService |
|
|
|
if (Objects.equals(tempShippingInformDetail.getThisShippingNum(), sysSalesShippingInformDetail.getHasCheckNum())){ |
|
|
|
allWithoutCheckFlag = 1; |
|
|
|
} |
|
|
|
|
|
|
|
// 当前时间
|
|
|
|
Date now = new Date(); |
|
|
|
|
|
|
@ -804,21 +805,45 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService |
|
|
|
orderChildren.add(tempSalesOrderChild); |
|
|
|
} |
|
|
|
} |
|
|
|
//按照计划交付时间与当前时间的差值排序
|
|
|
|
orderChildren.sort(Comparator.comparing(o->Math.abs(o.getDeliveryTime().getTime() - now.getTime()))); |
|
|
|
|
|
|
|
//更新 HasCheckNum 数据
|
|
|
|
// 按照计划交付时间与当前时间的差值排序
|
|
|
|
orderChildren.sort(Comparator.comparing(o -> Math.abs(o.getDeliveryTime().getTime() - now.getTime()))); |
|
|
|
|
|
|
|
// 更新 HasCheckNum 数据
|
|
|
|
boolean shouldContinue = true; |
|
|
|
for (SysSalesOrderChild orderChild : orderChildren) { |
|
|
|
if (!shouldContinue) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
orderChild.setUpdateTime(new Date()); |
|
|
|
orderChild.setUpdateBy(loginName); |
|
|
|
orderChild.setHasCheckNum(sysSalesShippingInformDetail.getHasCheckNum()); |
|
|
|
|
|
|
|
// 检查数据库中是否有已有的 hasCheckNum,如果有则进行合计
|
|
|
|
Integer existingHasCheckNum = orderChild.getHasCheckNum(); |
|
|
|
Integer currentHasCheckNum = sysSalesShippingInformDetail.getHasCheckNum(); |
|
|
|
|
|
|
|
if (existingHasCheckNum != null) { |
|
|
|
orderChild.setHasCheckNum(existingHasCheckNum + currentHasCheckNum); |
|
|
|
} else { |
|
|
|
orderChild.setHasCheckNum(currentHasCheckNum); |
|
|
|
} |
|
|
|
|
|
|
|
int updateSalesOrderChildResult = salesOrderChildMapper.updateSysSalesOrderChildByCodeAndQuoteId(orderChild); |
|
|
|
if (updateSalesOrderChildResult <= 0) { |
|
|
|
throw new BusinessException("更新销售订单子表数据失败"); |
|
|
|
throw new RuntimeException("更新销售订单子表数据失败"); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否需要继续更新下一个
|
|
|
|
if (orderChild.getHasCheckNum().equals(orderChild.getMaterialNum())) { |
|
|
|
shouldContinue = true; |
|
|
|
} else { |
|
|
|
shouldContinue = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int updateShippingInformDetailResult = shippingInformDetailMapper.updateSysSalesShippingInformDetail(sysSalesShippingInformDetail); |
|
|
|
if (updateShippingInformDetailResult <= 0) { |
|
|
|
throw new BusinessException("更新销售出货通知单详情数据失败"); |
|
|
@ -918,17 +943,38 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService |
|
|
|
orderChildren.add(tempSalesOrderChild); |
|
|
|
} |
|
|
|
} |
|
|
|
//按照计划交付时间与当前时间的差值排序
|
|
|
|
orderChildren.sort(Comparator.comparing(o->Math.abs(o.getDeliveryTime().getTime() - now.getTime()))); |
|
|
|
|
|
|
|
//更新 HasCheckNum 数据
|
|
|
|
// 按照计划交付时间与当前时间的差值排序
|
|
|
|
orderChildren.sort(Comparator.comparing(o -> Math.abs(o.getDeliveryTime().getTime() - now.getTime()))); |
|
|
|
|
|
|
|
// 更新 HasCheckNum 数据
|
|
|
|
boolean shouldContinue = true; |
|
|
|
for (SysSalesOrderChild orderChild : orderChildren) { |
|
|
|
orderChild.setUpdateTime(new Date()); |
|
|
|
orderChild.setUpdateBy(loginName); |
|
|
|
orderChild.setHasCheckNum(sysSalesShippingInformDetail.getHasCheckNum()); |
|
|
|
if (!shouldContinue) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 检查数据库中是否有已有的 hasCheckNum,如果有则进行合计
|
|
|
|
Integer existingHasCheckNum = orderChild.getHasCheckNum(); |
|
|
|
Integer currentHasCheckNum = tempShippingInformDetail.getHasCheckNum(); |
|
|
|
|
|
|
|
if (existingHasCheckNum != null) { |
|
|
|
orderChild.setHasCheckNum(existingHasCheckNum + currentHasCheckNum); |
|
|
|
} else { |
|
|
|
orderChild.setHasCheckNum(currentHasCheckNum); |
|
|
|
} |
|
|
|
|
|
|
|
int updateSalesOrderChildResult = salesOrderChildMapper.updateSysSalesOrderChildByCodeAndQuoteId(orderChild); |
|
|
|
if (updateSalesOrderChildResult <= 0) { |
|
|
|
throw new BusinessException("更新销售订单子表数据失败"); |
|
|
|
throw new RuntimeException("更新销售订单子表数据失败"); |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否需要继续更新下一个
|
|
|
|
if (orderChild.getHasCheckNum().equals(orderChild.getMaterialNum())) { |
|
|
|
shouldContinue = true; |
|
|
|
} else { |
|
|
|
shouldContinue = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|