| | |
| | | package com.example.springboot.component; |
| | | |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.javassist.compiler.ast.Symbol; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import com.example.springboot.service.JdbcConnections; |
| | | import com.example.springboot.service.SpianService; |
| | | import com.example.springboot.entity.Glass; |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | |
| | | // \\ TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | | |
| | | // 根据玻璃id获取订单号,单独数据源 |
| | | // try { |
| | | // north_glass_buffer1 glass = jdbcConnections.selectGlass(112); |
| | | // // System.out.println(glass.getOrderId()); |
| | | // } catch (SQLException e) { |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // e.printStackTrace(); |
| | | // } |
| | | //spianService.selectout2("250"); |
| | | List<Short> datas1List = S7control.getinstance().ReadWord("DB106.24", 1);// 获取prc进片请求数据 |
| | | List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8", 1);// 获取进片车状态 |
| | | List<Short> datas1ListState2 = S7control.getinstance().ReadWord("DB105.16", 1);// 获取进片车任务是否启动 |
| | |
| | | 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 aaa=1; |
| | | // 当进片小车完成任务时 |
| | | if (B01backs == true) { |
| | | // 当B01小车汇报完成时更改玻璃状态为1 |
| | | spianMapper.UpdateCageOver(B01glassid.toString(), 1);// 更改笼子表进片状态 |
| | | spianMapper.Updatetask(1, 0);// 更改进片任务状态为1 |
| | | spianMapper.UpdatetaskOut(B01glassid.toString()); // 完成上一次出片或者进片任务 |
| | | spianMapper.OverOutSlice(B01glassid.toString(), 2);// 完成出片队列任务 |
| | | spianMapper.UpdataGlassCage(B01glassid.toString(),0);// 清除出片格子玻璃信息 |
| | | // 当B01小车汇报完成时更改玻璃状态 为1 |
| | | spianService.overtask(B01glassid.toString());// 完成任务 |
| | | S7control.getinstance().WriteWord("DB106.60", (short) 0);// 恢复B01小车应答改为0 |
| | | System.out.println("汇报时B01|" + B01glassid); |
| | | |
| | | // S7control.getinstance().WriteWord("DB105.48", (short) 1);//汇报B01小车收到 |
| | | System.out.println("汇报时B01|第"+aaa+"次"+ B01glassid); |
| | | aaa+=1; |
| | | } |
| | | |
| | | // 当出片小车完成任务时 |
| | | if (B02backs == true) { |
| | | // 当B02小车汇报完成时更改玻璃状态为0 |
| | | spianMapper.UpdateCageOver(B02glassid.toString(), 0);// 更改笼子表出片状态 |
| | | spianMapper.UpdatetaskOut(B02glassid.toString()); // 完成上一次出片或者进片任务 |
| | | spianMapper.OverOutSlice(B02glassid.toString(), 2);// 完成出片队列任务 |
| | | spianMapper.UpdataGlassCage(B01glassid.toString(),0);// 清除出片格子玻璃信息 |
| | | spianService.overtask(B02glassid.toString());// 完成任务 |
| | | S7control.getinstance().WriteWord("DB106.62", (short) 0);// 恢复B02小车应答改为0 |
| | | // S7control.getinstance().WriteWord("DB105.50", (short) 1);//汇报B02小车收到 |
| | | System.out.println("汇报时B02|" + B02glassid); |
| | | } |
| | | |
| | |
| | | StringBuilder queueid1 = spianService.queGlassid("DB106.26", 14);// 获取请求的id跟DO1同时清 |
| | | // 获取DO2数据 |
| | | StringBuilder queueid2 = spianService.queGlassid("DB103.58", 14); |
| | | System.out.println("D01|" + queueid1); |
| | | System.out.println("D02|" + queueid2); |
| | | |
| | | int questate = spianMapper.Selectquecount(queueid1.toString());// 判断扫码位是否有玻璃已确认 |
| | | // queueid1.toString().isEmpty() |
| | | north_glass_buffer1 glass1 = spianMapper.selectGlass(queueid1.toString());// D01的玻璃信息 |
| | | north_glass_buffer1 glass2 = spianMapper.selectGlass(queueid2.toString());// D02玻璃信息 |
| | | // 当扫码位玻璃id为空时 宽度为0 |
| | | |
| | | if (queueid1 != null && questate == 0) { |
| | | // 写入D01的数据到上片队列表 |
| | | if (glass1 == null) { // 当没有值时传空 |
| | |
| | | } else { |
| | | |
| | | spianMapper.Updatequeue(queueid1.toString(), glass1.getordernumber(), glass1.getlistnumber(), |
| | | glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(), |
| | | glass1.getglasslength().toString(), glass1.getglassheight().toString(), 1); |
| | | glass1.getboxnumber(), 0, glass1.getglasslengthmm().toString(), glass1.getglassheightmm().toString(), |
| | | glass1.getglasslength().toString(), glass1.getglassheight().toString(), 1); |
| | | } |
| | | |
| | | } |
| | |
| | | spianMapper.Updatequeue(null, null, null, null, 0, null, null, null, null, 2); |
| | | } else { |
| | | spianMapper.Updatequeue(queueid2.toString(), glass2.getordernumber(), glass2.getlistnumber(), |
| | | glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(), |
| | | glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2); |
| | | glass2.getboxnumber(), 0, glass2.getglasslengthmm().toString(), glass2.getglassheightmm().toString(), |
| | | glass2.getglasslength().toString(), glass2.getglassheight().toString(), 2); |
| | | spianMapper.overqueue2(queueid2.toString(), 0, 1);// 更改扫码位任务表的状态为0 |
| | | S7control.getinstance().WriteWord("DB105.16", (short) 0);// 关闭任务启动 |
| | | } |
| | |
| | | boolean outstate = false;// 出片车空闲判断 |
| | | boolean outstate1 = false;// 出片车任务是否启动 |
| | | if (outlist != null && outlist1 != null) { |
| | | // 判断按订单出片 |
| | | |
| | | outstate = outlist.contains((short) 0);// 出片车空闲判断 当出片车空闲时为true |
| | | outstate1 = outlist1.contains((short) 1);// 出片车任务是否启动 当出片车任务启动时为true |
| | | |
| | | north_glass_buffer1 glass = spianMapper.SelectDBOut();// 判断是否有调拨后的出片任务未完成 |
| | | |
| | | if (!outglassbegin & !outstate)// 当任务还未开始,且出片车不空闲时,任务状态改为开始 |
| | | { |
| | | outglassbegin = true; |
| | | } |
| | | if (outglassbegin & outstate)// 当任务开始且出片车空闲时 |
| | | { |
| | | outglassbegin = false; |
| | | } |
| | | |
| | | if (outstate == true & glass.getbarcode() != null) { // 当出片车空闲且有出片任务待完成时 |
| | | // 判断有两个出片或调拨任务时并且出片id和未完成的出片任务id不一样时执行出片 |
| | | if (!writedstrIdOut.toString().equals(glass.getbarcode().toString())) { |
| | | spianService.selectout2(glass.getbarcode().toString()); |
| | | outstate = false; |
| | | } |
| | | } |
| | | // 判断当前是否有未执行的任务 |
| | | int outnum = spianMapper.SelectOutSliceshu(); |
| | | // 当没有任务执行并且出片车空闲时 |
| | | if (outnum == 0 && outstate == true) { |
| | | if (outnum == 0 && outstate == true && Plchome.isAllowQueue == true) { |
| | | // 判断铝框出片队列表是否有待出片的玻璃 |
| | | String outglassid = spianMapper.SelectOutSlice(); |
| | | if (outglassid != null) { |
| | | |
| | | |
| | | spianService.selectout2(outglassid); |
| | | outstate = false; |
| | | } |