From df4da61f98f4d81f84e2975313b2528e978123cf Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期四, 11 七月 2024 14:22:02 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java          |    9 +
 /dev/null                                                                                                                            |  311 --------------------------------------
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java |   33 ++-
 UI-Project/src/assets/ypccche.png                                                                                                    |    0 
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java    |  108 ++++---------
 UI-Project/src/assets/ypcc.png                                                                                                       |    0 
 6 files changed, 67 insertions(+), 394 deletions(-)

diff --git a/UI-Project/src/assets/ypcc.png b/UI-Project/src/assets/ypcc.png
new file mode 100644
index 0000000..fdca249
--- /dev/null
+++ b/UI-Project/src/assets/ypcc.png
Binary files differ
diff --git a/UI-Project/src/assets/ypccche.png b/UI-Project/src/assets/ypccche.png
new file mode 100644
index 0000000..96f75d0
--- /dev/null
+++ b/UI-Project/src/assets/ypccche.png
Binary files differ
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
index ddf347d..2c15c6c 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -5,20 +5,18 @@
 import com.mes.downworkstation.entity.request.DownWorkRequest;
 import com.mes.downworkstation.service.DownWorkstationService;
 import com.mes.glassinfo.service.GlassInfoService;
+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.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 /**
  * <p>
- *  鍓嶇鎺у埗鍣�
+ * 鍓嶇鎺у埗鍣�
  * </p>
  *
  * @author zhoush
@@ -34,43 +32,30 @@
     private DownWorkstationService downWorkstationService;
     @Autowired
     private GlassInfoService glassInfoService;
+
     @ApiOperation("鑾峰彇宸ヤ綅淇℃伅")
     @GetMapping("/getone")
-    public ResponseEntity<?> getOneDownWorkstations() {
+    public Result getOneDownWorkstations() {
         try {
-            List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,6);
+            List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1, 6);
             // 鏋勫缓绗﹀悎棰勬湡鏍煎紡鐨勫搷搴旀暟鎹�
-            Map<String, Object> responseData = new HashMap<>();
-            responseData.put("code", 200);
-            responseData.put("msg", "鎴愬姛");
-            responseData.put("data", data);
-            // 杩斿洖 ResponseEntity 瀵硅薄锛屽寘鍚搷搴旀暟鎹拰鐘舵�佺爜
-            return ResponseEntity.ok(responseData);
+            return Result.build(200, "鑾峰彇宸ヤ綅淇℃伅鎴愬姛", data);
         } catch (Exception e) {
             e.printStackTrace();
             // 濡傛灉鍑虹幇寮傚父锛岃繑鍥為敊璇俊鎭�
-            Map<String, Object> errorResponse = new HashMap<>();
-            errorResponse.put("code", 500);
-            errorResponse.put("msg", "鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�");
-            return ResponseEntity.status(500).body(errorResponse);
+            return Result.build(500, "鑾峰彇宸ヤ綅淇℃伅澶辫触", 1);
         }
     }
 
     @ApiOperation("鑾峰彇娴佺▼鍗″彿")
     @GetMapping("/getflowCardId")
-    public ResponseEntity<Map<String, Object>> getflowCardId() {
-        Map<String, Object> responseData = new HashMap<>();
+    public Result getflowCardId() {
+
         try {
             List<Map<String, Object>> data = glassInfoService.getFlowCardId();
-            responseData.put("code", 200);
-            responseData.put("msg", "鎴愬姛");
-            responseData.put("data", data);
-            return ResponseEntity.ok(responseData);
+            return Result.build(200, "鑾峰彇娴佺▼鍗″彿鎴愬姛", data);
         } catch (Exception e) {
-            responseData.put("code", 500);
-            responseData.put("msg", "澶辫触");
-            responseData.put("data", null);
-            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData);
+            return Result.build(500, "鑾峰彇娴佺▼鍗″彿澶辫触", 1);
         }
     }
 
@@ -78,22 +63,17 @@
     //缁戝畾鏋跺瓙
     @ApiOperation("缁戝畾鏋跺瓙")
     @PostMapping("/updateFlowCardId")
-    public ResponseEntity<Map<String, Object>> updateFlowCardId(@RequestBody DownWorkRequest request) {
+    public Result updateFlowCardId(@RequestBody DownWorkRequest request) {
 
         // 缁戝畾鏋跺瓙
-        downWorkstationService.updateFlowCardIdAndCount(request.getFlowCardId(),  request.getWorkstationId(), request.getLayer());
+        downWorkstationService.updateFlowCardIdAndCount(request.getFlowCardId(), request.getWorkstationId(), request.getLayer());
 
-        // 鏋勫缓鍝嶅簲鏁版嵁
-        Map<String, Object> responseData = new HashMap<>();
-        responseData.put("message", "updated successfully");
-        responseData.put("code", 200);
-        // 杩斿洖澶勭悊缁撴灉
-        return ResponseEntity.ok(responseData);
+        return Result.build(200, "缁戝畾鏋跺瓙鎴愬姛", 1);
     }
 
     @ApiOperation("娓呴櫎宸ヤ綅淇℃伅")
     @PostMapping("/clear")
-    public ResponseEntity<Map<String, Object>> clearWorkstationInfo(@RequestBody Map<String, Object> requestData) {
+    public Result clearWorkstationInfo(@RequestBody Map<String, Object> requestData) {
         // 璋冪敤 DownWorkstationService 涓殑鏂规硶娓呴櫎鎸囧畾宸ヤ綅ID鐨勪俊鎭�
         int workstationId = (int) requestData.get("workstationId");
 
@@ -103,18 +83,10 @@
 
         if (downWorkstations == totalWorkstations) {
             downWorkstationService.clearFlowCardId(workstationId);
-            Map<String, Object> responseData = new HashMap<>();
-            responseData.put("message", "cleared successfully");
-            responseData.put("code", 200);
-            // 杩斿洖澶勭悊缁撴灉
-            return ResponseEntity.ok(responseData);
-        }
-        else {
+            return Result.build(200, "娓呴櫎宸ヤ綅淇℃伅鎴愬姛", 1);
+        } else {
             // 濡傛灉鎬绘暟閲忓拰钀芥灦鏁伴噺涓嶄竴鑷达紝杩斿洖閿欒鍝嶅簲
-            Map<String, Object> errorResponse = new HashMap<>();
-            errorResponse.put("message", "Total workstations count does not match down workstations count.");
-            errorResponse.put("code", 400);
-            return ResponseEntity.badRequest().body(errorResponse);
+            return Result.build(500, "娓呴櫎宸ヤ綅淇℃伅澶辫触", 1);
         }
 
 
@@ -123,46 +95,38 @@
     }
 
 
-
-
     @ApiOperation("鑾峰彇宸ヤ綅鏄剧ず鍥�1")
     @GetMapping("/getwo")
-    public ResponseEntity<Map<String, Object>> getwo() {
-        Map<String, Object> responseData = new HashMap<>();
+    public Result getwo() {
+
         try {
-            List<Map<String, Object>> data = downWorkstationService.getTotalGlassDimensionsByWorkstation(1,3);
-            responseData.put("code", 200);
-            responseData.put("msg", "鎴愬姛");
-            responseData.put("data", data);
-            return ResponseEntity.ok(responseData);
+            List<Map<String, Object>> data = downWorkstationService.getTotalGlassDimensionsByWorkstation(1, 3);
+            return Result.build(200, "鑾峰彇宸ヤ綅鏄剧ず鍥�1鎴愬姛", data);
         } catch (Exception e) {
-            responseData.put("code", 500);
-            responseData.put("msg", "澶辫触");
-            responseData.put("data", null);
-            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData);
+            return Result.build(200, "鑾峰彇宸ヤ綅鏄剧ず鍥�1澶辫触", 1);
         }
     }
 
     @ApiOperation("鑾峰彇宸ヤ綅鏄剧ず鍥�2")
     @GetMapping("/getwo2")
-    public ResponseEntity<Map<String, Object>> getw2o() {
-        Map<String, Object> responseData = new HashMap<>();
+    public Result getwo2() {
+
         try {
-            List<Map<String, Object>> data = downWorkstationService.getTotalGlassDimensionsByWorkstation(4,6);
-            responseData.put("code", 200);
-            responseData.put("msg", "鎴愬姛");
-            responseData.put("data", data);
-            return ResponseEntity.ok(responseData);
+            List<Map<String, Object>> data = downWorkstationService.getTotalGlassDimensionsByWorkstation(4, 6);
+            return Result.build(200, "鑾峰彇宸ヤ綅鏄剧ず鍥�2鎴愬姛", data);
         } catch (Exception e) {
-            responseData.put("code", 500);
-            responseData.put("msg", "澶辫触");
-            responseData.put("data", null);
-            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData);
+            return Result.build(200, "鑾峰彇宸ヤ綅鏄剧ず鍥�2澶辫触", 1);
+
         }
     }
 
-
-
+    @ApiOperation("  鍔熻兘锛氬宸ヤ綅杩涜銆愬惎鐢�/绂佺敤銆�")
+    @PostMapping("/updateDownWorkstation")
+    @ResponseBody
+    public Result updateDownWorkstation(@RequestBody DownWorkstation downWorkstation) {
+        boolean isSucess = downWorkstationService.updateDownWorkstationstate(downWorkstation);
+        return Result.build(200, "鏇存崲鎴愬姛", isSucess);
+    }
 
 
 }
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
index 8c133f2..a101328 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
@@ -53,7 +53,7 @@
      * @param workstationId
      * @return 鏇存柊鏋跺瓙鍜屾暟閲�
      */
