| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:remove')") |
| | | @OperationLog("Delete ASN单据") |
| | | @PostMapping("/asnOrder/remove/{ids}") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!asnOrderService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | if (!asnOrderService.remove(new LambdaQueryWrapper<AsnOrder>().in(AsnOrder::getId, Arrays.asList(ids)).eq(AsnOrder::getExceStatus, AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val))) { |
| | | return R.error("任务中单据不可删除!!"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | for (Long id : ids) { |
| | | List<AsnOrderItem> list = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, id)); |
| | | if (!list.isEmpty()) { |
| | | if (!asnOrderItemService.remove(new LambdaQueryWrapper<AsnOrderItem>().in(AsnOrderItem::getAsnId, ids))) { |
| | | throw new CoolException("Details Delete Fail"); |
| | | } |
| | | } |
| | | } |
| | | return R.ok("删除成功!!").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:list')") |