skyouc
2025-05-02 ee608e161f17082b9fd6e1ed236214a0ac5c2f0e
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/AsnOrderController.java
@@ -31,6 +31,7 @@
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;
@@ -111,10 +112,19 @@
    @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");
        }
        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("Delete Success").add(ids);
    }