diff --git a/Common/HttpUtilApi.cs b/Common/HttpUtilApi.cs
new file mode 100644
index 0000000..e68086d
--- /dev/null
+++ b/Common/HttpUtilApi.cs
@@ -0,0 +1,130 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using ZJ_BYD.Model.HttpApiParam;
+
+namespace ZJ_BYD.Common
+{
+ public class HttpUtilApi
+ {
+ private static string checkSnCodeUrl = "http://47.93.53.88:8280/scada-collected/checkSnCode";
+ private static string submitWorkStationDataUrl = "http://47.93.53.88:8280/scada-collected/submitWorkStationData";
+
+ ///
+ /// 条码验证及查询接口
+ ///
+ ///
+ ///
+ public static ResponseParam checkSnCode(CheckSnCode checkSnCode)
+ {
+ ResponseParam result = null;
+ try
+ {
+ var jsonStr = JsonConvert.SerializeObject(checkSnCode);
+
+ var reqStr = Post(checkSnCodeUrl, jsonStr);
+
+ result = JsonConvert.DeserializeObject(reqStr);
+
+ }
+ catch (Exception ex)
+ {
+ result = new ResponseParam()
+ {
+ code = 500,
+ msg = ex.Message
+ };
+
+ }
+ return result;
+ }
+
+ ///
+ /// 一体机工位提交数据
+ ///
+ ///
+ ///
+ public static ResponseParam submitWorkStationData(WorkData workData)
+ {
+ ResponseParam result = null;
+ try
+ {
+ var jsonStr = JsonConvert.SerializeObject(submitWorkStationDataUrl);
+
+ var respStr = Post(submitWorkStationDataUrl, jsonStr);
+
+ result = JsonConvert.DeserializeObject(respStr);
+ }
+ catch (Exception ex)
+ {
+ result = new ResponseParam()
+ {
+ code = 500,
+ msg = ex.Message
+ };
+ }
+ return result;
+ }
+
+ private static string Post(string Url, string jsonParas)
+ {
+ string postContent = "";
+ string strURL = Url;
+ //创建一个HTTP请求
+ HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strURL);
+ //Post请求方式
+ request.Method = "POST";
+ //内容类型
+ request.ContentType = "application/json";
+ request.UserAgent = "app";
+ //设置参数,并进行URL编码
+ string paraUrlCoded = jsonParas;//System.Web.HttpUtility.UrlEncode(jsonParas);
+ byte[] payload;
+ //将Json字符串转化为字节
+
+ payload = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
+ //设置请求的ContentLength
+ request.ContentLength = payload.Length;
+ //发送请求,获得请求流
+
+ Stream writer = null;
+ try
+ {
+ writer = request.GetRequestStream();//获取用于写入请求数据的Stream对象
+ }
+ catch (Exception)
+ {
+ // writer = null;
+ //Console.Write("连接服务器失败!");
+ postContent = "连接服务器失败!";
+ //writer.Close();//关闭请求流
+ return postContent;//返回Json数据
+ }
+ //将请求参数写入流
+ writer.Write(payload, 0, payload.Length);
+ writer.Close();//关闭请求流
+ // String strValue = "";//strValue为http响应所返回的字符流
+ HttpWebResponse response;
+ try
+ {
+ //获得响应流
+ response = (HttpWebResponse)request.GetResponse();
+ }
+ catch (WebException ex)
+ {
+ response = ex.Response as HttpWebResponse;
+ }
+ Stream s = response.GetResponseStream();
+ // Stream postData = Request.InputStream;
+ StreamReader sRead = new StreamReader(s);
+ postContent = sRead.ReadToEnd();
+ sRead.Close();
+ return postContent;//返回Json数据
+ }
+ }
+}
diff --git a/Model/HttpApiParam/CheckSnCode.cs b/Model/HttpApiParam/CheckSnCode.cs
new file mode 100644
index 0000000..c5265a4
--- /dev/null
+++ b/Model/HttpApiParam/CheckSnCode.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZJ_BYD.Model.HttpApiParam
+{
+ public class CheckSnCode
+ {
+ public string mainCode { get; set; }
+ public string _operator { get; set; }
+ public string productCode { get; set; }
+ public string snCode { get; set; }
+ public string snCodeName { get; set; }
+ public string snType { get; set; }
+ public string stationCode { get; set; }
+ }
+}
diff --git a/Model/HttpApiParam/DParams.cs b/Model/HttpApiParam/DParams.cs
new file mode 100644
index 0000000..ba0f936
--- /dev/null
+++ b/Model/HttpApiParam/DParams.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZJ_BYD.Model.HttpApiParam
+{
+ public class DParams
+ {
+ public string max { get; set; }
+ public string min { get; set; }
+ public string n { get; set; }
+ public string ng { get; set; }
+ public string step { get; set; }
+ public string stepName { get; set; }
+ public string v { get; set; }
+ public string vtype { get; set; }
+ }
+
+}
diff --git a/Model/HttpApiParam/ResponseData.cs b/Model/HttpApiParam/ResponseData.cs
new file mode 100644
index 0000000..c8adfa2
--- /dev/null
+++ b/Model/HttpApiParam/ResponseData.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZJ_BYD.Model.HttpApiParam
+{
+ public class ResponseData
+ {
+ public string inputNum { get; set; }
+ public string productCode { get; set; }
+ public string targetNum { get; set; }
+ public string rfId { get; set; }
+ public string useFlag { get; set; }
+ }
+}
diff --git a/Model/HttpApiParam/ResponseParam.cs b/Model/HttpApiParam/ResponseParam.cs
new file mode 100644
index 0000000..572b507
--- /dev/null
+++ b/Model/HttpApiParam/ResponseParam.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZJ_BYD.Model.HttpApiParam
+{
+ public class ResponseParam
+ {
+ public int code { get; set; }
+ public List data { get; set; }
+ public string msg { get; set; }
+ }
+
+}
diff --git a/Model/HttpApiParam/WorkData.cs b/Model/HttpApiParam/WorkData.cs
new file mode 100644
index 0000000..aca3165
--- /dev/null
+++ b/Model/HttpApiParam/WorkData.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZJ_BYD.Model.HttpApiParam
+{
+ public class WorkData
+ {
+ public List dparams { get; set; }
+ public string _operator { get; set; }
+ public string productCode { get; set; }
+ public int qc { get; set; }
+ public string rfId { get; set; }
+ public string snList { get; set; }
+ public string workStationCode { get; set; }
+ }
+
+}
diff --git a/ZJ_BYD.csproj b/ZJ_BYD.csproj
index 89f1132..4949bc6 100644
--- a/ZJ_BYD.csproj
+++ b/ZJ_BYD.csproj
@@ -240,6 +240,7 @@
BindOrder.cs
+
Component
@@ -250,6 +251,11 @@
LoginFrom.cs
+
+
+
+
+
@@ -786,6 +792,7 @@
+