Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
# Conflicts:
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
| | |
| | | "type": "3", |
| | | "page": "1" |
| | | } |
| | | ,{ |
| | | "name": "B02.SR right in pos error", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A01 servo turn homed", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A02 servo turn homed", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A01 servo travel homed", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A02 servo travel homed", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "B01 servo travel homed", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "B02 servo travel homed", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "resetDelay", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A01 travel Negative limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A01 travel Positive limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A01 turn up limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A01 turn down limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A02 travel Negative limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A02 travel Positive limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A02 turn up limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } ,{ |
| | | "name": "A02 turn down limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | },{ |
| | | "name": "B01 travel Negative limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | },{ |
| | | "name": "B01 travel Positive limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | },{ |
| | | "name": "B02 travel Negative limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | },{ |
| | | "name": "B02 travel Positive limit", |
| | | "value": "1", |
| | | "state": "1", |
| | | "type": "3", |
| | | "page": "1" |
| | | } |
| | | ], |
| | | "address": [ |
| | | { |
| | | "name": "DB104.0.0", |
| | | "count": 71 |
| | | "count": 91 |
| | | } |
| | | ] |
| | | } |
| | |
| | | "Parameter": "参数设置",
|
| | | "Action": "开关控制",
|
| | | "Sign": "IO状态",
|
| | | "State": "设备状态",
|
| | | "State": "状态",
|
| | | "Alarm": "报警信息",
|
| | | "Distribute": "下发",
|
| | | "Search": "搜索",
|
| | |
| | | // import Tag from '../layout/tag.vue'; |
| | | // import store from '../store'; |
| | | let socket; |
| | | |
| | | let timer; |
| | | export default { |
| | | name: "Layout", |
| | | // store, |
| | |
| | | }, |
| | | //45秒复位倒数计时 |
| | | CountDown() { |
| | | clearInterval(timer); |
| | | let count = 45; |
| | | let timer = setInterval( |
| | | timer = setInterval( |
| | | () => { |
| | | if (this.EmergencyStop == true) { |
| | | this.dialogFormCountDown = false; |
| | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/ServoManualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') |
| | | }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') |
| | | }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | |
| | | active-class="blue-button" |
| | | >{{ $t("Alarm") }}</router-link |
| | | > |
| | | <router-link |
| | | <!-- <router-link |
| | | to="/Electrical/State" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("State") }}</router-link |
| | | > |
| | | > --> |
| | | <!-- <router-link |
| | | to="/Electrical/Action" |
| | | tag="el-button" |
| | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
|
| | | }}</router-link>
|
| | | <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
|
| | | }}</router-link> -->
|
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
|
| | | }}</router-link> -->
|
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | |
| | | active-class="blue-button" |
| | | >{{ $t("Alarm") }}</router-link |
| | | > |
| | | <router-link |
| | | <!-- <router-link |
| | | to="/Electrical/State" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("State") }}</router-link |
| | | > |
| | | > --> |
| | | <!-- <router-link |
| | | to="/Electrical/Action" |
| | | tag="el-button" |
| | |
| | | active-class="blue-button" |
| | | >{{ $t("Alarm") }}</router-link |
| | | > |
| | | <router-link |
| | | <!-- <router-link |
| | | to="/Electrical/State" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("State") }}</router-link |
| | | > |
| | | > --> |
| | | <!-- <router-link |
| | | to="/Electrical/Action" |
| | | tag="el-button" |
| | |
| | | active-class="blue-button" |
| | | >{{ $t("Alarm") }}</router-link |
| | | > |
| | | <router-link |
| | | <!-- <router-link |
| | | to="/Electrical/State" |
| | | tag="el-button" |
| | | type="text" |
| | | active-class="blue-button" |
| | | >{{ $t("State") }}</router-link |
| | | > |
| | | > --> |
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') |
| | | }}</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') |
| | | }}</router-link> |
| | | <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') |
| | | }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') |
| | | }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') |
| | |
| | |
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
|
| | | }}</router-link>
|
| | | <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
|
| | | }}</router-link> -->
|
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
|
| | | }}</router-link> -->
|
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | |
| | |
|
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
|
| | | }}</router-link>
|
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
|
| | | }}</router-link>
|
| | | <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
|
| | | }}</router-link> -->
|
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
|
| | | }}</router-link> -->
|
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
|
| | |
| | | <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb"> |
| | | |
| | | <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') }}</router-link> |
| | | <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link> |
| | | <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') }}</router-link> --> |
| | | <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') }}</router-link> --> |
| | | <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') }}</router-link> |
| | |
| | | reset: false,
|
| | | isQueueWarning: false,
|
| | | CurrentFrame: [],
|
| | | DeviceList: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
| | | DeviceList: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
| | | GlassIdList: [],
|
| | | Scanningmethod: true,
|
| | | CurrrentGlassId: ""
|
| | |
| | | //console.log("收到数据====" + msg.data);
|
| | | let obj = JSON.parse(msg.data);
|
| | | if (obj.params != null) {
|
| | |
|
| | | this.car1 = 145 + 8.15 * Math.abs(obj.params[0][0] - this.carlist[0]['start']) / Math.abs(this.carlist[0]['end'] - this.carlist[0]['start']) * 100;
|
| | | this.car2 = 210 + 8.15 * Math.abs(obj.params[0][1] - this.carlist[1]['start']) / Math.abs(this.carlist[1]['end'] - this.carlist[1]['start']) * 100;
|
| | | var zhi1=obj.params[0][0];
|
| | | var zhi2=obj.params[0][1];
|
| | | this.car1 = 145 + 8.15 * Math.abs(zhi1 - this.carlist[0]['start']) / Math.abs(this.carlist[0]['end'] - this.carlist[0]['start']) * 100;
|
| | | this.car2 = 210 + 8.15 * Math.abs(zhi2 - this.carlist[1]['start']) / Math.abs(this.carlist[1]['end'] - this.carlist[1]['start']) * 100;
|
| | | // this.car1 = 210 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
|
| | | // this.car2 = 300 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
|
| | | }
|
| | | |
| | | this.tableData = obj.tableData[0];
|
| | | this.cagelist1 = obj.cagelist1[0];
|
| | | this.cagelist2 = obj.cagelist2[0];
|
| | |
| | |
|
| | | //查询当前铝框信息
|
| | | this.CurrentFrame = obj.CurrentFrame;
|
| | | |
| | | //获取设备状态
|
| | | if (obj.DeviceList != null) {
|
| | | this.DeviceList = obj.DeviceList[0];
|
| | | }
|
| | | // if (obj.DeviceList != null) {
|
| | | // this.DeviceList = obj.DeviceList[0];
|
| | | // }
|
| | | //获取设备上的玻璃id
|
| | | if (obj.GlassIdList != null) {
|
| | | this.GlassIdList = obj.GlassIdList[0];
|
| | |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | // spianService.selectAll("X21942610402GV"); |
| | | |
| | | // 出片任务//////////////////////////////// |
| | | List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态 |
| | | List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 出片任务是否启动 |
| | | |
| | | boolean Plcout = spianService.listbool("DB106.64"); // 出片请求字 |
| | | boolean Plcout2 = spianService.listbool("DB105.18"); // 出片启动 |
| | | if (Plcout == false&&Plcout2==true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0 |
| | | System.out.println("关闭出片启动" + LocalDateTime.now());// 出片任务发送字改为0 |
| | | } |
| | | boolean Plcadd = spianService.listbool("DB106.24"); // 进片请求字 |
| | | boolean Plcadd2 = spianService.listbool("DB105.16"); // 进片启动 |
| | | if (Plcadd == false&&Plcadd2==true) { |
| | | S7control.getinstance().WriteWord("DB105.16", (short) 0);//进片任务启动改为0 |
| | | System.out.println("关闭进片启动" + LocalDateTime.now());// 进片任务发送字改为0 |
| | | } |
| | | |
| | | |
| | | |
| | | // StringBuilder writedstrIdOut = new StringBuilder(); |
| | | // 获取已下发的出片id |
| | | byte[] writedglassidbytesOut = S7control.getinstance().ReadByte("DB105.30", 14); |
| | | String writedstrIdOut = new String(writedglassidbytesOut); |
| | | |
| | | boolean outstate = false;// 出片车空闲判断 |
| | | boolean outstate1 = false;// 出片车任务是否启动 |
| | | if (outlist != null && outlist1 != null) { |
| | | |
| | | outstate = outlist.contains((short) 0);// 出片车空闲判断 当出片车空闲时为true |
| | | outstate1 = outlist1.contains((short) 1);// 出片车任务是否启动 当出片车任务启动时为true |
| | | |
| | | |
| | | if (Plcout == true) { |
| | | // 判断当前是否有未执行的任务 |
| | | int outnum = spianMapper.SelectOutSliceshu(); |
| | | int cageoutsum = spianMapper.Selectcageout(3); |
| | | int outnum = spianMapper.SelectOutSliceshu();//是否有正在出片的任务 |
| | | int cageoutsum = spianMapper.Selectcageout(3);//笼子内是否还有在出片的玻璃 |
| | | // 当没有任务执行并且出片车空闲时 |
| | | if (outnum == 0 && outstate == true && Plchome.isAllowQueue == true && cageoutsum == 0) { |
| | | if (outnum == 0 && Plchome.isAllowQueue == true && cageoutsum == 0) { |
| | | // 判断铝框出片队列表是否有待出片的玻璃 |
| | | String outglassid = spianMapper.SelectOutSlice(); |
| | | // 当有待出片的玻璃时 |
| | |
| | | if (glassdisabled == 0) { |
| | | spianService.selectout2(outglassid); |
| | | Plchome.isQueueWarning = false; |
| | | outstate = false; |
| | | } else { // 禁用更改状态弹出提示 |
| | | Plchome.isQueueWarning = true; |
| | | } |
| | | |
| | | } |
| | | } |
| | | if (outstate == true) {// 当出片车空闲时,且出片启动为1时,任务启动改为0 |
| | | if (outstate1 == true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0 |
| | | System.out.println("关闭启动" + LocalDateTime.now()); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | ///////////// 进片任务 |
| | |
| | | List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 获取进片车任务是否启动 |
| | | |
| | | boolean B01backs = spianService.listbool("DB106.60");// b01汇报 |
| | | |
| | | boolean B02backs = spianService.listbool("DB106.62");// b02汇报 |
| | | StringBuilder B01glassid = spianService.queGlassid("DB103.184", 14);// BO1的玻璃id |
| | | StringBuilder B02glassid = spianService.queGlassid("DB103.212", 14);// B02的玻璃id |
| | |
| | | int HB = spianMapper.SelectHB(B01glassid.toString()); |
| | | if (HB > 0) { |
| | | // 当B01小车汇报完成时更改玻璃状态 为1 |
| | | S7control.getinstance().WriteWord("DB106.60", (short) 0);// 恢复B01小车应答改为0 |
| | | boolean yingda = spianService.listbool("DB106.60");// b01汇报 |
| | | if(yingda==false){ |
| | | S7control.getinstance().WriteWord("DB105.48", (short) 1);// 恢复B01小车应答改为1 |
| | | boolean yingda = spianService.listbool("DB105.48");// b01汇报 |
| | | if (yingda == true) { |
| | | spianService.overtask(B01glassid.toString());// 完成任务 |
| | | } |
| | | System.out.println("汇报时B01|第" + aaa + "次" + B01glassid + "应答" + yingda); |
| | | aaa += 1; |
| | | } |
| | | |
| | | }else{ |
| | | S7control.getinstance().WriteWord("DB105.48", (short) 0);// 恢复B01小车应答改为1 |
| | | } |
| | | |
| | | // 当出片小车完成任务时 |
| | | if (B02backs == true) { |
| | | // 判断是否汇报正确的id |
| | | int HB = spianMapper.SelectHB(B02glassid.toString()); |
| | | System.out.println("汇报时B02|" + B02glassid); |
| | | if (HB > 0) { |
| | | // 当B02小车汇报完成时更改玻璃状态为0 |
| | | |
| | | S7control.getinstance().WriteWord("DB106.62", (short) 0);// 恢复B02小车应答改为0 |
| | | System.out.println("汇报时B02|" + B02glassid); |
| | | boolean yingda = spianService.listbool("DB106.62");// b02汇报 |
| | | if (yingda == false) { |
| | | S7control.getinstance().WriteWord("DB105.50", (short) 1);// 恢复B02小车应答改为1 |
| | | System.out.println("汇报时B02ID|" + B02glassid); |
| | | boolean yingda = spianService.listbool("DB105.50");// b02汇报 |
| | | if (yingda == true) { |
| | | spianService.overtask(B02glassid.toString());// 完成任务 |
| | | } |
| | | System.out.println("汇报时B02|第" + aaa + "次" + B02glassid + "应答" + yingda); |
| | | } |
| | | }else{ |
| | | S7control.getinstance().WriteWord("DB105.50", (short) 0);// 恢复B02小车应答改为0 |
| | | } |
| | | |
| | | |
| | | // 获取DO1数据 |
| | | StringBuilder queueid1 = spianService.queGlassid("DB106.26", 14);// 获取请求的id跟DO1同时清 |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | if (queueid2 != null) { |
| | | // 写入D02的数据到上片队列表 |
| | | if (glass2 == null) { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | // if (outstate == true) { // 出片车状态空闲时 |
| | | // Integer state = spianMapper.Selectoutstate(); |
| | | // String orderid = spianMapper.SelectOrderout(); |
| | | |
| | | // if (orderid != null && state == 0) { |
| | | // spianService.selectout(orderid); |
| | | // } |
| | | // } |
| | | |
| | | // 查询数据库 |
| | | // 推送到前端 |
| | |
| | | @Override
|
| | | public void run() {
|
| | | while (this != null) {
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | |
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | JSONObject jsonObject = new JSONObject();
|
| | |
|
| | | // 注入mapper
|
| | | // 注入mapper
|
| | |
|
| | | homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
|
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
|
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
|
| | | outSliceServive = WebSocketServer.applicationContext.getBean(OutSliceServive.class);
|
| | | north_Glass_Buffer1Service = WebSocketServer.applicationContext.getBean(North_Glass_Buffer1Service.class);
|
| | | storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
|
| | | dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
|
| | |
|
| | | // 笼子使用情况
|
| | | List<StorageCage> tableData = homeMapper.selectAll();
|
| | | jsonObject.append("tableData", tableData);
|
| | |
| | | Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
|
| | | jsonObject.append("CurrentFrame", CurrentFrame);
|
| | |
|
| | | // List<Short> listd17 = S7control.getinstance().ReadWord("DB17.0",10);
|
| | | // String id=spianService.queGlassid("DB17.10", 14).toString();
|
| | | //
|
| | | // // 铝框线交互
|
| | | // try {
|
| | | // if (CurrentFrame != null) {
|
| | | // spianService.outmesid(CurrentFrame.getBarCode(), "DB17.0");
|
| | | // }
|
| | | // List<Short> framerequests = S7control.getinstance().ReadWord("铝框id请求字地址", 1);
|
| | | // for (Short framerequest : framerequests) {
|
| | | // if (framerequest == 1) {
|
| | | // // 铝框id
|
| | | // String franmeno = spianService.queGlassid("DB17.10", 14).toString();
|
| | | // String position;
|
| | | // try {
|
| | | // position = dbserve.SelectPositionByFrameBarcode(franmeno);
|
| | | // } catch (SQLException e) {
|
| | | // // TODO Auto-generated catch block
|
| | | // position = "0";
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | // Short send;
|
| | | // if (position == "0") {
|
| | | // send = 0;
|
| | | // } else {
|
| | | // send = 1;
|
| | | // }
|
| | | // S7control.getinstance().WriteWord("铝框翻转发送地址", (short) send);
|
| | | // }
|
| | | // }
|
| | | // } catch (Exception e) {
|
| | | // // TODO: handle exception
|
| | | // }
|
| | | // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
|
| | | // String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14));
|
| | |
|
| | | |
| | |
|
| | | |
| | | |
| | |
|
| | | |
| | |
|
| | | // 铝框线交互
|
| | | if (CurrentFrame != null) {
|
| | | S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(),"DB17.0");
|
| | | }
|
| | | String E01id=S7controlLK.getinstance().readStrings("DB17.0");
|
| | | String J01id=S7controlLK.getinstance().readStrings("DB17.22");
|
| | | |
| | | List<Short> liststates=S7controlLK.getinstance().ReadWord("DB17.38", 1);
|
| | | List<Short> liststate=S7controlLK.getinstance().ReadWord("DB17.20", 1);
|
| | | Short framerequest = liststate.get(0);
|
| | | if (framerequest == 1) {
|
| | | // 铝框id
|
| | | String position;
|
| | | try {
|
| | | position = dbserve.SelectPositionByFrameBarcode(J01id);
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | position = "0";
|
| | | e.printStackTrace();
|
| | | }
|
| | | Short send;
|
| | | if (position.equals("0")) {
|
| | | send = 0;
|
| | | } else {
|
| | | send = 1;
|
| | | }
|
| | | S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | if (S7control.getinstance().CheckConnected() == true) {
|
| | | // 获取当前扫码方式
|
| | |
| | | if (inglassInfo.size() > 0) {
|
| | | jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
|
| | | }
|
| | |
|
| | | }
|
| | | // // 获取铝框idDB106.DBW64,添加到出片队列
|
| | | // String frameno="X21763329601FB";
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
|
| | | dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | |
| | | |
| | | boolean dbconnected = false;
|
| | | try {
|
| | | dbserve.getConn();
|
New file |
| | |
| | | package com.example.springboot.component; |
| | | |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.ByteOrder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.sql.Time; |
| | | 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; |
| | | import org.apache.ibatis.jdbc.Null; |
| | | |
| | | public class S7controlLK { |
| | | |
| | | S7PLC s7PLC; // PLC通讯类实例 |
| | | private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型 |
| | | private String ip = "192.168.10.101"; // plc ip地址 |
| | | private int port = 102; // plc 端口号 |
| | | |
| | | private static volatile S7controlLK instance = null; |
| | | |
| | | private S7controlLK() { |
| | | if (s7PLC == null) |
| | | s7PLC = new S7PLC(plcType, ip, port, 0, 0); |
| | | } |
| | | |
| | | // 单例模式 获取类的唯一实例 |
| | | public static S7controlLK getinstance() { |
| | | if (instance == null) { |
| | | synchronized (S7controlLK.class) { |
| | | if (instance == null) |
| | | instance = new S7controlLK(); |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | /** |
| | | * 关闭西门子s7通讯连接 |
| | | */ |
| | | public void CloseS7client() { |
| | | if (s7PLC == null) |
| | | s7PLC.close(); |
| | | s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * s7通讯连接状态 |
| | | */ |
| | | public boolean CheckConnected() { |
| | | return s7PLC.checkConnected(); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个word |
| | | * |
| | | * @param address 地址 |
| | | * @param data word的值 |
| | | */ |
| | | public void WriteWord(String address, short data) { |
| | | if (s7PLC == null) { |
| | | return; |
| | | } |
| | | s7PLC.writeInt16(address, data); |
| | | } |
| | | |
| | | /** |
| | | * 从某地址连续 写入多个word |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteWord(String address, List<Short> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 16); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addInt16(addresslist.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个word |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | |
| | | /** |
| | | * 按指定的地址 写入一个Bit |
| | | * |
| | | * @param address 地址 |
| | | * @param data Bit的值 |
| | | */ |
| | | public void WriteBit(String address, Boolean data) { |
| | | if (s7PLC == null) |
| | | return; |
| | | s7PLC.writeBoolean(address, data); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个bit |
| | | * |
| | | * @param address 地址 |
| | | * @param datas bit的值 |
| | | */ |
| | | public void WriteBit(List<String> address, List<Boolean> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < address.size(); i++) { |
| | | addressWrite.addBoolean(address.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 从某地址连续 写入多个bit |
| | | * |
| | | * @param address 地址 |
| | | * @param datas word的值 |
| | | */ |
| | | public void WriteBit(String address, List<Boolean> datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | List<String> addresslist = GetAddressList(address, datas.size(), 1); |
| | | MultiAddressWrite addressWrite = new MultiAddressWrite(); |
| | | for (int i = 0; i < datas.size(); i++) { |
| | | addressWrite.addBoolean(addresslist.get(i), datas.get(i)); |
| | | } |
| | | s7PLC.writeMultiData(addressWrite); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 写入多个byte |
| | | * |
| | | * @param address 地址 |
| | | * @param datas byte的值 |
| | | */ |
| | | public void WriteByte(String address, byte[] datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | // s7PLC.write(address, data); |
| | | s7PLC.writeByte(address, datas); |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(List<String> address) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | |
| | | try { |
| | | return s7PLC.readInt16(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | private int getIndexFromAddress(String address) { |
| | | |
| | | // 可以解析出地址中的数字部分,并转换为整数 |
| | | return 0; |
| | | } |
| | | |
| | | private String getAddressFromIndex(int index) { |
| | | |
| | | // 整数转换为地址格式的字符串 |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取word结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个word |
| | | * @return 结果 |
| | | */ |
| | | public List<Short> ReadWord(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | |
| | | List<String> addresslist = GetAddressList(address, count, 16); |
| | | try { |
| | | return s7PLC.readInt16(addresslist); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 读取byte结果集 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 连续读多少个byte |
| | | * @return 结果 |
| | | */ |
| | | public byte[] ReadByte(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | // List<String> addresslist = GetAddressList(address, count, 16); |
| | | |
| | | try { |
| | | return s7PLC.readByte(address, count); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 按指定的地址 按bit位 0 flase 1 true 读取结果 |
| | | * |
| | | * @param addresslist 地址集 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(List<String> addresslist) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | return s7PLC.readBoolean(addresslist); |
| | | } |
| | | |
| | | // 读取不连续地址bit |
| | | public List<Boolean> readBits(List<String> addressList) { |
| | | if (s7PLC == null || addressList.isEmpty()) { |
| | | return null; |
| | | } |
| | | |
| | | List<Boolean> values = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | boolean value = s7PLC.readBoolean(address); |
| | | values.add(value); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | return values; |
| | | } |
| | | |
| | | // 读取String |
| | | public List<String> readStrings(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | result.add(null); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public List<String> readStringsandword(List<String> addressList) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | List<String> result = new ArrayList<>(); |
| | | for (String address : addressList) { |
| | | try { |
| | | if (address.contains("-")) { |
| | | address = address.substring(0, address.indexOf("-")); |
| | | |
| | | byte[] bytes = s7PLC.readByte(address, 14); |
| | | if (bytes != null) { |
| | | String str = new String(bytes, StandardCharsets.UTF_8); |
| | | result.add(str); |
| | | } |
| | | |
| | | } else { |
| | | Short value = s7PLC.readInt16(address); |
| | | result.add(value.toString()); |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | result.add(null); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | // 不连续地址写入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("-")) { |
| | | 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); |
| | | S7controlLK.getinstance().WriteByte(addr, bytes); |
| | | } |
| | | |
| | | // 读取不连续word |
| | | public List<Short> readWords(List<String> addresses) { |
| | | if (s7PLC == null) { |
| | | return null; |
| | | } |
| | | |
| | | List<Short> data = new ArrayList<>(); |
| | | |
| | | for (String address : addresses) { |
| | | try { |
| | | |
| | | // 单个地址 |
| | | Short value = s7PLC.readInt16(address); |
| | | data.add(value); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | |
| | | } |
| | | |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | // 读取时间 |
| | | public Long readtime(String address) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | try { |
| | | return s7PLC.readTime(address); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | public void writetime(String address, long datas) { |
| | | if (s7PLC == null) |
| | | return; |
| | | |
| | | s7PLC.writeTime(address, datas); // 将数据写入单个地址 |
| | | } |
| | | |
| | | private int extractAddressNumber(String address) { |
| | | String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分 |
| | | return Integer.parseInt(numberStr); |
| | | } |
| | | |
| | | /** |
| | | * 从指定的地址开始 连续按bit位读取 |
| | | * |
| | | * @param address 地址 |
| | | * @param count 长度 |
| | | * @return Boolean结果 |
| | | */ |
| | | public List<Boolean> ReadBits(String address, int count) { |
| | | if (s7PLC == null) |
| | | return null; |
| | | List<String> addresslist = GetAddressList(address, count, 1); |
| | | try { |
| | | return s7PLC.readBoolean(addresslist); |
| | | } catch (Exception e) { |
| | | System.out.println("读取 " + address + " 失败:" + e.getMessage()); |
| | | return null; |
| | | } |
| | | |
| | | }; |
| | | |
| | | private List<String> GetAddressList(String address, int count, int addedbit) { |
| | | List<String> addresslist = new ArrayList<String>(); |
| | | |
| | | String[] stringdatas = address.trim().split("\\."); |
| | | if (stringdatas.length < 2 || !address.startsWith("DB")) |
| | | return null; |
| | | int dbwindex = 0; |
| | | int bitindex = 0; |
| | | if (stringdatas.length == 2) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | } else if (stringdatas.length == 3) { |
| | | dbwindex = Integer.parseInt(stringdatas[1]); |
| | | bitindex = Integer.parseInt(stringdatas[2]); |
| | | } else |
| | | return null; |
| | | |
| | | addresslist.add(address); |
| | | for (int i = 0; i < count - 1; i++) { |
| | | |
| | | int bitcurrent = bitindex + addedbit; |
| | | if (bitcurrent > 7) { |
| | | dbwindex += bitcurrent / 8; |
| | | bitindex = 0; |
| | | } else |
| | | bitindex = bitcurrent; |
| | | |
| | | String endstr = stringdatas.length == 3 ? "." + bitindex : ""; |
| | | addresslist.add(stringdatas[0] + "." + dbwindex + endstr); |
| | | } |
| | | return addresslist; |
| | | } |
| | | |
| | | public void writeStrings(String data, String addr) { |
| | | // List<Byte> glassidlist = new ArrayList<>(); |
| | | String[] parts = addr.split("-"); |
| | | if (parts.length == 2) { |
| | | addr = parts[0]; |
| | | } |
| | | s7PLC.writeString(addr, data); |
| | | } |
| | | |
| | | public String readStrings(String addr) { |
| | | return s7PLC.readString(addr); |
| | | } |
| | | } |
| | |
| | | @Select("select COUNT(if(a.state1=0,cell,0))as cell,ROUND(id/2)as id from (select *,max(state)as state1 from storage_cage a GROUP BY cage,cell)as a where (a.cage=#{cage1}-1 or a.cage=#{cage1}+1)and if(a.cage<6,a.cage>0 and a.cage<6,a.cage>5) and disabled=0 GROUP BY cage ORDER BY cell desc LIMIT 1") |
| | | int selectCage(int cage1); |
| | | // 获取笼子号订单号排序的空订单笼子 |
| | | @Select("select a.cage,FrameBarcode,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1,max(a.state)as state2,disabled,FrameBarcode from storage_cage a left join (select COUNT(*)shu,cage from storage_cage where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY (FrameBarcode=#{Fbarcode} or ''='') desc,shu desc,shu2,state2 asc,cage asc;") |
| | | @Select("select a.cage,FrameBarcode,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1,max(a.state)as state2,disabled,FrameBarcode from storage_cage a left join (select COUNT(*)shu,cage from storage_cage where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY shu desc,shu2,state2 asc,cage asc;") |
| | | List<StorageCage> selectAll(String orderids,String Fbarcode); |
| | | //优先判断一次是否有同铝框的空位 |
| | | @Select("select *,min(state) state1 from storage_cage where width>=(#{width}+#{width2}) GROUP BY cage,cell HAVING state1=0 and FrameBarcode=#{Fbarcode} ORDER BY width desc LIMIT 1;") |
| | |
| | | // #{date}, #{address}, #{userNo})") |
| | | // void insert (Spian spian); |
| | | // 新增任务表 |
| | | @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,count) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{count});") |
| | | void Inserttask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int count); |
| | | @Insert("INSERT INTO `canadames`.`storage_task`(`task_type`, `task_state`, `shelf_rack`, `load_rack`,start_time,glass_id,count,finsh_time) VALUES (#{tasktype},#{taskstate},#{shelfrack},#{loadrack},now(),#{glassid},#{count},#{qidong});") |
| | | void Inserttask(int tasktype, int taskstate, int shelfrack, int loadrack, String glassid, int count,int qidong); |
| | | |
| | | // 修改任务表 |
| | | @Update("update storage_task set task_state=#{state} where task_type=#{type} and task_state=0;") |
| | |
| | | @Select(" select disabled from storage_cage where glass_id=#{glassid} limit 1;") |
| | | int SelectCageGlassState(String glassid); |
| | | //判断汇报的id是否正确 |
| | | @Select("SELECT count(*) FROM `storage_cage` where state!=0 and state!=1 and glass_id=#{glassid}") |
| | | @Select("SELECT count(*) FROM `storage_cage` where state!=0 and glass_id=#{glassid}") |
| | | int SelectHB(String glassid); |
| | | } |
| | |
| | | package com.example.springboot.service; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStreamReader; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | import com.google.common.primitives.Bytes; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | |
| | | @Service |
| | | public class SpianService { |
| | | @Autowired |
| | |
| | | // @GetMapping("/all") |
| | | public Short selectAll(String glassid) { |
| | | |
| | | int cage1=0; |
| | | int cage1 = 0; |
| | | int cells; |
| | | int ids; |
| | | int prcid; |
| | |
| | | double minwidth = 0; |
| | | |
| | | north_glass_buffer1 glasslist = spianMapper.selectGlass(glassid); // 获取玻璃参数 |
| | | //如果没有此id时 |
| | | // 如果没有此id时 |
| | | if (glasslist == null) { |
| | | return (300); |
| | | } |
| | | |
| | | |
| | | double widths = glasslist.getglasslengthmm(); |
| | | String orderids = glasslist.getordernumber(); |
| | | String FrameBarcode = glasslist.getFrameBarcode(); |
| | |
| | | List<Short> datas = new ArrayList<>(); |
| | | |
| | | // String orderid="A001"; |
| | | // 获取订单相关度最高的笼子排序 |
| | | List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode,widths,400); |
| | | //判断铝框指定空格是否需要间隔空间 |
| | | |
| | | |
| | | // 获取铝框相关度最高的笼子排序 |
| | | List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode, widths, 400); |
| | | // 判断铝框指定空格是否需要间隔空间 |
| | | |
| | | if (storageCage.size() == 0) { |
| | | storageCage = spianMapper.selectAll(orderids, FrameBarcode); |
| | | } |
| | |
| | | // 将外片玻璃的数据更新到内片 |
| | | spianMapper.UpdateDBCage(ids, cage1, cells, 1); |
| | | // 将新入的玻璃存入外片 |
| | | // spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids-1, 2); |
| | | |
| | | spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1, cells, ids - 1, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier);// 新增任务 |
| | | |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | boolean qidong = listbool("DB105.16"); |
| | | int qidong2 = 0; |
| | | if (qidong == true) { |
| | | qidong2 = 1; |
| | | } |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier,qidong2);// 新增任务 |
| | | System.out.println("进片任务|" + datas); |
| | | |
| | | } else { |
| | | // 数据库修改笼子表新增一条玻璃 |
| | | // spianMapper.UpdataAddCage(orderids, glassid, widths, cage1, cells, ids, 2); |
| | | |
| | | spianMapper.UpdataAddCage2(orderids, glassid, glasslist, cage1, cells, ids, 2); |
| | | spianMapper.UpdataAddCage1(widths, cage1, cells);// 减少格子宽度 |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier);// 新增任务 |
| | | |
| | | S7control.getinstance().WriteWord(adddresslist, datas); |
| | | boolean qidong = listbool("DB105.16"); |
| | | int qidong2 = 0; |
| | | if (qidong == true) { |
| | | qidong2 = 1; |
| | | } |
| | | spianMapper.Inserttask(0, 0, 1000, ids, glassid.toString(), prctier,qidong2);// 新增任务 |
| | | System.out.println("进片任务|" + datas); |
| | | |
| | | // S7control.getinstance().WriteByte("DB105.16",glassid); |
| | | } |
| | | outmesid(glassid, "DB105.20"); |
| | | return (200); |
| | |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid.toString(), 3);// 更改笼子表的玻璃状态 |
| | | |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, state);// 新增任务 |
| | | // int state = spianMapper.selectGlassState(cage, cell);//获取格子数量 |
| | | // if (state == 2) { |
| | | // spianMapper.UpdateDBCage1(cage, cell);// 将内片数据更新到外片里 |
| | | // spianMapper.UpdateDBCage2(cage, cell);// 清除内片数据 |
| | | // } |
| | | System.out.println("出片任务|" + datas); |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 1);// 出片任务发送字改为1 |
| | | boolean qidong = listbool("DB105.18"); |
| | | int qidong2 = 0; |
| | | if (qidong == true) { |
| | | qidong2 = 1; |
| | | } |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, state, qidong2);// 新增任务 |
| | | outmesid(glassid, "DB105.34");// 派发出片ID |
| | | |
| | | return (200);// 结束 |
| | |
| | | datas.add((short) 1); |
| | | datas.add((short) 1); |
| | | spianMapper.OverOutSlice(glassid.toString(), 1, 0);// 更新出片队列任务状态为进行中 |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, 1);// 新增任务 |
| | | |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.UpdataGlassCageState(glassid, 3);// 更改笼子表的玻璃状态 |
| | | |
| | | System.out.println("出片任务|" + datas); |
| | | outmesid(glassid, "DB105.34");// 派发出片ID |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 1);// 出片任务发送字改为1 |
| | | boolean qidong = listbool("DB105.18"); |
| | | int qidong2 = 0; |
| | | if (qidong == true) { |
| | | qidong2 = 1; |
| | | } |
| | | spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid, 1, qidong2);// 新增任务 |
| | | return (200);// 结束 |
| | | |
| | | } else { |
| | |
| | | spianMapper.UpdateDBCage(ids, cage, cell, 2);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassids, 2);// 新增调度任务 |
| | | // 传输mes数据,坐标,数据 |
| | | System.out.println("出片任务|" + datas); |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 1);// 出片任务发送字改为1 |
| | | outmesid(glassids, "DB105.34");// 派发调拨玻璃ID |
| | | |
| | | boolean qidong = listbool("DB105.18"); |
| | | int qidong2 = 0; |
| | | if (qidong == true) { |
| | | qidong2 = 1; |
| | | } |
| | | spianMapper.Inserttask(2, 0, cageout.getId(), ids, glassids, 2, qidong2);// 新增调度任务 |
| | | |
| | | return (200); // 结束 |
| | | |
| | | } else {// 笼子号大于5时 |
| | |
| | | datas.add((short) 2); |
| | | datas.add((short) 1); |
| | | String glassids = spianMapper.SelectGlassid(cage, cell); // 获取被调拨的玻璃id |
| | | spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态 |
| | | spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassids, 2);// 新增调度任务 |
| | | // spianMapper.Inserttask(1, 0, cageout.getId(), 1000, glassid);// 新增出片任务 |
| | | spianMapper.UpdateDBCage(ids, cage, cell, 2);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | // 传输mes数据,坐标,数据 |
| | | System.out.println("出片任务|" + datas); |
| | | S7control.getinstance().WriteWord(adddresslist, datas);// 派发出片车任务 |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 1);// 出片任务发送字改为1 |
| | | |
| | | outmesid(glassids, "DB105.34");// 派发调拨玻璃ID |
| | | spianMapper.UpdataGlassCageState(glassids, 3);// 更改笼子表的玻璃状态 |
| | | boolean qidong = listbool("DB105.18"); |
| | | int qidong2 = 2; |
| | | if (qidong == true) { |
| | | qidong2 = 1; |
| | | } |
| | | spianMapper.Inserttask(2, 0, cageout.getId() + 1, ids, glassids, 2, qidong2);// 新增调度任务 |
| | | spianMapper.UpdateDBCage(ids, cage, cell, 2);// 将原格子数据更新到新格子里 |
| | | spianMapper.UpdataAddCage1(glasswidth, cages, cells);// 减少新格子宽度 |
| | | spianMapper.UpdataOutCage1(glasswidth, cage, cell);// 增加原格子宽度 |
| | | |
| | | return (200);// 结束 |
| | | |
| | | } |
| | |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | System.out.println("outmesidbytes:" + bytes.length); |
| | | S7control.getinstance().WriteByte(address, bytes);// 派发出片id |
| | | |
| | | } |
| | | |
| | | // 获取地址内的玻璃id转字符串 |
| | |
| | | // } |
| | | |
| | | } |
| | | |
| | | } |