春风项目四线(合箱线、总装线)
yyt
2024-02-19 0b14225915932f0f5c88bc3e44302bf1c309de1a
CVT看板介面,新增SNCode写入功能,扫码功能更新.
已修改3个文件
已添加1个文件
160 ■■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/api/main/da/opcuaconfig/opcuaconfig.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/kb/cvt/cs.vue 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/kb/cvt/index.vue 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/controller/DaOpcuaConfigController.java
@@ -3,7 +3,9 @@
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.jcdm.main.da.opcuaconfig.client.ClientHandler;
import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
import com.jcdm.main.da.opcuaconfig.domain.NodeEntity;
import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@@ -102,4 +104,21 @@
    {
        return toAjax(daOpcuaConfigService.deleteDaOpcuaConfigByIds(ids));
    }
    /**
     * èŽ·å–交互信号配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('da:opcuaconfig:query')")
    @GetMapping(value = "/SNCode/{SNCode}/{locationCode}")
    public AjaxResult setSNCode(@PathVariable("SNCode") String SNCode,@PathVariable("locationCode") String locationCode) {
        NodeEntity node= NodeEntity.builder().index(2).identifier("CFL4CVT"+"."+locationCode+".SNCode").value(SNCode).type("string").build();
        Boolean out= null;
        try {
            out = ClientHandler.write(node);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return toAjax(out);
    }
}
jcdm-ui/src/api/main/da/opcuaconfig/opcuaconfig.js
@@ -17,6 +17,14 @@
  })
}
// æŸ¥è¯¢äº¤äº’信号配置详细
export function setSNCode(SNCode,locationCode) {
  return request({
    url: '/da/opcuaconfig/SNCode/' + SNCode+'/'+locationCode,
    method: 'get'
  })
}
// æ–°å¢žäº¤äº’信号配置
export function addOpcuaconfig(data) {
  return request({
jcdm-ui/src/views/main/kb/cvt/cs.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@
<template>
  <el-input
    Î¿nkeyup="this.value=this.value.replace(/\D|/g,'')"
    clearable
    maxlength="116"
    v-model="codeValue"
    placeholder="请输入条形码"
  />
</template>
<script>
export default {
  data(){
    return {
      codeValue: "",
      code: "",
      lastTime: "",
      nextTime: "",
      lastCode: "",
      nextCode: "",
      dtmainId: "",
    };
  },
  created() {
    window.document.onkeypress = (e) => {
      if (window.event) {
        // IE
        this.nextCode = e.keyCode;
      } else if (e.which) {
        // Netscape/Firefox/Opera
        this.nextCode = e.which;
      }
      if (e.which === 13) {
        // é”®ç›˜å›žè½¦äº‹ä»¶
        if (this.code.length < 3) return; // æ‰«ç æžªçš„速度很快,手动输入的时间不会让code的长度大于2,所以这里不会对扫码枪有效
        //console.log("扫码结束。");
        //console.log("条形码:", this.code);
        this.parseQRCode(this.code); // èŽ·å–到扫码枪输入的内容,做别的操作
        this.lastCode = "";
        this.lastTime = "";
        return;
      }
      this.nextTime = new Date().getTime();
      if (!this.lastTime && !this.lastCode) {
        this.code = ""; // æ¸…空上次的条形码
        this.code += e.key;
        //console.log("扫码开始---", this.code);
      }
      if (this.lastCode && this.lastTime && this.nextTime - this.lastTime > 500) {
        // å½“扫码前有keypress事件时,防止首字缺失
        this.code = e.key;
        //console.log("防止首字缺失。。。", this.code);
      } else if (this.lastCode && this.lastTime) {
        this.code += e.key;
        //console.log("扫码中。。。", this.code);
      }
      this.lastCode = this.nextCode;
      this.lastTime = this.nextTime;
    };
  },
  methods: {
    parseQRCode(code) {
      // if (code.length === 16) {
      //   console.log(code);
      // } else if (code.length === 0) {
      //   console.log("请输入条码!");
      // } else {
      //   alert("条码不合法:" + code);
      // }
      this.codeValue = code;
      // å‘送网络请求
    },
  },
}
</script>
<style scoped lang="scss">
</style>
jcdm-ui/src/views/main/kb/cvt/index.vue
@@ -27,7 +27,7 @@
             <el-form ref="form" :model="form"  label-width="25%"   >
               <el-form-item prop="engineNo" style="margin-top: 16px">
               <span slot="label" style="font-size:22px;color:black;"><strong>发动机号</strong></span>
                 <el-input style="font-size:20px" v-model="form.engineNo" placeholder="请输入发动机号" clearable  @keyup.enter.native="EngineNohandleChange">
                 <el-input style="font-size:20px" v-model="form.engineNo" placeholder="请输入发动机号" clearable  @input="EngineNohandleChange">
                   <el-button slot="append" plain type="info" @click="EngineNohandleChange" icon="el-icon-search"></el-button>
                 </el-input>
               </el-form-item>
@@ -80,6 +80,7 @@
import { listOrderScheduling, getOrderScheduling, delOrderScheduling, addOrderScheduling, updateOrderScheduling } from "@/api/main/bs/orderScheduling/orderScheduling";
import { listPassingStationCollection, getPassingStationCollection, delPassingStationCollection, addPassingStationCollection, updatePassingStationCollection } from "@/api/main/da/passingStationCollection/passingStationCollection";
import {listLineInfo} from "@/api/main/bs/lineInfo/lineInfo";
import { setSNCode } from "@/api/main/da/opcuaconfig/opcuaconfig";
import {getIp, listStationConf} from "@/api/main/sc/stationConf";
export default {
@@ -95,6 +96,15 @@
      buttondisabled:true,
      locationCode: "未配置",
      locationName: "未配置工位",
      codeValue: "",
      code: "",
      lastTime: "",
      nextTime: "",
      lastCode: "",
      nextCode: "",
      dtmainId: "",
      // æŸ¥è¯¢å‚æ•°
      queryParams: {
        pageNum: 1,
@@ -122,7 +132,36 @@
  },
  computed: {},
  watch: {},
  created() {},
  created() {
    window.document.onkeypress = (e) => {
      if (window.event) {
        this.nextCode = e.keyCode;
      } else if (e.which) {
        this.nextCode = e.which;
      }
      if (e.which === 13) {
        // é”®ç›˜å›žè½¦äº‹ä»¶
        if (this.code.length < 3) return; // æ‰«ç æžªçš„速度很快,手动输入的时间不会让code的长度大于2,所以这里不会对扫码枪有效
        this.parseQRCode(this.code); // èŽ·å–到扫码枪输入的内容,做别的操作
        this.lastCode = "";
        this.lastTime = "";
        return;
      }
      this.nextTime = new Date().getTime();
      if (!this.lastTime && !this.lastCode) {
        this.code = ""; // æ¸…空上次的条形码
        this.code += e.key;
      }
      if (this.lastCode && this.lastTime && this.nextTime - this.lastTime > 500) {
        // å½“扫码前有keypress事件时,防止首字缺失
        this.code = e.key;
      } else if (this.lastCode && this.lastTime) {
        this.code += e.key;
      }
      this.lastCode = this.nextCode;
      this.lastTime = this.nextTime;
    };
  },
  mounted() {
    this.getStationConf();
  },
@@ -154,7 +193,8 @@
    },
    EngineNohandleChange(){
      if(this.form.engineNo !== null && this.form.engineNo !== undefined){
        let OrderSchedulingParam = {engineNo: null}
        //let OrderSchedulingParam = {engineNo: null}
        setSNCode(this.form.engineNo,this.locationCode)
        //OrderSchedulingParam.engineNo = this.form.engineNo;
     /*   listOrderScheduling(OrderSchedulingParam).then(response => {
          if(response.total === 1 ){
@@ -202,7 +242,9 @@
      }
    },
    parseQRCode(code) {
      this.form.engineNo = code;
    },
  },
  }