| | |
| | | public static String FrameNo = "";
|
| | | // 是否需要手动确认玻璃
|
| | | public static Boolean isConfirm = false;
|
| | | //待确认的出片队列
|
| | | // 待确认的出片队列
|
| | | public static List<north_glass_buffer1> AluminumFrame;
|
| | |
|
| | | // private Configuration config;
|
| | |
| | | private StorageCageService storageCageService;
|
| | |
|
| | | // public Plchome() throws IOException {
|
| | | // config = new Configuration("config.properties");
|
| | | // config = new Configuration("config.properties");
|
| | | // }
|
| | |
|
| | | // public static Map b=new HashMap<>();
|
| | |
| | | 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
|
| | | // }
|
| | |
|
| | | if (S7control.getinstance().CheckConnected() == true) {
|
| | | // 获取当前扫码方式
|
| | |
|
| | | 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);
|
| | |
| | | if (!frameno.equals(Plchome.FrameNo)) {
|
| | | Plchome.FrameNo = frameno;
|
| | | try {
|
| | | Short num=0;
|
| | | List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service.SelectAluminumFrameInfoById(Plchome.FrameNo);
|
| | | Short num = 0;
|
| | | List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service
|
| | | .SelectAluminumFrameInfoById(Plchome.FrameNo);
|
| | | for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
|
| | | if(north_glass_buffer1.getstorageCage()==null){
|
| | | if (north_glass_buffer1.getstorageCage() == null) {
|
| | | break;
|
| | | }
|
| | | num++;
|
| | | }
|
| | | if(num==north_glass_buffer1s.size()){
|
| | | if (num == north_glass_buffer1s.size()) {
|
| | | north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
|
| | | }else{
|
| | | Plchome.AluminumFrame=north_glass_buffer1s;
|
| | | } else {
|
| | | Plchome.AluminumFrame = north_glass_buffer1s;
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | if(AluminumFrame!=null){
|
| | | if (AluminumFrame != null) {
|
| | | jsonObject.append("AluminumFrame", AluminumFrame);
|
| | | }
|
| | |
|
| | | // // 获取铝框idDB106.DBW64,添加到出片队列
|
| | | // String frameno = spianService.queGlassid("DB103.270", 14).toString();
|
| | | // // String frameno="X12345611002GV";
|
| | | // // frameno="X21763329601FB";
|
| | | // if (!frameno.equals(Plchome.FrameNo)) {
|
| | | // Plchome.FrameNo = frameno;
|
| | | // try {
|
| | | // Short num=0;
|
| | | // List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service.SelectAluminumFrameInfoById(Plchome.FrameNo);
|
| | | // for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
|
| | | // if(north_glass_buffer1.getstorageCage()==null){
|
| | | // north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
|
| | | // break;
|
| | | // }
|
| | | // num++;
|
| | | // }
|
| | | // if(num==north_glass_buffer1s.size()){
|
| | | // jsonObject.append("AluminumFrame", north_glass_buffer1s);
|
| | | // }
|
| | | // } catch (SQLException e) {
|
| | | // // TODO Auto-generated catch block
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | // }
|
| | |
|
| | | // 获取进片请求状态
|
| | | List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
|
| | |
| | | // }
|
| | | }
|
| | |
|
| | | // 铝框线交互
|
| | |
|
| | | // //铝框id请求字
|
| | | // List<Short> framerequest = S7control.getinstance().ReadWord("铝框id请求字地址", 1);
|
| | | // if(framerequest!=null){
|
| | | // //铝框id
|
| | | // String franmeno= spianService.queGlassid("铝框id地址", 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);
|
| | | // }
|
| | | storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
|
| | | dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
|
| | | boolean dbconnected = false;
|
| | |
| | |
|
| | | if (!messages.isEmpty()) {
|
| | | // // 将最后一个消息转换为整数类型的列表
|
| | | // String lastMessage = messages.get(messages.size() - 1);
|
| | | // System.out.println("lastMessage:" + lastMessage);
|
| | | // JSONArray messageArray = new JSONArray(lastMessage);
|
| | |
|
| | | // try {
|
| | | // // 检查索引是否有效
|
| | | // if (messageArray.getJSONArray(0).size() > 0) {
|
| | | // // 获取消息数组
|
| | | // JSONArray jsonArray = messageArray.getJSONArray(0);
|
| | | // // 创建一个布尔值列表
|
| | | // List<Boolean> sValue = new ArrayList<>();
|
| | | // // 遍历消息数组
|
| | | // for (int i = 0; i < jsonArray.size(); i++) {
|
| | | // // 获取消息数组中的值
|
| | | // Object value = jsonArray.get(i);
|
| | | // // 检查值是否有效
|
| | | // if (value != null && !value.toString().equals("null")) {
|
| | | // try {
|
| | | // // 移除非数字和数字字符
|
| | | // String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
|
| | | // // 解析为布尔值
|
| | | // boolean val = "1".equals(cleanedValue.trim());
|
| | | // // 将布尔值添加到布尔值列表中
|
| | | // sValue.add(val);
|
| | | // System.out.println(
|
| | | // "messageValue: " + Arrays.asList(val) + " added to the list");
|
| | |
|
| | | // } catch (NumberFormatException e) {
|
| | | // // 如果无法解析为 boolean 类型,则忽略该部分
|
| | | // System.err.println("Could not parse value: " + value);
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // // 终止进片任务
|
| | | // boolean Value1 = sValue.get(0);
|
| | | // boolean Value2 = sValue.get(1);
|
| | |
|
| | | // if (Value1) {
|
| | | // storageCageService.EndTask(0);
|
| | |
|
| | | // }
|
| | | // if (Value2) {
|
| | | // storageCageService.EndTask(1);
|
| | |
|
| | | // }
|
| | | // // 检查布尔值列表是否为空
|
| | | // if (!sValue.isEmpty()) {
|
| | |
|
| | | // // 调用 S7control.getinstance().WriteBit 方法将布尔值列表写入地址列表
|
| | | // S7control.getinstance().WriteBit(niuanaddressList3, sValue);
|
| | | // System.out.println(
|
| | | // "Values " + sValue + " written to PLC at address " + niuanaddressList3);
|
| | | // }
|
| | | // }
|
| | | // } catch (Exception e) {
|
| | | // System.err.println("An error occurred while writing bit to PLC: " +
|
| | | // e.getMessage());
|
| | | // }
|
| | | webserver.clearMessages();
|
| | | }
|
| | |
|