Showing
1 changed file
with
31 additions
and
0 deletions
| ... | ... | @@ -196,6 +196,37 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { |
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | + * 检查发货单相关数据 | |
| 200 | + */ | |
| 201 | + @ApiOperation("检查发货单相关数据") | |
| 202 | + @HasPermission({"shipping-plan-manage:shipping-plan:query"}) | |
| 203 | + @PostMapping("/check") | |
| 204 | + public InvokeResult<Void> saveSignInTicket(@RequestBody List<String> ids) { | |
| 205 | + // 获取发货单数据 | |
| 206 | + List<ShipmentsOrderInfo> orderInfoList = shipmentsOrderInfoService.queryByIds(ids); | |
| 207 | + if (CollectionUtils.isEmpty(orderInfoList)) { | |
| 208 | + throw new DefaultClientException("发货单不存在!"); | |
| 209 | + } | |
| 210 | + // 获取所有发货单明细数据 | |
| 211 | + List<String> shipmentsOrderIds = orderInfoList.stream().map(ShipmentsOrderInfo::getId).collect(Collectors.toList()); | |
| 212 | + List<ShipmentsPlanDetail> shipmentsDetailList = shipmentsPlanDetailService.listByShipmentOrderId(shipmentsOrderIds); | |
| 213 | + if (CollectionUtils.isEmpty(shipmentsDetailList)) { | |
| 214 | + throw new DefaultClientException("发货单明细不存在!"); | |
| 215 | + } | |
| 216 | + // 按发货单ID分组明细数据 | |
| 217 | + Map<String, List<ShipmentsPlanDetail>> detailMap = shipmentsDetailList.stream() | |
| 218 | + .collect(Collectors.groupingBy(ShipmentsPlanDetail::getShipmentOrderId)); | |
| 219 | + for (ShipmentsOrderInfo orderInfo : orderInfoList) { | |
| 220 | + List<ShipmentsPlanDetail> detailList = detailMap.get(orderInfo.getId()); | |
| 221 | + if (CollectionUtil.isNotEmpty(detailList) && detailList.size() > 8) { | |
| 222 | + throw new DefaultClientException("发货单明细不能超过8条,请前往对应发货单做延期处理!"); | |
| 223 | + } | |
| 224 | + } | |
| 225 | + return InvokeResultBuilder.success(); | |
| 226 | + } | |
| 227 | + | |
| 228 | + | |
| 229 | + /** | |
| 199 | 230 | * 发货单批量打印 |
| 200 | 231 | * @param vo 打印参数 |
| 201 | 232 | * @param response 响应体 | ... | ... |