From 28c0d364e7ff349a77037c3770acaa9f656fb93b Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期三, 12 十一月 2025 18:01:27 +0800
Subject: [PATCH] yys  1.仓储物流增加分类管理      2.仓储物流分类管理导出接口      4.新疆生产管控定制化

---
 src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java |   87 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 86 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java b/src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java
index 22b96b4..169b83f 100644
--- a/src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java
+++ b/src/main/java/com/ruoyi/production/controller/SalesLedgerSchedulingController.java
@@ -2,6 +2,7 @@
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.framework.web.controller.BaseController;
@@ -11,14 +12,20 @@
 import com.ruoyi.production.dto.ProductionDispatchAddDto;
 import com.ruoyi.production.dto.SalesLedgerSchedulingDto;
 import com.ruoyi.production.dto.SalesLedgerSchedulingProcessDto;
+import com.ruoyi.production.mapper.SpeculativeTradingInfoMapper;
+import com.ruoyi.production.pojo.SpeculativeTradingInfo;
 import com.ruoyi.production.service.impl.SalesLedgerSchedulingServiceImpl;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -32,6 +39,45 @@
 
     @Autowired
     private SalesLedgerSchedulingServiceImpl salesLedgerSchedulingService;
+
+
+    @Autowired
+    private SpeculativeTradingInfoMapper speculativeTradingInfoMapper;
+
+    @GetMapping("/list")
+    @Log(title = "鐢熶骇绠$悊-鐢熶骇娲惧伐-鐐掓満淇℃伅", businessType = BusinessType.OTHER)
+    @ApiOperation("鐢熶骇绠$悊-鐢熶骇娲惧伐-鐐掓満淇℃伅")
+    public AjaxResult list() {
+        List<SpeculativeTradingInfo> result = speculativeTradingInfoMapper.selectList(null);
+        result.forEach(item -> {
+
+            item.setCurrentWorkLoad(salesLedgerSchedulingService.getSchedulingNumBySpeculativeTradingName(item.getName()).divide(new BigDecimal(1000),2, RoundingMode.CEILING));
+            item.setVacant(item.getWorkLoad().subtract(item.getCurrentWorkLoad()));
+        });
+        return AjaxResult.success(result);
+    }
+
+    @PostMapping("/addSpeculatTrading")
+    @Log(title = "鐢熶骇绠$悊-鐢熶骇娲惧伐-娣诲姞鐐掓満淇℃伅", businessType = BusinessType.INSERT)
+    @ApiOperation("鐢熶骇绠$悊-鐢熶骇娲惧伐-娣诲姞鐐掓満淇℃伅")
+    public AjaxResult addSpeculatTrading(@RequestBody List<SpeculativeTradingInfo> speculativeTradingInfo) {
+        if(CollectionUtils.isEmpty(speculativeTradingInfo)) return AjaxResult.error("鏁版嵁缁勪笉鑳戒负绌�");
+        speculativeTradingInfo.forEach(item -> {
+            speculativeTradingInfoMapper.insert(item);
+        });
+        return AjaxResult.success("娣诲姞鐐掓満淇℃伅鎴愬姛");
+    }
+
+    @PostMapping("/updateSpeculatTrading")
+    @Log(title = "鐢熶骇绠$悊-鐢熶骇娲惧伐-淇敼鐐掓満淇℃伅", businessType = BusinessType.UPDATE)
+    @ApiOperation("鐢熶骇绠$悊-鐢熶骇娲惧伐-淇敼鐐掓満淇℃伅")
+    public AjaxResult updateSpeculatTrading(@RequestBody List<SpeculativeTradingInfo> speculativeTradingInfo) {
+        if(CollectionUtils.isEmpty(speculativeTradingInfo)) return AjaxResult.error("鏁版嵁缁勪笉鑳戒负绌�");
+        speculativeTradingInfo.forEach(item -> {
+            speculativeTradingInfoMapper.updateById(item);
+        });
+        return AjaxResult.success("淇敼鐐掓満淇℃伅鎴愬姛");
+    }
 
 
     @GetMapping("/listPage")
@@ -52,12 +98,34 @@
         salesLedgerSchedulingService.export(response);
     }
 
+
+    /**
+     * 瀵煎嚭
+     * @param response
+     */
+    @PostMapping("/exportOne")
+    @ApiOperation("鐢熶骇绠$悊-鐢熶骇娲惧伐-瀵煎嚭")
+    public void exportOne(HttpServletResponse response) {
+        salesLedgerSchedulingService.exportOne(response);
+    }
+
     @PostMapping("/productionDispatch")
     @Log(title = "鐢熶骇绠$悊-鐢熶骇璁㈠崟-鐢熶骇娲惧伐", businessType = BusinessType.INSERT)
     @ApiOperation("鐢熶骇绠$悊-鐢熶骇璁㈠崟-鐢熶骇娲惧伐")
     @Transactional(rollbackFor = Exception.class)
     public AjaxResult productionDispatch(@RequestBody ProductionDispatchAddDto productionDispatchAddDto) {
-        int result = salesLedgerSchedulingService.productionDispatch(productionDispatchAddDto);
+        List<ProductionDispatchAddDto> productionDispatchAddDtoList = new ArrayList<>();
+        productionDispatchAddDtoList.add(productionDispatchAddDto);
+        String result = salesLedgerSchedulingService.productionDispatch(productionDispatchAddDtoList);
+        return AjaxResult.success(result);
+    }
+
+    @PostMapping("/productionDispatchList")
+    @Log(title = "鐢熶骇绠$悊-鐢熶骇璁㈠崟-鑷姩娲惧伐", businessType = BusinessType.INSERT)
+    @ApiOperation("鐢熶骇绠$悊-鐢熶骇璁㈠崟-鑷姩娲惧伐")
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxResult productionDispatchList(@RequestBody List<ProductionDispatchAddDto> productionDispatchAddDto) {
+        String result = salesLedgerSchedulingService.productionDispatch(productionDispatchAddDto);
         return AjaxResult.success(result);
     }
 
@@ -69,6 +137,23 @@
         return AjaxResult.success(result);
     }
 
+    /**
+     * 瀵煎嚭
+     * @param response
+     */
+    @PostMapping("/exportTwo")
+    @ApiOperation("鐢熶骇绠$悊-宸ュ簭鎺掍骇-瀵煎嚭")
+    public void exportTwo(HttpServletResponse response) {
+        Page page = new Page(-1,-1);
+        SalesLedgerSchedulingProcessDto salesLedgerSchedulingDto = new SalesLedgerSchedulingProcessDto();
+        IPage<SalesLedgerSchedulingProcessDto> result = salesLedgerSchedulingService.listPageProcess(page,salesLedgerSchedulingDto);
+        result.getRecords().forEach(item -> {
+            item.setStatusName(item.getStatus().toString());
+        });
+        ExcelUtil<SalesLedgerSchedulingProcessDto> util = new ExcelUtil<>(SalesLedgerSchedulingProcessDto.class);
+        util.exportExcel(response, result.getRecords(), "宸ュ簭鎺掍骇");
+    }
+
 
     @DeleteMapping("/productionDispatchDelete")
     @Log(title = "鐢熶骇绠$悊-宸ュ簭鎺掍骇-鍙栨秷鎺掍骇", businessType = BusinessType.DELETE)

--
Gitblit v1.9.3