From ec8d7cbe79f8c012f0d855e19fee9dc8cd27608f Mon Sep 17 00:00:00 2001
From: yaowanxin <3588231647@qq.com>
Date: 星期五, 09 一月 2026 16:24:54 +0800
Subject: [PATCH] 1.各生产订单的完成进度统计接口 2.在制品周转情况接口 3.生产报工记录添加上生产时间字段
---
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