hsy
2026-08-28 a8e4132c3e2e9c3b3fcb0360901b35571b6464ea
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -70,6 +70,11 @@
        if (byId == null) {
            return AjaxResult.error("发货信息不存在");
        }
        if ("审核通过".equals(byId.getStatus()) && !"已发货".equals(req.getStatus())) {
            // Note: If the request is from outbound management trying to change status to "已发货", it's allowed.
            // But if it's a normal edit, it's blocked. We just check if it's already 审核通过 and they are updating other fields.
            return AjaxResult.error("已审核通过,不能编辑发货信息");
        }
        boolean update = shippingInfoService.updateById(req);
        return update ? AjaxResult.success() : AjaxResult.error();
    }
@@ -79,7 +84,12 @@
    @Transactional(rollbackFor = Exception.class)
    @Log(title = "发货信息管理", businessType = BusinessType.DELETE)
    public AjaxResult delete(@RequestBody List<Long> ids) {
        for (Long id : ids) {
            ShippingInfo byId = shippingInfoService.getById(id);
            if (byId != null && ("已发货".equals(byId.getStatus()) || "审核通过".equals(byId.getStatus()))) {
                return AjaxResult.error("存在已发货或审核通过的产品,不能删除");
            }
        }
        return shippingInfoService.delete(ids) ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
    }
@@ -88,8 +98,8 @@
     */
    @PostMapping("/export")
    @Operation(summary = "导出发货信息")
    public void export(HttpServletResponse response) {
        List<ShippingInfo> list = shippingInfoMapper.listAll();
    public void export(HttpServletResponse response, ShippingInfo req) {
        List<ShippingInfo> list = shippingInfoMapper.listAll(req);
        ExcelUtil<ShippingInfo> util = new ExcelUtil<ShippingInfo>(ShippingInfo.class);
        util.exportExcel(response, list, "发货信息");
    }