From 97fd38f691e779bd2c9f4f7e400d0457391522ea Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期六, 02 一月 2021 10:46:15 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java |    4 
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java    |    7 
 src/main/resources/mapper/LocMastMapper.xml                    |    9 
 src/main/webapp/views/console.html                             |  172 ++++++++--------
 src/main/java/com/zy/common/model/LocTypeDto.java              |   52 +++++
 src/main/java/com/zy/core/enums/CrnModeType.java               |    9 
 src/main/java/com/zy/core/properties/SlaveProperties.java      |    6 
 src/main/java/com/zy/core/model/protocol/StaProtocol.java      |   14 +
 src/main/java/com/zy/asrs/controller/ConsoleController.java    |    1 
 src/main/java/com/zy/asrs/utils/Utils.java                     |  140 +++++++++++++
 src/main/java/com/zy/asrs/mapper/LocMastMapper.java            |    2 
 src/main/webapp/static/css/console.css                         |    4 
 src/main/java/com/zy/asrs/service/LocMastService.java          |    2 
 src/main/java/com/zy/common/service/CommonService.java         |  132 +++++++++++--
 src/main/java/com/zy/core/thread/SiemensDevpThread.java        |    9 
 src/main/resources/application.yml                             |    6 
 16 files changed, 436 insertions(+), 133 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/ConsoleController.java b/src/main/java/com/zy/asrs/controller/ConsoleController.java
index ca5b3cb..4349ee5 100644
--- a/src/main/java/com/zy/asrs/controller/ConsoleController.java
+++ b/src/main/java/com/zy/asrs/controller/ConsoleController.java
@@ -100,7 +100,6 @@
             vo.setSiteId(String.valueOf(entry.getKey())); // 绔欑偣缂栧彿
             vo.setWorkNo(staProtocol.getWorkNo()); // 宸ヤ綔鍙�
             vo.setSiteStatus(SiteStatusType.process(staProtocol));  // 鐘舵��
-            vo.setNearbySta(String.valueOf(staProtocol.getPosition())); // 鍙拌溅浣嶇疆
             vos.add(vo);
         }
         return R.ok().add(vos);