-    int updateFlowCardIdAndCount(String flowCardId, int workstationId,int layer);
+    void updateFlowCardIdAndCount(String flowCardId, int workstationId,int layer);
 
 
 
@@ -70,4 +70,11 @@
      * @return
      */
     DownWorkstation selectByFlowCardId(String flowcardid);
+
+
+    /**
+     * @param downWorkstation
+     * @returnq 鍚敤绂佺敤
+     */
+    boolean updateDownWorkstationstate(DownWorkstation downWorkstation);
 }
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
index 56a0fdd..3d8482d 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -10,6 +10,7 @@
 import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
 import com.mes.downglassinfo.service.DownGlassInfoService;
 import com.mes.downglassinfo.service.DownGlassTaskService;
+import com.mes.downstorage.entity.DownStorageCage;
 import com.mes.downworkstation.entity.DownWorkstation;
 import com.mes.downworkstation.entity.DownWorkstationTask;
 import com.mes.downworkstation.entity.DownWorkstionAndDownGlassinfo;
@@ -34,7 +35,7 @@
 
     @Autowired
     private DownWorkstationMapper downWorkstationMapper;
-    @Autowired(required = false)
+    @Autowired(required=false)
     private DownWorkstationTaskMapper downWorkstationTaskMapper;
     @Autowired
     private DownGlassInfoService downGlassInfoService;
