From d5d0d1c7a84b996b9bbcebfaf2c2c95f1a5a3678 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期五, 11 十月 2024 08:39:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java |   78 +++++++++++++++++++++++++++++++++++----
 1 files changed, 70 insertions(+), 8 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
index 8335a7e..3b73c7e 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
@@ -1,13 +1,24 @@
 package com.mes.bigstorage.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.mes.bigstorage.entity.BigStorageCageDetails;
 import com.mes.bigstorage.service.BigStorageCageDetailsService;
 import com.mes.bigstorage.service.BigStorageCageService;
+import com.mes.common.config.Const;
+import com.mes.common.utils.RedisUtil;
 import com.mes.utils.Result;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.util.List;
 import java.util.Map;
 
@@ -28,6 +39,8 @@
     private BigStorageCageDetailsService bigStorageCageDetailsService;
     @Autowired
     private BigStorageCageService bigStorageCageService;
+    @Resource
+    private RedisUtil redisUtil;
 
 
     @ApiOperation("鐜荤拑璇︽儏鏌ヨ")
@@ -78,19 +91,68 @@
 
     @ApiOperation("鎸囧畾閽㈠寲")
     @PostMapping("/TemperingGlass")
-    public Result TemperingGlass(@RequestBody String temperingLayoutId,@RequestBody String engineerId) {
-        boolean result=bigStorageCageDetailsService.TemperingGlass(temperingLayoutId,engineerId);
-        if(result==true){
-            return Result.build(200,"鎸囧畾閽㈠寲鎴愬姛",1);
-        }else {
-            return Result.build(200, "宸插瓨鍦ㄩ挗鍖栦换鍔�", 1);
+    public Result temperingGlass(@RequestBody BigStorageCageDetails bigStorageCageDetails) {
+        boolean result = bigStorageCageDetailsService.temperingGlass(bigStorageCageDetails.getTemperingLayoutId().toString(), bigStorageCageDetails.getEngineerId());
+        if (result == true) {
+            return Result.build(200, "鎸囧畾閽㈠寲鎴愬姛", 1);
+        } else {
+            return Result.build(200, "宸插瓨鍦ㄩ挗鍖栦换鍔★紝璇风瓑寰呴挗鍖栧畬鎴愬啀鎸囧畾閽㈠寲", 1);
         }
     }
 
     @ApiOperation("閽㈠寲鏌ヨ")
     @PostMapping("/selectTemperingGlass")
     public Result selectTemperingGlass() {
-        return Result.build(200,"鏌ヨ鎴愬姛",bigStorageCageDetailsService.selectTemperingGlass());
+        return Result.build(200, "鏌ヨ鎴愬姛", bigStorageCageDetailsService.selectTemperingGlass());
     }
+
+    @ApiOperation("鏄惁閽㈠寲寮�鍏�")
+    @PostMapping("/temperingSwitch")
+    public Result temperingSwitch(Boolean flag) {
+        bigStorageCageDetailsService.temperingSwitch(flag);
+        return Result.build(200, "淇敼鎴愬姛", redisUtil.getCacheObject("temperingSwitch"));
+    }
+
+    @ApiOperation("娴佺▼鍗℃煡璇�")
+    @PostMapping("/selectFlowCardByCache")
+    public Result selectFlowCardByCache() {
+        List<Map<String, Object>> flowCardIdCount=bigStorageCageDetailsService.listMaps(
+                new QueryWrapper<BigStorageCageDetails>()
+                        .select("flow_card_id,layer,count(*) as count")
+                        .eq("state", Const.GLASS_STATE_IN)
+                        .eq("tempering_layout_id",0)
+                        .groupBy("flow_card_id,layer")
+        );
+        return Result.build(200, "鏌ヨ鎴愬姛", flowCardIdCount);
+    }
+
+    @ApiOperation("鎸囧畾娴佺▼鍗�")
+    @PostMapping("/appointFlowCard")
+    public Result appointFlowCard(@RequestBody BigStorageCageDetails bigStorageCageDetails) {
+        List<BigStorageCageDetails> bigStorageCageDetailsList=bigStorageCageDetailsService.list(
+                new LambdaQueryWrapper<BigStorageCageDetails>()
+                .eq(BigStorageCageDetails::getState,Const.GLASS_STATE_ARTIFICIAL)
+        );
+        if(bigStorageCageDetailsList.size()==0){
+            bigStorageCageDetailsService.update(
+                    new LambdaUpdateWrapper<BigStorageCageDetails>()
+                            .set(BigStorageCageDetails::getState,Const.GLASS_STATE_ARTIFICIAL)
+                            .eq(BigStorageCageDetails::getFlowCardId,bigStorageCageDetails.getFlowCardId())
+                            .eq(BigStorageCageDetails::getLayer,bigStorageCageDetails.getLayer())
+                            .eq(BigStorageCageDetails::getState,Const.GLASS_STATE_IN)
+            );
+            return Result.build(200, "鎸囧畾娴佺▼鍗℃垚鍔�", 1);
+        }else{
+            return Result.build(200, "鎸囧畾娴佺▼鍗℃垚鍔�", 1);
+        }
+    }
+
+    @ApiOperation("鎸囧畾宸ョ▼")
+    @PostMapping("/appointEngineerId")
+    public Result appointEngineerId(@RequestBody BigStorageCageDetails bigStorageCageDetails) {
+        bigStorageCageDetailsService.appointEngineerId(bigStorageCageDetails.getEngineerId());
+        return Result.build(200, "淇敼鎴愬姛", 1);
+    }
+
 }
 

--
Gitblit v1.8.0