| | |
| | | @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) {
|
| | | // 获取当前扫码方式
|
| | | List<Short> Scanningmethod = S7control.getinstance().ReadWord("DB103.255", 1);
|
| | | jsonObject.append("Scanningmethod", Scanningmethod);
|
| | |
|
| | | List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
|
| | | if (Scanningmethods != null) {
|
| | | for (Boolean Scanningmethod : Scanningmethods) {
|
| | | jsonObject.append("Scanningmethod", Scanningmethod);
|
| | | }
|
| | | }
|
| | |
|
| | | String CurrrentGlassId = spianService.queGlassid("DB103.256", 14).toString();
|
| | | jsonObject.append("CurrrentGlassId", CurrrentGlassId);
|
| | |
|
| | | // 获取D01-D06,A01,A02,B01,B02状态
|
| | | List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
|
| | | jsonObject.append("DeviceList", DeviceList);
|
| | | // 获取D01-D06,A01,A02,B01,B02玻璃id
|
| | | List<String> GlassIdList = new ArrayList<String>();
|
| | | GlassIdList.add(spianService.queGlassid("DB103.40", 14).toString());
|
| | | GlassIdList.add(spianService.queGlassid("DB103.44", 14).toString());
|
| | | GlassIdList.add(spianService.queGlassid("DB103.58", 14).toString());
|
| | |
|
| | | GlassIdList.add(spianService.queGlassid("DB103.184", 14).toString());
|
| | |
| | | if (inglassInfo.size() > 0) {
|
| | | jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
|
| | | }
|
| | |
|
| | | }
|
| | | // // 获取铝框idDB106.DBW64,添加到出片队列
|
| | | // String frameno="X21763329601FB";
|
| | |
| | | for (Boolean emergencystop : emergencystops) {
|
| | | jsonObject.append("emergencystop", emergencystop);
|
| | | }
|
| | |
|
| | | // // 终止继续按钮
|
| | | // List<String> niuanaddressList3 =
|
| | | // Arrays.asList(config.getProperty("Parameter2.stop").split(","));
|
| | | // List<Boolean> anniuread =
|
| | | // S7control.getinstance().readBits(niuanaddressList3);
|
| | | // // Boolean[] value4 = { false, false};
|
| | | // // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
|
| | | // Boolean[] value5 = { true };
|
| | | // List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
|
| | | // short[] anniuparams = new short[anniuread.size()];
|
| | | // for (int i = 0; i < anniuread.size(); i++) {
|
| | | // boolean value = anniuread.get(i);
|
| | | // anniuparams[i] = value ? (short) 1 : (short) 0;
|
| | | // }
|
| | |
|
| | | // short[] resets2 = new short[resets.size()];
|
| | | // for (int i = 0; i < resets.size(); i++) {
|
| | | // boolean value = resets.get(i);
|
| | | // resets2[i] = value ? (short) 1 : (short) 0;
|
| | | // }
|
| | |
|
| | | // for (short number : resets2) {
|
| | |
|
| | | // if (number == 1) {
|
| | | // jsonObject.append("Abort", anniuparams);
|
| | |
|
| | | // }
|
| | |
|
| | | // }
|
| | | }
|
| | |
|
| | | storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
|
| | | dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | |
| | | |
| | | boolean dbconnected = false;
|
| | | try {
|
| | | dbserve.getConn();
|