buhuazhen
2 天以前 28bc6d67f2f35e312fc1fa30095359cc8b3135a4
src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -74,12 +74,19 @@
    @Log(title = "发货信息管理", businessType = BusinessType.INSERT)
    public AjaxResult add(@RequestBody ShippingInfoDto req) throws Exception {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH","shippingNo");
        String sh = OrderUtils.countTodayByCreateTime(shippingInfoMapper, "SH","shipping_no");
        // 发货审批
        ApproveProcessVO approveProcessVO = new ApproveProcessVO();
        approveProcessVO.setApproveType(7);
        approveProcessVO.setApproveDeptId(loginUser.getCurrentDeptId());
        approveProcessVO.setApproveReason(req.getType() + ":" +sh);
        // 审批原因格式:发货单号:{发货类型}:{发货车牌号}
        String approveReason = "发货单号:" + sh + "\n" + req.getType();
        if ("货车".equals(req.getType()) && req.getShippingCarNumber() != null) {
            approveReason += ":" + req.getShippingCarNumber();
        } else if ("快递".equals(req.getType()) && req.getExpressCompany() != null) {
            approveReason += ":" + req.getExpressCompany();
        }
        approveProcessVO.setApproveReason(approveReason);
        approveProcessVO.setApproveUserIds(req.getApproveUserIds());
        approveProcessVO.setApproveUser(loginUser.getUserId());
        approveProcessVO.setApproveTime(LocalDate.now().toString());
@@ -141,4 +148,29 @@
    public AjaxResult getByCustomerName(String customerName) {
        return AjaxResult.success(shippingInfoService.getShippingInfoByCustomerName(customerName));
    }
    /**
     * 一键发货 - 自动审批通过并出库
     */
    @PostMapping("/oneClickShipping")
    @ApiOperation("一键发货")
    @Transactional(rollbackFor = Exception.class)
    @Log(title = "发货信息管理", businessType = BusinessType.INSERT)
    public AjaxResult oneClickShipping(@RequestBody ShippingInfoDto req) throws IOException {
        return shippingInfoService.oneClickShipping(req) ? AjaxResult.success("发货成功") : AjaxResult.error("发货失败");
    }
    /**
     * 批量一键发货 - 将销售台账下所有未发货的产品全部发货
     */
    @PostMapping("/batchOneClickShipping")
    @ApiOperation("批量一键发货")
    @Transactional(rollbackFor = Exception.class)
    @Log(title = "发货信息管理", businessType = BusinessType.INSERT)
    public AjaxResult batchOneClickShipping(@RequestBody ShippingInfoDto req) throws IOException {
        if (req.getSalesLedgerId() == null) {
            return AjaxResult.error("销售台账ID不能为空");
        }
        return shippingInfoService.batchOneClickShipping(req.getSalesLedgerId(), req) ? AjaxResult.success("批量发货成功") : AjaxResult.error("批量发货失败");
    }
}