| gmms/.classpath | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| gmms/.settings/org.eclipse.wst.common.project.facet.core.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| gmms/WebContent/login/run.jsp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| nglib/.idea/encodings.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| nglib/src/builder/Manager.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| nglib/src/builder/httpApi.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| nglib/src/ng/devices/MysqlService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
gmms/.classpath
@@ -1,17 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_121"> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> <attributes> <attribute name="owner.project.facets" value="java"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0"> <attributes> <attribute name="owner.project.facets" value="jst.web"/> </attributes> </classpathentry> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="output" path="build/classes"/> </classpath> gmms/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -1,6 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <faceted-project> <runtime name="Apache Tomcat v8.0"/> <fixed facet="jst.web"/> <fixed facet="java"/> <fixed facet="wst.jsdt.web"/> gmms/WebContent/login/run.jsp
@@ -3,10 +3,10 @@ <%@page import="toTcp.TcpMain"%> <%@include file="../mysqlInsert/mysql_connect.jsp"%> <% ThreadHttpServer.mains(); //ThreadHttpServer.mains(); //TcpMain.getElectric(); //Manager.appStart(new String[]{url,user,password }); Manager.appStart(new String[]{url,user,password }); //response.sendRedirect("bdg.jsp"); %> nglib/.idea/encodings.xml
@@ -1,7 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="Encoding"> <file url="file://$PROJECT_DIR$/bin/S7/S7control.java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/builder/HttpHandlerDemo.java" charset="GBK" /> <file url="file://$PROJECT_DIR$/src/builder/MachineManager.java" charset="GBK" /> <file url="file://$PROJECT_DIR$/src/builder/Manager.java" charset="GBK" /> @@ -16,6 +15,6 @@ <file url="file://$PROJECT_DIR$/src/ng/devices/PlcParameterInfo.java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/ng/devices/PlcParameterObject.java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/toTcp/TCPClient.java" charset="GBK" /> <file url="PROJECT" charset="GBK" /> <file url="PROJECT" charset="UTF-8" /> </component> </project> nglib/src/builder/Manager.java
@@ -207,7 +207,6 @@ System.out.println("错误"); } } public static void main(String[] args){ Manager.appStart(new String[]{"jdbc:mysql://localhost/gmms?serverTimezone=GMT%2B8","root","beibo.123/" }); while(true){ nglib/src/builder/httpApi.java
@@ -1,5 +1,6 @@ package builder; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import java.io.BufferedReader; @@ -10,21 +11,30 @@ import java.net.URL; public class httpApi { public static String Ip="localhost"; public static void main(String[] args) { JSONObject jsonObject=new JSONObject(); jsonObject.put("thickness", "0"); jsonObject.put("width", "0"); jsonObject.put("height", "0"); jsonObject.put("sameCount", "0"); jsonObject.put("glassType", "string"); jsonObject.put("thickness", "5"); jsonObject.put("width", "3660"); jsonObject.put("height", "2440"); jsonObject.put("sameCount", "2"); jsonObject.put("glassType", "超白玻"); sendShelfTask(jsonObject); JSONObject a=selectLoadRack(); double width=Double.valueOf(a.get("width").toString()); double height=Double.valueOf(a.get("height").toString()); double thickness=Double.valueOf(a.get("thickness").toString()); int sameCount=Integer.valueOf(a.get("sameCount").toString()); System.out.println(width+","+height+","+thickness+","+sameCount); } //发送仓储任务 //发送仓储所需玻璃任务 public static JSONObject sendShelfTask(JSONObject params){ try { String requestURL="http://39.105.110.179:5000/GlassInfo"; String requestURL="http://"+Ip+":5000/GlassInfo"; String requestBody = params.toString(); JSONObject resultJSON= httpApi(requestURL,"POST",requestBody); return resultJSON; @@ -34,34 +44,47 @@ } return null; } //查询上片料架信息 //MES是否正常连接 public static JSONObject sendShelfTask(){ try { String requestURL="http://"+Ip+":5000/GlassInfo"; JSONObject resultJSON= httpApi(requestURL,"GET",null); return resultJSON; } catch (Exception e) { // TODO: handle exception System.out.println("HTTP ERROR:http://39.105.110.179:5000/GlassInfo GET"); } return null; } //查询上片位信息 public static JSONObject selectLoadRack(){ try { String requestURL="http://39.105.110.179:5000/GlassInfo"; String requestURL="http://"+Ip+":5000/GlassInfo/getReady"; JSONObject resultJSON= httpApi(requestURL,"GET",null); return resultJSON; JSONObject loadRack=resultJSON.getJSONObject("data").getJSONArray("stocklist").getJSONObject(0); return loadRack; } catch (Exception e) { // TODO: handle exception System.out.println("HTTP ERROR:http://39.105.110.179:5000/GlassInfo GET"); System.out.println("HTTP ERROR:http://"+Ip+":5000/GlassInfo GET"); } return null; } //上片位片数-1 //反馈上片位信息-1 public static JSONObject loadRackReduction(){ try { String requestURL="http://39.105.110.179:5000/GlassInfo"; String requestURL="http://"+Ip+":5000/GlassInfo/finishGet"; JSONObject resultJSON= httpApi(requestURL,"GET",null); return resultJSON; } catch (Exception e) { // TODO: handle exception System.out.println("HTTP ERROR:http://39.105.110.179:5000/GlassInfo GET"); System.out.println("HTTP ERROR:http://"+Ip+":5000/GlassInfo/finishGet GET"); } return null; } //仓储料架信息 //查询仓储库内信息 public static JSONObject storageRackInfo(){ try { String requestURL="http://39.105.110.179:5000/GlassInfo"; String requestURL="http://"+Ip+":5000/GlassInfo"; JSONObject resultJSON= httpApi(requestURL,"GET",null); return resultJSON; } catch (Exception e) { @@ -73,27 +96,26 @@ public static JSONObject httpApi(String requestURL,String requestMethod,String requestBody){ JSONObject jsonObject = null; try { // 定义 URL // 地址 URL URL url = new URL(requestURL); // 打开连接 // 连接 HttpURLConnection connection = (HttpURLConnection) url.openConnection(); // 设置请求方法 // 请求方式 connection.setRequestMethod(requestMethod); // 允许输出流,用于发送请求体 connection.setDoOutput(true); connection.setRequestProperty("Content-type", "application/json; charset=UTF-8"); System.out.println(requestBody); // 获取输出流并写入请求体 try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) { // 参数写入 if(requestBody!=null){ try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) { outputStream.writeBytes(requestBody); } outputStream.flush(); } // 获取响应码 } // 状态码 int responseCode = connection.getResponseCode(); System.out.println("Response Code: " + responseCode); // 读取响应内容 // 读取返回内容 if (responseCode==200){ BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line; StringBuilder response = new StringBuilder(); @@ -101,12 +123,16 @@ response.append(line); } reader.close(); // 断开连接 // 关闭 connection.disconnect(); String resultStr = response.toString(); if (resultStr!=null&&resultStr.length()>0) { jsonObject =JSONObject.parseObject(resultStr); } //System.out.println(jsonObject); }else{ System.out.println("Response Code: " + responseCode); } } catch (IOException e) { e.printStackTrace(); } nglib/src/ng/devices/MysqlService.java
@@ -114,13 +114,13 @@ //上片 if(id==2){ try{ //JSONObject jSONObject=httpApi.selectLoadRack(); JSONObject jSONObject=new JSONObject(); jSONObject.put("thickness", "4"); jSONObject.put("width", "3660"); jSONObject.put("height", "2440"); jSONObject.put("sameCount", "1"); jSONObject.put("glassType", "string"); JSONObject jSONObject=httpApi.selectLoadRack(); // JSONObject jSONObject=new JSONObject(); // jSONObject.put("thickness", "4"); // jSONObject.put("width", "3660"); // jSONObject.put("height", "2440"); // jSONObject.put("sameCount", "1"); // jSONObject.put("glassType", "string"); if (jSONObject!=null){ //创建连接 sn=this.db.createSession(false); @@ -140,7 +140,15 @@ result= sql.getString(7); flag= sql.getString(8);//1 表示任务完成数量减一 if ("1".equals(flag) ){ //JSONObject loadRackReductionJson=httpApi.loadRackReduction(); for (int i=0;i<1;){ JSONObject loadRackReductionJson=httpApi.loadRackReduction(); if ("true".equals(loadRackReductionJson.get("success").toString())){ //调用成功 i++; break; } } } } }catch(Exception e){