1
zhang
2 天以前 8a286894c2f6c5a3ff027b1c0fcb45b72b96cba1
1
8个文件已修改
169 ■■■■■ 已修改文件
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/SiteController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/vo/SiteTableVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/constant/DeviceField.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/model/StaProtocol.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/properties/DevpSlave.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asc-conveyor/src/main/resources/application.yml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asc-conveyor/src/main/webapp/views/pipeline.html 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/SiteController.java
@@ -69,10 +69,11 @@
            vo.setLoading(staProtocol.isLoading() ? "Y" : "N");     // 有物
            vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N");   // 可入
            vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出
            vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N");     // 空板信号
            vo.setEmptyMk(staProtocol.isEmptyMk() !=staProtocol.isFullPlt() ? (staProtocol.isEmptyMk()?"空" : "满"): "-");     // 空板信号
            vo.setStaNo(staProtocol.getStaNo());                // 目标站
//            vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高");     //高低库位
            vo.setLocType1(devp.getDevNo() == 102 ? "高" : "低");
            vo.setWeight(staProtocol.getWeight() == null ? 0D : staProtocol.getWeight());
            vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow()? ( staProtocol.isLow() ? "低" : "高"): "-");     //高低库位
        }
        return R.ok().add(list);
@@ -110,9 +111,10 @@
                    vo.setLoading(staProtocol.isLoading() ? "Y" : "N");     // 有物
                    vo.setInEnable(staProtocol.isInEnable() ? "Y" : "N");   // 可入
                    vo.setOutEnable(staProtocol.isOutEnable() ? "Y" : "N"); // 可出
                    vo.setEmptyMk(staProtocol.isEmptyMk() ? "Y" : "N");     // 空板信号
                    vo.setEmptyMk(staProtocol.isEmptyMk() !=staProtocol.isFullPlt() ? (staProtocol.isEmptyMk()?"空" : "满"): "-");     // 空板信号
                    vo.setStaNo(staProtocol.getStaNo());                // 目标站
                    vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow() && staProtocol.isLow() ? "低" : "高");     //高低库位
                    vo.setWeight(staProtocol.getWeight() ==null ? 0D : staProtocol.getWeight());
                    vo.setLocType1(staProtocol.isHigh() != staProtocol.isLow()? ( staProtocol.isLow() ? "低" : "高"): "-");     //高低库位
                    return R.ok().add(vo);
                }
            }
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/controller/vo/SiteTableVo.java
@@ -37,4 +37,6 @@
    //高低库位
    private String locType1 = "-";
    private Double weight = 0D;
}
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/constant/DeviceField.java
@@ -6,22 +6,26 @@
 */
