| | |
| | |
|
| | | public static StringBuilder feedglassid;
|
| | |
|
| | | public static Boolean dbconnected = false;
|
| | |
|
| | | public static Boolean plc1 = true;
|
| | | public static Boolean plc2 = false;
|
| | |
|
| | | // public Plchome() throws IOException {
|
| | | // config = new Configuration("config.properties");
|
| | | // }
|
| | |
| | | storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
|
| | | dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
|
| | |
|
| | | boolean dbconnected = false;
|
| | | // boolean dbconnected = false;
|
| | | try {
|
| | | dbserve.getConn();
|
| | | dbconnected = true;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | dbconnected = false;
|
| | | log.info("dbconnected:" + dbconnected);
|
| | | }
|
| | | log.info("dbconnected:"+dbconnected);
|
| | | jsonObject.append("dbconnected", dbconnected);
|
| | | // // 获取当前扫码枪玻璃id
|
| | | // String CurrrentGlassId = "X22595911002GV";
|
| | |
| | |
|
| | | // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
|
| | | // String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14));
|
| | | try {
|
| | | // 铝框线交互
|
| | | // if (S7controlLK.getinstance().CheckConnected() == true) {
|
| | | // 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);
|
| | | }
|
| | |
|
| | | String E01id = S7controlLK.getinstance().readStrings("DB17.0");
|
| | | // log.info("frameno:" + E01id);
|
| | | List<Short> liststates = S7controlLK.getinstance().ReadWord("DB17.38", 1);
|
| | | // log.info("frameflip:" + liststates);
|
| | | // }else{
|
| | | // log.info("Plc2"+S7controlLK.getinstance().CheckConnected());
|
| | | // jsonObject.append("Plc2", false);
|
| | | // }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (S7control.getinstance().CheckConnected() == true) {
|
| | |
|
| | | // 铝框线交互
|
| | | if (S7controlLK.getinstance().CheckConnected() == true) {
|
| | | // E02玻璃id
|
| | | String E02id = S7controlLK.getinstance().readStrings("DB17.40");
|
| | | // log.info("E02id"+E02id);
|
| | | outSliceServive.FrameStateUpdate(E02id);
|
| | | if (CurrentFrame.getBarCode() != 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);
|
| | | }
|
| | | |
| | | String E01id = S7controlLK.getinstance().readStrings("DB17.0");
|
| | | // log.info("frameno:" + E01id);
|
| | | List<Short> liststates = S7controlLK.getinstance().ReadWord("DB17.38", 1);
|
| | | // log.info("frameflip:" + liststates);
|
| | | }
|
| | |
|
| | | // 获取当前扫码方式
|
| | | List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | plc1=true;
|
| | | } else {
|
| | | plc1=false;
|
| | | log.info("Plc1" + S7controlLK.getinstance().CheckConnected());
|
| | | }
|
| | | jsonObject.append("zhi", zhi);
|
| | | |
| | | jsonObject.append("Plc1", plc1);
|
| | | // jsonObject.append("params", new short[] { 30, 40, });
|
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Home");
|
| | | if (sendwServer != null) {
|