소스 검색

搞定供应链安全

wukai 5 달 전
부모
커밋
f0cd3c105b
20개의 변경된 파일984개의 추가작업 그리고 152개의 파일을 삭제
  1. 21 2
      jjt-admin/src/test/java/com/jjt/order/OrderTest.java
  2. 7 7
      jjt-biz/src/main/java/com/jjt/lean/controller/LeanCapabilityAnalysisController.java
  3. 113 0
      jjt-biz/src/main/java/com/jjt/lean/controller/LeanGykcController.java
  4. 18 32
      jjt-biz/src/main/java/com/jjt/lean/controller/LeanQhController.java
  5. 18 32
      jjt-biz/src/main/java/com/jjt/lean/controller/LeanXhController.java
  6. 0 38
      jjt-biz/src/main/java/com/jjt/lean/controller/ScrmController.java
  7. 112 0
      jjt-biz/src/main/java/com/jjt/lean/controller/ScsController.java
  8. 143 0
      jjt-biz/src/main/java/com/jjt/lean/domain/LeanGykc.java
  9. 69 0
      jjt-biz/src/main/java/com/jjt/lean/mapper/LeanGykcMapper.java
  10. 69 0
      jjt-biz/src/main/java/com/jjt/lean/service/ILeanGykcService.java
  11. 97 0
      jjt-biz/src/main/java/com/jjt/lean/service/impl/LeanGykcServiceImpl.java
  12. 0 13
      jjt-biz/src/main/java/com/jjt/lean/vo/ScrmVO.java
  13. 30 0
      jjt-biz/src/main/java/com/jjt/lean/vo/ScsVO.java
  14. 5 0
      jjt-biz/src/main/java/com/jjt/order/domain/TwinOrder.java
  15. 23 0
      jjt-biz/src/main/java/com/jjt/order/domain/YclStock.java
  16. 3 2
      jjt-biz/src/main/java/com/jjt/order/service/impl/TwinOrderServiceImpl.java
  17. 35 0
      jjt-biz/src/main/java/com/jjt/utils/MssqlService.java
  18. 192 0
      jjt-biz/src/main/resources/mapper/lean/LeanGykcMapper.xml
  19. 6 6
      jjt-biz/src/main/resources/mapper/lean/LeanQhMapper.xml
  20. 23 20
      jjt-biz/src/main/resources/mapper/lean/LeanXhMapper.xml

+ 21 - 2
jjt-admin/src/test/java/com/jjt/order/OrderTest.java

@@ -1,8 +1,11 @@
 package com.jjt.order;
 
 import com.jjt.JjtApplication;
+import com.jjt.order.domain.TwinOrder;
 import com.jjt.order.domain.VmsStock;
+import com.jjt.order.domain.YclStock;
 import com.jjt.order.service.ITwinOrderService;
+import com.jjt.utils.MssqlService;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
 
