diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/rest/BigScreenController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/rest/BigScreenController.java index 6477bd36..1317dc01 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/rest/BigScreenController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/rest/BigScreenController.java @@ -31,6 +31,12 @@ public class BigScreenController { public ResponseEntity getData(@RequestBody JSONObject whereJson) { return new ResponseEntity<>(bigScreenService.getData(whereJson), HttpStatus.OK); } + @PostMapping("/query3Dcartoon") + @Log("查询三维动画大屏") + @ApiOperation("查询三维动画大屏") + public ResponseEntity query3Dcartoon(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(bigScreenService.query3Dcartoon(whereJson), HttpStatus.OK); + } @PostMapping("/workScreen") @Log("查询工序看板") diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/BigScreenService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/BigScreenService.java index 1282b0a0..291481bc 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/BigScreenService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/BigScreenService.java @@ -7,12 +7,19 @@ import com.alibaba.fastjson.JSONObject; */ public interface BigScreenService { /** - * 获取监控大屏数据 + * 获取监控大屏数据页面 * * @return */ public JSONObject getData(JSONObject param); + /** + * 三维动画页面 + * + * @return + */ + public JSONObject query3Dcartoon(JSONObject param); + /** * 获根据不同看板编号查询不同工序看板数据 * diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/BigScreenServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/BigScreenServiceImpl.java index 41d7d7ad..7f0b26c2 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/BigScreenServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ext/bigScreen/service/impl/BigScreenServiceImpl.java @@ -17,6 +17,12 @@ public class BigScreenServiceImpl implements BigScreenService { return JSON.parseObject(str); } + @Override + public JSONObject query3Dcartoon(JSONObject param) { + String str="{\"desc\":\"查询成功\",\"code\":\"1\",\"result\":{\"total_input1\":\"17500.00\",\"total_input2\":\"3500.00\",\"year_output1\":\"25000.00\",\"year_output2\":\"5000.00\",\"product_num\":\"205\",\"process_num\":\"8\",\"b_date\":\"2019-05-05\"}}"; + return JSON.parseObject(str); + } + @Override public JSONObject workScreen(JSONObject param) { String web_flag = param.getString("web_flag"); diff --git a/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test.java b/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test.java new file mode 100644 index 00000000..a6e6f89a --- /dev/null +++ b/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test.java @@ -0,0 +1,369 @@ +/* +package org.nl.day01; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import org.nl.exception.WDKException; +import org.nl.wql.WQL; +import org.nl.wql.core.bean.WQLObject; + +import java.text.SimpleDateFormat; +import java.util.*; + +public class Test { + + */ +/** + * 根据输入天数day,获取距离今天day天数的字符串日期 + * + * @param day + * 距离今天天数 + * @return 如day为0 则输出2019-06-09当天日期 + *//* + + public static String getDateStr(int day) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + Date todayDate = new Date(); + long beforeTime = (todayDate.getTime() / 1000) - 60 * 60 * 24 * day; + todayDate.setTime(beforeTime * 1000); + String beforeDate = formatter.format(todayDate); + return beforeDate; + } + */ +/** + * 更新交货单 + * + * @param ctx + * @param account + *//* + + @WDKTransaction + public void updateDeliveryOrderInfo(String code) { + Date date1 = new Date(); + System.out.println("updateDeliveryOrderInfo发送数据-----------------"); + String url = "http://192.168.0.82:8000/sap/bc/srt/rfc/sap/zfg_ecc_to_zhwl/800/zfg_ecc_to_zhwl/binding"; + String method = "ZfmGetDnZjwl"; + HashMap form = new HashMap<>(); + // 获得前两天日期 + JSONObject ZfmGetSoResponse = null; + if (code.equals("")) { + form.put("IErdatFrm", getDateStr(1)); + form.put("IErdatTo",getDateStr(0)); + form.put("IVbeln", ""); // 非必填字段 + } else { + form.put("IErdatFrm", ""); + form.put("IErdatTo", ""); + form.put("IVbeln", code); // 非必填字段 + } + try { + JSONObject ret = WebServiceUtil.process(url, method, form); + System.out.println("getXML发送数据-----------------" + ret.toString()); + JSONObject Envelope = ret.optJSONObject("soap-env:Envelope"); + JSONObject Body = Envelope.optJSONObject("soap-env:Body"); + ZfmGetSoResponse = Body.optJSONObject("n0:ZfmGetDnZjwlResponse"); + String check = ZfmGetSoResponse.optString("OResultcode"); + if ("1005".equals(check)) { + System.out.println(ZfmGetSoResponse.optString("OResultmsg")); + return; + } else if (!"1000".equals(check)) { + throw new WDKException(ZfmGetSoResponse.optString("OResultmsg")); + } + } catch (Exception e) { + e.printStackTrace(); + } + JSONObject TZtsalesorder = ZfmGetSoResponse.optJSONObject("TZtdn"); + JSONArray item = TZtsalesorder.optJSONArray("item"); + + if (item.size() == 0 || TZtsalesorder == null) { + return; + } + + // 发货通知单(未拆分)主表 + WQLObject wqlMst = WQLObject.getWQLObject("SAL_OD_DeliveryNotice"); + // 发货通知单明细(未拆分)表 + WQLObject wqlDtl = WQLObject.getWQLObject("SAL_OD_DeliveryNoticeDtl"); + // 交货单接口表 + WQLObject wqld = WQLObject.getWQLObject("SAP_OD_Delivery"); + + // 字典表单据类型 + WQLObject wqlDic = WQLObject.getWQLObject("PF_PB_SysDicInfo"); + JSONArray diclist = wqlDic.query("sysdic_type ='TC_SALE_SENDBIZTYPE' and sysdic_para2 !='' ") + .getResultJSONArray(0); + HashMap DicMap = new HashMap<>(); + for (int i = 0; i < diclist.size(); i++) { + JSONObject nowdiclist = diclist.getJSONObject(i); + DicMap.put(nowdiclist.optString("sysdic_para2"), nowdiclist.optString("sysdic_code")); + } + //查询当前仓库 + JSONArray jaStor = WQL.getWO("QSTOST_MTATERUTIL_01") + .addParam("flag", "6") + .process() + .getResultJSONArray(0); + + HashMap mapStor = new HashMap<>(); + for(int i=0;i mapMst = new HashMap(); + for(int i=0;i mapMater = new HashMap<>(); + for(int i=0;i mapCount2 = new HashMap<>(); + mapCount2.put("sysflag", "1"); + // 更新中间主表 + wqld.update(mapCount2, "id in("+sbdtl.toString()+")"); + + Set> entrySet = mapMst.entrySet(); + Iterator> iter = entrySet.iterator(); + //新增主表 + while (iter.hasNext()) + { + Map.Entry entry = iter.next(); + JSONObject jo = entry.getValue(); + if(jo.optInt("detail_count")==0){ + continue; + } + if(jo.optString("is_insert").equals("1")){ + wqlMst.insert(entry.getValue()); + }else if(jo.optString("is_insert").equals("0")){ + wqlMst.update(entry.getValue()); + } + } + Date date2 = new Date(); + System.out.println("共计秒:"+(date2.getTime()-date1.getTime())/1000); + System.out.println("销售发货通知数据同步成功!"); + } + + } +*/ diff --git a/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test2.java b/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test2.java new file mode 100644 index 00000000..cf67a6ec --- /dev/null +++ b/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test2.java @@ -0,0 +1,62 @@ +package org.nl.day01; + +import net.sf.json.JSONObject; + +import java.util.HashMap; + +public class Test2 { + public static void main(String[] args) throws Exception { + + String url = "http://192.168.0.82:8000/sap/bc/srt/rfc/sap/z_sd0002_send_mat_md/800/z_sd0002_send_mat_md/binding"; + String method = "ZSd0002SendMatMd"; //物料接口 + HashMap form = new HashMap(); + form.put("MatnrFr", "24018347S"); + form.put("MatnrTo", "24018347S"); + //非必填字段 + JSONObject ret = WebServiceUtil.process(url, method, form); + System.out.println("getXML返回数据-----------------" + ret.toString()); + JSONObject Envelope = ret.optJSONObject("soap-env:Envelope"); + JSONObject Body = Envelope.optJSONObject("soap-env:Body"); + JSONObject ZfmGetSoResponse = Body.optJSONObject("n0:ZSd0002SendMatMdResponse"); + JSONObject TZtsalesorder = ZfmGetSoResponse.optJSONObject("TZtsalesorder"); + /* JSONArray item = TZtsalesorder.optJSONArray("item"); + System.out.println("例子:查询结果字段OResultmsg-----------------" + ZfmGetSoResponse.optString("OResultmsg")); + System.out.println("例子:查询结果数组size-----------------" + item.size());*/ + + /*String url = "http://192.168.0.82:8000/sap/bc/srt/rfc/sap/zfg_ecc_to_zhwl/800/zfg_ecc_to_zhwl/binding"; + String method="ZfmGetSo"; //获取销售订单 + HashMap form = new HashMap(); + form.put("IErdatFrm", "2022-05-01"); + form.put("IErdatTo", "2022-05-08"); + //非必填字段 + form.put("IVbeln", ""); + JSONObject ret = WebServiceUtil.process(url,method,form); + System.out.println("getXML发送数据-----------------"+ret.toString()); + JSONObject Envelope = ret.getJSONObject("soap-env:Envelope"); + JSONObject Body = Envelope.getJSONObject("soap-env:Body"); + JSONObject ZfmGetSoResponse = Body.getJSONObject("n0:ZfmGetSoResponse"); + JSONObject TZtsalesorder = ZfmGetSoResponse.getJSONObject("TZtsalesorder"); + JSONArray item = TZtsalesorder.optJSONArray("item"); + System.out.println("例子:查询结果字段OResultmsg-----------------"+ZfmGetSoResponse.optString("OResultmsg")); + System.out.println("例子:查询结果数组size-----------------"+item.size());*/ + + + /* String url = "http://192.168.0.82:8000/sap/bc/srt/rfc/sap/zfg_ecc_to_zhwl/800/zfg_ecc_to_zhwl/binding"; + String method = "ZfmGetDnZjwl"; //获取交货单 + HashMap form = new HashMap(); + form.put("IErdatFrm", "2019-05-01"); + form.put("IErdatTo", "2019-05-08"); + //非必填字段 + form.put("IVbeln", ""); + //非必填字段 + JSONObject ret = WebServiceUtil.process(url, method, form); + System.out.println("getXML发送数据-----------------" + ret.toString()); + JSONObject Envelope = ret.optJSONObject("soap-env:Envelope"); + JSONObject Body = Envelope.optJSONObject("soap-env:Body"); + JSONObject ZfmGetDnZjwlResponse = Body.getJSONObject("n0:ZfmGetDnZjwlResponse"); + JSONObject TZtdn = ZfmGetDnZjwlResponse.getJSONObject("TZtdn"); + JSONArray item = TZtdn.getJSONArray("item"); + System.out.println("例子:查询结果字段OResultmsg-----------------" + ZfmGetDnZjwlResponse.getString("OResultmsg")); + System.out.println("例子:查询结果数组size-----------------" + item.size());*/ + } +} diff --git a/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test4.java b/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test4.java new file mode 100644 index 00000000..05c810e5 --- /dev/null +++ b/mes/hd/nladmin-system/src/test/java/org/nl/day01/Test4.java @@ -0,0 +1,7 @@ +package org.nl.day01; + +public class Test4 { + public static void main(String[] args) { + System.out.println(); + } +} diff --git a/mes/hd/nladmin-system/src/test/java/org/nl/day01/WebServiceUtil.java b/mes/hd/nladmin-system/src/test/java/org/nl/day01/WebServiceUtil.java new file mode 100644 index 00000000..71c946de --- /dev/null +++ b/mes/hd/nladmin-system/src/test/java/org/nl/day01/WebServiceUtil.java @@ -0,0 +1,190 @@ +package org.nl.day01; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.XML; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; + +/** + * 后端调用第三方webservice接口 + * + * @author zds 2018-12-27 16:33:50 + */ +public class WebServiceUtil { + /** + * @param url 第三方系统提供webservice的接口url + * @param method 第三方系统提供webservice对应的方法名 + * @param form 第三方系统提供webservice对应的方法请求参数 + * @return 第三方系统返回的JSONObject调用结果 + * @throws Exception 工具类一般不处理具体异常,抛出由调用方处理,否则容易形成黑箱 + */ + public static JSONObject process(String url, String method, HashMap form) throws Exception { + + + //第一步:创建服务地址 + URL netUrl = new URL(url); + + //第二步:打开一个通向服务地址的连接 + HttpURLConnection connection = (HttpURLConnection) netUrl.openConnection(); + + //第三步:设置参数 + connection.setRequestMethod("POST"); + //设置超时时间 + connection.setConnectTimeout(50000); + + //3.2设置数据格式:content-type + connection.setRequestProperty("content-type", "text/xml;charset=utf-8"); + + //3.3设置输入输出,因为默认新创建的connection没有读写权限, + connection.setDoInput(true); + + connection.setDoOutput(true); + + + //第四步:组织SOAP数据,发送请求 + String soapXML = getXML(form, method); + + //将信息以流的方式发送出去 + OutputStream os = connection.getOutputStream(); + + os.write(soapXML.getBytes()); + + //第五步:接收服务端响应,打印 + + int responseCode = connection.getResponseCode(); + + //返回结果 + String resultStr = null; + if (200 == responseCode) {//表示服务端响应成功 + + //获取当前连接请求返回的数据流 + InputStream is = connection.getInputStream(); + + InputStreamReader isr = new InputStreamReader(is, "utf-8"); + + BufferedReader br = new BufferedReader(isr); + + StringBuilder sb = new StringBuilder(); + + String temp = null; + + while (null != (temp = br.readLine())) { + sb.append(temp); + } + + //打印结果 + String ret = sb.toString(); + if (ret.startsWith("", ""); + else + ret = (new StringBuilder("")).append(ret).toString(); + + resultStr = XML.toJSONObject(ret).toString(); + + + is.close(); + isr.close(); + br.close(); + //关闭连接 + connection.disconnect(); + } + os.close(); + return ObjectUtil.isEmpty(resultStr) ? null : JSONObject.fromObject(resultStr); + } + + /** + * 获得要发送的webservice的xml形式的参数 + * + * @param form查询条件 + * @return + */ + private static String getXML(HashMap form, String method) { + StringBuffer sb = new StringBuffer(); + sb.append(" "); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + if (method.contains("ZSd0002SendMatMd")) + sb.append(""); + // 设置请求参数 + for (Iterator it = form.keySet().iterator(); it.hasNext(); ) { + String key = it.next(); + String value = form.get(key); + sb.append(" <" + key + ">" + value + ""); + } + if (method.contains("ZSd0002SendMatMd")) + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + System.out.println("getXML发送数据-----------------" + sb.toString()); + return sb.toString(); + + } + + + public static void main(String[] args) throws Exception { + + String url = "http://192.168.0.82:8000/sap/bc/srt/rfc/sap/z_sd0002_send_mat_md/800/z_sd0002_send_mat_md/binding"; + String method = "ZSd0002SendMatMd"; //物料接口 + HashMap form = new HashMap(); + form.put("MatnrFr", "24018862S"); + form.put("MatnrTo", "24018862S"); + //非必填字段 + JSONObject ret = WebServiceUtil.process(url, method, form); + System.out.println("getXML返回数据-----------------" + ret.toString()); + JSONObject Envelope = ret.optJSONObject("soap-env:Envelope"); + JSONObject Body = Envelope.optJSONObject("soap-env:Body"); + JSONObject ZfmGetSoResponse = Body.optJSONObject("n0:ZSd0002SendMatMdResponse"); + JSONObject TZtsalesorder = ZfmGetSoResponse.optJSONObject("TZtsalesorder"); + JSONArray item = TZtsalesorder.optJSONArray("item"); + System.out.println("例子:查询结果字段OResultmsg-----------------" + ZfmGetSoResponse.optString("OResultmsg")); + System.out.println("例子:查询结果数组size-----------------" + item.size()); + + /*String url = "http://192.168.0.82:8000/sap/bc/srt/rfc/sap/zfg_ecc_to_zhwl/800/zfg_ecc_to_zhwl/binding"; + String method="ZfmGetSo"; //获取销售订单 + HashMap form = new HashMap(); + form.put("IErdatFrm", "2022-05-01"); + form.put("IErdatTo", "2022-05-08"); + //非必填字段 + form.put("IVbeln", ""); + JSONObject ret = WebServiceUtil.process(url,method,form); + System.out.println("getXML发送数据-----------------"+ret.toString()); + JSONObject Envelope = ret.getJSONObject("soap-env:Envelope"); + JSONObject Body = Envelope.getJSONObject("soap-env:Body"); + JSONObject ZfmGetSoResponse = Body.getJSONObject("n0:ZfmGetSoResponse"); + JSONObject TZtsalesorder = ZfmGetSoResponse.getJSONObject("TZtsalesorder"); + JSONArray item = TZtsalesorder.optJSONArray("item"); + System.out.println("例子:查询结果字段OResultmsg-----------------"+ZfmGetSoResponse.optString("OResultmsg")); + System.out.println("例子:查询结果数组size-----------------"+item.size());*/ + + + /* String url = "http://192.168.0.82:8000/sap/bc/srt/rfc/sap/zfg_ecc_to_zhwl/800/zfg_ecc_to_zhwl/binding"; + String method = "ZfmGetDnZjwl"; //获取交货单 + HashMap form = new HashMap(); + form.put("IErdatFrm", "2019-05-01"); + form.put("IErdatTo", "2019-05-08"); + //非必填字段 + form.put("IVbeln", ""); + //非必填字段 + JSONObject ret = WebServiceUtil.process(url, method, form); + System.out.println("getXML发送数据-----------------" + ret.toString()); + JSONObject Envelope = ret.optJSONObject("soap-env:Envelope"); + JSONObject Body = Envelope.optJSONObject("soap-env:Body"); + JSONObject ZfmGetDnZjwlResponse = Body.getJSONObject("n0:ZfmGetDnZjwlResponse"); + JSONObject TZtdn = ZfmGetDnZjwlResponse.getJSONObject("TZtdn"); + JSONArray item = TZtdn.getJSONArray("item"); + System.out.println("例子:查询结果字段OResultmsg-----------------" + ZfmGetDnZjwlResponse.getString("OResultmsg")); + System.out.println("例子:查询结果数组size-----------------" + item.size());*/ + } +} diff --git a/mes/qd/src/components/Crud/RR.operation.vue b/mes/qd/src/components/Crud/RR.operation.vue index df2c138e..6bcfcbb4 100644 --- a/mes/qd/src/components/Crud/RR.operation.vue +++ b/mes/qd/src/components/Crud/RR.operation.vue @@ -1,8 +1,16 @@