diff --git a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
index fb6ed06..c7e3491 100644
--- a/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/LocMastMapper.java
@@ -13,7 +13,7 @@
 @Repository
 public interface LocMastMapper extends BaseMapper<LocMast> {
 
-    LocMast queryFreeLocMast(@Param("row") Integer row);
+    LocMast queryFreeLocMast(@Param("row") Integer row, @Param("locType1") Short locType1);
 
     @Select("select loc_no from asr_loc_mast where 1=1 and loc_sts = 'O' and crn_no = #{crnNo}")
     List<String> queryGroupEmptyStock(Integer crnNo);
diff --git a/src/main/java/com/zy/asrs/service/LocMastService.java b/src/main/java/com/zy/asrs/service/LocMastService.java
index 29dff9a..c1e1346 100644
--- a/src/main/java/com/zy/asrs/service/LocMastService.java
+++ b/src/main/java/com/zy/asrs/service/LocMastService.java
@@ -10,7 +10,7 @@
     /**
      * 妫�绱㈠彲鐢ㄥ簱浣�
      */
-    LocMast queryFreeLocMast(Integer row);
+    LocMast queryFreeLocMast(Integer row, Short locType1);
 
     /**
      * 鑾峰彇鍚岀粍璐ф灦鐨勭┖搴撲綅
diff --git a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
index 7a1e77c..6e39d53 100644
--- a/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/LocMastServiceImpl.java
@@ -13,8 +13,8 @@
 public class LocMastServiceImpl extends ServiceImpl<LocMastMapper, LocMast> implements LocMastService {
 
     @Override
-    public LocMast queryFreeLocMast(Integer row) {
-        return this.baseMapper.queryFreeLocMast(row);
+    public LocMast queryFreeLocMast(Integer row, Short locType1) {
+        return this.baseMapper.queryFreeLocMast(row, locType1);
     }
 
     @Override
diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 79b66f7..bbcdbc3 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -12,6 +12,7 @@
 import com.zy.asrs.mapper.WrkMastMapper;
 import com.zy.asrs.service.*;
 import com.zy.asrs.utils.VersionUtils;
+import com.zy.common.model.LocTypeDto;
 import com.zy.common.model.MatDto;
 import com.zy.common.model.StartupDto;
 import com.zy.common.service.CommonService;
@@ -129,8 +130,9 @@
 
                     try {
                         // 妫�绱㈠簱浣�
+                        LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
                         List<String> matNos = waitPakins.stream().map(WaitPakin::getMatnr).distinct().collect(Collectors.toList());
-                        StartupDto startupDto = commonService.getLocNo(1, 1, inSta.getStaNo(), matNos);
+                        StartupDto startupDto = commonService.getLocNo(1, 1, inSta.getStaNo(), matNos, locTypeDto);
                         // 宸ヤ綔鍙�
                         int workNo = startupDto.getWorkNo();
                         // 鎻掑叆宸ヤ綔鏄庣粏妗�
@@ -848,7 +850,8 @@
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()
                         && staProtocol.isEmptyMk() && staProtocol.getWorkNo() == 0 && staProtocol.isPakMk()) {
                     // 妫�绱㈠簱浣�
-                    StartupDto startupDto = commonService.getLocNo(1, 10, emptyInSta.getStaNo(), null);
+                    LocTypeDto locTypeDto = new LocTypeDto(staProtocol);
+                    StartupDto startupDto = commonService.getLocNo(1, 10, emptyInSta.getStaNo(), null, locTypeDto);
                     // 宸ヤ綔鍙�
                     int workNo = startupDto.getWorkNo();
 
diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 31ebd6a..36a0324 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -1,9 +1,12 @@
 package com.zy.asrs.utils;
 
 import com.core.common.Arith;
+import com.core.common.Cools;
+import com.zy.core.properties.SlaveProperties;
 
-import java.math.BigDecimal;
 import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Created by vincent on 2020/8/27
@@ -33,5 +36,140 @@
         }
     }
 
+    /**
+     * 鍒ゆ柇鏄惁涓烘繁搴撲綅
+     */
+    public static boolean isDeepLoc(SlaveProperties slaveProperties, String locNo){
+        if (slaveProperties.isDoubleDeep()) {
+            int row = getRow(locNo);
+            return slaveProperties.getDoubleLocs().contains(row);
+        } else {
+            return false;
+        }
+    }
 
+    /**
+     * 鍒ゆ柇鏄惁涓烘繁搴撲綅
+     */
+    public static boolean isDeepLoc(SlaveProperties slaveProperties, Integer row){
+        if (slaveProperties.isDoubleDeep()) {
+            return slaveProperties.getDoubleLocs().contains(row);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 鍒ゆ柇鏄惁涓烘祬搴撲綅
+     */
+    public static boolean isShallowLoc(SlaveProperties slaveProperties, String locNo){
+        if (slaveProperties.isDoubleDeep()) {
+            int row = getRow(locNo);
+            return !slaveProperties.getDoubleLocs().contains(row);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 鍒ゆ柇鏄惁涓烘祬搴撲綅
+     */
+    public static boolean isShallowLoc(SlaveProperties slaveProperties, Integer row){
+        if (slaveProperties.isDoubleDeep()) {
+            return !slaveProperties.getDoubleLocs().contains(row);
+        } else {
+            return false;
+        }
+    }
+
+    /**
+     * 鑾峰彇 娣卞簱浣嶅搴旂殑娴呭簱浣嶅彿
+     */
+    public static String getShallowLoc(SlaveProperties slaveProperties, String deepLoc) {
+        int row = getRow(deepLoc);
+        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
+        int shallowRow = remainder == 1 ? (row + 1) : (row - 1);
+        return zerofill(String.valueOf(shallowRow), 2) + deepLoc.substring(2);
+    }
+
+    /**
+     * 鑾峰彇 娣卞簱浣嶆帓瀵瑰簲鐨勬祬搴撲綅鎺�
+     */
+    public static Integer getShallowRow(SlaveProperties slaveProperties, Integer deepRow) {
+        int remainder = (int) Arith.remainder(deepRow, slaveProperties.getGroupCount());
+        return remainder == 1 ? (deepRow + 1) : (deepRow - 1);
+    }
+
+    /**
+     * 鑾峰彇 娴呭簱浣嶅搴旂殑娣卞簱浣嶅彿
+     */
+    public static String getDeepLoc(SlaveProperties slaveProperties, String shallowLoc) {
+        int row = getRow(shallowLoc);
+        int remainder = (int) Arith.remainder(row, slaveProperties.getGroupCount());
+        int targetRow;
+        if (remainder == 2) {
+            targetRow = row - 1;
+        } else if (remainder == 3) {
+            targetRow = row + 1;
+        } else {
+            throw new RuntimeException(shallowLoc + "涓嶆槸娴呭簱浣嶏紝绯荤粺绻佸繖");
+        }
+        return zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
+    }
+
+    /**
+     * 鑾峰彇 娴呭簱浣嶆帓瀵瑰簲鐨勬繁搴撲綅鎺�
+     */
+    public static Integer getDeepRow(SlaveProperties slaveProperties, Integer shallowRow) {
+        int remainder = (int) Arith.remainder(shallowRow, slaveProperties.getGroupCount());
+        int targetRow;
+        if (remainder == 2) {
+            targetRow = shallowRow - 1;
+        } else if (remainder == 3) {
+            targetRow = shallowRow + 1;
+        } else {
+            throw new RuntimeException(shallowRow + "涓嶆槸娴呭簱浣嶆帓锛岀郴缁熺箒蹇�");
+        }
+        return targetRow;
+    }
+
+    /**
+     * 閫氳繃搴撲綅鍙疯幏鍙� 鎺�
+     */
+    public static int getRow(String locNo) {
+        if (!Cools.isEmpty(locNo)) {
+            return Integer.parseInt(locNo.substring(0, 2));
+        }
+        throw new RuntimeException("搴撲綅瑙f瀽寮傚父");
+    }
+
+    /**
+     * 褰撴绱㈠埌鍙屾繁搴撲綅鐨勬祬搴撲綅鏃讹紝濡傛灉娣卞簱浣嶆棤璐э紝鍒欐斁鍏ュ搴旂殑娣卞簱浣�
+     */
+    public static void toDeepIfEmptyByShallow(String shallowLoc) {
+        int row = getRow(shallowLoc);
+        int remainder = (int) Arith.remainder(row, 4);
+        int targetRow = 0;
+        if (remainder == 2) {
+            targetRow = row - 1;
+        } else if (remainder == 3) {
+            targetRow = row + 1;
+        } else {
+            throw new RuntimeException(shallowLoc + "涓嶆槸娴呭簱浣嶏紝绯荤粺绻佸繖");
+        }
+        String targetLoc = zerofill(String.valueOf(targetRow), 2) + shallowLoc.substring(2);
+
+    }
+
+    public static void main(String[] args) {
+        SlaveProperties slaveProperties = new SlaveProperties();
+        slaveProperties.setDoubleDeep(true);
+        List<Integer> list = new ArrayList<>();
+        list.add(1);list.add(4);list.add(5);list.add(8);list.add(9);list.add(12);
+        slaveProperties.setDoubleLocs(list);
+        slaveProperties.setGroupCount(4);
+        Integer deepRow = getDeepRow(slaveProperties, 6);
+        System.out.println(deepRow);
+
+    }
 }
diff --git a/src/main/java/com/zy/common/model/LocTypeDto.java b/src/main/java/com/zy/common/model/LocTypeDto.java
new file mode 100644
index 0000000..ccd52fc
--- /dev/null
+++ b/src/main/java/com/zy/common/model/LocTypeDto.java
@@ -0,0 +1,52 @@
+package com.zy.common.model;
+
+import com.core.exception.CoolException;
+import com.zy.core.model.protocol.StaProtocol;
+import lombok.Data;
+
+/**
+ * Created by vincent on 2020/10/19
+ */
+@Data
+public class LocTypeDto {
+
+    // 楂樹綆绫诲瀷{0:鏈煡,1:浣庡簱浣�,2:楂樺簱浣峿
+    private Short locType1;
+
+    // 瀹界獎绫诲瀷{0:鏈煡,1:绐勫簱浣�,2:瀹藉簱浣峿
+    private Short locType2;
+
+    // 杞婚噸绫诲瀷{0:鏈煡,1:杞诲簱浣�,2:閲嶅簱浣峿
+    private Short locType3;
+
+    public LocTypeDto() {
+    }
+
+    public LocTypeDto(StaProtocol staProtocol) {
+        if (staProtocol.isHigh() == staProtocol.isLow()) {
+            throw new CoolException("plc楂樹綆妫�娴嬪紓甯�");
+        }
+        if (staProtocol.isLow()) {
+            this.locType1 = 1; // 浣庡簱浣�
+        } else {
+            this.locType1 = 2; // 楂樺簱浣�
+        }
+    }
+
+    /**
+     * 搴撲綅绫诲瀷瑙f瀽
+     */
+    public static LocTypeDto process(StaProtocol staProtocol) {
+        LocTypeDto dto = new LocTypeDto();
+        if (staProtocol.isHigh() == staProtocol.isLow()) {
+            throw new CoolException("plc楂樹綆妫�娴嬪紓甯�");
+        }
+        if (staProtocol.isLow()) {
+            dto.setLocType1((short) 1); // 浣庡簱浣�
+        } else {
+            dto.setLocType1((short) 2); // 楂樺簱浣�
+        }
+        return dto;
+    }
+
+}
diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 3dd49c3..8b4c272 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -5,12 +5,16 @@
 import com.core.common.Arith;
 import com.core.common.Cools;
 import com.core.exception.CoolException;
-import com.zy.asrs.domain.enums.WorkNoType;
 import com.zy.asrs.entity.*;
 import com.zy.asrs.service.*;
+import com.zy.asrs.utils.Utils;
+import com.zy.common.model.LocTypeDto;
+import com.zy.common.model.Shelves;
 import com.zy.common.model.StartupDto;
+import com.zy.core.properties.SlaveProperties;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -35,10 +39,13 @@
     private BasDevpService basDevpService;
     @Autowired
     private LocMastService locMastService;
+    @Autowired
+    private SlaveProperties slaveProperties;
+    @Autowired
+    private LocDetlService locDetlService;
 
     /**
      * 鐢熸垚宸ヤ綔鍙�
-     * @param wrkMk 0:鍏ュ簱 1 - 3000 ; 1:鎷f枡/骞舵澘/鐩樼偣 3001 - 6000 ; 2: 鍑哄簱 6001 -9000 ; 3:鍏朵粬 9001 -9999
      * @return workNo(宸ヤ綔鍙�)
      */
     public int getWorkNo(Integer wrkMk) {
@@ -75,6 +82,7 @@
         return workNo;
     }
 
+
     /**
      * 妫�绱㈠簱浣嶅彿
      * @param whsType 绫诲瀷 1:鍙屾繁寮忚揣鏋�
@@ -83,15 +91,19 @@
      * @param matNos 鐗╂枡鍙烽泦鍚�
      * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
      */
-    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos) {
+    @Transactional
+    public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos, LocTypeDto locTypeDto) {
         StartupDto startupDto = new StartupDto();
-        int workNo = getWorkNo(WorkNoType.getWorkNoType(staDescId));
-        startupDto.setWorkNo(workNo);
-        if (sourceStaNo < 100) {
+        // 鐢熸垚宸ヤ綔鍙�
+        int workNo = getWorkNo(0);
+        if (sourceStaNo == 202) {
+            whsType = 2;
+        } else if (sourceStaNo == 205){
             whsType = 1;
         } else {
-            whsType = 2;
+            throw new CoolException("搴撲綅鎺掑彿鍒嗛厤");
         }
+        startupDto.setWorkNo(workNo);
         RowLastno rowLastno = rowLastnoService.selectById(whsType);
         if (Cools.isEmpty(rowLastno)) {
             throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�");
@@ -100,20 +112,85 @@
             int curRow = rowLastno.getCurrentRow();
             int sRow = rowLastno.getsRow();
             int eRow = rowLastno.geteRow();
-
-            // 鑾峰彇鐩爣绔欐墍鍦ㄨ揣鏋舵帓鍙�
-            curRow = curRow == sRow ? eRow : sRow;
+            int crn_qty = rowLastno.getCrnQty();
+            int rowCount = eRow - sRow + 1;
             // 鐩爣鍫嗗灈鏈哄彿
-            int crnNo;
-            switch (whsType) {
-                case 1:
-                    crnNo = 1;
-                    break;
-                case 2:
-                    crnNo = 2;
-                    break;
-                default:
-                    throw new CoolException("妫�绱㈠簱浣� -- 妫�绱㈠爢鍨涙満鍙峰け璐�");
+            int crnNo = 0;
+            // 鐩爣搴撲綅
+            LocMast locMast = null;
+
+            // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂�
+            if (!Cools.isEmpty(matNos)) {
+                List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0));
+                for (String locNo : locNos) {
+                    if (Utils.isShallowLoc(slaveProperties, locNo)) {
+                        continue;
+                    }
+                    String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
+                    // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
+                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
+                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
+                        locMast = shallowLoc;
+                        crnNo = locMast.getCrnNo();
+                        break;
+                    }
+                }
+            }
+
+            // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭
+            if (staDescId == 10) {
+                List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("loc_sts", "D"));
+                if (locMasts.size() > 0) {
+                    for (LocMast loc : locMasts) {
+                        if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
+                            continue;
+                        }
+                        String shallowLocNo = Utils.getShallowLoc(slaveProperties,  loc.getLocNo());
+                        // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
+                        LocMast shallowLoc = locMastService.selectById(shallowLocNo);
+                        if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
+                            locMast = shallowLoc;
+                            crnNo = locMast.getCrnNo();
+                            break;
+                        }
+                    }
+                }
+            }
+
+            // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
+            if (null == locMast) {
+                // 閲嶅簱浣�
+                if (whsType == 1) {
+                    // 鑾峰彇鐩爣绔欐墍鍦ㄨ揣鏋舵帓鍙�
+                    Shelves shelves = new Shelves(rowCount, crn_qty);
+                    curRow = shelves.start(curRow);
+                    if (curRow < 0) {
+                        throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
+                    }
+                    for (List<Integer> node : shelves.nodes){
+                        if (node.contains(curRow)) {
+                            crnNo = shelves.nodes.indexOf(node) + 1;
+                            break;
+                        }
+                    }
+                    // 杞诲簱浣�
+                } if (whsType == 2) {
+                    // 鑾峰彇鐩爣绔欐墍鍦ㄨ揣鏋舵帓鍙�
+                    Shelves shelves = new Shelves(rowCount, crn_qty);
+                    curRow = shelves.start(curRow - 4);
+                    if (curRow < 0) {
+                        throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
+                    }
+                    for (List<Integer> node : shelves.nodes){
+                        if (node.contains(curRow)) {
+                            crnNo = shelves.nodes.indexOf(node) + 1;
+                            break;
+                        }
+                    }
+                    // 鍋忕Щ閲忚ˉ鍋�
+                    curRow = curRow + 4;
+                    crnNo = crnNo + 1;
+                }
             }
 
             basCrnpService.checkSiteStatus(crnNo);
@@ -130,8 +207,21 @@
             int inQty = staNo.getInQty()==null?0:staNo.getInQty();
             if (staNo.getAutoing().equals("Y") && inQty<2) {
                 // 鏌ユ壘搴撲綅
-                LocMast locMast = locMastService.queryFreeLocMast(curRow);
+                if (locMast == null) {
+                    if (Utils.isShallowLoc(slaveProperties, curRow)) {
+                        Integer deepRow = Utils.getDeepRow(slaveProperties, curRow);
+                        locMast = locMastService.queryFreeLocMast(deepRow, locTypeDto.getLocType1());
+                    }
+                    if (Cools.isEmpty(locMast)) {
+                        locMast = locMastService.queryFreeLocMast(curRow, locTypeDto.getLocType1());
+                    }
+                }
                 if (Cools.isEmpty(locMast)) {
+                    // 杞昏揣鐗╂壘杞诲簱浣嶄负绌烘椂锛屽彲浠ュ幓鎵鹃噸搴撲綅浠�
+                    if (locTypeDto.getLocType1() == 1) {
+                        locTypeDto.setLocType1((short) 2);
+                        return getLocNo(1, staDescId, sourceStaNo, matNos, locTypeDto);
+                    }
                     throw new CoolException("娌℃湁绌哄簱浣�");
                 }
                 String locNo = locMast.getLocNo();
diff --git a/src/main/java/com/zy/core/enums/CrnModeType.java b/src/main/java/com/zy/core/enums/CrnModeType.java
index a520095..0b75045 100644
--- a/src/main/java/com/zy/core/enums/CrnModeType.java
+++ b/src/main/java/com/zy/core/enums/CrnModeType.java
@@ -2,10 +2,11 @@
 
 public enum CrnModeType {
 
-    STOP(0, "鍋滄満鐘舵��"),    // 鍋滄満鐘舵��
-    HAND(1, "鎵嬪姩妯″紡"),   // 鎵嬪姩妯″紡涓�
-    HALF_AUTO(2, "鍗婅嚜鍔ㄦā寮�"),  // 鍗婅嚜鍔ㄦā寮忎腑
-    AUTO(3, "鐢佃剳妯″紡"),   // 鐢佃剳妯″紡涓�/鑷姩妯″紡
+    NONE(0, "鏈�夋嫨"),
+    AUTO(1, "鑷姩"),
+    HALF_AUTO(2, "鍗婅嚜鍔�"),
+    HAND(3, "鎵嬪姩"),
+    STOP(4, "缁翠慨"),
     ;
 
     public Integer id;
diff --git a/src/main/java/com/zy/core/model/protocol/StaProtocol.java b/src/main/java/com/zy/core/model/protocol/StaProtocol.java
index 64e43af..358631e 100644
--- a/src/main/java/com/zy/core/model/protocol/StaProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/StaProtocol.java
@@ -37,25 +37,31 @@
     // 绌烘澘淇″彿
     private boolean emptyMk;
 
+    // 楂�
+    private boolean high;
+
+    // 浣�
+    private boolean low;
+
     // 闇�姹�1
     private boolean inreq1;
 
     // 閿佸畾鏍囪
     private boolean pakMk = true;
 
-    // 鍙拌溅浣嶇疆
-    private Short position;
 
     public BasDevp toSqlModel(){
         BasDevp basDevp = new BasDevp();
         basDevp.setDevNo(siteId);
         basDevp.setWrkNo(workNo.intValue());
-        // 绔欑偣 todo:luxiaotao
         basDevp.setAutoing(autoing?"Y":"N");
         basDevp.setLoading(loading?"Y":"N");
         basDevp.setInEnable(inEnable?"Y":"N");
         basDevp.setOutEnable(outEnable?"Y":"N");
-        basDevp.setInreq1(inreq1?"Y":"N");
+        basDevp.setLocType1((short) 0);  // 楂樹綆绫诲瀷{0:鏈煡,1:浣庡簱浣�,2:楂樺簱浣峿
+        basDevp.setLocType2((short) 0);  // 瀹界獎绫诲瀷{0:鏈煡,1:绐勫簱浣�,2:瀹藉簱浣峿
+        basDevp.setLocType3((short) 0);  // 杞婚噸绫诲瀷{0:鏈煡,1:杞诲簱浣�,2:閲嶅簱浣峿
+        basDevp.setLocType1(high != low && low ? (short) 1 : (short) 2);
         return basDevp;
     }
 
diff --git a/src/main/java/com/zy/core/properties/SlaveProperties.java b/src/main/java/com/zy/core/properties/SlaveProperties.java
index 1cf0514..4a60418 100644
--- a/src/main/java/com/zy/core/properties/SlaveProperties.java
+++ b/src/main/java/com/zy/core/properties/SlaveProperties.java
@@ -19,6 +19,12 @@
 @ConfigurationProperties(prefix = "wcs-slave")
 public class SlaveProperties {
 
+    private boolean doubleDeep;
+
+    private List<Integer> doubleLocs = new ArrayList<>();
+
+    private int groupCount;
+
     private List<CrnSlave> crn = new ArrayList<>();
 
     private List<DevpSlave> devp = new ArrayList<>();
diff --git a/src/main/java/com/zy/core/thread/SiemensDevpThread.java b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
index aaef15b..4dde49d 100644
--- a/src/main/java/com/zy/core/thread/SiemensDevpThread.java
+++ b/src/main/java/com/zy/core/thread/SiemensDevpThread.java
@@ -130,15 +130,6 @@
                 }
             }
         }
-        // 鍙拌溅浣嶇疆
-        OperateResultExOne<Short> result2 = siemensS7Net.ReadInt16("DB100.48");
-        if (result2.IsSuccess) {
-            StaProtocol staProtocol = station.get(8);
-            staProtocol.setPosition(result2.Content);
-        } else {
-            OutputQueue.DEVP.offer(MessageFormat.format("銆恵0}銆�8鍙峰彴杞﹁幏鍙栧疄鏃朵綅缃け璐ワ紒锛侊紒", DateUtils.convert(new Date())));
-            log.error("8鍙峰彴杞﹁幏鍙栧疄鏃朵綅缃け璐ワ紒锛侊紒");
-        }
 
         if (result.IsSuccess && result1.IsSuccess) {
 
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 25fd543..f79abe9 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -35,6 +35,12 @@
 
 # 涓嬩綅鏈洪厤缃�
 wcs-slave:
+  # 鍙屾繁
+  doubleDeep: true
+  # 鍙屾繁搴撲綅鎺掑彿
+  doubleLocs: 1,4,5,8
+  # 涓�涓爢鍨涙満璐熻矗鐨勮揣鏋舵帓鏁�
+  groupCount: 4
   # 鍫嗗灈鏈�1
   crn[0]:
     id: 1
diff --git a/src/main/resources/mapper/LocMastMapper.xml b/src/main/resources/mapper/LocMastMapper.xml
index 2454472..62d7864 100644
--- a/src/main/resources/mapper/LocMastMapper.xml
+++ b/src/main/resources/mapper/LocMastMapper.xml
@@ -39,7 +39,14 @@
     </resultMap>
 
     <select id="queryFreeLocMast" resultMap="BaseResultMap">
-        select top 1 * from asr_loc_mast where row1=#{row} and loc_sts='O' order by loc_sts desc ,lev1 asc,bay1 asc
+        select top 1 *
+        from asr_loc_mast
+        where row1=#{row}
+        and loc_sts='O'
+        <if test="locType1 != null">
+            and loc_type1 = #{locType1}
+        </if>
+        order by loc_sts desc ,lev1 asc,bay1 asc
     </select>
 
     <select id="queryDemoSourceLoc" resultMap="BaseResultMap">
diff --git a/src/main/webapp/static/css/console.css b/src/main/webapp/static/css/console.css
index c82ff51..f15bfcd 100644
--- a/src/main/webapp/static/css/console.css
+++ b/src/main/webapp/static/css/console.css
@@ -218,7 +218,7 @@
 .main-part {
     position: absolute;
     top: 100px;
-    left: 300px;
+    left: 500px;
 }
 .main-part .lane {
     /*margin-bottom: 30px;*/
@@ -358,7 +358,7 @@
     position: absolute;
     background-color:#333!important;
     color: #333 !important;
-    width: 93%;
+    width: 72%;
     margin-top: 10px;
 }
 
diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html
index 898b7fd..f86b70b 100644
--- a/src/main/webapp/views/console.html
+++ b/src/main/webapp/views/console.html
@@ -91,14 +91,6 @@
 
     <!----------- 宸﹁緭閫佺嚎 ---------->
 
-    <!-- 鍙拌溅杞ㄩ亾 -->
-    <div id="car-track-1" class="car-track">
-        <div></div>
-    </div>
-
-    <!-- 鍙拌溅瀹炰緥 -->
-    <div id="site-8" class="site car">8</div>
-
     <!-- 绗竴鍒楋紙瀹藉害 100px锛� -->
     <div class="site-row site-row-1">
         <div id="site-7" class="site" style="height: 20px;line-height: 20px;margin-bottom: 20px">7</div>
@@ -125,10 +117,10 @@
     <div class="main-part">
         <!--绗竴缁�-->
         <div class="lane">
-            <span class="row-no">1#</span>
+            <span class="row-no">8#</span>
             <!-- 璐ф灦 -->
             <div class="stock-group">
-                <div id="site-6" class="site" style="">6</div>
+                <div id="site-100" class="site" style="">100</div>
                 <button class="item">1</button>
                 <button class="item">2</button>
                 <button class="item">3</button>
@@ -161,8 +153,90 @@
                 <button class="item">30</button>
                 <button class="item">31</button>
                 <button class="item">32</button>
-                <button class="item">33</button>
-                <button class="item">34</button>
+                <div class="site site-none">&nbsp;&nbsp;&nbsp;&nbsp;</div>
+            </div>
+            <!-- 鍫嗗灈鏈� -->
+            <div class="crn">
+                <hr class="pathway">
+                <div id="crn-2" class="machine"></div>
+            </div>
+            <!-- 璐ф灦 -->
+            <div class="stock-group">
+                <div id="site-124" class="site" style="">124</div>
+                <button class="item">1</button>
+                <button class="item">2</button>
+                <button class="item">3</button>
+                <button class="item">4</button>
+                <button class="item">5</button>
+                <button class="item">6</button>
+                <button class="item">7</button>
+                <button class="item">8</button>
+                <button class="item">9</button>
+                <button class="item">10</button>
+                <button class="item">11</button>
+                <button class="item">12</button>
+                <button class="item">13</button>
+                <button class="item">14</button>
+                <button class="item">15</button>
+                <button class="item">16</button>
+                <button class="item">17</button>
+                <button class="item">18</button>
+                <button class="item">19</button>
+                <button class="item">20</button>
+                <button class="item">21</button>
+                <button class="item">22</button>
+                <button class="item">23</button>
+                <button class="item">24</button>
+                <button class="item">25</button>
+                <button class="item">26</button>
+                <button class="item">27</button>
+                <button class="item">28</button>
+                <button class="item">29</button>
+                <button class="item">30</button>
+                <button class="item">31</button>
+                <button class="item">32</button>
+                <div class="site site-none">&nbsp;&nbsp;&nbsp;&nbsp;</div>
+            </div>
+            <span class="row-no">5#</span>
+        </div>
+        <!--绗簩缁�-->
+        <div class="lane">
+            <span class="row-no">4#</span>
+            <!-- 璐ф灦 -->
+            <div class="stock-group">
+                <div id="site-120" class="site" style="">120</div>
+                <button class="item">1</button>
+                <button class="item">2</button>
+                <button class="item">3</button>
+                <button class="item">4</button>
+                <button class="item">5</button>
+                <button class="item">6</button>
+                <button class="item">7</button>
+                <button class="item">8</button>
+                <button class="item">9</button>
+                <button class="item">10</button>
+                <button class="item">11</button>
+                <button class="item">12</button>
+                <button class="item">13</button>
+                <button class="item">14</button>
+                <button class="item">15</button>
+                <button class="item">16</button>
+                <button class="item">17</button>
+                <button class="item">18</button>
+                <button class="item">19</button>
+                <button class="item">20</button>
+                <button class="item">21</button>
+                <button class="item">22</button>
+                <button class="item">23</button>
+                <button class="item">24</button>
+                <button class="item">25</button>
+                <button class="item">26</button>
+                <button class="item">27</button>
+                <button class="item">28</button>
+                <button class="item">29</button>
+                <button class="item">30</button>
+                <button class="item">31</button>
+                <button class="item">32</button>
                 <div class="site site-none">&nbsp;&nbsp;&nbsp;&nbsp;</div>
             </div>
             <!-- 鍫嗗灈鏈� -->
@@ -172,7 +246,7 @@
             </div>
             <!-- 璐ф灦 -->
             <div class="stock-group">
-                <div id="site-5" class="site" style="">5</div>
+                <div id="site-118" class="site" style="">118</div>
                 <button class="item">1</button>
                 <button class="item">2</button>
                 <button class="item">3</button>
@@ -205,79 +279,9 @@
                 <button class="item">30</button>
                 <button class="item">31</button>
                 <button class="item">32</button>
-                <button class="item">33</button>
-                <button class="item">34</button>
                 <div class="site site-none">&nbsp;&nbsp;&nbsp;&nbsp;</div>
             </div>
-            <span class="row-no">2#</span>
-        </div>
-        <!--绗簩缁�-->
-        <div class="lane" style="margin-left: 300px">
-            <span class="row-no">3#</span>
-            <!-- 璐ф灦 -->
-            <div class="stock-group">
-                <div id="site-101" class="site" style="">101</div>
-                <button class="item">2</button>
-                <button class="item">4</button>
-                <button class="item">6</button>
-                <button class="item">8</button>
-                <button class="item">10</button>
-                <button class="item">12</button>
-                <button class="item">14</button>
-                <button class="item">16</button>
-                <button class="item">18</button>
-                <button class="item">20</button>
-                <button class="item">22</button>
-                <button class="item">24</button>
-                <button class="item">26</button>
-                <button class="item">28</button>
-                <button class="item">30</button>
-                <button class="item">32</button>
-                <button class="item">34</button>
-                <button class="item">36</button>
-                <button class="item">38</button>
-                <button class="item">40</button>
-                <button class="item">42</button>
-                <button class="item">44</button>
-                <button class="item">46</button>
-                <button class="item">48</button>
-                <div class="site site-none">&nbsp;&nbsp;&nbsp;&nbsp;</div>
-            </div>
-            <!-- 鍫嗗灈鏈� -->
-            <div class="crn">
-                <hr class="pathway" style="width: 67.5%">
-                <div id="crn-2" class="machine"></div>
-            </div>
-            <!-- 璐ф灦 -->
-            <div class="stock-group">
-                <div id="site-107" class="site" style="">107</div>
-                <button class="item">2</button>
-                <button class="item">4</button>
-                <button class="item">6</button>
-                <button class="item">8</button>
-                <button class="item">10</button>
-                <button class="item">12</button>
-                <button class="item">14</button>
-                <button class="item">16</button>
-                <button class="item">18</button>
-                <button class="item">20</button>
-                <button class="item">22</button>
-                <button class="item">24</button>
-                <button class="item">26</button>
-                <button class="item">28</button>
-                <button class="item">30</button>
-                <button class="item">32</button>
-                <button class="item">34</button>
-                <button class="item">36</button>
-                <button class="item">38</button>
-                <button class="item">40</button>
-                <button class="item">42</button>
-                <button class="item">44</button>
-                <button class="item">46</button>
-                <button class="item">48</button>
-                <div class="site site-none">&nbsp;&nbsp;&nbsp;&nbsp;</div>
-            </div>
-            <span class="row-no">4#</span>
+            <span class="row-no">1#</span>
         </div>
     </div>
 </main>

--
Gitblit v1.9.1