| | |
| | | import com.example.springboot.entity.north_glass_buffer1; |
| | | import com.example.springboot.entity.device.PlcParameterObject; |
| | | import com.example.springboot.mapper.AlarmMapper; |
| | | import com.example.springboot.mapper.AlbaniaMapper; |
| | | import com.example.springboot.mapper.SpianMapper; |
| | | |
| | | public class PlcHoldNew extends Thread { |
| | |
| | | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | | private SpianMapper spianMapper; |
| | | private AlbaniaMapper albaniaMapper; |
| | | private SpianService spianService; |
| | | int aaa; |
| | | |
| | |
| | | |
| | | // if (S7control.getinstance().CheckConnected() == false) { |
| | | spianService = WebSocketServer.applicationContext.getBean(SpianService.class); |
| | | spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class); |
| | | jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class); |
| | | albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class); |
| | | |
| | | //读取DB105区文件 |
| | | PlcParameterObject plcmes=PLCAutoMes.PlcMesObject; |
| | | //读106 |
| | | PlcParameterObject plcread=PLCAutoMes.PlcReadObject; |
| | | //读103 |
| | | PlcParameterObject plcstate=PLCAutoMes.plcStateObject; |
| | | String OutRequest=plcread.getPlcParameter("OutRequest").getValue();//出片请求 |
| | | String OutActivate=plcmes.getPlcParameter("OutActivate").getValue();//出片启动 |
| | | |
| | | |
| | | |
| | | S7control.getinstance().WriteWord( plcmes.getPlcParameter("1231").getAddress(plcmes.getPlcParameter("1231").getAddressIndex()), (short) 0); |
| | | String OutRequest=plcread.getPlcParameter("OutRequest").getValue();//出片请求一线 |
| | | String OutActivate=plcmes.getPlcParameter("OutActivate").getValue();//出片请求二线 |
| | | String AddRequest=plcmes.getPlcParameter("AddRequest").getValue();//进片请求 |
| | | String CarRequest=plcmes.getPlcParameter("CatReque").getValue();//运送车请求 |
| | | |
| | | // 出片任务 |
| | | |
| | | if (OutActivate.equals("1") == false&&OutRequest.equals("1")==true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short) 0);// 出片任务启动改为0 |
| | | } |
| | | String FeedRequest=plcread.getPlcParameter("FeedRequest").getValue();// 进片请求字 |
| | | String AddActivate=plcmes.getPlcParameter("AddActivate").getValue();// 进片启动 |
| | | if (FeedRequest.equals("1") == false&&AddActivate.equals("1")==true) { |
| | | S7control.getinstance().WriteWord("DB105.16", (short) 0);//进片任务启动改为0 |
| | | } |
| | | |
| | | if (OutActivate.equals("1") == true) { |
| | | // 判断当前是否有未执行的任务 |
| | | int outnum = spianMapper.SelectOutSliceshu();//是否有正在出片的任务 |
| | | int cageoutsum = spianMapper.Selectcageout(3);//笼子内是否还有在出片的玻璃 |
| | | // 当没有任务执行并且出片车空闲时 |
| | | if (outnum == 0 && Plchome.isAllowQueue == true && cageoutsum == 0) { |
| | | // 判断铝框出片队列表是否有待出片的玻璃 |
| | | String outglassid = spianMapper.SelectOutSlice(); |
| | | // 当有待出片的玻璃时 |
| | | if (outglassid != null) { |
| | | // 获取该玻璃是否被禁用 |
| | | int glassdisabled = spianMapper.SelectCageGlassState(outglassid); |
| | | // 未禁用下发任务 |
| | | if (glassdisabled == 0) { |
| | | spianService.selectout2(outglassid); |
| | | Plchome.isQueueWarning = false; |
| | | } else { // 禁用更改状态弹出提示 |
| | | Plchome.isQueueWarning = true; |
| | | } |
| | | if (OutActivate.equals("1") == false&&CarRequest.equals("0")==true) { |
| | | S7control.getinstance().WriteWord("DB105.18", (short)1);// 将大车的状态改为运输中 |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | ///////////// 进片任务 |
| | | |