From 277b5047d00a3e9094bafd5ecb078976fbf6a92d Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期四, 08 一月 2026 18:59:04 +0800
Subject: [PATCH] 华玺砂浆转移-采购代码、发货和发货审核、报修和报修审核、采购模板,查询采购模板接口、财务管理的存货核算数据接口、财务管理的固定资产核算获取台账接口、采购审批,接口、客户分类字段、采购台账字段,实现采购异常记录的添加接口、黑名单,添加资质管理字段,可上传资质文件-至军泰伟业

---
 src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
index 56b3e15..c498b93 100644
--- a/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
+++ b/src/main/java/com/ruoyi/sales/controller/ShippingInfoController.java
@@ -1,5 +1,6 @@
 package com.ruoyi.sales.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -7,13 +8,20 @@
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.sales.mapper.ShipmentApprovalMapper;
 import com.ruoyi.sales.mapper.ShippingInfoMapper;
 import com.ruoyi.sales.pojo.SalesLedger;
+import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.sales.pojo.ShipmentApproval;
 import com.ruoyi.sales.pojo.ShippingInfo;
+import com.ruoyi.sales.service.ISalesLedgerProductService;
+import com.ruoyi.sales.service.ISalesLedgerService;
 import com.ruoyi.sales.service.ShippingInfoService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
@@ -30,6 +38,10 @@
 
     @Autowired
     private ShippingInfoService shippingInfoService;
+    @Autowired
+    private ShipmentApprovalMapper shipmentApprovalMapper;
+    @Autowired
+    private ISalesLedgerProductService salesLedgerProductService;
 
 
     @GetMapping("/listPage")
@@ -41,8 +53,33 @@
 
     @PostMapping("/add")
     @ApiOperation("娣诲姞鍙戣揣淇℃伅")
+    @Transactional(rollbackFor = Exception.class)
     public AjaxResult add(@RequestBody ShippingInfo req) {
+        LambdaQueryWrapper<ShippingInfo> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(ShippingInfo::getSalesLedgerId, req.getSalesLedgerId());
+        wrapper.eq(ShippingInfo::getSalesLedgerProductId, req.getSalesLedgerProductId());
+        List<ShippingInfo> list = shippingInfoService.list(wrapper);
+        if(!CollectionUtils.isEmpty(list)){
+            return AjaxResult.error("鍙戣揣淇℃伅宸插瓨鍦�");
+        }
         boolean save = shippingInfoService.save(req);
+        if(save){
+            ShippingInfo shippingInfo = shippingInfoService.getOne(wrapper);
+            ShipmentApproval shipmentApproval = new ShipmentApproval();
+            shipmentApproval.setSalesLedgerId(req.getSalesLedgerId());
+            shipmentApproval.setSalesLedgerProductId(req.getSalesLedgerProductId());
+            shipmentApproval.setApproveUserId(req.getApproverId());
+            shipmentApproval.setApproveStatus(2);
+            shipmentApproval.setShippingInfoId(shippingInfo.getId());
+            shipmentApprovalMapper.insert(shipmentApproval);
+
+            SalesLedgerProduct salesLedgerProduct = salesLedgerProductService.getById(req.getSalesLedgerProductId());
+            if(salesLedgerProduct != null){
+                salesLedgerProduct.setApproveStatus(2);
+                salesLedgerProductService.updateById(salesLedgerProduct);
+            }
+
+        }
         return save ? AjaxResult.success() : AjaxResult.error();
     }
 

--
Gitblit v1.9.3