| | |
| | | import com.example.springboot.entity.Queue;
|
| | | import com.example.springboot.entity.StorageCage;
|
| | | import com.example.springboot.entity.alarmmg;
|
| | | import com.example.springboot.entity.north_frame_buffer1_frames;
|
| | | import com.example.springboot.entity.north_glass_buffer1;
|
| | | import com.example.springboot.mapper.HomeMapper;
|
| | | import com.example.springboot.mapper.SpianMapper;
|
| | |
| | | public static Boolean isConfirm = true;
|
| | | // 待确认的出片队列
|
| | | public static List<north_glass_buffer1> AluminumFrame;
|
| | | // 待确认的铝框信息
|
| | | public static north_frame_buffer1_frames AluminumFrameInfo=new north_frame_buffer1_frames();
|
| | |
|
| | | // private Configuration config;
|
| | |
|
| | | //
|
| | | private StorageCageService storageCageService;
|
| | |
|
| | | public static Boolean FeedState = false;
|
| | |
| | | // b.put()
|
| | | @Override
|
| | | public void run() {
|
| | | homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
|
| | |
|
| | | while (this != null) {
|
| | | Short zhi = 0;
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | jsonObject.append("feedglassid", feedglassid);
|
| | |
|
| | | try {
|
| | | Thread.sleep(1000);
|
| | | // 注入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);
|
| | |
| | | .getBean(North_Glass_Buffer1Service.class);
|
| | | storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
|
| | | dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
|
| | | while (this != null) {
|
| | | Short zhi = 0;
|
| | | JSONObject jsonObject = new JSONObject();
|
| | | jsonObject.append("feedglassid", feedglassid);
|
| | | |
| | | try {
|
| | | Thread.sleep(1000);
|
| | | // 注入mapper
|
| | | |
| | |
|
| | | // boolean dbconnected = false;
|
| | | try {
|
| | |
| | | // E02玻璃id
|
| | | // log.info("frame1"+S7controlLK.getinstance().CheckConnected());
|
| | | String E02id="";
|
| | | try {
|
| | | E02id= S7controlLK.getinstance().readStrings("DB17.40");
|
| | | plc2=true;
|
| | | } catch (Exception e) {
|
| | | // TODO: handle exception
|
| | | plc2=false;
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | jsonObject.append("Plc2", plc2);
|
| | | // log.info("铝框线读取2"+S7controlLK.getinstance().CheckConnected());
|
| | | |
| | | // log.info("E02id"+E02id);
|
| | | outSliceServive.FrameStateUpdate(E02id);
|
| | | if (CurrentFrame != null) {
|
| | | S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
|
| | | }
|
| | | String J01id = S7controlLK.getinstance().readStrings("DB17.22");
|
| | | List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
|
| | | Short framerequest = liststate.get(0);
|
| | | // log.info("liststate:" + liststate);
|
| | | 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 = 2;
|
| | | } else {
|
| | | send = 1;
|
| | | }
|
| | | if (J01id != null) {
|
| | | int barcodeState = spianMapper.SelectOverState(J01id);// 获取该铝框的状态
|
| | | if (barcodeState == 0) {// 当该铝框所有的玻璃都是完成状态时删除在出片队列的数据
|
| | | spianMapper.DeleteQueue(J01id);
|
| | | // log.info("deleteoutslice:" + J01id);
|
| | | }
|
| | | }
|
| | | S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
|
| | | }
|
| | | // try {
|
| | | // E02id= S7controlLK.getinstance().readStrings("DB17.40");
|
| | | // plc2=true;
|
| | | // } catch (Exception e) {
|
| | | // // TODO: handle exception
|
| | | // plc2=false;
|
| | | // e.printStackTrace();
|
| | | // }
|
| | |
|
| | | // jsonObject.append("Plc2", plc2);
|
| | | // // log.info("铝框线读取2"+S7controlLK.getinstance().CheckConnected());
|
| | |
|
| | | // // log.info("E02id"+E02id);
|
| | | // outSliceServive.FrameStateUpdate(E02id);
|
| | | // if (CurrentFrame != null) {
|
| | | // S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(), "DB17.0");
|
| | | // }
|
| | | // String J01id = S7controlLK.getinstance().readStrings("DB17.22");
|
| | | // List<Short> liststate = S7controlLK.getinstance().ReadWord("DB17.20", 1);
|
| | | // Short framerequest = liststate.get(0);
|
| | | // // log.info("liststate:" + liststate);
|
| | | // 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("1")) {
|
| | | // send = 1;
|
| | | // } else {
|
| | | // send = 2;
|
| | | // }
|
| | | // if (J01id != null) {
|
| | | // int barcodeState = spianMapper.SelectOverState(J01id);// 获取该铝框的状态
|
| | | // if (barcodeState == 0) {// 当该铝框所有的玻璃都是完成状态时删除在出片队列的数据
|
| | | // spianMapper.DeleteQueue(J01id);
|
| | | // // log.info("deleteoutslice:" + J01id);
|
| | | // }
|
| | | // }
|
| | | // S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
|
| | | // }
|
| | |
|
| | | String E01id = S7controlLK.getinstance().readStrings("DB17.0");
|
| | | // log.info("frameno:" + E01id);
|
| | |
| | | north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
|
| | | } else {
|
| | | Plchome.AluminumFrame = north_glass_buffer1s;
|
| | | Plchome.AluminumFrameInfo=dbserve.SelectFrameBarcode(Plchome.FrameNo);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | if (AluminumFrame != null) {
|
| | | jsonObject.append("AluminumFrame", AluminumFrame);
|
| | | }
|
| | |
|
| | |
|
| | | // 复位倒计时
|
| | | // 地址104.9.6
|
| | |
| | | plc1=false;
|
| | | log.info("Plc1" + S7controlLK.getinstance().CheckConnected());
|
| | | }
|
| | | if (AluminumFrame != null) {
|
| | | jsonObject.append("AluminumFrame", AluminumFrame);
|
| | | }
|
| | | if (AluminumFrameInfo.getbarcode() != null) {
|
| | | jsonObject.append("AluminumFrameInfo", AluminumFrameInfo);
|
| | | }
|
| | | jsonObject.append("zhi", zhi);
|
| | | jsonObject.append("Plc1", plc1);
|
| | | // jsonObject.append("params", new short[] { 30, 40, });
|