@@ -67,7 +68,7 @@
 
     //宸ヤ綅鏄剧ず
     @Override
-    public List<Map<String, Object>> getTotalGlassDimensionsByWorkstation(int start, int end) {
+    public List<Map<String, Object>> getTotalGlassDimensionsByWorkstation(int start,int end) {
         MPJQueryWrapper<DownWorkstation> queryWrapper = new MPJQueryWrapper<>();
         queryWrapper.select("t.workstation_id", "t.flow_card_id", "COALESCE(SUM(b.width), 0) AS totalwidth", "COALESCE(SUM(b.height), 0) AS totalheight")
                 .leftJoin("down_glass_info b on t.flow_card_id = b.flow_card_id")
@@ -76,8 +77,8 @@
 
         ;
 
-        List<DownWorkstionAndDownGlassinfo> workstationList = downWorkstationMapper.selectJoinList(DownWorkstionAndDownGlassinfo.class, queryWrapper);
-        // List<DownWorkstionAndDownGlassinfo> workstationList = null;
+    List<DownWorkstionAndDownGlassinfo> workstationList = downWorkstationMapper.selectJoinList(DownWorkstionAndDownGlassinfo.class, queryWrapper);
+       // List<DownWorkstionAndDownGlassinfo> workstationList = null;
         List<Map<String, Object>> result = new ArrayList<>();
         for (DownWorkstionAndDownGlassinfo downWorkstionAndDownGlassinfo : workstationList) {
             Map<String, Object> rack = new HashMap<>();
@@ -94,7 +95,7 @@
             List<DownGlassInfo> downGlassInfoList = downGlassInfoMapper.selectList(glassInfoQueryWrapper);
 
 
-            if (!downGlassInfoList.isEmpty()) {
+         if (!downGlassInfoList.isEmpty()) {
 
                 item.put("downGlassInfoList", downGlassInfoList);
 
@@ -103,7 +104,7 @@
             rack.put("item", item);
             result.add(rack);
         }
-        log.info("result" + (result));
+        log.info("result"+(result));
         return result; // 杩斿洖鏈�缁堢粨鏋�
     }
 
@@ -141,21 +142,22 @@
 
 
     @Override
-    public int updateFlowCardIdAndCount(String flowCardId, int workstationId, int layer) {
-        int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId, layer);
+    public void updateFlowCardIdAndCount(String flowCardId,  int workstationId,int layer) {
+        int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId,layer);
         QueryWrapper<Damage> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("process_id", flowCardId);
         queryWrapper.eq("technology_number", layer);
 
-        int otherNumber = damageservice.count(queryWrapper);
+       int otherNumber=damageservice.count(queryWrapper);
         UpdateWrapper<DownWorkstation> updateWrapper = new UpdateWrapper<>();
         updateWrapper.set("total_quantity", glassInfoCount)
                 .set("flow_card_id", flowCardId)
                 .set("layer", layer)
                 .set("other_number", otherNumber)
                 .eq("workstation_id", workstationId);
+
         this.update(updateWrapper);
-        return 1;
+
     }
 
     @Override
@@ -168,6 +170,9 @@
 
         baseMapper.update(new DownWorkstation(), updateWrapper);
     }
+
+
+
 
 
     @Override
@@ -190,4 +195,12 @@
     }
 
 
