From 41fde0575d9ed4e05246e8cd9b272874636bd182 Mon Sep 17 00:00:00 2001 From: wangsr Date: Sat, 7 Oct 2023 17:05:10 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E5=A4=84=E7=90=86=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- A3Lib/log4net/log4net.config | 30 +- .../DockingEntity/JsonReturnEntity.cs | 25 + .../DockingEntity/MaterialPlanSyncEntity.cs | 55 + .../TankDeviceStateSyncEntity.cs | 37 + .../TankIsDischargedSyncEntity.cs | 29 + .../InterfaceDocking/HttpHelper.cs | 919 ++++++++++++++ .../InterfaceDocking/HttpResponse.cs | 36 + .../InterfaceDocking/MiniJson.cs | 1075 +++++++++++++++++ .../ManualControl/InitAction.cs | 55 +- .../ManualControl/ManualControlAction.cs | 176 ++- .../Mesnac.Action.ChemicalWeighing.csproj | 7 + .../DeviceDetail2ReportAction.cs | 16 +- Main/MCEdit/App.config | 2 +- .../MCProject/nodeForm/ManualWaterControl.xml | 218 +++- Main/MCRun/App.config | 2 +- Main/MCRun/Data/SysConfig/MenuConfig.dat | Bin 20825 -> 19564 bytes 16 files changed, 2633 insertions(+), 49 deletions(-) create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/JsonReturnEntity.cs create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/MaterialPlanSyncEntity.cs create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/TankDeviceStateSyncEntity.cs create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/TankIsDischargedSyncEntity.cs create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/HttpHelper.cs create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/HttpResponse.cs create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/MiniJson.cs diff --git a/A3Lib/log4net/log4net.config b/A3Lib/log4net/log4net.config index 2e0d67f..1bcea6e 100644 --- a/A3Lib/log4net/log4net.config +++ b/A3Lib/log4net/log4net.config @@ -5,6 +5,7 @@ + @@ -20,9 +21,32 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/JsonReturnEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/JsonReturnEntity.cs new file mode 100644 index 0000000..49c23fe --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/JsonReturnEntity.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity +{ + public class JsonReturnEntity + { + /// + /// 请求ID + /// + public string reqCode { get; set; } + /// + /// 返回代码 + /// + public int code { get; set; } + /// + /// 返回信息 + /// + public string message { get; set; } + } + +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/MaterialPlanSyncEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/MaterialPlanSyncEntity.cs new file mode 100644 index 0000000..284f75a --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/MaterialPlanSyncEntity.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity +{ + public class MaterialPlanSyncEntity + { + /// + /// + /// + public string reqCode { get; set; } + /// + /// + /// + public DateTime reqTime { get; set; } + /// + /// + /// + public string planNo { get; set; } + /// + /// + /// + public List data { get; set; } + } + + public class UnLoadItems + { + /// + /// 料罐 + /// + public string unloadNo { get; set; } + } + + public class Data + { + /// + /// 物料 + /// + public string sku { get; set; } + /// + /// 成型机 + /// + public string loadNo { get; set; } + /// + /// + /// + public List unLoadItems { get; set; } + } +} + + + diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/TankDeviceStateSyncEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/TankDeviceStateSyncEntity.cs new file mode 100644 index 0000000..8df53c2 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/TankDeviceStateSyncEntity.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity +{ + public class TankDeviceStateSyncEntity + { + /// + /// 请求ID + /// + public string reqCode { get; set; } + /// + /// 请求时间 + /// + public DateTime reqTime { get; set; } + /// + /// 设备编码 + /// + public string deviceNo { get; set; } + /// + /// 物料编码 + /// + public string sku { get; set; } + /// + /// 0:异常,1:正常 2:进料 3:出料 + /// + public string state { get; set; } + /// + /// + /// + public string planID { get; set; } + } + +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/TankIsDischargedSyncEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/TankIsDischargedSyncEntity.cs new file mode 100644 index 0000000..9e83a52 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/DockingEntity/TankIsDischargedSyncEntity.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity +{ + public class TankIsDischargedSyncEntity + { + /// + /// 请求ID + /// + public string reqCode { get; set; } + /// + /// 请求时间 + /// + public DateTime reqTime { get; set; } + /// + /// 设备编码,1-8 + /// + public string deviceNo { get; set; } + /// + /// 0:无料,1:有料 + /// + public string state { get; set; } + } + +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/HttpHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/HttpHelper.cs new file mode 100644 index 0000000..f2ce4ab --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/HttpHelper.cs @@ -0,0 +1,919 @@ +using System; +using System.IO; +using System.IO.Compression; +using System.Linq; +using System.Net; +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Text.RegularExpressions; + +namespace Mesnac.Action.ChemicalWeighing.InterfaceDocking +{ + /// + /// Http连接操作帮助类 + /// + public class HttpHelper + { + #region 预定义方变量 + + //默认的编码 + private Encoding encoding = Encoding.Default; + + //Post数据编码 + private Encoding postencoding = Encoding.Default; + + //HttpWebRequest对象用来发起请求 + private HttpWebRequest request = null; + + //获取影响流的数据对象 + private HttpWebResponse response = null; + + //设置本地的出口ip和端口 + private IPEndPoint _IPEndPoint = null; + + #endregion 预定义方变量 + + #region Public + + /// + /// 根据相传入的数据,得到相应页面数据 + /// + /// 参数类对象 + /// 返回HttpResult类型 + public HttpResult GetHtml(HttpItem item) + { + //返回参数 + HttpResult result = new HttpResult(); + try + { + //准备参数 + SetRequest(item); + } + catch (Exception ex) + { + //配置参数时出错 + return new HttpResult() { Cookie = string.Empty, Header = null, Html = ex.Message, StatusDescription = "配置参数时出错:" + ex.Message }; + } + try + { + //请求数据 + using (response = (HttpWebResponse)request.GetResponse()) + { + GetData(item, result); + } + } + catch (WebException ex) + { + if (ex.Response != null) + { + using (response = (HttpWebResponse)ex.Response) + { + GetData(item, result); + } + } + else + { + result.Html = ex.Message; + } + } + catch (Exception ex) + { + result.Html = ex.Message; + } + if (item.IsToLower) result.Html = result.Html.ToLower(); + //重置request,response为空 + if (item.IsReset) + { + request = null; + response = null; + } + return result; + } + + #endregion Public + + #region GetData + + /// + /// 获取数据的并解析的方法 + /// + /// + /// + private void GetData(HttpItem item, HttpResult result) + { + if (response == null) + { + return; + } + + #region base + + //获取StatusCode + result.StatusCode = response.StatusCode; + //获取StatusDescription + result.StatusDescription = response.StatusDescription; + //获取Headers + result.Header = response.Headers; + //获取最后访问的URl + result.ResponseUri = response.ResponseUri.ToString(); + //获取CookieCollection + if (response.Cookies != null) result.CookieCollection = response.Cookies; + //获取set-cookie + if (response.Headers["set-cookie"] != null) result.Cookie = response.Headers["set-cookie"]; + + #endregion base + + #region byte + + //处理网页Byte + byte[] ResponseByte = GetByte(); + + #endregion byte + + #region Html + + if (ResponseByte != null && ResponseByte.Length > 0) + { + //设置编码 + SetEncoding(item, result, ResponseByte); + //得到返回的HTML + result.Html = encoding.GetString(ResponseByte); + } + else + { + //没有返回任何Html代码 + result.Html = string.Empty; + } + + #endregion Html + } + + /// + /// 设置编码 + /// + /// HttpItem + /// HttpResult + /// byte[] + private void SetEncoding(HttpItem item, HttpResult result, byte[] ResponseByte) + { + //是否返回Byte类型数据 + if (item.ResultType == ResultType.Byte) result.ResultByte = ResponseByte; + //从这里开始我们要无视编码了 + if (encoding == null) + { + Match meta = Regex.Match(Encoding.Default.GetString(ResponseByte), " 0) + { + c = meta.Groups[1].Value.ToLower().Trim(); + } + if (c.Length > 2) + { + try + { + encoding = Encoding.GetEncoding(c.Replace("\"", string.Empty).Replace("'", "").Replace(";", "").Replace("iso-8859-1", "gbk").Trim()); + } + catch + { + if (string.IsNullOrEmpty(response.CharacterSet)) + { + encoding = Encoding.UTF8; + } + else + { + encoding = Encoding.GetEncoding(response.CharacterSet); + } + } + } + else + { + if (string.IsNullOrEmpty(response.CharacterSet)) + { + encoding = Encoding.UTF8; + } + else + { + encoding = Encoding.GetEncoding(response.CharacterSet); + } + } + } + } + + /// + /// 提取网页Byte + /// + /// + private byte[] GetByte() + { + byte[] ResponseByte = null; + using (MemoryStream _stream = new MemoryStream()) + { + //GZIIP处理 + if (response.ContentEncoding != null && response.ContentEncoding.Equals("gzip", StringComparison.InvariantCultureIgnoreCase)) + { + //开始读取流并设置编码方式 + new GZipStream(response.GetResponseStream(), CompressionMode.Decompress).CopyTo(_stream, 1024); + } + else + { + //开始读取流并设置编码方式 + response.GetResponseStream().CopyTo((Stream)_stream, 1024); + } + //获取Byte + ResponseByte = _stream.ToArray(); + } + return ResponseByte; + } + + #endregion GetData + + #region SetRequest + + /// + /// 为请求准备参数 + /// + ///参数列表 + private void SetRequest(HttpItem item) + { + // 验证证书 + SetCer(item); + if (item.IPEndPoint != null) + { + _IPEndPoint = item.IPEndPoint; + //设置本地的出口ip和端口 + request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(BindIPEndPointCallback); + } + //设置Header参数 + if (item.Header != null && item.Header.Count > 0) + { + foreach (string key in item.Header.AllKeys) + { + request.Headers.Add(key, item.Header[key]); + } + } + + // 设置代理 + SetProxy(item); + if (item.ProtocolVersion != null) request.ProtocolVersion = item.ProtocolVersion; + request.ServicePoint.Expect100Continue = item.Expect100Continue; + //请求方式Get或者Post + request.Method = item.Method; + request.Timeout = item.Timeout; + request.KeepAlive = item.KeepAlive; + request.ReadWriteTimeout = item.ReadWriteTimeout; + if (!string.IsNullOrWhiteSpace(item.Host)) + { + request.Host = item.Host; + } + if (item.IfModifiedSince != null) request.IfModifiedSince = Convert.ToDateTime(item.IfModifiedSince); + //Accept + request.Accept = item.Accept; + //ContentType返回类型 + request.ContentType = item.ContentType; + //UserAgent客户端的访问类型,包括浏览器版本和操作系统信息 + request.UserAgent = item.UserAgent; + // 编码 + encoding = item.Encoding; + //设置安全凭证 + request.Credentials = item.ICredentials; + //设置Cookie + SetCookie(item); + //来源地址 + request.Referer = item.Referer; + //是否执行跳转功能 + request.AllowAutoRedirect = item.Allowautoredirect; + if (item.MaximumAutomaticRedirections > 0) + { + request.MaximumAutomaticRedirections = item.MaximumAutomaticRedirections; + } + //设置Post数据 + SetPostData(item); + //设置最大连接 + if (item.Connectionlimit > 0) request.ServicePoint.ConnectionLimit = item.Connectionlimit; + } + + /// + /// 设置证书 + /// + /// + private void SetCer(HttpItem item) + { + if (!string.IsNullOrWhiteSpace(item.CerPath)) + { + //这一句一定要写在创建连接的前面。使用回调的方法进行证书验证。 + ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult); + //初始化对像,并设置请求的URL地址 + request = (HttpWebRequest)WebRequest.Create(item.URL); + SetCerList(item); + //将证书添加到请求里 + request.ClientCertificates.Add(new X509Certificate(item.CerPath)); + } + else + { + //初始化对像,并设置请求的URL地址 + request = (HttpWebRequest)WebRequest.Create(item.URL); + SetCerList(item); + } + } + + /// + /// 设置多个证书 + /// + /// + private void SetCerList(HttpItem item) + { + if (item.ClentCertificates != null && item.ClentCertificates.Count > 0) + { + foreach (X509Certificate c in item.ClentCertificates) + { + request.ClientCertificates.Add(c); + } + } + } + + /// + /// 设置Cookie + /// + /// Http参数 + private void SetCookie(HttpItem item) + { + if (!string.IsNullOrEmpty(item.Cookie)) request.Headers[HttpRequestHeader.Cookie] = item.Cookie; + //设置CookieCollection + if (item.ResultCookieType == ResultCookieType.CookieCollection) + { + request.CookieContainer = new CookieContainer(); + if (item.CookieCollection != null && item.CookieCollection.Count > 0) + { + //默认为20个,如果超出需要增加长度 + if (item.CookieCollection.Count > 20) + { + request.CookieContainer.PerDomainCapacity = item.CookieCollection.Count; + } + request.CookieContainer.Add(item.CookieCollection); + } + } + } + + /// + /// 设置Post数据 + /// + /// Http参数 + private void SetPostData(HttpItem item) + { + //验证在得到结果时是否有传入数据 + if (!request.Method.Trim().ToLower().Contains("get")) + { + if (item.PostEncoding != null) + { + postencoding = item.PostEncoding; + } + byte[] buffer = null; + //写入Byte类型 + if (item.PostDataType == PostDataType.Byte && item.PostdataByte != null && item.PostdataByte.Length > 0) + { + //验证在得到结果时是否有传入数据 + buffer = item.PostdataByte; + }//写入文件 + else if (item.PostDataType == PostDataType.FilePath && !string.IsNullOrWhiteSpace(item.Postdata)) + { + StreamReader r = new StreamReader(item.Postdata, postencoding); + buffer = postencoding.GetBytes(r.ReadToEnd()); + r.Close(); + } //写入字符串 + else if (!string.IsNullOrWhiteSpace(item.Postdata)) + { + buffer = postencoding.GetBytes(item.Postdata); + } + if (buffer != null) + { + request.ContentLength = buffer.Length; + request.GetRequestStream().Write(buffer, 0, buffer.Length); + } + else + { + request.ContentLength = 0; + } + } + } + + /// + /// 设置代理 + /// + /// 参数对象 + private void SetProxy(HttpItem item) + { + bool isIeProxy = false; + if (!string.IsNullOrWhiteSpace(item.ProxyIp)) + { + isIeProxy = item.ProxyIp.ToLower().Contains("ieproxy"); + } + if (!string.IsNullOrWhiteSpace(item.ProxyIp) && !isIeProxy) + { + //设置代理服务器 + if (item.ProxyIp.Contains(":")) + { + string[] plist = item.ProxyIp.Split(':'); + WebProxy myProxy = new WebProxy(plist[0].Trim(), Convert.ToInt32(plist[1].Trim())); + //建议连接 + myProxy.Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd); + //给当前请求对象 + request.Proxy = myProxy; + } + else + { + WebProxy myProxy = new WebProxy(item.ProxyIp, false); + //建议连接 + myProxy.Credentials = new NetworkCredential(item.ProxyUserName, item.ProxyPwd); + //给当前请求对象 + request.Proxy = myProxy; + } + } + else if (isIeProxy) + { + //设置为IE代理 + } + else + { + request.Proxy = item.WebProxy; + } + } + + #endregion SetRequest + + #region private main + + /// + /// 回调验证证书问题 + /// + /// 流对象 + /// 证书 + /// X509Chain + /// SslPolicyErrors + /// bool + private bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) + { return true; } + + /// + /// 通过设置这个属性,可以在发出连接的时候绑定客户端发出连接所使用的IP地址。 + /// + /// + /// + /// + /// + private IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) + { + return _IPEndPoint;//端口号 + } + + #endregion private main + } + + #region public calss + + /// + /// Http请求参考类 + /// + public class HttpItem + { + /// + /// 请求URL必须填写 + /// + public string URL { get; set; } + + private string _Method = "GET"; + + /// + /// 请求方式默认为GET方式,当为POST方式时必须设置Postdata的值 + /// + public string Method + { + get { return _Method; } + set { _Method = value; } + } + + private int _Timeout = 100000; + + /// + /// 默认请求超时时间 + /// + public int Timeout + { + get { return _Timeout; } + set { _Timeout = value; } + } + + private int _ReadWriteTimeout = 30000; + + /// + /// 默认写入Post数据超时间 + /// + public int ReadWriteTimeout + { + get { return _ReadWriteTimeout; } + set { _ReadWriteTimeout = value; } + } + + /// + /// 设置Host的标头信息 + /// + public string Host { get; set; } + + private Boolean _KeepAlive = true; + + /// + /// 获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接默认为true。 + /// + public Boolean KeepAlive + { + get { return _KeepAlive; } + set { _KeepAlive = value; } + } + + private string _Accept = "text/html, application/xhtml+xml, */*"; + + /// + /// 请求标头值 默认为text/html, application/xhtml+xml, */* + /// + public string Accept + { + get { return _Accept; } + set { _Accept = value; } + } + + private string _ContentType = "text/html"; + + /// + /// 请求返回类型默认 text/html + /// + public string ContentType + { + get { return _ContentType; } + set { _ContentType = value; } + } + + private string _UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)"; + + /// + /// 客户端访问信息默认Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) + /// + public string UserAgent + { + get { return _UserAgent; } + set { _UserAgent = value; } + } + + /// + /// 返回数据编码默认为NUll,可以自动识别,一般为utf-8,gbk,gb2312 + /// + public Encoding Encoding { get; set; } + + private PostDataType _PostDataType = PostDataType.String; + + /// + /// Post的数据类型 + /// + public PostDataType PostDataType + { + get { return _PostDataType; } + set { _PostDataType = value; } + } + + /// + /// Post请求时要发送的字符串Post数据 + /// + public string Postdata { get; set; } + + /// + /// Post请求时要发送的Byte类型的Post数据 + /// + public byte[] PostdataByte { get; set; } + + /// + /// Cookie对象集合 + /// + public CookieCollection CookieCollection { get; set; } + + /// + /// 请求时的Cookie + /// + public string Cookie { get; set; } + + /// + /// 来源地址,上次访问地址 + /// + public string Referer { get; set; } + + /// + /// 证书绝对路径 + /// + public string CerPath { get; set; } + + /// + /// 设置代理对象,不想使用IE默认配置就设置为Null,而且不要设置ProxyIp + /// + public WebProxy WebProxy { get; set; } + + private Boolean isToLower = false; + + /// + /// 是否设置为全文小写,默认为不转化 + /// + public Boolean IsToLower + { + get { return isToLower; } + set { isToLower = value; } + } + + private Boolean allowautoredirect = false; + + /// + /// 支持跳转页面,查询结果将是跳转后的页面,默认是不跳转 + /// + public Boolean Allowautoredirect + { + get { return allowautoredirect; } + set { allowautoredirect = value; } + } + + private int connectionlimit = 1024; + + /// + /// 最大连接数 + /// + public int Connectionlimit + { + get { return connectionlimit; } + set { connectionlimit = value; } + } + + /// + /// 代理Proxy 服务器用户名 + /// + public string ProxyUserName { get; set; } + + /// + /// 代理 服务器密码 + /// + public string ProxyPwd { get; set; } + + /// + /// 代理 服务IP,如果要使用IE代理就设置为ieproxy + /// + public string ProxyIp { get; set; } + + private ResultType resulttype = ResultType.String; + + /// + /// 设置返回类型String和Byte + /// + public ResultType ResultType + { + get { return resulttype; } + set { resulttype = value; } + } + + private WebHeaderCollection header = new WebHeaderCollection(); + + /// + /// header对象 + /// + public WebHeaderCollection Header + { + get { return header; } + set { header = value; } + } + + /// + // 获取或设置用于请求的 HTTP 版本。返回结果:用于请求的 HTTP 版本。默认为 System.Net.HttpVersion.Version11。 + /// + public Version ProtocolVersion { get; set; } + + private Boolean _expect100continue = false; + + /// + /// 获取或设置一个 System.Boolean 值,该值确定是否使用 100-Continue 行为。如果 POST 请求需要 100-Continue 响应,则为 true;否则为 false。默认值为 true。 + /// + public Boolean Expect100Continue + { + get { return _expect100continue; } + set { _expect100continue = value; } + } + + /// + /// 设置509证书集合 + /// + public X509CertificateCollection ClentCertificates { get; set; } + + /// + /// 设置或获取Post参数编码,默认的为Default编码 + /// + public Encoding PostEncoding { get; set; } + + private ResultCookieType _ResultCookieType = ResultCookieType.String; + + /// + /// Cookie返回类型,默认的是只返回字符串类型 + /// + public ResultCookieType ResultCookieType + { + get { return _ResultCookieType; } + set { _ResultCookieType = value; } + } + + private ICredentials _ICredentials = CredentialCache.DefaultCredentials; + + /// + /// 获取或设置请求的身份验证信息。 + /// + public ICredentials ICredentials + { + get { return _ICredentials; } + set { _ICredentials = value; } + } + + /// + /// 设置请求将跟随的重定向的最大数目 + /// + public int MaximumAutomaticRedirections { get; set; } + + private DateTime? _IfModifiedSince = null; + + /// + /// 获取和设置IfModifiedSince,默认为当前日期和时间 + /// + public DateTime? IfModifiedSince + { + get { return _IfModifiedSince; } + set { _IfModifiedSince = value; } + } + + #region ip-port + + private IPEndPoint _IPEndPoint = null; + + /// + /// 设置本地的出口ip和端口 + /// ] + /// + ///item.IPEndPoint = new IPEndPoint(IPAddress.Parse("192.168.1.1"),80); + /// + public IPEndPoint IPEndPoint + { + get { return _IPEndPoint; } + set { _IPEndPoint = value; } + } + + #endregion ip-port + + private bool _isReset = false; + + /// + /// 是否重置request,response的值,默认不重置,当设置为True时request,response将被设置为Null + /// + public bool IsReset + { + get { return _isReset; } + set { _isReset = value; } + } + } + + /// + /// Http返回参数类 + /// + public class HttpResult + { + /// + /// Http请求返回的Cookie + /// + public string Cookie { get; set; } + + /// + /// Cookie对象集合 + /// + public CookieCollection CookieCollection { get; set; } + + private string _html = string.Empty; + + /// + /// 返回的String类型数据 只有ResultType.String时才返回数据,其它情况为空 + /// + public string Html + { + get { return _html; } + set { _html = value; } + } + + /// + /// 返回的Byte数组 只有ResultType.Byte时才返回数据,其它情况为空 + /// + public byte[] ResultByte { get; set; } + + /// + /// header对象 + /// + public WebHeaderCollection Header { get; set; } + + /// + /// 返回状态说明 + /// + public string StatusDescription { get; set; } + + /// + /// 返回状态码,默认为OK + /// + public HttpStatusCode StatusCode { get; set; } + + /// + /// 最后访问的URl + /// + public string ResponseUri { get; set; } + + /// + /// 获取重定向的URl + /// + public string RedirectUrl + { + get + { + try + { + if (Header != null && Header.Count > 0) + { + if (Header.AllKeys.Any(k => k.ToLower().Contains("location"))) + { + string baseurl = Header["location"].ToString().Trim(); + string locationurl = baseurl.ToLower(); + if (!string.IsNullOrWhiteSpace(locationurl)) + { + bool b = locationurl.StartsWith("http://") || locationurl.StartsWith("https://"); + if (!b) + { + baseurl = new Uri(new Uri(ResponseUri), baseurl).AbsoluteUri; + } + } + return baseurl; + } + } + } + catch { } + return string.Empty; + } + } + } + + /// + /// 返回类型 + /// + public enum ResultType + { + /// + /// 表示只返回字符串 只有Html有数据 + /// + String, + + /// + /// 表示返回字符串和字节流 ResultByte和Html都有数据返回 + /// + Byte + } + + /// + /// Post的数据格式默认为string + /// + public enum PostDataType + { + /// + /// 字符串类型,这时编码Encoding可不设置 + /// + String, + + /// + /// Byte类型,需要设置PostdataByte参数的值编码Encoding可设置为空 + /// + Byte, + + /// + /// 传文件,Postdata必须设置为文件的绝对路径,必须设置Encoding的值 + /// + FilePath + } + + /// + /// Cookie返回类型 + /// + public enum ResultCookieType + { + /// + /// 只返回字符串类型的Cookie + /// + String, + + /// + /// CookieCollection格式的Cookie集合同时也返回String类型的cookie + /// + CookieCollection + } + + #endregion public calss +} \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/HttpResponse.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/HttpResponse.cs new file mode 100644 index 0000000..22994a0 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/HttpResponse.cs @@ -0,0 +1,36 @@ +using Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.InterfaceDocking +{ + public class HttpResponse + { + public string PostResponse(TankIsDischargedSyncEntity taskIsDisChargedSyncEntity) + { + HttpItem item = new HttpItem() + { + URL = "", //URL 必需项 + Method = "post",//URL 可选项 默认为Get + ContentType = "application/json",//返回类型 可选项有默认值 + PostDataType = PostDataType.String, + PostEncoding = Encoding.UTF8, + Postdata = taskIsDisChargedSyncEntity.JsonTo(), + ResultType = ResultType.String + }; + try + { + HttpResult httpResult = new HttpHelper().GetHtml(item); + return httpResult.Html; + } + catch (Exception ex) + { + string message = $" url:{item.URL} {Environment.NewLine} Data:{item.Postdata} {Environment.NewLine} 异常信息:{ex.Message}"; + return ex.Message; + } + } + } +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/MiniJson.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/MiniJson.cs new file mode 100644 index 0000000..c74b46a --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/InterfaceDocking/MiniJson.cs @@ -0,0 +1,1075 @@ +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Data; +using System.Drawing; +using System.Drawing.Imaging; +using System.Dynamic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; + +namespace System +{ + /// + /// 过滤不需要序列化的字段 + /// + public class FastIgnore : Attribute { } + /// + /// Json序列化 + /// + public static class JsonMini + { + #region 公共方法 + /// + /// 全局时间序列化样式,默认为yyyy-MM-dd HH:mm:ss + /// + public static string TimeFormat = "yyyy-MM-dd HH:mm:ss"; + + /// + /// 将Json字符串转为指定类型 + /// + /// + /// + /// + public static T JsonFrom(this string s) where T : class + { + return (T)s.JsonFrom(typeof(T)); + } + + public static object JsonFrom(this string s, Type t) + { + if (string.IsNullOrEmpty(s)) + throw new NullReferenceException("不能为空"); + s = s.Trim(); + StringBuilder sb = new StringBuilder(s.Length); + Dictionary dict = new Dictionary(); + List list = new List(); + int index = 0; + + if (s[0] == '\"' && s[s.Length - 1] == '\"') + { + s = s.Trim('\"').Replace("\\\"", "\"");//去除转义 + } + if (s.Length < 2 || (s[0] == '{' && s[s.Length - 1] != '}') || (s[0] == '[' && s[s.Length - 1] != ']')) + { + throw new NullReferenceException("不是JSON字符串"); + } + switch (s[0]) + { + case '{': + return s.GetObject(ref index, sb, list).ToObject(t); + case '[': + var data = s.GetArray(ref index, sb, dict); + if (t == typeof(DataTable)) + return data.ToDataTable();//处理表类型 + if (t.GetGenericArguments().Length < 1) + return ChangeData(t, data);//处理各种类型 + if (t.IsList()) + return ChangeList(t.GetGenericArguments()[0], data);//处理集合类型 + throw new NullReferenceException("类型应该为集合"); + default: + throw new NullReferenceException("缺失{或["); + } + } + + /// + /// 将Json字符串转为对象
+ /// 重载,当前数据类型速度最快 + ///
+ /// + /// + public static Dictionary JsonFrom(this string s) + { + return JsonFrom>(s); + } + + /// + /// 将对象转为Json字符串 + /// + /// + /// + /// 时间序列化样式,默认为yyyy-MM-dd HH:mm:ss + /// + public static string JsonTo(this T t, string timeFormat = null) + { + StringBuilder sb = new StringBuilder(); + t.CodeObject(sb, timeFormat ?? TimeFormat); + return sb.ToString(); + } + + /// + /// 将dynamic转为Json字符串 + /// + /// + /// + /// + public static string JsonTo(dynamic t, string timeFormat = null) + { + StringBuilder sb = new StringBuilder(); + t.CodeObject(sb, timeFormat ?? TimeFormat); + return sb.ToString(); + } + + #endregion + + #region 动态获取 + /// + /// 获取数组类型元素的数量,方便PickData方法循环提取数组里所有元素 + /// + /// + /// + /// + public static int ArrayCount(string json, string array = "") + { + if (string.IsNullOrEmpty(array.Trim(' '))) + { + return json.JsonFrom>().Count(); + } + var result = PickData(json, array); + if (result is IList arr) + { + return arr.Count; + } + return 0; + } + /// + /// 获取字段,array参数用空格分隔,数字为索引,非数字为字段 + /// + /// + /// + /// + public static object PickData(string json, string array) + { + var arr = array.Trim(' ').Split(' '); + if (arr.Length > 0) + { + if (int.TryParse(arr[0], out int _)) + { + return PickData(json.JsonFrom>(), array.Trim(' ').Split(' '), 0); + } + } + return PickData(json.JsonFrom(), array.Trim(' ').Split(' '), 0); + } + static object PickData(object json, string[] array, int index = 0) + { + if (index >= array.Length) + { + return json; + } + var key = array[index]; + if (int.TryParse(key, out int pos)) + { + if (json is List list) + { + index++; + return PickData(list[pos], array, index); + } + } + else + { + if (json is IDictionary dict) + { + if (dict.TryGetValue(key, out object value)) + { + index++; + return PickData(value, array, index); + } + } + } + return null; + } + #endregion + + #region 转换为实体类对应的类型 + + static bool IsDictionary(this Type type) => (typeof(IDictionary).IsAssignableFrom(type)); + + static bool IsList(this Type type) => (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>)); + + /// + /// 处理数组类型 + /// https://gitee.com/majorworld + /// + /// + /// + /// + static object ChangeArray(Type type, IList data) + { + var array = Array.CreateInstance(type, data.Count); + for (int i = 0; i < data.Count; i++) + { + array.SetValue(type.ChangeData(data[i]), i); + } + return array; + } + + /// + /// 转换ArrayList类型 + /// https://gitee.com/majorworld + /// + /// + /// + static ArrayList ChangeArrayList(object value) + { + ArrayList array = new ArrayList(); + if (value is IList list) + { + foreach (var item in list) + array.Add(item); + } + return array; + } + + /// + /// 转换Color类型 + /// https://gitee.com/majorworld + /// + /// + /// + static Color ChangeColor(string s) + { + if (s[0] == '#') + return Color.FromArgb(Convert.ToInt32(s.Substring(1), 16)); + var c = s.Split(','); + if (c.Length == 3) + return Color.FromArgb(int.Parse(c[0]), int.Parse(c[1]), int.Parse(c[2])); + else if (c.Length == 4) + return Color.FromArgb(int.Parse(c[0]), int.Parse(c[1]), int.Parse(c[2]), int.Parse(c[3])); + return Color.FromName(s); + } + + /// + /// 转换为各种数据 + /// https://gitee.com/majorworld + /// + /// + /// + /// + static object ChangeData(this Type p, object value) + { + if (value is null) + return null; + if (value.GetType() == p) + return value; + else if (value is Dictionary dictionary) + return ToObject(dictionary, p);//解析子级实体类的数据 + else if (p == typeof(Bitmap) || p == typeof(Image)) + return Base64ToImage(value as string); + else if (p == typeof(string)) + return value.JsonTo(); + else if (p.IsPrimitive && p != typeof(char)) + return Convert.ChangeType(value, p); + else if (p == typeof(byte[])) + return Convert.FromBase64String(value as string); + else if (p == typeof(Color)) + return ChangeColor(value as string); + else if (p == typeof(Point)) + return ChangePoint(value as string); + else if (p == typeof(Guid)) + return Guid.Parse(value as string); + else if (p == typeof(ArrayList)) + return ChangeArrayList(value);//处理动态数组类型 + else if (p.IsEnum) + return Enum.ToObject(p, value);//处理枚举 + else if (p == typeof(DataTable)) + { + if (value is List list) + { + return list.ToDataTable(); + } + } + else if (value is IList list) + { + if (p.GetGenericArguments().Length < 1) + { + if (p.IsArray) + return ChangeArray(p.GetElementType(), value as IList);//处理数组类型 + List d = new List(); + foreach (var kv in list as dynamic) + { + if (kv is Dictionary dict) + d.Add(dict.ToObject(typeof(object))); + } + return d;//解析dynamic + } + return ChangeList(p.GetGenericArguments()[0], value as List);//处理List类型 + } + Type t = Nullable.GetUnderlyingType(p); + if (t is null) + return Convert.ChangeType(value, p); + return ChangeData(t, value);//处理可空类型 + } + + /// + /// 处理字典类型 + /// https://gitee.com/majorworld + /// + /// + /// + /// + static object ChangeDictionary(Type type, Dictionary dict) + { + //反射创建泛型字典 + var t = typeof(Dictionary<,>).MakeGenericType(new[] { type.GetGenericArguments()[0], type.GetGenericArguments()[1] }); ; + var d = Activator.CreateInstance(t) as IDictionary; + foreach (var item in dict) + d.Add(type.GetGenericArguments()[0].ChangeData(item.Key), type.GetGenericArguments()[1].ChangeData(item.Value)); + return d; + } + + /// + /// 处理集合类型 + /// https://gitee.com/majorworld + /// + /// + /// + /// + static object ChangeList(Type type, List data) + { + IList list = Activator.CreateInstance(typeof(List<>).MakeGenericType(type)) as IList; + foreach (var item in data) + list.Add(type.ChangeData(item)); + return list; + } + + /// + /// 转换Point类型 + /// https://gitee.com/majorworld + /// + /// + /// + static Point ChangePoint(string s) + { + var c = s.Split(','); + return new Point(int.Parse(c[0]), int.Parse(c[1])); + } + + /// + /// List转DataTable + /// https://gitee.com/majorworld + /// + /// + /// + /// + static DataTable ToDataTable(this List list) + { + DataTable dt = new DataTable(); + for (int i = 0; i < list.Count; i++) + { + Dictionary dict = list[i] as Dictionary; + if (i == 0) + { + foreach (var item in dict) + { + if (item.Value is null) + dt.Columns.Add(item.Key, typeof(object)); + else + dt.Columns.Add(item.Key, item.Value.GetType()); + } + } + dt.Rows.Add(dict.Values.ToArray()); + } + return dt; + } + + + /// + /// 获取动态类型 + /// https://gitee.com/majorworld + /// + /// + /// + static dynamic GetDynamic(this Dictionary dict) + { + dynamic d = new ExpandoObject(); + foreach (var kv in dict) + { + if (kv.Value is IList list) + { + List array = new List(); + foreach (var item in list) + { + if (item is Dictionary dictChild) + { + array.Add(GetDynamic(dictChild)); + } + } + (d as ICollection>).Add(new KeyValuePair(kv.Key, array)); + } + else if (kv.Value is Dictionary dictionary) + (d as ICollection>).Add(new KeyValuePair(kv.Key, ToObject(dictionary, typeof(object)))); + else + (d as ICollection>).Add(kv); + } + return d; + } + /// + /// 转换为对象 + /// https://gitee.com/majorworld + /// + /// + /// + /// + static object ToObject(this Dictionary dict, Type type) + { + //(1/4)返回原始解析数据 + if (type == typeof(Dictionary)) + { + return dict; + } + //(2/4)返回dynamic类型数据 + if (type.UnderlyingSystemType.Name == "Object") + { + return GetDynamic(dict); + } + //(3/4)返回DataSet类型数据 + if (type == typeof(DataSet)) + { + DataSet ds = new DataSet(); + foreach (var item in dict) + { + if (item.Value is List list) + { + var dt = list.ToDataTable(); + dt.TableName = item.Key; + ds.Tables.Add(dt); + } + } + return ds; + } + + //(4/4)返回所绑定的实体类数据 + object obj = null; + if (type == typeof(string)) + { + obj = dict.JsonTo(); + } + else + { + obj = Activator.CreateInstance(type); + } + var props = type.GetCacheInfo(); + foreach (var kv in dict) + { + var prop = props.Where(x => string.Equals(x.Name, kv.Key, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); + if (prop is null) + { + if (type.IsDictionary()) + return ChangeDictionary(type, dict);//解析值是字典的数据(非缓存字段的字典) + continue; + } + if (prop.CanWrite) + prop.SetValue(obj, prop.PropertyType.ChangeData(kv.Value), null);//递归调用当前方法,解析子级 + } + return obj; + } + + #endregion 转换 + + #region 解析字符串为对象 + + /// + /// 解析集合 + /// https://gitee.com/majorworld + /// + /// + /// + /// + /// + /// + static List GetArray(this string s, ref int index, StringBuilder sb, Dictionary dict) + { + index++; + List list = new List(); + while (index < s.Length) + { + switch (s[index]) + { + case ',': + index++; + break; + case '"': + list.Add(s.GetString(ref index, sb)); + break; + case ']': + ++index; + return list; + case ' ': + case '\r': + case '\n': + case '\t': + case '\f': + case '\b': + ++index; + break; + default: + list.Add(s.GetData(s[index], ref index, sb, dict, list)); + break; + } + } + return list; + } + + /// + /// 解析对象 + /// https://gitee.com/majorworld + /// + /// + /// + /// + /// + /// + static Dictionary GetObject(this string s, ref int index, StringBuilder sb, List list) + { + index++; + Dictionary dict = new Dictionary(); + string key = string.Empty; + bool iskey = true; + while (index < s.Length) + { + switch (s[index]) + { + case ',': + iskey = true; + key = string.Empty; + index++; + break; + case ':': + iskey = false; + index++; + break; + case '}': + ++index; + return dict; + case '"': + if (iskey) + key = s.GetString(ref index, sb); + else + dict.Add(key, s.GetString(ref index, sb)); + break; + case ' ': + case '\r': + case '\n': + case '\t': + case '\f': + case '\b': + index++; + break; + default: + dict.Add(key, s.GetData(s[index], ref index, sb, dict, list)); + break; + } + } + throw new FormatException("解析错误,不完整的Json"); + } + + /// + /// 获取布尔数据 + /// https://gitee.com/majorworld + /// + /// + /// + /// + /// + static bool GetBool(this string s, ref int index, bool state) + { + if (state) + { + if (s[index + 1] == 'r' && s[index + 2] == 'u' && s[index + 3] == 'e') + { + index += 4; + return true; + } + } + else + { + if (s[index + 1] == 'a' && s[index + 2] == 'l' && s[index + 3] == 's' && s[index + 4] == 'e') + { + index += 5; + return false; + } + } + throw new FormatException($"\"{string.Concat(s[index], s[index + 1], s[index + 2], s[index + 3])}\"处Json格式无法解析"); + } + + /// + /// 自动获取数据 + /// https://gitee.com/majorworld + /// + /// + /// + /// + /// + /// + /// + /// + static object GetData(this string s, char c, ref int index, StringBuilder sb, Dictionary dict, List list) + { + switch (c) + { + case 't': + return s.GetBool(ref index, true); + case 'f': + return s.GetBool(ref index, false); + case 'n': + return s.GetNull(ref index); + case '{': + return s.GetObject(ref index, sb, list); + case '[': + return s.GetArray(ref index, sb, dict); + default: + return s.GetNumber(ref index, sb); + } + } + + /// + /// 获取空数据 + /// https://gitee.com/majorworld + /// + /// + /// + /// + static object GetNull(this string s, ref int index) + { + if (s[index + 1] == 'u' && s[index + 2] == 'l' && s[index + 3] == 'l') + { + index += 4; + return null; + } + throw new FormatException($"\"{string.Concat(s[index], s[index + 1], s[index + 2], s[index + 3])}\"处Json格式无法解析"); + } + + /// + /// 获取数字数据 + /// https://gitee.com/majorworld + /// + /// + /// + /// + /// + static object GetNumber(this string s, ref int index, StringBuilder sb) + { + sb.Clear(); + for (; index < s.Length; ++index) + { + if (s[index] == ',' || s[index] == '}' || s[index] == ']' || s[index] == ' ' || s[index] == '\n' || s[index] == '\r') + break; + else + sb.Append(s[index]); + } + string code = sb.ToString(); + if (int.TryParse(code, out int x)) + return x; + if (long.TryParse(code, out long y)) + return y; + if (double.TryParse(code, out double z)) + return z; + throw new FormatException($"\"{code}\"处Json格式无法解析"); + } + + /// + /// 获取字符串数据 + /// https://gitee.com/majorworld + /// + /// + /// + /// + /// + static string GetString(this string s, ref int index, StringBuilder sb) + { + sb.Clear(); + index++; + + for (; index < s.Length; ++index) + { + switch (s[index]) + { + case '"': + index++; + return sb.ToString(); + case '\\': + switch (s[index + 1]) + { + case 'u'://添加对unicode字符串的支持 + if (int.TryParse(s.Substring(index + 2, 4), Globalization.NumberStyles.AllowHexSpecifier, null, out int c)) + { + index = index + 5; + sb.Append((char)c); + break; + } + break; + #region 2023年9月6日添加对转义字符的支持 + case 'r': + index++; + sb.Append('\r'); + break; + case 'n': + index++; + sb.Append('\n'); + break; + case 't': + index++; + sb.Append('\t'); + break; + case 'f': + index++; + sb.Append('\f'); + break; + case 'b': + index++; + sb.Append('\b'); + break; + case '\'': + index++; + sb.Append('\''); + break; + #endregion + default: + if (s[index + 1] == '"' || s[index + 1] == '\\') + index++; + sb.Append(s[index]); + break; + } + break; + default: + sb.Append(s[index]); + break; + } + } + throw new FormatException($"\"{sb}\"处Json格式无法解析"); + } + + #endregion 解析 + + #region 编码对象为字符串 + /// + /// 缓存数据加速序列化速度,主要是减少不必要的GetCustomAttributes获取特性并过滤字段 + /// + static ConcurrentDictionary InfoCache = new ConcurrentDictionary(); + + /// + /// base64 转 Image + /// + /// + static Bitmap Base64ToImage(this string base64) + { + if (string.IsNullOrEmpty(base64)) + { + return null; + } + int index = base64.IndexOf(","); + if (index > -1) + { + base64 = base64.Substring(index, base64.Length - index); + } + byte[] bytes = Convert.FromBase64String(base64); + MemoryStream memStream = new MemoryStream(bytes); + Image mImage = Image.FromStream(memStream); + return new Bitmap(mImage); + } + + /// + /// Image 转成 base64 + /// + /// + static string ImageToBase64(this Bitmap bmp, ImageFormat format = null) + { + if (bmp is null) + { + return string.Empty; + } + MemoryStream ms = new MemoryStream(); + bmp.Save(ms, format ?? ImageFormat.Png); + byte[] arr = new byte[ms.Length]; ms.Position = 0; + ms.Read(arr, 0, (int)ms.Length); ms.Close(); + return Convert.ToBase64String(arr); + } + + /// + /// 序列化 + /// https://gitee.com/majorworld + /// + /// + /// + /// + static void CodeObject(this object obj, StringBuilder sb, string timeFormat) + { + switch (obj) + { + case null: + sb.Append("null"); + break; + case Bitmap bmp: + sb.Append($"\"{ImageToBase64(bmp)}\""); + break; + case Image img: + sb.Append($"\"{ImageToBase64(img as Bitmap)}\""); + break; + case Enum _: + sb.Append($"{Convert.ToInt32(obj)}"); + break; + case byte[] bytes: + sb.Append($"\"{Convert.ToBase64String(bytes)}\""); + break; + case Array array: + sb.Append('['); + for (int i = 0; i < array.Length; i++) + { + if (i != 0) + sb.Append(","); + array.GetValue(i).CodeObject(sb, timeFormat); + } + sb.Append(']'); + break; + case string text: + #region 2023年9月6日添加对转义字符的支持 + sb.ToLiteral(text); + #endregion + break; + case char c: + //sb.Append($"\"{obj}\""); + sb.Append("\""); + sb.ToCharLiteral(c); + sb.Append("\""); + break; + case bool _: + sb.Append($"{obj.ToString().ToLower()}"); + break; + case DataTable dt: + dt.CodeDataTable(sb, timeFormat); + break; + case DataSet ds: + sb.Append('{'); + for (int i = 0; i < ds.Tables.Count; i++) + { + if (i != 0) + sb.Append(","); + sb.Append($"\"{ds.Tables[i].TableName}\":"); + ds.Tables[i].CodeDataTable(sb, timeFormat); + } + sb.Append('}'); + break; + case DateTime time: + sb.AppendFormat($"\"{time.ToString(timeFormat)}\""); + break; + case Guid id: + sb.AppendFormat($"\"{id}\""); + break; + case Color color: + if (color.A == 255) + sb.Append($"\"{color.R},{color.G},{color.B}\""); + else + sb.Append($"\"{color.A},{color.R},{color.G},{color.B}\""); + break; + case Point point: + sb.Append($"\"{point.X},{point.Y}\""); + break; + case ArrayList list: + sb.Append('['); + for (int i = 0; i < list.Count; i++) + { + if (i != 0) + sb.Append(","); + list[i].CodeObject(sb, timeFormat); + } + sb.Append(']'); + break; + default: + CodeOther(obj, sb, timeFormat); + break; + } + } + /// + /// 将字符可见 + /// + /// https://gitee.com/majorworld + /// + static void ToLiteral(this StringBuilder sb, string input) + { + sb.Append("\""); + foreach (var c in input) + { + sb.ToCharLiteral(c); + } + sb.Append("\""); + } + + static void ToCharLiteral(this StringBuilder sb, char c) + { + switch (c) + { + case '\"': sb.Append("\\\""); break; + case '\\': sb.Append(@"\\"); break; + case '\0': sb.Append(@"\u0000"); break; + case '\a': sb.Append(@"\u0007"); break; + case '\b': sb.Append(@"\b"); break; + case '\f': sb.Append(@"\f"); break; + case '\n': sb.Append(@"\n"); break; + case '\r': sb.Append(@"\r"); break; + case '\t': sb.Append(@"\t"); break; + case '\v': sb.Append(@"\u000b"); break; + default: + sb.Append(c); + break; + } + } + + /// + /// 序列化其他 + /// https://gitee.com/majorworld + /// + /// + /// + /// + static void CodeOther(object obj, StringBuilder sb, string timeFormat) + { + Type type = obj.GetType(); + //数字 + if (type.IsPrimitive && type != typeof(char)) + { + sb.Append($"{obj}"); + return; + } + //字典 + else if (type.IsDictionary()) + { + sb.Append('{'); + var collection = obj as IDictionary; + var enumerator = collection.GetEnumerator(); + int index = 0; + while (enumerator.MoveNext()) + { + if (index != 0) + sb.Append(","); + sb.Append($"\"{enumerator.Key}\":"); + enumerator.Value.CodeObject(sb, timeFormat); + index++; + } + sb.Append('}'); + return; + } + //集合 + else if (type.IsList()) + { + sb.Append('['); + if (obj is IList list) + { + for (int i = 0; i < list.Count; i++) + { + if (i != 0) + sb.Append(","); + list[i].CodeObject(sb, timeFormat); + } + } + sb.Append(']'); + return; + } + else if (type.UnderlyingSystemType.Name == "ExpandoObject") + { + sb.Append('{'); + bool first = true; + foreach (dynamic item in obj as dynamic) + { + if (!first) + sb.Append(','); + first = false; + object value = item.Value; + sb.Append($"\"{item.Key}\":"); + value.CodeObject(sb, timeFormat); + } + sb.Append('}'); + return; + } + + //对象 + var prop = type.GetCacheInfo(); + if (prop is null) + { + sb.Append("null"); + return; + } + sb.Append('{'); + for (int i = 0; i < prop.Length; i++) + { + PropertyInfo p = prop[i]; + if (i != 0) + sb.Append(","); + var data = p.GetValue(obj, null); + sb.Append($"\"{p.Name}\":"); + data.CodeObject(sb, timeFormat); + } + sb.Append("}"); + } + + /// + /// 尝试获取缓存中的类型,排除忽略的字段 + /// https://gitee.com/majorworld + /// + /// + /// + static PropertyInfo[] GetCacheInfo(this Type type) + { + if (InfoCache.TryGetValue(type, out PropertyInfo[] props)) { } + else + { + props = type.GetProperties(BindingFlags.Instance | BindingFlags.Public); + List cache = new List(); + + #region 2023-09-09如果继承的字段有忽略特性 + var faces = type.GetInterfaces(); + List list = new List(); + foreach (Type cell in faces) + { + var collection = cell.GetProperties(BindingFlags.Instance | BindingFlags.Public); + foreach (var item in collection) + { + if (Attribute.GetCustomAttributes(item, typeof(FastIgnore))?.Length > 0) + list.Add(item.Name); + } + } + #endregion + + foreach (var item in props) + { + if (Attribute.GetCustomAttributes(item, typeof(FastIgnore))?.Length == 0 && !list.Contains(item.Name)) + cache.Add(item); + } + InfoCache[type] = cache.ToArray(); + props = cache.ToArray(); + } + return props; + } + + /// + /// 序列化DataTable + /// https://gitee.com/majorworld + /// + /// + /// + /// 时间格式化样式,默认为yyyy-MM-dd HH:mm:ss + static void CodeDataTable(this DataTable dt, StringBuilder sb, string timeFormat) + { + sb.Append('['); + for (int i = 0; i < dt.Rows.Count; i++) + { + if (i != 0) + sb.Append(","); + var item = dt.Rows[i]; + sb.Append('{'); + for (int j = 0; j < dt.Columns.Count; j++) + { + if (j != 0) + sb.Append(","); + var cell = dt.Columns[j]; + sb.Append($"\"{cell}\":"); + item[j].CodeObject(sb, timeFormat); + } + sb.Append('}'); + } + sb.Append(']'); + } + #endregion + } +} \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs index 745aa4d..c60b525 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs @@ -1,5 +1,8 @@ using DataBlockHelper; +using DataBlockHelper.DBHelpers; using HslCommunication; +using log4net; +using log4net.Config; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.FreeDb; using Mesnac.Action.ChemicalWeighing.LjMaterial; @@ -9,6 +12,7 @@ using Mesnac.Core.Service; using System; using System.Collections.Generic; using System.Data; +using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; @@ -18,6 +22,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl public class InitAction : ChemicalWeighingAction, IAction { + DB2107Helper DB2107; + + DB2103Helper DB2103; + List McControllist; OperateResult Read; @@ -61,6 +69,9 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl public void Run(RuntimeParameter runtime) { + DB2107 = new DB2107Helper(); + + DB2103 = new DB2103Helper(); base.RunIni(runtime); //必须要调用的 @@ -141,31 +152,13 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl timer.Dispose(); } - Read = PlcConnect.Instance.Read("DB2119.22.0", 2); + WaterActualValue1.MCValue = DB2107.Weight.WScale_3.ActWeight; - content = Read.Content; - - WaterActualValue1.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); - - Read = PlcConnect.Instance.Read("DB2119.2.0", 2); - - content = Read.Content; - - WaterActualValue2.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); - - Read = PlcConnect.Instance.Read("DB2119.32.0", 2); - - content = Read.Content; - - WaterActualValue3.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); - - Read = PlcConnect.Instance.Read("DB2119.12.0", 2); - - content = Read.Content; - - WaterActualValue4.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); + WaterActualValue2.MCValue = DB2107.Weight.WScale_1.ActWeight; + WaterActualValue3.MCValue = DB2107.Weight.WScale_4.ActWeight; + WaterActualValue4.MCValue = DB2107.Weight.WScale_2.ActWeight; Read = PlcConnect.Instance.Read("DB2119.24.0", 2); @@ -193,24 +186,14 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl - Read = PlcConnect.Instance.Read("DB2119.42.0", 2); - - content = Read.Content; - - SpiralActValue1.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); - - Read = PlcConnect.Instance.Read("DB2119.64.0", 2); - - content = Read.Content; - - SpiralActValue2.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); - Read = PlcConnect.Instance.Read("DB2119.86.0", 2); + SpiralActValue1.MCValue = DB2103.DM2ASF01.ACT_Speed; - content = Read.Content; + SpiralActValue2.MCValue = DB2103.DM2BSF01.ACT_Speed; - SpiralActValue3.MCValue = PlcConnect.Instance.ByteTransform.TransInt16(content, 0); + SpiralActValue3.MCValue = DB2103.DM2CSF01.ACT_Speed; + SpiralActValue4.MCValue = DB2103.DM2DSF01.ACT_Speed; Read = PlcConnect.Instance.Read("DB2119.28.0", 1); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs index 74965b9..ea7795e 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs @@ -1,6 +1,8 @@ using DataBlockHelper; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.FreeDb; +using Mesnac.Action.ChemicalWeighing.InterfaceDocking; +using Mesnac.Action.ChemicalWeighing.InterfaceDocking.DockingEntity; using Mesnac.Basic; using Mesnac.Controls.Base; using Mesnac.Controls.Default; @@ -108,7 +110,16 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl IBaseControl PointSpeedSpiralValue2 = GetBaseControl("PointSpeedSpiralValue2"); IBaseControl PointSpeedSpiralValue3 = GetBaseControl("PointSpeedSpiralValue3"); IBaseControl PointSpeedSpiralValue4 = GetBaseControl("PointSpeedSpiralValue4"); - + + IBaseControl WetRequest1 = GetBaseControl("WetRequest1"); + IBaseControl WetRequest2 = GetBaseControl("WetRequest2"); + IBaseControl WetRequest3 = GetBaseControl("WetRequest3"); + IBaseControl WetRequest4 = GetBaseControl("WetRequest4"); + IBaseControl WetRequest5 = GetBaseControl("WetRequest5"); + IBaseControl WetRequest6 = GetBaseControl("WetRequest6"); + IBaseControl WetRequest7 = GetBaseControl("WetRequest7"); + IBaseControl WetRequest8 = GetBaseControl("WetRequest8"); + #endregion @@ -879,6 +890,169 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl //MessageBox.Show("螺旋4已停止!"); } + + if (WetRequest1 == runtime.Sender) + { + if (MessageBox.Show("糊化机1确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "1", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("糊化机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("糊化机8返回数据 " + returnTest); + } + + if (WetRequest2 == runtime.Sender) + { + if (MessageBox.Show("糊化机2确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "2", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("糊化机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("糊化机8返回数据 " + returnTest); + } + + if (WetRequest3 == runtime.Sender) + { + if (MessageBox.Show("糊化机3确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "3", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("糊化机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("糊化机8返回数据 " + returnTest); + } + + if (WetRequest4 == runtime.Sender) + { + if (MessageBox.Show("糊化机4确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "4", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("糊化机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("糊化机8返回数据 " + returnTest); + } + + if (WetRequest5 == runtime.Sender) + { + if (MessageBox.Show("糊化机5确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "5", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("糊化机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("糊化机8返回数据 " + returnTest); + } + + if (WetRequest6 == runtime.Sender) + { + if (MessageBox.Show("糊化机6确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "6", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("糊化机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("糊化机8返回数据 " + returnTest); + } + + if (WetRequest7 == runtime.Sender) + { + if (MessageBox.Show("糊化机7确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "7", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("糊化机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("糊化机8返回数据 " + returnTest); + } + + if (WetRequest8 == runtime.Sender) + { + if (MessageBox.Show("糊化机8确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "8", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("糊化机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("糊化机8返回数据 " + returnTest); + } + + + #endregion diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index 2743d1c..86d782b 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -260,6 +260,13 @@ + + + + + + + diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DeviceDetail2Report/DeviceDetail2ReportAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DeviceDetail2Report/DeviceDetail2ReportAction.cs index c077ea0..c3f2e38 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DeviceDetail2Report/DeviceDetail2ReportAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/DeviceDetail2Report/DeviceDetail2ReportAction.cs @@ -277,8 +277,20 @@ namespace Mesnac.Action.ChemicalWeighing.Report.DeviceDetail2Report timer1.Dispose(); } - DataTable AlarmTable = DBHelp.GetTable(@"select t2.Alarm_ID, t2.Alarm_Other_Info,t2.Alarm_Block,t2.Alarm_Word,t2.Alarm_Bit,t1.Alarm_OccurTime from LR_Alarmlog t1 - left join Pmt_Alarm t2 on t1.Alarm_ID=t2.Alarm_ID where t1.Alarm_Status=1"); + DataTable AlarmTable = DBHelp.GetTable(@"SELECT + t2.Alarm_ID, + t2.Alarm_Other_Info, + t2.Alarm_Block, + t2.Alarm_Word, + t2.Alarm_Bit, + t1.Alarm_OccurTime + FROM + LR_Alarmlog t1 + LEFT JOIN Pmt_Alarm t2 ON t1.Alarm_ID = t2.Alarm_ID + WHERE + t1.Alarm_Status = 1 + ORDER BY + t1.Alarm_OccurTime desc"); if (this.AlarmForm != null && this.AlarmForm.BaseControl != null) { diff --git a/Main/MCEdit/App.config b/Main/MCEdit/App.config index 51cd3d7..a54157b 100644 --- a/Main/MCEdit/App.config +++ b/Main/MCEdit/App.config @@ -78,7 +78,7 @@ - + diff --git a/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml b/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml index 9647c67..1f9f2bd 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml @@ -1,5 +1,213 @@ + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + WetRequest8 + + False + + + + Query + True + True + False + + + + Red + DarkGray + 湿混机8发送下料请求 + 6, 339 + MCButton21 + 148, 40 + 7 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + WetRequest7 + + False + + + + Query + True + True + False + + + + Red + DarkGray + 湿混机7发送下料请求 + 6, 293 + MCButton20 + 148, 40 + 6 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + WetRequest6 + + False + + + + Query + True + True + False + + + + Red + DarkGray + 湿混机6发送下料请求 + 6, 247 + MCButton19 + 148, 40 + 5 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + WetRequest5 + + False + + + + Query + True + True + False + + + + Red + DarkGray + 湿混机5发送下料请求 + 6, 201 + MCButton18 + 148, 40 + 4 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + WetRequest4 + + False + + + + Query + True + True + False + + + + Red + DarkGray + 湿混机4发送下料请求 + 6, 155 + MCButton17 + 148, 40 + 3 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + WetRequest3 + + False + + + + Query + True + True + False + + + + Red + DarkGray + 湿混机3发送下料请求 + 6, 109 + MCButton16 + 148, 40 + 2 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + WetRequest2 + + False + + + + Query + True + True + False + + + + Red + DarkGray + 湿混机2发送下料请求 + 6, 63 + MCButton15 + 148, 40 + 1 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + WetRequest1 + + False + + + + Query + True + True + False + + + + Red + DarkGray + 湿混机1发送下料请求 + 6, 17 + MCButton14 + 148, 40 + 0 + + False + 下料请求发送 + 696, 12 + GroupBox10 + 160, 387 + 28 + False @@ -30,12 +238,12 @@ False 3, 17 MCDataGridView3 - 357, 751 + 357, 745 2 False 操作日志 - 696, 12 + 862, 12 GroupBox9 366, 771 27 @@ -469,7 +677,7 @@ False 湿混机螺旋2 - 183, 443 + 184, 443 GroupBox6 165, 340 25 @@ -1771,7 +1979,7 @@ False 湿混机螺旋1 - 12, 443 + 13, 443 GroupBox5 165, 340 15 @@ -3282,7 +3490,7 @@ False False Control - 1090, 832 + 1506, 832 WindowsDefaultLocation 手动控制 Normal diff --git a/Main/MCRun/App.config b/Main/MCRun/App.config index f04b98a..4556058 100644 --- a/Main/MCRun/App.config +++ b/Main/MCRun/App.config @@ -69,7 +69,7 @@ - + diff --git a/Main/MCRun/Data/SysConfig/MenuConfig.dat b/Main/MCRun/Data/SysConfig/MenuConfig.dat index 4dce92931e140b0da663d1f82521df4889b1fbf3..b5c8e4ea9a47bf00154ea0442dbf714521e50d05 100644 GIT binary patch literal 19564 zcmeHOX>c6H71mFe5=%N)XLCxjX-Pa4O|Q&0wWc%4?5ycG zDVc0Moto`!a^jy^)0^{&Tt1`BPAU0ZMoP?@z9=6_#N`{5)m`c3N@{i_5RiPb&+iI( zyoxgz;_xfeDuFk3WfWyWI;xyQE$X|JRk;aW>2#ti-V42cfs|B)wrq2cA}?2>_O_(d zt+b`0%B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