| | |
| | | ], |
| | | "address": [ |
| | | { |
| | | "name": "DB104.DBx0.0", |
| | | "name": "DB104.0.0", |
| | | "count": 72 |
| | | } |
| | | ] |
| | |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "半自动启动", |
| | | "name": "A01半自动启动", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | |
| | | }, |
| | | { |
| | | "button": { |
| | | "name": "半自动启动", |
| | | "name": "A02半自动启动", |
| | | "value":0, |
| | | "address":"DB10.0" |
| | | } |
| | |
| | | "address": [ |
| | | { |
| | | "name": "DB102.0.0", |
| | | "count": 58 |
| | | "count": 64 |
| | | } |
| | | ] |
| | | } |
| | |
| | | const parms = obj.params; |
| | | const fanzhuan = obj.fanzhuan; |
| | | const xiaoche = obj.xiaoche; |
| | | |
| | | console.log(obj); |
| | | // console.log('parms:', parms); |
| | | // console.log('fanzhuan:', fanzhuan); |
| | | // console.log('xiaoche:', xiaoche); |
| | |
| | | </el-breadcrumb> |
| | | |
| | | <el-row :gutter="40"> |
| | | <el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:260px;"> |
| | | <el-col :span="6" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" style="margin-bottom: -20px;"> |
| | | <el-card class="json-block" style="width:260px;margin-bottom: 2px;"> |
| | | <div class="button-row" style="display: flex; justify-content: space-between;"> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <span v-if="item.title" :name="item.title.name" class="action-button" >{{ item.title.name }}</span> |
| | |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex"> |
| | | <el-button v-if="item.button" :name="item.button.name" v-model="item.button.value" class="action-button" |
| | | @click="updateButtonValue(dataGroup, itemIndex);submitDataToBackend(item.button.name)" |
| | | :class="{ 'green-button': item.button.value === 0 && item.button.name !== '清除ID','red-button': item.button.value === 1 && item.button.name !== '清除ID' }">{{ item.button.name }}</el-button> |
| | | :class="{ 'green-button': item.button.value === 0 && item.button.name !== '清除ID','red-button': item.button.value === 2 && item.button.name !== '清除ID' ,'yellow-button': item.button.value === 1 && item.button.name !== '清除ID' }">{{ item.button.name }}</el-button> |
| | | </div> |
| | | </div> |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div class="item-row"> |
| | | |
| | | <span class="name" style="width:150px;">{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:150px;" class="input-box"></el-input> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" readonly="readonly" style="width:400px;" class="input-box"></el-input> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | methods: { |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | |
| | |
| | | }); |
| | | |
| | | const values = inputData.flat().filter(item => item !== null).map(item => item.value); |
| | | |
| | | const jsonObject = { data: values }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('Type为3的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | window.location.reload(); |
| | | } |
| | | }, |
| | | initWebSocket () { |
| | |
| | | const parms = obj.params; |
| | | // const xiaoche = obj.params[3]; |
| | | |
| | | console.log(parms); |
| | | |
| | | // console.log(parms); |
| | | //清除id |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | //ID |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | //手动状态 |
| | | for (let i = 0; i < jsonData2.length; i++) { |
| | | let arr = jsonData2[i]; |
| | | for (let j = 0; j < arr.length; j++) { |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | //扫描枪扫码的ID |
| | | jsonData2.forEach((item) => { |
| | | item.forEach((subItem) => { |
| | | if (subItem.read === 66) { |
| | |
| | | }); |
| | | |
| | | |
| | | |
| | | //A01当前格子 |
| | | let lastParmsArray = parms[parms.length - 1]; |
| | | |
| | | let lastParmsIndex = 0; |
| | |
| | | .red-button{ |
| | | background-color: red; |
| | | } |
| | | .yellow-button{ |
| | | background-color: yellow; |
| | | } |
| | | |
| | | </style> |
| | |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div class="item-row"> |
| | | <span class="name" style="width:250px;">{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" class="input-box" @keyup.enter.native="submitDataToBackend" ></el-input> |
| | | |
| | | |
| | | |
| | | <el-button |
| | | <!-- <el-button |
| | | v-if="item.type === '0' && item.name !== '格子间距' && item.name !== '出片接片地址' && item.name !== '存片接片地址'" |
| | | class="input-box" @click="submitDataToBackend();">取地址</el-button> |
| | | class="input-box" @click="submitDataToBackend();">取地址</el-button> --> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | <div v-for="(item, itemIndex) in dataGroup" :key="itemIndex" class="item-container"> |
| | | <div class="item-row"> |
| | | <span class="name" style="width:250px;">{{ item.name }}</span> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" class="input-box"></el-input> |
| | | <el-button v-if="item.type === '0'" class="input-box" @click="submitDataToBackend();">取地址</el-button> |
| | | <el-input v-if="item.type === '0'" v-model="item.value" class="input-box" @keyup.enter.native="submitDataToBackend"></el-input> |
| | | <!-- <el-button v-if="item.type === '0'" class="input-box" @click="submitDataToBackend();">取地址</el-button> --> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | </el-breadcrumb> |
| | | |
| | | <el-row :gutter="26"> |
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex"> |
| | | <el-card class="json-block" style="width:auto;"> |
| | | <el-col :span="12" v-for="(dataGroup, groupIndex) in jsonData" :key="groupIndex" style="margin-bottom: -20px;"> |
| | | <el-card class="json-block" style="width:auto;margin-bottom: 10px;"> |
| | | <el-row > |
| | | <el-col v-for="(item, itemIndex) in dataGroup" :key="itemIndex" :span="12"> |
| | | <div class="item-container"> |
| | |
| | | |
| | | }, |
| | | methods: { |
| | | |
| | | updateButtonValue(dataGroup, itemIndex) { |
| | | // 将当前按钮的值设为1 |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | this.$set(dataGroup[itemIndex].button, 'value', 1); |
| | | |
| | | |
| | | // 将其他按钮的值设为0 |
| | | // dataGroup.forEach((item, index) => { |
| | | // if (index !== itemIndex && item.button) { |
| | | // this.$set(item.button, 'value', 0); |
| | | // } |
| | | // }); |
| | | }, |
| | | submitDataToBackend(currentButtonName) { |
| | | if (currentButtonName === '半自动启动') { |
| | | if (currentButtonName === 'A01半自动启动') { |
| | | const data = []; |
| | | |
| | | for (let i = 0; i < 2; i++) { |
| | | for (let i = 0; i < 1; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | |
| | | |
| | | data.push(values); |
| | | } |
| | | |
| | | |
| | | |
| | | const jsonObject = { data }; |
| | |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '复位') { |
| | | |
| | | if (currentButtonName === 'A02半自动启动') { |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(...resetButtonValues); |
| | | const jsonObject2 = { data2 }; |
| | | for (let i = 1; i < 2; i++) { |
| | | const inputData = this.jsonData[i].filter(item => item.type === '0').map(item => { |
| | | return { value: item.value }; |
| | | }); |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | const values2 = inputData.map(item => item.value); |
| | | |
| | | data2.push(values2); |
| | | |
| | | } |
| | | data2.unshift([]); |
| | | const jsonObject = { data:data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString = JSON.stringify(jsonObject); |
| | | console.log('所有Type为0的value:', jsonString); |
| | | socket?.send(jsonString); |
| | | |
| | | } |
| | | |
| | | if (currentButtonName === '复位') { |
| | | const data2 = []; |
| | | const resetButtonValues = this.jsonData.map(item => { |
| | | const buttonItem = item.find(subItem => subItem.button && subItem.button.name === '复位'); |
| | | return buttonItem ? buttonItem.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data2.push(resetButtonValues.flat()); |
| | | |
| | | // 在 data2 数组前面添加两个空数组 |
| | | data2.unshift([], []); |
| | | |
| | | // 创建 jsonObject2 对象,并添加 data2 属性 |
| | | const jsonObject2 = { data: data2 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString2 = JSON.stringify(jsonObject2); |
| | | console.log('所有Type为0的value:', jsonString2); |
| | | socket?.send(jsonString2); |
| | | window.location.reload(); |
| | | } |
| | | |
| | | if (currentButtonName === '回零') { |
| | | const data3 = []; |
| | | const resetButtonValues3 = this.jsonData.map(item => { |
| | | const buttonItem3 = item.find(subItem => subItem.button && subItem.button.name === '回零'); |
| | | return buttonItem3 ? buttonItem3.button.value : null; |
| | | }).filter(value => value !== null); |
| | | |
| | | // 将得到的值添加到 data 数组中 |
| | | data3.push(resetButtonValues3.flat()); |
| | | |
| | | // 在 data3 数组前面添加两个空数组 |
| | | data3.unshift([], [], []); |
| | | |
| | | // 创建 jsonObject2 对象,并添加 data3 属性 |
| | | const jsonObject3 = { data: data3 }; |
| | | |
| | | // 提交数据到后端 |
| | | const jsonString3 = JSON.stringify(jsonObject3); |
| | | console.log('回零:', jsonString3); |
| | | socket?.send(jsonString3); |
| | | window.location.reload(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (currentButtonName === 'A01半自动') { |
| | | const elements = document.getElementsByClassName('special-class'); |
| | | for (let i = 0; i < elements.length; i++) { |
| | |
| | | } |
| | | |
| | | let obj = JSON.parse(msg.data); |
| | | // console.log(obj) |
| | | // console.log(obj) |
| | | const jsonData2 = this.jsonData; |
| | | |
| | | const handleMouseMove = throttle(function(event) { |
| | |
| | | } |
| | | } |
| | | |
| | | for (let i = 0; i < obj.weihuiling[0].length; i++) { |
| | | const weihuilingValue = obj.weihuiling[0][i]; |
| | | |
| | | // 查找jsonData2中带有"button"的对象,并且name等于"故障" |
| | | for (let j = 0; j < jsonData2.length; j++) { |
| | | const section = jsonData2[j]; |
| | | |
| | | for (let k = 0; k < section.length; k++) { |
| | | const item = section[k]; |
| | | |
| | | if (item.button && item.button.name === "未回零") { |
| | | // 更新value属性 |
| | | item.button.value = weihuilingValue; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | }, 200); |
| | | }, 500); |
| | | |
| | | document.addEventListener('mouseover', handleMouseMove); |
| | | }; |
| | |
| | | this.record.params[0] = obj.sig[0];
|
| | |
|
| | | this.record.xyData = this.jsonData.sign;
|
| | |
|
| | | console.log(this.jsonData.sign)
|
| | | for (let a = 0; a < this.record.xyData.length; a++) {
|
| | | this.record.xyData[a].value = this.record.params[0][a];
|
| | |
|
| | |
| | | |
| | | |
| | | List<String> addressList1 = new ArrayList<>(); |
| | | addressList1.add("DB103.32~45"); |
| | | addressList1.add("DB103.46~59"); |
| | | addressList1.add("DB103.60~73"); |
| | | addressList1.add("DB103.74~101"); |
| | | addressList1.add("DB103.102~115"); |
| | | addressList1.add("DB103.116~143"); |
| | | addressList1.add("DB103.144~157"); |
| | | addressList1.add("DB103.158~171"); |
| | | addressList1.add("DB103.172~185"); |
| | | addressList1.add("DB103.200~213"); |
| | | addressList1.add("DB103.228~241"); |
| | | List<Boolean> paramlist = S7control.getinstance().readBits(addressList1); |
| | | // addressList1.add("DB103.32~45"); |
| | | // addressList1.add("DB103.46~59"); |
| | | // addressList1.add("DB103.60~73"); |
| | | // addressList1.add("DB103.74~101"); |
| | | // addressList1.add("DB103.102~115"); |
| | | // addressList1.add("DB103.116~143"); |
| | | // addressList1.add("DB103.144~157"); |
| | | // addressList1.add("DB103.158~171"); |
| | | // addressList1.add("DB103.172~185"); |
| | | // addressList1.add("DB103.200~213"); |
| | | // addressList1.add("DB103.228~241"); |
| | | addressList1.add("DB103.40"); |
| | | addressList1.add("DB103.58"); |
| | | addressList1.add("DB103.72"); |
| | | addressList1.add("DB103.86"); |
| | | addressList1.add("DB103.100"); |
| | | addressList1.add("DB103.114"); |
| | | addressList1.add("DB103.128"); |
| | | addressList1.add("DB103.142"); |
| | | addressList1.add("DB103.156"); |
| | | addressList1.add("DB103.184"); |
| | | addressList1.add("DB103.212"); |
| | | List<String> paramlist = S7control.getinstance().readStrings(addressList1); |
| | | |
| | | |
| | | List<String> addresses = new ArrayList<>(); |
| | |
| | | |
| | | List<Boolean> data2 = S7control.getinstance().ReadBits("DB101.9.2", 10); |
| | | List<String> addressList3 = new ArrayList<>(); |
| | | addressList3.add("DB106.64-DB106.77"); |
| | | List<Boolean> data3 = S7control.getinstance().readBits(addressList3); |
| | | addressList3.add("DB106.64"); |
| | | List<String> data3 = S7control.getinstance().readStrings(addressList3); |
| | | |
| | | List<String> addresses4 = new ArrayList<>(); |
| | | addresses.add("DB106.0"); |
| | | addresses.add("DB106.12"); |
| | | addresses.add("DB106.40"); |
| | | addresses.add("DB106.50"); |
| | | addresses4.add("DB103.52"); |
| | | addresses4.add("DB103.54"); |
| | | addresses4.add("DB103.56"); |
| | | addresses4.add("DB103.60"); |
| | | |
| | | List<Short> data4 = S7control.getinstance().readWords(addresses4); |
| | | |
| | |
| | | |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | short[] params = new short[paramlist.size()]; |
| | | for (int i = 0; i < paramlist.size(); i++) { |
| | | boolean value = paramlist.get(i); |
| | | short[] params = new short[data2.size()]; |
| | | for (int i = 0; i < data2.size(); i++) { |
| | | boolean value = data2.get(i); |
| | | params[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | |
| | | jsonObject.append("params", params); |
| | | jsonObject.append("params", data2); |
| | | jsonObject.append("params", paramlist); |
| | | jsonObject.append("params", data); |
| | | jsonObject.append("params", data3); |
| | | jsonObject.append("params", data4); |
| | |
| | | // Integer Plccount = this.count;
|
| | |
|
| | | // System.out.println(stt);
|
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 20);
|
| | |
|
| | | List<Short> arraylist = S7control.getinstance().ReadWord("DB100.42", 23);
|
| | | // System.out.println(arraylist);
|
| | | // Short[] 存片 = { 1 };
|
| | | // List<Short> 存片1 = new ArrayList<>(Arrays.asList(存片));
|
| | | // Short[] 接片 = { 1 };
|
| | |
| | | if (webSocketServer != null) {
|
| | | List<String> messages = webSocketServer.getMessages();
|
| | |
|
| | | String addressList3 = "DB100.12";
|
| | | String addressList3 = "DB100.42";
|
| | |
|
| | | if (!messages.isEmpty()) {
|
| | | // 将最后一个消息转换为 short 类型的列表
|
| | |
| | |
|
| | | // 写入第yi个地址
|
| | | if (!mergedList.isEmpty()) {
|
| | | // S7control.getinstance().WriteWord(addressList3, mergedList);
|
| | | S7control.getinstance().WriteWord(addressList3, mergedList);
|
| | | System.out.println("messageValue:" + mergedList + " written to PLC at address " + addressList3);
|
| | | }
|
| | |
|
| | |
| | | return FileUtils.readFileToString(file, "UTF-8"); |
| | | } |
| | | |
| | | public void readValue() { |
| | | String str = ""; |
| | | BufferedReader bufferedReader = null; |
| | | FileInputStream fileInputStream; |
| | | try { |
| | | // 从文件中读取字节数据存入 fileInputStream |
| | | fileInputStream = new FileInputStream("CanadaMes-ui/src/configuration/address.json"); |
| | | // 读取 fileInputStream 中字节并将其解码为字符 |
| | | InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8"); |
| | | // 提高读取效率,在 BufferedReader 内包装 InputStreamReader |
| | | bufferedReader = new BufferedReader(inputStreamReader); |
| | | String line = null; |
| | | // 将 bufferedReader 内容一行一行赋值给str |
| | | while ((line = bufferedReader.readLine()) != null) { |
| | | str += line; |
| | | |
| | | |
| | | |
| | | public void insertDataToList(List<Short> list, String rangeAddress, int insertIndex) { |
| | | if (list.size() >= insertIndex + 14) { |
| | | List<Short> rangeData = new ArrayList<>(); |
| | | byte[] byteData = S7control.getinstance().ReadByte(rangeAddress, 14); |
| | | if (byteData != null && byteData.length == 14) { |
| | | for (byte b : byteData) { |
| | | rangeData.add((short) b); |
| | | } |
| | | } else { |
| | | // 读取数据失败,添加默认值 |
| | | for (int i = 0; i < 14; i++) { |
| | | rangeData.add((short) -1); |
| | | } |
| | | } |
| | | |
| | | // 将str字符串格式转为json |
| | | JSONObject jsonObject = new JSONObject(str); |
| | | |
| | | // 获取json中的值 |
| | | JSONArray address = jsonObject.getJSONArray("ServoManualone"); |
| | | for (int i = 0; i < address.size(); i++) { |
| | | JSONObject ress = (JSONObject) address.get(i); |
| | | |
| | | this.name = ress.getStr("name"); |
| | | this.count = ress.getInt("count"); |
| | | |
| | | } |
| | | |
| | | } catch (FileNotFoundException e) { |
| | | e.printStackTrace(); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | list.addAll(insertIndex, rangeData); |
| | | } |
| | | } |
| | | |
| | |
| | | public void run() { |
| | | while (this != null) { |
| | | try { |
| | | Thread.sleep(500); |
| | | Thread.sleep(1000); |
| | | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // this.readValue(); |
| | | // String PlcAddress = this.name; |
| | | // Integer Plccount = this.count; |
| | | |
| | | |
| | | List<String> addresses = new ArrayList<>(); |
| | | addresses.add("DB103.25"); |
| | | addresses.add("DB100.144"); |
| | | addresses.add("DB100.148-161"); |
| | | |
| | | addresses.add("DB100.184"); |
| | | addresses.add("DB100.186"); |
| | | addresses.add("DB100.180"); |
| | |
| | | |
| | | List<Short> arraylist = S7control.getinstance().readWords(addresses); |
| | | |
| | | // String rangeAddress = "DB100.148-161"; |
| | | String rangeAddress = "DB100.148"; |
| | | int insertIndex = 2; |
| | | insertDataToList(arraylist, rangeAddress, insertIndex); |
| | | |
| | | |
| | | List<String> addresses2 = new ArrayList<>(); |
| | | addresses2.add("DB103.26"); |
| | | addresses2.add("DB100.188"); |
| | | addresses2.add("DB100.190"); |
| | | addresses2.add("DB100.146"); |
| | | addresses2.add("DB100.162-175"); |
| | | // addresses2.add("DB100.162-175"); |
| | | List<Short> arraylist2 = S7control.getinstance().readWords(addresses2); |
| | | |
| | | // String rangeAddress2 = "DB100.148-161"; |
| | | String rangeAddress2 = "DB100.162"; |
| | | int insertIndex2 = 4; |
| | | insertDataToList(arraylist2, rangeAddress2, insertIndex2); |
| | | // System.out.println(arraylist2); |
| | | List<String> addresses3 = new ArrayList<>(); |
| | | addresses3.add("DB103.42"); |
| | | List<Short> arraylist3 = S7control.getinstance().readWords(addresses3); |
| | |
| | | addresses7.add("DB104.28"); |
| | | addresses7.add("DB104.30"); |
| | | List<Short> arraylist7 = S7control.getinstance().readWords(addresses7); |
| | | // List<String> addresses8 = new ArrayList<>(); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // addresses8.add("DB103.26"); |
| | | // List<Short> arraylist8 = S7control.getinstance().readWords(addresses8); |
| | | |
| | | |
| | | List<String> addresses8 = new ArrayList<>(); |
| | | addresses8.add("DB101.3.7"); |
| | | addresses8.add("DB101.4.2"); |
| | | addresses8.add("DB101.4.5"); |
| | | addresses8.add("DB101.4.7"); |
| | | List<Boolean> arraylist8 = S7control.getinstance().readBits(addresses8); |
| | | short[] params = new short[arraylist8.size()]; |
| | | for (int i = 0; i < arraylist8.size(); i++) { |
| | | boolean value = arraylist8.get(i); |
| | | params[i] = value ? (short) 1 : (short) 0; |
| | | } |
| | | |
| | | |
| | | // Short[] values1 = { 1, 2, 3, 4, 5, 6, 7}; |
| | | // List<Short> arraylist = new ArrayList<>(Arrays.asList(values1)); |
| | | // Short[] values2 = { 1, 2, 3, 4, 5}; |
| | | // List<Short> arraylist2 = new ArrayList<>(Arrays.asList(values2)); |
| | | |
| | | // |
| | | // Short[] values3 = {1}; |
| | | // List<Short> arraylist3 = new ArrayList<>(Arrays.asList(values3)); |
| | | // Short[] values4 = {2}; |
| | |
| | | jsonObject.append("zuhe5", arraylist5); |
| | | jsonObject.append("zuhe6", arraylist6); |
| | | jsonObject.append("guzhang", arraylist7); |
| | | // jsonObject.append("weihuiling", arraylist8); |
| | | jsonObject.append("weihuiling", params); |
| | | |
| | | |
| | | |
| | |
| | | waddresses2.add("DB100.190"); |
| | | waddresses2.add("DB100.146"); |
| | | waddresses2.add("DB100.162-175"); |
| | | |
| | | List<String> waddresses3 = new ArrayList<>(); |
| | | waddresses3.add("DB101.4.0"); |
| | | waddresses3.add("DB101.4.3"); |
| | | waddresses3.add("DB101.3.6"); |
| | | waddresses3.add("DB101.4.1"); |
| | | waddresses3.add("DB101.4.4"); |
| | | waddresses3.add("DB101.4.6"); |
| | | |
| | | |
| | | List<String> waddresses4 = new ArrayList<>(); |
| | | waddresses4.add("DB101.3.7"); |
| | | waddresses4.add("DB101.4.2"); |
| | | waddresses4.add("DB101.4.5"); |
| | | waddresses4.add("DB101.4.7"); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | if (!sValue.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses1, sValue); |
| | | S7control.getinstance().WriteWord(waddresses1, sValue); |
| | | System.out.println("Values " + sValue + " written to PLC at address " + waddresses1); |
| | | } |
| | | } |
| | | |
| | | if (messageArray.getJSONArray(1).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(1); |
| | | JSONArray jsonArray2 = messageArray.getJSONArray(1); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | for (int i = 0; i < jsonArray2.size(); i++) { |
| | | Object value = jsonArray2.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | |
| | | } |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(waddresses2, sValue2); |
| | | S7control.getinstance().WriteWord(waddresses2, sValue2); |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + waddresses2); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | if (messageArray.getJSONArray(2).size() > 0) { |
| | | JSONArray jsonArray3 = messageArray.getJSONArray(2); |
| | | List<Boolean> sValue3 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray3.size(); i++) { |
| | | Object value = jsonArray3.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | boolean val = "1".equals(cleanedValue.trim()); |
| | | sValue3.add(val); |
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 boolean 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue3.isEmpty()) { |
| | | S7control.getinstance().WriteBit(waddresses3, sValue3); |
| | | System.out.println("Values " + sValue3 + " written to PLC at address " + waddresses3); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (messageArray.getJSONArray(3).size() > 0) { |
| | | JSONArray jsonArray4 = messageArray.getJSONArray(3); |
| | | List<Boolean> sValue4 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray4.size(); i++) { |
| | | Object value = jsonArray4.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | boolean val = "1".equals(cleanedValue.trim()); |
| | | sValue4.add(val); |
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 boolean 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue4.isEmpty()) { |
| | | S7control.getinstance().WriteBit(waddresses4, sValue4); |
| | | System.out.println("Values " + sValue4 + " written to PLC at address " + waddresses4); |
| | | } |
| | | } |
| | | |
| | | // 清空消息列表 |
| | | webSocketServer.clearMessages(); |
| | | } |
| | |
| | | Integer Plccount = this.count;
|
| | | // System.out.println(PlcAddress);
|
| | |
|
| | | // List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
|
| | | Boolean[] values = { false, true, true, true, true, true, true, true, true,
|
| | | true, true, true, true, true, true, true, true, true, true, true, true, true, true,
|
| | | true, false, true };
|
| | | List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
|
| | | List<Boolean> paramlist = S7control.getinstance().ReadBits("DB2.0.0", 26);
|
| | | // Boolean[] values = { false, true, true, true, true, true, true, true, true,
|
| | | // true, true, true, true, true, true, true, true, true, true, true, true, true, true,
|
| | | // true, false, true };
|
| | | // List<Boolean> paramlist = new ArrayList<>(Arrays.asList(values));
|
| | |
|
| | | if (paramlist != null) {
|
| | |
|
| | |
| | | Integer Plccount = this.count; |
| | | |
| | | // 根据地址读取PCL数据 |
| | | // List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, |
| | | // Plccount); |
| | | Boolean[] values = { false, false, true, false, true, false, true, false, |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress,Plccount); |
| | | /*Boolean[] values = { false, false, true, false, true, false, true, false, |
| | | true, false, true, false, true, false, |
| | | true, false, true, false, true, false, true, false, true, false, true, false, |
| | | true, false, true, false, true, |
| | | false, true, false, true, false, |
| | | true, false, true, false }; |
| | | List<Boolean> plclist = new ArrayList<>(Arrays.asList(values)); |
| | | List<Boolean> plclist = new ArrayList<>(Arrays.asList(values));*/ |
| | | if (plclist != null) { |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | Integer Plccount = this.count; |
| | | // System.out.println(PlcAddress); |
| | | |
| | | // List<Boolean> plclist = S7control.getinstance().ReadBits("DB102.0.0", 44); |
| | | List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount); |
| | | // List<Boolean> plclist2 = S7control.getinstance().ReadBits("DB102.5.5", 13); |
| | | |
| | | Boolean[] values = { true, true, true, true, true, false, true, false, |
| | | true, false, true, false, true, false, |
| | | true, false, true, false, true, false, true, false, true, false, true, false, |
| | | true, false, true, false, true, |
| | | false, true, false, true, false, |
| | | true, false, true, false, true, false, true, false, null, |
| | | true, false, |
| | | true, false, true, false, true, false, |
| | | true, false, true, false, true, }; |
| | | List<Boolean> plclist = new ArrayList<>(Arrays.asList(values)); |
| | | // Boolean[] values = { true, true, true, true, true, false, true, false, |
| | | // true, false, true, false, true, false, |
| | | // true, false, true, false, true, false, true, false, true, false, true, false, |
| | | // true, false, true, false, true, |
| | | // false, true, false, true, false, |
| | | // true, false, true, false, true, false, true, false, null, |
| | | // true, false, |
| | | // true, false, true, false, true, false, |
| | | // true, false, true, false, true, }; |
| | | // List<Boolean> plclist = new ArrayList<>(Arrays.asList(values)); |
| | | |
| | | if (plclist != null) { |
| | | // 将获取的布尔类型转换为整数类型 |
| | |
| | | Integer Plccount = this.count; |
| | | // System.out.println(PlcAddress); |
| | | |
| | | // List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 10); |
| | | Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0, |
| | | 1, 0, }; |
| | | List<Short> plclist = new ArrayList<>(Arrays.asList(values)); |
| | | List<Short> plclist = S7control.getinstance().ReadWord("DB103.0", 10); |
| | | // Short[] values = { 0, 1, 1, 0, 1, 0, 1, 0, |
| | | // 1, 0, }; |
| | | // List<Short> plclist = new ArrayList<>(Arrays.asList(values)); |
| | | if (plclist != null) { |
| | | |
| | | List<String> Intlist = new ArrayList<>(); |
| | |
| | | package com.example.springboot.component; |
| | | |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite; |
| | | import com.github.xingshuangs.iot.protocol.s7.service.S7PLC; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | | public class S7control { |
| | | |
| | |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteWord(List<String> address, List<Short> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | |
| | | for (int i = 0; i < address.size(); i++) { |
| | | String addr = address.get(i); |
| | | short data = datas.get(i); |
| | | |
| | | if (addr.contains("-")) { |
| | | // 处理范围地址 |
| | | String[] range = addr.split("-"); |
| | | if (range.length == 2) { |
| | | String startAddr = range[0].trim(); |
| | | String endAddr = range[1].trim(); |
| | | |
| | | int startIndex = Integer.parseInt(startAddr.substring(startAddr.indexOf('.') + 1)); |
| | | int endIndex = Integer.parseInt(endAddr.substring(endAddr.indexOf('.') + 1)); |
| | | |
| | | for (int j = startIndex; j <= endIndex; j++) { |
| | | String currentAddress = startAddr.substring(0, startAddr.indexOf('.') + 1) + j; |
| | | s7PLC.writeInt16(currentAddress, data); // 将数据写入当前地址 |
| | | } |
| | | } |
| | | } else { |
| | | // 处理单个地址 |
| | | s7PLC.writeInt16(addr, data); // 将数据写入单个地址 |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | return s7PLC.readInt16(address); |
| | | } |
| | | |
| | | public List<Short> readWords(List<String> addresses) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Short> data = new ArrayList<>(); |
| | | |
| | | for (String address : addresses) { |
| | | if (address.contains("-")) { |
| | | String[] range = address.split("-"); |
| | | String startAddress = range[0]; |
| | | String endAddress = range[1]; |
| | | |
| | | if (startAddress.equals(endAddress)) { |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(startAddress); |
| | | data.add(value); |
| | | } else { |
| | | // 范围地址 |
| | | int startIndex = getIndexFromAddress(startAddress); |
| | | int endIndex = getIndexFromAddress(endAddress); |
| | | |
| | | for (int i = startIndex; i <= endIndex; i++) { |
| | | String currentAddress = getAddressFromIndex(i); |
| | | Short value = s7PLC.readInt16(currentAddress); |
| | | data.add(value); |
| | | } |
| | | } |
| | | } else { |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(address); |
| | | data.add(value); |
| | | } |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | | |
| | |
| | | public byte[] ReadByte(String address, int count) { |
| | | if (s7PLC==null) |
| | | return null; |
| | | |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | return s7PLC.readByte(address,count); |
| | | } |
| | |
| | | } |
| | | |
| | | public List<Boolean> readBits(List<String> addressList) { |
| | | if (s7PLC == null) |
| | | if (s7PLC == null || addressList.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | List<Boolean> result = new ArrayList<>(); |
| | | List<Boolean> values = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | boolean value = s7PLC.readBoolean(address); |
| | | values.add(value); |
| | | } |
| | | |
| | | return values; |
| | | } |
| | | |
| | | |
| | | public List<String> readStrings(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<String> result = new ArrayList<>(); |
| | | |
| | | for (String address : addressList) { |
| | | if (address.contains("~")) { |
| | | String[] range = address.split("~"); |
| | | String startAddress = range[0]; |
| | | String endAddress = range[1]; |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | |
| | | int startIndex = extractAddressNumber(startAddress); |
| | | int endIndex = extractAddressNumber(endAddress); |
| | | |
| | | String prefix = startAddress.substring(0, startAddress.indexOf(".") + 1); |
| | | |
| | | for (int i = startIndex; i <= endIndex; i++) { |
| | | String newAddress = prefix + i; |
| | | result.add(s7PLC.readBoolean(newAddress)); |
| | | } |
| | | } else { |
| | | result.add(s7PLC.readBoolean(address)); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.US_ASCII); |
| | | result.add(str); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public void WriteWord(List<String> address, List<Short> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | |
| | | for (int i = 0; i < address.size(); i++) { |
| | | String addr = address.get(i); |
| | | short data = datas.get(i); |
| | | |
| | | if (addr.contains("-")) { |
| | | outmesid(String.valueOf(data),addr); // 单独处理带破折号的地址 |
| | | } else { |
| | | s7PLC.writeInt16(addr, data); // 将数据写入单个地址 |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void outmesid(String data, String addr) { |
| | | System.out.println("outmesid: " + data); |
| | | List<Byte> glassidlist = new ArrayList<>(); |
| | | String[] parts = addr.split("-"); |
| | | if (parts.length == 2) { |
| | | addr = parts[0]; // 只保留 "-" 前面的部分 |
| | | } |
| | | for (char iditem : data.toCharArray()) { |
| | | glassidlist.add(Byte.valueOf(String.valueOf(iditem))); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | S7control.getinstance().WriteByte(addr, bytes); |
| | | } |
| | | |
| | | |
| | | public List<Short> readWords(List<String> addresses) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Short> data = new ArrayList<>(); |
| | | |
| | | for (String address : addresses) { |
| | | |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(address); |
| | | data.add(value); |
| | | |
| | | } |
| | | |
| | | return data; |
| | | } |
| | | |
| | | private int extractAddressNumber(String address) { |
| | | String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | |
| | | import com.example.springboot.component.PlcPositioning2; |
| | | import com.example.springboot.component.PlcParameter2; |
| | | import com.example.springboot.component.PlcParameter1; |
| | | //import com.example.springboot.component.PlcServoManualone; |
| | | import com.example.springboot.component.PlcServoManualone; |
| | | |
| | | @Component |
| | | @Order(1) |
| | |
| | | |
| | | // new PlcHold().start(); |
| | | |
| | | // new Plcaction().start(); |
| | | // new Plcaction().start(); |
| | | // |
| | | // new Plchome().start(); |
| | | // |
| | | // new PlcParameter().start(); |
| | | // new PlcParameter().start(); |
| | | // |
| | | // new Plcalarm().start(); |
| | | // new Plcalarm().start(); |
| | | // |
| | | // new Plcsign().start(); |
| | | // new Plcsign().start(); |
| | | // |
| | | // new Plcstate().start(); |
| | | // new Plcstate().start(); |
| | | new PlcPositioning1().start(); |
| | | new PlcPositioning2().start(); |
| | | new PlcParameter2().start(); |
| | | new PlcParameter1().start(); |
| | | new PLCAutomaticParameterSetting().start(); |
| | | // new PlcServoManualone().start(); |
| | | new PlcServoManualone().start(); |
| | | } |
| | | } |
| | |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | import com.example.springboot.service.HomeService; |
| | | import com.example.springboot.service.MultiFieldComparator; |
| | | //import com.example.springboot.service.MultiFieldComparator; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.component.S7control; |
| | |
| | | map.put("message", "300"); |
| | | } else { |
| | | homeMapper.Inglassid(north_glass_buffer1s, cage, cell, tier); |
| | | spianMapper.UpdataAddCage1(north_glass_buffer1s.getglasslengthMm(), cage, cell); |
| | | spianMapper.UpdataAddCage1(north_glass_buffer1s.getglasslengthmm(), cage, cell); |
| | | } |
| | | return Result.success(map); |
| | | } |
| | |
| | | List<north_glass_buffer1> listAluminumFrame = homeMapper.SelectAluminumFrameInfoById(FrameBarcode); |
| | | String flip=homeMapper.SelectFlipByFrameBarcode(FrameBarcode); |
| | | for (north_glass_buffer1 north_glass_buffer1 : listAluminumFrame) { |
| | | north_glass_buffer1.setstorageCage(homeMapper.SelectStorageGlassById(north_glass_buffer1.getbarcode())); |
| | | north_glass_buffer1.setOut_slice(homeMapper.SelectQueueByglassid(north_glass_buffer1.getbarcode())); |
| | | // north_glass_buffer1.setstorageCage(homeMapper.SelectStorageGlassById(north_glass_buffer1.getbarcode())); |
| | | // north_glass_buffer1.setOut_slice(homeMapper.SelectQueueByglassid(north_glass_buffer1.getbarcode())); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("listAluminumFrame", listAluminumFrame); |
| | |
| | | |
| | | //HashMap<String,List<Out_slice>> map=new HashMap<String,List<Out_slice>>(); |
| | | // HashMap map=new HashMap<>(); |
| | | // for (Out_slice out_slice : listoutslice) { |
| | | // String key_=out_slice.getState()+"-"; |
| | | // for (Out_slice Out_slice.java : listoutslice) { |
| | | // String key_=Out_slice.java.getState()+"-"; |
| | | // if (map.get(key_)==null) { |
| | | // List<Out_slice> lists=new ArrayList<Out_slice>(); |
| | | // lists.add(out_slice); |
| | | // lists.add(Out_slice.java); |
| | | // map.put(key_, lists); |
| | | // }else{ |
| | | // List<Out_slice> lists=(List<Out_slice>)map.get(key_); |
| | | // lists.add(out_slice); |
| | | // lists.add(Out_slice.java); |
| | | // map.put(key_,lists); |
| | | // } |
| | | // } |
| | |
| | | |
| | | // List<Out_slice> listskey=(List<Out_slice>)map.get("1-"); |
| | | // List<Out_slice> list=new ArrayList<Out_slice>(); |
| | | // for (Out_slice out_slice : listskey) { |
| | | // for (Out_slice Out_slice.java : listskey) { |
| | | // if (list.isEmpty()) { |
| | | // list.add(out_slice); |
| | | // list.add(Out_slice.java); |
| | | // }else{ |
| | | // for (int i=0;i<list.size();i++) { |
| | | // Out_slice out_slice2=list.get(i); |
| | | // if(out_slice.getID()>out_slice2.getID()){ |
| | | // if(Out_slice.java.getID()>out_slice2.getID()){ |
| | | // continue; |
| | | // }else{ |
| | | // list.add(i,out_slice2); |
| | |
| | | private String datecreated;// |
| | | private String FrameBarcode;// |
| | | |
| | | private StorageCage storageCage; |
| | | |
| | | // public void class setstorageCage(StorageCage storageCage){ |
| | | // this.storageCage=storageCage; |
| | | // } |
| | | |
| | | public Integer id() { |
| | | return id; |
| | | } |
| | |
| | | import com.example.springboot.entity.StorageCage; |
| | | import com.example.springboot.entity.alarmmg; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.entity.north_glass_buffer1_frames; |
| | | //import com.example.springboot.entity.north_glass_buffer1_frames; |
| | | import com.example.springboot.entity.Out_slice; |
| | | |
| | | import java.util.List; |
| | |
| | | north_glass_buffer1 SelectBoxNo(String glassid); |
| | | |
| | | //查询出片队列信息 |
| | | @Select("select * from out_slice where state=0 or state=1") |
| | | @Select("select * from Out_slice.java where state=0 or state=1") |
| | | List<Out_slice> SelectProductionqueue(); |
| | | |
| | | //根据玻璃id查询笼内玻璃信息 |
| | |
| | | |
| | | |
| | | //根据玻璃id删除出片队列玻璃 |
| | | @Select("update out_slice set state=3 where id=#{id}") |
| | | @Select("update Out_slice.java set state=3 where id=#{id}") |
| | | void DeleteProductionQueueGlass(Short id); |
| | | |
| | | //根据铝框id查询对应玻璃信息 |
| | |
| | | List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode); |
| | | |
| | | //查询根据id查询 |
| | | @Select("select b.* from storage_cage a inner join out_slice b on a.glass_id=b.glassId where b.glassId=#{glassId}") |
| | | @Select("select b.* from storage_cage a inner join Out_slice.java b on a.glass_id=b.glassId where b.glassId=#{glassId}") |
| | | List<Out_slice> SelectOutSliceById(String glassId); |
| | | |
| | | //查询玻璃id是否 |
| | |
| | | String SelectFlipByFrameBarcode(String frameBarcode); |
| | | |
| | | //查询玻璃是否已存在于出片队列 |
| | | @Select("select * from out_slice where glassid=#{getbarcode} and (state=0 or state=1)") |
| | | @Select("select * from Out_slice.java where glassid=#{getbarcode} and (state=0 or state=1)") |
| | | Out_slice SelectQueueByglassid(String getbarcode); |
| | | |
| | | //查询玻璃是否已存在于出片队列 |
| | | @Select("INSERT INTO out_slice( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, 0, #{flip});") |
| | | @Select("INSERT INTO Out_slice.java( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, 0, #{flip});") |
| | | void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm); |
| | | |
| | | } |
| | |
| | | @Select("select state from queue where type=1") |
| | | String Selectqueuestate(); |
| | | //判断铝框出片表是否有玻璃需要出 |
| | | @Select("SELECT * FROM `out_slice` where state=0 or state=0 order by id limit 1;") |
| | | @Select("SELECT * FROM `Out_slice.java` where state=0 or state=0 order by id limit 1;") |
| | | String SelectOutSlice(); |
| | | //判断铝框出片表是否有玻璃正在出片中 |
| | | @Select("SELECT count(*) FROM `out_slice` where state=1 or state=0 order by id limit 1;") |
| | | @Select("SELECT count(*) FROM `Out_slice.java` where state=1 or state=0 order by id limit 1;") |
| | | int SelectOutSliceshu(); |
| | | } |
| | | |
| | |
| | | // List<Out_slice> resultlist = new ArrayList<Out_slice>(); |
| | | // HashMap map = new HashMap<>(); |
| | | // // HashMap<String,List<Out_slice>> map=new HashMap<String,List<Out_slice>>(); |
| | | // for (Out_slice out_slice : out_slices) { |
| | | // String key_ = out_slice.getState() + "-"; |
| | | // for (Out_slice Out_slice.java : out_slices) { |
| | | // String key_ = Out_slice.java.getState() + "-"; |
| | | // if (map.get(key_) == null) { |
| | | // List<Out_slice> lists = new ArrayList<Out_slice>(); |
| | | // lists.add(out_slice); |
| | | // lists.add(Out_slice.java); |
| | | // map.put(key_, lists); |
| | | // } else { |
| | | // List<Out_slice> lists = (List<Out_slice>) map.get(key_); |
| | | // lists.add(out_slice); |
| | | // lists.add(Out_slice.java); |
| | | // map.put(key_, lists); |
| | | // } |
| | | // } |
| | |
| | | // public static List<Out_slice> Orderbyresult(List<Out_slice> out_slices, int orders) { |
| | | // // orders 排序模式 |
| | | // List<Out_slice> list = new ArrayList<Out_slice>(); |
| | | // for (Out_slice out_slice : out_slices) { |
| | | // for (Out_slice Out_slice.java : out_slices) { |
| | | // if (list.isEmpty()) { |
| | | // list.add(out_slice); |
| | | // list.add(Out_slice.java); |
| | | // } else { |
| | | // for (int i = 0; i < list.size(); i++) { |
| | | // Out_slice out_slice2 = list.get(i); |
| | | // if (out_slice.getID() > out_slice2.getID()) { |
| | | // if (Out_slice.java.getID() > out_slice2.getID()) { |
| | | // continue; |
| | | // } else { |
| | | // list.add(i, out_slice2); |
| | |
| | | |
| | | // public static void f() { |
| | | // HashMap map = new HashMap<>(); |
| | | // for (Out_slice out_slice : listoutslice) { |
| | | // String key_ = out_slice.getState() + "-"; |
| | | // for (Out_slice Out_slice.java : listoutslice) { |
| | | // String key_ = Out_slice.java.getState() + "-"; |
| | | // if (map.get(key_) == null) { |
| | | // List<Out_slice> lists = new ArrayList<Out_slice>(); |
| | | // lists.add(out_slice); |
| | | // lists.add(Out_slice.java); |
| | | // map.put(key_, lists); |
| | | // } else { |
| | | // List<Out_slice> lists = (List<Out_slice>) map.get(key_); |
| | | // lists.add(out_slice); |
| | | // lists.add(Out_slice.java); |
| | | // map.put(key_, lists); |
| | | // } |
| | | // } |