public enum DeviceField {
    // 扫码器:每站点16字节,String[14]
    BARCODE("DB103", 254, 16),
    BARCODE("DB103", 254, 18,new int[]{0,2},21),
    // 出入库模式
    IO_MODE("DB103", 170, 4,new int[]{0,2},21),
    // 称重:每站点4字节,Float
    //WEIGHT("DB102", 0, 4),
    WEIGHT("DB103", 634, 4),
    WEIGHT("DB103", 634, 6,new int[]{0,2},21),
    // 尺寸异常:每站点2字节,Bit数组
    DIMENSION_WORD("DB103", 2, 8);
    DIMENSION_WORD("DB103", 2, 8,new int[]{0,2,4,6},21);
    private final String addressPattern;
    private final int offset;
    private final int byteLength;
    private final int[] seg;
    private final int arrLength;
    DeviceField(String addressPattern, int offset, int byteLength) {
    DeviceField(String addressPattern, int offset, int byteLength,int[] seg, int arrLength) {
        this.addressPattern = addressPattern;
        this.offset = offset;
        this.byteLength = byteLength;
        this.seg = seg;
        this.arrLength = arrLength;
    }
    public String getAddressPattern() {
@@ -36,6 +40,14 @@
        return byteLength;
    }
    public int getArrLength() {
        return arrLength;
    }
    public int[] getSeg() {
        return seg;
    }
    /**
     * 根据 DB 块编号和站点偏移生成具体地址
     *
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/model/StaProtocol.java
@@ -80,6 +80,9 @@
    // 扫码失败
    private boolean barcodeErr = false;
    // 有货报警,空托入库时检测托盘上有无货物
    private boolean loadErr = false;
    //故障-----------------------------------------------------------------------
    private Boolean breakerErr = false; //断路器故障
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/properties/DevpSlave.java
@@ -18,6 +18,11 @@
    private Integer slot;
    private Boolean weight;
    private Boolean barcode ;
    private Boolean staNosError ;
    private List<Sta> releaseSta = new ArrayList<>();
@@ -25,13 +30,9 @@
    private List<Sta> inSta = new ArrayList<>();
    private List<Integer> barcodeArr = new ArrayList<>();
    private List<Integer> weightArr = new ArrayList<>();
    private List<Integer> staNos = new ArrayList<>();
    private List<Integer> staNosError = new ArrayList<>();
    @Data
    public static class Sta {
zy-asc-conveyor/src/main/java/com/zy/acs/conveyor/core/thread/SiemensDevpThread.java
@@ -158,14 +158,13 @@
     * 读取条码信息
     */
    private void readBarcodes() {
        List<Integer> barcodeArr = slave.getBarcodeArr();
        if (barcodeArr == null || barcodeArr.isEmpty()) {
        if (slave.getBarcode() == null || !slave.getBarcode()) {
            return;
        }
        OperateResultExOne<byte[]> result = siemensS7Net.Read(
                DeviceField.BARCODE.buildAddress(),
                (short) (barcodeArr.size() * DeviceField.BARCODE.getByteLength()));
                (short) ( DeviceField.BARCODE.getByteLength() * DeviceField.BARCODE.getArrLength()));
        if (!result.IsSuccess) {
            log.warn("读取条码失败 [id:{}]", slave.getId());
@@ -173,15 +172,18 @@
        }
        byte[] content = result.Content;
        for (int i = 0; i < barcodeArr.size(); i++) {
        for (int i = 0; i < DeviceField.BARCODE.getArrLength(); i++) {
            int[] seg = DeviceField.BARCODE.getSeg();
            Short staNo = siemensS7Net.getByteTransform().TransInt16(
                    content, seg[0]+i * DeviceField.BARCODE.getByteLength());
            String barcode = siemensS7Net.getByteTransform().TransString(
                    content, i * DeviceField.BARCODE.getByteLength(),
                    DeviceField.BARCODE.getByteLength(), "UTF-8");
                    content, seg[1]+i * DeviceField.BARCODE.getByteLength(),
                    DeviceField.BARCODE.getByteLength()-seg[1], "UTF-8");
            if (!Cools.isEmpty(barcode)) {
                StaProtocol staProtocol = station.get(barcodeArr.get(i));
            if (!Cools.isEmpty(barcode)&& staNo !=null) {
                StaProtocol staProtocol = station.get(staNo);
                if (staProtocol == null) {
                    log.warn("站点不存在 [id:{}] [staNo:{}]", slave.getId(), barcodeArr.get(i));
                    log.warn("扫码站点不存在 [id:{}] [staNo:{}]", slave.getId(), staNo);
                    continue;
                }
                staProtocol.setBarcode(barcode);
@@ -191,30 +193,36 @@
    }
    /**
     * 读取条码信息
     * 读取重量信息
     */
    private void readWeight() {
        List<Integer> weightArr = slave.getWeightArr();
        if (weightArr == null || weightArr.isEmpty()) {
        if ( slave.getWeight() == null || ! slave.getWeight()) {
            return;
        }
        OperateResultExOne<byte[]> result = siemensS7Net.Read(
                DeviceField.WEIGHT.buildAddress(),
                (short) (weightArr.size() * DeviceField.WEIGHT.getByteLength()));
                (short) (DeviceField.WEIGHT.getArrLength() * DeviceField.WEIGHT.getByteLength()));
        if (!result.IsSuccess) {
            log.warn("读取重量失败 [id:{}]", slave.getId());
            return;
        }
        for (int i = 0; i < weightArr.size(); i++) {
            StaProtocol staProtocol = station.get(weightArr.get(i));
        byte[] content = result.Content;
        for (int i = 0; i < DeviceField.WEIGHT.getArrLength() ; i++) {
            int[] seg = DeviceField.WEIGHT.getSeg();
            Short staNo = siemensS7Net.getByteTransform().TransInt16(
                    content, seg[0]+i * DeviceField.WEIGHT.getByteLength());
            Double weight = (double) siemensS7Net.getByteTransform().TransSingle(
                    content, seg[1] + i * DeviceField.WEIGHT.getByteLength());
            if (!Cools.isEmpty(weight)&& staNo !=null) {
                StaProtocol staProtocol = station.get(staNo);
            if (staProtocol == null) {
                log.warn("站点不存在 [id:{}] [staNo:{}]", slave.getId(), weightArr.get(i));
                    log.warn("称重站点不存在 [id:{}] [staNo:{}]", slave.getId(), staNo);
                continue;
            }
            double weight = siemensS7Net.getByteTransform().TransSingle(result.Content, i * DeviceField.WEIGHT.getByteLength());
            staProtocol.setWeight(BigDecimal.valueOf(weight).setScale(4, RoundingMode.HALF_UP).doubleValue());
            }
        }
    }
@@ -222,14 +230,13 @@
     * 读取外形检测错误
     */
    private void readDimensionErrors() {
        List<Integer> staNosError = slave.getStaNosError();
        if (staNosError == null || staNosError.isEmpty()) {
        if ( slave.getStaNosError() == null ||  !slave.getStaNosError()) {
            return;
        }
        OperateResultExOne<byte[]> result = siemensS7Net.Read(
                DeviceField.DIMENSION_WORD.buildAddress(),
                (short) (staNosError.size() * DeviceField.DIMENSION_WORD.getByteLength()));
                (short) (DeviceField.DIMENSION_WORD.getArrLength() * DeviceField.DIMENSION_WORD.getByteLength()));
        if (!result.IsSuccess) {
            log.warn("读取外形检测错误失败 [id:{}]", slave.getId());
@@ -237,30 +244,35 @@
        }
        byte[] content = result.Content;
        for (int i = 0; i < staNosError.size(); i++) {
            Integer siteId = staNosError.get(i);
            StaProtocol staProtocol = station.get(siteId);
        for (int i = 0; i < DeviceField.DIMENSION_WORD.getArrLength(); i++) {
            int[] seg = DeviceField.DIMENSION_WORD.getSeg();
            Short staNo = siemensS7Net.getByteTransform().TransInt16(
                    content, seg[0]);
            if ( staNo !=null) {
                StaProtocol staProtocol = station.get(staNo);
            if (staProtocol == null){
                log.warn("站点不存在 [id:{}] [staNo:{}]", slave.getId(), staNosError.get(i));
                    log.warn("异常站点不存在 [id:{}] [staNo:{}]", slave.getId(), staNo);
                continue;
            }
            short i1 = siemensS7Net.getByteTransform().TransInt16(
                    content, 0);
            boolean[] status = siemensS7Net.getByteTransform().TransBool(
                    content, 2+i * DeviceField.DIMENSION_WORD.getByteLength(),
                        content, seg[1]+i * DeviceField.DIMENSION_WORD.getByteLength(),
                    1);
//未使用,预留
//                boolean[] status1 = siemensS7Net.getByteTransform().TransBool(
//                        content, seg[1]+i * DeviceField.DIMENSION_WORD.getByteLength()+1,
//                        1);
            boolean[] status1 = siemensS7Net.getByteTransform().TransBool(
                    content, 2+i * DeviceField.DIMENSION_WORD.getByteLength()+1,
                    1);
                staProtocol.setLeftErr(status[0]);
                staProtocol.setRightErr(status[1]);
                staProtocol.setFrontErr(status[2]);
                staProtocol.setBackErr(status[3]);
                staProtocol.setHighErr(status[4]);
                staProtocol.setLoadErr(status[5]);
                staProtocol.setWeightErr(status[6]);
                staProtocol.setBarcodeErr(status[7]);
            }
            staProtocol.setFrontErr(status[0]);
            staProtocol.setBackErr(status[1]);
            staProtocol.setHighErr(status[2]);
            staProtocol.setLeftErr(status[3]);
            staProtocol.setRightErr(status[4]);
            staProtocol.setWeightErr(status[5]);
            staProtocol.setBarcodeErr(status[6]);
        }
    }
zy-asc-conveyor/src/main/resources/application.yml
@@ -102,12 +102,9 @@
      - 1011
      - 1012
      - 1013
    staNosError:
      - 1010
    barcodeArr:
      - 1010
    weightArr:
      - 1009
    staNosError: true
    barcode: true
    weight: true
    # ctu放货站点
    releaseSta[0]:
      # 本站点
zy-asc-conveyor/src/main/webapp/views/pipeline.html
@@ -783,10 +783,10 @@
                            <th>有物</th>
                            <th>可入</th>
                            <th>可出</th>
                            <th>入库标记</th>
                            <th>空板信号</th>
                            <th>重量信号</th>
                            <th>空满信号</th>
                            <th>目标站</th>
                            <th>高低库位</th>
                            <th>高低信号</th>
                        </tr>
                        </thead>
                        <tbody>
@@ -824,19 +824,19 @@
                        </div>
                        <div class="form-group">
                            <label class="form-label" for="workNo">工作号:</label>
                            <input id="workNo" name="workNo" type="number" class="form-input"
                            <input id="workNo" name="workNo" type="number" min="0" class="form-input"
                                   autocomplete="off">
                        </div>
                        <div class="form-group">
                            <label class="form-label" for="staNo">目标站:</label>
                            <input id="staNo" name="staNo" type="number" class="form-input"
                            <input id="staNo" name="staNo" type="number" min="0" class="form-input"
                                   autocomplete="off">
                        </div>
                        <div class="form-group">
                            <label class="form-label" for="pakMk">入库标记:</label>
                            <input id="pakMk" name="pakMk" type="text" class="form-input"
                                   autocomplete="off">
                        </div>
<!--                        <div class="form-group">-->
<!--                            <label class="form-label" for="pakMk">入库标记:</label>-->
<!--                            <input id="pakMk" name="pakMk" type="text" class="form-input"-->
<!--                                   autocomplete="off">-->
<!--                        </div>-->
                    </form>
                </div>
                <div class="modal-footer">
@@ -987,7 +987,7 @@
                            ${site.outEnable === 'Y' ? 'Y' : 'N'}
                        </span>
                    </td>
                    <td>${site.pakMk || '--'}</td>
                    <td>${site.weight || '--'}</td>
                    <td>${site.emptyMk || '--'}</td>
                    <td>${site.staNo || '--'}</td>
                    <td>${site.locType1 || '--'}</td>