+    @Override
+    public boolean updateDownWorkstationstate(DownWorkstation downWorkstation) {
+        DownWorkstation downWork = baseMapper.selectById(downWorkstation.getId());
+        downWork.setEnableState(downWorkstation.getEnableState());
+        baseMapper.updateById(downWork);
+        return true;
+    }
+
 }
diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
deleted file mode 100644
index 14e96bf..0000000
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownCacheGlassTask.java
+++ /dev/null
@@ -1,311 +0,0 @@
-package com.mes.job;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.mes.common.config.Const;
-import com.mes.downglassinfo.entity.DownGlassInfo;
-import com.mes.downglassinfo.entity.DownGlassTask;
-import com.mes.downglassinfo.service.DownGlassInfoService;
-import com.mes.downglassinfo.service.DownGlassTaskService;
-import com.mes.downstorage.entity.DownStorageCageDetails;
-import com.mes.downstorage.service.DownStorageCageDetailsService;
-import com.mes.downstorage.service.DownStorageCageService;
-import com.mes.downworkstation.entity.DownWorkstation;
-import com.mes.downworkstation.service.DownWorkstationService;
-import com.mes.downworkstation.service.DownWorkstationTaskService;
-import com.mes.glassinfo.entity.GlassInfo;
-import com.mes.glassinfo.service.GlassInfoService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * @Author : zhoush
- * @Date: 2024/5/8 8:17
- * @Description:
- */
-@Component
-@Slf4j
-public class DownCacheGlassTask {
-
-
-    @Autowired
-    DownGlassTaskService downGlassTaskService;
-    @Autowired
-    GlassInfoService glassInfoService;
-    @Autowired
-    DownStorageCageDetailsService downStorageCageDetailsService;
-    @Autowired
-    DownStorageCageService downStorageCageService;
-    @Autowired
-    DownWorkstationService downWorkstationService;
-    @Autowired
-    DownGlassInfoService downGlassInfoService;
-
-
-    @Autowired
-    private DownWorkstationTaskService downWorkstationTaskService;
-
-    //    @Value("${mes.threshold}")
-    private int threshold;
-
-//    @Scheduled(fixedDelay = 1000)
-    public void autoBindRack() {
-        log.info("鏍规嵁缂撳瓨涓凡缁忚繘鐗囩殑鐜荤拑绉嶆暟閲忔渶澶氱殑娴佺▼鍗″彿鑷姩缁戝畾涓�涓惎鐢ㄧ姸鎬佺殑绌烘灦瀛�");
-
-        List<DownStorageCageDetails> Details = downStorageCageService.selectCacheMax();
-        if (Details.size() > 0) {
-            DownStorageCageDetails downStorageCageDetails = Details.get(0);
-            String flowCardId = downStorageCageDetails.getFlowCardId();
-            int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId,1);
-            DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, null));
-            List<DownWorkstation> downWorkstations = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>()
-                    .eq(DownWorkstation::getEnableState, 1));
-
-            if (!downWorkstations.stream().anyMatch(workstation -> workstation.getFlowCardId().equals(flowCardId))) {
-                downWorkstationService.updateFlowCardIdAndCount(flowCardId, glassInfoCount, downWorkstation.getWorkstationId());
-            }
-
-
-        }
-    }
-
-
-    // @Scheduled(fixedDelay = 1000)
-    public void plcdownGlassTask() {
-        //   PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject;
-//        String taskRequestTypeValue = plcParameterObject.getPlcParameter("A06_request_word").getValue();
-//        String glassIdeValue = plcParameterObject.getPlcParameter("A05_scanning_ID").getValue();
-//        String confirmationWrodValue = plcParameterObject.getPlcParameter("MES_confirmation_word").getValue();
-//        String outGlassstate = plcParameterObject.getPlcParameter("A09_glass_status").getValue();
-//        String MESSendingWord = plcParameterObject.getPlcParameter("MES_confirmation_word").getAddress();
-        // String G06RobotTaskRequestWord = plcParameterObject.getPlcParameter("G06RobotTaskRequestWord").getAddress();
-
-
-        String taskRequestTypeValue = "0";
-        String glassIdeValue = "NG24041101C002-2-6-1-6";
-        String confirmationWrodValue = "1";
-        String outGlassstate = "1";
-        String MESSendingWord = "1";
-        String G11RobotTaskRequestWord = "0";
-        String G06RobotTaskRequestWord = "0";
-        String G13RobotTaskRequestWord = "0";
-
-        log.info("1銆佽幏鍙栧埌鐨勮姹傚瓧涓猴細{}锛岃幏鍙栧埌鐨勬壂鎻廔D涓猴細{}锛岃幏鍙栧埌鐨勭‘璁ゅ瓧涓猴細{}锛岃幏鍙栧埌鐨勫嚭鐗囩姸鎬佷负锛歿}",
-                taskRequestTypeValue, glassIdeValue, confirmationWrodValue, outGlassstate);
-
-//        if ("0".equals(taskRequestTypeValue)) {
-//            if ("0".equals(confirmationWrodValue)) {
-//                log.info("2銆佽幏鍙栧埌鐨勮姹傚瓧涓�0锛屼笖纭瀛椾负0锛屼笉鎵ц浠诲姟");
-//                return;
-//            }
-//            log.info("2銆佽幏鍙栧埌鐨勮姹傚瓧涓�0锛屽皢纭瀛楁敼涓�0");
-//            S7object.getinstance().plccontrol.WriteWord(MESSendingWord, 0);
-//            return;
-//        }
-//        if (!"0".equals(confirmationWrodValue)) {
-//            log.info("2銆佽幏鍙栧埌鐨勮姹傚瓧涓嶄负0锛屽皢纭瀛楁敼涓�0");
-//            S7object.getinstance().plccontrol.WriteWord(MESSendingWord, 0);
-//            return;
-//        }
-
-        if ("1".equals(taskRequestTypeValue)) {
-            log.info("3銆佽繘鐗囪姹傦紝涓旂‘璁ゅ瓧涓�0锛屾墽琛岃繘鐗囦换鍔�");
-            inTo(glassIdeValue, MESSendingWord);
-        } else if ("2".equals(taskRequestTypeValue)) {
-
-            log.info("3銆佸嚭鐗囪姹傦紝涓旂‘璁ゅ瓧涓�0锛屾墽琛岃繘鐗囦换鍔�");
-            outTo(MESSendingWord);
-
-        } else if ("3".equals(taskRequestTypeValue)) {
-            log.info("3銆佽繘鐗囧拰鍑虹墖閮界┖闂诧紝鎵ц鍑虹墖浠诲姟");
-            if (outTo(MESSendingWord)) {
-                inTo(glassIdeValue, MESSendingWord);
-
-
-            }
-        }
-
-        if (("0".equals(G11RobotTaskRequestWord) || "0".equals(G06RobotTaskRequestWord)) || "0".equals(G13RobotTaskRequestWord)) {
-            log.info("4銆佹湁涓嬬墖瀹屾垚淇″彿鏇存柊钀芥灦鏁伴噺");
-            insertdownglassinfo();
-        }
-
-
-    }
-
-    /**
-     * 杩涚墖浠诲姟
-     *
-     * @param glassId
-     * @param MESSendingWord
-     * @param
-     */
-    private void inTo(String glassId, String MESSendingWord) {
-        log.info("1銆佹寜鐓х幓鐠僫d:{}鑾峰彇鐜荤拑灏忕墖淇℃伅", glassId);
-        GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
-        if (glassInfo == null) {
-            log.info("2銆佹鐜荤拑缂栧彿涓嶅瓨鍦�");
-            return;
-        }
-        log.info("2銆佽幏鍙栧埌鐨勭幓鐠冧俊鎭负{}", glassInfo);
-
-        if (downStorageCageDetailsService.DirectConnection(glassInfo)) {
-            //鐩撮��
-            //log.info("3銆佸鏋滃綋鍓嶇幓鐠冨睘浜庣増鍥緄d鍜岀墖搴忕殑椤哄簭鍒欑洿閫氾紝鎵ц涓嬬墖浠诲姟");
-            log.info("3銆佸鏋滃綋鍓嶇幓鐠冨睘浜庢祦绋嬪崱涓殑鐗囧簭鐨勯『搴忓垯鐩撮�氾紝鎵ц涓嬬墖浠诲姟");
-            DownWorkstation downWorkstation = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>().eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId()));
-            int WorkstationId = downWorkstation.getWorkstationId();
-            DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, 0, WorkstationId, 3);
-            downGlassTaskService.insertCacheTask(downGlassTask);
-
-        } else {
-
-            // log.info("4銆佸鏋滀笉灞炰簬鐗堝浘id鍜岀墖搴忕殑椤哄簭鎵ц杩涚墖浠诲姟");
-            log.info("4銆佸鏋滀笉灞炰簬娴佺▼鍗′腑鐨勭墖搴忕殑椤哄簭鎵ц杩涚墖浠诲姟");
-
-            //娣诲姞杩涚墖浠诲姟  鏌ユ壘绌烘牸
-            List<DownStorageCageDetails> list = downStorageCageService.selectCacheEmpty();
-            if (list.size() > 0) {
-                DownStorageCageDetails item = list.get(0);
-
-
-                log.info("5銆佹煡璇㈠崸寮忕悊鐗囩閲岄潰鐨勭┖鏍�:{}", list);
-                log.info("6銆佸皢鐜荤拑淇℃伅鎻掑叆鍗у紡鐞嗙墖绗�,褰撳墠鐜荤拑淇℃伅:{}", glassInfo);
-                DownStorageCageDetails details = new DownStorageCageDetails();
-                BeanUtils.copyProperties(glassInfo, details);
-                details.setState(Const.GLASS_STATE_IN);
-                details.setGlassId(glassInfo.getGlassId());
-                details.setSlot(item.getSlot());
-                details.setDeviceId(item.getDeviceId());
-                downStorageCageDetailsService.save(details);
-                log.info("7銆佺幓鐠冧俊鎭凡瀛樺叆鐞嗙墖绗艰鎯呰〃锛岀幓鐠冧俊鎭负{}", details);
-
-                DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(glassInfo, 0, item.getSlot(), 1);
-                //娣诲姞杩涚墖浠诲姟
-                log.info("8銆佺敓鎴愯繘鐗囦换鍔′俊鎭瓨鍏ヤ换鍔¤〃{}", downGlassTask);
-                downGlassTaskService.insertCacheTask(downGlassTask);
-            }
-
-
-        }
-        log.info("9銆佸彂閫佺‘璁ゅ瓧瀹屾垚");
-        //S7object.getinstance().plccontrol.WriteWord(MESSendingWord, 1);
-    }
-
-    /**
-     * 鍑虹墖浠诲姟
-     *
-     * @param MESSendingWord
-     */
-    private Boolean outTo(String MESSendingWord) {
-        // log.info("鍗曠墖鎯呭喌鏍规嵁浼犲叆鐨勬枡鏋跺彿 鏌ヨ绗﹀悎鎸夌収鐗堝浘id鍜岀墖搴忓嚭鐗�,骞朵笖浼樺厛鍑烘弧鏋剁殑灏忕墖");
-        log.info("鍗曠墖鎯呭喌鏍规嵁浼犲叆鐨勬枡鏋跺彿 鏌ヨ绗﹀悎鎸夌収娴佺▼鍗′腑椤哄簭鍑虹墖,骞朵笖浼樺厛鍑烘弧鏋剁殑灏忕墖");
-
-//        List<DownStorageCageDetails> list1to3 = downStorageCageDetailsService.CacheOut1(1, 3);
-//        List<DownStorageCageDetails> list4to6 = downStorageCageDetailsService.CacheOut1(4, 6);
-        List<DownStorageCageDetails> list1to6 = downStorageCageDetailsService.CacheOut2(1, 6);
-
-        DownStorageCageDetails selectedItem = null;
-
-        Integer endCell = null;
-
-        // 浼樺厛 瓒呭嚭灏哄浼樺厛浜哄伐鍑虹墖 浜哄伐澶勭悊
-        if (!list1to6.isEmpty()) {
-            DownStorageCageDetails item3 = list1to6.get(0);
-            //鍚庢湡鏈夌敓浜ц鍒�
-            if (item3.getHeight() >= 2500 && item3.getWidth() >= 2660) {
-                log.info("浜哄伐澶勭悊");
-                selectedItem = item3;
-
-            } else if (!!list1to6.isEmpty()) {
-                log.info("鍓嶅悗绔兘绌洪棽浼樺厛婊℃灦");
-                selectedItem = list1to6.get(0);
-            }
-        }
-
-        // 鎸夌収鐗堝浘id鍜岀墖搴忕鍚堝墠绔嚭鐗�
-//        if (selectedItem == null && !list1to3.isEmpty()) {
-//            log.info("鍓嶇鍑虹墖");
-//            selectedItem = list1to3.get(0);
-//        }
-//
-//        // 鎸夌収鐗堝浘id鍜岀墖搴忕鍚堝悗绔嚭鐗�
-//        if (selectedItem == null && !list4to6.isEmpty()) {
-//            log.info("鍚庣鍑虹墖");
-//            selectedItem = list4to6.get(0);
-//        }
-
-        if (selectedItem != null) {
-            DownWorkstation downWorkstation = downWorkstationService.getOne(
-                    new LambdaQueryWrapper<DownWorkstation>()
-                            .eq(DownWorkstation::getFlowCardId, selectedItem.getFlowCardId())
-            );
-            endCell = downWorkstation.getWorkstationId();
-            if (endCell == null) {
-                endCell = 7;
-            }
-            DownGlassTask downGlassTask = downStorageCageService.createDownGlassTask(selectedItem, 9, endCell, 2);
-            downGlassTaskService.insertCacheTask(downGlassTask);
-            LambdaQueryWrapper<DownStorageCageDetails> wrapper = new LambdaQueryWrapper<>();
-            wrapper.eq(DownStorageCageDetails::getGlassId, selectedItem.getGlassId());
-            DownStorageCageDetails updateDetail = new DownStorageCageDetails();
-            updateDetail.setState(Const.GLASS_STATE_OUT);
-            downStorageCageDetailsService.update(updateDetail, wrapper);
-            log.info("鏇存柊鍑虹墖鐜荤拑鐨勭姸鎬佷负{}", Const.GLASS_STATE_OUT);
-            // S7object.getinstance().plccontrol.WriteWord(MESSendingWord, 2);
-
-            return true;
-        }
-
-        // 杩斿洖缁撴灉
-        return false;
-    }
-
-
-    //
-    public void insertdownglassinfo() {
-        try {
-
-            List<DownGlassTask> taskdownGlassInf = downGlassTaskService.getUnloadingTaskState();
-            if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) {
-
-                for (DownGlassTask downGlassInfo : taskdownGlassInf) {
-                    // 鍒涘缓鏂扮殑 DownGlassInfo 瀵硅薄骞惰缃浉鍏冲睘鎬�
-                    DownGlassInfo newdownGlassInfo = new DownGlassInfo();
-
-                    Integer maxSequence = downGlassInfoService.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId(), downGlassInfo.getLayer());
-                    // 鍒濆鍖栭『搴忓瓧娈靛��
-                    int sequence = maxSequence != null ? maxSequence + 1 : 1;
-                    BeanUtils.copyProperties(downGlassInfo, newdownGlassInfo);
-                    // 璁剧疆椤哄簭瀛楁鍊�
-                    newdownGlassInfo.setSequence(sequence);
-                    // 鎻掑叆鏁版嵁鍒颁笅鐗囩幓鐠冧俊鎭〃
-                    downGlassInfoService.insertDownGlassInfo(newdownGlassInfo);
-                    log.info("鎻掑叆鏁版嵁鍒颁笅鐗囩幓鐠冧俊鎭〃");
-                    DownWorkstation downWorkstation1 = downWorkstationService.selectByFlowCardId(downGlassInfo.getFlowCardId());
-                    downWorkstationService.updateracksnumber(downGlassInfo.getFlowCardId(), downWorkstation1.getRacksNumber() + 1);
-                    log.info("鏇存柊钀芥灦鏁伴噺");
-//                    LambdaQueryWrapper<DownGlassTask> wrapper = new LambdaQueryWrapper<>();
-//                    wrapper.eq(DownGlassTask::getGlassId, newdownGlassInfo.getGlassId());
-//                    DownGlassTask updateDetail = new DownGlassTask();
-//                    updateDetail.setTaskStauts(2);
-//                    downGlassTaskService.update(updateDetail, wrapper);
-                    sequence++; // 閫掑椤哄簭瀛楁鍊�
-
-
-                }
-            }
-        } catch (Exception e) {
-            // 鎵撳嵃寮傚父淇℃伅
-            e.printStackTrace();
-            // 鎴栬�呭彲浠ヨ繘琛屽叾浠栧紓甯稿鐞嗭紝姣斿璁板綍鏃ュ織鎴栬�呰繑鍥炵壒瀹氱殑閿欒淇℃伅
-        }
-
-
-    }
-
-
-}

--
Gitblit v1.8.0