@@ -24,14 +27,30 @@ import java.util.stream.Collectors;
 public class OrderTest {
     @Resource
     private ITwinOrderService orderService;
-//    @Resource
+    //    @Resource
 //    private ITwinFormulaInfoService formulaInfoService;
+    @Resource
+    private MssqlService mssqlService;
+
+    @Test
+    void lean() {
+        String start = LocalDate.now().minusDays(11).toString();
+        String end = LocalDate.now().toString();
+        List<TwinOrder> orderList = orderService.selectTwinOrderListByDate(start, end);
+        orderList.forEach(order -> {
+            System.err.println(order.getOrderDate() + "\t" + order.getOrderCode() + "\t" + order.getTwinOrderDetailList().size() + "\t" + order.getTotalWeight());
+        });
+
+        List<YclStock> yclStock = mssqlService.yclStock();
+
+        System.err.println(yclStock);
+    }
 
     @Test
     void test() {
         String d = "2025-10-17";
         LocalDate start = LocalDate.parse(d);
-            orderService.getOrder(start);
+        orderService.getOrder(start);
 //        LocalDate end = LocalDate.now().minusDays(1);
 //        do {
 //            orderService.getOrder(start);

+ 7 - 7
jjt-biz/src/main/java/com/jjt/lean/controller/LeanCapabilityAnalysisController.java

@@ -41,7 +41,7 @@ public class LeanCapabilityAnalysisController extends BaseController{
      * 查询白坯布重量分析列表
      */
     @ApiOperation("查询白坯布重量分析列表")
-    @PreAuthorize("@ss.hasPermi('lean:cap:list')")
+    //@PreAuthorize("@ss.hasPermi('lean:cap:list')")
     @GetMapping("/list")
     public TableDataInfo list(LeanCapabilityAnalysis leanCapabilityAnalysis)
     {
@@ -54,7 +54,7 @@ public class LeanCapabilityAnalysisController extends BaseController{
      * 导出白坯布重量分析列表
      */
     @ApiOperation("导出白坯布重量分析列表")
-    @PreAuthorize("@ss.hasPermi('lean:cap:export')")
+    //@PreAuthorize("@ss.hasPermi('lean:cap:export')")
     @Log(title = "白坯布重量分析", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, LeanCapabilityAnalysis leanCapabilityAnalysis)
@@ -68,7 +68,7 @@ public class LeanCapabilityAnalysisController extends BaseController{
      * 获取白坯布重量分析详细信息
      */
     @ApiOperation("获取白坯布重量分析详细信息")
-    @PreAuthorize("@ss.hasPermi('lean:cap:query')")
+    //@PreAuthorize("@ss.hasPermi('lean:cap:query')")
     @GetMapping(value = "/{bwId}")
     public AjaxResult getInfo(@PathVariable("bwId") Long bwId)
     {
@@ -79,7 +79,7 @@ public class LeanCapabilityAnalysisController extends BaseController{
      * 新增白坯布重量分析
      */
     @ApiOperation("新增白坯布重量分析")
-    @PreAuthorize("@ss.hasPermi('lean:cap:add')")
+    //@PreAuthorize("@ss.hasPermi('lean:cap:add')")
     @Log(title = "白坯布重量分析", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody LeanCapabilityAnalysis leanCapabilityAnalysis)
@@ -95,7 +95,7 @@ public class LeanCapabilityAnalysisController extends BaseController{
      * 修改白坯布重量分析
      */
     @ApiOperation("修改白坯布重量分析")
-    @PreAuthorize("@ss.hasPermi('lean:cap:edit')")
+    //@PreAuthorize("@ss.hasPermi('lean:cap:edit')")
     @Log(title = "白坯布重量分析", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody LeanCapabilityAnalysis leanCapabilityAnalysis)
@@ -111,11 +111,11 @@ public class LeanCapabilityAnalysisController extends BaseController{
      * 删除白坯布重量分析
      */
     @ApiOperation("删除白坯布重量分析")
-    @PreAuthorize("@ss.hasPermi('lean:cap:remove')")
+    //@PreAuthorize("@ss.hasPermi('lean:cap:remove')")
     @Log(title = "白坯布重量分析", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{bwIds}")
     public AjaxResult remove(@PathVariable Long[] bwIds)
     {
         return toAjax(leanCapabilityAnalysisService.deleteLeanCapabilityAnalysisByBwIds(bwIds));
     }
-}
+}

+ 113 - 0
jjt-biz/src/main/java/com/jjt/lean/controller/LeanGykcController.java

@@ -0,0 +1,113 @@
+package com.jjt.lean.controller;
+
+import java.util.List;
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.jjt.common.annotation.Log;
+import com.jjt.common.core.controller.BaseController;
+import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.enums.BusinessType;
+import com.jjt.lean.domain.LeanGykc;
+import com.jjt.lean.service.ILeanGykcService;
+import com.jjt.common.utils.poi.ExcelUtil;
+import com.jjt.common.core.page.TableDataInfo;
+
+/**
+ * 供应商库存Controller
+ *
+ * @author wukai
+ * @date 2025-11-18
+ */
+@Api(tags="供应商库存")
+@RestController
+@RequestMapping("/lean/gykc")
+public class LeanGykcController extends BaseController{
+    @Resource
+    private ILeanGykcService leanGykcService;
+
+    /**
+     * 查询供应商库存列表
+     */
+    @ApiOperation("查询供应商库存列表")
+    //@PreAuthorize("@ss.hasPermi('lean:gykc:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(LeanGykc leanGykc)
+    {
+        startPage();
+        List<LeanGykc> list = leanGykcService.selectLeanGykcList(leanGykc);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出供应商库存列表
+     */
+    @ApiOperation("导出供应商库存列表")
+    //@PreAuthorize("@ss.hasPermi('lean:gykc:export')")
+    @Log(title = "供应商库存", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, LeanGykc leanGykc)
+    {
+        List<LeanGykc> list = leanGykcService.selectLeanGykcList(leanGykc);
+        ExcelUtil<LeanGykc> util = new ExcelUtil<LeanGykc>(LeanGykc.class);
+        util.exportExcel(response, list, "供应商库存数据");
+    }
+
+    /**
+     * 获取供应商库存详细信息
+     */
+    @ApiOperation("获取供应商库存详细信息")
+    //@PreAuthorize("@ss.hasPermi('lean:gykc:query')")
+    @GetMapping(value = "/{gykcId}")
+    public AjaxResult getInfo(@PathVariable("gykcId") Long gykcId)
+    {
+        return success(leanGykcService.selectLeanGykcByGykcId(gykcId));
+    }
+
+    /**
+     * 新增供应商库存
+     */
+    @ApiOperation("新增供应商库存")
+    //@PreAuthorize("@ss.hasPermi('lean:gykc:add')")
+    @Log(title = "供应商库存", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody LeanGykc leanGykc)
+    {
+        return toAjax(leanGykcService.insertLeanGykc(leanGykc));
+    }
+
+    /**
+     * 修改供应商库存
+     */
+    @ApiOperation("修改供应商库存")
+    //@PreAuthorize("@ss.hasPermi('lean:gykc:edit')")
+    @Log(title = "供应商库存", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody LeanGykc leanGykc)
+    {
+        return toAjax(leanGykcService.updateLeanGykc(leanGykc));
+    }
+
+    /**
+     * 删除供应商库存
+     */
+    @ApiOperation("删除供应商库存")
+    //@PreAuthorize("@ss.hasPermi('lean:gykc:remove')")
+    @Log(title = "供应商库存", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{gykcIds}")
+    public AjaxResult remove(@PathVariable Long[] gykcIds)
+    {
+        return toAjax(leanGykcService.deleteLeanGykcByGykcIds(gykcIds));
+    }
+}

+ 18 - 32
jjt-biz/src/main/java/com/jjt/lean/controller/LeanQhController.java

@@ -1,28 +1,20 @@
 package com.jjt.lean.controller;
 
-import java.util.List;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.jjt.common.annotation.Log;
 import com.jjt.common.core.controller.BaseController;
 import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.core.page.TableDataInfo;
 import com.jjt.common.enums.BusinessType;
+import com.jjt.common.utils.poi.ExcelUtil;
 import com.jjt.lean.domain.LeanQh;
 import com.jjt.lean.service.ILeanQhService;
-import com.jjt.common.utils.poi.ExcelUtil;
-import com.jjt.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 期货价格Controller
@@ -30,10 +22,10 @@ import com.jjt.common.core.page.TableDataInfo;
  * @author wukai
  * @date 2025-11-16
  */
-@Api(tags="期货价格")
+@Api(tags = "期货价格")
 @RestController
 @RequestMapping("/lean/qh")
-public class LeanQhController extends BaseController{
+public class LeanQhController extends BaseController {
     @Resource
     private ILeanQhService leanQhService;
 
@@ -43,8 +35,7 @@ public class LeanQhController extends BaseController{
     @ApiOperation("查询期货价格列表")
     //@PreAuthorize("@ss.hasPermi('lean:qh:list')")
     @GetMapping("/list")
-    public TableDataInfo list(LeanQh leanQh)
-    {
+    public TableDataInfo list(LeanQh leanQh) {
         startPage();
         List<LeanQh> list = leanQhService.selectLeanQhList(leanQh);
         return getDataTable(list);
@@ -57,8 +48,7 @@ public class LeanQhController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('lean:qh:export')")
     @Log(title = "期货价格", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, LeanQh leanQh)
-    {
+    public void export(HttpServletResponse response, LeanQh leanQh) {
         List<LeanQh> list = leanQhService.selectLeanQhList(leanQh);
         ExcelUtil<LeanQh> util = new ExcelUtil<LeanQh>(LeanQh.class);
         util.exportExcel(response, list, "期货价格数据");
@@ -70,8 +60,7 @@ public class LeanQhController extends BaseController{
     @ApiOperation("获取期货价格详细信息")
     //@PreAuthorize("@ss.hasPermi('lean:qh:query')")
     @GetMapping(value = "/{qhId}")
-    public AjaxResult getInfo(@PathVariable("qhId") Long qhId)
-    {
+    public AjaxResult getInfo(@PathVariable("qhId") Long qhId) {
         return success(leanQhService.selectLeanQhByQhId(qhId));
     }
 
@@ -82,8 +71,7 @@ public class LeanQhController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('lean:qh:add')")
     @Log(title = "期货价格", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody LeanQh leanQh)
-    {
+    public AjaxResult add(@RequestBody LeanQh leanQh) {
         return toAjax(leanQhService.insertLeanQh(leanQh));
     }
 
@@ -94,8 +82,7 @@ public class LeanQhController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('lean:qh:edit')")
     @Log(title = "期货价格", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody LeanQh leanQh)
-    {
+    public AjaxResult edit(@RequestBody LeanQh leanQh) {
         return toAjax(leanQhService.updateLeanQh(leanQh));
     }
 
@@ -105,9 +92,8 @@ public class LeanQhController extends BaseController{
     @ApiOperation("删除期货价格")
     //@PreAuthorize("@ss.hasPermi('lean:qh:remove')")
     @Log(title = "期货价格", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{qhIds}")
-    public AjaxResult remove(@PathVariable Long[] qhIds)
-    {
+    @DeleteMapping("/{qhIds}")
+    public AjaxResult remove(@PathVariable Long[] qhIds) {
         return toAjax(leanQhService.deleteLeanQhByQhIds(qhIds));
     }
 }

+ 18 - 32
jjt-biz/src/main/java/com/jjt/lean/controller/LeanXhController.java

@@ -1,28 +1,20 @@
 package com.jjt.lean.controller;
 
-import java.util.List;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
 import com.jjt.common.annotation.Log;
 import com.jjt.common.core.controller.BaseController;
 import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.core.page.TableDataInfo;
 import com.jjt.common.enums.BusinessType;
+import com.jjt.common.utils.poi.ExcelUtil;
 import com.jjt.lean.domain.LeanXh;
 import com.jjt.lean.service.ILeanXhService;
-import com.jjt.common.utils.poi.ExcelUtil;
-import com.jjt.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * 现货价格Controller
@@ -30,10 +22,10 @@ import com.jjt.common.core.page.TableDataInfo;
  * @author wukai
  * @date 2025-11-16
  */
-@Api(tags="现货价格")
+@Api(tags = "现货价格")
 @RestController
 @RequestMapping("/lean/xh")
-public class LeanXhController extends BaseController{
+public class LeanXhController extends BaseController {
     @Resource
     private ILeanXhService leanXhService;
 
@@ -43,8 +35,7 @@ public class LeanXhController extends BaseController{
     @ApiOperation("查询现货价格列表")
     //@PreAuthorize("@ss.hasPermi('lean:xh:list')")
     @GetMapping("/list")
-    public TableDataInfo list(LeanXh leanXh)
-    {
+    public TableDataInfo list(LeanXh leanXh) {
         startPage();
         List<LeanXh> list = leanXhService.selectLeanXhList(leanXh);
         return getDataTable(list);
@@ -57,8 +48,7 @@ public class LeanXhController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('lean:xh:export')")
     @Log(title = "现货价格", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, LeanXh leanXh)
-    {
+    public void export(HttpServletResponse response, LeanXh leanXh) {
         List<LeanXh> list = leanXhService.selectLeanXhList(leanXh);
         ExcelUtil<LeanXh> util = new ExcelUtil<LeanXh>(LeanXh.class);
         util.exportExcel(response, list, "现货价格数据");
@@ -70,8 +60,7 @@ public class LeanXhController extends BaseController{
     @ApiOperation("获取现货价格详细信息")
     //@PreAuthorize("@ss.hasPermi('lean:xh:query')")
     @GetMapping(value = "/{xhId}")
-    public AjaxResult getInfo(@PathVariable("xhId") Long xhId)
-    {
+    public AjaxResult getInfo(@PathVariable("xhId") Long xhId) {
         return success(leanXhService.selectLeanXhByXhId(xhId));
     }
 
@@ -82,8 +71,7 @@ public class LeanXhController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('lean:xh:add')")
     @Log(title = "现货价格", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody LeanXh leanXh)
-    {
+    public AjaxResult add(@RequestBody LeanXh leanXh) {
         return toAjax(leanXhService.insertLeanXh(leanXh));
     }
 
@@ -94,8 +82,7 @@ public class LeanXhController extends BaseController{
     //@PreAuthorize("@ss.hasPermi('lean:xh:edit')")
     @Log(title = "现货价格", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody LeanXh leanXh)
-    {
+    public AjaxResult edit(@RequestBody LeanXh leanXh) {
         return toAjax(leanXhService.updateLeanXh(leanXh));
     }
 
@@ -105,9 +92,8 @@ public class LeanXhController extends BaseController{
     @ApiOperation("删除现货价格")
     //@PreAuthorize("@ss.hasPermi('lean:xh:remove')")
     @Log(title = "现货价格", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{xhIds}")
-    public AjaxResult remove(@PathVariable Long[] xhIds)
-    {
+    @DeleteMapping("/{xhIds}")
+    public AjaxResult remove(@PathVariable Long[] xhIds) {
         return toAjax(leanXhService.deleteLeanXhByXhIds(xhIds));
     }
 }

+ 0 - 38
jjt-biz/src/main/java/com/jjt/lean/controller/ScrmController.java

@@ -1,38 +0,0 @@
-package com.jjt.lean.controller;
-
-import com.jjt.common.core.controller.BaseController;
-import com.jjt.common.core.domain.R;
-import com.jjt.common.core.redis.RedisCache;
-import com.jjt.lean.vo.ScrmVO;
-import com.jjt.order.service.ITwinOrderService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * 供应链安全
- *
- * @author ruoyi
- */
-@Api(tags = "全厂孪生数据接口")
-@RestController
-@RequestMapping("/lean/scrm")
-@Slf4j
-public class ScrmController extends BaseController {
-    @Resource
-    private ITwinOrderService twinOrderService;
-    @Resource
-    private RedisCache redisCache;
-
-    @ApiOperation("获取所有数据")
-    @GetMapping("/getAll")
-    public R<ScrmVO> getAll() {
-        return R.success(new ScrmVO());
-    }
-
-}

+ 112 - 0
jjt-biz/src/main/java/com/jjt/lean/controller/ScsController.java

@@ -0,0 +1,112 @@
+package com.jjt.lean.controller;
+
+import com.jjt.common.core.controller.BaseController;
+import com.jjt.common.core.domain.AjaxResult;
+import com.jjt.common.core.domain.R;
+import com.jjt.common.utils.SecurityUtils;
+import com.jjt.common.utils.StringUtils;
+import com.jjt.lean.service.ILeanGykcService;
+import com.jjt.lean.vo.ScsVO;
+import com.jjt.order.domain.TwinOrder;
+import com.jjt.order.domain.YclStock;
+import com.jjt.order.service.ITwinOrderService;
+import com.jjt.utils.MssqlService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDate;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 供应链安全
+ *
+ * @author ruoyi
+ */
+@Api(tags = "全厂孪生数据接口")
+@RestController
+@RequestMapping("/lean/scs")
+@Slf4j
+public class ScsController extends BaseController {
+    @Resource
+    private ITwinOrderService twinOrderService;
+    @Resource
+    private MssqlService mssqlService;
+    @Resource
+    private ILeanGykcService gykcService;
+    @Resource
+    private RedisTemplate<String, Object> redisTemplate;
+
+    @ApiOperation("获取所有数据")
+    @GetMapping("/data")
+    public R<ScsVO> data() {
+        ScsVO vo = new ScsVO();
+        String start = LocalDate.now().minusDays(11).toString();
+        String end = LocalDate.now().toString();
+        List<TwinOrder> orderList = twinOrderService.selectTwinOrderListByDate(start, end);
+        vo.setOrderList(orderList);
+        vo.setWeight(orderList.stream().map(TwinOrder::getTotalWeight).filter(StringUtils::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+        List<YclStock> yclStock = mssqlService.yclStock();
+        yclStock.forEach(ycl -> {
+            switch (ycl.getType()) {
+                case "DTY类":
+                    vo.setDty(ycl.getWeight());
+                case "POY类":
+                    vo.setPoy(ycl.getWeight());
+                    break;
+                case "FDY类":
+                    vo.setFdy(ycl.getWeight());
+                    break;
+                default:
+                    break;
+            }
+        });
+
+        BigDecimal poy = gykcService.selectPoyWeight();
+        vo.setGyPoy(poy.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP));
+        return R.success(vo);
+    }
+
+    /**
+     * 保存参数设置到Redis
+     */
+    @PostMapping("/params")
+    public AjaxResult saveParams(@RequestBody Map<String, Object> params) {
+        try {
+            // 将参数保存到Redis,使用用户ID作为key的一部分
+            String key = "scs:params:" + SecurityUtils.getUserId();
+            redisTemplate.opsForValue().set(key, params);
+            return AjaxResult.success("参数保存成功");
+        } catch (Exception e) {
+            return AjaxResult.error("参数保存失败: " + e.getMessage());
+        }
+    }
+
+    /**
+     * 获取已保存的参数
+     */
+    @GetMapping("/params")
+    public AjaxResult getParams() {
+        try {
+            String key = "scs:params:" + SecurityUtils.getUserId();
+            Object params = redisTemplate.opsForValue().get(key);
+            if (params != null) {
+                return AjaxResult.success(params);
+            } else {
+                return AjaxResult.success(new HashMap<>());
+                // 返回空参数
+            }
+        } catch (Exception e) {
+            return AjaxResult.error("参数获取失败: " + e.getMessage());
+        }
+    }
+
+}

+ 143 - 0
jjt-biz/src/main/java/com/jjt/lean/domain/LeanGykc.java

@@ -0,0 +1,143 @@
+package com.jjt.lean.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.jjt.common.annotation.Excel;
+import com.jjt.common.core.domain.BaseEntity;
+
+/**
+ * 供应商库存对象 LEAN_GYKC
+ *
+ * @author wukai
+ * @date 2025-11-18
+ */
+@ApiModel(value = "LeanGykc", description = "供应商库存")
+@Data
+public class LeanGykc extends BaseEntity{
+    private static final long serialVersionUID = 1L;
+
+    /** ID */
+    @ApiModelProperty("ID")
+    @TableId
+    private Long gykcId;
+
+    /** 入库时间 */
+    @ApiModelProperty("入库时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date storageTime;
+
+    /** 丝车号 */
+    @ApiModelProperty("丝车号")
+    @Excel(name = "丝车号")
+    private String silkCarNo;
+
+    /** 货位地址 */
+    @ApiModelProperty("货位地址")
+    @Excel(name = "货位地址")
+    private String locationAddress;
+
+    /** 货位状态 */
+    @ApiModelProperty("货位状态")
+    @Excel(name = "货位状态")
+    private String locationStatus;
+
+    /** 批号 */
+    @ApiModelProperty("批号")
+    @Excel(name = "批号")
+    private String batchNo;
+
+    /** 丝车等级 */
+    @ApiModelProperty("丝车等级")
+    @Excel(name = "丝车等级")
+    private String silkCarGrade;
+
+    /** 规格 */
+    @ApiModelProperty("规格")
+    @Excel(name = "规格")
+    private String specification;
+
+    /** 纺位区域 */
+    @ApiModelProperty("纺位区域")
+    @Excel(name = "纺位区域")
+    private String spinningArea;
+
+    /** 纺位明细 */
+    @ApiModelProperty("纺位明细")
+    @Excel(name = "纺位明细")
+    private String spinningDetail;
+
+    /** 挂牌信息 */
+    @ApiModelProperty("挂牌信息")
+    @Excel(name = "挂牌信息")
+    private String tagInfo;
+
+    /** 单据号 */
+    @ApiModelProperty("单据号")
+    @Excel(name = "单据号")
+    private String documentNo;
+
+    /** 最大满卷时间 */
+    @ApiModelProperty("最大满卷时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "最大满卷时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date maxFullRollTime;
+
+    /** 丝锭数 */
+    @ApiModelProperty("丝锭数")
+    @Excel(name = "丝锭数")
+    private Long silkSpindleCount;
+
+    /** 丝锭总重量 */
+    @ApiModelProperty("丝锭总重量")
+    @Excel(name = "丝锭总重量")
+    private BigDecimal totalWeight;
+
+    /** 平衡时间 */
+    @ApiModelProperty("平衡时间")
+    @Excel(name = "平衡时间")
+    private Long balanceTime;
+
+    /** 平衡时间下限 */
+    @ApiModelProperty("平衡时间下限")
+    @Excel(name = "平衡时间下限")
+    private Long batchBalanceTimeLower;
+
+    /** 下限差值 */
+    @ApiModelProperty("下限差值")
+    @Excel(name = "下限差值")
+    private Long lowerDifference;
+
+    /** 平衡时间上限 */
+    @ApiModelProperty("平衡时间上限")
+    @Excel(name = "平衡时间上限")
+    private Long batchBalanceTimeUpper;
+
+    /** 上限差值 */
+    @ApiModelProperty("上限差值")
+    @Excel(name = "上限差值")
+    private Long upperDifference;
+
+    /** 丝车ID */
+    @ApiModelProperty("丝车ID")
+    @Excel(name = "丝车ID")
+    private Long silkCarId;
+
+    /** 货位地址索引 */
+    @ApiModelProperty("货位地址索引")
+    @Excel(name = "货位地址索引")
+    private Long locationIndex;
+
+    /** 货位状态代码 */
+    @ApiModelProperty("货位状态代码")
+    @Excel(name = "货位状态代码")
+    private String locationStatusCode;
+
+}

+ 69 - 0
jjt-biz/src/main/java/com/jjt/lean/mapper/LeanGykcMapper.java

@@ -0,0 +1,69 @@
+package com.jjt.lean.mapper;
+
+import java.math.BigDecimal;
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jjt.lean.domain.LeanGykc;
+
+/**
+ * 供应商库存Mapper接口
+ *
+ * @author wukai
+ * @date 2025-11-18
+ */
+public interface LeanGykcMapper extends BaseMapper<LeanGykc>
+{
+    /**
+     * 查询供应商库存
+     *
+     * @param gykcId 供应商库存主键
+     * @return 供应商库存
+     */
+    public LeanGykc selectLeanGykcByGykcId(Long gykcId);
+
+    /**
+     * 查询供应商库存列表
+     *
+     * @param leanGykc 供应商库存
+     * @return 供应商库存集合
+     */
+    public List<LeanGykc> selectLeanGykcList(LeanGykc leanGykc);
+
+    /**
+     * 新增供应商库存
+     *
+     * @param leanGykc 供应商库存
+     * @return 结果
+     */
+    public int insertLeanGykc(LeanGykc leanGykc);
+
+    /**
+     * 修改供应商库存
+     *
+     * @param leanGykc 供应商库存
+     * @return 结果
+     */
+    public int updateLeanGykc(LeanGykc leanGykc);
+
+    /**
+     * 删除供应商库存
+     *
+     * @param gykcId 供应商库存主键
+     * @return 结果
+     */
+    public int deleteLeanGykcByGykcId(Long gykcId);
+
+    /**
+     * 批量删除供应商库存
+     *
+     * @param gykcIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteLeanGykcByGykcIds(Long[] gykcIds);
+    /**
+     * 获取供应商库存
+     *
+     * @return 结果
+     */
+    BigDecimal selectPoyWeight();
+}

+ 69 - 0
jjt-biz/src/main/java/com/jjt/lean/service/ILeanGykcService.java

@@ -0,0 +1,69 @@
+package com.jjt.lean.service;
+
+import com.jjt.lean.domain.LeanGykc;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 供应商库存Service接口
+ *
+ * @author wukai
+ * @date 2025-11-18
+ */
+public interface ILeanGykcService {
+    /**
+     * 查询供应商库存
+     *
+     * @param gykcId 供应商库存主键
+     * @return 供应商库存
+     */
+    public LeanGykc selectLeanGykcByGykcId(Long gykcId);
+
+    /**
+     * 查询供应商库存列表
+     *
+     * @param leanGykc 供应商库存
+     * @return 供应商库存集合
+     */
+    public List<LeanGykc> selectLeanGykcList(LeanGykc leanGykc);
+
+    /**
+     * 新增供应商库存
+     *
+     * @param leanGykc 供应商库存
+     * @return 结果
+     */
+    public int insertLeanGykc(LeanGykc leanGykc);
+
+    /**
+     * 修改供应商库存
+     *
+     * @param leanGykc 供应商库存
+     * @return 结果
+     */
+    public int updateLeanGykc(LeanGykc leanGykc);
+
+    /**
+     * 批量删除供应商库存
+     *
+     * @param gykcIds 需要删除的供应商库存主键集合
+     * @return 结果
+     */
+    public int deleteLeanGykcByGykcIds(Long[] gykcIds);
+
+    /**
+     * 删除供应商库存信息
+     *
+     * @param gykcId 供应商库存主键
+     * @return 结果
+     */
+    public int deleteLeanGykcByGykcId(Long gykcId);
+
+    /**
+     * 获取供应商库存
+     *
+     * @return 结果
+     */
+    BigDecimal selectPoyWeight();
+}

+ 97 - 0
jjt-biz/src/main/java/com/jjt/lean/service/impl/LeanGykcServiceImpl.java

@@ -0,0 +1,97 @@
+package com.jjt.lean.service.impl;
+
+import java.math.BigDecimal;
+import java.util.List;
+import org.springframework.stereotype.Service;
+import com.jjt.lean.mapper.LeanGykcMapper;
+import com.jjt.lean.domain.LeanGykc;
+import com.jjt.lean.service.ILeanGykcService;
+import javax.annotation.Resource;
+
+/**
+ * 供应商库存Service业务层处理
+ *
+ * @author wukai
+ * @date 2025-11-18
+ */
+@Service
+public class LeanGykcServiceImpl implements ILeanGykcService {
+    @Resource
+    private LeanGykcMapper leanGykcMapper;
+
+    /**
+     * 查询供应商库存
+     *
+     * @param gykcId 供应商库存主键
+     * @return 供应商库存
+     */
+    @Override
+    public LeanGykc selectLeanGykcByGykcId(Long gykcId) {
+        return leanGykcMapper.selectLeanGykcByGykcId(gykcId);
+    }
+
+    /**
+     * 查询供应商库存列表
+     *
+     * @param leanGykc 供应商库存
+     * @return 供应商库存
+     */
+    @Override
+    public List<LeanGykc> selectLeanGykcList(LeanGykc leanGykc) {
+        return leanGykcMapper.selectLeanGykcList(leanGykc);
+    }
+
+    /**
+     * 新增供应商库存
+     *
+     * @param leanGykc 供应商库存
+     * @return 结果
+     */
+    @Override
+    public int insertLeanGykc(LeanGykc leanGykc) {
+            return leanGykcMapper.insertLeanGykc(leanGykc);
+    }
+
+    /**
+     * 修改供应商库存
+     *
+     * @param leanGykc 供应商库存
+     * @return 结果
+     */
+    @Override
+    public int updateLeanGykc(LeanGykc leanGykc) {
+        return leanGykcMapper.updateLeanGykc(leanGykc);
+    }
+
+    /**
+     * 批量删除供应商库存
+     *
+     * @param gykcIds 需要删除的供应商库存主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLeanGykcByGykcIds(Long[] gykcIds) {
+        return leanGykcMapper.deleteLeanGykcByGykcIds(gykcIds);
+    }
+
+    /**
+     * 删除供应商库存信息
+     *
+     * @param gykcId 供应商库存主键
+     * @return 结果
+     */
+    @Override
+    public int deleteLeanGykcByGykcId(Long gykcId) {
+        return leanGykcMapper.deleteLeanGykcByGykcId(gykcId);
+    }
+
+    /**
+     * 获取供应商库存
+     *
+     * @return 结果
+     */
+    @Override
+    public BigDecimal selectPoyWeight() {
+        return leanGykcMapper.selectPoyWeight();
+    }
+}

+ 0 - 13
jjt-biz/src/main/java/com/jjt/lean/vo/ScrmVO.java

@@ -1,13 +0,0 @@
-package com.jjt.lean.vo;
-
-import lombok.Data;
-
-/**
- * ScrmVO$
- *
- * @author wukai
- * @date 2025/11/15 23:49
- */
-@Data
-public class ScrmVO {
-}

+ 30 - 0
jjt-biz/src/main/java/com/jjt/lean/vo/ScsVO.java

@@ -0,0 +1,30 @@
+package com.jjt.lean.vo;
+
+import com.jjt.order.domain.TwinOrder;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * ScrmVO$
+ *
+ * @author wukai
+ * @date 2025/11/15 23:49
+ */
+@Data
+public class ScsVO {
+    @ApiModelProperty("需求重量")
+    private BigDecimal weight;
+    @ApiModelProperty("dty")
+    private BigDecimal dty;
+    @ApiModelProperty("poy")
+    private BigDecimal poy;
+    @ApiModelProperty("gyPoy")
+    private BigDecimal gyPoy;
+    @ApiModelProperty("fdy")
+    private BigDecimal fdy;
+    @ApiModelProperty("订单列表")
+    private List<TwinOrder> orderList;
+}

+ 5 - 0
jjt-biz/src/main/java/com/jjt/order/domain/TwinOrder.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -67,5 +68,9 @@ public class TwinOrder extends BaseEntity {
      * 物料信息
      */
     private List<BomVO> bomList;
+    /**
+     * 总重量
+     */
+    private BigDecimal totalWeight;
 
 }

+ 23 - 0
jjt-biz/src/main/java/com/jjt/order/domain/YclStock.java

@@ -0,0 +1,23 @@
+package com.jjt.order.domain;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 原材料库存
+ *
+ * @author ruoyi
+ * @date 2024-12-30
+ */
+@ApiModel(value = "YclStock", description = "原材料库存")
+@Data
+public class YclStock {
+    private static final long serialVersionUID = 1L;
+    @ApiModelProperty("sku")
+    private String type;
+    @ApiModelProperty("总重")
+    private BigDecimal weight;
+}

+ 3 - 2
jjt-biz/src/main/java/com/jjt/order/service/impl/TwinOrderServiceImpl.java

@@ -3,7 +3,6 @@ package com.jjt.order.service.impl;
 import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
-import com.jjt.common.core.redis.RedisCache;
 import com.jjt.common.core.text.Convert;
 import com.jjt.common.utils.DateUtils;
 import com.jjt.common.utils.StringUtils;
@@ -198,7 +197,9 @@ public class TwinOrderServiceImpl implements ITwinOrderService {
         list.forEach(to -> {
             TwinOrderDetail tod = new TwinOrderDetail();
             tod.setOderId(to.getOderId());
-            to.setTwinOrderDetailList(detailService.selectTwinOrderDetailList(tod));
+            List<TwinOrderDetail> detailList = detailService.selectTwinOrderDetailList(tod);
+            to.setTotalWeight(detailList.stream().map(TwinOrderDetail::getWeight).filter(StringUtils::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(1000), 2, BigDecimal.ROUND_HALF_UP));
+            to.setTwinOrderDetailList(detailList);
         });
         return list;
     }

+ 35 - 0
jjt-biz/src/main/java/com/jjt/utils/MssqlService.java

@@ -3,9 +3,12 @@ package com.jjt.utils;
 import com.jjt.common.utils.StringUtils;
 import com.jjt.order.domain.MesStock;
 import com.jjt.order.domain.VmsStock;
+import com.jjt.order.domain.YclStock;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
@@ -108,6 +111,38 @@ public class MssqlService {
     }
 
     /**
+     * 白柸布库存
+     *
+     * @return 结果
+     */
+    public List<YclStock> yclStock() {
+        List<YclStock> stocks = new ArrayList<>();
+        try {
+            //第一步:加载数据库驱动程序,此时不需要实例化,因为会由容器自己负责
+            Class.forName(dbDriver);
+            String sql = "SELECT SKU_CLASS,SUM(QTY) WEIGTH FROM V_WMS_STOCK WHERE WAREHOUSE_ID='WH01-原料仓库' AND UOM='KG' GROUP BY SKU_CLASS";
+            try (Connection conn = DriverManager.getConnection(dbUrl, user, pass); Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery(sql)) {
+                //第二步:根据连接协议、用户名、密码连接数据库
+                //第三步:进行数据库的数据操作
+                //取得Statement对象
+                //使用ResultSet接收数据
+                while (rs.next()) {
+                    String type = rs.getString("SKU_CLASS");
+                    Float weight = rs.getFloat("WEIGTH");
+
+                    YclStock stock = new YclStock();
+                    stock.setType(type);
+                    stock.setWeight(BigDecimal.valueOf(weight).divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP));
+                    stocks.add(stock);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return stocks;
+    }
+
+    /**
      * mes当前库存
      *
      * @param localDate 当前时间

+ 192 - 0
jjt-biz/src/main/resources/mapper/lean/LeanGykcMapper.xml

@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jjt.lean.mapper.LeanGykcMapper">
+
+    <resultMap type="LeanGykc" id="LeanGykcResult">
+        <result property="gykcId" column="GYKC_ID"/>
+        <result property="storageTime" column="STORAGE_TIME"/>
+        <result property="silkCarNo" column="SILK_CAR_NO"/>
+        <result property="locationAddress" column="LOCATION_ADDRESS"/>
+        <result property="locationStatus" column="LOCATION_STATUS"/>
+        <result property="batchNo" column="BATCH_NO"/>
+        <result property="silkCarGrade" column="SILK_CAR_GRADE"/>
+        <result property="specification" column="SPECIFICATION"/>
+        <result property="spinningArea" column="SPINNING_AREA"/>
+        <result property="spinningDetail" column="SPINNING_DETAIL"/>
+        <result property="tagInfo" column="TAG_INFO"/>
+        <result property="documentNo" column="DOCUMENT_NO"/>
+        <result property="maxFullRollTime" column="MAX_FULL_ROLL_TIME"/>
+        <result property="silkSpindleCount" column="SILK_SPINDLE_COUNT"/>
+        <result property="totalWeight" column="TOTAL_WEIGHT"/>
+        <result property="balanceTime" column="BALANCE_TIME"/>
+        <result property="batchBalanceTimeLower" column="BATCH_BALANCE_TIME_LOWER"/>
+        <result property="lowerDifference" column="LOWER_DIFFERENCE"/>
+        <result property="batchBalanceTimeUpper" column="BATCH_BALANCE_TIME_UPPER"/>
+        <result property="upperDifference" column="UPPER_DIFFERENCE"/>
+        <result property="silkCarId" column="SILK_CAR_ID"/>
+        <result property="locationIndex" column="LOCATION_INDEX"/>
+        <result property="locationStatusCode" column="LOCATION_STATUS_CODE"/>
+    </resultMap>
+
+    <sql id="selectLeanGykcVo">
+        select GYKC_ID,
+               STORAGE_TIME,
+               SILK_CAR_NO,
+               LOCATION_ADDRESS,
+               LOCATION_STATUS,
+               BATCH_NO,
+               SILK_CAR_GRADE,
+               SPECIFICATION,
+               SPINNING_AREA,
+               SPINNING_DETAIL,
+               TAG_INFO,
+               DOCUMENT_NO,
+               MAX_FULL_ROLL_TIME,
+               SILK_SPINDLE_COUNT,
+               TOTAL_WEIGHT,
+               BALANCE_TIME,
+               BATCH_BALANCE_TIME_LOWER,
+               LOWER_DIFFERENCE,
+               BATCH_BALANCE_TIME_UPPER,
+               UPPER_DIFFERENCE,
+               SILK_CAR_ID,
+               LOCATION_INDEX,
+               LOCATION_STATUS_CODE
+        from LEAN_GYKC
+    </sql>
+
+    <select id="selectLeanGykcList" parameterType="LeanGykc" resultMap="LeanGykcResult">
+        <include refid="selectLeanGykcVo"/>
+        <where>
+            <if test="storageTime != null ">and STORAGE_TIME = #{storageTime}</if>
+            <if test="silkCarNo != null  and silkCarNo != ''">and SILK_CAR_NO = #{silkCarNo}</if>
+            <if test="locationAddress != null  and locationAddress != ''">and LOCATION_ADDRESS = #{locationAddress}</if>
+            <if test="locationStatus != null  and locationStatus != ''">and LOCATION_STATUS = #{locationStatus}</if>
+            <if test="batchNo != null  and batchNo != ''">and BATCH_NO = #{batchNo}</if>
+            <if test="silkCarGrade != null  and silkCarGrade != ''">and SILK_CAR_GRADE = #{silkCarGrade}</if>
+            <if test="specification != null  and specification != ''">and SPECIFICATION = #{specification}</if>
+            <if test="spinningArea != null  and spinningArea != ''">and SPINNING_AREA = #{spinningArea}</if>
+            <if test="spinningDetail != null  and spinningDetail != ''">and SPINNING_DETAIL = #{spinningDetail}</if>
+            <if test="tagInfo != null  and tagInfo != ''">and TAG_INFO = #{tagInfo}</if>
+            <if test="documentNo != null  and documentNo != ''">and DOCUMENT_NO = #{documentNo}</if>
+            <if test="maxFullRollTime != null ">and MAX_FULL_ROLL_TIME = #{maxFullRollTime}</if>
+            <if test="silkSpindleCount != null ">and SILK_SPINDLE_COUNT = #{silkSpindleCount}</if>
+            <if test="totalWeight != null ">and TOTAL_WEIGHT = #{totalWeight}</if>
+            <if test="balanceTime != null ">and BALANCE_TIME = #{balanceTime}</if>
+            <if test="batchBalanceTimeLower != null ">and BATCH_BALANCE_TIME_LOWER = #{batchBalanceTimeLower}</if>
+            <if test="lowerDifference != null ">and LOWER_DIFFERENCE = #{lowerDifference}</if>
+            <if test="batchBalanceTimeUpper != null ">and BATCH_BALANCE_TIME_UPPER = #{batchBalanceTimeUpper}</if>
+            <if test="upperDifference != null ">and UPPER_DIFFERENCE = #{upperDifference}</if>
+            <if test="silkCarId != null ">and SILK_CAR_ID = #{silkCarId}</if>
+            <if test="locationIndex != null ">and LOCATION_INDEX = #{locationIndex}</if>
+            <if test="locationStatusCode != null  and locationStatusCode != ''">and LOCATION_STATUS_CODE =
+                #{locationStatusCode}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectLeanGykcByGykcId" parameterType="Long" resultMap="LeanGykcResult">
+        <include refid="selectLeanGykcVo"/>
+        where GYKC_ID = #{gykcId}
+    </select>
+    <select id="selectPoyWeight" resultType="java.math.BigDecimal">
+        select sum(TOTAL_WEIGHT)
+        from LEAN_GYKC
+    </select>
+
+    <insert id="insertLeanGykc" parameterType="LeanGykc" useGeneratedKeys="true" keyProperty="gykcId">
+        insert into LEAN_GYKC
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="storageTime != null">STORAGE_TIME,</if>
+            <if test="silkCarNo != null">SILK_CAR_NO,</if>
+            <if test="locationAddress != null">LOCATION_ADDRESS,</if>
+            <if test="locationStatus != null">LOCATION_STATUS,</if>
+            <if test="batchNo != null">BATCH_NO,</if>
+            <if test="silkCarGrade != null">SILK_CAR_GRADE,</if>
+            <if test="specification != null">SPECIFICATION,</if>
+            <if test="spinningArea != null">SPINNING_AREA,</if>
+            <if test="spinningDetail != null">SPINNING_DETAIL,</if>
+            <if test="tagInfo != null">TAG_INFO,</if>
+            <if test="documentNo != null">DOCUMENT_NO,</if>
+            <if test="maxFullRollTime != null">MAX_FULL_ROLL_TIME,</if>
+            <if test="silkSpindleCount != null">SILK_SPINDLE_COUNT,</if>
+            <if test="totalWeight != null">TOTAL_WEIGHT,</if>
+            <if test="balanceTime != null">BALANCE_TIME,</if>
+            <if test="batchBalanceTimeLower != null">BATCH_BALANCE_TIME_LOWER,</if>
+            <if test="lowerDifference != null">LOWER_DIFFERENCE,</if>
+            <if test="batchBalanceTimeUpper != null">BATCH_BALANCE_TIME_UPPER,</if>
+            <if test="upperDifference != null">UPPER_DIFFERENCE,</if>
+            <if test="silkCarId != null">SILK_CAR_ID,</if>
+            <if test="locationIndex != null">LOCATION_INDEX,</if>
+            <if test="locationStatusCode != null">LOCATION_STATUS_CODE,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="storageTime != null">#{storageTime},</if>
+            <if test="silkCarNo != null">#{silkCarNo},</if>
+            <if test="locationAddress != null">#{locationAddress},</if>
+            <if test="locationStatus != null">#{locationStatus},</if>
+            <if test="batchNo != null">#{batchNo},</if>
+            <if test="silkCarGrade != null">#{silkCarGrade},</if>
+            <if test="specification != null">#{specification},</if>
+            <if test="spinningArea != null">#{spinningArea},</if>
+            <if test="spinningDetail != null">#{spinningDetail},</if>
+            <if test="tagInfo != null">#{tagInfo},</if>
+            <if test="documentNo != null">#{documentNo},</if>
+            <if test="maxFullRollTime != null">#{maxFullRollTime},</if>
+            <if test="silkSpindleCount != null">#{silkSpindleCount},</if>
+            <if test="totalWeight != null">#{totalWeight},</if>
+            <if test="balanceTime != null">#{balanceTime},</if>
+            <if test="batchBalanceTimeLower != null">#{batchBalanceTimeLower},</if>
+            <if test="lowerDifference != null">#{lowerDifference},</if>
+            <if test="batchBalanceTimeUpper != null">#{batchBalanceTimeUpper},</if>
+            <if test="upperDifference != null">#{upperDifference},</if>
+            <if test="silkCarId != null">#{silkCarId},</if>
+            <if test="locationIndex != null">#{locationIndex},</if>
+            <if test="locationStatusCode != null">#{locationStatusCode},</if>
+        </trim>
+    </insert>
+
+    <update id="updateLeanGykc" parameterType="LeanGykc">
+        update LEAN_GYKC
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="storageTime != null">STORAGE_TIME = #{storageTime},</if>
+            <if test="silkCarNo != null">SILK_CAR_NO = #{silkCarNo},</if>
+            <if test="locationAddress != null">LOCATION_ADDRESS = #{locationAddress},</if>
+            <if test="locationStatus != null">LOCATION_STATUS = #{locationStatus},</if>
+            <if test="batchNo != null">BATCH_NO = #{batchNo},</if>
+            <if test="silkCarGrade != null">SILK_CAR_GRADE = #{silkCarGrade},</if>
+            <if test="specification != null">SPECIFICATION = #{specification},</if>
+            <if test="spinningArea != null">SPINNING_AREA = #{spinningArea},</if>
+            <if test="spinningDetail != null">SPINNING_DETAIL = #{spinningDetail},</if>
+            <if test="tagInfo != null">TAG_INFO = #{tagInfo},</if>
+            <if test="documentNo != null">DOCUMENT_NO = #{documentNo},</if>
+            <if test="maxFullRollTime != null">MAX_FULL_ROLL_TIME = #{maxFullRollTime},</if>
+            <if test="silkSpindleCount != null">SILK_SPINDLE_COUNT = #{silkSpindleCount},</if>
+            <if test="totalWeight != null">TOTAL_WEIGHT = #{totalWeight},</if>
+            <if test="balanceTime != null">BALANCE_TIME = #{balanceTime},</if>
+            <if test="batchBalanceTimeLower != null">BATCH_BALANCE_TIME_LOWER = #{batchBalanceTimeLower},</if>
+            <if test="lowerDifference != null">LOWER_DIFFERENCE = #{lowerDifference},</if>
+            <if test="batchBalanceTimeUpper != null">BATCH_BALANCE_TIME_UPPER = #{batchBalanceTimeUpper},</if>
+            <if test="upperDifference != null">UPPER_DIFFERENCE = #{upperDifference},</if>
+            <if test="silkCarId != null">SILK_CAR_ID = #{silkCarId},</if>
+            <if test="locationIndex != null">LOCATION_INDEX = #{locationIndex},</if>
+            <if test="locationStatusCode != null">LOCATION_STATUS_CODE = #{locationStatusCode},</if>
+        </trim>
+        where GYKC_ID = #{gykcId}
+    </update>
+
+    <delete id="deleteLeanGykcByGykcId" parameterType="Long">
+        delete
+        from LEAN_GYKC
+        where GYKC_ID = #{gykcId}
+    </delete>
+
+    <delete id="deleteLeanGykcByGykcIds" parameterType="String">
+        delete from LEAN_GYKC where GYKC_ID in
+        <foreach item="gykcId" collection="array" open="(" separator="," close=")">
+            #{gykcId}
+        </foreach>
+    </delete>
+</mapper>

+ 6 - 6
jjt-biz/src/main/resources/mapper/lean/LeanQhMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.lean.mapper.LeanQhMapper">
-    
+
     <resultMap type="LeanQh" id="LeanQhResult">
         <result property="qhId"    column="QH_ID"    />
         <result property="qhTime"    column="QH_TIME"    />
@@ -18,14 +18,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectLeanQhList" parameterType="LeanQh" resultMap="LeanQhResult">
         <include refid="selectLeanQhVo"/>
-        <where>  
-            <if test="qhTime != null "> and QH_TIME = #{qhTime}</if>
+        <where>
+            <if test="qhTime != null "> and YEAR(QH_TIME) = YEAR(#{qhTime})</if>
             <if test="qhType != null  and qhType != ''"> and QH_TYPE = #{qhType}</if>
             <if test="qhClass != null  and qhClass != ''"> and QH_CLASS = #{qhClass}</if>
             <if test="price != null "> and PRICE = #{price}</if>
         </where>
     </select>
-    
+
     <select id="selectLeanQhByQhId" parameterType="Long" resultMap="LeanQhResult">
         <include refid="selectLeanQhVo"/>
         where QH_ID = #{qhId}
@@ -63,9 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteLeanQhByQhIds" parameterType="String">
-        delete from LEAN_QH where QH_ID in 
+        delete from LEAN_QH where QH_ID in
         <foreach item="qhId" collection="array" open="(" separator="," close=")">
             #{qhId}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 23 - 20
jjt-biz/src/main/resources/mapper/lean/LeanXhMapper.xml

@@ -1,31 +1,32 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.jjt.lean.mapper.LeanXhMapper">
-    
+
     <resultMap type="LeanXh" id="LeanXhResult">
-        <result property="xhId"    column="XH_ID"    />
-        <result property="xhTime"    column="XH_TIME"    />
-        <result property="xhType"    column="XH_TYPE"    />
-        <result property="xhClass"    column="XH_CLASS"    />
-        <result property="price"    column="PRICE"    />
+        <result property="xhId" column="XH_ID"/>
+        <result property="xhTime" column="XH_TIME"/>
+        <result property="xhType" column="XH_TYPE"/>
+        <result property="xhClass" column="XH_CLASS"/>
+        <result property="price" column="PRICE"/>
     </resultMap>
 
     <sql id="selectLeanXhVo">
-        select XH_ID, XH_TIME, XH_TYPE, XH_CLASS, PRICE from LEAN_XH
+        select XH_ID, XH_TIME, XH_TYPE, XH_CLASS, PRICE
+        from LEAN_XH
     </sql>
 
     <select id="selectLeanXhList" parameterType="LeanXh" resultMap="LeanXhResult">
         <include refid="selectLeanXhVo"/>
-        <where>  
-            <if test="xhTime != null "> and XH_TIME = #{xhTime}</if>
-            <if test="xhType != null  and xhType != ''"> and XH_TYPE = #{xhType}</if>
-            <if test="xhClass != null  and xhClass != ''"> and XH_CLASS = #{xhClass}</if>
-            <if test="price != null "> and PRICE = #{price}</if>
+        <where>
+            <if test="xhTime != null ">and YEAR(XH_TIME) = YEAR(#{xhTime})</if>
+            <if test="xhType != null  and xhType != ''">and XH_TYPE = #{xhType}</if>
+            <if test="xhClass != null  and xhClass != ''">and XH_CLASS = #{xhClass}</if>
+            <if test="price != null ">and PRICE = #{price}</if>
         </where>
     </select>
-    
+
     <select id="selectLeanXhByXhId" parameterType="Long" resultMap="LeanXhResult">
         <include refid="selectLeanXhVo"/>
         where XH_ID = #{xhId}
@@ -38,13 +39,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="xhType != null">XH_TYPE,</if>
             <if test="xhClass != null">XH_CLASS,</if>
             <if test="price != null">PRICE,</if>
-         </trim>
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="xhTime != null">#{xhTime},</if>
             <if test="xhType != null">#{xhType},</if>
             <if test="xhClass != null">#{xhClass},</if>
             <if test="price != null">#{price},</if>
-         </trim>
+        </trim>
     </insert>
 
     <update id="updateLeanXh" parameterType="LeanXh">
@@ -59,13 +60,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteLeanXhByXhId" parameterType="Long">
-        delete from LEAN_XH where XH_ID = #{xhId}
+        delete
+        from LEAN_XH
+        where XH_ID = #{xhId}
     </delete>
 
     <delete id="deleteLeanXhByXhIds" parameterType="String">
-        delete from LEAN_XH where XH_ID in 
+        delete from LEAN_XH where XH_ID in
         <foreach item="xhId" collection="array" open="(" separator="," close=")">
             #{xhId}
         </foreach>
     </delete>
-</mapper>
+</mapper>