commit 10f06d99cd9240271f2bd7c22070037ecef06e64 Author: XingCheng3 <1773407212@qq.com> Date: Mon Jun 8 17:06:10 2026 +0800 init: 北航大学BH-DAS项目首次入库 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b48f252 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +.vs/ +packages/ +bin/ +obj/ +*.user +*.suo +*.cache +*.log +*.zip +*.rar +*.7z +_system~.ini diff --git a/BH.sln b/BH.sln new file mode 100644 index 0000000..f196570 --- /dev/null +++ b/BH.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33516.290 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BH", "CCYQ_JieFang\BH.csproj", "{A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "01_MyLog4Net", "MyLog4Net\01_MyLog4Net.csproj", "{1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "03_CallWebApi", "CallWebApi\03_CallWebApi.csproj", "{727A1B50-D83A-4319-BDF6-E923F4BD41B3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DK_DC_Tool", "DK_DC_Tool\DK_DC_Tool.csproj", "{3C6FEF50-2014-4157-A12B-93FB4AD20FE7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073}.Release|Any CPU.Build.0 = Release|Any CPU + {1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F}.Release|Any CPU.Build.0 = Release|Any CPU + {727A1B50-D83A-4319-BDF6-E923F4BD41B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {727A1B50-D83A-4319-BDF6-E923F4BD41B3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {727A1B50-D83A-4319-BDF6-E923F4BD41B3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {727A1B50-D83A-4319-BDF6-E923F4BD41B3}.Release|Any CPU.Build.0 = Release|Any CPU + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9338DC32-EA20-43C9-9073-F048C086886F} + EndGlobalSection +EndGlobal diff --git a/CCYQ_JieFang/App.config b/CCYQ_JieFang/App.config new file mode 100644 index 0000000..22488ae --- /dev/null +++ b/CCYQ_JieFang/App.config @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CCYQ_JieFang/BH.csproj b/CCYQ_JieFang/BH.csproj new file mode 100644 index 0000000..4d06e01 --- /dev/null +++ b/CCYQ_JieFang/BH.csproj @@ -0,0 +1,394 @@ + + + + + Debug + AnyCPU + {A8D0B4EF-E223-4B9A-B2D9-0156B7B8B073} + WinExe + CCYQ_JieFang + BH-DAS + v4.8 + 512 + true + true + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + 任务管理.ico + + + + app.manifest + + + + ..\DLL\BasicData.dll + + + False + ..\DLL\BouncyCastle.Crypto.dll + + + False + ..\DLL\ConLink.dll + + + ..\DLL\ConLink19.dll + + + ..\DLL\DataLinkMesWork.dll + + + ..\DLL\Fanuc.Interface.dll + + + False + ..\DLL\ICSharpCode.SharpZipLib.dll + + + False + ..\DLL\MesControl.dll + + + False + ..\DLL\MesWork.DeviceDriver.dll + + + False + ..\DLL\MesWork.PLC.dll + + + False + ..\DLL\Monitor.MesWork.dll + + + False + ..\DLL\MQTTnet.dll + + + False + ..\DLL\MQTTnet.Extensions.ManagedClient.dll + + + ..\DLL\MySql.Data.dll + + + False + ..\DLL\NPOI.dll + + + False + ..\DLL\NPOI.OOXML.dll + + + False + ..\DLL\NPOI.OpenXml4Net.dll + + + False + ..\DLL\NPOI.OpenXmlFormats.dll + + + False + ..\DLL\Opc.Ua.Client.dll + + + False + ..\DLL\Opc.Ua.Configuration.dll + + + False + ..\DLL\Opc.Ua.Core.dll + + + False + ..\DLL\OpcUaHelper.dll + + + False + ..\DLL\SqlCmd.dll + + + + + + ..\DLL\System.Net.Http.Formatting.dll + + + ..\DLL\System.Web.Cors.dll + + + + ..\DLL\System.Web.Http.dll + + + ..\DLL\System.Web.Http.Cors.dll + + + ..\DLL\System.Web.Http.SelfHost.dll + + + + + + + + + + + + False + ..\DLL\Ubiety.Dns.Core.dll + + + ..\DLL\WeifenLuo.WinFormsUI.Docking.dll + + + + + Form + + + logInfo.cs + + + Form + + + DAS_OP20.cs + + + Form + + + DAS_OP30.cs + + + Form + + + DAS_OP40.cs + + + Form + + + DAS_OP50.cs + + + Form + + + AgvTest.cs + + + Form + + + MeasureRangeSet.cs + + + Form + + + partInfo.cs + + + + + + + + + Form + + + MesWork.cs + + + Form + + + DAS_OP10.cs + + + + + + + Form + + + LogRecord.cs + + + + Form + + + + + + + + + + + LogRecord.cs + + + logInfo.cs + + + MesWork.cs + Designer + + + DAS_OP10.cs + + + DAS_OP20.cs + + + DAS_OP30.cs + + + DAS_OP40.cs + + + DAS_OP50.cs + + + AgvTest.cs + + + MeasureRangeSet.cs + + + partInfo.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + + + + + + + + + + + False + Microsoft .NET Framework 4.6.1 %28x86 和 x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + 1.2.0 + + + 13.0.1 + + + 2.1.0 + + + 1.0.3 + + + 2.5.2 + + + 1.1.10 + + + 3.1.0 + + + + + {3c6fef50-2014-4157-a12b-93fb4ad20fe7} + DK_DC_Tool + + + {1dc48c83-1842-4de8-acaf-26e1e7f7c58f} + 01_MyLog4Net + + + + \ No newline at end of file diff --git a/CCYQ_JieFang/BusinessCode/AppConfig.cs b/CCYQ_JieFang/BusinessCode/AppConfig.cs new file mode 100644 index 0000000..e6086d9 --- /dev/null +++ b/CCYQ_JieFang/BusinessCode/AppConfig.cs @@ -0,0 +1,409 @@ +using CCYQ_JieFang; +using DeviceDriver_BasicData; +using DK_DC_Tool; +using NJ_ZC; +using OpcBasic; +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Windows.Forms; +using SystemFramework; +using static System.Configuration.ConfigurationManager; + +namespace MesWork +{ + public partial class Temp { + public static MesWorkForm mesWorkForm = null; + public static DAS_OP10 mesWorkForm1 = null; + public static DAS_OP20 mesWorkForm2 = null; + public static DAS_OP30 mesWorkForm3 = null; + public static DAS_OP40 mesWorkForm4 = null; + public static DAS_OP50 mesWorkForm5 = null; + } + public partial class MesWorkForm + { + public static string BasicDataTableFile = AppSettings["BasicDataTableFile"]; + public static int IsDemoMesServer = Convert.ToInt32(AppSettings["IsDemoMesServer"]); + public static int IsWriteMonitorLog = Convert.ToInt32(AppSettings["IsWriteMonitorLog"]); + + public static string ConnectionString = AppSettings["ConnectionString"]; + + public static string MesServer_IpPortName = AppSettings["MesServer_IpPortName"]; + public static string MesServer_SendProtocol = AppSettings["MesServer_SendProtocol"]; + public static string MesServer_SendTagProtocol = AppSettings["MesServer_SendTagProtocol"]; + public static string MesServer_SendTagProtocol_MES = AppSettings["MesServer_SendTagProtocol_MES"]; + + // + public static string MeasureDataString = AppSettings["MeasureDataString"]; + public static string ProgramDataString = AppSettings["ProgramDataString"]; + + public static string WebSvrUrlPort = AppSettings["WebSvrUrlPort"]; + + + public static string ResponseEnterOrLeaveUrl = AppSettings["ResponseEnterOrLeaveUrl"]; + public static string FinishCallUrl = AppSettings["FinishCallUrl"]; + public static string DeviceStatusUrl = AppSettings["DeviceStatusUrl"]; + + public static string IPC_product = AppSettings["IPC_product"]; + public static string IPC_RequestEnterOrLeave = AppSettings["IPC_RequestEnterOrLeave"]; + public static string IPC_WorkFinsih = AppSettings["IPC_WorkFinsih"]; + + // MQTT + // public static int connectType = Convert.ToInt32(AppSettings["connectType"]); + // public static string MqttUrl = AppSettings["MqttUrl"]; + // public static string MqttTargetTopic = AppSettings["MqttTargetTopic"]; + + public static int TimerUpdateSql = Convert.ToInt32(AppSettings["TimerUpdateSql"]); + public static int StationStatus_Interval_Read = Convert.ToInt32(AppSettings["StationStatus_Interval_Read"]); + public static int StationStatus_Interval_Update = Convert.ToInt32(AppSettings["StationStatus_Interval_Update"]); + public static int StationStatus_Interval_Insert = Convert.ToInt32(AppSettings["StationStatus_Interval_Insert"]); + + public static int ExecSql_Interval = Convert.ToInt32(AppSettings["ExecSql_Interval"]); + + public static string IsLogFilePath = AppSettings["IsLogFilePath"]; + public static string LogFilePath = AppSettings["LogFilePath"]; + public static string IpcConfigPath = AppSettings["IpcConfigPath"]; + + private static StreamWriter streamWriter; + /// + /// + /// + public static ConcurrentQueue taskSql = new ConcurrentQueue(); + /// + /// + /// + public static string StationName = "DDV"; + /// + /// + /// + public static DataTable dt_Robot = null; + /// + /// + /// + public static DataTable dt_EEM = null; + /// + /// + /// + public static DataTable dt_EEM_PLC = null; + /// + /// + /// + public static DataTable dt_CNC = null; + /// + /// + /// + public static DataTable dt_pmc = null; + /// + /// + /// + public static DataTable dt_pmc_Simplify = null; + /// + /// + /// + public static DataTable dt_PLC_Data = null; + /// + /// + /// + public static Hashtable ht_PLM_Old = new Hashtable(); + /// + /// + /// + public static Hashtable ht_PLM_Curr = new Hashtable(); + /// + /// + /// + public static Hashtable ht_OpName_Status = new Hashtable(); + /// + /// + /// + public static Hashtable ht_OpName_PMCReadTagIDArray = new Hashtable(); + /// + /// ݵб仯 + /// + /// + /// + public override void OPCTagData_TagDataOnChangeMIS(object sender, CustomeEvetnArgs e) + { + ThreadPool.QueueUserWorkItem(MIS_Funtion, e); + } + + + public void Tighten_E_ScanContent(string hex_str, string raw_str) + { + ThreadPool.QueueUserWorkItem(MIS_Tighten, new TightenParam + { + hex = hex_str , + raw = raw_str + }); + } + /// + /// ʱPLC״̬ڣ3 s + /// + /// + /// + public override void PlcStateEvent(object sender, PlcStateEvetnArgs eState) + { + + } + + public static string currentOpName = ""; + /// + /// + /// + [STAThread] + static void Main() + { + + new System.Threading.Mutex(true, "Device Data SCADA", out bool bCanRun); + if (!bCanRun) + { + MessageBox.Show("豸ݲɼ ѾУظ"); + return; + } + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(Temp.mesWorkForm = new MesWorkForm()); + + } + + /// + /// дȡ + /// + /// + /// + private void DemoRead(string doWhat, string opOrIp) + { + try + { + string opName = "OP1010"; + object tagValue = 1; + bool result = false; + ConcurrentDictionary tagAdrListTagFormat = null; + + switch (doWhat) + { + case "TagID": + tagValue = ReadPLC("71010001"); + result = WritePLC("71010001", tagValue); + break; + case "TagTypeCodeID": + tagValue = ReadPLC(10, opName); + result = WritePLC(10, opName, tagValue); + break; + //case "Cmd": + // tagValue = ReadPLC((int)EnumTagTypeCodeID.EngineID, opName); + // result = WritePLC((int)EnumTagTypeCodeID.EngineID, opName, tagValue); + // break; + case "OpAllTag"://OPе + tagAdrListTagFormat = ReadPLC_GroupData(opOrIp); + break; + case "OpMonitorTag"://OPص + tagAdrListTagFormat = ReadPLC_GroupMonitor(opOrIp); + break; + case "IpAllTag"://IPе + tagAdrListTagFormat = ReadPLC_IpTag(opOrIp); + break; + case "IpMonitorTag"://IPص + tagAdrListTagFormat = ReadPLC_IpMonitorTag(opOrIp); + break; + case "RegionRead"://ȡʼַ + ȣ + { + string tagStartAdr = "DB411.10"; + ushort tagAdrListMaxLength = 100; + GetDbAndMaxLengthByOpName(opOrIp, out tagStartAdr, out tagAdrListMaxLength); + tagAdrListTagFormat = ReadQualityDataList(opOrIp, tagStartAdr, tagAdrListMaxLength); + } + break; + case "ReadBytes"://ȡʼַ + ȣ + { + string tagStartAdr = "DB411.10"; + ushort tagAdrListMaxLength = 100; + var bates1 = ReadByteData_Op(opOrIp, tagStartAdr, tagAdrListMaxLength); + var bates2 = ReadByteData_Ip(opOrIp, tagStartAdr, tagAdrListMaxLength); + } + break; + case "WriteBytes"://ȡʼַ + ȣ + { + string tagStartAdr = "DB411.10"; + var result1 = WritePLC_Bytes_Op(opOrIp, tagStartAdr, new byte[1024]); + var result2 = WritePLC_Bytes_Ip(opOrIp, tagStartAdr, new byte[1024]); + } + break; + default: + break; + } + //ReadByteData_Op(string opName, string startAdrr, ushort length) + foreach (System.Collections.Generic.KeyValuePair de in tagAdrListTagFormat)//õλصϣ + { + TagFormat TF = (TagFormat)de.Value; + string recResult = TF.OpName + " (" + TF.TagTypeCodeID + ")" + TF.TagValue.ToString(); ; + } + } + catch (System.Exception err) + { + ApplicationLog.WriteLog("listView_ShowQualityData_Init" + err); + } + + } + + public string Hello_You_All_Never_Know(string[] args) + { + return Guid.NewGuid().ToString()+ Guid.NewGuid().ToString(); + } + + + private void Button1_Click(object sender, System.EventArgs e) + { + ConcurrentDictionary tagTypeCodeIDList = DriverCache[CacheType.Cache_OpTagTypeCodeIDList]; + } + + + public static void SavePrintLog(int type, string message) + { + try + { + if (IsLogFilePath == "0") return; + string directPath = LogFilePath.Trim(); + if (!Directory.Exists(directPath)) //жļǷڣ򴴽 + { + Directory.CreateDirectory(directPath); + } + directPath += string.Format(@"\{0}.log", DateTime.Now.ToString("yyyy-MM-dd")); + if (streamWriter == null) + { + streamWriter = !File.Exists(directPath) ? File.CreateText(directPath) : File.AppendText(directPath); //жļǷ򴴽ӡ + } + streamWriter.WriteLine("***********************************************************************"); + streamWriter.WriteLine(DateTime.Now.ToString("HH:mm:ss")); + if (message != null) + { + if (type == 0) + { + streamWriter.WriteLine("¼Ϣ\r\n" + message); + } + else + { + streamWriter.WriteLine("쳣Ϣ\r\n" + message); + } + } + } + finally + { + if (streamWriter != null) + { + streamWriter.Flush(); + streamWriter.Dispose(); + streamWriter = null; + } + } + } + + + static private void Loop() + { + while (true) + { + taskSql.TryDequeue(out ParamT tp); + if (tp != null) + { + var procedureName = tp.procedureName; + var sqlParameter = tp.sqlParameter; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref sqlParameter, out string errorMessage); + if (errorMessage.Length > 0) + { + errorMessage = errorMessage.Replace("'","**"); + LogRecord.LogRecord.Insert_Log(LogRecord.LogRecord.Type_Log.Alarm, errorMessage); + } + } + if (taskSql.Count < 5) + { + Thread.Sleep(15); + } + } + } + + + private void DatatableCol_Simplify(DataTable dt_pmc) + { + dt_pmc_Simplify = new DataTable(); + dt_pmc_Simplify.Columns.Add("TagID"); + dt_pmc_Simplify.Columns.Add("TagName"); + dt_pmc_Simplify.Columns.Add("TagValue"); + dt_pmc_Simplify.Columns.Add("λ"); + dt_pmc_Simplify.Columns.Add("Դ"); + dt_pmc_Simplify.Columns.Add("IP"); + dt_pmc_Simplify.Columns.Add("TagTypeID"); + dt_pmc_Simplify.Columns.Add("TagLong"); + dt_pmc_Simplify.Columns.Add("DbName"); + dt_pmc_Simplify.Columns.Add(""); + dt_pmc_Simplify.Columns.Add("ַ"); + dt_pmc_Simplify.Columns.Add(""); + dt_pmc_Simplify.Columns.Add("λ"); + dt_pmc_Simplify.Columns.Add("ʹ"); + dt_pmc_Simplify.Columns.Add(""); + dt_pmc_Simplify.Columns.Add("Ƿ"); + dt_pmc_Simplify.Columns.Add("Ƿ"); + + var dt_pmcT = dt_pmc.Copy(); + + for (int i = 0; i < dt_pmcT.Rows.Count; i++) + { + var TagID = dt_pmcT.Rows[i]["TagID"].ToString(); + var TagName = dt_pmcT.Rows[i]["TagName"].ToString(); + var TagValue = "0"; + var λ = dt_pmcT.Rows[i]["λ"].ToString(); + var Դ = dt_pmcT.Rows[i]["Դ"].ToString(); + var IP = dt_pmcT.Rows[i]["IP"].ToString(); + var TagTypeID = dt_pmcT.Rows[i]["TagTypeID"].ToString(); + var TagLong = dt_pmcT.Rows[i]["TagLong"].ToString(); + var DbName = dt_pmcT.Rows[i]["DbName"].ToString(); + var = dt_pmcT.Rows[i][""].ToString(); + var ַ = dt_pmcT.Rows[i]["ַ"].ToString(); + var = dt_pmcT.Rows[i][""].ToString(); + var λ = dt_pmcT.Rows[i]["λ"].ToString(); + var ʹ = dt_pmcT.Rows[i]["ʹ"].ToString(); + var = dt_pmcT.Rows[i][""].ToString(); + var Ƿ = dt_pmcT.Rows[i]["Ƿ"].ToString(); + var Ƿ = dt_pmcT.Rows[i]["Ƿ"].ToString(); + + ht_PLM_Old.Add(TagID, "0"); + + dt_pmc_Simplify.Rows.Add( + TagID, + TagName, + TagValue, + λ , + Դ , + IP , + TagTypeID , + TagLong , + DbName , + , + ַ , + , + λ, + ʹ, + , + Ƿ, + Ƿ + ); + + + + } + + + + + + } + + } +} diff --git a/CCYQ_JieFang/BusinessCode/B_DB_Opera.cs b/CCYQ_JieFang/BusinessCode/B_DB_Opera.cs new file mode 100644 index 0000000..71e2ebd --- /dev/null +++ b/CCYQ_JieFang/BusinessCode/B_DB_Opera.cs @@ -0,0 +1,268 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Diagnostics.Eventing.Reader; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MesWork +{ + /// + /// + /// + public class B_DB_Opera + { + + public static void Event_WorkStart(string opName, int tagTypeCodeID, string partType, string tagID) + { + return; + var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + { + procedureName = "Event_WorkStart", + sqlParameter = new SqlParameter[] { + new SqlParameter("@OpName", opName), + new SqlParameter("@TagTypeCodeID", tagTypeCodeID), + new SqlParameter("@PartType", partType), + new SqlParameter("@ChangeTime",ChangeTime), + new SqlParameter("@TagID", tagID) + } + }); + + } + + public static void Event_WorkEnd(string opName, int tagTypeCodeID, string partType + , string barCode, int qualityMask, int outCount, int duration + , string tagID) + { + return; + /* +@OpName nvarchar(50) = null, +@TagTypeCodeID int = 0, +@PartType int = 0, +@BarCode nvarchar(2048) = null, +@QualityMask int = 0, +@OutCount int = 0, +@Duration int = 0, +@ChangeTime datetime = null, +@TagID nvarchar(200) = null + */ + + var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + { + procedureName = "Event_WorkEnd", + sqlParameter = new SqlParameter[] { + new SqlParameter("@OpName", opName), + new SqlParameter("@TagTypeCodeID", tagTypeCodeID), + new SqlParameter("@PartType", partType), + new SqlParameter("@BarCode", barCode), + new SqlParameter("@QualityMask", qualityMask), + new SqlParameter("@OutCount", outCount), + new SqlParameter("@Duration", duration), + new SqlParameter("@ChangeTime",ChangeTime), + new SqlParameter("@TagID", tagID) + } + }); + } + + + + + + public static void Event_Signal_Log(string opName, int tagTypeCodeID, string value, string tagID) + { + return; + var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + { + procedureName = "Event_Signal_Log", + sqlParameter = new SqlParameter[] { + new SqlParameter("@OpName", opName), + new SqlParameter("@TagTypeCodeID", tagTypeCodeID), + new SqlParameter("@Value", value), + new SqlParameter("@ChangeTime",ChangeTime), + new SqlParameter("@TagID", tagID) + } + }); + } + + + public static void Event_Alarm_Start(string opName, int tagTypeCodeID, string alarmText, string tagID) + { + return; + var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + { + procedureName = "Event_Alarm_Start", + sqlParameter = new SqlParameter[] { + new SqlParameter("@OpName", opName), + new SqlParameter("@TagTypeCodeID", tagTypeCodeID), + new SqlParameter("@AlarmText", alarmText), + new SqlParameter("@ChangeTime",ChangeTime), + new SqlParameter("@TagID", tagID) + } + }); + + } + + + public static void Event_Alarm_End(string opName, int tagTypeCodeID, string alarmText, string tagID) + { + return; + var ChangeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + { + procedureName = "Event_Alarm_End", + sqlParameter = new SqlParameter[] { + new SqlParameter("@OpName", opName), + new SqlParameter("@TagTypeCodeID", tagTypeCodeID), + new SqlParameter("@AlarmText", alarmText), + new SqlParameter("@ChangeTime",ChangeTime), + new SqlParameter("@TagID", tagID) + } + }); + + } + + //public static void MES_ToolDataSave(string opName, string toolNum, string toolLife, string toolCount) + //{ + // SqlParameter[] thisParms = new SqlParameter[4]; + // thisParms[0] = new SqlParameter("@opName", opName); + // thisParms[1] = new SqlParameter("@刀具代码", toolNum); + // thisParms[2] = new SqlParameter("@刀具额定寿命", Convert.ToInt32(toolLife)); + // thisParms[3] = new SqlParameter("@已用寿命", Convert.ToInt32(toolCount)); + + // MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + // { + // procedureName = "LG_刀具管理_刀具设备台账编辑", + // sqlParameter = thisParms + // }); + //} + //public static void MES_MeasureDataSave(string opName, string partId, decimal value, string time, string measureDataAddress, string monitorData) + //{ + // SqlParameter[] thisParms = new SqlParameter[6]; + // thisParms[0] = new SqlParameter("@opName", opName); + // thisParms[1] = new SqlParameter("@partId", partId); + // thisParms[2] = new SqlParameter("@recordTime", time); + // thisParms[3] = new SqlParameter("@Value", value); + // thisParms[4] = new SqlParameter("@measureDataAddress", measureDataAddress); + // thisParms[5] = new SqlParameter("@monitorData", monitorData); + + // MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + // { + // procedureName = "LG_临工看板_质量管理_增加数据", + // sqlParameter = thisParms + // }); + //} + + //public static void MES_ProgramStatusDataSave(string opName, string serialNumber, int status, string time) + //{ + // SqlParameter[] thisParms = new SqlParameter[4]; + // thisParms[0] = new SqlParameter("@opName", opName); + // thisParms[1] = new SqlParameter("@serialNumber", serialNumber); + // thisParms[2] = new SqlParameter("@recordTime", time); + // thisParms[3] = new SqlParameter("@status", status); + + // MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + // { + // procedureName = "LG_临工看板_程序状态管理_增加数据", + // sqlParameter = thisParms + // }); + //} + + //public static void MES_PartDataSave(string opName, string partId, string time, int type, int isOk, string FLOW_NUM, string passTime, int durationTime) + //{ + // SqlParameter[] thisParms = new SqlParameter[8]; + // thisParms[0] = new SqlParameter("@opName", opName); + // thisParms[1] = new SqlParameter("@partId", partId); + // thisParms[2] = new SqlParameter("@scanTime", time); + // thisParms[3] = new SqlParameter("@type", type); + // thisParms[4] = new SqlParameter("@是否合格", isOk); + // thisParms[5] = new SqlParameter("@FLOW_NUM", FLOW_NUM); + // thisParms[6] = new SqlParameter("@passTime", passTime); + // thisParms[7] = new SqlParameter("@durationTime", durationTime); + + // MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + // { + // procedureName = "LG_临工看板_产量管理_增加数据", + // sqlParameter = thisParms + // }); + //} + public static void MES_StatusChange(string opName, int StatusCode, string TriggerTime) + { + return; + SqlParameter[] thisParms = new SqlParameter[3]; + thisParms[0] = new SqlParameter("@opName", opName); + thisParms[1] = new SqlParameter("@StatusCode", StatusCode); + thisParms[2] = new SqlParameter("@TriggerTime", TriggerTime); + + MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + { + procedureName = "设备管理_状态变化新增", + sqlParameter = thisParms + }); + } + //public static void MES_StatusChange_WorkModel(string opName, int shutdown, int emergency, int auto, int debug, int manual, string TriggerTime) + //{ + // SqlParameter[] thisParms = new SqlParameter[7]; + // thisParms[0] = new SqlParameter("@opName", opName); + // thisParms[1] = new SqlParameter("@shutdown", shutdown); + // thisParms[2] = new SqlParameter("@emergency", emergency); + // thisParms[3] = new SqlParameter("@auto", auto); + // thisParms[4] = new SqlParameter("@debug", debug); + // thisParms[5] = new SqlParameter("@manual", manual); + // thisParms[6] = new SqlParameter("@TriggerTime", TriggerTime); + + // MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + // { + // procedureName = "LG_临工看板_设备管理_状态变化新增数据_工作模式", + // sqlParameter = thisParms + // }); + //} + //public static void MES_MachineParamsSave(string opName, float feedRate, float spindleSpeed, string recordTime) + //{ + // SqlParameter[] thisParms = new SqlParameter[4]; + // thisParms[0] = new SqlParameter("@opName", opName); + // thisParms[1] = new SqlParameter("@feedRate", feedRate); + // thisParms[2] = new SqlParameter("@spindleSpeed", spindleSpeed); + // thisParms[3] = new SqlParameter("@recordTime", recordTime); + + // MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + // { + // procedureName = "LG_临工看板_设备管理_增加数据", + // sqlParameter = thisParms + // }); + //} + + public static void ClearLog() + { + return; + MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + { + procedureName = "Event_Delete_Station_记录_日志_运行日志", + sqlParameter = new SqlParameter[] { + new SqlParameter("@工位号", "DDV") + } + }); + } + + public static void Exec_DispatchSql() + { + return; + MesWorkForm.taskSql.Enqueue(new NJ_ZC.ParamT + { + procedureName = "Event_Delete_部分历史数据", + sqlParameter = new SqlParameter[] { + } + }); + } + + } + + + + +} diff --git a/CCYQ_JieFang/BusinessCode/DispatchSql.cs b/CCYQ_JieFang/BusinessCode/DispatchSql.cs new file mode 100644 index 0000000..258568f --- /dev/null +++ b/CCYQ_JieFang/BusinessCode/DispatchSql.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace MesWork +{ + public partial class Temp { } + public partial class MesWorkForm + { + + private void Task_DispatchSql() + { + while (true) + { + try + { + B_DB_Opera.Exec_DispatchSql(); + LogRecord.LogRecord.Insert_Log(LogRecord.LogRecord.Type_Log.Tip, "执行一次数据库调度【Task_DispatchSql】"); + } + catch (Exception err) + { + } + Thread.Sleep(ExecSql_Interval*60*60*1000); + } + } + + } +} diff --git a/CCYQ_JieFang/BusinessCode/Heartbeat.cs b/CCYQ_JieFang/BusinessCode/Heartbeat.cs new file mode 100644 index 0000000..ca3434b --- /dev/null +++ b/CCYQ_JieFang/BusinessCode/Heartbeat.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MesWork +{ + public partial class Temp { } + public partial class MesWorkForm + { + + private static void Heartbeat(string opName, string tagValue) + { + if (tagValue == "1") + { + WritePLC((int)EnumTagTypeCodeID.HeartBeatMIS, opName, true); + } + else + { + WritePLC((int)EnumTagTypeCodeID.HeartBeatMIS, opName, false); + } + } + + } +} diff --git a/CCYQ_JieFang/BusinessCode/MIS_Funtion.cs b/CCYQ_JieFang/BusinessCode/MIS_Funtion.cs new file mode 100644 index 0000000..0b3a0fb --- /dev/null +++ b/CCYQ_JieFang/BusinessCode/MIS_Funtion.cs @@ -0,0 +1,196 @@ +using DK_DC_Tool; +using NPOI.SS.Formula.Functions; +using OpcBasic; +using Robots.Commands; +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using SystemFramework; + +/// +/// +/// +namespace MesWork +{ + /// + /// + public partial class MesWorkForm + { + /// + /// + /// + /// + private void MIS_Tighten(object e) + { + var param = (TightenParam)e; + var hex = param.hex; + var raw = param.raw; + try + { + /* + . . . . . T 0 2 0 2 0 0 0 1 0 = 0 . 1 1 8 , 0 . 0 0 0 , 3 . 0 0 0 , 6 8 8 . 1 2 2 ; 0 0 0 1 1 = 2 ; 0 0 0 1 2 = 5 2 ; 0 1 0 1 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 1 1 = 1 ; 0 1 0 2 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 2 1 = 1 ; 0 1 0 3 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 3 1 = 1 ; 0 1 0 4 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 4 1 = 1 ; 0 1 0 5 0 = 0 . 1 1 8 , 6 8 8 . 1 2 2 , 2 . 9 9 9 ; 0 1 0 5 1 = 6 ; . + 1.去除所有空格 + .....T020200010=0.118,0.000,3.000,688.122;00011=2;00012=52;01010=0.000,0.000,0.000;01011=1;01020=0.000,0.000,0.000;01021=1;01030=0.000,0.000,0.000;01031=1;01040=0.000,0.000,0.000;01041=1;01050=0.118,688.122,2.999;01051=6;. + 2.从索引10开始截取,最后一位不要 + 00010=0.118,0.000,3.000,688.122;00011=2;00012=52;01010=0.000,0.000,0.000;01011=1;01020=0.000,0.000,0.000;01021=1;01030=0.000,0.000,0.000;01031=1;01040=0.000,0.000,0.000;01041=1;01050=0.118,688.122,2.999;01051=6; + 3.按照分号拆分,留前三组 + 00010=0.118,0.000,3.000,688.122 最终扭矩 ;监测角度 ;最终时间 ;最终角度 ; + 00011=2 0= 无定意;1=OK,拧紧合格;2=NG,拧紧不合格; + 00012=52 00= 无定意;01= 最终扭矩过大;02= 最终扭矩过大;03= 最终角度过大;04= 最终角度过小;n1= 第 n 步扭矩过大;n2= 第 n 步时间超限;1 20) + { + // 3.按照分号拆分,留前三组 + var arr = str.Split(';'); + if (arr.Length > 3) + { + // 无效数据 + string 最终扭矩 = arr[0].Split('=')[1].Split(',')[0]; + string 监测角度 = arr[0].Split('=')[1].Split(',')[1]; + string 最终时间 = arr[0].Split('=')[1].Split(',')[2]; + string 最终角度 = arr[0].Split('=')[1].Split(',')[3]; + string isOk = arr[1].Split('=')[1]; + string NG_Code = arr[2].Split('=')[1]; + string NG_CodeStr = ""; + if (isOk == "2") NG_CodeStr = Tighten.TightenNG_Code[NG_Code]; + + // 第几个孔位 + int MeasurePosition = Convert.ToInt32(MesWorkForm.ReadPLC(55, currentOpName)); + int partPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, currentOpName)); + string IsOK = isOk; + + publicCore.LogInsert("Tighten", "Info", $"【保存拧紧枪数据】工件位置{partPosition},拧紧位置{MeasurePosition}" + raw); + // 保存质量数 + publicCore.QualityData_MobyInsert(partPosition, MeasurePosition, currentOpName, 最终扭矩, IsOK, NG_CodeStr, out string errMsg); + MesWorkForm.WritePLC(83, currentOpName, true); + publicCore.LogInsert(currentOpName, "Info", "【IPC_读电批完成置位】"); + // 拧紧状态显示 + if (MIS_Funtion_PLC_MeasureFinish != null) + { + MIS_Funtion_PLC_MeasureFinish(); + } + } + } + } + else + { + if (str.Length > 20) + { + publicCore.LogInsert(currentOpName, "Error", "拧紧枪发送数据,但是PLC读电批值为:" + isStartTighten); + } + else + { + publicCore.LogInsert(currentOpName, "Info", "订阅拧紧枪数据!"); + } + } + break; + + } + } + } + } + catch (Exception err) + { + publicCore.LogInsert("Tighten", "Error", "【拧紧枪数据错误】" + err); + } + + } + + /// + /// 处理MIS逻辑 + /// + /// + private void MIS_Funtion(object e) + { + try + { + var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e; + if (msgEvent.TagValue == null) return; + + var tagID = msgEvent.TagID.ToString (); + var opName = msgEvent.OpName.ToString(); + var tagTypeCodeID = (int)msgEvent.TagTypeCodeID; + var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID; + // EnumTagTypeCodeID TagTypeCodeID = (EnumTagTypeCodeID)tagTypeCodeID; + string tagValue; + switch (tagTypeID) + { + case EnumTagTypeID.BOOL: + tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString(); + break; + default: + tagValue = msgEvent.TagValue.ToString(); + break; + } + switch(opName) + { + // PLC心跳 + case "OP10": + if (DAS_OP10.MIS_Funtion_PLC_OP != null) + { + DAS_OP10.MIS_Funtion_PLC_OP(msgEvent); + } + break; + case "OP20": + if (DAS_OP20.MIS_Funtion_PLC_OP != null) + { + DAS_OP20.MIS_Funtion_PLC_OP(msgEvent); + } + break; + case "OP30": + if (DAS_OP30.MIS_Funtion_PLC_OP != null) + { + DAS_OP30.MIS_Funtion_PLC_OP(msgEvent); + } + break; + case "OP40": + if (DAS_OP40.MIS_Funtion_PLC_OP != null) + { + DAS_OP40.MIS_Funtion_PLC_OP(msgEvent); + } + break; + case "OP50": + if (DAS_OP50.MIS_Funtion_PLC_OP != null) + { + DAS_OP50.MIS_Funtion_PLC_OP(msgEvent); + } + break; + } + } + catch (Exception err) + { } + + } + } +} diff --git a/CCYQ_JieFang/BusinessCode/MesRead.cs b/CCYQ_JieFang/BusinessCode/MesRead.cs new file mode 100644 index 0000000..71016e6 --- /dev/null +++ b/CCYQ_JieFang/BusinessCode/MesRead.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MesWork +{ + public partial class Temp { } + public partial class MesWorkForm + { + + /// + /// 允许保存(针对半自动和手动压装工位) + /// + /// + /// + private static void MesRead(string opName, string tagValue, int tagID) + { + if (tagValue == "1") + { + // Hashtable valueList = ReadPLC_Sync_DataList_MesRead(opName); + + // long id_tagCF; + // InsertQualityDataIndex(out id_tagCF); + + //InsertQualityData(id_tagCF); + //// //Insert(System.Data.DataTable dt); + } + else + { + } + } + + + //static public void InsertQualityDataIndex(out long id_tagCF) + //{ + // string tableName; + // ParamData[] paramWhere; + + // int tagID = 81010003; + // int engineTypeID = 1; + // string engineID = "TestEn0001"; + // string engineType = "Type001"; + + // paramWhere = new ParamData[4]; + + + // tableName = "测量数据合格索引"; + // paramWhere[0].name = "TagID_CF"; + // paramWhere[0].value = tagID.ToString(); + // paramWhere[1].name = "EngineTypeID"; + // paramWhere[1].value = engineTypeID.ToString(); + // paramWhere[2].name = "EngineID"; + // paramWhere[2].value = engineID.ToString(); + // paramWhere[3].name = "EngineType"; + // paramWhere[3].value = engineType.ToString(); + + // Insert(tableName, paramWhere, out id_tagCF); + //} + + + //static public void InsertQualityData(long id_tagCF) + //{ + // int tagID = 81010003; + // int engineTypeID = 1; + // string engineID = "TestEn0001"; + // string engineType = "Type001"; + // string tagValue; + // int isgood = 1; + // string tableName; + // tableName = "测量数据合格"; + + // DataTable dt = BuildDataTables_WWW(tableName); + // object[] value = new object[10]; + + // tagValue = "10001"; + + // value[0] = id_tagCF; + // value[1] = engineTypeID; + // value[2] = engineID; + // value[3] = tagID; + // value[4] = tagValue; + // value[5] = isgood; + // value[6] = "测量位置01"; + // value[7] = "测量项目01"; + // value[8] = "工位号01"; + // value[9] = "理论值01"; + // dt.Rows.Add(value); + + // tagValue = "10002"; + + // value[0] = id_tagCF; + // value[1] = engineTypeID; + // value[2] = engineID; + // value[3] = tagID; + // value[4] = tagValue; + // value[5] = isgood; + // value[6] = "测量位置02"; + // value[7] = "测量项目02"; + // value[8] = "工位号02"; + // value[9] = "理论值02"; + // dt.Rows.Add(value); + + // Insert(dt); + //} + + + static public DataTable BuildDataTables_WWW(string tableName) + { + DataTable table; + DataColumnCollection columns; + table = new DataTable(tableName); + columns = table.Columns; + table.Columns.Add("Id_tagCF", typeof(System.Int32)); + table.Columns.Add("EngineTypeID", typeof(System.Int32)); + table.Columns.Add("EngineID", typeof(System.String)); + table.Columns.Add("TagID", typeof(System.String)); + table.Columns.Add("TagValue", typeof(System.String)); + table.Columns.Add("IsGoodBad", typeof(System.Int32)); + table.Columns.Add("测量位置", typeof(System.String)); + table.Columns.Add("测量项目", typeof(System.String)); + table.Columns.Add("工位号", typeof(System.String)); + table.Columns.Add("理论值", typeof(System.String)); + table.Columns.Add("上限值", typeof(System.String)); + table.Columns.Add("下限值", typeof(System.String)); + table.Columns.Add("测量单位", typeof(System.String)); + table.Columns.Add("列位置", typeof(System.Int32)); + table.Columns.Add("变量排序", typeof(System.Int32)); + + return table; + } + + + + + + + + + } +} diff --git a/CCYQ_JieFang/BusinessCode/PLC_State.cs b/CCYQ_JieFang/BusinessCode/PLC_State.cs new file mode 100644 index 0000000..42fbcbc --- /dev/null +++ b/CCYQ_JieFang/BusinessCode/PLC_State.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MesWork +{ + public partial class Temp { } + public partial class MesWorkForm + { + /// + /// PLC状态展示 + /// + /// + void ShowPlcStateList(object obj) + { + OpcData.PlcStateEvetnArgs eState = (OpcData.PlcStateEvetnArgs)obj; + string ip = eState.IP.ToString(); + string onState = eState.OnLine.ToString(); + } + + + + } +} diff --git a/CCYQ_JieFang/BusinessCode/WorkStart.cs b/CCYQ_JieFang/BusinessCode/WorkStart.cs new file mode 100644 index 0000000..a4f5e2b --- /dev/null +++ b/CCYQ_JieFang/BusinessCode/WorkStart.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MesWork +{ + public partial class Temp { } + public partial class MesWorkForm + { + /// + /// 工件到位与离开时,清空MES自身信号 + /// + /// + /// + private static void WorkStart(string opName, string tagValue) + { + if (tagValue == "1") + { + + } + else + { + WritePLC((int)EnumTagTypeCodeID.EngineTypeGetOverMES, opName, false);//MES传递机型5 + WritePLC((int)EnumTagTypeCodeID.FixAllow, opName, false);//允许工作66 + WritePLC((int)EnumTagTypeCodeID.ConfirmOkGo, opName, false);//合格放行51 + WritePLC((int)EnumTagTypeCodeID.FalseGo, opName, false);//不合格放行8 + WritePLC((int)EnumTagTypeCodeID.MaterialVerifyOver, opName, false);//工作完成7 + WritePLC((int)EnumTagTypeCodeID.MesReadOver, opName, false);//保存完成20 + } + + } + + + } +} diff --git a/CCYQ_JieFang/Core/ExecSqlServer.cs b/CCYQ_JieFang/Core/ExecSqlServer.cs new file mode 100644 index 0000000..cc38749 --- /dev/null +++ b/CCYQ_JieFang/Core/ExecSqlServer.cs @@ -0,0 +1,28 @@ +using MesWork; +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NJ_ZC +{ + + public class ParamT + { + public string procedureName + { + get; + set; + } = ""; + + public SqlParameter[] sqlParameter + { + get; + set; + } + } + + +} diff --git a/CCYQ_JieFang/Core/LogRecord.Designer.cs b/CCYQ_JieFang/Core/LogRecord.Designer.cs new file mode 100644 index 0000000..700f3c5 --- /dev/null +++ b/CCYQ_JieFang/Core/LogRecord.Designer.cs @@ -0,0 +1,222 @@ + +namespace LogRecord +{ + partial class LogRecord + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + this.dgv_Log = new System.Windows.Forms.DataGridView(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.btn_Refresh = new System.Windows.Forms.Button(); + this.序号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.工位号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.类型 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.时间 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.内容 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.dgv_Log)).BeginInit(); + this.SuspendLayout(); + // + // dgv_Log + // + this.dgv_Log.AllowUserToAddRows = false; + this.dgv_Log.AllowUserToDeleteRows = false; + this.dgv_Log.AllowUserToResizeRows = false; + this.dgv_Log.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dgv_Log.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight; + dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dgv_Log.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + this.dgv_Log.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dgv_Log.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.序号, + this.工位号, + this.类型, + this.时间, + this.内容}); + this.dgv_Log.Location = new System.Drawing.Point(12, 51); + this.dgv_Log.MultiSelect = false; + this.dgv_Log.Name = "dgv_Log"; + this.dgv_Log.ReadOnly = true; + this.dgv_Log.RowHeadersVisible = false; + this.dgv_Log.RowTemplate.Height = 26; + this.dgv_Log.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.dgv_Log.Size = new System.Drawing.Size(1277, 745); + this.dgv_Log.TabIndex = 72; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(358, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 73; + this.button1.Text = "报警"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Visible = false; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.Location = new System.Drawing.Point(439, 12); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 73; + this.button2.Text = "登录"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Visible = false; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.Location = new System.Drawing.Point(520, 12); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(75, 23); + this.button3.TabIndex = 73; + this.button3.Text = "提示"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Visible = false; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // btn_Refresh + // + this.btn_Refresh.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btn_Refresh.Location = new System.Drawing.Point(12, 10); + this.btn_Refresh.Name = "btn_Refresh"; + this.btn_Refresh.Size = new System.Drawing.Size(320, 35); + this.btn_Refresh.TabIndex = 74; + this.btn_Refresh.Text = "刷新"; + this.btn_Refresh.UseVisualStyleBackColor = true; + this.btn_Refresh.Click += new System.EventHandler(this.btn_Refresh_Click); + // + // 序号 + // + this.序号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.序号.DataPropertyName = "序号"; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold); + this.序号.DefaultCellStyle = dataGridViewCellStyle2; + this.序号.HeaderText = "序号"; + this.序号.Name = "序号"; + this.序号.ReadOnly = true; + this.序号.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.序号.Width = 60; + // + // 工位号 + // + this.工位号.DataPropertyName = "工位号"; + dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold); + this.工位号.DefaultCellStyle = dataGridViewCellStyle3; + this.工位号.HeaderText = "工位号"; + this.工位号.Name = "工位号"; + this.工位号.ReadOnly = true; + this.工位号.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.工位号.Visible = false; + this.工位号.Width = 250; + // + // 类型 + // + this.类型.DataPropertyName = "类型"; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold); + this.类型.DefaultCellStyle = dataGridViewCellStyle4; + this.类型.HeaderText = "类型"; + this.类型.Name = "类型"; + this.类型.ReadOnly = true; + this.类型.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.类型.Width = 90; + // + // 时间 + // + this.时间.DataPropertyName = "时间"; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold); + dataGridViewCellStyle5.Format = "G"; + this.时间.DefaultCellStyle = dataGridViewCellStyle5; + this.时间.HeaderText = "时间"; + this.时间.Name = "时间"; + this.时间.ReadOnly = true; + this.时间.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.时间.Width = 190; + // + // 内容 + // + this.内容.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.内容.DataPropertyName = "内容"; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold); + this.内容.DefaultCellStyle = dataGridViewCellStyle6; + this.内容.HeaderText = "内容"; + this.内容.Name = "内容"; + this.内容.ReadOnly = true; + this.内容.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + // + // LogRecord + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1298, 808); + this.Controls.Add(this.btn_Refresh); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.dgv_Log); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Name = "LogRecord"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "日志"; + this.Load += new System.EventHandler(this.LogRecord_Load); + ((System.ComponentModel.ISupportInitialize)(this.dgv_Log)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataGridView dgv_Log; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button btn_Refresh; + private System.Windows.Forms.DataGridViewTextBoxColumn 序号; + private System.Windows.Forms.DataGridViewTextBoxColumn 工位号; + private System.Windows.Forms.DataGridViewTextBoxColumn 类型; + private System.Windows.Forms.DataGridViewTextBoxColumn 时间; + private System.Windows.Forms.DataGridViewTextBoxColumn 内容; + } +} + diff --git a/CCYQ_JieFang/Core/LogRecord.cs b/CCYQ_JieFang/Core/LogRecord.cs new file mode 100644 index 0000000..837d3f1 --- /dev/null +++ b/CCYQ_JieFang/Core/LogRecord.cs @@ -0,0 +1,144 @@ +using MesWork; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using static System.Configuration.ConfigurationManager; + +namespace LogRecord +{ + public partial class LogRecord : Form + { + public LogRecord() + { + InitializeComponent(); + this.WindowState = FormWindowState.Maximized; + } + public LogRecord(int _Width,int _Height) + { + InitializeComponent(); + this.Width = _Width; + this.Height = _Height; + } + + private void LogRecord_Load(object sender, EventArgs e) + { + Refresh_Log(); + } + + private void Refresh_Log() + { + var dt = Select_Log(); + dgv_Log.DataSource = dt; + + for (int i = 0; i < dt.Rows.Count; i++) + { + var 类型 = (Type_Log)Enum.Parse(typeof(Type_Log),dt.Rows[i]["类型"].ToString()); + switch (类型) + { + case Type_Log.Alarm: + RowsColor(i, Color.Red, dgv_Log); + break; + case Type_Log.Login: + RowsColor(i, Color.Green, dgv_Log); + break; + case Type_Log.Tip: + RowsColor(i, Color.Yellow, dgv_Log); + break; + default: + RowsColor(i, Color.Gray, dgv_Log); + break; + } + } + dgv_Log.ClearSelection(); + //dgv_Log.CurrentCell = null; + //dgv_Log.Rows[0].Selected = false; + } + private void RowsColor(int row, Color color, DataGridView dgv) + { + var dt = (System.Data.DataTable)dgv.DataSource; + for (int i = 0; i < dt.Columns.Count; i++) + { + dgv.Rows[row].Cells[i].Style.BackColor = color; + } + } + + public static bool Insert_Log(Type_Log LogType, string Log_Content) + { + return true; + /* +SELECT [IDG],[Log_Station],[Log_Type],[Log_Time],[Log_Content] FROM [记录_日志_运行日志] + */ + bool success = false; + var sql = +$" INSERT INTO [记录_日志_运行日志]([Log_Station],[Log_Type],[Log_Time],[Log_Content])" + +$" VALUES('{MesWorkForm.StationName}','{LogType.ToString()}',getdate(),'{Log_Content}')"; + success = DataLinkMesWork.SQLCommon.ExecuteSql(sql, MesWorkForm.ConnectionString, out string err2); + + return success; + + } + public static DataTable Select_Log() + { + /* +SELECT [IDG],[Log_Station],[Log_Type],[Log_Time],[Log_Content] FROM [记录_日志_运行日志] + */ + var sql = +$" (SELECT " + +$" row_number() over(order by [Log_Time]) AS 序号" + +$" ,[Log_Station] AS 工位号" + +$" ,[Log_Type] AS 类型" + +$" ,[Log_Time] AS 时间" + +$" ,[Log_Content] AS 内容" + + +$" FROM [记录_日志_运行日志]" + +$" WHERE [Log_Station] = '{MesWorkForm.StationName}')" + +$" ORDER BY 序号 DESC"; + DataLinkMesWork.SQLCommon.ExecuteDataTable(sql, MesWorkForm.ConnectionString,out DataTable dt, out string err2); + return dt; + + } + + private void button1_Click(object sender, EventArgs e) + { + Insert_Log(Type_Log.Alarm, "dfghjkjfdfghjk法国红酒看官方一股好久哦i反对牛v军方肯定没得查看你的孙女i的女哦i的妇女哦看v哦对妇女的发"); + } + + private void button2_Click(object sender, EventArgs e) + { + Insert_Log(Type_Log.Login, "废物"); + } + + private void button3_Click(object sender, EventArgs e) + { + Insert_Log(Type_Log.Tip, "滚"); + } + + public enum Type_Log + { + /// + /// 报警 + /// + Alarm = 1, + /// + /// 登录 + /// + Login = 2, + /// + /// 提示 + /// + Tip = 3 + } + + private void btn_Refresh_Click(object sender, EventArgs e) + { + Refresh_Log(); + } + } +} diff --git a/CCYQ_JieFang/Core/LogRecord.resx b/CCYQ_JieFang/Core/LogRecord.resx new file mode 100644 index 0000000..2a7ec94 --- /dev/null +++ b/CCYQ_JieFang/Core/LogRecord.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/CCYQ_JieFang/Core/Remote.Receive.cs b/CCYQ_JieFang/Core/Remote.Receive.cs new file mode 100644 index 0000000..299eeff --- /dev/null +++ b/CCYQ_JieFang/Core/Remote.Receive.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MesWork +{ + public partial class QingYa_OP0010 { } + public partial class MesWorkForm + { + /// + /// + /// + /// + public void LoadClientInfo(object _Msg) + { + try + { + string recStr = (string)_Msg; + string m_Source = recStr.Split('|')[0]; + string cmd = recStr.Split('|')[1]; + //string OpName = recStr.Split('|')[2]; + //string tagValue = recStr.Split('|')[3]; + + switch (m_Source) + { + case "DT": + break; + case "MES": + break; + } + + } + catch (Exception err) { } + } + + + + + + } +} diff --git a/CCYQ_JieFang/Core/TagTypeCodeID.cs b/CCYQ_JieFang/Core/TagTypeCodeID.cs new file mode 100644 index 0000000..a10b044 --- /dev/null +++ b/CCYQ_JieFang/Core/TagTypeCodeID.cs @@ -0,0 +1,466 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +///1 X WorkStart 2 工件到位(PLC) 工件到位。托盘到达工位,并且托盘上有工件。 +///2 X RepairPartStatusPLC 3 RepairPartStatusPLC 备用 +///3 STRING RepairPathString 4 RepairPathString "工位返修字符串(121211112222111),前2位是西门子字符串格式,第一位是总长度,第二位是实际长度" +///4 X EngineTypeGetOverMES 5 传递机型(MES) MES传递总成信息给PLC(上线工位) +///5 X PartPalletGoOver 6 PartPalletGoOver 上线工位。0:正常工作;1:空托盘放行,PLC读取到此标志不走申请上线逻辑。 +///6 X MaterialVerifyOver 7 MaterialVerifyOver MES保存完质量数据,物料数据等与PLC信号交互完成后通知PLC,所以工步都完成,才可以放行工件,正常工作时工件放行的必要条件。 +///7 X FalseGo 8 FalseGo 按MES界面[不合格放行]按钮,MES发送此信号。操作者判断工件不合格,通知设备,按不合格方式放行工件,工件流转到返修下线工位后,返修下线。MES工作完成MES0.3=1,MES合格放行MES0.5=0,MES0.4=1 +///8 INT EngineTypeID 9 EngineTypeID MES发动机机型标志(必须PLC) +///9 STRING EngineID 10 EngineID MES发动机编号(必须PLC) +///10 STRING EngineType 11 机型(MES) MES发动机机型(必须PLC) +///11 X PartPalletStatus 13 PartPalletStatus MES激发变量托盘到位离开(必须PLC) +///12 X HeartBeatPLC 14 HeartBeatPLC 心跳处理:PLC收到MES心跳信号后,PLC延时5秒后,数值取反再写回PLC,写回PLC开始计时,如果5秒钟MES无反馈报通讯故障。 +///13 X HeartBeatMIS 15 HeartBeatMIS 间隔时间5S,心跳处理。收到PLC心跳信号后,MES按原值回写。PLC收到MES信号后延时5秒,取反写入,以此循环。 +///14 X TargetTimeRead 16 TargetTimeRead MES允许可读工位运行时间 +///15 Int MachineTargetTime 17 MachineTargetTime 目标运行时间 +///16 Int MachineActualTime 18 MachineActualTime 实际运行时间 +///17 X MesRead 19 允许保存(PLC) 质量数据可以读数据 +///18 X MesReadOver 20 保存完成(MES) MES保存完数据(必须MIS) +///19 INT QualityMask 21 合格标志(PLC) 质量数据工位合格标志0:没有工作;1:合格 ;2 :不合格(必须PLC) +///20 B PalletInfo 22 PalletInfo 0空托盘,1合格件,2不合格件 +///21 INT RepairStatusPLC 23 RepairStatusPLC 0正常件,1返修件 +///22 INT OrderNo 24 订单号(MES) 订单号(MES) +///23 X StorageNo 25 库位号(MES) 库位号(MES) +///24 X AllowPass 26 允许放行(MES) 允许放行 +///25 X PartLoadFinish 27 PartLoadFinish PartLoadFinish +///26 X Reserved_7 28 Reserved_7 备用 +///27 X Reserved_8 29 Reserved_8 备用 +///28 X Reserved_9 30 Reserved_9 备用 +///29 X Reserved_10 31 Reserved_10 备用 +///30 X Reserved_11 32 Reserved_11 备用 +///31 X Reserved_12 33 Reserved_12 备用 +///32 X Reserved_13 34 Reserved_13 备用 +///33 X Reserved_14 35 Reserved_14 备用 +///34 Int PLCSPareint1 36 PLCSPareint1 备用 +///35 Int PLCSPareint2 37 PLCSPareint2 备用 +///36 Int PLCSPareint3 38 PLCSPareint3 备用 +///37 STRING PLCSarestring1 39 PLCSarestring1 备用 +///38 STRING PLCSarestring2 40 PLCSarestring2 备用 +///39 STRING MarkID 42 MarkID 机体打标号(MES)前2位是西门子字符串格式,第一位是总长度,第二位是实际长度 +///40 X PartLoad 43 PartLoad 上线工位,PLC向MES申请总成编号。收到该信号后,MES将机型标志(DBB22 ~23)、总成号(DBB24 ~63)、总成机型DBB64 ~103写入PLC。之后MES通过信号“传递机型(DBX0.1)”通知PLC。 +///41 X EngineTypeGetOverPLC 44 传递机型(PLC) PLC将机型标志(DBB50…51)、工件编号(DBB52…101)、产品型号(DBB102…187)、托盘编号(DBB188…189)准备完毕后,通知MES。 +///42 X PartLoadOK 48 PartLoadOK 备用 +///43 X Reserved_18 49 Reserved_18 备用 +///44 X PalletDown 50 PalletDown 暂时保留,项目未使用 +///45 X ConfirmOkGo 51 ConfirmOkGo 按MES界面[合格放行]按钮,MES发送此信号。操作者判断工件合格,通知设备,工件按合格方式放行工件。MES工作完成MES0.3=1,MES合格放行MES0.5=1,MES0.4=0 +///46 X ResetDevice 52 ResetDevice 针对手动工位,无HMI,需要复位设备在MES页面操作。 +///47 X UnloadCompleted 53 UnloadCompleted 暂时保留,项目未使用 +///48 X MachineTime_ReadOver 54 MachineTime_ReadOver 备用 +///49 X Reserved_19 58 Reserved_19 备用 +///50 X FixOK 59 FixOK 手动拧紧工位,单工步螺栓拧紧完成,通知PC读取数据。 +///51 X Reserved_21 61 Reserved_21 备用 +///52 X Reserved_22 62 Reserved_22 备用 +///53 X Reserved_23 63 Reserved_23 备用 +///54 X Reserved_24 64 Reserved_24 备用 +///55 X Reserved_25 65 Reserved_25 备用 +///56 X FixAllow 66 FixAllow "设备工作的必须信号,对于有物料验证的工位,MES验证完成给出此信号,对于无物料验证工位,MES直接给出此信号。" +///57 X FixOver 67 FixOver 用于手动拧紧且有质量数据工位。通知设备当前工步拧紧螺钉工作结束。 +///58 X MatchingCompleted 68 MatchingCompleted 分线上总线,匹配成功是1;不成功是0。 +///59 X Match 69 Match 分线上总线,匹配成功是1;不成功是0。 +///60 X Reserved_2 70 Reserved_2 备用 +///61 X IsAutoGetEngineID 71 IsAutoGetEngineID 自动手动申请工件编号。0是自动方式;1:手动方式。暂时保留,生成流水号方式是在数据库中实现的 +///62 X RepairUplineMES 72 RepairUplineMES 上线清空MOBY(针对上线工位):通知PLC从新开始申请上线流程 +///63 INT EngineTypeID_MES 73 机型代码(MES) MES发动机机型标志(必须MES) +///64 STRING EngineID_MES 74 工件编号(MES) MES发动机编号(必须MES) +///65 STRING EngineType_MES 75 EngineType_MES MES发动机机型(必须MES) +///66 X Reserved_20 76 Reserved_20 备用 +///67 INT ProcessCode 77 ProcessCode 手动拧紧工位:由MES通知PLC拧紧序号 +///68 B OnLineState 79 OnLineState 通过线体工位PC实现下达工位工作状态:工位有三种状态:在线、离线、屏蔽。在线:0正常状态,实现正常功能。1离线:设备脱离MES工作,进入不交互模式。 +///69 INT PartPalletCode 80 托盘号(MES) 托盘编号(B5A) +///70 INT BoltCode 88 BoltCode 手动拧紧工位:指导PLC所用套筒 +///71 INT RepairStatus 93 RepairStatus "0正常件,1返修件。对于上线工位MES给出是正常上线还是返修上线,返修路径" +///72 DInt Reserved_15 110 Reserved_15 备用 +///73 DInt Reserved_16 111 Reserved_16 备用 +///74 B Reserved_17 112 Reserved_17 备用 +///75 INT SPareint1 113 SPareint1 备用int1 +///76 INT SPareint2 114 SPareint2 备用int2 +///77 INT SPareint3 115 SPareint3 备用int3 +///78 STRING Sparestring1 116 Sparestring1 备用字符串1 +///79 STRING Sparestring2 117 Sparestring2 备用字符串2 +///80 X MachineStatusPutOn 1000 机床上电(PLC) 机床上电(必须PLC) +///81 X MachineStatusWorkOn 1001 循环开始(PLC) 循环开始(必须PLC) +///82 X MachineStatusAlarm 1002 设备报警(PLC) 机床故障(必须PLC) +///83 X MachineStatusNoPart 1003 MachineStatusNoPart 上料无件(必须PLC) +///84 X MachineStatusBlock 1004 MachineStatusBlock 下料堵塞(必须PLC) + + +namespace MesWork +{ + /// + /// 这是变量类型代码的配置,几乎是不变的 + /// 请不要随意修改,为了保证变量版本同一,并且方便维护,请联系发行人修改! + /// 请注意,此修改为全局修改! + /// + public enum EnumTagTypeCodeID + { + /// + /// 工件到位(PLC) + /// 变量类型:Bool + /// 解释:托盘到达工位,并且托盘上有工件。 + /// + WorkStart = 2, + /// + /// + /// + RepairPartStatusPLC = 3, + /// + /// 工位返修字符串 + /// 变量类型:String + /// 解释:工位返修字符串 + /// + RepairPathString = 4, + /// + /// 传递机型(MES) + /// 变量类型:Bool + /// 解释:MES传递总成信息给PLC(上线工位) + /// + EngineTypeGetOverMES = 5, + /// + /// + /// + PartPalletGoOver = 6, + /// + /// + /// + MaterialVerifyOver = 7, + /// + /// + /// + FalseGo = 8, + /// + /// + /// + EngineTypeID = 9, + /// + /// + /// + EngineID = 10, + /// + /// 机型(MES) + /// 变量类型:String + /// + EngineType = 11, + /// + /// + /// + PartPalletStatus = 13, + /// + /// + /// + HeartBeatPLC = 14, + /// + /// + /// + HeartBeatMIS = 15, + /// + /// + /// + TargetTimeRead = 16, + /// + /// + /// + MachineTargetTime = 17, + /// + /// + /// + MachineActualTime = 18, + /// + /// 允许保存(PLC) + /// 变量类型:Bool + /// + MesRead = 19, + /// + /// 保存完成(MES) + /// 变量类型:Bool + /// + MesReadOver = 20, + /// + /// 合格标志(PLC) + /// 变量类型:Int + /// + QualityMask = 21, + /// + /// + /// + PalletInfo = 22, + /// + /// + /// + RepairStatusPLC = 23, + /// + /// 订单号(MES) + /// 变量类型:Int + /// + OrderNo = 24, + /// + /// 库位号(MES) + /// 变量类型:Bool + /// + StorageNo = 25, + /// + /// 允许放行(MES) + /// 变量类型:Bool + /// + AllowPass = 26, + /// + /// + /// + PartLoadFinish = 27, + /// + /// + /// + Reserved_7 = 28, + /// + /// + /// + Reserved_8 = 29, + /// + /// + /// + Reserved_9 = 30, + /// + /// + /// + Reserved_10 = 31, + /// + /// + /// + Reserved_11 = 32, + /// + /// + /// + Reserved_12 = 33, + /// + /// + /// + Reserved_13 = 34, + /// + /// + /// + Reserved_14 = 35, + /// + /// + /// + PLCSPareint1 = 36, + /// + /// + /// + PLCSPareint2 = 37, + /// + /// + /// + PLCSPareint3 = 38, + /// + /// + /// + PLCSarestring1 = 39, + /// + /// + /// + PLCSarestring2 = 40, + /// + /// + /// + MarkID = 42, + /// + /// + /// + PartLoad = 43, + /// + /// 传递机型(PLC) + /// 变量类型:Bool + /// + EngineTypeGetOverPLC = 44, + /// + /// + /// + PartLoadOK = 48, + /// + /// + /// + Reserved_18 = 49, + /// + /// + /// + PalletDown = 50, + /// + /// + /// + ConfirmOkGo = 51, + /// + /// + /// + ResetDevice = 52, + /// + /// + /// + UnloadCompleted = 53, + /// + /// + /// + MachineTime_ReadOver = 54, + /// + /// + /// + Reserved_19 = 58, + /// + /// + /// + FixOK = 59, + /// + /// + /// + Reserved_21 = 61, + /// + /// + /// + Reserved_22 = 62, + /// + /// + /// + Reserved_23 = 63, + /// + /// + /// + Reserved_24 = 64, + /// + /// + /// + Reserved_25 = 65, + /// + /// + /// + FixAllow = 66, + /// + /// + /// + FixOver = 67, + /// + /// + /// + MatchingCompleted = 68, + /// + /// + /// + Match = 69, + /// + /// + /// + Reserved_2 = 70, + /// + /// + /// + IsAutoGetEngineID = 71, + /// + /// + /// + RepairUplineMES = 72, + /// + /// 机型代码(MES) + /// 变量类型:Int + /// + EngineTypeID_MES = 73, + /// + /// 工件编号(MES) + /// 变量类型:String + /// + EngineID_MES = 74, + /// + /// + /// + EngineType_MES = 75, + /// + /// + /// + Reserved_20 = 76, + /// + /// + /// + ProcessCode = 77, + /// + /// + /// + OnLineState = 79, + /// + /// 托盘号(MES) + /// 变量类型:Int + /// + PartPalletCode = 80, + /// + /// + /// + BoltCode = 88, + /// + /// + /// + RepairStatus = 93, + /// + /// + /// + Reserved_15 = 110, + /// + /// + /// + Reserved_16 = 111, + /// + /// + /// + Reserved_17 = 112, + /// + /// + /// + SPareint1 = 113, + /// + /// + /// + SPareint2 = 114, + /// + /// + /// + SPareint3 = 115, + /// + /// + /// + Sparestring1 = 116, + /// + /// + /// + Sparestring2 = 117, + /// + /// 机床上电(PLC) + /// 变量类型:Bool + /// + MachineStatusPutOn = 1000, + /// + /// 循环开始(PLC) + /// 变量类型:Bool + /// + MachineStatusWorkOn = 1001, + /// + /// 设备报警(PLC) + /// 变量类型:Bool + /// + MachineStatusAlarm = 1002, + /// + /// 上料无件(PLC) + /// 变量类型:Bool + /// + MachineStatusNoPart = 1003, + /// + /// 下料堵塞(PLC) + /// 变量类型:Bool + /// + MachineStatusBlock = 1004, + /// + /// 下料堵塞(PLC) + /// 变量类型:Bool + /// + havePart70 = 10003, + } +} diff --git a/CCYQ_JieFang/MW.OnStart.cs b/CCYQ_JieFang/MW.OnStart.cs new file mode 100644 index 0000000..24581a5 --- /dev/null +++ b/CCYQ_JieFang/MW.OnStart.cs @@ -0,0 +1,22 @@ + +using Newtonsoft.Json; +using System; +using System.Threading; +using SystemFramework; + +namespace MesWork +{ + public partial class Temp { } + public partial class MesWorkForm + { + protected override void OnShown(EventArgs e) + { + //ThreadPool.SetMaxThreads(2000, 800); + //Never_Know.Hello_You_All_Never_Know = Hello_You_All_Never_Know; + //new ApplicationLog(); + //LoadOPCData(MesWorkForm.BasicDataTableFile, MesWorkForm.IsDemoMesServer, MesWorkForm.IsWriteMonitorLog, true); + //initServer = new InitServer(MesWorkForm.WebSvrUrlPort); + } + + } +} diff --git a/CCYQ_JieFang/MesWork.Designer.cs b/CCYQ_JieFang/MesWork.Designer.cs new file mode 100644 index 0000000..a475c91 --- /dev/null +++ b/CCYQ_JieFang/MesWork.Designer.cs @@ -0,0 +1,181 @@ +using System.Windows.Forms; +using global::Init; +namespace MesWork +{ + partial class MesWorkForm : PlcLinkForm + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + + } + + #region Windows 窗体设计器生成的代码 + + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MesWorkForm)); + this.panel_Page = new System.Windows.Forms.Panel(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.文件ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.上下限设置ToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.系统日志ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.ToolStripMenuItem_exit = new System.Windows.Forms.ToolStripMenuItem(); + this.监控ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pLC监控ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.查询ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aGV调试ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.button1 = new System.Windows.Forms.Button(); + this.tableLayoutPanel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.menuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // panel_Page + // + resources.ApplyResources(this.panel_Page, "panel_Page"); + this.panel_Page.Name = "panel_Page"; + // + // tableLayoutPanel1 + // + resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); + this.tableLayoutPanel1.Controls.Add(this.panel_Page, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + // + // panel2 + // + this.panel2.Controls.Add(this.button1); + this.panel2.Controls.Add(this.menuStrip1); + resources.ApplyResources(this.panel2, "panel2"); + this.panel2.Name = "panel2"; + // + // menuStrip1 + // + resources.ApplyResources(this.menuStrip1, "menuStrip1"); + this.menuStrip1.GripMargin = new System.Windows.Forms.Padding(2, 2, 0, 2); + this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.文件ToolStripMenuItem, + this.监控ToolStripMenuItem, + this.查询ToolStripMenuItem, + this.aGV调试ToolStripMenuItem}); + this.menuStrip1.Name = "menuStrip1"; + // + // 文件ToolStripMenuItem + // + this.文件ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.上下限设置ToolStripMenuItem1, + this.系统日志ToolStripMenuItem, + this.ToolStripMenuItem_exit}); + this.文件ToolStripMenuItem.Name = "文件ToolStripMenuItem"; + resources.ApplyResources(this.文件ToolStripMenuItem, "文件ToolStripMenuItem"); + // + // 上下限设置ToolStripMenuItem1 + // + this.上下限设置ToolStripMenuItem1.Name = "上下限设置ToolStripMenuItem1"; + resources.ApplyResources(this.上下限设置ToolStripMenuItem1, "上下限设置ToolStripMenuItem1"); + this.上下限设置ToolStripMenuItem1.Click += new System.EventHandler(this.上下限设置ToolStripMenuItem1_Click); + // + // 系统日志ToolStripMenuItem + // + this.系统日志ToolStripMenuItem.Name = "系统日志ToolStripMenuItem"; + resources.ApplyResources(this.系统日志ToolStripMenuItem, "系统日志ToolStripMenuItem"); + this.系统日志ToolStripMenuItem.Click += new System.EventHandler(this.系统日志ToolStripMenuItem_Click); + // + // ToolStripMenuItem_exit + // + this.ToolStripMenuItem_exit.Name = "ToolStripMenuItem_exit"; + resources.ApplyResources(this.ToolStripMenuItem_exit, "ToolStripMenuItem_exit"); + this.ToolStripMenuItem_exit.Click += new System.EventHandler(this.ToolStripMenuItem_exit_Click); + // + // 监控ToolStripMenuItem + // + this.监控ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.pLC监控ToolStripMenuItem}); + this.监控ToolStripMenuItem.Name = "监控ToolStripMenuItem"; + resources.ApplyResources(this.监控ToolStripMenuItem, "监控ToolStripMenuItem"); + // + // pLC监控ToolStripMenuItem + // + this.pLC监控ToolStripMenuItem.Name = "pLC监控ToolStripMenuItem"; + resources.ApplyResources(this.pLC监控ToolStripMenuItem, "pLC监控ToolStripMenuItem"); + this.pLC监控ToolStripMenuItem.Click += new System.EventHandler(this.pLC监控ToolStripMenuItem_Click); + // + // 查询ToolStripMenuItem + // + this.查询ToolStripMenuItem.Name = "查询ToolStripMenuItem"; + resources.ApplyResources(this.查询ToolStripMenuItem, "查询ToolStripMenuItem"); + this.查询ToolStripMenuItem.Click += new System.EventHandler(this.查询ToolStripMenuItem_Click); + // + // aGV调试ToolStripMenuItem + // + this.aGV调试ToolStripMenuItem.Name = "aGV调试ToolStripMenuItem"; + resources.ApplyResources(this.aGV调试ToolStripMenuItem, "aGV调试ToolStripMenuItem"); + this.aGV调试ToolStripMenuItem.Click += new System.EventHandler(this.aGV调试ToolStripMenuItem_Click); + // + // button1 + // + resources.ApplyResources(this.button1, "button1"); + this.button1.Name = "button1"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // MesWorkForm + // + resources.ApplyResources(this, "$this"); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.tableLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MainMenuStrip = this.menuStrip1; + this.Name = "MesWorkForm"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MesWorkForm_FormClosing); + this.Load += new System.EventHandler(this.MesWorkForm_Load); + this.tableLayoutPanel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private Panel panel_Page; + private TableLayoutPanel tableLayoutPanel1; + private Panel panel2; + private MenuStrip menuStrip1; + private ToolStripMenuItem 文件ToolStripMenuItem; + private ToolStripMenuItem ToolStripMenuItem_exit; + private ToolStripMenuItem 监控ToolStripMenuItem; + private ToolStripMenuItem pLC监控ToolStripMenuItem; + private ToolStripMenuItem 查询ToolStripMenuItem; + private ToolStripMenuItem 上下限设置ToolStripMenuItem1; + private ToolStripMenuItem 系统日志ToolStripMenuItem; + private ToolStripMenuItem aGV调试ToolStripMenuItem; + private Button button1; + } +} + diff --git a/CCYQ_JieFang/MesWork.cs b/CCYQ_JieFang/MesWork.cs new file mode 100644 index 0000000..1cefc55 --- /dev/null +++ b/CCYQ_JieFang/MesWork.cs @@ -0,0 +1,224 @@ +namespace MesWork +{ + using CCYQ_JieFang; + using DK_DC_Tool; + using MQTTnet.Server; + using Robots; + using System; + using System.Data; + using System.Diagnostics; + using System.IO; + using System.Net; + using System.Threading; + using System.Windows.Forms; + using SystemFramework; + + public partial class MesWorkForm + { + InitServer initServer = null; + + /// + /// 测量完成委托 + /// + public static Action MIS_Funtion_PLC_MeasureFinish = null; + + /// + /// + /// + public MesWorkForm() + { + InitializeComponent(); + + CheckForIllegalCrossThreadCalls = false; + currentOpName = File.ReadAllText(IpcConfigPath).ToString(); + Never_Know.Hello_You_All_Never_Know = Hello_You_All_Never_Know; + + publicCore.LogInsert(currentOpName, "Info", "开启程序!"); + + ThreadPool.SetMaxThreads(2000, 800); + LoadOPCData(MesWorkForm.BasicDataTableFile, MesWorkForm.IsDemoMesServer, MesWorkForm.IsWriteMonitorLog, false, false, out string err); + if (err.Length > 0) + { + MessageBox.Show($"LoadOPCData报错:{err}"); + Process.GetCurrentProcess().Kill(); + } + switch (currentOpName) + { + case "OP10": + { + Temp.mesWorkForm1 = new DAS_OP10(currentOpName); + Temp.mesWorkForm1.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮) + Temp.mesWorkForm1.TopLevel = false; //指示子窗体非顶级窗体 + Temp.mesWorkForm1.Dock = DockStyle.Fill;//将窗体最大化填充 + panel_Page.Controls.Add(Temp.mesWorkForm1); + Temp.mesWorkForm1.Show(); + Temp.mesWorkForm1.Load -= OpFormLoad; + Temp.mesWorkForm1.Load += OpFormLoad; + } + break; + case "OP20": + Temp.mesWorkForm2 = new DAS_OP20(currentOpName); + Temp.mesWorkForm2.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮) + Temp.mesWorkForm2.TopLevel = false; //指示子窗体非顶级窗体 + Temp.mesWorkForm2.Dock = DockStyle.Fill;//将窗体最大化填充 + panel_Page.Controls.Add(Temp.mesWorkForm2); + Temp.mesWorkForm2.Show(); + Temp.mesWorkForm2.Load -= OpFormLoad; + Temp.mesWorkForm2.Load += OpFormLoad; + break; + case "OP30": + Temp.mesWorkForm3 = new DAS_OP30(currentOpName); + Temp.mesWorkForm3.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮) + Temp.mesWorkForm3.TopLevel = false; //指示子窗体非顶级窗体 + Temp.mesWorkForm3.Dock = DockStyle.Fill;//将窗体最大化填充 + panel_Page.Controls.Add(Temp.mesWorkForm3); + Temp.mesWorkForm3.Show(); + Temp.mesWorkForm3.Load -= OpFormLoad; + Temp.mesWorkForm3.Load += OpFormLoad; + break; + case "OP40": + Temp.mesWorkForm4 = new DAS_OP40(currentOpName); + Temp.mesWorkForm4.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮) + Temp.mesWorkForm4.TopLevel = false; //指示子窗体非顶级窗体 + Temp.mesWorkForm4.Dock = DockStyle.Fill;//将窗体最大化填充 + panel_Page.Controls.Add(Temp.mesWorkForm4); + Temp.mesWorkForm4.Show(); + Temp.mesWorkForm4.Load -= OpFormLoad; + Temp.mesWorkForm4.Load += OpFormLoad; + break; + case "OP50": + Temp.mesWorkForm5 = new DAS_OP50(currentOpName); + Temp.mesWorkForm5.FormBorderStyle = FormBorderStyle.None; //隐藏子窗体边框(去除最小花,最大化,关闭等按钮) + Temp.mesWorkForm5.TopLevel = false; //指示子窗体非顶级窗体 + Temp.mesWorkForm5.Dock = DockStyle.Fill;//将窗体最大化填充 + panel_Page.Controls.Add(Temp.mesWorkForm5); + Temp.mesWorkForm5.Show(); + Temp.mesWorkForm5.Load -= OpFormLoad; + Temp.mesWorkForm5.Load += OpFormLoad; + break; + default: + MessageBox.Show("未找到对应工位!"); + break; + } + } + + private void OpFormLoad(object sender, EventArgs e) + { + // 开启PLC监控 + StartServer(); + + // 开启webApi + initServer = new InitServer(MesWorkForm.WebSvrUrlPort); + + Tighten.E_LogInsert -= publicCore.LogInsert; + Tighten.E_LogInsert += publicCore.LogInsert; + + Tighten.E_ScanContent -= Tighten_E_ScanContent; + Tighten.E_ScanContent += Tighten_E_ScanContent; + + //string hex_str = ""; + //string raw_str = " . . . . . A 0 2 0 4 A C K . . . . . Z T 0 2 0 4 0 1 0 1 = 1 ; 0 2 0 1 = 0 , 2 . 0 0 , 2 . 1 0 , 1 . 0 0 , 0 . 6 0 , 2 . 0 0 , 5 0 0 0 , 0 , 3 0 . 0 0 , - 2 0 0 , 1 0 0 , 3 , 5 , - 1 0 0 , - 1 8 0 , - 3 . 6 0 , 3 . 0 0 , 1 0 0 , 9 0 , 3 . 6 0 , 3 . 0 0 , 6 0 0 , 3 6 0 0 , 3 . 6 0 , 6 . 0 0 , 8 0 , 0 . 4 0 , 3 . 6 0 , 3 . 0 0 , 6 0 0 , 2 . 0 0 , 2 . 1 0 , 3 . 0 0 , - 1 0 0 , - 1 8 0 , - 3 . 6 0 , 3 . 0 0 , 2 0 0 , 9 0 , 3 . 6 0 , 3 . 0 0 , 8 0 0 , 2 6 0 0 , 3 . 6 0 , 3 . 0 0 , 8 0 , 0 . 2 0 , 0 . 6 0 , 3 . 0 0 , 3 0 , 2 . 0 0 , 2 . 1 0 , 3 . 0 0 , 2 0 , 9 0 , 0 . 7 2 , 3 . 0 0 , 3 0 0 , 5 7 , 0 . 7 2 , 3 . 0 0 , 2 0 0 , 1 4 4 4 , 0 . 7 2 , 3 . 0 0 , 1 0 0 , 0 . 2 0 , 0 . 7 2 , 3 . 0 0 , 4 0 , 2 . 0 0 , 2 . 1 0 , 3 . 0 0 ; . . . . . . T 0 2 0 2 0 0 0 1 0 = 0 . 1 1 6 , 0 . 0 0 0 , 1 . 7 5 9 , 3 4 1 5 . 9 7 4 ; 0 0 0 1 1 = 2 ; 0 0 0 1 2 = 0 2 ; 0 1 0 1 0 = 0 . 1 8 8 , - 1 7 9 . 9 0 9 , 0 . 3 5 9 ; 0 1 0 1 1 = 1 ; 0 1 0 2 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 2 1 = 1 ; 0 1 0 3 0 = 0 . 1 1 6 , 3 5 9 6 . 4 5 6 , 1 . 3 6 9 ; 0 1 0 3 1 = 1 ; 0 1 0 4 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 4 1 = 1 ; 0 1 0 5 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 5 1 = 1 ; . "; + //// string raw_str = " . . . . . T 0 2 0 2 0 0 0 1 0 = 0 . 1 0 1 , 0 . 0 0 0 , 1 . 7 5 9 , 3 4 1 5 . 9 7 4 ; 0 0 0 1 1 = 2 ; 0 0 0 1 2 = 0 2 ; 0 1 0 1 0 = 0 . 1 6 7 , - 1 8 0 . 4 8 2 , 0 . 3 5 8 ; 0 1 0 1 1 = 1 ; 0 1 0 2 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 2 1 = 1 ; 0 1 0 3 0 = 0 . 1 0 1 , 3 5 9 7 . 0 2 9 , 1 . 3 6 9 ; 0 1 0 3 1 = 1 ; 0 1 0 4 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 4 1 = 1 ; 0 1 0 5 0 = 0 . 0 0 0 , 0 . 0 0 0 , 0 . 0 0 0 ; 0 1 0 5 1 = 1 ; ."; + //Tighten.E_ScanContent.Invoke(hex_str, raw_str); + + var dt_Tighten = NPOITest.ExeclHelper.ExcelToDataTable(BasicDataTableFile, "拧紧枪", true); + //OpName IP Port IsEnable + var dataTable = dt_Tighten.Select($"OpName='{currentOpName}' and IsEnable='1'"); + if(dataTable.Length > 0) + { + dt_Tighten = dt_Tighten.Select($"OpName='{currentOpName}' and IsEnable='1'").CopyToDataTable(); + if (dt_Tighten.Rows.Count > 0) + { + var IP = dt_Tighten.Rows[0]["IP"].ToString(); + var Port = Convert.ToInt32(dt_Tighten.Rows[0]["Port"]); + var tighten = new Tighten(); + tighten.Start(IP, Port, currentOpName); + } + } + + } + + private void MesWorkForm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) + { + if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + { + publicCore.LogInsert(currentOpName, "Info", "退出程序!"); + + e.Cancel = false; + StopServer(2000); + Thread.Sleep(500); + System.Diagnostics.Process.GetCurrentProcess().Kill(); + } + else + { + e.Cancel = true; + } + } + + private void label_ExitSys_Click(object sender, EventArgs e) + { + if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + { + CloseDeviceConn(); + System.Diagnostics.Process.GetCurrentProcess().Kill(); + } + } + + private void MesWorkForm_Load(object sender, EventArgs e) + { + + } + + private void ToolStripMenuItem_exit_Click(object sender, EventArgs e) + { + if (MessageBox.Show("是否确认退出程序?", "退出", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + { + StopServer(2000); + Thread.Sleep(500); + System.Diagnostics.Process.GetCurrentProcess().Kill(); + } + } + + private void pLC监控ToolStripMenuItem_Click(object sender, EventArgs e) + { + new OpcForm(IsDemoMesServer).Show(this); + } + + private void 关于ToolStripMenuItem_Click(object sender, EventArgs e) + { + MessageBox.Show("关于信息!"); + } + + private void 系统日志ToolStripMenuItem_Click(object sender, EventArgs e) + { + new logInfo(currentOpName).Show(this); + } + + private void 查询ToolStripMenuItem_Click(object sender, EventArgs e) + { + new partInfo(currentOpName).Show(this); + } + + private void aGV调试ToolStripMenuItem_Click(object sender, EventArgs e) + { + new AgvTest(currentOpName).Show(this); + + } + + private void 上下限设置ToolStripMenuItem1_Click(object sender, EventArgs e) + { + new MeasureRangeSet(currentOpName).Show(this); + } + + private void button1_Click(object sender, EventArgs e) + { + + if (MessageBox.Show("是否确认跳过本次拧紧?\r\n仅适用于上位机拧紧确认失败的操作", "拧紧确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + { + MesWorkForm.WritePLC(83, currentOpName, true); + MessageBox.Show("操作完成!"); + } + } + } +} + diff --git a/CCYQ_JieFang/MesWork.resx b/CCYQ_JieFang/MesWork.resx new file mode 100644 index 0000000..356fa76 --- /dev/null +++ b/CCYQ_JieFang/MesWork.resx @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Fill + + + + 2, 45 + + + 2, 2, 2, 2 + + + 2022, 1046 + + + + 0 + + + panel_Page + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 0 + + + 1 + + + 402, -2 + + + 104, 41 + + + 2 + + + 拧紧确认 + + + button1 + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 0 + + + 17, 17 + + + Fill + + + 0, 0 + + + 7, 2, 0, 2 + + + 2022, 39 + + + 1 + + + menuStrip1 + + + menuStrip1 + + + System.Windows.Forms.MenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 1 + + + Fill + + + 2, 2 + + + 2, 2, 2, 2 + + + 2022, 39 + + + 1 + + + panel2 + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 1 + + + Fill + + + 0, 0 + + + 2, 2, 2, 2 + + + 2 + + + 2026, 1093 + + + 1 + + + tableLayoutPanel1 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="panel_Page" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="panel2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Absolute,43,Percent,100" /></TableLayoutSettings> + + + 62, 35 + + + 系统 + + + 200, 34 + + + 上下限设置 + + + 200, 34 + + + 系统日志 + + + 200, 34 + + + 退出 + + + 62, 35 + + + 监控 + + + 178, 34 + + + PLC监控 + + + 134, 35 + + + 查询生产信息 + + + 100, 35 + + + AGV调试 + + + True + + + 49 + + + 144, 144 + + + True + + + 2026, 1093 + + + + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAAAAAAAAAAAAAAAAAAAAA + AAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8AxodGBciJSHLKjEuYyoxMlsqM + TJbKjEyWyoxMlsqMTJbKjEyWyoxMlsqMTJbKjEyWyoxMlsqMTJbKjEyWyoxMlsqMTJbKjEuYyIlIcsaH + RgX///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wC+fToHzI5OuOix + eP/wvIX/8LuE//C7hP/wu4T/8LuE//C7hP/wu4T/8LuE//C7hP/wu4T/8LuE//C7hP/wu4T/8LyF/+ix + eP/Mjk64v306B////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wDIiUhk3KNn9e+6g//wu4T/8LuE//C8hP/wvIX/77uE/++7hP/vu4T/77uE//C8hf/wvIT/8LuE//C7 + hP/vuoP/3KNn9ciJSGT///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AMWFQwbGh0ZUyotLk8qMTJbKjEyUyYtKsNKWWPvfp2v/36Zr/9+ma//fp2v/0pZY+8mL + SrDKjEyUyoxMlsqLS5PGh0ZUxYVEB////wD///8A////AP///wD///8A////AP///wDIiUgCwoI/CLt5 + NQm7eTUJu3k1Cbt5NQm7eTUJung0CLNvKga0cCoHtHArB6BWDAPCgT9E3aNo9vvKlf/7yZX/+8mV//vK + lf/do2j2woE/RKBWDAO0cCsHtHAqB7NvKQa6eDQIu3k1Cbt5NQm7eTUJu3k1Cbt5NQnCgj8IyIlIAsaH + RjbLjUy40JNUwNCTVMDQk1TA0JNUwNCTVMDQk1TA0JNUwNCTVMDQk1TA0JNUv8+SUtDTl1n926Fl/9uh + Zf/boWX/26Fl/9OXWf3PklLQ0JNUv9CTVMDQk1TA0JNUwNCTVMDQk1TA0JNUwM+SUsDPklLA0JJTwMuN + TLjGh0Y2xIRCSNuhZfT2w47/9sON//bDjf/2w43/9sON//bDjf/2w43/9sON//bDjf/2w43/9sOO//bD + jv/2w43/9sON//bDjf/2w43/9sOO//bDjv/2w43/9sON//bDjf/2w43/9sON//bDjf/2w47/9syf//bR + qf/2ypv/26Fl9MSEQkjDg0FI3qVq9P7Nmf/+zZn//s2Z//7Nmf/+zZn//s2Z//7Nmf/+zZn//s2Z//7N + mf/+zZn//s2Z//7Nmf/+zZn//s2Z//7Nmf/+zZn//s2Z//7Nmf/+zZn//s2Z//7Nmf/+zZn//s2Z//7N + mv/+4MD//+rU//7btv/epWn0w4NBSMWGREjRllj036hv/9+ob//fqG//36hv/9+ob//fqG//36hv/9+o + b//fqG//36hv/9+ob//fqG//36hv/9+ob//fqG//36hv/9+ob//fqG//36hv/9+ob//fqG//36hv/9+o + b//fqG//36hv/9+obv/fqG7/36hu/9GWWPTFhkRIxII9SNmugfTw4dH/8ODQ//Dg0P/w4ND/8ODQ//Dg + 0P/w4ND/8ODQ//Dg0P/w4ND/8ODQ//Dg0P/w4ND/8ODQ//Dg0P/w4ND/8ODQ//Dg0P/w4ND/8ODQ//Dg + 0P/w4ND/8ODQ//Dg0P/w4ND/8ODQ//Dg0P/w4dH/2a6B9MSCPUjDfzpI37uV9P////////////////// + //////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////fu5X0w386SMN/Okjfu5X0//////// + ////////////////////////////////////////////////////////////////////////+vXv//v2 + 8f///////////////////////////////////////////////////////////9+7lfTDfzpIw386SN+7 + lfT///////////////////////////////////////////////////////////////////////////// + ///jxKP/4b+c////////////////////////////////////////////////////////////37uV9MN/ + OkjDfzpI37uV9P////////////////////////////////////////////////////////////////// + ////////+PDo/9eqe//Vp3b/9ere//////////////////////////////////////////////////// + ///fu5X0w386SMN/Okjfu5X0//////////////////////////////////////////////////////// + ///////////////////myq3/5cip/+vUvP/hvpv//v79//////////////////////////////////// + /////////////9+7lfTDfzpIw386SN+7lfT///////////////////////////////////////////// + ////////////////////////+vXv/9qxh//27OL//Pn2/9y1jP/y5NX///////////////////////// + ////////////////////////37uV9MN/OkjDgDpI3rmS9P36+P/9+vf//fr3//369//9+vf//fr3//36 + 9//9+vf//vz6///////////////////////r1Lz/4sKh////////////7dnF/964kv/8+PT//fr3//36 + 9//9+vf//fr3//369//9+vf//fr3//36+P/euZL0w4A6SMaFQkjQm2T03LSL/9y0iv/ctIr/3LSK/9y0 + iv/ctIr/3LSK/9uyiP/eupT/+/fy/////////////Pj1/9y1jf/06Nv////////////9+/j/37yX/9qw + hf/ctIv/3LSK/9y0iv/ctIr/3LSK/9y0iv/ctIr/3LSL/9CbZPTGhUJIxIE8SNy0i/T48Of/+O/m//jv + 5v/47+b/+O/m//jv5v/47+b/9+/m/9+6lP/q0bn////////////t2cT/3rqU//79/P////////////// + ///8+PT/9+/m//jv5v/47+b/+O/m//jv5v/47+b/+O/m//jv5v/48Of/3LSL9MSBPEjDfzpI37uV9P// + ////////////////////////////////////////9erf/9qvhP/58+3//fz6/922jv/x4dD///////// + ///////////////////////////////////////////////////////////////////fu5X0w386SMN/ + Okjfu5X0////////////////////////////////////////////////48Oi/+bKrv/x4ND/3beP//37 + +v///////////////////////////////////////////////////////////////////////////9+7 + lfTDfzpIw386SN+7lfT////////////////////////////////////////////////37+b/2a6C/9er + ff/u28f///////////////////////////////////////////////////////////////////////// + ////////37uV9MN/OkjDfzpI37uV9P////////////////////////////////////////////////// + ///myaz/16p8//z59v////////////////////////////////////////////////////////////// + ///////////////////fu5X0w386SMN/Okjfu5X0//////////////////////////////////////// + //////////////r17//16dz///////////////////////////////////////////////////////// + /////////////////////////////9+7lfTDfzpIw386SN+7lfT///////////////////////////// + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////37uV9MN/OkjEgTxI3LSL9Pjw5//47+f/+O/n//jv + 5//47+f/+O/n//jv5//47+f/+O/n//jv5//47+f/+O/n//jv5//47+f/+O/n//jv5//47+f/+O/n//jv + 5//47+f/+O/n//jv5//47+f/+O/n//jv5//47+f/+O/n//jw5//ctIv0xIE8SMaHRTbLkFO40JtkwNCb + ZMDQm2TA0JtkwNCbZMDQm2TA0JtkwNCbZMDQm2TA0JtkwNCbZMDQm2TA0JtkwNCbZMDQm2TA0JtkwNCb + ZMDQm2TA0JtkwNCbZMDQm2TA0JtkwNCbZMDQm2TA0JtkwNCbZMDQm2TA0JtkwMuQU7jGh0U2yIpKAsJ9 + NQi6bR4Jum0eCbptHgm6bR4Jum0eCbptHgm6bR4Jum0eCbptHgm6bR4Jum0eCbptHgm6bR4Jum0eCbpt + Hgm6bR4Jum0eCbptHgm6bR4Jum0eCbptHgm6bR4Jum0eCbptHgm6bR4Jum0eCbptHgm6bR4Jwn01CMiK + SgL///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A///////////8AAA//AAAP/4AAH/+AAB/AAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAA//////////8= + + + + 2, 2, 2, 2 + + + CenterScreen + + + 监控系统( 2023.1213) + + + 文件ToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 上下限设置ToolStripMenuItem1 + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 系统日志ToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ToolStripMenuItem_exit + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 监控ToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + pLC监控ToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 查询ToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + aGV调试ToolStripMenuItem + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + MesWorkForm + + + MesWork.PlcLinkForm, MesWork.PLC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/AgvTest.Designer.cs b/CCYQ_JieFang/OP/AgvTest.Designer.cs new file mode 100644 index 0000000..ab62d36 --- /dev/null +++ b/CCYQ_JieFang/OP/AgvTest.Designer.cs @@ -0,0 +1,256 @@ +namespace CCYQ_JieFang +{ + partial class AgvTest + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button5 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); + this.checkBox4_position4 = new System.Windows.Forms.CheckBox(); + this.checkBox1_position1 = new System.Windows.Forms.CheckBox(); + this.checkBox3_position3 = new System.Windows.Forms.CheckBox(); + this.checkBox2_position2 = new System.Windows.Forms.CheckBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // button5 + // + this.button5.Font = new System.Drawing.Font("宋体", 11F); + this.button5.Location = new System.Drawing.Point(364, 334); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(317, 57); + this.button5.TabIndex = 12; + this.button5.Text = "4.AGV已经离开工位(下料)"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // button4 + // + this.button4.Font = new System.Drawing.Font("宋体", 11F); + this.button4.Location = new System.Drawing.Point(29, 334); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(309, 57); + this.button4.TabIndex = 13; + this.button4.Text = "4.AGV已经离开工位(上料)"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // button3 + // + this.button3.Font = new System.Drawing.Font("宋体", 11F); + this.button3.Location = new System.Drawing.Point(364, 193); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(317, 57); + this.button3.TabIndex = 14; + this.button3.Text = "3.AGV请求离开工位"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("宋体", 11F); + this.button2.Location = new System.Drawing.Point(29, 193); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(317, 57); + this.button2.TabIndex = 15; + this.button2.Text = "2.AGV请求进入工位"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button1 + // + this.button1.Font = new System.Drawing.Font("宋体", 11F); + this.button1.Location = new System.Drawing.Point(29, 50); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(317, 57); + this.button1.TabIndex = 16; + this.button1.Text = "1.AGV进行送料(允许工作)"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Controls.Add(this.checkBox4_position4); + this.panel1.Controls.Add(this.checkBox1_position1); + this.panel1.Controls.Add(this.checkBox3_position3); + this.panel1.Controls.Add(this.checkBox2_position2); + this.panel1.Location = new System.Drawing.Point(364, 31); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(259, 90); + this.panel1.TabIndex = 18; + // + // checkBox4_position4 + // + this.checkBox4_position4.AutoSize = true; + this.checkBox4_position4.Checked = true; + this.checkBox4_position4.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox4_position4.Location = new System.Drawing.Point(133, 56); + this.checkBox4_position4.Name = "checkBox4_position4"; + this.checkBox4_position4.Size = new System.Drawing.Size(115, 22); + this.checkBox4_position4.TabIndex = 19; + this.checkBox4_position4.Text = "位置4有料"; + this.checkBox4_position4.UseVisualStyleBackColor = true; + this.checkBox4_position4.CheckedChanged += new System.EventHandler(this.checkBox4_position4_CheckedChanged); + // + // checkBox1_position1 + // + this.checkBox1_position1.AutoSize = true; + this.checkBox1_position1.Checked = true; + this.checkBox1_position1.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox1_position1.Location = new System.Drawing.Point(12, 15); + this.checkBox1_position1.Name = "checkBox1_position1"; + this.checkBox1_position1.Size = new System.Drawing.Size(115, 22); + this.checkBox1_position1.TabIndex = 19; + this.checkBox1_position1.Text = "位置1有料"; + this.checkBox1_position1.UseVisualStyleBackColor = true; + this.checkBox1_position1.CheckedChanged += new System.EventHandler(this.checkBox1_position1_CheckedChanged); + // + // checkBox3_position3 + // + this.checkBox3_position3.AutoSize = true; + this.checkBox3_position3.Checked = true; + this.checkBox3_position3.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox3_position3.Location = new System.Drawing.Point(12, 56); + this.checkBox3_position3.Name = "checkBox3_position3"; + this.checkBox3_position3.Size = new System.Drawing.Size(115, 22); + this.checkBox3_position3.TabIndex = 19; + this.checkBox3_position3.Text = "位置3有料"; + this.checkBox3_position3.UseVisualStyleBackColor = true; + this.checkBox3_position3.CheckedChanged += new System.EventHandler(this.checkBox3_position3_CheckedChanged); + // + // checkBox2_position2 + // + this.checkBox2_position2.AutoSize = true; + this.checkBox2_position2.Checked = true; + this.checkBox2_position2.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox2_position2.Location = new System.Drawing.Point(133, 15); + this.checkBox2_position2.Name = "checkBox2_position2"; + this.checkBox2_position2.Size = new System.Drawing.Size(115, 22); + this.checkBox2_position2.TabIndex = 19; + this.checkBox2_position2.Text = "位置2有料"; + this.checkBox2_position2.UseVisualStyleBackColor = true; + this.checkBox2_position2.CheckedChanged += new System.EventHandler(this.checkBox2_position2_CheckedChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(57, 114); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(17, 18); + this.label1.TabIndex = 19; + this.label1.Text = "."; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(57, 253); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(17, 18); + this.label2.TabIndex = 19; + this.label2.Text = "."; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(361, 253); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(17, 18); + this.label3.TabIndex = 19; + this.label3.Text = "."; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(57, 394); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(17, 18); + this.label4.TabIndex = 19; + this.label4.Text = "."; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(361, 394); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(17, 18); + this.label5.TabIndex = 19; + this.label5.Text = "."; + // + // AgvTest + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(718, 465); + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.panel1); + this.Controls.Add(this.button5); + this.Controls.Add(this.button4); + this.Controls.Add(this.button3); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Name = "AgvTest"; + this.Text = "AGV调试"; + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.CheckBox checkBox1_position1; + private System.Windows.Forms.CheckBox checkBox2_position2; + private System.Windows.Forms.CheckBox checkBox3_position3; + private System.Windows.Forms.CheckBox checkBox4_position4; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/AgvTest.cs b/CCYQ_JieFang/OP/AgvTest.cs new file mode 100644 index 0000000..7a354ac --- /dev/null +++ b/CCYQ_JieFang/OP/AgvTest.cs @@ -0,0 +1,688 @@ +using MesWork; +using Newtonsoft.Json; +using Opc.Ua; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CCYQ_JieFang +{ + public partial class AgvTest : Form + { + string currentOpName; + public AgvTest(string opName) + { + currentOpName = opName; + InitializeComponent(); + InitPartInfo(); + } + + private void InitPartInfo() + { + if(publicCore.partCount == 1) + { + checkBox1_position1.Visible = true; + checkBox2_position2.Visible = false; + checkBox3_position3.Visible = false; + checkBox4_position4.Visible = false; + } + else if(publicCore.partCount == 2) + { + checkBox1_position1.Visible = true; + checkBox2_position2.Visible = true; + checkBox3_position3.Visible = false; + checkBox4_position4.Visible = false; + } + else if(publicCore.partCount == 3) + { + checkBox1_position1.Visible = true; + checkBox2_position2.Visible = true; + checkBox3_position3.Visible = true; + checkBox4_position4.Visible = false; + } + else if(publicCore.partCount == 4) + { + checkBox1_position1.Visible = true; + checkBox2_position2.Visible = true; + checkBox3_position3.Visible = true; + checkBox4_position4.Visible = true; + } + + + } + + private void button1_Click(object sender, EventArgs e) + { + label1.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_product", "Info", "正在发送请求,请稍后..."); + try + { + IPC_product iPC_product = new IPC_product(); + iPC_product.MsgId = AnalysisMsg.UuidUtil(); + iPC_product.Location = currentOpName; + iPC_product.MsgSource = 2; + iPC_product.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + iPC_product.AssemblyInformation = SolveProductCount(); + + //准备上传的数据 反序列化 + string bodydata = JsonConvert.SerializeObject(iPC_product); + + publicCore.LogInsert(currentOpName, "Info", bodydata); + + string urlstr = MesWorkForm.IPC_product; + string retString; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr); + request.Method = "post"; + byte[] bytes = Encoding.UTF8.GetBytes(bodydata); + request.Accept = "*/*"; + request.ContentType = "application/json;charset=utf-8"; + + // 反序列化后先把JSON做接口记录 + //存储日志 + int AID = -1; + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var reqParam = new SqlParameter[] { + new SqlParameter("@接口地址",urlstr), + new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",bodydata), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage); + if (reqDt.Rows.Count > 0) + { + AID = Convert.ToInt32(reqDt.Rows[0]["AID"]); + } + + request.ContentLength = bytes.Length; + + // 准备请求体 + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + //发送webapi请求 等待相应 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + retString = myStreamReader.ReadToEnd(); + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",retString) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + + // 序列化响应内容 + msgResHeader mrh = JsonConvert.DeserializeObject(retString); + int statusCode = (int)response.StatusCode; + // 对响应内容进行处理 更新数据库标志 + if (statusCode == 200) + { + myStreamReader.Close(); + myResponseStream.Close(); + label1.Text = "请求发送成功!详细信息查看日志"; + publicCore.LogInsert("IPC_product", "Info", "请求发送成功!详细信息查看日志"); + + if (response != null) + { + // 失败 + if (mrh.Code != "200") + { + publicCore.LogInsert(currentOpName, "Error", "接口【IPC-接收装配信息】失败!" + mrh.Message); + } + response.Close(); + } + if (request != null) + { + request.Abort(); + } + publicCore.LogInsert(currentOpName, "Info", retString); + } + else + { + label1.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_product", "Error", "接口【IPC-接收装配信息】失败!" + statusCode); + } + } + catch (Exception err) + { + publicCore.LogInsert("IPC_product", "Error", "接口【IPC-接收装配信息】失败!" + err.Message); + } + + } + + private void button2_Click(object sender, EventArgs e) + { + label2.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Info", "正在发送请求,请稍后..."); + try + { + IPC_RequestEnterOrLeave iPC_RequestEnterOrLeave = new IPC_RequestEnterOrLeave(); + iPC_RequestEnterOrLeave.MsgId = AnalysisMsg.UuidUtil(); + iPC_RequestEnterOrLeave.Location = currentOpName; + iPC_RequestEnterOrLeave.MsgSource = 2; + iPC_RequestEnterOrLeave.RequestType = 1; + iPC_RequestEnterOrLeave.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + //准备上传的数据 反序列化 + string bodydata = JsonConvert.SerializeObject(iPC_RequestEnterOrLeave); + + publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Info", bodydata); + + string urlstr = MesWorkForm.IPC_RequestEnterOrLeave; + string retString; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr); + request.Method = "post"; + byte[] bytes = Encoding.UTF8.GetBytes(bodydata); + request.Accept = "*/*"; + request.ContentType = "application/json;charset=utf-8"; + + // 反序列化后先把JSON做接口记录 + //存储日志 + int AID = -1; + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var reqParam = new SqlParameter[] { + new SqlParameter("@接口地址",urlstr), + new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",bodydata), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage); + if (reqDt.Rows.Count > 0) + { + AID = Convert.ToInt32(reqDt.Rows[0]["AID"]); + } + + request.ContentLength = bytes.Length; + + // 准备请求体 + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + //发送webapi请求 等待相应 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + retString = myStreamReader.ReadToEnd(); + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",retString) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + + // 序列化响应内容 + msgResHeader mrh = JsonConvert.DeserializeObject(retString); + int statusCode = (int)response.StatusCode; + // 对响应内容进行处理 更新数据库标志 + if (statusCode == 200) + { + myStreamReader.Close(); + myResponseStream.Close(); + label2.Text = "请求发送成功!详细信息查看日志"; + publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Info", "请求发送成功!详细信息查看日志"); + + if (response != null) + { + // 失败 + if (mrh.Code != "200") + { + publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Error", "接口【IPC-AGV请求进入/离开】失败!" + mrh.Message); + } + response.Close(); + } + if (request != null) + { + request.Abort(); + } + publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Info", retString); + } + else + { + label2.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_RequestEnterOrLeave_Enter", "Error", "接口【IPC-AGV请求进入/离开】失败!" + statusCode); + } + } + catch (Exception err) + { + publicCore.LogInsert(currentOpName, "Error", "接口【IPC-接收装配信息】失败!" + err.Message); + } + } + + private void button3_Click(object sender, EventArgs e) + { + label3.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Info", "正在发送请求,请稍后..."); + try + { + IPC_RequestEnterOrLeave iPC_RequestEnterOrLeave = new IPC_RequestEnterOrLeave(); + iPC_RequestEnterOrLeave.MsgId = AnalysisMsg.UuidUtil(); + iPC_RequestEnterOrLeave.Location = currentOpName; + iPC_RequestEnterOrLeave.MsgSource = 2; + iPC_RequestEnterOrLeave.RequestType = 2; + iPC_RequestEnterOrLeave.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + //准备上传的数据 反序列化 + string bodydata = JsonConvert.SerializeObject(iPC_RequestEnterOrLeave); + + publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Info", bodydata); + + string urlstr = MesWorkForm.IPC_RequestEnterOrLeave; + string retString; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr); + request.Method = "post"; + byte[] bytes = Encoding.UTF8.GetBytes(bodydata); + request.Accept = "*/*"; + request.ContentType = "application/json;charset=utf-8"; + + // 反序列化后先把JSON做接口记录 + //存储日志 + int AID = -1; + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var reqParam = new SqlParameter[] { + new SqlParameter("@接口地址",urlstr), + new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",bodydata), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage); + if (reqDt.Rows.Count > 0) + { + AID = Convert.ToInt32(reqDt.Rows[0]["AID"]); + } + + request.ContentLength = bytes.Length; + + // 准备请求体 + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + //发送webapi请求 等待相应 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + retString = myStreamReader.ReadToEnd(); + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",retString) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + + // 序列化响应内容 + msgResHeader mrh = JsonConvert.DeserializeObject(retString); + int statusCode = (int)response.StatusCode; + // 对响应内容进行处理 更新数据库标志 + if (statusCode == 200) + { + myStreamReader.Close(); + myResponseStream.Close(); + label3.Text = "请求发送成功!详细信息查看日志"; + publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Info", "请求发送成功!详细信息查看日志"); + + if (response != null) + { + // 失败 + if (mrh.Code != "200") + { + publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Error", "接口【IPC-AGV请求进入/离开】失败!" + mrh.Message); + } + response.Close(); + } + if (request != null) + { + request.Abort(); + } + publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Info", retString); + } + else + { + label3.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Error", "接口【IPC-AGV请求进入/离开】失败!" + statusCode); + } + } + catch (Exception err) + { + publicCore.LogInsert("IPC_RequestEnterOrLeave_Leave", "Error", "接口【IPC-AGV请求进入/离开】失败!" + err.Message); + } + } + + private void button4_Click(object sender, EventArgs e) + { + label4.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_WorkFinsih_Up", "Info", "正在发送请求,请稍后..."); + try + { + IPC_WorkFinsih iPC_WorkFinsih = new IPC_WorkFinsih(); + iPC_WorkFinsih.MsgId = AnalysisMsg.UuidUtil(); + iPC_WorkFinsih.Location = currentOpName; + iPC_WorkFinsih.MsgSource = 2; + iPC_WorkFinsih.FinishType = 1; + iPC_WorkFinsih.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + //准备上传的数据 反序列化 + string bodydata = JsonConvert.SerializeObject(iPC_WorkFinsih); + + publicCore.LogInsert("IPC_WorkFinsih_Up", "Info", bodydata); + + string urlstr = MesWorkForm.IPC_WorkFinsih; + string retString; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr); + request.Method = "post"; + byte[] bytes = Encoding.UTF8.GetBytes(bodydata); + request.Accept = "*/*"; + request.ContentType = "application/json;charset=utf-8"; + + // 反序列化后先把JSON做接口记录 + //存储日志 + int AID = -1; + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var reqParam = new SqlParameter[] { + new SqlParameter("@接口地址",urlstr), + new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",bodydata), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage); + if (reqDt.Rows.Count > 0) + { + AID = Convert.ToInt32(reqDt.Rows[0]["AID"]); + } + + request.ContentLength = bytes.Length; + + // 准备请求体 + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + //发送webapi请求 等待相应 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + retString = myStreamReader.ReadToEnd(); + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",retString) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + + // 序列化响应内容 + msgResHeader mrh = JsonConvert.DeserializeObject(retString); + int statusCode = (int)response.StatusCode; + // 对响应内容进行处理 更新数据库标志 + if (statusCode == 200) + { + myStreamReader.Close(); + myResponseStream.Close(); + label4.Text = "请求发送成功!详细信息查看日志"; + publicCore.LogInsert("IPC_WorkFinsih_Up", "Info", "请求发送成功!详细信息查看日志"); + + if (response != null) + { + // 失败 + if (mrh.Code != "200") + { + publicCore.LogInsert("IPC_WorkFinsih_Up", "Error", "接口【IPC-AGV上料完成离开】失败!" + mrh.Message); + } + response.Close(); + } + if (request != null) + { + request.Abort(); + } + publicCore.LogInsert("IPC_WorkFinsih_Up", "Info", retString); + } + else + { + label4.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_WorkFinsih_Up", "Error", "接口【IPC-AGV上料完成离开】失败!" + statusCode); + } + } + catch (Exception err) + { + publicCore.LogInsert("IPC_WorkFinsih_Up", "Error", "接口【IPC-AGV上料完成离开】失败!" + err.Message); + } + } + + private void button5_Click(object sender, EventArgs e) + { + label5.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_WorkFinsih_Down", "Info", "正在发送请求,请稍后..."); + try + { + IPC_WorkFinsih iPC_WorkFinsih = new IPC_WorkFinsih(); + iPC_WorkFinsih.MsgId = AnalysisMsg.UuidUtil(); + iPC_WorkFinsih.Location = currentOpName; + iPC_WorkFinsih.MsgSource = 2; + iPC_WorkFinsih.FinishType = 2; + iPC_WorkFinsih.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + //准备上传的数据 反序列化 + string bodydata = JsonConvert.SerializeObject(iPC_WorkFinsih); + + publicCore.LogInsert("IPC_WorkFinsih_Down", "Info", bodydata); + + string urlstr = MesWorkForm.IPC_WorkFinsih; + string retString; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr); + request.Method = "post"; + byte[] bytes = Encoding.UTF8.GetBytes(bodydata); + request.Accept = "*/*"; + request.ContentType = "application/json;charset=utf-8"; + + // 反序列化后先把JSON做接口记录 + //存储日志 + int AID = -1; + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var reqParam = new SqlParameter[] { + new SqlParameter("@接口地址",urlstr), + new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",bodydata), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage); + if (reqDt.Rows.Count > 0) + { + AID = Convert.ToInt32(reqDt.Rows[0]["AID"]); + } + + request.ContentLength = bytes.Length; + + // 准备请求体 + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + //发送webapi请求 等待相应 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + retString = myStreamReader.ReadToEnd(); + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",retString) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + + // 序列化响应内容 + msgResHeader mrh = JsonConvert.DeserializeObject(retString); + int statusCode = (int)response.StatusCode; + // 对响应内容进行处理 更新数据库标志 + if (statusCode == 200) + { + myStreamReader.Close(); + myResponseStream.Close(); + label5.Text = "请求发送成功!详细信息查看日志"; + publicCore.LogInsert("IPC_WorkFinsih_Down", "Info", "请求发送成功!详细信息查看日志"); + + if (response != null) + { + // 失败 + if (mrh.Code != "200") + { + publicCore.LogInsert("IPC_WorkFinsih_Down", "Error", "接口【IPC-AGV上料完成离开】失败!" + mrh.Message); + } + response.Close(); + } + if (request != null) + { + request.Abort(); + } + publicCore.LogInsert("IPC_WorkFinsih_Down", "Info", retString); + } + else + { + label4.Text = "正在发送请求,请稍后..."; + publicCore.LogInsert("IPC_WorkFinsih_Down", "Error", "接口【IPC-AGV上料完成离开】失败!" + statusCode); + } + } + catch (Exception err) + { + publicCore.LogInsert("IPC_WorkFinsih_Down", "Error", "接口【IPC-AGV上料完成离开】失败!" + err.Message); + } + } + + + + private List SolveProductCount() + { + List AssemblyInformation = new List(); + string currentTime = DateTime.Now.ToString("yyyyMMddHHmmss"); + if (publicCore.partCount == 1) + { + if(checkBox1_position1.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation1 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation1.productPosition = 1; + product_AssemblyInformation1.productNo = currentTime + "_part1"; + product_AssemblyInformation1.productName = "装配件01"; + AssemblyInformation.Add(product_AssemblyInformation1); + } + + + } + else if (publicCore.partCount == 2) + { + if (checkBox1_position1.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation1 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation1.productPosition = 1; + product_AssemblyInformation1.productNo = currentTime + "_part1"; + product_AssemblyInformation1.productName = "装配件01"; + AssemblyInformation.Add(product_AssemblyInformation1); + } + if (checkBox2_position2.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation2 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation2.productPosition = 2; + product_AssemblyInformation2.productNo = currentTime + "_part2"; + product_AssemblyInformation2.productName = "装配件02"; + AssemblyInformation.Add(product_AssemblyInformation2); + } + + } + else if (publicCore.partCount == 3) + { + if (checkBox1_position1.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation1 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation1.productPosition = 1; + product_AssemblyInformation1.productNo = currentTime + "_part1"; + product_AssemblyInformation1.productName = "装配件01"; + AssemblyInformation.Add(product_AssemblyInformation1); + } + if (checkBox2_position2.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation2 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation2.productPosition = 2; + product_AssemblyInformation2.productNo = currentTime + "_part2"; + product_AssemblyInformation2.productName = "装配件02"; + AssemblyInformation.Add(product_AssemblyInformation2); + } + if (checkBox3_position3.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation3 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation3.productPosition = 3; + product_AssemblyInformation3.productNo = currentTime + "_part3"; + product_AssemblyInformation3.productName = "装配件03"; + AssemblyInformation.Add(product_AssemblyInformation3); + } + } + else if (publicCore.partCount == 4) + { + if (checkBox1_position1.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation1 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation1.productPosition = 1; + product_AssemblyInformation1.productNo = currentTime + "_part1"; + product_AssemblyInformation1.productName = "装配件01"; + AssemblyInformation.Add(product_AssemblyInformation1); + } + if (checkBox2_position2.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation2 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation2.productPosition = 2; + product_AssemblyInformation2.productNo = currentTime + "_part2"; + product_AssemblyInformation2.productName = "装配件02"; + AssemblyInformation.Add(product_AssemblyInformation2); + } + if (checkBox3_position3.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation3 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation3.productPosition = 3; + product_AssemblyInformation3.productNo = currentTime + "_part3"; + product_AssemblyInformation3.productName = "装配件03"; + AssemblyInformation.Add(product_AssemblyInformation3); + } + if (checkBox4_position4.Checked) + { + IPC_product_AssemblyInformation product_AssemblyInformation4 = new IPC_product_AssemblyInformation(); + product_AssemblyInformation4.productPosition = 4; + product_AssemblyInformation4.productNo = currentTime + "_part4"; + product_AssemblyInformation4.productName = "装配件04"; + AssemblyInformation.Add(product_AssemblyInformation4); + } + } + return AssemblyInformation; + } + + private void checkBox1_position1_CheckedChanged(object sender, EventArgs e) + { + SolveProductCount(); + } + + private void checkBox2_position2_CheckedChanged(object sender, EventArgs e) + { + SolveProductCount(); + } + + private void checkBox3_position3_CheckedChanged(object sender, EventArgs e) + { + SolveProductCount(); + } + + private void checkBox4_position4_CheckedChanged(object sender, EventArgs e) + { + SolveProductCount(); + } + } +} diff --git a/CCYQ_JieFang/OP/AgvTest.resx b/CCYQ_JieFang/OP/AgvTest.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/CCYQ_JieFang/OP/AgvTest.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/MeasureRangeSet.Designer.cs b/CCYQ_JieFang/OP/MeasureRangeSet.Designer.cs new file mode 100644 index 0000000..57856fc --- /dev/null +++ b/CCYQ_JieFang/OP/MeasureRangeSet.Designer.cs @@ -0,0 +1,181 @@ +namespace CCYQ_JieFang +{ + partial class MeasureRangeSet + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1_search = new System.Windows.Forms.Button(); + this.dataGridView1_part = new System.Windows.Forms.DataGridView(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.工位号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.测量项目 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.测量位置 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.单位 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.上限值 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.下限值 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.label1 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1_part)).BeginInit(); + this.SuspendLayout(); + // + // button1_search + // + this.button1_search.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.button1_search.Location = new System.Drawing.Point(12, 10); + this.button1_search.Name = "button1_search"; + this.button1_search.Size = new System.Drawing.Size(75, 32); + this.button1_search.TabIndex = 6; + this.button1_search.Text = "查询"; + this.button1_search.UseVisualStyleBackColor = true; + this.button1_search.Click += new System.EventHandler(this.button1_search_Click); + // + // dataGridView1_part + // + this.dataGridView1_part.AllowUserToAddRows = false; + this.dataGridView1_part.AllowUserToDeleteRows = false; + this.dataGridView1_part.AllowUserToResizeRows = false; + this.dataGridView1_part.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1_part.ColumnHeadersHeight = 29; + this.dataGridView1_part.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.dataGridView1_part.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ID, + this.工位号, + this.测量项目, + this.测量位置, + this.单位, + this.上限值, + this.下限值}); + this.dataGridView1_part.Location = new System.Drawing.Point(12, 49); + this.dataGridView1_part.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.dataGridView1_part.Name = "dataGridView1_part"; + this.dataGridView1_part.RowHeadersVisible = false; + this.dataGridView1_part.RowHeadersWidth = 51; + this.dataGridView1_part.RowTemplate.Height = 27; + this.dataGridView1_part.Size = new System.Drawing.Size(1364, 604); + this.dataGridView1_part.TabIndex = 5; + this.dataGridView1_part.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dataGridView1_part_CellBeginEdit); + this.dataGridView1_part.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_part_CellEndEdit); + this.dataGridView1_part.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.dataGridView1_part_DataError); + // + // ID + // + this.ID.DataPropertyName = "Id"; + this.ID.HeaderText = "ID"; + this.ID.MinimumWidth = 6; + this.ID.Name = "ID"; + this.ID.ReadOnly = true; + this.ID.Width = 80; + // + // 工位号 + // + this.工位号.DataPropertyName = "工位号"; + this.工位号.HeaderText = "工位号"; + this.工位号.MinimumWidth = 6; + this.工位号.Name = "工位号"; + this.工位号.ReadOnly = true; + // + // 测量项目 + // + this.测量项目.DataPropertyName = "测量项目"; + this.测量项目.HeaderText = "测量项目"; + this.测量项目.MinimumWidth = 6; + this.测量项目.Name = "测量项目"; + this.测量项目.ReadOnly = true; + this.测量项目.Width = 150; + // + // 测量位置 + // + this.测量位置.DataPropertyName = "测量位置"; + this.测量位置.HeaderText = "测量位置"; + this.测量位置.MinimumWidth = 6; + this.测量位置.Name = "测量位置"; + this.测量位置.ReadOnly = true; + // + // 单位 + // + this.单位.DataPropertyName = "测量单位"; + this.单位.HeaderText = "单位"; + this.单位.MinimumWidth = 8; + this.单位.Name = "单位"; + this.单位.Width = 150; + // + // 上限值 + // + this.上限值.DataPropertyName = "上限值"; + this.上限值.HeaderText = "上限值"; + this.上限值.MinimumWidth = 8; + this.上限值.Name = "上限值"; + this.上限值.Width = 150; + // + // 下限值 + // + this.下限值.DataPropertyName = "下限值"; + this.下限值.HeaderText = "下限值"; + this.下限值.MinimumWidth = 8; + this.下限值.Name = "下限值"; + this.下限值.Width = 150; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(132, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(242, 18); + this.label1.TabIndex = 7; + this.label1.Text = "可调整单位、上限值、下限值"; + // + // MeasureRangeSet + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1388, 659); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1_search); + this.Controls.Add(this.dataGridView1_part); + this.Name = "MeasureRangeSet"; + this.Text = "测量数据设定"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1_part)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1_search; + private System.Windows.Forms.DataGridView dataGridView1_part; + private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn 工位号; + private System.Windows.Forms.DataGridViewTextBoxColumn 测量项目; + private System.Windows.Forms.DataGridViewTextBoxColumn 测量位置; + private System.Windows.Forms.DataGridViewTextBoxColumn 单位; + private System.Windows.Forms.DataGridViewTextBoxColumn 上限值; + private System.Windows.Forms.DataGridViewTextBoxColumn 下限值; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/MeasureRangeSet.cs b/CCYQ_JieFang/OP/MeasureRangeSet.cs new file mode 100644 index 0000000..cf126fd --- /dev/null +++ b/CCYQ_JieFang/OP/MeasureRangeSet.cs @@ -0,0 +1,121 @@ +using MesWork; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CCYQ_JieFang +{ + public partial class MeasureRangeSet : Form + { + string currentOpName; + object oldValue = null; + public MeasureRangeSet(string opName) + { + currentOpName = opName; + InitializeComponent(); + dataGridView1_part.AutoGenerateColumns = false; + SearchPartInit(currentOpName); + } + + private void button1_search_Click(object sender, EventArgs e) + { + SearchPartInit(Name); + } + + + + private void SearchPartInit(string opName) + { + try + { + SearchMeasureInfo(opName, out DataTable dt, out string errorMsg); + if (dt.Rows.Count > 0) + { + dataGridView1_part.DataSource = dt; + } + } + catch (Exception err) + { + + } + + } + private bool UpdateMeasureInfo(string ID, string upVlaue, string downVlaue, string unit, out string errorMsg) + { + string procedureName; + procedureName = "基础数据_质量数据_编辑"; + SqlParameter[] thisParms = new SqlParameter[4]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@ID", ID); + thisParms[1] = new System.Data.SqlClient.SqlParameter("@上限值", upVlaue); + thisParms[2] = new System.Data.SqlClient.SqlParameter("@下限值", downVlaue); + thisParms[3] = new System.Data.SqlClient.SqlParameter("@测量单位", unit); + return publicCore.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out errorMsg); + } + private bool SearchMeasureInfo(string opName, out DataTable dt, out string errorMsg) + { + string procedureName; + procedureName = "基础数据_质量数据_查询"; + SqlParameter[] thisParms = new SqlParameter[1]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); + return publicCore.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg); + } + + private void dataGridView1_part_CellEndEdit(object sender, DataGridViewCellEventArgs e) + { + object newValue = dataGridView1_part.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; + + if(oldValue != newValue) + { + try + { + string ID = GetDgvSVal(e, "ID"); + string upVlaue = GetDgvSVal(e, "上限值"); + string downVlaue = GetDgvSVal(e, "下限值"); + + if (Convert.ToDouble(upVlaue) < Convert.ToDouble(downVlaue)) + { + MessageBox.Show("上限值应大于下限值!"); + return; + } + + string unit = GetDgvSVal(e, "测量单位"); + if (UpdateMeasureInfo(ID, upVlaue, downVlaue, unit, out string errMsg)) + { + MessageBox.Show("设置成功!"); + } + else + { + MessageBox.Show("设置失败!"); + } + } + catch (Exception err) + { + MessageBox.Show("设置错误!"); + } + SearchPartInit(currentOpName); + } + + } + private string GetDgvSVal(DataGridViewCellEventArgs e, string cellName) + { + return ((DataTable)dataGridView1_part.DataSource).Rows[e.RowIndex][cellName].ToString(); + } + + private void dataGridView1_part_DataError(object sender, DataGridViewDataErrorEventArgs e) + { + MessageBox.Show(e.Exception.Message.ToString()); + } + + private void dataGridView1_part_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) + { + oldValue = dataGridView1_part.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; + } + } +} diff --git a/CCYQ_JieFang/OP/MeasureRangeSet.resx b/CCYQ_JieFang/OP/MeasureRangeSet.resx new file mode 100644 index 0000000..1716753 --- /dev/null +++ b/CCYQ_JieFang/OP/MeasureRangeSet.resx @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP10/DAS_OP10.Designer.cs b/CCYQ_JieFang/OP/OP10/DAS_OP10.Designer.cs new file mode 100644 index 0000000..591670a --- /dev/null +++ b/CCYQ_JieFang/OP/OP10/DAS_OP10.Designer.cs @@ -0,0 +1,1179 @@ +namespace MesWork +{ + partial class DAS_OP10: PlcLinkForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DAS_OP10)); + this.timHSCZ = new System.Windows.Forms.Timer(this.components); + this.label9 = new System.Windows.Forms.Label(); + this.timUI = new System.Windows.Forms.Timer(this.components); + this.labelTime = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.panel7 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.pictureBox12_end_9 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_9 = new System.Windows.Forms.PictureBox(); + this.textBox_MeasureValue_3 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_2 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_4 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_1 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_7 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_6 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_5 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_12 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_11 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_10 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_9 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_8 = new System.Windows.Forms.TextBox(); + this.pictureBox12_end_10 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_4 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_12 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_11 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_12 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_11 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_10 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_3 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_1 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_8 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_7 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_6 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_5 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_4 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_5 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_6 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_7 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_8 = new System.Windows.Forms.PictureBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.pictureBox2_start_3 = new System.Windows.Forms.PictureBox(); + this.label14 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.pictureBox2_start_1 = new System.Windows.Forms.PictureBox(); + this.label2 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label16 = new System.Windows.Forms.Label(); + this.button_running = new System.Windows.Forms.Button(); + this.button_alarm = new System.Windows.Forms.Button(); + this.button_finished = new System.Windows.Forms.Button(); + this.button_empty = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.label_AgvLeaved = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); + this.label_AgvCanLeave = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label_AgvRequestLeave = new System.Windows.Forms.Label(); + this.button5_heartBeat_Ning = new System.Windows.Forms.Button(); + this.button5_heartBeat = new System.Windows.Forms.Button(); + this.label_AgvCanEnter = new System.Windows.Forms.Label(); + this.textBox1_PartPosition = new System.Windows.Forms.TextBox(); + this.label_AgvSongliao = new System.Windows.Forms.Label(); + this.label_AgvRequestEnter = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.textBox1_EngineID = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panel7.SuspendLayout(); + this.panel3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_9)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_9)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_10)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_12)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_11)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_12)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_11)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_10)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // timHSCZ + // + this.timHSCZ.Enabled = true; + // + // label9 + // + this.label9.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.label9.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label9.Location = new System.Drawing.Point(-153, -198); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(771, 60); + this.label9.TabIndex = 22; + this.label9.Text = "微型减速机"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // timUI + // + this.timUI.Enabled = true; + // + // labelTime + // + this.labelTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F); + this.labelTime.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelTime.Location = new System.Drawing.Point(1010, -198); + this.labelTime.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.labelTime.Name = "labelTime"; + this.labelTime.Size = new System.Drawing.Size(728, 69); + this.labelTime.TabIndex = 23; + this.labelTime.Text = "2021-03-09 12:30:30"; + this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label18 + // + this.label18.BackColor = System.Drawing.Color.Transparent; + this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label18.Cursor = System.Windows.Forms.Cursors.Hand; + this.label18.Font = new System.Drawing.Font("微软雅黑", 10.5F); + this.label18.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label18.Location = new System.Drawing.Point(212, 212); + this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(104, 64); + this.label18.TabIndex = 1; + this.label18.Text = "查询"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label18.Visible = false; + // + // panel7 + // + this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.panel7.Controls.Add(this.label18); + this.panel7.Location = new System.Drawing.Point(-162, -134); + this.panel7.Margin = new System.Windows.Forms.Padding(4); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(1899, 82); + this.panel7.TabIndex = 24; + // + // panel3 + // + this.panel3.Controls.Add(this.pictureBox12_end_9); + this.panel3.Controls.Add(this.pictureBox2_start_9); + this.panel3.Controls.Add(this.textBox_MeasureValue_3); + this.panel3.Controls.Add(this.textBox_MeasureValue_2); + this.panel3.Controls.Add(this.textBox_MeasureValue_4); + this.panel3.Controls.Add(this.textBox_MeasureValue_1); + this.panel3.Controls.Add(this.textBox_MeasureValue_7); + this.panel3.Controls.Add(this.textBox_MeasureValue_6); + this.panel3.Controls.Add(this.textBox_MeasureValue_5); + this.panel3.Controls.Add(this.textBox_MeasureValue_12); + this.panel3.Controls.Add(this.textBox_MeasureValue_11); + this.panel3.Controls.Add(this.textBox_MeasureValue_10); + this.panel3.Controls.Add(this.textBox_MeasureValue_9); + this.panel3.Controls.Add(this.textBox_MeasureValue_8); + this.panel3.Controls.Add(this.pictureBox12_end_10); + this.panel3.Controls.Add(this.pictureBox12_end_4); + this.panel3.Controls.Add(this.pictureBox12_end_2); + this.panel3.Controls.Add(this.pictureBox12_end_12); + this.panel3.Controls.Add(this.pictureBox12_end_11); + this.panel3.Controls.Add(this.pictureBox2_start_2); + this.panel3.Controls.Add(this.pictureBox2_start_12); + this.panel3.Controls.Add(this.pictureBox2_start_11); + this.panel3.Controls.Add(this.pictureBox2_start_10); + this.panel3.Controls.Add(this.pictureBox12_end_3); + this.panel3.Controls.Add(this.pictureBox12_end_1); + this.panel3.Controls.Add(this.pictureBox12_end_8); + this.panel3.Controls.Add(this.pictureBox12_end_7); + this.panel3.Controls.Add(this.pictureBox12_end_6); + this.panel3.Controls.Add(this.pictureBox12_end_5); + this.panel3.Controls.Add(this.pictureBox2_start_4); + this.panel3.Controls.Add(this.pictureBox2_start_5); + this.panel3.Controls.Add(this.pictureBox2_start_6); + this.panel3.Controls.Add(this.pictureBox2_start_7); + this.panel3.Controls.Add(this.pictureBox2_start_8); + this.panel3.Controls.Add(this.label6); + this.panel3.Controls.Add(this.label4); + this.panel3.Controls.Add(this.label5); + this.panel3.Controls.Add(this.label10); + this.panel3.Controls.Add(this.pictureBox2_start_3); + this.panel3.Controls.Add(this.label14); + this.panel3.Controls.Add(this.label8); + this.panel3.Controls.Add(this.label13); + this.panel3.Controls.Add(this.label3); + this.panel3.Controls.Add(this.label12); + this.panel3.Controls.Add(this.label7); + this.panel3.Controls.Add(this.label11); + this.panel3.Controls.Add(this.pictureBox2_start_1); + this.panel3.Controls.Add(this.label2); + this.panel3.Controls.Add(this.pictureBox1); + this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel3.Location = new System.Drawing.Point(3, 93); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1989, 820); + this.panel3.TabIndex = 4; + // + // pictureBox12_end_9 + // + this.pictureBox12_end_9.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_9.Location = new System.Drawing.Point(1335, 544); + this.pictureBox12_end_9.Name = "pictureBox12_end_9"; + this.pictureBox12_end_9.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_9.TabIndex = 8; + this.pictureBox12_end_9.TabStop = false; + // + // pictureBox2_start_9 + // + this.pictureBox2_start_9.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_9.Location = new System.Drawing.Point(1335, 543); + this.pictureBox2_start_9.Name = "pictureBox2_start_9"; + this.pictureBox2_start_9.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_9.TabIndex = 8; + this.pictureBox2_start_9.TabStop = false; + // + // textBox_MeasureValue_3 + // + this.textBox_MeasureValue_3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_3.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_3.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_3.Location = new System.Drawing.Point(1738, 513); + this.textBox_MeasureValue_3.Name = "textBox_MeasureValue_3"; + this.textBox_MeasureValue_3.ReadOnly = true; + this.textBox_MeasureValue_3.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_3.TabIndex = 4; + this.textBox_MeasureValue_3.Text = "0"; + // + // textBox_MeasureValue_2 + // + this.textBox_MeasureValue_2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_2.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_2.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_2.Location = new System.Drawing.Point(280, 513); + this.textBox_MeasureValue_2.Name = "textBox_MeasureValue_2"; + this.textBox_MeasureValue_2.ReadOnly = true; + this.textBox_MeasureValue_2.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_2.TabIndex = 4; + this.textBox_MeasureValue_2.Text = "0"; + // + // textBox_MeasureValue_4 + // + this.textBox_MeasureValue_4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_4.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_4.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_4.Location = new System.Drawing.Point(280, 314); + this.textBox_MeasureValue_4.Name = "textBox_MeasureValue_4"; + this.textBox_MeasureValue_4.ReadOnly = true; + this.textBox_MeasureValue_4.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_4.TabIndex = 4; + this.textBox_MeasureValue_4.Text = "0"; + // + // textBox_MeasureValue_1 + // + this.textBox_MeasureValue_1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_1.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_1.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_1.Location = new System.Drawing.Point(1738, 314); + this.textBox_MeasureValue_1.Name = "textBox_MeasureValue_1"; + this.textBox_MeasureValue_1.ReadOnly = true; + this.textBox_MeasureValue_1.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_1.TabIndex = 4; + this.textBox_MeasureValue_1.Text = "0"; + // + // textBox_MeasureValue_7 + // + this.textBox_MeasureValue_7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_7.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_7.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_7.Location = new System.Drawing.Point(1118, 8); + this.textBox_MeasureValue_7.Name = "textBox_MeasureValue_7"; + this.textBox_MeasureValue_7.ReadOnly = true; + this.textBox_MeasureValue_7.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_7.TabIndex = 4; + this.textBox_MeasureValue_7.Text = "0"; + // + // textBox_MeasureValue_6 + // + this.textBox_MeasureValue_6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_6.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_6.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_6.Location = new System.Drawing.Point(903, 8); + this.textBox_MeasureValue_6.Name = "textBox_MeasureValue_6"; + this.textBox_MeasureValue_6.ReadOnly = true; + this.textBox_MeasureValue_6.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_6.TabIndex = 4; + this.textBox_MeasureValue_6.Text = "0"; + // + // textBox_MeasureValue_5 + // + this.textBox_MeasureValue_5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_5.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_5.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_5.Location = new System.Drawing.Point(692, 8); + this.textBox_MeasureValue_5.Name = "textBox_MeasureValue_5"; + this.textBox_MeasureValue_5.ReadOnly = true; + this.textBox_MeasureValue_5.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_5.TabIndex = 4; + this.textBox_MeasureValue_5.Text = "0"; + // + // textBox_MeasureValue_12 + // + this.textBox_MeasureValue_12.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_12.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_12.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_12.Location = new System.Drawing.Point(704, 771); + this.textBox_MeasureValue_12.Name = "textBox_MeasureValue_12"; + this.textBox_MeasureValue_12.ReadOnly = true; + this.textBox_MeasureValue_12.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_12.TabIndex = 4; + this.textBox_MeasureValue_12.Text = "0"; + // + // textBox_MeasureValue_11 + // + this.textBox_MeasureValue_11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_11.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_11.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_11.Location = new System.Drawing.Point(915, 771); + this.textBox_MeasureValue_11.Name = "textBox_MeasureValue_11"; + this.textBox_MeasureValue_11.ReadOnly = true; + this.textBox_MeasureValue_11.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_11.TabIndex = 4; + this.textBox_MeasureValue_11.Text = "0"; + // + // textBox_MeasureValue_10 + // + this.textBox_MeasureValue_10.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_10.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_10.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_10.Location = new System.Drawing.Point(1130, 771); + this.textBox_MeasureValue_10.Name = "textBox_MeasureValue_10"; + this.textBox_MeasureValue_10.ReadOnly = true; + this.textBox_MeasureValue_10.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_10.TabIndex = 4; + this.textBox_MeasureValue_10.Text = "0"; + // + // textBox_MeasureValue_9 + // + this.textBox_MeasureValue_9.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_9.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_9.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_9.Location = new System.Drawing.Point(1354, 771); + this.textBox_MeasureValue_9.Name = "textBox_MeasureValue_9"; + this.textBox_MeasureValue_9.ReadOnly = true; + this.textBox_MeasureValue_9.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_9.TabIndex = 4; + this.textBox_MeasureValue_9.Text = "0"; + // + // textBox_MeasureValue_8 + // + this.textBox_MeasureValue_8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_8.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_8.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_8.Location = new System.Drawing.Point(1342, 8); + this.textBox_MeasureValue_8.Name = "textBox_MeasureValue_8"; + this.textBox_MeasureValue_8.ReadOnly = true; + this.textBox_MeasureValue_8.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_8.TabIndex = 4; + this.textBox_MeasureValue_8.Text = "0"; + // + // pictureBox12_end_10 + // + this.pictureBox12_end_10.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_10.Location = new System.Drawing.Point(1184, 544); + this.pictureBox12_end_10.Name = "pictureBox12_end_10"; + this.pictureBox12_end_10.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_10.TabIndex = 8; + this.pictureBox12_end_10.TabStop = false; + // + // pictureBox12_end_4 + // + this.pictureBox12_end_4.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_4.Location = new System.Drawing.Point(574, 345); + this.pictureBox12_end_4.Name = "pictureBox12_end_4"; + this.pictureBox12_end_4.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_4.TabIndex = 8; + this.pictureBox12_end_4.TabStop = false; + // + // pictureBox12_end_2 + // + this.pictureBox12_end_2.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_2.Location = new System.Drawing.Point(574, 448); + this.pictureBox12_end_2.Name = "pictureBox12_end_2"; + this.pictureBox12_end_2.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_2.TabIndex = 8; + this.pictureBox12_end_2.TabStop = false; + // + // pictureBox12_end_12 + // + this.pictureBox12_end_12.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_12.Location = new System.Drawing.Point(740, 544); + this.pictureBox12_end_12.Name = "pictureBox12_end_12"; + this.pictureBox12_end_12.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_12.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_12.TabIndex = 8; + this.pictureBox12_end_12.TabStop = false; + // + // pictureBox12_end_11 + // + this.pictureBox12_end_11.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_11.Location = new System.Drawing.Point(969, 544); + this.pictureBox12_end_11.Name = "pictureBox12_end_11"; + this.pictureBox12_end_11.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_11.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_11.TabIndex = 8; + this.pictureBox12_end_11.TabStop = false; + // + // pictureBox2_start_2 + // + this.pictureBox2_start_2.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_2.Location = new System.Drawing.Point(576, 447); + this.pictureBox2_start_2.Name = "pictureBox2_start_2"; + this.pictureBox2_start_2.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_2.TabIndex = 8; + this.pictureBox2_start_2.TabStop = false; + // + // pictureBox2_start_12 + // + this.pictureBox2_start_12.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_12.Location = new System.Drawing.Point(740, 543); + this.pictureBox2_start_12.Name = "pictureBox2_start_12"; + this.pictureBox2_start_12.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_12.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_12.TabIndex = 8; + this.pictureBox2_start_12.TabStop = false; + // + // pictureBox2_start_11 + // + this.pictureBox2_start_11.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_11.Location = new System.Drawing.Point(969, 543); + this.pictureBox2_start_11.Name = "pictureBox2_start_11"; + this.pictureBox2_start_11.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_11.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_11.TabIndex = 8; + this.pictureBox2_start_11.TabStop = false; + // + // pictureBox2_start_10 + // + this.pictureBox2_start_10.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_10.Location = new System.Drawing.Point(1184, 543); + this.pictureBox2_start_10.Name = "pictureBox2_start_10"; + this.pictureBox2_start_10.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_10.TabIndex = 8; + this.pictureBox2_start_10.TabStop = false; + // + // pictureBox12_end_3 + // + this.pictureBox12_end_3.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_3.Location = new System.Drawing.Point(1503, 448); + this.pictureBox12_end_3.Name = "pictureBox12_end_3"; + this.pictureBox12_end_3.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_3.TabIndex = 8; + this.pictureBox12_end_3.TabStop = false; + // + // pictureBox12_end_1 + // + this.pictureBox12_end_1.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_1.Location = new System.Drawing.Point(1503, 345); + this.pictureBox12_end_1.Name = "pictureBox12_end_1"; + this.pictureBox12_end_1.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_1.TabIndex = 8; + this.pictureBox12_end_1.TabStop = false; + // + // pictureBox12_end_8 + // + this.pictureBox12_end_8.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_8.Location = new System.Drawing.Point(1335, 273); + this.pictureBox12_end_8.Name = "pictureBox12_end_8"; + this.pictureBox12_end_8.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_8.TabIndex = 8; + this.pictureBox12_end_8.TabStop = false; + // + // pictureBox12_end_7 + // + this.pictureBox12_end_7.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_7.Location = new System.Drawing.Point(1184, 273); + this.pictureBox12_end_7.Name = "pictureBox12_end_7"; + this.pictureBox12_end_7.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_7.TabIndex = 8; + this.pictureBox12_end_7.TabStop = false; + // + // pictureBox12_end_6 + // + this.pictureBox12_end_6.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_6.Location = new System.Drawing.Point(969, 273); + this.pictureBox12_end_6.Name = "pictureBox12_end_6"; + this.pictureBox12_end_6.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_6.TabIndex = 8; + this.pictureBox12_end_6.TabStop = false; + // + // pictureBox12_end_5 + // + this.pictureBox12_end_5.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_5.Location = new System.Drawing.Point(724, 273); + this.pictureBox12_end_5.Name = "pictureBox12_end_5"; + this.pictureBox12_end_5.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_5.TabIndex = 8; + this.pictureBox12_end_5.TabStop = false; + // + // pictureBox2_start_4 + // + this.pictureBox2_start_4.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_4.Location = new System.Drawing.Point(574, 344); + this.pictureBox2_start_4.Name = "pictureBox2_start_4"; + this.pictureBox2_start_4.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_4.TabIndex = 8; + this.pictureBox2_start_4.TabStop = false; + // + // pictureBox2_start_5 + // + this.pictureBox2_start_5.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_5.Location = new System.Drawing.Point(724, 273); + this.pictureBox2_start_5.Name = "pictureBox2_start_5"; + this.pictureBox2_start_5.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_5.TabIndex = 8; + this.pictureBox2_start_5.TabStop = false; + // + // pictureBox2_start_6 + // + this.pictureBox2_start_6.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_6.Location = new System.Drawing.Point(969, 273); + this.pictureBox2_start_6.Name = "pictureBox2_start_6"; + this.pictureBox2_start_6.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_6.TabIndex = 8; + this.pictureBox2_start_6.TabStop = false; + // + // pictureBox2_start_7 + // + this.pictureBox2_start_7.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_7.Location = new System.Drawing.Point(1184, 273); + this.pictureBox2_start_7.Name = "pictureBox2_start_7"; + this.pictureBox2_start_7.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_7.TabIndex = 8; + this.pictureBox2_start_7.TabStop = false; + // + // pictureBox2_start_8 + // + this.pictureBox2_start_8.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_8.Location = new System.Drawing.Point(1335, 273); + this.pictureBox2_start_8.Name = "pictureBox2_start_8"; + this.pictureBox2_start_8.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_8.TabIndex = 8; + this.pictureBox2_start_8.TabStop = false; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.BackColor = System.Drawing.Color.White; + this.label6.Font = new System.Drawing.Font("宋体", 15F); + this.label6.Location = new System.Drawing.Point(274, 480); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(73, 30); + this.label6.TabIndex = 6; + this.label6.Text = "扭矩"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.BackColor = System.Drawing.Color.White; + this.label4.Font = new System.Drawing.Font("宋体", 15F); + this.label4.Location = new System.Drawing.Point(1732, 480); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(73, 30); + this.label4.TabIndex = 6; + this.label4.Text = "扭矩"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.BackColor = System.Drawing.Color.White; + this.label5.Font = new System.Drawing.Font("宋体", 15F); + this.label5.Location = new System.Drawing.Point(274, 280); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(73, 30); + this.label5.TabIndex = 6; + this.label5.Text = "扭矩"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.BackColor = System.Drawing.Color.White; + this.label10.Font = new System.Drawing.Font("宋体", 15F); + this.label10.Location = new System.Drawing.Point(1038, 10); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(73, 30); + this.label10.TabIndex = 6; + this.label10.Text = "扭矩"; + // + // pictureBox2_start_3 + // + this.pictureBox2_start_3.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_3.Location = new System.Drawing.Point(1503, 447); + this.pictureBox2_start_3.Name = "pictureBox2_start_3"; + this.pictureBox2_start_3.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_3.TabIndex = 8; + this.pictureBox2_start_3.TabStop = false; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.BackColor = System.Drawing.Color.White; + this.label14.Font = new System.Drawing.Font("宋体", 15F); + this.label14.Location = new System.Drawing.Point(624, 777); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(73, 30); + this.label14.TabIndex = 6; + this.label14.Text = "扭矩"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.BackColor = System.Drawing.Color.White; + this.label8.Font = new System.Drawing.Font("宋体", 15F); + this.label8.Location = new System.Drawing.Point(824, 10); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(73, 30); + this.label8.TabIndex = 6; + this.label8.Text = "扭矩"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.BackColor = System.Drawing.Color.White; + this.label13.Font = new System.Drawing.Font("宋体", 15F); + this.label13.Location = new System.Drawing.Point(836, 777); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(73, 30); + this.label13.TabIndex = 6; + this.label13.Text = "扭矩"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.BackColor = System.Drawing.Color.White; + this.label3.Font = new System.Drawing.Font("宋体", 15F); + this.label3.Location = new System.Drawing.Point(1732, 280); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(73, 30); + this.label3.TabIndex = 6; + this.label3.Text = "扭矩"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.BackColor = System.Drawing.Color.White; + this.label12.Font = new System.Drawing.Font("宋体", 15F); + this.label12.Location = new System.Drawing.Point(1050, 777); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(73, 30); + this.label12.TabIndex = 6; + this.label12.Text = "扭矩"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.BackColor = System.Drawing.Color.White; + this.label7.Font = new System.Drawing.Font("宋体", 15F); + this.label7.Location = new System.Drawing.Point(612, 10); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(73, 30); + this.label7.TabIndex = 6; + this.label7.Text = "扭矩"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.BackColor = System.Drawing.Color.White; + this.label11.Font = new System.Drawing.Font("宋体", 15F); + this.label11.Location = new System.Drawing.Point(1275, 777); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(73, 30); + this.label11.TabIndex = 6; + this.label11.Text = "扭矩"; + // + // pictureBox2_start_1 + // + this.pictureBox2_start_1.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_1.Location = new System.Drawing.Point(1503, 344); + this.pictureBox2_start_1.Name = "pictureBox2_start_1"; + this.pictureBox2_start_1.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_1.TabIndex = 8; + this.pictureBox2_start_1.TabStop = false; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.White; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(1263, 14); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(73, 30); + this.label2.TabIndex = 6; + this.label2.Text = "扭矩"; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.White; + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox1.Image = global::CCYQ_JieFang.Properties.Resources._01_微型减速机; + this.pictureBox1.Location = new System.Drawing.Point(130, 16); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(1689, 748); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // panel1 + // + this.panel1.Controls.Add(this.label16); + this.panel1.Controls.Add(this.button_running); + this.panel1.Controls.Add(this.button_alarm); + this.panel1.Controls.Add(this.button_finished); + this.panel1.Controls.Add(this.button_empty); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 919); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(1989, 84); + this.panel1.TabIndex = 3; + // + // label16 + // + this.label16.BackColor = System.Drawing.Color.Black; + this.label16.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label16.Location = new System.Drawing.Point(0, 4); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(1980, 4); + this.label16.TabIndex = 10; + // + // button_running + // + this.button_running.BackColor = System.Drawing.Color.Gray; + this.button_running.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_running.Font = new System.Drawing.Font("宋体", 12F); + this.button_running.ForeColor = System.Drawing.Color.White; + this.button_running.Location = new System.Drawing.Point(38, 15); + this.button_running.Name = "button_running"; + this.button_running.Size = new System.Drawing.Size(333, 66); + this.button_running.TabIndex = 4; + this.button_running.Text = "设备运行(禁止上下料)"; + this.button_running.UseVisualStyleBackColor = false; + // + // button_alarm + // + this.button_alarm.BackColor = System.Drawing.Color.Gray; + this.button_alarm.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_alarm.Font = new System.Drawing.Font("宋体", 12F); + this.button_alarm.ForeColor = System.Drawing.Color.White; + this.button_alarm.Location = new System.Drawing.Point(1252, 16); + this.button_alarm.Name = "button_alarm"; + this.button_alarm.Size = new System.Drawing.Size(333, 66); + this.button_alarm.TabIndex = 5; + this.button_alarm.Text = "设备故障"; + this.button_alarm.UseVisualStyleBackColor = false; + // + // button_finished + // + this.button_finished.BackColor = System.Drawing.Color.Gray; + this.button_finished.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_finished.Font = new System.Drawing.Font("宋体", 12F); + this.button_finished.ForeColor = System.Drawing.Color.White; + this.button_finished.Location = new System.Drawing.Point(442, 15); + this.button_finished.Name = "button_finished"; + this.button_finished.Size = new System.Drawing.Size(333, 66); + this.button_finished.TabIndex = 6; + this.button_finished.Text = "完成装配(请求下料)"; + this.button_finished.UseVisualStyleBackColor = false; + // + // button_empty + // + this.button_empty.BackColor = System.Drawing.Color.Gray; + this.button_empty.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_empty.Font = new System.Drawing.Font("宋体", 12F); + this.button_empty.ForeColor = System.Drawing.Color.White; + this.button_empty.Location = new System.Drawing.Point(848, 16); + this.button_empty.Name = "button_empty"; + this.button_empty.Size = new System.Drawing.Size(333, 66); + this.button_empty.TabIndex = 7; + this.button_empty.Text = "设备空闲(请求上料)"; + this.button_empty.UseVisualStyleBackColor = false; + // + // panel2 + // + this.panel2.Controls.Add(this.label_AgvLeaved); + this.panel2.Controls.Add(this.label19); + this.panel2.Controls.Add(this.label_AgvCanLeave); + this.panel2.Controls.Add(this.label15); + this.panel2.Controls.Add(this.label_AgvRequestLeave); + this.panel2.Controls.Add(this.button5_heartBeat_Ning); + this.panel2.Controls.Add(this.button5_heartBeat); + this.panel2.Controls.Add(this.label_AgvCanEnter); + this.panel2.Controls.Add(this.textBox1_PartPosition); + this.panel2.Controls.Add(this.label_AgvSongliao); + this.panel2.Controls.Add(this.label_AgvRequestEnter); + this.panel2.Controls.Add(this.label17); + this.panel2.Controls.Add(this.textBox1_EngineID); + this.panel2.Controls.Add(this.label1); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(3, 3); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1989, 84); + this.panel2.TabIndex = 2; + // + // label_AgvLeaved + // + this.label_AgvLeaved.AutoSize = true; + this.label_AgvLeaved.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvLeaved.Location = new System.Drawing.Point(1393, 12); + this.label_AgvLeaved.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvLeaved.Name = "label_AgvLeaved"; + this.label_AgvLeaved.Size = new System.Drawing.Size(153, 22); + this.label_AgvLeaved.TabIndex = 9; + this.label_AgvLeaved.Text = "●AGV已经离开"; + // + // label19 + // + this.label19.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label19.Location = new System.Drawing.Point(1756, 16); + this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(2, 44); + this.label19.TabIndex = 9; + // + // label_AgvCanLeave + // + this.label_AgvCanLeave.AutoSize = true; + this.label_AgvCanLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanLeave.Location = new System.Drawing.Point(1225, 45); + this.label_AgvCanLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanLeave.Name = "label_AgvCanLeave"; + this.label_AgvCanLeave.Size = new System.Drawing.Size(153, 22); + this.label_AgvCanLeave.TabIndex = 9; + this.label_AgvCanLeave.Text = "●AGV可以离开"; + // + // label15 + // + this.label15.BackColor = System.Drawing.Color.Black; + this.label15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label15.Location = new System.Drawing.Point(0, 75); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(1980, 4); + this.label15.TabIndex = 9; + // + // label_AgvRequestLeave + // + this.label_AgvRequestLeave.AutoSize = true; + this.label_AgvRequestLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestLeave.Location = new System.Drawing.Point(1225, 12); + this.label_AgvRequestLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestLeave.Name = "label_AgvRequestLeave"; + this.label_AgvRequestLeave.Size = new System.Drawing.Size(153, 22); + this.label_AgvRequestLeave.TabIndex = 9; + this.label_AgvRequestLeave.Text = "●AGV请求离开"; + // + // button5_heartBeat_Ning + // + this.button5_heartBeat_Ning.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat_Ning.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat_Ning.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat_Ning.Location = new System.Drawing.Point(1765, 12); + this.button5_heartBeat_Ning.Name = "button5_heartBeat_Ning"; + this.button5_heartBeat_Ning.Size = new System.Drawing.Size(100, 52); + this.button5_heartBeat_Ning.TabIndex = 5; + this.button5_heartBeat_Ning.Text = "拧紧枪"; + this.button5_heartBeat_Ning.UseVisualStyleBackColor = false; + // + // button5_heartBeat + // + this.button5_heartBeat.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat.Location = new System.Drawing.Point(1883, 12); + this.button5_heartBeat.Name = "button5_heartBeat"; + this.button5_heartBeat.Size = new System.Drawing.Size(100, 52); + this.button5_heartBeat.TabIndex = 5; + this.button5_heartBeat.Text = "PLC"; + this.button5_heartBeat.UseVisualStyleBackColor = false; + // + // label_AgvCanEnter + // + this.label_AgvCanEnter.AutoSize = true; + this.label_AgvCanEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanEnter.Location = new System.Drawing.Point(1043, 45); + this.label_AgvCanEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanEnter.Name = "label_AgvCanEnter"; + this.label_AgvCanEnter.Size = new System.Drawing.Size(153, 22); + this.label_AgvCanEnter.TabIndex = 9; + this.label_AgvCanEnter.Text = "●AGV可以进入"; + // + // textBox1_PartPosition + // + this.textBox1_PartPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_PartPosition.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_PartPosition.Location = new System.Drawing.Point(692, 9); + this.textBox1_PartPosition.Name = "textBox1_PartPosition"; + this.textBox1_PartPosition.ReadOnly = true; + this.textBox1_PartPosition.Size = new System.Drawing.Size(118, 53); + this.textBox1_PartPosition.TabIndex = 1; + // + // label_AgvSongliao + // + this.label_AgvSongliao.AutoSize = true; + this.label_AgvSongliao.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvSongliao.Location = new System.Drawing.Point(883, 14); + this.label_AgvSongliao.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvSongliao.Name = "label_AgvSongliao"; + this.label_AgvSongliao.Size = new System.Drawing.Size(153, 22); + this.label_AgvSongliao.TabIndex = 9; + this.label_AgvSongliao.Text = "●AGV准备送料"; + // + // label_AgvRequestEnter + // + this.label_AgvRequestEnter.AutoSize = true; + this.label_AgvRequestEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestEnter.Location = new System.Drawing.Point(1043, 12); + this.label_AgvRequestEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestEnter.Name = "label_AgvRequestEnter"; + this.label_AgvRequestEnter.Size = new System.Drawing.Size(153, 22); + this.label_AgvRequestEnter.TabIndex = 9; + this.label_AgvRequestEnter.Text = "●AGV请求进入"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Font = new System.Drawing.Font("宋体", 16F); + this.label17.Location = new System.Drawing.Point(525, 18); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(175, 33); + this.label17.TabIndex = 0; + this.label17.Text = "装配位置:"; + // + // textBox1_EngineID + // + this.textBox1_EngineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_EngineID.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_EngineID.Location = new System.Drawing.Point(170, 10); + this.textBox1_EngineID.Name = "textBox1_EngineID"; + this.textBox1_EngineID.ReadOnly = true; + this.textBox1_EngineID.Size = new System.Drawing.Size(348, 53); + this.textBox1_EngineID.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 16F); + this.label1.Location = new System.Drawing.Point(3, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(175, 33); + this.label1.TabIndex = 0; + this.label1.Text = "产品编码:"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1995, 1006); + this.tableLayoutPanel1.TabIndex = 25; + // + // DAS_OP10 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1995, 1006); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.label9); + this.Controls.Add(this.labelTime); + this.Controls.Add(this.panel7); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DAS_OP10"; + this.Text = "OP10工位-微型减速机"; + this.panel7.ResumeLayout(false); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_9)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_9)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_10)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_12)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_11)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_12)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_11)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_10)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.panel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Timer timHSCZ; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Timer timUI; + private System.Windows.Forms.Label labelTime; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Panel panel7; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.PictureBox pictureBox12_end_9; + private System.Windows.Forms.PictureBox pictureBox2_start_9; + private System.Windows.Forms.TextBox textBox_MeasureValue_3; + private System.Windows.Forms.TextBox textBox_MeasureValue_2; + private System.Windows.Forms.TextBox textBox_MeasureValue_4; + private System.Windows.Forms.TextBox textBox_MeasureValue_1; + private System.Windows.Forms.TextBox textBox_MeasureValue_7; + private System.Windows.Forms.TextBox textBox_MeasureValue_6; + private System.Windows.Forms.TextBox textBox_MeasureValue_5; + private System.Windows.Forms.TextBox textBox_MeasureValue_12; + private System.Windows.Forms.TextBox textBox_MeasureValue_11; + private System.Windows.Forms.TextBox textBox_MeasureValue_10; + private System.Windows.Forms.TextBox textBox_MeasureValue_9; + private System.Windows.Forms.TextBox textBox_MeasureValue_8; + private System.Windows.Forms.PictureBox pictureBox12_end_10; + private System.Windows.Forms.PictureBox pictureBox12_end_4; + private System.Windows.Forms.PictureBox pictureBox12_end_2; + private System.Windows.Forms.PictureBox pictureBox12_end_12; + private System.Windows.Forms.PictureBox pictureBox12_end_11; + private System.Windows.Forms.PictureBox pictureBox2_start_2; + private System.Windows.Forms.PictureBox pictureBox2_start_12; + private System.Windows.Forms.PictureBox pictureBox2_start_11; + private System.Windows.Forms.PictureBox pictureBox2_start_10; + private System.Windows.Forms.PictureBox pictureBox12_end_3; + private System.Windows.Forms.PictureBox pictureBox12_end_1; + private System.Windows.Forms.PictureBox pictureBox12_end_8; + private System.Windows.Forms.PictureBox pictureBox12_end_7; + private System.Windows.Forms.PictureBox pictureBox12_end_6; + private System.Windows.Forms.PictureBox pictureBox12_end_5; + private System.Windows.Forms.PictureBox pictureBox2_start_4; + private System.Windows.Forms.PictureBox pictureBox2_start_5; + private System.Windows.Forms.PictureBox pictureBox2_start_6; + private System.Windows.Forms.PictureBox pictureBox2_start_7; + private System.Windows.Forms.PictureBox pictureBox2_start_8; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.PictureBox pictureBox2_start_3; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.PictureBox pictureBox2_start_1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Button button_running; + private System.Windows.Forms.Button button_alarm; + private System.Windows.Forms.Button button_finished; + private System.Windows.Forms.Button button_empty; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label_AgvLeaved; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label_AgvCanLeave; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label_AgvRequestLeave; + private System.Windows.Forms.Button button5_heartBeat; + private System.Windows.Forms.Label label_AgvCanEnter; + private System.Windows.Forms.TextBox textBox1_PartPosition; + private System.Windows.Forms.Label label_AgvRequestEnter; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.TextBox textBox1_EngineID; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label_AgvSongliao; + private System.Windows.Forms.Button button5_heartBeat_Ning; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP10/DAS_OP10.cs b/CCYQ_JieFang/OP/OP10/DAS_OP10.cs new file mode 100644 index 0000000..d288a43 --- /dev/null +++ b/CCYQ_JieFang/OP/OP10/DAS_OP10.cs @@ -0,0 +1,654 @@ + +using DK_DC_Tool; +using HslCommunication.Core; +using Newtonsoft.Json; +using NPOI.SS.UserModel; +using OpcBasic; +using Robot.Common; +using Serilog.Events; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using SystemFramework; + +namespace MesWork +{ + public partial class DAS_OP10 + { + InitServer initServer = null; + /// + /// + /// + private static string OpNameCurrent = ""; + /// + /// 字典 ,存储12个开始测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicStartMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicEndMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量文本框控件,key为测量位置,value文本框的值 + /// + Dictionary dicMeasureTextBox = new Dictionary(); + /// + /// PLC事件变化委托 + /// + public static Action MIS_Funtion_PLC_OP = null; + + /// + /// PLC事件变化委托 + /// + public static Action AGV_Task_change = null; + /// + /// PLC事件变化委托--处理托盘信息 + /// + public static Action AGV_Task_Info = null; + + // 每个工位的满工件数量 + // 工位OP10 2个 + public static int partCount = 2; + + public static bool isConnect = false; + + public DAS_OP10(string opName) + { + InitializeComponent(); + + publicCore.partCount = partCount; + OpNameCurrent = opName; + + Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang; + Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang; + + MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking; + MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking; + + MIS_Funtion_PLC_OP -= MIS_Funtion_PLC; + MIS_Funtion_PLC_OP += MIS_Funtion_PLC; + + AGV_Task_change -= SolveAgvDeviceStatus; + AGV_Task_change += SolveAgvDeviceStatus; + + + if (MesWorkForm.IsDemoMesServer == 1) + { + MoNiHeartBeat(); + } + SolvePicAndMeasureValueInit(); + + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + } + catch (Exception err) { } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + + //var aa = + //new Thread(new ThreadStart(delegate () { + // while (true) + // { + // try + // { + // if (!isConnect) + // { + // if (publicCore.Get_PartPosition(OpNameCurrent) != -1) + // { + // isConnect = true; + // ProductInfo_search(); + // } + // } + // } + // catch (Exception err) { } + // Thread.Sleep(1000); + // } + //})); + //aa.IsBackground = true; + //aa.Start(); + + } + public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent) + { + try + { + var tagID = msgEvent.TagID.ToString(); + // var opName = msgEvent.OpName.ToString(); + var tagTypeCodeID = (int)msgEvent.TagTypeCodeID; + var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID; + string tagValue; + switch (tagTypeID) + { + case EnumTagTypeID.BOOL: + tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString(); + break; + default: + tagValue = msgEvent.TagValue.ToString(); + break; + } + switch (tagTypeCodeID) + { + case 14: + DeviceHeartBeat(tagValue); + break; + // AGV任务 + case 50: + publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue); + break; + // 51 空闲(请求上料) + // 52 完成(请求下料) + // 53 故障 + case 51: + case 52: + case 53: + publicCore.SolveDeviceStatus(OpNameCurrent); + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + break; + // 54 第几个件 + case 54: + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + case 55: + publicCore.MeasurePositionChange(OpNameCurrent, 2); + SolvePicAndMeasureValueWorking(); + break; + //读电批 + case 56: + if (tagValue == "1") + { + publicCore.LogInsert("OP10", "Info", "【PLC_读电批置位】"); + // 不在这个地方写true,写在接收数据的地方写 + + } + else + { + publicCore.LogInsert("OP10", "Info", "【PLC_读电批复位】"); + MesWorkForm.WritePLC(83, OpNameCurrent, false); + publicCore.LogInsert("OP10", "Info", "【IPC_读电批完成复位】"); + } + break; + //读泄漏量1 2或者压力 + case 59: + if (tagValue == "1") + { + //publicCore.ReadQualityData_LeakageRate(OpNameCurrent); + //publicCore.ReadQualityData_Pressure(OpNameCurrent); + MesWorkForm.WritePLC(84, OpNameCurrent, true); + } + else + { + MesWorkForm.WritePLC(84, OpNameCurrent, false); + } + break; + } + } + catch (Exception ex) + { + } + } + /// + /// 初始化界面显示 + /// + private void SolvePicAndMeasureValueInit() + { + try + { + dicStartMasurePictureBox.Add(1, pictureBox2_start_1); + dicStartMasurePictureBox.Add(2, pictureBox2_start_2); + dicStartMasurePictureBox.Add(3, pictureBox2_start_3); + dicStartMasurePictureBox.Add(4, pictureBox2_start_4); + dicStartMasurePictureBox.Add(5, pictureBox2_start_5); + dicStartMasurePictureBox.Add(6, pictureBox2_start_6); + dicStartMasurePictureBox.Add(7, pictureBox2_start_7); + dicStartMasurePictureBox.Add(8, pictureBox2_start_8); + dicStartMasurePictureBox.Add(9, pictureBox2_start_9); + dicStartMasurePictureBox.Add(10, pictureBox2_start_10); + dicStartMasurePictureBox.Add(11, pictureBox2_start_11); + dicStartMasurePictureBox.Add(12, pictureBox2_start_12); + + dicEndMasurePictureBox.Add(1, pictureBox12_end_1); + dicEndMasurePictureBox.Add(2, pictureBox12_end_2); + dicEndMasurePictureBox.Add(3, pictureBox12_end_3); + dicEndMasurePictureBox.Add(4, pictureBox12_end_4); + dicEndMasurePictureBox.Add(5, pictureBox12_end_5); + dicEndMasurePictureBox.Add(6, pictureBox12_end_6); + dicEndMasurePictureBox.Add(7, pictureBox12_end_7); + dicEndMasurePictureBox.Add(8, pictureBox12_end_8); + dicEndMasurePictureBox.Add(9, pictureBox12_end_9); + dicEndMasurePictureBox.Add(10, pictureBox12_end_10); + dicEndMasurePictureBox.Add(11, pictureBox12_end_11); + dicEndMasurePictureBox.Add(12, pictureBox12_end_12); + + dicMeasureTextBox.Add(1, textBox_MeasureValue_1); + dicMeasureTextBox.Add(2, textBox_MeasureValue_2); + dicMeasureTextBox.Add(3, textBox_MeasureValue_3); + dicMeasureTextBox.Add(4, textBox_MeasureValue_4); + dicMeasureTextBox.Add(5, textBox_MeasureValue_5); + dicMeasureTextBox.Add(6, textBox_MeasureValue_6); + dicMeasureTextBox.Add(7, textBox_MeasureValue_7); + dicMeasureTextBox.Add(8, textBox_MeasureValue_8); + dicMeasureTextBox.Add(9, textBox_MeasureValue_9); + dicMeasureTextBox.Add(10, textBox_MeasureValue_10); + dicMeasureTextBox.Add(11, textBox_MeasureValue_11); + dicMeasureTextBox.Add(12, textBox_MeasureValue_12); + + + foreach (var item in dicStartMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicEndMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicMeasureTextBox) + { + item.Value.Text = ""; + } + + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "1") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 工作时界面显示 + /// + private void SolvePicAndMeasureValueWorking() + { + try + { + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "2") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 界面产品编码和装配位置的显示 + /// + public void ProductInfo_search() + { + try + { + //textBox1_EngineID.Text = ""; + //textBox1_PartPosition.Text = ""; + ShowTextBoxControl(textBox1_EngineID, "", Color.White); + ShowTextBoxControl(textBox1_PartPosition, "", Color.White); + int PartPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White); + ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White); + //textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString(); + //textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString(); + } + } + catch (Exception err) + { + } + } + private void ShowPicBoxControl(Control c, bool ststus) + { + c.BeginInvoke(new Action(delegate () { + c.Visible = ststus; + })); + } + private void ShowTextBoxControl(Control c, string value, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.Text = value; + c.BackColor = color; + })); + } + private void ShowLabelControl(Control c, Color color) + { + //if (c.InvokeRequired) + //{ + + //} + //else + //{ + // c.ForeColor = color; + //} + c.BeginInvoke(new Action(delegate () { + c.ForeColor = color; + })); + } + private void ShowButtonControl(Control c, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.BackColor = color; + })); + } + + + /// + /// 初始化设备状态 + /// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警 + /// + private void SolveDeviceStatusInit(string currentStatus) + { + try + { + ShowButtonControl(button_running, Color.Gray); + ShowButtonControl(button_finished, Color.Gray); + ShowButtonControl(button_empty, Color.Gray); + ShowButtonControl(button_alarm, Color.Gray); + //button_running.BackColor = Color.Gray; + //button_finished.BackColor = Color.Gray; + //button_empty.BackColor = Color.Gray; + //button_alarm.BackColor = Color.Gray; + + if (currentStatus == "1") + { + ShowButtonControl(button_running, Color.Green); + //button_running.BackColor = Color.Green; + } + else if (currentStatus == "2") + { + ShowButtonControl(button_empty, Color.SkyBlue); + + //button_empty.BackColor = Color.SkyBlue; + } + else if (currentStatus == "3") + { + ShowButtonControl(button_finished, Color.DarkOrange); + + //button_finished.BackColor = Color.DarkOrange; + } + else if (currentStatus == "4") + { + ShowButtonControl(button_alarm, Color.Red); + + //button_alarm.BackColor = Color.Red; + } + } + catch (Exception err) + { + + } + } + /// + /// AGV设备状态显示 + /// + /// + private void SolveAgvDeviceStatus(string PLC_AgvTaskNum) + { + try + { + // 77 反馈AGV任务 + switch (PLC_AgvTaskNum) + { + case "10": + // AGV触发装配任务 正在送料 + //label_AgvSongliao.ForeColor = Color.Green; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Black; + + ShowLabelControl(label_AgvSongliao, Color.Green); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Black); + + + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + + break; + case "11": + + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + + //label_AgvRequestEnter.ForeColor = Color.Green; + //label_AgvRequestLeave.ForeColor = Color.Black; + break; + // 允许AGV进行上料 --允许进入 + // 允许AGV进行下料 --允许进入 + case "2": + case "4": + ShowLabelControl(label_AgvCanEnter, Color.Green); + ShowLabelControl(label_AgvCanLeave, Color.Black); + //label_AgvCanEnter.ForeColor = Color.Green; + //label_AgvCanLeave.ForeColor = Color.Black; + break; + case "21": + // AGV 上料完成 + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Green; + break; + case "3": + // 1.调用FSS-接收IPC下料请求的接口 + // 2.反馈任务号:30 AGV已呼叫成功正在去往下料区 + break; + case "31": + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Green); + //label_AgvRequestEnter.ForeColor = Color.Black; + //label_AgvRequestLeave.ForeColor = Color.Green; + // AGV已到达下料区 + break; + case "41": + // AGV下料完成 + break; + // 允许AGV离开 + case "5": + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Green); + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Green; + break; + case "51": + //label_AgvSongliao.ForeColor = Color.Black; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Green; + ShowLabelControl(label_AgvSongliao, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Green); + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + } + + + } + catch (Exception err) + { + } + } + + /// + /// 设备PLC心跳button5_heartBeat_Ning + /// + /// + private void DeviceHeartBeat(string tagValue) + { + WritePLC(15, OpNameCurrent, tagValue); + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat, Color.Green); + + //button5_heartBeat.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat, Color.Gray); + + //button5_heartBeat.BackColor = Color.Gray; + } + } + /// + /// 设备PLC心跳 + /// + /// + private void DeviceHeartBeat_NingJinQiang(string tagValue) + { + if (tagValue != "0") + { + ShowButtonControl(button5_heartBeat_Ning, Color.Green); + + //button5_heartBeat_Ning.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat_Ning, Color.Red); + + //button5_heartBeat_Ning.BackColor = Color.Red; + } + } + + + + private void MoNiHeartBeat() + { + bool tv = false; + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + WritePLC(14, OpNameCurrent, tv); + tv = !tv; + } + catch (Exception err) { } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + } + + private void label5_Click(object sender, EventArgs e) + { + + } + + private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/CCYQ_JieFang/OP/OP10/DAS_OP10.resx b/CCYQ_JieFang/OP/OP10/DAS_OP10.resx new file mode 100644 index 0000000..55f2584 --- /dev/null +++ b/CCYQ_JieFang/OP/OP10/DAS_OP10.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 432, 221 + + + 573, 221 + + + 33 + + + + + AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz + UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC + QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm + Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX + dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT + PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0 + F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd + 0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI + Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg + gg== + + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP20/DAS_OP20.Designer.cs b/CCYQ_JieFang/OP/OP20/DAS_OP20.Designer.cs new file mode 100644 index 0000000..daf1429 --- /dev/null +++ b/CCYQ_JieFang/OP/OP20/DAS_OP20.Designer.cs @@ -0,0 +1,1064 @@ +namespace MesWork +{ + partial class DAS_OP20: PlcLinkForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DAS_OP20)); + this.timHSCZ = new System.Windows.Forms.Timer(this.components); + this.label9 = new System.Windows.Forms.Label(); + this.timUI = new System.Windows.Forms.Timer(this.components); + this.labelTime = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.panel7 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.pictureBox12_end_9 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_9 = new System.Windows.Forms.PictureBox(); + this.textBox_MeasureValue_3 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_2 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_4 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_1 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_7 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_6 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_5 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_10 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_9 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_8 = new System.Windows.Forms.TextBox(); + this.pictureBox12_end_10 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_4 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_10 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_3 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_1 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_8 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_7 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_6 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_5 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_4 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_5 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_6 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_7 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_8 = new System.Windows.Forms.PictureBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.pictureBox2_start_3 = new System.Windows.Forms.PictureBox(); + this.label8 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.pictureBox2_start_1 = new System.Windows.Forms.PictureBox(); + this.label2 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label16 = new System.Windows.Forms.Label(); + this.button_running = new System.Windows.Forms.Button(); + this.button_alarm = new System.Windows.Forms.Button(); + this.button_finished = new System.Windows.Forms.Button(); + this.button_empty = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.label_AgvLeaved = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); + this.label_AgvCanLeave = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label_AgvRequestLeave = new System.Windows.Forms.Label(); + this.button5_heartBeat_Ning = new System.Windows.Forms.Button(); + this.button5_heartBeat = new System.Windows.Forms.Button(); + this.label_AgvCanEnter = new System.Windows.Forms.Label(); + this.textBox1_PartPosition = new System.Windows.Forms.TextBox(); + this.label_AgvSongliao = new System.Windows.Forms.Label(); + this.label_AgvRequestEnter = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.textBox1_EngineID = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panel7.SuspendLayout(); + this.panel3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_9)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_9)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_10)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_10)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // timHSCZ + // + this.timHSCZ.Enabled = true; + // + // label9 + // + this.label9.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.label9.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label9.Location = new System.Drawing.Point(-153, -198); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(771, 60); + this.label9.TabIndex = 22; + this.label9.Text = "微型减速机"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // timUI + // + this.timUI.Enabled = true; + // + // labelTime + // + this.labelTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F); + this.labelTime.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelTime.Location = new System.Drawing.Point(1010, -198); + this.labelTime.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.labelTime.Name = "labelTime"; + this.labelTime.Size = new System.Drawing.Size(728, 69); + this.labelTime.TabIndex = 23; + this.labelTime.Text = "2021-03-09 12:30:30"; + this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label18 + // + this.label18.BackColor = System.Drawing.Color.Transparent; + this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label18.Cursor = System.Windows.Forms.Cursors.Hand; + this.label18.Font = new System.Drawing.Font("微软雅黑", 10.5F); + this.label18.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label18.Location = new System.Drawing.Point(212, 212); + this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(104, 64); + this.label18.TabIndex = 1; + this.label18.Text = "查询"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label18.Visible = false; + // + // panel7 + // + this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.panel7.Controls.Add(this.label18); + this.panel7.Location = new System.Drawing.Point(-162, -134); + this.panel7.Margin = new System.Windows.Forms.Padding(4); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(1899, 82); + this.panel7.TabIndex = 24; + // + // panel3 + // + this.panel3.Controls.Add(this.pictureBox12_end_9); + this.panel3.Controls.Add(this.pictureBox2_start_9); + this.panel3.Controls.Add(this.textBox_MeasureValue_3); + this.panel3.Controls.Add(this.textBox_MeasureValue_2); + this.panel3.Controls.Add(this.textBox_MeasureValue_4); + this.panel3.Controls.Add(this.textBox_MeasureValue_1); + this.panel3.Controls.Add(this.textBox_MeasureValue_7); + this.panel3.Controls.Add(this.textBox_MeasureValue_6); + this.panel3.Controls.Add(this.textBox_MeasureValue_5); + this.panel3.Controls.Add(this.textBox_MeasureValue_10); + this.panel3.Controls.Add(this.textBox_MeasureValue_9); + this.panel3.Controls.Add(this.textBox_MeasureValue_8); + this.panel3.Controls.Add(this.pictureBox12_end_10); + this.panel3.Controls.Add(this.pictureBox12_end_4); + this.panel3.Controls.Add(this.pictureBox12_end_2); + this.panel3.Controls.Add(this.pictureBox2_start_2); + this.panel3.Controls.Add(this.pictureBox2_start_10); + this.panel3.Controls.Add(this.pictureBox12_end_3); + this.panel3.Controls.Add(this.pictureBox12_end_1); + this.panel3.Controls.Add(this.pictureBox12_end_8); + this.panel3.Controls.Add(this.pictureBox12_end_7); + this.panel3.Controls.Add(this.pictureBox12_end_6); + this.panel3.Controls.Add(this.pictureBox12_end_5); + this.panel3.Controls.Add(this.pictureBox2_start_4); + this.panel3.Controls.Add(this.pictureBox2_start_5); + this.panel3.Controls.Add(this.pictureBox2_start_6); + this.panel3.Controls.Add(this.pictureBox2_start_7); + this.panel3.Controls.Add(this.pictureBox2_start_8); + this.panel3.Controls.Add(this.label6); + this.panel3.Controls.Add(this.label4); + this.panel3.Controls.Add(this.label5); + this.panel3.Controls.Add(this.label10); + this.panel3.Controls.Add(this.pictureBox2_start_3); + this.panel3.Controls.Add(this.label8); + this.panel3.Controls.Add(this.label3); + this.panel3.Controls.Add(this.label12); + this.panel3.Controls.Add(this.label7); + this.panel3.Controls.Add(this.label11); + this.panel3.Controls.Add(this.pictureBox2_start_1); + this.panel3.Controls.Add(this.label2); + this.panel3.Controls.Add(this.pictureBox1); + this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel3.Location = new System.Drawing.Point(3, 93); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1989, 820); + this.panel3.TabIndex = 4; + // + // pictureBox12_end_9 + // + this.pictureBox12_end_9.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_9.Location = new System.Drawing.Point(1284, 126); + this.pictureBox12_end_9.Name = "pictureBox12_end_9"; + this.pictureBox12_end_9.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_9.TabIndex = 8; + this.pictureBox12_end_9.TabStop = false; + // + // pictureBox2_start_9 + // + this.pictureBox2_start_9.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_9.Location = new System.Drawing.Point(1284, 126); + this.pictureBox2_start_9.Name = "pictureBox2_start_9"; + this.pictureBox2_start_9.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_9.TabIndex = 8; + this.pictureBox2_start_9.TabStop = false; + // + // textBox_MeasureValue_3 + // + this.textBox_MeasureValue_3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_3.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_3.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_3.Location = new System.Drawing.Point(692, 579); + this.textBox_MeasureValue_3.Name = "textBox_MeasureValue_3"; + this.textBox_MeasureValue_3.ReadOnly = true; + this.textBox_MeasureValue_3.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_3.TabIndex = 4; + this.textBox_MeasureValue_3.Text = "0"; + // + // textBox_MeasureValue_2 + // + this.textBox_MeasureValue_2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_2.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_2.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_2.Location = new System.Drawing.Point(619, 424); + this.textBox_MeasureValue_2.Name = "textBox_MeasureValue_2"; + this.textBox_MeasureValue_2.ReadOnly = true; + this.textBox_MeasureValue_2.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_2.TabIndex = 4; + this.textBox_MeasureValue_2.Text = "0"; + // + // textBox_MeasureValue_4 + // + this.textBox_MeasureValue_4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_4.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_4.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_4.Location = new System.Drawing.Point(824, 687); + this.textBox_MeasureValue_4.Name = "textBox_MeasureValue_4"; + this.textBox_MeasureValue_4.ReadOnly = true; + this.textBox_MeasureValue_4.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_4.TabIndex = 4; + this.textBox_MeasureValue_4.Text = "0"; + this.textBox_MeasureValue_4.TextChanged += new System.EventHandler(this.textBox_MeasureValue_4_TextChanged); + // + // textBox_MeasureValue_1 + // + this.textBox_MeasureValue_1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_1.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_1.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_1.Location = new System.Drawing.Point(603, 303); + this.textBox_MeasureValue_1.Name = "textBox_MeasureValue_1"; + this.textBox_MeasureValue_1.ReadOnly = true; + this.textBox_MeasureValue_1.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_1.TabIndex = 4; + this.textBox_MeasureValue_1.Text = "0"; + // + // textBox_MeasureValue_7 + // + this.textBox_MeasureValue_7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_7.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_7.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_7.Location = new System.Drawing.Point(1778, 379); + this.textBox_MeasureValue_7.Name = "textBox_MeasureValue_7"; + this.textBox_MeasureValue_7.ReadOnly = true; + this.textBox_MeasureValue_7.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_7.TabIndex = 4; + this.textBox_MeasureValue_7.Text = "0"; + // + // textBox_MeasureValue_6 + // + this.textBox_MeasureValue_6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_6.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_6.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_6.Location = new System.Drawing.Point(1615, 651); + this.textBox_MeasureValue_6.Name = "textBox_MeasureValue_6"; + this.textBox_MeasureValue_6.ReadOnly = true; + this.textBox_MeasureValue_6.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_6.TabIndex = 4; + this.textBox_MeasureValue_6.Text = "0"; + // + // textBox_MeasureValue_5 + // + this.textBox_MeasureValue_5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_5.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_5.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_5.Location = new System.Drawing.Point(1216, 745); + this.textBox_MeasureValue_5.Name = "textBox_MeasureValue_5"; + this.textBox_MeasureValue_5.ReadOnly = true; + this.textBox_MeasureValue_5.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_5.TabIndex = 4; + this.textBox_MeasureValue_5.Text = "0"; + // + // textBox_MeasureValue_10 + // + this.textBox_MeasureValue_10.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_10.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_10.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_10.Location = new System.Drawing.Point(803, 58); + this.textBox_MeasureValue_10.Name = "textBox_MeasureValue_10"; + this.textBox_MeasureValue_10.ReadOnly = true; + this.textBox_MeasureValue_10.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_10.TabIndex = 4; + this.textBox_MeasureValue_10.Text = "0"; + // + // textBox_MeasureValue_9 + // + this.textBox_MeasureValue_9.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_9.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_9.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_9.Location = new System.Drawing.Point(1206, 30); + this.textBox_MeasureValue_9.Name = "textBox_MeasureValue_9"; + this.textBox_MeasureValue_9.ReadOnly = true; + this.textBox_MeasureValue_9.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_9.TabIndex = 4; + this.textBox_MeasureValue_9.Text = "0"; + // + // textBox_MeasureValue_8 + // + this.textBox_MeasureValue_8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_8.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_8.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_8.Location = new System.Drawing.Point(1596, 88); + this.textBox_MeasureValue_8.Name = "textBox_MeasureValue_8"; + this.textBox_MeasureValue_8.ReadOnly = true; + this.textBox_MeasureValue_8.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_8.TabIndex = 4; + this.textBox_MeasureValue_8.Text = "0"; + // + // pictureBox12_end_10 + // + this.pictureBox12_end_10.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_10.Location = new System.Drawing.Point(1047, 146); + this.pictureBox12_end_10.Name = "pictureBox12_end_10"; + this.pictureBox12_end_10.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_10.TabIndex = 8; + this.pictureBox12_end_10.TabStop = false; + // + // pictureBox12_end_4 + // + this.pictureBox12_end_4.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_4.Location = new System.Drawing.Point(1091, 544); + this.pictureBox12_end_4.Name = "pictureBox12_end_4"; + this.pictureBox12_end_4.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_4.TabIndex = 8; + this.pictureBox12_end_4.TabStop = false; + // + // pictureBox12_end_2 + // + this.pictureBox12_end_2.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_2.Location = new System.Drawing.Point(934, 391); + this.pictureBox12_end_2.Name = "pictureBox12_end_2"; + this.pictureBox12_end_2.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_2.TabIndex = 8; + this.pictureBox12_end_2.TabStop = false; + // + // pictureBox2_start_2 + // + this.pictureBox2_start_2.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_2.Location = new System.Drawing.Point(934, 391); + this.pictureBox2_start_2.Name = "pictureBox2_start_2"; + this.pictureBox2_start_2.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_2.TabIndex = 8; + this.pictureBox2_start_2.TabStop = false; + // + // pictureBox2_start_10 + // + this.pictureBox2_start_10.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_10.Location = new System.Drawing.Point(1047, 146); + this.pictureBox2_start_10.Name = "pictureBox2_start_10"; + this.pictureBox2_start_10.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_10.TabIndex = 8; + this.pictureBox2_start_10.TabStop = false; + // + // pictureBox12_end_3 + // + this.pictureBox12_end_3.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_3.Location = new System.Drawing.Point(990, 491); + this.pictureBox12_end_3.Name = "pictureBox12_end_3"; + this.pictureBox12_end_3.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_3.TabIndex = 8; + this.pictureBox12_end_3.TabStop = false; + // + // pictureBox12_end_1 + // + this.pictureBox12_end_1.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_1.Location = new System.Drawing.Point(915, 303); + this.pictureBox12_end_1.Name = "pictureBox12_end_1"; + this.pictureBox12_end_1.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_1.TabIndex = 8; + this.pictureBox12_end_1.TabStop = false; + // + // pictureBox12_end_8 + // + this.pictureBox12_end_8.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_8.Location = new System.Drawing.Point(1397, 175); + this.pictureBox12_end_8.Name = "pictureBox12_end_8"; + this.pictureBox12_end_8.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_8.TabIndex = 8; + this.pictureBox12_end_8.TabStop = false; + // + // pictureBox12_end_7 + // + this.pictureBox12_end_7.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_7.Location = new System.Drawing.Point(1511, 341); + this.pictureBox12_end_7.Name = "pictureBox12_end_7"; + this.pictureBox12_end_7.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_7.TabIndex = 8; + this.pictureBox12_end_7.TabStop = false; + // + // pictureBox12_end_6 + // + this.pictureBox12_end_6.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_6.Location = new System.Drawing.Point(1433, 523); + this.pictureBox12_end_6.Name = "pictureBox12_end_6"; + this.pictureBox12_end_6.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_6.TabIndex = 8; + this.pictureBox12_end_6.TabStop = false; + // + // pictureBox12_end_5 + // + this.pictureBox12_end_5.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_5.Location = new System.Drawing.Point(1206, 570); + this.pictureBox12_end_5.Name = "pictureBox12_end_5"; + this.pictureBox12_end_5.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_5.TabIndex = 8; + this.pictureBox12_end_5.TabStop = false; + // + // pictureBox2_start_4 + // + this.pictureBox2_start_4.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_4.Location = new System.Drawing.Point(1091, 546); + this.pictureBox2_start_4.Name = "pictureBox2_start_4"; + this.pictureBox2_start_4.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_4.TabIndex = 8; + this.pictureBox2_start_4.TabStop = false; + // + // pictureBox2_start_5 + // + this.pictureBox2_start_5.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_5.Location = new System.Drawing.Point(1206, 570); + this.pictureBox2_start_5.Name = "pictureBox2_start_5"; + this.pictureBox2_start_5.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_5.TabIndex = 8; + this.pictureBox2_start_5.TabStop = false; + // + // pictureBox2_start_6 + // + this.pictureBox2_start_6.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_6.Location = new System.Drawing.Point(1433, 523); + this.pictureBox2_start_6.Name = "pictureBox2_start_6"; + this.pictureBox2_start_6.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_6.TabIndex = 8; + this.pictureBox2_start_6.TabStop = false; + // + // pictureBox2_start_7 + // + this.pictureBox2_start_7.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_7.Location = new System.Drawing.Point(1511, 341); + this.pictureBox2_start_7.Name = "pictureBox2_start_7"; + this.pictureBox2_start_7.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_7.TabIndex = 8; + this.pictureBox2_start_7.TabStop = false; + // + // pictureBox2_start_8 + // + this.pictureBox2_start_8.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_8.Location = new System.Drawing.Point(1397, 175); + this.pictureBox2_start_8.Name = "pictureBox2_start_8"; + this.pictureBox2_start_8.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_8.TabIndex = 8; + this.pictureBox2_start_8.TabStop = false; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.BackColor = System.Drawing.Color.White; + this.label6.Font = new System.Drawing.Font("宋体", 15F); + this.label6.Location = new System.Drawing.Point(613, 391); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(73, 30); + this.label6.TabIndex = 6; + this.label6.Text = "扭矩"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.BackColor = System.Drawing.Color.White; + this.label4.Font = new System.Drawing.Font("宋体", 15F); + this.label4.Location = new System.Drawing.Point(686, 546); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(73, 30); + this.label4.TabIndex = 6; + this.label4.Text = "扭矩"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.BackColor = System.Drawing.Color.White; + this.label5.Font = new System.Drawing.Font("宋体", 15F); + this.label5.Location = new System.Drawing.Point(818, 653); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(73, 30); + this.label5.TabIndex = 6; + this.label5.Text = "扭矩"; + this.label5.Click += new System.EventHandler(this.label5_Click); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.BackColor = System.Drawing.Color.White; + this.label10.Font = new System.Drawing.Font("宋体", 15F); + this.label10.Location = new System.Drawing.Point(1773, 341); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(73, 30); + this.label10.TabIndex = 6; + this.label10.Text = "扭矩"; + // + // pictureBox2_start_3 + // + this.pictureBox2_start_3.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_3.Location = new System.Drawing.Point(990, 491); + this.pictureBox2_start_3.Name = "pictureBox2_start_3"; + this.pictureBox2_start_3.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_3.TabIndex = 8; + this.pictureBox2_start_3.TabStop = false; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.BackColor = System.Drawing.Color.White; + this.label8.Font = new System.Drawing.Font("宋体", 15F); + this.label8.Location = new System.Drawing.Point(1610, 617); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(73, 30); + this.label8.TabIndex = 6; + this.label8.Text = "扭矩"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.BackColor = System.Drawing.Color.White; + this.label3.Font = new System.Drawing.Font("宋体", 15F); + this.label3.Location = new System.Drawing.Point(597, 269); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(73, 30); + this.label3.TabIndex = 6; + this.label3.Text = "扭矩"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.BackColor = System.Drawing.Color.White; + this.label12.Font = new System.Drawing.Font("宋体", 15F); + this.label12.Location = new System.Drawing.Point(798, 19); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(73, 30); + this.label12.TabIndex = 6; + this.label12.Text = "扭矩"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.BackColor = System.Drawing.Color.White; + this.label7.Font = new System.Drawing.Font("宋体", 15F); + this.label7.Location = new System.Drawing.Point(1211, 712); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(73, 30); + this.label7.TabIndex = 6; + this.label7.Text = "扭矩"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.BackColor = System.Drawing.Color.White; + this.label11.Font = new System.Drawing.Font("宋体", 15F); + this.label11.Location = new System.Drawing.Point(1201, 2); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(73, 30); + this.label11.TabIndex = 6; + this.label11.Text = "扭矩"; + // + // pictureBox2_start_1 + // + this.pictureBox2_start_1.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_1.Location = new System.Drawing.Point(915, 303); + this.pictureBox2_start_1.Name = "pictureBox2_start_1"; + this.pictureBox2_start_1.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_1.TabIndex = 8; + this.pictureBox2_start_1.TabStop = false; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.White; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(1591, 54); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(73, 30); + this.label2.TabIndex = 6; + this.label2.Text = "扭矩"; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.White; + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox1.Image = global::CCYQ_JieFang.Properties.Resources._02_涡喷发动机; + this.pictureBox1.Location = new System.Drawing.Point(130, 16); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(1689, 801); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // panel1 + // + this.panel1.Controls.Add(this.label16); + this.panel1.Controls.Add(this.button_running); + this.panel1.Controls.Add(this.button_alarm); + this.panel1.Controls.Add(this.button_finished); + this.panel1.Controls.Add(this.button_empty); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 919); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(1989, 84); + this.panel1.TabIndex = 3; + // + // label16 + // + this.label16.BackColor = System.Drawing.Color.Black; + this.label16.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label16.Location = new System.Drawing.Point(0, 4); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(1980, 4); + this.label16.TabIndex = 10; + // + // button_running + // + this.button_running.BackColor = System.Drawing.Color.Gray; + this.button_running.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_running.Font = new System.Drawing.Font("宋体", 12F); + this.button_running.ForeColor = System.Drawing.Color.White; + this.button_running.Location = new System.Drawing.Point(38, 15); + this.button_running.Name = "button_running"; + this.button_running.Size = new System.Drawing.Size(333, 66); + this.button_running.TabIndex = 4; + this.button_running.Text = "设备运行(禁止上下料)"; + this.button_running.UseVisualStyleBackColor = false; + // + // button_alarm + // + this.button_alarm.BackColor = System.Drawing.Color.Gray; + this.button_alarm.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_alarm.Font = new System.Drawing.Font("宋体", 12F); + this.button_alarm.ForeColor = System.Drawing.Color.White; + this.button_alarm.Location = new System.Drawing.Point(1252, 16); + this.button_alarm.Name = "button_alarm"; + this.button_alarm.Size = new System.Drawing.Size(333, 66); + this.button_alarm.TabIndex = 5; + this.button_alarm.Text = "设备故障"; + this.button_alarm.UseVisualStyleBackColor = false; + // + // button_finished + // + this.button_finished.BackColor = System.Drawing.Color.Gray; + this.button_finished.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_finished.Font = new System.Drawing.Font("宋体", 12F); + this.button_finished.ForeColor = System.Drawing.Color.White; + this.button_finished.Location = new System.Drawing.Point(442, 15); + this.button_finished.Name = "button_finished"; + this.button_finished.Size = new System.Drawing.Size(333, 66); + this.button_finished.TabIndex = 6; + this.button_finished.Text = "完成装配(请求下料)"; + this.button_finished.UseVisualStyleBackColor = false; + // + // button_empty + // + this.button_empty.BackColor = System.Drawing.Color.Gray; + this.button_empty.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_empty.Font = new System.Drawing.Font("宋体", 12F); + this.button_empty.ForeColor = System.Drawing.Color.White; + this.button_empty.Location = new System.Drawing.Point(848, 16); + this.button_empty.Name = "button_empty"; + this.button_empty.Size = new System.Drawing.Size(333, 66); + this.button_empty.TabIndex = 7; + this.button_empty.Text = "设备空闲(请求上料)"; + this.button_empty.UseVisualStyleBackColor = false; + // + // panel2 + // + this.panel2.Controls.Add(this.label_AgvLeaved); + this.panel2.Controls.Add(this.label19); + this.panel2.Controls.Add(this.label_AgvCanLeave); + this.panel2.Controls.Add(this.label15); + this.panel2.Controls.Add(this.label_AgvRequestLeave); + this.panel2.Controls.Add(this.button5_heartBeat_Ning); + this.panel2.Controls.Add(this.button5_heartBeat); + this.panel2.Controls.Add(this.label_AgvCanEnter); + this.panel2.Controls.Add(this.textBox1_PartPosition); + this.panel2.Controls.Add(this.label_AgvSongliao); + this.panel2.Controls.Add(this.label_AgvRequestEnter); + this.panel2.Controls.Add(this.label17); + this.panel2.Controls.Add(this.textBox1_EngineID); + this.panel2.Controls.Add(this.label1); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(3, 3); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1989, 84); + this.panel2.TabIndex = 2; + // + // label_AgvLeaved + // + this.label_AgvLeaved.AutoSize = true; + this.label_AgvLeaved.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvLeaved.Location = new System.Drawing.Point(1393, 12); + this.label_AgvLeaved.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvLeaved.Name = "label_AgvLeaved"; + this.label_AgvLeaved.Size = new System.Drawing.Size(153, 22); + this.label_AgvLeaved.TabIndex = 9; + this.label_AgvLeaved.Text = "●AGV已经离开"; + // + // label19 + // + this.label19.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label19.Location = new System.Drawing.Point(1756, 16); + this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(2, 44); + this.label19.TabIndex = 9; + // + // label_AgvCanLeave + // + this.label_AgvCanLeave.AutoSize = true; + this.label_AgvCanLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanLeave.Location = new System.Drawing.Point(1225, 45); + this.label_AgvCanLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanLeave.Name = "label_AgvCanLeave"; + this.label_AgvCanLeave.Size = new System.Drawing.Size(153, 22); + this.label_AgvCanLeave.TabIndex = 9; + this.label_AgvCanLeave.Text = "●AGV可以离开"; + // + // label15 + // + this.label15.BackColor = System.Drawing.Color.Black; + this.label15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label15.Location = new System.Drawing.Point(0, 75); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(1980, 4); + this.label15.TabIndex = 9; + // + // label_AgvRequestLeave + // + this.label_AgvRequestLeave.AutoSize = true; + this.label_AgvRequestLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestLeave.Location = new System.Drawing.Point(1225, 12); + this.label_AgvRequestLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestLeave.Name = "label_AgvRequestLeave"; + this.label_AgvRequestLeave.Size = new System.Drawing.Size(153, 22); + this.label_AgvRequestLeave.TabIndex = 9; + this.label_AgvRequestLeave.Text = "●AGV请求离开"; + // + // button5_heartBeat_Ning + // + this.button5_heartBeat_Ning.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat_Ning.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat_Ning.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat_Ning.Location = new System.Drawing.Point(1765, 12); + this.button5_heartBeat_Ning.Name = "button5_heartBeat_Ning"; + this.button5_heartBeat_Ning.Size = new System.Drawing.Size(100, 52); + this.button5_heartBeat_Ning.TabIndex = 5; + this.button5_heartBeat_Ning.Text = "拧紧枪"; + this.button5_heartBeat_Ning.UseVisualStyleBackColor = false; + // + // button5_heartBeat + // + this.button5_heartBeat.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat.Location = new System.Drawing.Point(1883, 12); + this.button5_heartBeat.Name = "button5_heartBeat"; + this.button5_heartBeat.Size = new System.Drawing.Size(100, 52); + this.button5_heartBeat.TabIndex = 5; + this.button5_heartBeat.Text = "PLC"; + this.button5_heartBeat.UseVisualStyleBackColor = false; + // + // label_AgvCanEnter + // + this.label_AgvCanEnter.AutoSize = true; + this.label_AgvCanEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanEnter.Location = new System.Drawing.Point(1043, 45); + this.label_AgvCanEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanEnter.Name = "label_AgvCanEnter"; + this.label_AgvCanEnter.Size = new System.Drawing.Size(153, 22); + this.label_AgvCanEnter.TabIndex = 9; + this.label_AgvCanEnter.Text = "●AGV可以进入"; + // + // textBox1_PartPosition + // + this.textBox1_PartPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_PartPosition.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_PartPosition.Location = new System.Drawing.Point(692, 9); + this.textBox1_PartPosition.Name = "textBox1_PartPosition"; + this.textBox1_PartPosition.ReadOnly = true; + this.textBox1_PartPosition.Size = new System.Drawing.Size(118, 53); + this.textBox1_PartPosition.TabIndex = 1; + this.textBox1_PartPosition.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + // + // label_AgvSongliao + // + this.label_AgvSongliao.AutoSize = true; + this.label_AgvSongliao.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvSongliao.Location = new System.Drawing.Point(883, 14); + this.label_AgvSongliao.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvSongliao.Name = "label_AgvSongliao"; + this.label_AgvSongliao.Size = new System.Drawing.Size(153, 22); + this.label_AgvSongliao.TabIndex = 9; + this.label_AgvSongliao.Text = "●AGV准备送料"; + // + // label_AgvRequestEnter + // + this.label_AgvRequestEnter.AutoSize = true; + this.label_AgvRequestEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestEnter.Location = new System.Drawing.Point(1043, 12); + this.label_AgvRequestEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestEnter.Name = "label_AgvRequestEnter"; + this.label_AgvRequestEnter.Size = new System.Drawing.Size(153, 22); + this.label_AgvRequestEnter.TabIndex = 9; + this.label_AgvRequestEnter.Text = "●AGV请求进入"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Font = new System.Drawing.Font("宋体", 16F); + this.label17.Location = new System.Drawing.Point(525, 18); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(175, 33); + this.label17.TabIndex = 0; + this.label17.Text = "装配位置:"; + // + // textBox1_EngineID + // + this.textBox1_EngineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_EngineID.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_EngineID.Location = new System.Drawing.Point(170, 10); + this.textBox1_EngineID.Name = "textBox1_EngineID"; + this.textBox1_EngineID.ReadOnly = true; + this.textBox1_EngineID.Size = new System.Drawing.Size(348, 53); + this.textBox1_EngineID.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 16F); + this.label1.Location = new System.Drawing.Point(3, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(175, 33); + this.label1.TabIndex = 0; + this.label1.Text = "产品编码:"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1995, 1006); + this.tableLayoutPanel1.TabIndex = 25; + // + // DAS_OP20 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1995, 1006); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.label9); + this.Controls.Add(this.labelTime); + this.Controls.Add(this.panel7); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DAS_OP20"; + this.Text = "OP20工位-涡喷发动机"; + this.panel7.ResumeLayout(false); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_9)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_9)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_10)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_10)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.panel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Timer timHSCZ; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Timer timUI; + private System.Windows.Forms.Label labelTime; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Panel panel7; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.PictureBox pictureBox12_end_9; + private System.Windows.Forms.PictureBox pictureBox2_start_9; + private System.Windows.Forms.TextBox textBox_MeasureValue_3; + private System.Windows.Forms.TextBox textBox_MeasureValue_2; + private System.Windows.Forms.TextBox textBox_MeasureValue_4; + private System.Windows.Forms.TextBox textBox_MeasureValue_1; + private System.Windows.Forms.TextBox textBox_MeasureValue_7; + private System.Windows.Forms.TextBox textBox_MeasureValue_6; + private System.Windows.Forms.TextBox textBox_MeasureValue_5; + private System.Windows.Forms.TextBox textBox_MeasureValue_10; + private System.Windows.Forms.TextBox textBox_MeasureValue_9; + private System.Windows.Forms.TextBox textBox_MeasureValue_8; + private System.Windows.Forms.PictureBox pictureBox12_end_10; + private System.Windows.Forms.PictureBox pictureBox12_end_4; + private System.Windows.Forms.PictureBox pictureBox12_end_2; + private System.Windows.Forms.PictureBox pictureBox2_start_2; + private System.Windows.Forms.PictureBox pictureBox2_start_10; + private System.Windows.Forms.PictureBox pictureBox12_end_3; + private System.Windows.Forms.PictureBox pictureBox12_end_1; + private System.Windows.Forms.PictureBox pictureBox12_end_8; + private System.Windows.Forms.PictureBox pictureBox12_end_7; + private System.Windows.Forms.PictureBox pictureBox12_end_6; + private System.Windows.Forms.PictureBox pictureBox12_end_5; + private System.Windows.Forms.PictureBox pictureBox2_start_4; + private System.Windows.Forms.PictureBox pictureBox2_start_5; + private System.Windows.Forms.PictureBox pictureBox2_start_6; + private System.Windows.Forms.PictureBox pictureBox2_start_7; + private System.Windows.Forms.PictureBox pictureBox2_start_8; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.PictureBox pictureBox2_start_3; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.PictureBox pictureBox2_start_1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Button button_running; + private System.Windows.Forms.Button button_alarm; + private System.Windows.Forms.Button button_finished; + private System.Windows.Forms.Button button_empty; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label_AgvLeaved; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label_AgvCanLeave; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label_AgvRequestLeave; + private System.Windows.Forms.Button button5_heartBeat; + private System.Windows.Forms.Label label_AgvCanEnter; + private System.Windows.Forms.TextBox textBox1_PartPosition; + private System.Windows.Forms.Label label_AgvRequestEnter; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.TextBox textBox1_EngineID; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label_AgvSongliao; + private System.Windows.Forms.Button button5_heartBeat_Ning; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP20/DAS_OP20.cs b/CCYQ_JieFang/OP/OP20/DAS_OP20.cs new file mode 100644 index 0000000..a92cfcd --- /dev/null +++ b/CCYQ_JieFang/OP/OP20/DAS_OP20.cs @@ -0,0 +1,648 @@ + +using DK_DC_Tool; +using HslCommunication.Core; +using Newtonsoft.Json; +using NPOI.SS.UserModel; +using OpcBasic; +using Robot.Common; +using Serilog.Events; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using SystemFramework; + +namespace MesWork +{ + public partial class DAS_OP20 + { + InitServer initServer = null; + /// + /// + /// + private static string OpNameCurrent = ""; + /// + /// 字典 ,存储12个开始测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicStartMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicEndMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量文本框控件,key为测量位置,value文本框的值 + /// + Dictionary dicMeasureTextBox = new Dictionary(); + /// + /// PLC事件变化委托 + /// + public static Action MIS_Funtion_PLC_OP = null; + + /// + /// PLC事件变化委托 + /// + public static Action AGV_Task_change = null; + /// + /// PLC事件变化委托--处理托盘信息 + /// + public static Action AGV_Task_Info = null; + + // 每个工位的满工件数量 + // 工位OP20 3个 + public static int partCount = 3; + + public static bool isConnect = false; + + public DAS_OP20(string opName) + { + InitializeComponent(); + + publicCore.partCount = partCount; + OpNameCurrent = opName; + + Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang; + Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang; + + MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking; + MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking; + + MIS_Funtion_PLC_OP -= MIS_Funtion_PLC; + MIS_Funtion_PLC_OP += MIS_Funtion_PLC; + + AGV_Task_change -= SolveAgvDeviceStatus; + AGV_Task_change += SolveAgvDeviceStatus; + + + if (MesWorkForm.IsDemoMesServer == 1) + { + MoNiHeartBeat(); + } + SolvePicAndMeasureValueInit(); + + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + } + catch (Exception err) { } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + + //var aa = + //new Thread(new ThreadStart(delegate () { + // while (true) + // { + // try + // { + // if (!isConnect) + // { + // if (publicCore.Get_PartPosition(OpNameCurrent) != -1) + // { + // isConnect = true; + // ProductInfo_search(); + // } + // } + // } + // catch (Exception err) { } + // Thread.Sleep(1000); + // } + //})); + //aa.IsBackground = true; + //aa.Start(); + + } + public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent) + { + try + { + var tagID = msgEvent.TagID.ToString(); + // var opName = msgEvent.OpName.ToString(); + var tagTypeCodeID = (int)msgEvent.TagTypeCodeID; + var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID; + string tagValue; + switch (tagTypeID) + { + case EnumTagTypeID.BOOL: + tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString(); + break; + default: + tagValue = msgEvent.TagValue.ToString(); + break; + } + switch (tagTypeCodeID) + { + case 14: + DeviceHeartBeat(tagValue); + break; + // AGV任务 + case 50: + publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue); + break; + // 51 空闲(请求上料) + // 52 完成(请求下料) + // 53 故障 + case 51: + case 52: + case 53: + publicCore.SolveDeviceStatus(OpNameCurrent); + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + break; + // 54 第几个件 + case 54: + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + case 55: + publicCore.MeasurePositionChange(OpNameCurrent, 2); + SolvePicAndMeasureValueWorking(); + break; + //读电批 + case 56: + if (tagValue == "1") + { + publicCore.LogInsert("OP20", "Info", "【PLC_读电批置位】"); + // 不在这个地方写true,写在接收数据的地方写 + + } + else + { + publicCore.LogInsert("OP20", "Info", "【PLC_读电批复位】"); + MesWorkForm.WritePLC(83, OpNameCurrent, false); + publicCore.LogInsert("OP20", "Info", "【IPC_读电批完成复位】"); + } + break; + //读泄漏量1 2或者压力 + case 59: + if(tagValue == "1") + { + //publicCore.ReadQualityData_LeakageRate(OpNameCurrent); + //publicCore.ReadQualityData_Pressure(OpNameCurrent); + MesWorkForm.WritePLC(84, OpNameCurrent, true); + } + else + { + MesWorkForm.WritePLC(84, OpNameCurrent, false); + } + break; + } + } + catch (Exception ex) + { + } + } + /// + /// 初始化界面显示 + /// + private void SolvePicAndMeasureValueInit() + { + try + { + dicStartMasurePictureBox.Add(1, pictureBox2_start_1); + dicStartMasurePictureBox.Add(2, pictureBox2_start_2); + dicStartMasurePictureBox.Add(3, pictureBox2_start_3); + dicStartMasurePictureBox.Add(4, pictureBox2_start_4); + dicStartMasurePictureBox.Add(5, pictureBox2_start_5); + dicStartMasurePictureBox.Add(6, pictureBox2_start_6); + dicStartMasurePictureBox.Add(7, pictureBox2_start_7); + dicStartMasurePictureBox.Add(8, pictureBox2_start_8); + dicStartMasurePictureBox.Add(9, pictureBox2_start_9); + dicStartMasurePictureBox.Add(10, pictureBox2_start_10); + + dicEndMasurePictureBox.Add(1, pictureBox12_end_1); + dicEndMasurePictureBox.Add(2, pictureBox12_end_2); + dicEndMasurePictureBox.Add(3, pictureBox12_end_3); + dicEndMasurePictureBox.Add(4, pictureBox12_end_4); + dicEndMasurePictureBox.Add(5, pictureBox12_end_5); + dicEndMasurePictureBox.Add(6, pictureBox12_end_6); + dicEndMasurePictureBox.Add(7, pictureBox12_end_7); + dicEndMasurePictureBox.Add(8, pictureBox12_end_8); + dicEndMasurePictureBox.Add(9, pictureBox12_end_9); + dicEndMasurePictureBox.Add(10, pictureBox12_end_10); + + dicMeasureTextBox.Add(1, textBox_MeasureValue_1); + dicMeasureTextBox.Add(2, textBox_MeasureValue_2); + dicMeasureTextBox.Add(3, textBox_MeasureValue_3); + dicMeasureTextBox.Add(4, textBox_MeasureValue_4); + dicMeasureTextBox.Add(5, textBox_MeasureValue_5); + dicMeasureTextBox.Add(6, textBox_MeasureValue_6); + dicMeasureTextBox.Add(7, textBox_MeasureValue_7); + dicMeasureTextBox.Add(8, textBox_MeasureValue_8); + dicMeasureTextBox.Add(9, textBox_MeasureValue_9); + dicMeasureTextBox.Add(10, textBox_MeasureValue_10); + + + foreach (var item in dicStartMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicEndMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicMeasureTextBox) + { + item.Value.Text = ""; + } + + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "1") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 工作时界面显示 + /// + private void SolvePicAndMeasureValueWorking() + { + try + { + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "2") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 界面产品编码和装配位置的显示 + /// + public void ProductInfo_search() + { + try + { + //textBox1_EngineID.Text = ""; + //textBox1_PartPosition.Text = ""; + ShowTextBoxControl(textBox1_EngineID, "", Color.White); + ShowTextBoxControl(textBox1_PartPosition, "", Color.White); + int PartPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White); + ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White); + //textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString(); + //textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString(); + } + } + catch (Exception err) + { + } + } + private void ShowPicBoxControl(Control c,bool ststus) + { + c.BeginInvoke(new Action(delegate () { + c.Visible = ststus; + })); + } + private void ShowTextBoxControl(Control c, string value, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.Text = value; + c.BackColor = color; + })); + } + private void ShowLabelControl(Control c, Color color) + { + //if (c.InvokeRequired) + //{ + + //} + //else + //{ + // c.ForeColor = color; + //} + c.BeginInvoke(new Action(delegate () { + c.ForeColor = color; + })); + } + private void ShowButtonControl(Control c, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.BackColor = color; + })); + } + + + /// + /// 初始化设备状态 + /// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警 + /// + private void SolveDeviceStatusInit(string currentStatus) + { + try + { + ShowButtonControl(button_running, Color.Gray); + ShowButtonControl(button_finished, Color.Gray); + ShowButtonControl(button_empty, Color.Gray); + ShowButtonControl(button_alarm, Color.Gray); + //button_running.BackColor = Color.Gray; + //button_finished.BackColor = Color.Gray; + //button_empty.BackColor = Color.Gray; + //button_alarm.BackColor = Color.Gray; + + if (currentStatus == "1") + { + ShowButtonControl(button_running, Color.Green); + //button_running.BackColor = Color.Green; + } + else if (currentStatus == "2") + { + ShowButtonControl(button_empty, Color.SkyBlue); + + //button_empty.BackColor = Color.SkyBlue; + } + else if (currentStatus == "3") + { + ShowButtonControl(button_finished, Color.DarkOrange); + + //button_finished.BackColor = Color.DarkOrange; + } + else if (currentStatus == "4") + { + ShowButtonControl(button_alarm, Color.Red); + + //button_alarm.BackColor = Color.Red; + } + } + catch (Exception err) + { + + } + } + /// + /// AGV设备状态显示 + /// + /// + private void SolveAgvDeviceStatus(string PLC_AgvTaskNum) + { + try + { + // 77 反馈AGV任务 + switch (PLC_AgvTaskNum) + { + case "10": + // AGV触发装配任务 正在送料 + //label_AgvSongliao.ForeColor = Color.Green; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Black; + + ShowLabelControl(label_AgvSongliao, Color.Green); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Black); + + + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + + break; + case "11": + + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + + //label_AgvRequestEnter.ForeColor = Color.Green; + //label_AgvRequestLeave.ForeColor = Color.Black; + break; + // 允许AGV进行上料 --允许进入 + // 允许AGV进行下料 --允许进入 + case "2": + case "4": + ShowLabelControl(label_AgvCanEnter, Color.Green); + ShowLabelControl(label_AgvCanLeave, Color.Black); + //label_AgvCanEnter.ForeColor = Color.Green; + //label_AgvCanLeave.ForeColor = Color.Black; + break; + case "21": + // AGV 上料完成 + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Green; + break; + case "3": + // 1.调用FSS-接收IPC下料请求的接口 + // 2.反馈任务号:30 AGV已呼叫成功正在去往下料区 + break; + case "31": + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Green); + //label_AgvRequestEnter.ForeColor = Color.Black; + //label_AgvRequestLeave.ForeColor = Color.Green; + // AGV已到达下料区 + break; + case "41": + // AGV下料完成 + break; + // 允许AGV离开 + case "5": + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Green); + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Green; + break; + case "51": + //label_AgvSongliao.ForeColor = Color.Black; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Green; + ShowLabelControl(label_AgvSongliao, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Green); + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + } + + + } + catch (Exception err) + { + } + } + + /// + /// 设备PLC心跳button5_heartBeat_Ning + /// + /// + private void DeviceHeartBeat(string tagValue) + { + WritePLC(15, OpNameCurrent, tagValue); + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat, Color.Green); + + //button5_heartBeat.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat, Color.Gray); + + //button5_heartBeat.BackColor = Color.Gray; + } + } + /// + /// 设备PLC心跳 + /// + /// + private void DeviceHeartBeat_NingJinQiang(string tagValue) + { + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat_Ning, Color.Green); + + //button5_heartBeat_Ning.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat_Ning, Color.Red); + + //button5_heartBeat_Ning.BackColor = Color.Red; + } + } + + + + private void MoNiHeartBeat() + { + bool tv = false; + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + WritePLC(14, OpNameCurrent, tv); + tv = !tv; + } + catch (Exception err) { } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + } + + private void label5_Click(object sender, EventArgs e) + { + + } + + private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/CCYQ_JieFang/OP/OP20/DAS_OP20.resx b/CCYQ_JieFang/OP/OP20/DAS_OP20.resx new file mode 100644 index 0000000..55f2584 --- /dev/null +++ b/CCYQ_JieFang/OP/OP20/DAS_OP20.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 432, 221 + + + 573, 221 + + + 33 + + + + + AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz + UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC + QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm + Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX + dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT + PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0 + F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd + 0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI + Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg + gg== + + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP30/DAS_OP30.Designer.cs b/CCYQ_JieFang/OP/OP30/DAS_OP30.Designer.cs new file mode 100644 index 0000000..8a68a32 --- /dev/null +++ b/CCYQ_JieFang/OP/OP30/DAS_OP30.Designer.cs @@ -0,0 +1,610 @@ +namespace MesWork +{ + partial class DAS_OP30: PlcLinkForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DAS_OP30)); + this.timHSCZ = new System.Windows.Forms.Timer(this.components); + this.label9 = new System.Windows.Forms.Label(); + this.timUI = new System.Windows.Forms.Timer(this.components); + this.labelTime = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.panel7 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.pictureBox12_end_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_1 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_1 = new System.Windows.Forms.PictureBox(); + this.textBox_MeasureValue_2 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_1 = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label16 = new System.Windows.Forms.Label(); + this.button_running = new System.Windows.Forms.Button(); + this.button_alarm = new System.Windows.Forms.Button(); + this.button_finished = new System.Windows.Forms.Button(); + this.button_empty = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.label_AgvLeaved = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); + this.label_AgvCanLeave = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label_AgvRequestLeave = new System.Windows.Forms.Label(); + this.button5_heartBeat_Ning = new System.Windows.Forms.Button(); + this.button5_heartBeat = new System.Windows.Forms.Button(); + this.label_AgvCanEnter = new System.Windows.Forms.Label(); + this.textBox1_PartPosition = new System.Windows.Forms.TextBox(); + this.label_AgvSongliao = new System.Windows.Forms.Label(); + this.label_AgvRequestEnter = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.textBox1_EngineID = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.panel7.SuspendLayout(); + this.panel3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // timHSCZ + // + this.timHSCZ.Enabled = true; + // + // label9 + // + this.label9.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.label9.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label9.Location = new System.Drawing.Point(-136, -165); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(685, 50); + this.label9.TabIndex = 22; + this.label9.Text = "微型减速机"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // timUI + // + this.timUI.Enabled = true; + // + // labelTime + // + this.labelTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F); + this.labelTime.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelTime.Location = new System.Drawing.Point(898, -165); + this.labelTime.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.labelTime.Name = "labelTime"; + this.labelTime.Size = new System.Drawing.Size(647, 58); + this.labelTime.TabIndex = 23; + this.labelTime.Text = "2021-03-09 12:30:30"; + this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label18 + // + this.label18.BackColor = System.Drawing.Color.Transparent; + this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label18.Cursor = System.Windows.Forms.Cursors.Hand; + this.label18.Font = new System.Drawing.Font("微软雅黑", 10.5F); + this.label18.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label18.Location = new System.Drawing.Point(188, 177); + this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(93, 54); + this.label18.TabIndex = 1; + this.label18.Text = "查询"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label18.Visible = false; + // + // panel7 + // + this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.panel7.Controls.Add(this.label18); + this.panel7.Location = new System.Drawing.Point(-144, -112); + this.panel7.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(1688, 68); + this.panel7.TabIndex = 24; + // + // panel3 + // + this.panel3.Controls.Add(this.pictureBox12_end_2); + this.panel3.Controls.Add(this.pictureBox2_start_2); + this.panel3.Controls.Add(this.pictureBox12_end_1); + this.panel3.Controls.Add(this.pictureBox2_start_1); + this.panel3.Controls.Add(this.textBox_MeasureValue_2); + this.panel3.Controls.Add(this.textBox_MeasureValue_1); + this.panel3.Controls.Add(this.label6); + this.panel3.Controls.Add(this.label5); + this.panel3.Controls.Add(this.pictureBox1); + this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel3.Location = new System.Drawing.Point(3, 77); + this.panel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1767, 684); + this.panel3.TabIndex = 4; + // + // pictureBox12_end_2 + // + this.pictureBox12_end_2.Image = global::CCYQ_JieFang.Properties.Resources.下压OK; + this.pictureBox12_end_2.Location = new System.Drawing.Point(678, 238); + this.pictureBox12_end_2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox12_end_2.Name = "pictureBox12_end_2"; + this.pictureBox12_end_2.Size = new System.Drawing.Size(57, 53); + this.pictureBox12_end_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_2.TabIndex = 9; + this.pictureBox12_end_2.TabStop = false; + // + // pictureBox2_start_2 + // + this.pictureBox2_start_2.Image = global::CCYQ_JieFang.Properties.Resources.下压; + this.pictureBox2_start_2.Location = new System.Drawing.Point(678, 238); + this.pictureBox2_start_2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox2_start_2.Name = "pictureBox2_start_2"; + this.pictureBox2_start_2.Size = new System.Drawing.Size(57, 53); + this.pictureBox2_start_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_2.TabIndex = 10; + this.pictureBox2_start_2.TabStop = false; + // + // pictureBox12_end_1 + // + this.pictureBox12_end_1.Image = global::CCYQ_JieFang.Properties.Resources.下压OK; + this.pictureBox12_end_1.Location = new System.Drawing.Point(678, 161); + this.pictureBox12_end_1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox12_end_1.Name = "pictureBox12_end_1"; + this.pictureBox12_end_1.Size = new System.Drawing.Size(57, 53); + this.pictureBox12_end_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_1.TabIndex = 9; + this.pictureBox12_end_1.TabStop = false; + // + // pictureBox2_start_1 + // + this.pictureBox2_start_1.Image = global::CCYQ_JieFang.Properties.Resources.下压; + this.pictureBox2_start_1.Location = new System.Drawing.Point(678, 161); + this.pictureBox2_start_1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox2_start_1.Name = "pictureBox2_start_1"; + this.pictureBox2_start_1.Size = new System.Drawing.Size(57, 53); + this.pictureBox2_start_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_1.TabIndex = 10; + this.pictureBox2_start_1.TabStop = false; + // + // textBox_MeasureValue_2 + // + this.textBox_MeasureValue_2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_2.Font = new System.Drawing.Font("宋体", 17F); + this.textBox_MeasureValue_2.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_2.Location = new System.Drawing.Point(505, 246); + this.textBox_MeasureValue_2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBox_MeasureValue_2.Name = "textBox_MeasureValue_2"; + this.textBox_MeasureValue_2.ReadOnly = true; + this.textBox_MeasureValue_2.Size = new System.Drawing.Size(158, 40); + this.textBox_MeasureValue_2.TabIndex = 4; + this.textBox_MeasureValue_2.Text = "0"; + // + // textBox_MeasureValue_1 + // + this.textBox_MeasureValue_1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_1.Font = new System.Drawing.Font("宋体", 17F); + this.textBox_MeasureValue_1.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_1.Location = new System.Drawing.Point(505, 169); + this.textBox_MeasureValue_1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBox_MeasureValue_1.Name = "textBox_MeasureValue_1"; + this.textBox_MeasureValue_1.ReadOnly = true; + this.textBox_MeasureValue_1.Size = new System.Drawing.Size(158, 40); + this.textBox_MeasureValue_1.TabIndex = 4; + this.textBox_MeasureValue_1.Text = "0"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.BackColor = System.Drawing.Color.White; + this.label6.Font = new System.Drawing.Font("宋体", 17F); + this.label6.Location = new System.Drawing.Point(411, 250); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(86, 29); + this.label6.TabIndex = 6; + this.label6.Text = "压力2"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.BackColor = System.Drawing.Color.White; + this.label5.Font = new System.Drawing.Font("宋体", 17F); + this.label5.Location = new System.Drawing.Point(411, 173); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(86, 29); + this.label5.TabIndex = 6; + this.label5.Text = "压力1"; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.White; + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox1.Image = global::CCYQ_JieFang.Properties.Resources._03_卫星模型; + this.pictureBox1.Location = new System.Drawing.Point(116, 13); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(1501, 668); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // panel1 + // + this.panel1.Controls.Add(this.label16); + this.panel1.Controls.Add(this.button_running); + this.panel1.Controls.Add(this.button_alarm); + this.panel1.Controls.Add(this.button_finished); + this.panel1.Controls.Add(this.button_empty); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 765); + this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(1767, 71); + this.panel1.TabIndex = 3; + // + // label16 + // + this.label16.BackColor = System.Drawing.Color.Black; + this.label16.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label16.Location = new System.Drawing.Point(0, 3); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(1760, 3); + this.label16.TabIndex = 10; + // + // button_running + // + this.button_running.BackColor = System.Drawing.Color.Gray; + this.button_running.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_running.Font = new System.Drawing.Font("宋体", 12F); + this.button_running.ForeColor = System.Drawing.Color.White; + this.button_running.Location = new System.Drawing.Point(34, 12); + this.button_running.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button_running.Name = "button_running"; + this.button_running.Size = new System.Drawing.Size(296, 55); + this.button_running.TabIndex = 4; + this.button_running.Text = "设备运行(禁止上下料)"; + this.button_running.UseVisualStyleBackColor = false; + // + // button_alarm + // + this.button_alarm.BackColor = System.Drawing.Color.Gray; + this.button_alarm.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_alarm.Font = new System.Drawing.Font("宋体", 12F); + this.button_alarm.ForeColor = System.Drawing.Color.White; + this.button_alarm.Location = new System.Drawing.Point(1113, 13); + this.button_alarm.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button_alarm.Name = "button_alarm"; + this.button_alarm.Size = new System.Drawing.Size(296, 55); + this.button_alarm.TabIndex = 5; + this.button_alarm.Text = "设备故障"; + this.button_alarm.UseVisualStyleBackColor = false; + // + // button_finished + // + this.button_finished.BackColor = System.Drawing.Color.Gray; + this.button_finished.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_finished.Font = new System.Drawing.Font("宋体", 12F); + this.button_finished.ForeColor = System.Drawing.Color.White; + this.button_finished.Location = new System.Drawing.Point(393, 12); + this.button_finished.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button_finished.Name = "button_finished"; + this.button_finished.Size = new System.Drawing.Size(296, 55); + this.button_finished.TabIndex = 6; + this.button_finished.Text = "完成装配(请求下料)"; + this.button_finished.UseVisualStyleBackColor = false; + // + // button_empty + // + this.button_empty.BackColor = System.Drawing.Color.Gray; + this.button_empty.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_empty.Font = new System.Drawing.Font("宋体", 12F); + this.button_empty.ForeColor = System.Drawing.Color.White; + this.button_empty.Location = new System.Drawing.Point(754, 13); + this.button_empty.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button_empty.Name = "button_empty"; + this.button_empty.Size = new System.Drawing.Size(296, 55); + this.button_empty.TabIndex = 7; + this.button_empty.Text = "设备空闲(请求上料)"; + this.button_empty.UseVisualStyleBackColor = false; + // + // panel2 + // + this.panel2.Controls.Add(this.label_AgvLeaved); + this.panel2.Controls.Add(this.label19); + this.panel2.Controls.Add(this.label_AgvCanLeave); + this.panel2.Controls.Add(this.label15); + this.panel2.Controls.Add(this.label_AgvRequestLeave); + this.panel2.Controls.Add(this.button5_heartBeat_Ning); + this.panel2.Controls.Add(this.button5_heartBeat); + this.panel2.Controls.Add(this.label_AgvCanEnter); + this.panel2.Controls.Add(this.textBox1_PartPosition); + this.panel2.Controls.Add(this.label_AgvSongliao); + this.panel2.Controls.Add(this.label_AgvRequestEnter); + this.panel2.Controls.Add(this.label17); + this.panel2.Controls.Add(this.textBox1_EngineID); + this.panel2.Controls.Add(this.label1); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(3, 2); + this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1767, 71); + this.panel2.TabIndex = 2; + // + // label_AgvLeaved + // + this.label_AgvLeaved.AutoSize = true; + this.label_AgvLeaved.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvLeaved.Location = new System.Drawing.Point(1238, 10); + this.label_AgvLeaved.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvLeaved.Name = "label_AgvLeaved"; + this.label_AgvLeaved.Size = new System.Drawing.Size(134, 19); + this.label_AgvLeaved.TabIndex = 9; + this.label_AgvLeaved.Text = "●AGV已经离开"; + // + // label19 + // + this.label19.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label19.Location = new System.Drawing.Point(1561, 13); + this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(2, 37); + this.label19.TabIndex = 9; + // + // label_AgvCanLeave + // + this.label_AgvCanLeave.AutoSize = true; + this.label_AgvCanLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanLeave.Location = new System.Drawing.Point(1089, 38); + this.label_AgvCanLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanLeave.Name = "label_AgvCanLeave"; + this.label_AgvCanLeave.Size = new System.Drawing.Size(134, 19); + this.label_AgvCanLeave.TabIndex = 9; + this.label_AgvCanLeave.Text = "●AGV可以离开"; + // + // label15 + // + this.label15.BackColor = System.Drawing.Color.Black; + this.label15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label15.Location = new System.Drawing.Point(0, 62); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(1760, 3); + this.label15.TabIndex = 9; + // + // label_AgvRequestLeave + // + this.label_AgvRequestLeave.AutoSize = true; + this.label_AgvRequestLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestLeave.Location = new System.Drawing.Point(1089, 10); + this.label_AgvRequestLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestLeave.Name = "label_AgvRequestLeave"; + this.label_AgvRequestLeave.Size = new System.Drawing.Size(134, 19); + this.label_AgvRequestLeave.TabIndex = 9; + this.label_AgvRequestLeave.Text = "●AGV请求离开"; + // + // button5_heartBeat_Ning + // + this.button5_heartBeat_Ning.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat_Ning.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat_Ning.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat_Ning.Location = new System.Drawing.Point(1569, 10); + this.button5_heartBeat_Ning.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button5_heartBeat_Ning.Name = "button5_heartBeat_Ning"; + this.button5_heartBeat_Ning.Size = new System.Drawing.Size(89, 43); + this.button5_heartBeat_Ning.TabIndex = 5; + this.button5_heartBeat_Ning.Text = "拧紧枪"; + this.button5_heartBeat_Ning.UseVisualStyleBackColor = false; + this.button5_heartBeat_Ning.Visible = false; + // + // button5_heartBeat + // + this.button5_heartBeat.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat.Location = new System.Drawing.Point(1674, 10); + this.button5_heartBeat.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button5_heartBeat.Name = "button5_heartBeat"; + this.button5_heartBeat.Size = new System.Drawing.Size(89, 43); + this.button5_heartBeat.TabIndex = 5; + this.button5_heartBeat.Text = "PLC"; + this.button5_heartBeat.UseVisualStyleBackColor = false; + // + // label_AgvCanEnter + // + this.label_AgvCanEnter.AutoSize = true; + this.label_AgvCanEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanEnter.Location = new System.Drawing.Point(927, 38); + this.label_AgvCanEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanEnter.Name = "label_AgvCanEnter"; + this.label_AgvCanEnter.Size = new System.Drawing.Size(134, 19); + this.label_AgvCanEnter.TabIndex = 9; + this.label_AgvCanEnter.Text = "●AGV可以进入"; + // + // textBox1_PartPosition + // + this.textBox1_PartPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_PartPosition.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_PartPosition.Location = new System.Drawing.Point(615, 8); + this.textBox1_PartPosition.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBox1_PartPosition.Name = "textBox1_PartPosition"; + this.textBox1_PartPosition.ReadOnly = true; + this.textBox1_PartPosition.Size = new System.Drawing.Size(105, 46); + this.textBox1_PartPosition.TabIndex = 1; + // + // label_AgvSongliao + // + this.label_AgvSongliao.AutoSize = true; + this.label_AgvSongliao.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvSongliao.Location = new System.Drawing.Point(785, 12); + this.label_AgvSongliao.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvSongliao.Name = "label_AgvSongliao"; + this.label_AgvSongliao.Size = new System.Drawing.Size(134, 19); + this.label_AgvSongliao.TabIndex = 9; + this.label_AgvSongliao.Text = "●AGV准备送料"; + // + // label_AgvRequestEnter + // + this.label_AgvRequestEnter.AutoSize = true; + this.label_AgvRequestEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestEnter.Location = new System.Drawing.Point(927, 10); + this.label_AgvRequestEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestEnter.Name = "label_AgvRequestEnter"; + this.label_AgvRequestEnter.Size = new System.Drawing.Size(134, 19); + this.label_AgvRequestEnter.TabIndex = 9; + this.label_AgvRequestEnter.Text = "●AGV请求进入"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Font = new System.Drawing.Font("宋体", 16F); + this.label17.Location = new System.Drawing.Point(467, 15); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(147, 27); + this.label17.TabIndex = 0; + this.label17.Text = "装配位置:"; + // + // textBox1_EngineID + // + this.textBox1_EngineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_EngineID.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_EngineID.Location = new System.Drawing.Point(151, 8); + this.textBox1_EngineID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.textBox1_EngineID.Name = "textBox1_EngineID"; + this.textBox1_EngineID.ReadOnly = true; + this.textBox1_EngineID.Size = new System.Drawing.Size(310, 46); + this.textBox1_EngineID.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 16F); + this.label1.Location = new System.Drawing.Point(3, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(147, 27); + this.label1.TabIndex = 0; + this.label1.Text = "产品编码:"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 75F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 75F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1773, 838); + this.tableLayoutPanel1.TabIndex = 25; + // + // DAS_OP30 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1773, 838); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.label9); + this.Controls.Add(this.labelTime); + this.Controls.Add(this.panel7); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DAS_OP30"; + this.Text = "OP30工位-卫星模型"; + this.panel7.ResumeLayout(false); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.panel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Timer timHSCZ; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Timer timUI; + private System.Windows.Forms.Label labelTime; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Panel panel7; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.TextBox textBox_MeasureValue_2; + private System.Windows.Forms.TextBox textBox_MeasureValue_1; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Button button_running; + private System.Windows.Forms.Button button_alarm; + private System.Windows.Forms.Button button_finished; + private System.Windows.Forms.Button button_empty; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label_AgvLeaved; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label_AgvCanLeave; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label_AgvRequestLeave; + private System.Windows.Forms.Button button5_heartBeat; + private System.Windows.Forms.Label label_AgvCanEnter; + private System.Windows.Forms.TextBox textBox1_PartPosition; + private System.Windows.Forms.Label label_AgvRequestEnter; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.TextBox textBox1_EngineID; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label_AgvSongliao; + private System.Windows.Forms.Button button5_heartBeat_Ning; + private System.Windows.Forms.PictureBox pictureBox12_end_1; + private System.Windows.Forms.PictureBox pictureBox2_start_1; + private System.Windows.Forms.PictureBox pictureBox12_end_2; + private System.Windows.Forms.PictureBox pictureBox2_start_2; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP30/DAS_OP30.cs b/CCYQ_JieFang/OP/OP30/DAS_OP30.cs new file mode 100644 index 0000000..8d55dd9 --- /dev/null +++ b/CCYQ_JieFang/OP/OP30/DAS_OP30.cs @@ -0,0 +1,626 @@ + +using DK_DC_Tool; +using HslCommunication.Core; +using Newtonsoft.Json; +using NPOI.SS.UserModel; +using OpcBasic; +using Robot.Common; +using Serilog.Events; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using SystemFramework; + +namespace MesWork +{ + public partial class DAS_OP30 + { + InitServer initServer = null; + /// + /// + /// + private static string OpNameCurrent = ""; + /// + /// 字典 ,存储12个开始测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicStartMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicEndMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量文本框控件,key为测量位置,value文本框的值 + /// + Dictionary dicMeasureTextBox = new Dictionary(); + /// + /// PLC事件变化委托 + /// + public static Action MIS_Funtion_PLC_OP = null; + + /// + /// PLC事件变化委托 + /// + public static Action AGV_Task_change = null; + /// + /// PLC事件变化委托--处理托盘信息 + /// + public static Action AGV_Task_Info = null; + + // 每个工位的满工件数量 + // 工位OP30 4个 + public static int partCount = 4; + + public static bool isConnect = false; + + public DAS_OP30(string opName) + { + InitializeComponent(); + + publicCore.partCount = partCount; + OpNameCurrent = opName; + + Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang; + Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang; + + MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking; + MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking; + + MIS_Funtion_PLC_OP -= MIS_Funtion_PLC; + MIS_Funtion_PLC_OP += MIS_Funtion_PLC; + + AGV_Task_change -= SolveAgvDeviceStatus; + AGV_Task_change += SolveAgvDeviceStatus; + + + if (MesWorkForm.IsDemoMesServer == 1) + { + MoNiHeartBeat(); + } + SolvePicAndMeasureValueInit(); + + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + } + catch (Exception err) { } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + + //var aa = + //new Thread(new ThreadStart(delegate () { + // while (true) + // { + // try + // { + // if (!isConnect) + // { + // if (publicCore.Get_PartPosition(OpNameCurrent) != -1) + // { + // isConnect = true; + // ProductInfo_search(); + // } + // } + // } + // catch (Exception err) { } + // Thread.Sleep(1000); + // } + //})); + //aa.IsBackground = true; + //aa.Start(); + + } + public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent) + { + try + { + var tagID = msgEvent.TagID.ToString(); + // var opName = msgEvent.OpName.ToString(); + var tagTypeCodeID = (int)msgEvent.TagTypeCodeID; + var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID; + string tagValue; + switch (tagTypeID) + { + case EnumTagTypeID.BOOL: + tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString(); + break; + default: + tagValue = msgEvent.TagValue.ToString(); + break; + } + switch (tagTypeCodeID) + { + case 14: + DeviceHeartBeat(tagValue); + break; + // AGV任务 + case 50: + publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue); + break; + // 51 空闲(请求上料) + // 52 完成(请求下料) + // 53 故障 + case 51: + case 52: + case 53: + publicCore.SolveDeviceStatus(OpNameCurrent); + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + break; + // 54 第几个件 + case 54: + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + case 55: + publicCore.MeasurePositionChange(OpNameCurrent, 2); + SolvePicAndMeasureValueWorking(); + break; + //读电批 + case 56: + if (tagValue == "1") + { + publicCore.LogInsert("OP30", "Info", "【PLC_读电批置位】"); + // 不在这个地方写true,写在接收数据的地方写 + + } + else + { + publicCore.LogInsert("OP30", "Info", "【PLC_读电批复位】"); + MesWorkForm.WritePLC(83, OpNameCurrent, false); + publicCore.LogInsert("OP30", "Info", "【IPC_读电批完成复位】"); + } + break; + //读泄漏量1 2或者压力 + case 59: + if (tagValue == "1") + { + //publicCore.ReadQualityData_LeakageRate(OpNameCurrent); + publicCore.ReadQualityData_Pressure(OpNameCurrent); + MesWorkForm.WritePLC(84, OpNameCurrent, true); + } + else + { + MesWorkForm.WritePLC(84, OpNameCurrent, false); + } + break; + } + } + catch (Exception ex) + { + } + } + /// + /// 初始化界面显示 + /// + private void SolvePicAndMeasureValueInit() + { + try + { + dicStartMasurePictureBox.Add(1, pictureBox2_start_1); + dicStartMasurePictureBox.Add(2, pictureBox2_start_2); + + dicEndMasurePictureBox.Add(1, pictureBox12_end_1); + dicEndMasurePictureBox.Add(2, pictureBox12_end_2); + + dicMeasureTextBox.Add(1, textBox_MeasureValue_1); + dicMeasureTextBox.Add(2, textBox_MeasureValue_2); + + foreach (var item in dicStartMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicEndMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicMeasureTextBox) + { + item.Value.Text = ""; + } + + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "1") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 工作时界面显示 + /// + private void SolvePicAndMeasureValueWorking() + { + try + { + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "2") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 界面产品编码和装配位置的显示 + /// + public void ProductInfo_search() + { + try + { + //textBox1_EngineID.Text = ""; + //textBox1_PartPosition.Text = ""; + ShowTextBoxControl(textBox1_EngineID, "", Color.White); + ShowTextBoxControl(textBox1_PartPosition, "", Color.White); + int PartPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White); + ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White); + //textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString(); + //textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString(); + } + } + catch (Exception err) + { + } + } + private void ShowPicBoxControl(Control c, bool ststus) + { + c.BeginInvoke(new Action(delegate () { + c.Visible = ststus; + })); + } + private void ShowTextBoxControl(Control c, string value, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.Text = value; + c.BackColor = color; + })); + } + private void ShowLabelControl(Control c, Color color) + { + //if (c.InvokeRequired) + //{ + + //} + //else + //{ + // c.ForeColor = color; + //} + c.BeginInvoke(new Action(delegate () { + c.ForeColor = color; + })); + } + private void ShowButtonControl(Control c, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.BackColor = color; + })); + } + + + /// + /// 初始化设备状态 + /// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警 + /// + private void SolveDeviceStatusInit(string currentStatus) + { + try + { + ShowButtonControl(button_running, Color.Gray); + ShowButtonControl(button_finished, Color.Gray); + ShowButtonControl(button_empty, Color.Gray); + ShowButtonControl(button_alarm, Color.Gray); + //button_running.BackColor = Color.Gray; + //button_finished.BackColor = Color.Gray; + //button_empty.BackColor = Color.Gray; + //button_alarm.BackColor = Color.Gray; + + if (currentStatus == "1") + { + ShowButtonControl(button_running, Color.Green); + //button_running.BackColor = Color.Green; + } + else if (currentStatus == "2") + { + ShowButtonControl(button_empty, Color.SkyBlue); + + //button_empty.BackColor = Color.SkyBlue; + } + else if (currentStatus == "3") + { + ShowButtonControl(button_finished, Color.DarkOrange); + + //button_finished.BackColor = Color.DarkOrange; + } + else if (currentStatus == "4") + { + ShowButtonControl(button_alarm, Color.Red); + + //button_alarm.BackColor = Color.Red; + } + } + catch (Exception err) + { + + } + } + /// + /// AGV设备状态显示 + /// + /// + private void SolveAgvDeviceStatus(string PLC_AgvTaskNum) + { + try + { + // 77 反馈AGV任务 + switch (PLC_AgvTaskNum) + { + case "10": + // AGV触发装配任务 正在送料 + //label_AgvSongliao.ForeColor = Color.Green; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Black; + + ShowLabelControl(label_AgvSongliao, Color.Green); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Black); + + + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + + break; + case "11": + + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + + //label_AgvRequestEnter.ForeColor = Color.Green; + //label_AgvRequestLeave.ForeColor = Color.Black; + break; + // 允许AGV进行上料 --允许进入 + // 允许AGV进行下料 --允许进入 + case "2": + case "4": + ShowLabelControl(label_AgvCanEnter, Color.Green); + ShowLabelControl(label_AgvCanLeave, Color.Black); + //label_AgvCanEnter.ForeColor = Color.Green; + //label_AgvCanLeave.ForeColor = Color.Black; + break; + case "21": + // AGV 上料完成 + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Green; + break; + case "3": + // 1.调用FSS-接收IPC下料请求的接口 + // 2.反馈任务号:30 AGV已呼叫成功正在去往下料区 + break; + case "31": + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Green); + //label_AgvRequestEnter.ForeColor = Color.Black; + //label_AgvRequestLeave.ForeColor = Color.Green; + // AGV已到达下料区 + break; + case "41": + // AGV下料完成 + break; + // 允许AGV离开 + case "5": + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Green); + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Green; + break; + case "51": + //label_AgvSongliao.ForeColor = Color.Black; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Green; + ShowLabelControl(label_AgvSongliao, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Green); + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + } + + + } + catch (Exception err) + { + } + } + + /// + /// 设备PLC心跳button5_heartBeat_Ning + /// + /// + private void DeviceHeartBeat(string tagValue) + { + WritePLC(15, OpNameCurrent, tagValue); + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat, Color.Green); + + //button5_heartBeat.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat, Color.Gray); + + //button5_heartBeat.BackColor = Color.Gray; + } + } + /// + /// 设备PLC心跳 + /// + /// + private void DeviceHeartBeat_NingJinQiang(string tagValue) + { + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat_Ning, Color.Green); + + //button5_heartBeat_Ning.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat_Ning, Color.Red); + + //button5_heartBeat_Ning.BackColor = Color.Red; + } + } + + + + private void MoNiHeartBeat() + { + bool tv = false; + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + WritePLC(14, OpNameCurrent, tv); + tv = !tv; + } + catch (Exception err) { } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + } + + private void label5_Click(object sender, EventArgs e) + { + + } + + private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/CCYQ_JieFang/OP/OP30/DAS_OP30.resx b/CCYQ_JieFang/OP/OP30/DAS_OP30.resx new file mode 100644 index 0000000..55f2584 --- /dev/null +++ b/CCYQ_JieFang/OP/OP30/DAS_OP30.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 432, 221 + + + 573, 221 + + + 33 + + + + + AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz + UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC + QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm + Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX + dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT + PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0 + F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd + 0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI + Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg + gg== + + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP40/DAS_OP40.Designer.cs b/CCYQ_JieFang/OP/OP40/DAS_OP40.Designer.cs new file mode 100644 index 0000000..5681362 --- /dev/null +++ b/CCYQ_JieFang/OP/OP40/DAS_OP40.Designer.cs @@ -0,0 +1,1002 @@ +namespace MesWork +{ + partial class DAS_OP40: PlcLinkForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DAS_OP40)); + this.timHSCZ = new System.Windows.Forms.Timer(this.components); + this.label9 = new System.Windows.Forms.Label(); + this.timUI = new System.Windows.Forms.Timer(this.components); + this.labelTime = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.panel7 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.textBox_MeasureValue_3 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_2 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_4 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_1 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_7 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_6 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_5 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_8 = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label16 = new System.Windows.Forms.Label(); + this.button_running = new System.Windows.Forms.Button(); + this.button_alarm = new System.Windows.Forms.Button(); + this.button_finished = new System.Windows.Forms.Button(); + this.button_empty = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.label_AgvLeaved = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); + this.label_AgvCanLeave = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label_AgvRequestLeave = new System.Windows.Forms.Label(); + this.button5_heartBeat_Ning = new System.Windows.Forms.Button(); + this.button5_heartBeat = new System.Windows.Forms.Button(); + this.label_AgvCanEnter = new System.Windows.Forms.Label(); + this.textBox1_PartPosition = new System.Windows.Forms.TextBox(); + this.label_AgvSongliao = new System.Windows.Forms.Label(); + this.label_AgvRequestEnter = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.textBox1_EngineID = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.pictureBox12_end_4 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_3 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_1 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_8 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_7 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_6 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_5 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_4 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_5 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_6 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_7 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_8 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_3 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_1 = new System.Windows.Forms.PictureBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_9 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_9 = new System.Windows.Forms.PictureBox(); + this.textBox_MeasureValue_9 = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); + this.panel7.SuspendLayout(); + this.panel3.SuspendLayout(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_9)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_9)).BeginInit(); + this.SuspendLayout(); + // + // timHSCZ + // + this.timHSCZ.Enabled = true; + // + // label9 + // + this.label9.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.label9.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label9.Location = new System.Drawing.Point(-153, -198); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(771, 60); + this.label9.TabIndex = 22; + this.label9.Text = "微型减速机"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // timUI + // + this.timUI.Enabled = true; + // + // labelTime + // + this.labelTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F); + this.labelTime.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelTime.Location = new System.Drawing.Point(1010, -198); + this.labelTime.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.labelTime.Name = "labelTime"; + this.labelTime.Size = new System.Drawing.Size(728, 69); + this.labelTime.TabIndex = 23; + this.labelTime.Text = "2021-03-09 12:30:30"; + this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label18 + // + this.label18.BackColor = System.Drawing.Color.Transparent; + this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label18.Cursor = System.Windows.Forms.Cursors.Hand; + this.label18.Font = new System.Drawing.Font("微软雅黑", 10.5F); + this.label18.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label18.Location = new System.Drawing.Point(212, 212); + this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(104, 64); + this.label18.TabIndex = 1; + this.label18.Text = "查询"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label18.Visible = false; + // + // panel7 + // + this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.panel7.Controls.Add(this.label18); + this.panel7.Location = new System.Drawing.Point(-162, -134); + this.panel7.Margin = new System.Windows.Forms.Padding(4); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(1899, 82); + this.panel7.TabIndex = 24; + // + // panel3 + // + this.panel3.Controls.Add(this.pictureBox12_end_9); + this.panel3.Controls.Add(this.pictureBox2_start_9); + this.panel3.Controls.Add(this.textBox_MeasureValue_9); + this.panel3.Controls.Add(this.label11); + this.panel3.Controls.Add(this.textBox_MeasureValue_3); + this.panel3.Controls.Add(this.textBox_MeasureValue_2); + this.panel3.Controls.Add(this.textBox_MeasureValue_4); + this.panel3.Controls.Add(this.textBox_MeasureValue_1); + this.panel3.Controls.Add(this.textBox_MeasureValue_7); + this.panel3.Controls.Add(this.textBox_MeasureValue_6); + this.panel3.Controls.Add(this.textBox_MeasureValue_5); + this.panel3.Controls.Add(this.textBox_MeasureValue_8); + this.panel3.Controls.Add(this.pictureBox12_end_4); + this.panel3.Controls.Add(this.pictureBox12_end_2); + this.panel3.Controls.Add(this.pictureBox2_start_2); + this.panel3.Controls.Add(this.pictureBox12_end_3); + this.panel3.Controls.Add(this.pictureBox12_end_1); + this.panel3.Controls.Add(this.pictureBox12_end_8); + this.panel3.Controls.Add(this.pictureBox12_end_7); + this.panel3.Controls.Add(this.pictureBox12_end_6); + this.panel3.Controls.Add(this.pictureBox12_end_5); + this.panel3.Controls.Add(this.pictureBox2_start_4); + this.panel3.Controls.Add(this.pictureBox2_start_5); + this.panel3.Controls.Add(this.pictureBox2_start_6); + this.panel3.Controls.Add(this.pictureBox2_start_7); + this.panel3.Controls.Add(this.pictureBox2_start_8); + this.panel3.Controls.Add(this.label6); + this.panel3.Controls.Add(this.label4); + this.panel3.Controls.Add(this.label5); + this.panel3.Controls.Add(this.label10); + this.panel3.Controls.Add(this.pictureBox2_start_3); + this.panel3.Controls.Add(this.label8); + this.panel3.Controls.Add(this.label3); + this.panel3.Controls.Add(this.label7); + this.panel3.Controls.Add(this.pictureBox2_start_1); + this.panel3.Controls.Add(this.label2); + this.panel3.Controls.Add(this.pictureBox1); + this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel3.Location = new System.Drawing.Point(3, 93); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1989, 820); + this.panel3.TabIndex = 4; + // + // textBox_MeasureValue_3 + // + this.textBox_MeasureValue_3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_3.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_3.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_3.Location = new System.Drawing.Point(820, 45); + this.textBox_MeasureValue_3.Name = "textBox_MeasureValue_3"; + this.textBox_MeasureValue_3.ReadOnly = true; + this.textBox_MeasureValue_3.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_3.TabIndex = 4; + this.textBox_MeasureValue_3.Text = "0"; + // + // textBox_MeasureValue_2 + // + this.textBox_MeasureValue_2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_2.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_2.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_2.Location = new System.Drawing.Point(1296, 40); + this.textBox_MeasureValue_2.Name = "textBox_MeasureValue_2"; + this.textBox_MeasureValue_2.ReadOnly = true; + this.textBox_MeasureValue_2.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_2.TabIndex = 4; + this.textBox_MeasureValue_2.Text = "0"; + // + // textBox_MeasureValue_4 + // + this.textBox_MeasureValue_4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_4.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_4.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_4.Location = new System.Drawing.Point(571, 228); + this.textBox_MeasureValue_4.Name = "textBox_MeasureValue_4"; + this.textBox_MeasureValue_4.ReadOnly = true; + this.textBox_MeasureValue_4.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_4.TabIndex = 4; + this.textBox_MeasureValue_4.Text = "0"; + // + // textBox_MeasureValue_1 + // + this.textBox_MeasureValue_1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_1.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_1.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_1.Location = new System.Drawing.Point(1484, 114); + this.textBox_MeasureValue_1.Name = "textBox_MeasureValue_1"; + this.textBox_MeasureValue_1.ReadOnly = true; + this.textBox_MeasureValue_1.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_1.TabIndex = 4; + this.textBox_MeasureValue_1.Text = "0"; + // + // textBox_MeasureValue_7 + // + this.textBox_MeasureValue_7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_7.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_7.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_7.Location = new System.Drawing.Point(1194, 730); + this.textBox_MeasureValue_7.Name = "textBox_MeasureValue_7"; + this.textBox_MeasureValue_7.ReadOnly = true; + this.textBox_MeasureValue_7.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_7.TabIndex = 4; + this.textBox_MeasureValue_7.Text = "0"; + // + // textBox_MeasureValue_6 + // + this.textBox_MeasureValue_6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_6.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_6.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_6.Location = new System.Drawing.Point(857, 672); + this.textBox_MeasureValue_6.Name = "textBox_MeasureValue_6"; + this.textBox_MeasureValue_6.ReadOnly = true; + this.textBox_MeasureValue_6.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_6.TabIndex = 4; + this.textBox_MeasureValue_6.Text = "0"; + // + // textBox_MeasureValue_5 + // + this.textBox_MeasureValue_5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_5.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_5.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_5.Location = new System.Drawing.Point(571, 503); + this.textBox_MeasureValue_5.Name = "textBox_MeasureValue_5"; + this.textBox_MeasureValue_5.ReadOnly = true; + this.textBox_MeasureValue_5.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_5.TabIndex = 4; + this.textBox_MeasureValue_5.Text = "0"; + // + // textBox_MeasureValue_8 + // + this.textBox_MeasureValue_8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_8.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_8.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_8.Location = new System.Drawing.Point(1561, 433); + this.textBox_MeasureValue_8.Name = "textBox_MeasureValue_8"; + this.textBox_MeasureValue_8.ReadOnly = true; + this.textBox_MeasureValue_8.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_8.TabIndex = 4; + this.textBox_MeasureValue_8.Text = "0"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.BackColor = System.Drawing.Color.White; + this.label6.Font = new System.Drawing.Font("宋体", 15F); + this.label6.Location = new System.Drawing.Point(1290, 7); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(73, 30); + this.label6.TabIndex = 6; + this.label6.Text = "扭矩"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.BackColor = System.Drawing.Color.White; + this.label4.Font = new System.Drawing.Font("宋体", 15F); + this.label4.Location = new System.Drawing.Point(814, 12); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(73, 30); + this.label4.TabIndex = 6; + this.label4.Text = "扭矩"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.BackColor = System.Drawing.Color.White; + this.label5.Font = new System.Drawing.Font("宋体", 15F); + this.label5.Location = new System.Drawing.Point(565, 194); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(73, 30); + this.label5.TabIndex = 6; + this.label5.Text = "扭矩"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.BackColor = System.Drawing.Color.White; + this.label10.Font = new System.Drawing.Font("宋体", 15F); + this.label10.Location = new System.Drawing.Point(1189, 697); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(73, 30); + this.label10.TabIndex = 6; + this.label10.Text = "扭矩"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.BackColor = System.Drawing.Color.White; + this.label8.Font = new System.Drawing.Font("宋体", 15F); + this.label8.Location = new System.Drawing.Point(852, 639); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(73, 30); + this.label8.TabIndex = 6; + this.label8.Text = "扭矩"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.BackColor = System.Drawing.Color.White; + this.label3.Font = new System.Drawing.Font("宋体", 15F); + this.label3.Location = new System.Drawing.Point(1478, 80); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(73, 30); + this.label3.TabIndex = 6; + this.label3.Text = "扭矩"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.BackColor = System.Drawing.Color.White; + this.label7.Font = new System.Drawing.Font("宋体", 15F); + this.label7.Location = new System.Drawing.Point(566, 470); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(73, 30); + this.label7.TabIndex = 6; + this.label7.Text = "扭矩"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.White; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(1556, 400); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(73, 30); + this.label2.TabIndex = 6; + this.label2.Text = "扭矩"; + // + // panel1 + // + this.panel1.Controls.Add(this.label16); + this.panel1.Controls.Add(this.button_running); + this.panel1.Controls.Add(this.button_alarm); + this.panel1.Controls.Add(this.button_finished); + this.panel1.Controls.Add(this.button_empty); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 919); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(1989, 84); + this.panel1.TabIndex = 3; + // + // label16 + // + this.label16.BackColor = System.Drawing.Color.Black; + this.label16.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label16.Location = new System.Drawing.Point(0, 4); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(1980, 4); + this.label16.TabIndex = 10; + // + // button_running + // + this.button_running.BackColor = System.Drawing.Color.Gray; + this.button_running.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_running.Font = new System.Drawing.Font("宋体", 12F); + this.button_running.ForeColor = System.Drawing.Color.White; + this.button_running.Location = new System.Drawing.Point(38, 15); + this.button_running.Name = "button_running"; + this.button_running.Size = new System.Drawing.Size(333, 66); + this.button_running.TabIndex = 4; + this.button_running.Text = "设备运行(禁止上下料)"; + this.button_running.UseVisualStyleBackColor = false; + // + // button_alarm + // + this.button_alarm.BackColor = System.Drawing.Color.Gray; + this.button_alarm.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_alarm.Font = new System.Drawing.Font("宋体", 12F); + this.button_alarm.ForeColor = System.Drawing.Color.White; + this.button_alarm.Location = new System.Drawing.Point(1252, 16); + this.button_alarm.Name = "button_alarm"; + this.button_alarm.Size = new System.Drawing.Size(333, 66); + this.button_alarm.TabIndex = 5; + this.button_alarm.Text = "设备故障"; + this.button_alarm.UseVisualStyleBackColor = false; + // + // button_finished + // + this.button_finished.BackColor = System.Drawing.Color.Gray; + this.button_finished.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_finished.Font = new System.Drawing.Font("宋体", 12F); + this.button_finished.ForeColor = System.Drawing.Color.White; + this.button_finished.Location = new System.Drawing.Point(442, 15); + this.button_finished.Name = "button_finished"; + this.button_finished.Size = new System.Drawing.Size(333, 66); + this.button_finished.TabIndex = 6; + this.button_finished.Text = "完成装配(请求下料)"; + this.button_finished.UseVisualStyleBackColor = false; + // + // button_empty + // + this.button_empty.BackColor = System.Drawing.Color.Gray; + this.button_empty.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_empty.Font = new System.Drawing.Font("宋体", 12F); + this.button_empty.ForeColor = System.Drawing.Color.White; + this.button_empty.Location = new System.Drawing.Point(848, 16); + this.button_empty.Name = "button_empty"; + this.button_empty.Size = new System.Drawing.Size(333, 66); + this.button_empty.TabIndex = 7; + this.button_empty.Text = "设备空闲(请求上料)"; + this.button_empty.UseVisualStyleBackColor = false; + // + // panel2 + // + this.panel2.Controls.Add(this.label_AgvLeaved); + this.panel2.Controls.Add(this.label19); + this.panel2.Controls.Add(this.label_AgvCanLeave); + this.panel2.Controls.Add(this.label15); + this.panel2.Controls.Add(this.label_AgvRequestLeave); + this.panel2.Controls.Add(this.button5_heartBeat_Ning); + this.panel2.Controls.Add(this.button5_heartBeat); + this.panel2.Controls.Add(this.label_AgvCanEnter); + this.panel2.Controls.Add(this.textBox1_PartPosition); + this.panel2.Controls.Add(this.label_AgvSongliao); + this.panel2.Controls.Add(this.label_AgvRequestEnter); + this.panel2.Controls.Add(this.label17); + this.panel2.Controls.Add(this.textBox1_EngineID); + this.panel2.Controls.Add(this.label1); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(3, 3); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1989, 84); + this.panel2.TabIndex = 2; + // + // label_AgvLeaved + // + this.label_AgvLeaved.AutoSize = true; + this.label_AgvLeaved.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvLeaved.Location = new System.Drawing.Point(1393, 12); + this.label_AgvLeaved.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvLeaved.Name = "label_AgvLeaved"; + this.label_AgvLeaved.Size = new System.Drawing.Size(153, 22); + this.label_AgvLeaved.TabIndex = 9; + this.label_AgvLeaved.Text = "●AGV已经离开"; + // + // label19 + // + this.label19.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label19.Location = new System.Drawing.Point(1756, 16); + this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(2, 44); + this.label19.TabIndex = 9; + // + // label_AgvCanLeave + // + this.label_AgvCanLeave.AutoSize = true; + this.label_AgvCanLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanLeave.Location = new System.Drawing.Point(1225, 45); + this.label_AgvCanLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanLeave.Name = "label_AgvCanLeave"; + this.label_AgvCanLeave.Size = new System.Drawing.Size(153, 22); + this.label_AgvCanLeave.TabIndex = 9; + this.label_AgvCanLeave.Text = "●AGV可以离开"; + // + // label15 + // + this.label15.BackColor = System.Drawing.Color.Black; + this.label15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label15.Location = new System.Drawing.Point(0, 75); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(1980, 4); + this.label15.TabIndex = 9; + // + // label_AgvRequestLeave + // + this.label_AgvRequestLeave.AutoSize = true; + this.label_AgvRequestLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestLeave.Location = new System.Drawing.Point(1225, 12); + this.label_AgvRequestLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestLeave.Name = "label_AgvRequestLeave"; + this.label_AgvRequestLeave.Size = new System.Drawing.Size(153, 22); + this.label_AgvRequestLeave.TabIndex = 9; + this.label_AgvRequestLeave.Text = "●AGV请求离开"; + // + // button5_heartBeat_Ning + // + this.button5_heartBeat_Ning.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat_Ning.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat_Ning.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat_Ning.Location = new System.Drawing.Point(1765, 12); + this.button5_heartBeat_Ning.Name = "button5_heartBeat_Ning"; + this.button5_heartBeat_Ning.Size = new System.Drawing.Size(100, 52); + this.button5_heartBeat_Ning.TabIndex = 5; + this.button5_heartBeat_Ning.Text = "拧紧枪"; + this.button5_heartBeat_Ning.UseVisualStyleBackColor = false; + // + // button5_heartBeat + // + this.button5_heartBeat.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat.Location = new System.Drawing.Point(1883, 12); + this.button5_heartBeat.Name = "button5_heartBeat"; + this.button5_heartBeat.Size = new System.Drawing.Size(100, 52); + this.button5_heartBeat.TabIndex = 5; + this.button5_heartBeat.Text = "PLC"; + this.button5_heartBeat.UseVisualStyleBackColor = false; + // + // label_AgvCanEnter + // + this.label_AgvCanEnter.AutoSize = true; + this.label_AgvCanEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanEnter.Location = new System.Drawing.Point(1043, 45); + this.label_AgvCanEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanEnter.Name = "label_AgvCanEnter"; + this.label_AgvCanEnter.Size = new System.Drawing.Size(153, 22); + this.label_AgvCanEnter.TabIndex = 9; + this.label_AgvCanEnter.Text = "●AGV可以进入"; + // + // textBox1_PartPosition + // + this.textBox1_PartPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_PartPosition.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_PartPosition.Location = new System.Drawing.Point(692, 9); + this.textBox1_PartPosition.Name = "textBox1_PartPosition"; + this.textBox1_PartPosition.ReadOnly = true; + this.textBox1_PartPosition.Size = new System.Drawing.Size(118, 53); + this.textBox1_PartPosition.TabIndex = 1; + // + // label_AgvSongliao + // + this.label_AgvSongliao.AutoSize = true; + this.label_AgvSongliao.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvSongliao.Location = new System.Drawing.Point(883, 14); + this.label_AgvSongliao.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvSongliao.Name = "label_AgvSongliao"; + this.label_AgvSongliao.Size = new System.Drawing.Size(153, 22); + this.label_AgvSongliao.TabIndex = 9; + this.label_AgvSongliao.Text = "●AGV准备送料"; + // + // label_AgvRequestEnter + // + this.label_AgvRequestEnter.AutoSize = true; + this.label_AgvRequestEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestEnter.Location = new System.Drawing.Point(1043, 12); + this.label_AgvRequestEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestEnter.Name = "label_AgvRequestEnter"; + this.label_AgvRequestEnter.Size = new System.Drawing.Size(153, 22); + this.label_AgvRequestEnter.TabIndex = 9; + this.label_AgvRequestEnter.Text = "●AGV请求进入"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Font = new System.Drawing.Font("宋体", 16F); + this.label17.Location = new System.Drawing.Point(525, 18); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(175, 33); + this.label17.TabIndex = 0; + this.label17.Text = "装配位置:"; + // + // textBox1_EngineID + // + this.textBox1_EngineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_EngineID.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_EngineID.Location = new System.Drawing.Point(170, 10); + this.textBox1_EngineID.Name = "textBox1_EngineID"; + this.textBox1_EngineID.ReadOnly = true; + this.textBox1_EngineID.Size = new System.Drawing.Size(348, 53); + this.textBox1_EngineID.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 16F); + this.label1.Location = new System.Drawing.Point(3, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(175, 33); + this.label1.TabIndex = 0; + this.label1.Text = "产品编码:"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1995, 1006); + this.tableLayoutPanel1.TabIndex = 25; + // + // pictureBox12_end_4 + // + this.pictureBox12_end_4.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_4.Location = new System.Drawing.Point(874, 292); + this.pictureBox12_end_4.Name = "pictureBox12_end_4"; + this.pictureBox12_end_4.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_4.TabIndex = 8; + this.pictureBox12_end_4.TabStop = false; + // + // pictureBox12_end_2 + // + this.pictureBox12_end_2.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_2.Location = new System.Drawing.Point(1156, 163); + this.pictureBox12_end_2.Name = "pictureBox12_end_2"; + this.pictureBox12_end_2.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_2.TabIndex = 8; + this.pictureBox12_end_2.TabStop = false; + // + // pictureBox2_start_2 + // + this.pictureBox2_start_2.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_2.Location = new System.Drawing.Point(1156, 163); + this.pictureBox2_start_2.Name = "pictureBox2_start_2"; + this.pictureBox2_start_2.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_2.TabIndex = 8; + this.pictureBox2_start_2.TabStop = false; + // + // pictureBox12_end_3 + // + this.pictureBox12_end_3.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_3.Location = new System.Drawing.Point(984, 181); + this.pictureBox12_end_3.Name = "pictureBox12_end_3"; + this.pictureBox12_end_3.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_3.TabIndex = 8; + this.pictureBox12_end_3.TabStop = false; + // + // pictureBox12_end_1 + // + this.pictureBox12_end_1.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_1.Location = new System.Drawing.Point(1296, 246); + this.pictureBox12_end_1.Name = "pictureBox12_end_1"; + this.pictureBox12_end_1.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_1.TabIndex = 8; + this.pictureBox12_end_1.TabStop = false; + // + // pictureBox12_end_8 + // + this.pictureBox12_end_8.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_8.Location = new System.Drawing.Point(1314, 400); + this.pictureBox12_end_8.Name = "pictureBox12_end_8"; + this.pictureBox12_end_8.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_8.TabIndex = 8; + this.pictureBox12_end_8.TabStop = false; + // + // pictureBox12_end_7 + // + this.pictureBox12_end_7.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_7.Location = new System.Drawing.Point(1209, 524); + this.pictureBox12_end_7.Name = "pictureBox12_end_7"; + this.pictureBox12_end_7.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_7.TabIndex = 8; + this.pictureBox12_end_7.TabStop = false; + // + // pictureBox12_end_6 + // + this.pictureBox12_end_6.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_6.Location = new System.Drawing.Point(1030, 543); + this.pictureBox12_end_6.Name = "pictureBox12_end_6"; + this.pictureBox12_end_6.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_6.TabIndex = 8; + this.pictureBox12_end_6.TabStop = false; + // + // pictureBox12_end_5 + // + this.pictureBox12_end_5.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_5.Location = new System.Drawing.Point(887, 448); + this.pictureBox12_end_5.Name = "pictureBox12_end_5"; + this.pictureBox12_end_5.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_5.TabIndex = 8; + this.pictureBox12_end_5.TabStop = false; + // + // pictureBox2_start_4 + // + this.pictureBox2_start_4.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_4.Location = new System.Drawing.Point(874, 292); + this.pictureBox2_start_4.Name = "pictureBox2_start_4"; + this.pictureBox2_start_4.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_4.TabIndex = 8; + this.pictureBox2_start_4.TabStop = false; + // + // pictureBox2_start_5 + // + this.pictureBox2_start_5.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_5.Location = new System.Drawing.Point(887, 448); + this.pictureBox2_start_5.Name = "pictureBox2_start_5"; + this.pictureBox2_start_5.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_5.TabIndex = 8; + this.pictureBox2_start_5.TabStop = false; + // + // pictureBox2_start_6 + // + this.pictureBox2_start_6.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_6.Location = new System.Drawing.Point(1030, 543); + this.pictureBox2_start_6.Name = "pictureBox2_start_6"; + this.pictureBox2_start_6.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_6.TabIndex = 8; + this.pictureBox2_start_6.TabStop = false; + // + // pictureBox2_start_7 + // + this.pictureBox2_start_7.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_7.Location = new System.Drawing.Point(1209, 524); + this.pictureBox2_start_7.Name = "pictureBox2_start_7"; + this.pictureBox2_start_7.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_7.TabIndex = 8; + this.pictureBox2_start_7.TabStop = false; + // + // pictureBox2_start_8 + // + this.pictureBox2_start_8.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_8.Location = new System.Drawing.Point(1314, 400); + this.pictureBox2_start_8.Name = "pictureBox2_start_8"; + this.pictureBox2_start_8.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_8.TabIndex = 8; + this.pictureBox2_start_8.TabStop = false; + // + // pictureBox2_start_3 + // + this.pictureBox2_start_3.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_3.Location = new System.Drawing.Point(984, 181); + this.pictureBox2_start_3.Name = "pictureBox2_start_3"; + this.pictureBox2_start_3.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_3.TabIndex = 8; + this.pictureBox2_start_3.TabStop = false; + // + // pictureBox2_start_1 + // + this.pictureBox2_start_1.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_1.Location = new System.Drawing.Point(1296, 246); + this.pictureBox2_start_1.Name = "pictureBox2_start_1"; + this.pictureBox2_start_1.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_1.TabIndex = 8; + this.pictureBox2_start_1.TabStop = false; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.White; + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox1.Image = global::CCYQ_JieFang.Properties.Resources._04_微型减速机; + this.pictureBox1.Location = new System.Drawing.Point(130, 16); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(1689, 801); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // pictureBox12_end_9 + // + this.pictureBox12_end_9.Image = global::CCYQ_JieFang.Properties.Resources.下压OK; + this.pictureBox12_end_9.Location = new System.Drawing.Point(412, 355); + this.pictureBox12_end_9.Name = "pictureBox12_end_9"; + this.pictureBox12_end_9.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_9.TabIndex = 11; + this.pictureBox12_end_9.TabStop = false; + // + // pictureBox2_start_9 + // + this.pictureBox2_start_9.Image = global::CCYQ_JieFang.Properties.Resources.下压; + this.pictureBox2_start_9.Location = new System.Drawing.Point(412, 355); + this.pictureBox2_start_9.Name = "pictureBox2_start_9"; + this.pictureBox2_start_9.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_9.TabIndex = 12; + this.pictureBox2_start_9.TabStop = false; + // + // textBox_MeasureValue_9 + // + this.textBox_MeasureValue_9.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_9.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_9.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_9.Location = new System.Drawing.Point(279, 366); + this.textBox_MeasureValue_9.Name = "textBox_MeasureValue_9"; + this.textBox_MeasureValue_9.ReadOnly = true; + this.textBox_MeasureValue_9.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_9.TabIndex = 9; + this.textBox_MeasureValue_9.Text = "0"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.BackColor = System.Drawing.Color.White; + this.label11.Font = new System.Drawing.Font("宋体", 15F); + this.label11.Location = new System.Drawing.Point(274, 330); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(103, 30); + this.label11.TabIndex = 10; + this.label11.Text = "泄露量"; + // + // DAS_OP40 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1995, 1006); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.label9); + this.Controls.Add(this.labelTime); + this.Controls.Add(this.panel7); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DAS_OP40"; + this.Text = "OP40工位-电机泵"; + this.panel7.ResumeLayout(false); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_9)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_9)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Timer timHSCZ; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Timer timUI; + private System.Windows.Forms.Label labelTime; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Panel panel7; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.TextBox textBox_MeasureValue_3; + private System.Windows.Forms.TextBox textBox_MeasureValue_2; + private System.Windows.Forms.TextBox textBox_MeasureValue_4; + private System.Windows.Forms.TextBox textBox_MeasureValue_1; + private System.Windows.Forms.TextBox textBox_MeasureValue_7; + private System.Windows.Forms.TextBox textBox_MeasureValue_6; + private System.Windows.Forms.TextBox textBox_MeasureValue_5; + private System.Windows.Forms.TextBox textBox_MeasureValue_8; + private System.Windows.Forms.PictureBox pictureBox12_end_4; + private System.Windows.Forms.PictureBox pictureBox12_end_2; + private System.Windows.Forms.PictureBox pictureBox2_start_2; + private System.Windows.Forms.PictureBox pictureBox12_end_3; + private System.Windows.Forms.PictureBox pictureBox12_end_1; + private System.Windows.Forms.PictureBox pictureBox12_end_8; + private System.Windows.Forms.PictureBox pictureBox12_end_7; + private System.Windows.Forms.PictureBox pictureBox12_end_6; + private System.Windows.Forms.PictureBox pictureBox12_end_5; + private System.Windows.Forms.PictureBox pictureBox2_start_4; + private System.Windows.Forms.PictureBox pictureBox2_start_5; + private System.Windows.Forms.PictureBox pictureBox2_start_6; + private System.Windows.Forms.PictureBox pictureBox2_start_7; + private System.Windows.Forms.PictureBox pictureBox2_start_8; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.PictureBox pictureBox2_start_3; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.PictureBox pictureBox2_start_1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Button button_running; + private System.Windows.Forms.Button button_alarm; + private System.Windows.Forms.Button button_finished; + private System.Windows.Forms.Button button_empty; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label_AgvLeaved; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label_AgvCanLeave; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label_AgvRequestLeave; + private System.Windows.Forms.Button button5_heartBeat; + private System.Windows.Forms.Label label_AgvCanEnter; + private System.Windows.Forms.TextBox textBox1_PartPosition; + private System.Windows.Forms.Label label_AgvRequestEnter; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.TextBox textBox1_EngineID; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label_AgvSongliao; + private System.Windows.Forms.Button button5_heartBeat_Ning; + private System.Windows.Forms.PictureBox pictureBox12_end_9; + private System.Windows.Forms.PictureBox pictureBox2_start_9; + private System.Windows.Forms.TextBox textBox_MeasureValue_9; + private System.Windows.Forms.Label label11; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP40/DAS_OP40.cs b/CCYQ_JieFang/OP/OP40/DAS_OP40.cs new file mode 100644 index 0000000..6e32ff1 --- /dev/null +++ b/CCYQ_JieFang/OP/OP40/DAS_OP40.cs @@ -0,0 +1,648 @@ + +using DK_DC_Tool; +using HslCommunication.Core; +using Newtonsoft.Json; +using NPOI.SS.UserModel; +using OpcBasic; +using Robot.Common; +using Serilog.Events; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using SystemFramework; + +namespace MesWork +{ + public partial class DAS_OP40 + { + InitServer initServer = null; + /// + /// + /// + private static string OpNameCurrent = ""; + /// + /// 字典 ,存储12个开始测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicStartMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicEndMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量文本框控件,key为测量位置,value文本框的值 + /// + Dictionary dicMeasureTextBox = new Dictionary(); + /// + /// PLC事件变化委托 + /// + public static Action MIS_Funtion_PLC_OP = null; + + /// + /// PLC事件变化委托 + /// + public static Action AGV_Task_change = null; + /// + /// PLC事件变化委托--处理托盘信息 + /// + public static Action AGV_Task_Info = null; + + // 每个工位的满工件数量 + // 工位OP40 2个 + public static int partCount = 2; + + public static bool isConnect = false; + + public DAS_OP40(string opName) + { + InitializeComponent(); + + publicCore.partCount = partCount; + OpNameCurrent = opName; + + Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang; + Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang; + + MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking; + MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking; + + MIS_Funtion_PLC_OP -= MIS_Funtion_PLC; + MIS_Funtion_PLC_OP += MIS_Funtion_PLC; + + AGV_Task_change -= SolveAgvDeviceStatus; + AGV_Task_change += SolveAgvDeviceStatus; + + + if (MesWorkForm.IsDemoMesServer == 1) + { + MoNiHeartBeat(); + } + SolvePicAndMeasureValueInit(); + + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + } + catch (Exception err) { + } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + + //var aa = + //new Thread(new ThreadStart(delegate () { + // while (true) + // { + // try + // { + // if (!isConnect) + // { + // if (publicCore.Get_PartPosition(OpNameCurrent) != -1) + // { + // isConnect = true; + // ProductInfo_search(); + // } + // } + // } + // catch (Exception err) { } + // Thread.Sleep(1000); + // } + //})); + //aa.IsBackground = true; + //aa.Start(); + + } + public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent) + { + try + { + var tagID = msgEvent.TagID.ToString(); + // var opName = msgEvent.OpName.ToString(); + var tagTypeCodeID = (int)msgEvent.TagTypeCodeID; + var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID; + string tagValue; + switch (tagTypeID) + { + case EnumTagTypeID.BOOL: + tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString(); + break; + default: + tagValue = msgEvent.TagValue.ToString(); + break; + } + switch (tagTypeCodeID) + { + case 14: + DeviceHeartBeat(tagValue); + break; + // AGV任务 + case 50: + publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue); + break; + // 51 空闲(请求上料) + // 52 完成(请求下料) + // 53 故障 + case 51: + case 52: + case 53: + publicCore.SolveDeviceStatus(OpNameCurrent); + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + break; + // 54 第几个件 + case 54: + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + // 55 第几个孔 + case 55: + publicCore.MeasurePositionChange(OpNameCurrent, 2); + SolvePicAndMeasureValueWorking(); + break; + //读电批 + case 56: + if (tagValue == "1") + { + publicCore.LogInsert("OP40", "Info", "【PLC_读电批置位】"); + // 不在这个地方写true,写在接收数据的地方写 + + } + else + { + publicCore.LogInsert("OP40", "Info", "【PLC_读电批复位】"); + MesWorkForm.WritePLC(83, OpNameCurrent, false); + publicCore.LogInsert("OP40", "Info", "【IPC_读电批完成复位】"); + } + break; + //读泄漏量1 2或者压力 + case 59: + if (tagValue == "1") + { + publicCore.ReadQualityData_LeakageRate(OpNameCurrent); + //publicCore.ReadQualityData_Pressure(OpNameCurrent); + MesWorkForm.WritePLC(84, OpNameCurrent, true); + } + else + { + MesWorkForm.WritePLC(84, OpNameCurrent, false); + } + break; + } + } + catch (Exception ex) + { + } + } + /// + /// 初始化界面显示 + /// + private void SolvePicAndMeasureValueInit() + { + try + { + dicStartMasurePictureBox.Add(1, pictureBox2_start_1); + dicStartMasurePictureBox.Add(2, pictureBox2_start_2); + dicStartMasurePictureBox.Add(3, pictureBox2_start_3); + dicStartMasurePictureBox.Add(4, pictureBox2_start_4); + dicStartMasurePictureBox.Add(5, pictureBox2_start_5); + dicStartMasurePictureBox.Add(6, pictureBox2_start_6); + dicStartMasurePictureBox.Add(7, pictureBox2_start_7); + dicStartMasurePictureBox.Add(8, pictureBox2_start_8); + dicStartMasurePictureBox.Add(9, pictureBox2_start_9); + + dicEndMasurePictureBox.Add(1, pictureBox12_end_1); + dicEndMasurePictureBox.Add(2, pictureBox12_end_2); + dicEndMasurePictureBox.Add(3, pictureBox12_end_3); + dicEndMasurePictureBox.Add(4, pictureBox12_end_4); + dicEndMasurePictureBox.Add(5, pictureBox12_end_5); + dicEndMasurePictureBox.Add(6, pictureBox12_end_6); + dicEndMasurePictureBox.Add(7, pictureBox12_end_7); + dicEndMasurePictureBox.Add(8, pictureBox12_end_8); + dicEndMasurePictureBox.Add(9, pictureBox12_end_9); + + dicMeasureTextBox.Add(1, textBox_MeasureValue_1); + dicMeasureTextBox.Add(2, textBox_MeasureValue_2); + dicMeasureTextBox.Add(3, textBox_MeasureValue_3); + dicMeasureTextBox.Add(4, textBox_MeasureValue_4); + dicMeasureTextBox.Add(5, textBox_MeasureValue_5); + dicMeasureTextBox.Add(6, textBox_MeasureValue_6); + dicMeasureTextBox.Add(7, textBox_MeasureValue_7); + dicMeasureTextBox.Add(8, textBox_MeasureValue_8); + dicMeasureTextBox.Add(9, textBox_MeasureValue_9); + + + foreach (var item in dicStartMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicEndMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicMeasureTextBox) + { + item.Value.Text = ""; + } + + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "1") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 工作时界面显示 + /// + private void SolvePicAndMeasureValueWorking() + { + try + { + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "2") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 界面产品编码和装配位置的显示 + /// + public void ProductInfo_search() + { + try + { + //textBox1_EngineID.Text = ""; + //textBox1_PartPosition.Text = ""; + ShowTextBoxControl(textBox1_EngineID, "", Color.White); + ShowTextBoxControl(textBox1_PartPosition, "", Color.White); + int PartPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White); + ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White); + //textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString(); + //textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString(); + } + } + catch (Exception err) + { + } + } + private void ShowPicBoxControl(Control c, bool ststus) + { + c.BeginInvoke(new Action(delegate () { + c.Visible = ststus; + })); + } + private void ShowTextBoxControl(Control c, string value, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.Text = value; + c.BackColor = color; + })); + } + private void ShowLabelControl(Control c, Color color) + { + //if (c.InvokeRequired) + //{ + + //} + //else + //{ + // c.ForeColor = color; + //} + c.BeginInvoke(new Action(delegate () { + c.ForeColor = color; + })); + } + private void ShowButtonControl(Control c, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.BackColor = color; + })); + } + + + /// + /// 初始化设备状态 + /// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警 + /// + private void SolveDeviceStatusInit(string currentStatus) + { + try + { + ShowButtonControl(button_running, Color.Gray); + ShowButtonControl(button_finished, Color.Gray); + ShowButtonControl(button_empty, Color.Gray); + ShowButtonControl(button_alarm, Color.Gray); + //button_running.BackColor = Color.Gray; + //button_finished.BackColor = Color.Gray; + //button_empty.BackColor = Color.Gray; + //button_alarm.BackColor = Color.Gray; + + if (currentStatus == "1") + { + ShowButtonControl(button_running, Color.Green); + //button_running.BackColor = Color.Green; + } + else if (currentStatus == "2") + { + ShowButtonControl(button_empty, Color.SkyBlue); + + //button_empty.BackColor = Color.SkyBlue; + } + else if (currentStatus == "3") + { + ShowButtonControl(button_finished, Color.DarkOrange); + + //button_finished.BackColor = Color.DarkOrange; + } + else if (currentStatus == "4") + { + ShowButtonControl(button_alarm, Color.Red); + + //button_alarm.BackColor = Color.Red; + } + } + catch (Exception err) + { + + } + } + /// + /// AGV设备状态显示 + /// + /// + private void SolveAgvDeviceStatus(string PLC_AgvTaskNum) + { + try + { + // 77 反馈AGV任务 + switch (PLC_AgvTaskNum) + { + case "10": + // AGV触发装配任务 正在送料 + //label_AgvSongliao.ForeColor = Color.Green; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Black; + + ShowLabelControl(label_AgvSongliao, Color.Green); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Black); + + + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + + break; + case "11": + + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + + //label_AgvRequestEnter.ForeColor = Color.Green; + //label_AgvRequestLeave.ForeColor = Color.Black; + break; + // 允许AGV进行上料 --允许进入 + // 允许AGV进行下料 --允许进入 + case "2": + case "4": + ShowLabelControl(label_AgvCanEnter, Color.Green); + ShowLabelControl(label_AgvCanLeave, Color.Black); + //label_AgvCanEnter.ForeColor = Color.Green; + //label_AgvCanLeave.ForeColor = Color.Black; + break; + case "21": + // AGV 上料完成 + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Green; + break; + case "3": + // 1.调用FSS-接收IPC下料请求的接口 + // 2.反馈任务号:30 AGV已呼叫成功正在去往下料区 + break; + case "31": + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Green); + //label_AgvRequestEnter.ForeColor = Color.Black; + //label_AgvRequestLeave.ForeColor = Color.Green; + // AGV已到达下料区 + break; + case "41": + // AGV下料完成 + break; + // 允许AGV离开 + case "5": + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Green); + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Green; + break; + case "51": + //label_AgvSongliao.ForeColor = Color.Black; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Green; + ShowLabelControl(label_AgvSongliao, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Green); + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + } + + + } + catch (Exception err) + { + } + } + + /// + /// 设备PLC心跳button5_heartBeat_Ning + /// + /// + private void DeviceHeartBeat(string tagValue) + { + WritePLC(15, OpNameCurrent, tagValue); + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat, Color.Green); + + //button5_heartBeat.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat, Color.Gray); + + //button5_heartBeat.BackColor = Color.Gray; + } + } + /// + /// 设备PLC心跳 + /// + /// + private void DeviceHeartBeat_NingJinQiang(string tagValue) + { + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat_Ning, Color.Green); + + //button5_heartBeat_Ning.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat_Ning, Color.Red); + + //button5_heartBeat_Ning.BackColor = Color.Red; + } + } + + + + private void MoNiHeartBeat() + { + bool tv = false; + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + WritePLC(14, OpNameCurrent, tv); + tv = !tv; + } + catch (Exception err) { + } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + } + + private void label5_Click(object sender, EventArgs e) + { + + } + + private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/CCYQ_JieFang/OP/OP40/DAS_OP40.resx b/CCYQ_JieFang/OP/OP40/DAS_OP40.resx new file mode 100644 index 0000000..55f2584 --- /dev/null +++ b/CCYQ_JieFang/OP/OP40/DAS_OP40.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 432, 221 + + + 573, 221 + + + 33 + + + + + AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz + UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC + QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm + Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX + dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT + PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0 + F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd + 0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI + Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg + gg== + + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP50/DAS_OP50.Designer.cs b/CCYQ_JieFang/OP/OP50/DAS_OP50.Designer.cs new file mode 100644 index 0000000..8f35ab3 --- /dev/null +++ b/CCYQ_JieFang/OP/OP50/DAS_OP50.Designer.cs @@ -0,0 +1,1179 @@ +namespace MesWork +{ + partial class DAS_OP50: PlcLinkForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DAS_OP50)); + this.timHSCZ = new System.Windows.Forms.Timer(this.components); + this.label9 = new System.Windows.Forms.Label(); + this.timUI = new System.Windows.Forms.Timer(this.components); + this.labelTime = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.panel7 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.textBox_MeasureValue_3 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_2 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_4 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_1 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_7 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_6 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_5 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_12 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_11 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_10 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_9 = new System.Windows.Forms.TextBox(); + this.textBox_MeasureValue_8 = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label16 = new System.Windows.Forms.Label(); + this.button_running = new System.Windows.Forms.Button(); + this.button_alarm = new System.Windows.Forms.Button(); + this.button_finished = new System.Windows.Forms.Button(); + this.button_empty = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.label_AgvLeaved = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); + this.label_AgvCanLeave = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.label_AgvRequestLeave = new System.Windows.Forms.Label(); + this.button5_heartBeat_Ning = new System.Windows.Forms.Button(); + this.button5_heartBeat = new System.Windows.Forms.Button(); + this.label_AgvCanEnter = new System.Windows.Forms.Label(); + this.textBox1_PartPosition = new System.Windows.Forms.TextBox(); + this.label_AgvSongliao = new System.Windows.Forms.Label(); + this.label_AgvRequestEnter = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.textBox1_EngineID = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.pictureBox12_end_9 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_9 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_10 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_4 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_12 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_11 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_2 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_12 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_11 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_10 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_3 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_1 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_8 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_7 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_6 = new System.Windows.Forms.PictureBox(); + this.pictureBox12_end_5 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_4 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_5 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_6 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_7 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_8 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_3 = new System.Windows.Forms.PictureBox(); + this.pictureBox2_start_1 = new System.Windows.Forms.PictureBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.panel7.SuspendLayout(); + this.panel3.SuspendLayout(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_9)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_9)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_10)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_12)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_11)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_12)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_11)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_10)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_4)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_5)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_6)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_7)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_8)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // timHSCZ + // + this.timHSCZ.Enabled = true; + // + // label9 + // + this.label9.Font = new System.Drawing.Font("微软雅黑", 15.75F, System.Drawing.FontStyle.Bold); + this.label9.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label9.Location = new System.Drawing.Point(-153, -198); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(771, 60); + this.label9.TabIndex = 22; + this.label9.Text = "微型减速机"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // timUI + // + this.timUI.Enabled = true; + // + // labelTime + // + this.labelTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F); + this.labelTime.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelTime.Location = new System.Drawing.Point(1010, -198); + this.labelTime.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.labelTime.Name = "labelTime"; + this.labelTime.Size = new System.Drawing.Size(728, 69); + this.labelTime.TabIndex = 23; + this.labelTime.Text = "2021-03-09 12:30:30"; + this.labelTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // label18 + // + this.label18.BackColor = System.Drawing.Color.Transparent; + this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label18.Cursor = System.Windows.Forms.Cursors.Hand; + this.label18.Font = new System.Drawing.Font("微软雅黑", 10.5F); + this.label18.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.label18.Location = new System.Drawing.Point(212, 212); + this.label18.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(104, 64); + this.label18.TabIndex = 1; + this.label18.Text = "查询"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label18.Visible = false; + // + // panel7 + // + this.panel7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.panel7.Controls.Add(this.label18); + this.panel7.Location = new System.Drawing.Point(-162, -134); + this.panel7.Margin = new System.Windows.Forms.Padding(4); + this.panel7.Name = "panel7"; + this.panel7.Size = new System.Drawing.Size(1899, 82); + this.panel7.TabIndex = 24; + // + // panel3 + // + this.panel3.Controls.Add(this.pictureBox12_end_9); + this.panel3.Controls.Add(this.pictureBox2_start_9); + this.panel3.Controls.Add(this.textBox_MeasureValue_3); + this.panel3.Controls.Add(this.textBox_MeasureValue_2); + this.panel3.Controls.Add(this.textBox_MeasureValue_4); + this.panel3.Controls.Add(this.textBox_MeasureValue_1); + this.panel3.Controls.Add(this.textBox_MeasureValue_7); + this.panel3.Controls.Add(this.textBox_MeasureValue_6); + this.panel3.Controls.Add(this.textBox_MeasureValue_5); + this.panel3.Controls.Add(this.textBox_MeasureValue_12); + this.panel3.Controls.Add(this.textBox_MeasureValue_11); + this.panel3.Controls.Add(this.textBox_MeasureValue_10); + this.panel3.Controls.Add(this.textBox_MeasureValue_9); + this.panel3.Controls.Add(this.textBox_MeasureValue_8); + this.panel3.Controls.Add(this.pictureBox12_end_10); + this.panel3.Controls.Add(this.pictureBox12_end_4); + this.panel3.Controls.Add(this.pictureBox12_end_2); + this.panel3.Controls.Add(this.pictureBox12_end_12); + this.panel3.Controls.Add(this.pictureBox12_end_11); + this.panel3.Controls.Add(this.pictureBox2_start_2); + this.panel3.Controls.Add(this.pictureBox2_start_12); + this.panel3.Controls.Add(this.pictureBox2_start_11); + this.panel3.Controls.Add(this.pictureBox2_start_10); + this.panel3.Controls.Add(this.pictureBox12_end_3); + this.panel3.Controls.Add(this.pictureBox12_end_1); + this.panel3.Controls.Add(this.pictureBox12_end_8); + this.panel3.Controls.Add(this.pictureBox12_end_7); + this.panel3.Controls.Add(this.pictureBox12_end_6); + this.panel3.Controls.Add(this.pictureBox12_end_5); + this.panel3.Controls.Add(this.pictureBox2_start_4); + this.panel3.Controls.Add(this.pictureBox2_start_5); + this.panel3.Controls.Add(this.pictureBox2_start_6); + this.panel3.Controls.Add(this.pictureBox2_start_7); + this.panel3.Controls.Add(this.pictureBox2_start_8); + this.panel3.Controls.Add(this.label6); + this.panel3.Controls.Add(this.label4); + this.panel3.Controls.Add(this.label5); + this.panel3.Controls.Add(this.label10); + this.panel3.Controls.Add(this.pictureBox2_start_3); + this.panel3.Controls.Add(this.label14); + this.panel3.Controls.Add(this.label8); + this.panel3.Controls.Add(this.label13); + this.panel3.Controls.Add(this.label3); + this.panel3.Controls.Add(this.label12); + this.panel3.Controls.Add(this.label7); + this.panel3.Controls.Add(this.label11); + this.panel3.Controls.Add(this.pictureBox2_start_1); + this.panel3.Controls.Add(this.label2); + this.panel3.Controls.Add(this.pictureBox1); + this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel3.Location = new System.Drawing.Point(3, 93); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1989, 820); + this.panel3.TabIndex = 4; + // + // textBox_MeasureValue_3 + // + this.textBox_MeasureValue_3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_3.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_3.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_3.Location = new System.Drawing.Point(1738, 513); + this.textBox_MeasureValue_3.Name = "textBox_MeasureValue_3"; + this.textBox_MeasureValue_3.ReadOnly = true; + this.textBox_MeasureValue_3.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_3.TabIndex = 4; + this.textBox_MeasureValue_3.Text = "0"; + // + // textBox_MeasureValue_2 + // + this.textBox_MeasureValue_2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_2.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_2.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_2.Location = new System.Drawing.Point(280, 513); + this.textBox_MeasureValue_2.Name = "textBox_MeasureValue_2"; + this.textBox_MeasureValue_2.ReadOnly = true; + this.textBox_MeasureValue_2.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_2.TabIndex = 4; + this.textBox_MeasureValue_2.Text = "0"; + // + // textBox_MeasureValue_4 + // + this.textBox_MeasureValue_4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_4.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_4.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_4.Location = new System.Drawing.Point(280, 314); + this.textBox_MeasureValue_4.Name = "textBox_MeasureValue_4"; + this.textBox_MeasureValue_4.ReadOnly = true; + this.textBox_MeasureValue_4.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_4.TabIndex = 4; + this.textBox_MeasureValue_4.Text = "0"; + // + // textBox_MeasureValue_1 + // + this.textBox_MeasureValue_1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_1.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_1.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_1.Location = new System.Drawing.Point(1738, 314); + this.textBox_MeasureValue_1.Name = "textBox_MeasureValue_1"; + this.textBox_MeasureValue_1.ReadOnly = true; + this.textBox_MeasureValue_1.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_1.TabIndex = 4; + this.textBox_MeasureValue_1.Text = "0"; + // + // textBox_MeasureValue_7 + // + this.textBox_MeasureValue_7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_7.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_7.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_7.Location = new System.Drawing.Point(1118, 8); + this.textBox_MeasureValue_7.Name = "textBox_MeasureValue_7"; + this.textBox_MeasureValue_7.ReadOnly = true; + this.textBox_MeasureValue_7.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_7.TabIndex = 4; + this.textBox_MeasureValue_7.Text = "0"; + // + // textBox_MeasureValue_6 + // + this.textBox_MeasureValue_6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_6.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_6.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_6.Location = new System.Drawing.Point(903, 8); + this.textBox_MeasureValue_6.Name = "textBox_MeasureValue_6"; + this.textBox_MeasureValue_6.ReadOnly = true; + this.textBox_MeasureValue_6.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_6.TabIndex = 4; + this.textBox_MeasureValue_6.Text = "0"; + // + // textBox_MeasureValue_5 + // + this.textBox_MeasureValue_5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_5.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_5.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_5.Location = new System.Drawing.Point(692, 8); + this.textBox_MeasureValue_5.Name = "textBox_MeasureValue_5"; + this.textBox_MeasureValue_5.ReadOnly = true; + this.textBox_MeasureValue_5.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_5.TabIndex = 4; + this.textBox_MeasureValue_5.Text = "0"; + // + // textBox_MeasureValue_12 + // + this.textBox_MeasureValue_12.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_12.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_12.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_12.Location = new System.Drawing.Point(704, 771); + this.textBox_MeasureValue_12.Name = "textBox_MeasureValue_12"; + this.textBox_MeasureValue_12.ReadOnly = true; + this.textBox_MeasureValue_12.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_12.TabIndex = 4; + this.textBox_MeasureValue_12.Text = "0"; + // + // textBox_MeasureValue_11 + // + this.textBox_MeasureValue_11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_11.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_11.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_11.Location = new System.Drawing.Point(915, 771); + this.textBox_MeasureValue_11.Name = "textBox_MeasureValue_11"; + this.textBox_MeasureValue_11.ReadOnly = true; + this.textBox_MeasureValue_11.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_11.TabIndex = 4; + this.textBox_MeasureValue_11.Text = "0"; + // + // textBox_MeasureValue_10 + // + this.textBox_MeasureValue_10.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_10.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_10.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_10.Location = new System.Drawing.Point(1130, 771); + this.textBox_MeasureValue_10.Name = "textBox_MeasureValue_10"; + this.textBox_MeasureValue_10.ReadOnly = true; + this.textBox_MeasureValue_10.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_10.TabIndex = 4; + this.textBox_MeasureValue_10.Text = "0"; + // + // textBox_MeasureValue_9 + // + this.textBox_MeasureValue_9.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_9.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_9.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_9.Location = new System.Drawing.Point(1354, 771); + this.textBox_MeasureValue_9.Name = "textBox_MeasureValue_9"; + this.textBox_MeasureValue_9.ReadOnly = true; + this.textBox_MeasureValue_9.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_9.TabIndex = 4; + this.textBox_MeasureValue_9.Text = "0"; + // + // textBox_MeasureValue_8 + // + this.textBox_MeasureValue_8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox_MeasureValue_8.Font = new System.Drawing.Font("宋体", 15F); + this.textBox_MeasureValue_8.ForeColor = System.Drawing.SystemColors.ControlText; + this.textBox_MeasureValue_8.Location = new System.Drawing.Point(1342, 8); + this.textBox_MeasureValue_8.Name = "textBox_MeasureValue_8"; + this.textBox_MeasureValue_8.ReadOnly = true; + this.textBox_MeasureValue_8.Size = new System.Drawing.Size(118, 42); + this.textBox_MeasureValue_8.TabIndex = 4; + this.textBox_MeasureValue_8.Text = "0"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.BackColor = System.Drawing.Color.White; + this.label6.Font = new System.Drawing.Font("宋体", 15F); + this.label6.Location = new System.Drawing.Point(274, 480); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(73, 30); + this.label6.TabIndex = 6; + this.label6.Text = "扭矩"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.BackColor = System.Drawing.Color.White; + this.label4.Font = new System.Drawing.Font("宋体", 15F); + this.label4.Location = new System.Drawing.Point(1732, 480); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(73, 30); + this.label4.TabIndex = 6; + this.label4.Text = "扭矩"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.BackColor = System.Drawing.Color.White; + this.label5.Font = new System.Drawing.Font("宋体", 15F); + this.label5.Location = new System.Drawing.Point(274, 280); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(73, 30); + this.label5.TabIndex = 6; + this.label5.Text = "扭矩"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.BackColor = System.Drawing.Color.White; + this.label10.Font = new System.Drawing.Font("宋体", 15F); + this.label10.Location = new System.Drawing.Point(1038, 10); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(73, 30); + this.label10.TabIndex = 6; + this.label10.Text = "扭矩"; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.BackColor = System.Drawing.Color.White; + this.label14.Font = new System.Drawing.Font("宋体", 15F); + this.label14.Location = new System.Drawing.Point(624, 777); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(73, 30); + this.label14.TabIndex = 6; + this.label14.Text = "扭矩"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.BackColor = System.Drawing.Color.White; + this.label8.Font = new System.Drawing.Font("宋体", 15F); + this.label8.Location = new System.Drawing.Point(824, 10); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(73, 30); + this.label8.TabIndex = 6; + this.label8.Text = "扭矩"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.BackColor = System.Drawing.Color.White; + this.label13.Font = new System.Drawing.Font("宋体", 15F); + this.label13.Location = new System.Drawing.Point(836, 777); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(73, 30); + this.label13.TabIndex = 6; + this.label13.Text = "扭矩"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.BackColor = System.Drawing.Color.White; + this.label3.Font = new System.Drawing.Font("宋体", 15F); + this.label3.Location = new System.Drawing.Point(1732, 280); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(73, 30); + this.label3.TabIndex = 6; + this.label3.Text = "扭矩"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.BackColor = System.Drawing.Color.White; + this.label12.Font = new System.Drawing.Font("宋体", 15F); + this.label12.Location = new System.Drawing.Point(1050, 777); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(73, 30); + this.label12.TabIndex = 6; + this.label12.Text = "扭矩"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.BackColor = System.Drawing.Color.White; + this.label7.Font = new System.Drawing.Font("宋体", 15F); + this.label7.Location = new System.Drawing.Point(612, 10); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(73, 30); + this.label7.TabIndex = 6; + this.label7.Text = "扭矩"; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.BackColor = System.Drawing.Color.White; + this.label11.Font = new System.Drawing.Font("宋体", 15F); + this.label11.Location = new System.Drawing.Point(1275, 777); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(73, 30); + this.label11.TabIndex = 6; + this.label11.Text = "扭矩"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.White; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(1263, 14); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(73, 30); + this.label2.TabIndex = 6; + this.label2.Text = "扭矩"; + // + // panel1 + // + this.panel1.Controls.Add(this.label16); + this.panel1.Controls.Add(this.button_running); + this.panel1.Controls.Add(this.button_alarm); + this.panel1.Controls.Add(this.button_finished); + this.panel1.Controls.Add(this.button_empty); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 919); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(1989, 84); + this.panel1.TabIndex = 3; + // + // label16 + // + this.label16.BackColor = System.Drawing.Color.Black; + this.label16.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label16.Location = new System.Drawing.Point(0, 4); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(1980, 4); + this.label16.TabIndex = 10; + // + // button_running + // + this.button_running.BackColor = System.Drawing.Color.Gray; + this.button_running.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_running.Font = new System.Drawing.Font("宋体", 12F); + this.button_running.ForeColor = System.Drawing.Color.White; + this.button_running.Location = new System.Drawing.Point(38, 15); + this.button_running.Name = "button_running"; + this.button_running.Size = new System.Drawing.Size(333, 66); + this.button_running.TabIndex = 4; + this.button_running.Text = "设备运行(禁止上下料)"; + this.button_running.UseVisualStyleBackColor = false; + // + // button_alarm + // + this.button_alarm.BackColor = System.Drawing.Color.Gray; + this.button_alarm.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_alarm.Font = new System.Drawing.Font("宋体", 12F); + this.button_alarm.ForeColor = System.Drawing.Color.White; + this.button_alarm.Location = new System.Drawing.Point(1252, 16); + this.button_alarm.Name = "button_alarm"; + this.button_alarm.Size = new System.Drawing.Size(333, 66); + this.button_alarm.TabIndex = 5; + this.button_alarm.Text = "设备故障"; + this.button_alarm.UseVisualStyleBackColor = false; + // + // button_finished + // + this.button_finished.BackColor = System.Drawing.Color.Gray; + this.button_finished.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_finished.Font = new System.Drawing.Font("宋体", 12F); + this.button_finished.ForeColor = System.Drawing.Color.White; + this.button_finished.Location = new System.Drawing.Point(442, 15); + this.button_finished.Name = "button_finished"; + this.button_finished.Size = new System.Drawing.Size(333, 66); + this.button_finished.TabIndex = 6; + this.button_finished.Text = "完成装配(请求下料)"; + this.button_finished.UseVisualStyleBackColor = false; + // + // button_empty + // + this.button_empty.BackColor = System.Drawing.Color.Gray; + this.button_empty.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button_empty.Font = new System.Drawing.Font("宋体", 12F); + this.button_empty.ForeColor = System.Drawing.Color.White; + this.button_empty.Location = new System.Drawing.Point(848, 16); + this.button_empty.Name = "button_empty"; + this.button_empty.Size = new System.Drawing.Size(333, 66); + this.button_empty.TabIndex = 7; + this.button_empty.Text = "设备空闲(请求上料)"; + this.button_empty.UseVisualStyleBackColor = false; + // + // panel2 + // + this.panel2.Controls.Add(this.label_AgvLeaved); + this.panel2.Controls.Add(this.label19); + this.panel2.Controls.Add(this.label_AgvCanLeave); + this.panel2.Controls.Add(this.label15); + this.panel2.Controls.Add(this.label_AgvRequestLeave); + this.panel2.Controls.Add(this.button5_heartBeat_Ning); + this.panel2.Controls.Add(this.button5_heartBeat); + this.panel2.Controls.Add(this.label_AgvCanEnter); + this.panel2.Controls.Add(this.textBox1_PartPosition); + this.panel2.Controls.Add(this.label_AgvSongliao); + this.panel2.Controls.Add(this.label_AgvRequestEnter); + this.panel2.Controls.Add(this.label17); + this.panel2.Controls.Add(this.textBox1_EngineID); + this.panel2.Controls.Add(this.label1); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(3, 3); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1989, 84); + this.panel2.TabIndex = 2; + // + // label_AgvLeaved + // + this.label_AgvLeaved.AutoSize = true; + this.label_AgvLeaved.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvLeaved.Location = new System.Drawing.Point(1393, 12); + this.label_AgvLeaved.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvLeaved.Name = "label_AgvLeaved"; + this.label_AgvLeaved.Size = new System.Drawing.Size(153, 22); + this.label_AgvLeaved.TabIndex = 9; + this.label_AgvLeaved.Text = "●AGV已经离开"; + // + // label19 + // + this.label19.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label19.Location = new System.Drawing.Point(1756, 16); + this.label19.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(2, 44); + this.label19.TabIndex = 9; + // + // label_AgvCanLeave + // + this.label_AgvCanLeave.AutoSize = true; + this.label_AgvCanLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanLeave.Location = new System.Drawing.Point(1225, 45); + this.label_AgvCanLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanLeave.Name = "label_AgvCanLeave"; + this.label_AgvCanLeave.Size = new System.Drawing.Size(153, 22); + this.label_AgvCanLeave.TabIndex = 9; + this.label_AgvCanLeave.Text = "●AGV可以离开"; + // + // label15 + // + this.label15.BackColor = System.Drawing.Color.Black; + this.label15.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.label15.Location = new System.Drawing.Point(0, 75); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(1980, 4); + this.label15.TabIndex = 9; + // + // label_AgvRequestLeave + // + this.label_AgvRequestLeave.AutoSize = true; + this.label_AgvRequestLeave.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestLeave.Location = new System.Drawing.Point(1225, 12); + this.label_AgvRequestLeave.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestLeave.Name = "label_AgvRequestLeave"; + this.label_AgvRequestLeave.Size = new System.Drawing.Size(153, 22); + this.label_AgvRequestLeave.TabIndex = 9; + this.label_AgvRequestLeave.Text = "●AGV请求离开"; + // + // button5_heartBeat_Ning + // + this.button5_heartBeat_Ning.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat_Ning.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat_Ning.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat_Ning.Location = new System.Drawing.Point(1765, 12); + this.button5_heartBeat_Ning.Name = "button5_heartBeat_Ning"; + this.button5_heartBeat_Ning.Size = new System.Drawing.Size(100, 52); + this.button5_heartBeat_Ning.TabIndex = 5; + this.button5_heartBeat_Ning.Text = "拧紧枪"; + this.button5_heartBeat_Ning.UseVisualStyleBackColor = false; + // + // button5_heartBeat + // + this.button5_heartBeat.BackColor = System.Drawing.Color.Gray; + this.button5_heartBeat.Font = new System.Drawing.Font("宋体", 12F); + this.button5_heartBeat.ForeColor = System.Drawing.Color.White; + this.button5_heartBeat.Location = new System.Drawing.Point(1883, 12); + this.button5_heartBeat.Name = "button5_heartBeat"; + this.button5_heartBeat.Size = new System.Drawing.Size(100, 52); + this.button5_heartBeat.TabIndex = 5; + this.button5_heartBeat.Text = "PLC"; + this.button5_heartBeat.UseVisualStyleBackColor = false; + // + // label_AgvCanEnter + // + this.label_AgvCanEnter.AutoSize = true; + this.label_AgvCanEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvCanEnter.Location = new System.Drawing.Point(1043, 45); + this.label_AgvCanEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvCanEnter.Name = "label_AgvCanEnter"; + this.label_AgvCanEnter.Size = new System.Drawing.Size(153, 22); + this.label_AgvCanEnter.TabIndex = 9; + this.label_AgvCanEnter.Text = "●AGV可以进入"; + // + // textBox1_PartPosition + // + this.textBox1_PartPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_PartPosition.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_PartPosition.Location = new System.Drawing.Point(692, 9); + this.textBox1_PartPosition.Name = "textBox1_PartPosition"; + this.textBox1_PartPosition.ReadOnly = true; + this.textBox1_PartPosition.Size = new System.Drawing.Size(118, 53); + this.textBox1_PartPosition.TabIndex = 1; + // + // label_AgvSongliao + // + this.label_AgvSongliao.AutoSize = true; + this.label_AgvSongliao.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvSongliao.Location = new System.Drawing.Point(883, 14); + this.label_AgvSongliao.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvSongliao.Name = "label_AgvSongliao"; + this.label_AgvSongliao.Size = new System.Drawing.Size(153, 22); + this.label_AgvSongliao.TabIndex = 9; + this.label_AgvSongliao.Text = "●AGV准备送料"; + // + // label_AgvRequestEnter + // + this.label_AgvRequestEnter.AutoSize = true; + this.label_AgvRequestEnter.Font = new System.Drawing.Font("宋体", 11F); + this.label_AgvRequestEnter.Location = new System.Drawing.Point(1043, 12); + this.label_AgvRequestEnter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label_AgvRequestEnter.Name = "label_AgvRequestEnter"; + this.label_AgvRequestEnter.Size = new System.Drawing.Size(153, 22); + this.label_AgvRequestEnter.TabIndex = 9; + this.label_AgvRequestEnter.Text = "●AGV请求进入"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Font = new System.Drawing.Font("宋体", 16F); + this.label17.Location = new System.Drawing.Point(525, 18); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(175, 33); + this.label17.TabIndex = 0; + this.label17.Text = "装配位置:"; + // + // textBox1_EngineID + // + this.textBox1_EngineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.textBox1_EngineID.Font = new System.Drawing.Font("宋体", 20F); + this.textBox1_EngineID.Location = new System.Drawing.Point(170, 10); + this.textBox1_EngineID.Name = "textBox1_EngineID"; + this.textBox1_EngineID.ReadOnly = true; + this.textBox1_EngineID.Size = new System.Drawing.Size(348, 53); + this.textBox1_EngineID.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 16F); + this.label1.Location = new System.Drawing.Point(3, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(175, 33); + this.label1.TabIndex = 0; + this.label1.Text = "产品编码:"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.panel3, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 90F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1995, 1006); + this.tableLayoutPanel1.TabIndex = 25; + // + // pictureBox12_end_9 + // + this.pictureBox12_end_9.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_9.Location = new System.Drawing.Point(1335, 544); + this.pictureBox12_end_9.Name = "pictureBox12_end_9"; + this.pictureBox12_end_9.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_9.TabIndex = 8; + this.pictureBox12_end_9.TabStop = false; + // + // pictureBox2_start_9 + // + this.pictureBox2_start_9.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_9.Location = new System.Drawing.Point(1335, 543); + this.pictureBox2_start_9.Name = "pictureBox2_start_9"; + this.pictureBox2_start_9.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_9.TabIndex = 8; + this.pictureBox2_start_9.TabStop = false; + // + // pictureBox12_end_10 + // + this.pictureBox12_end_10.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_10.Location = new System.Drawing.Point(1184, 544); + this.pictureBox12_end_10.Name = "pictureBox12_end_10"; + this.pictureBox12_end_10.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_10.TabIndex = 8; + this.pictureBox12_end_10.TabStop = false; + // + // pictureBox12_end_4 + // + this.pictureBox12_end_4.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_4.Location = new System.Drawing.Point(574, 345); + this.pictureBox12_end_4.Name = "pictureBox12_end_4"; + this.pictureBox12_end_4.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_4.TabIndex = 8; + this.pictureBox12_end_4.TabStop = false; + // + // pictureBox12_end_2 + // + this.pictureBox12_end_2.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_2.Location = new System.Drawing.Point(574, 448); + this.pictureBox12_end_2.Name = "pictureBox12_end_2"; + this.pictureBox12_end_2.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_2.TabIndex = 8; + this.pictureBox12_end_2.TabStop = false; + // + // pictureBox12_end_12 + // + this.pictureBox12_end_12.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_12.Location = new System.Drawing.Point(740, 544); + this.pictureBox12_end_12.Name = "pictureBox12_end_12"; + this.pictureBox12_end_12.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_12.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_12.TabIndex = 8; + this.pictureBox12_end_12.TabStop = false; + // + // pictureBox12_end_11 + // + this.pictureBox12_end_11.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_11.Location = new System.Drawing.Point(969, 544); + this.pictureBox12_end_11.Name = "pictureBox12_end_11"; + this.pictureBox12_end_11.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_11.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_11.TabIndex = 8; + this.pictureBox12_end_11.TabStop = false; + // + // pictureBox2_start_2 + // + this.pictureBox2_start_2.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_2.Location = new System.Drawing.Point(576, 447); + this.pictureBox2_start_2.Name = "pictureBox2_start_2"; + this.pictureBox2_start_2.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_2.TabIndex = 8; + this.pictureBox2_start_2.TabStop = false; + // + // pictureBox2_start_12 + // + this.pictureBox2_start_12.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_12.Location = new System.Drawing.Point(740, 543); + this.pictureBox2_start_12.Name = "pictureBox2_start_12"; + this.pictureBox2_start_12.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_12.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_12.TabIndex = 8; + this.pictureBox2_start_12.TabStop = false; + // + // pictureBox2_start_11 + // + this.pictureBox2_start_11.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_11.Location = new System.Drawing.Point(969, 543); + this.pictureBox2_start_11.Name = "pictureBox2_start_11"; + this.pictureBox2_start_11.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_11.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_11.TabIndex = 8; + this.pictureBox2_start_11.TabStop = false; + // + // pictureBox2_start_10 + // + this.pictureBox2_start_10.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_10.Location = new System.Drawing.Point(1184, 543); + this.pictureBox2_start_10.Name = "pictureBox2_start_10"; + this.pictureBox2_start_10.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_10.TabIndex = 8; + this.pictureBox2_start_10.TabStop = false; + // + // pictureBox12_end_3 + // + this.pictureBox12_end_3.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_3.Location = new System.Drawing.Point(1503, 448); + this.pictureBox12_end_3.Name = "pictureBox12_end_3"; + this.pictureBox12_end_3.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_3.TabIndex = 8; + this.pictureBox12_end_3.TabStop = false; + // + // pictureBox12_end_1 + // + this.pictureBox12_end_1.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_1.Location = new System.Drawing.Point(1503, 345); + this.pictureBox12_end_1.Name = "pictureBox12_end_1"; + this.pictureBox12_end_1.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_1.TabIndex = 8; + this.pictureBox12_end_1.TabStop = false; + // + // pictureBox12_end_8 + // + this.pictureBox12_end_8.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_8.Location = new System.Drawing.Point(1335, 273); + this.pictureBox12_end_8.Name = "pictureBox12_end_8"; + this.pictureBox12_end_8.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_8.TabIndex = 8; + this.pictureBox12_end_8.TabStop = false; + // + // pictureBox12_end_7 + // + this.pictureBox12_end_7.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_7.Location = new System.Drawing.Point(1184, 273); + this.pictureBox12_end_7.Name = "pictureBox12_end_7"; + this.pictureBox12_end_7.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_7.TabIndex = 8; + this.pictureBox12_end_7.TabStop = false; + // + // pictureBox12_end_6 + // + this.pictureBox12_end_6.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_6.Location = new System.Drawing.Point(969, 273); + this.pictureBox12_end_6.Name = "pictureBox12_end_6"; + this.pictureBox12_end_6.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_6.TabIndex = 8; + this.pictureBox12_end_6.TabStop = false; + // + // pictureBox12_end_5 + // + this.pictureBox12_end_5.Image = global::CCYQ_JieFang.Properties.Resources.green; + this.pictureBox12_end_5.Location = new System.Drawing.Point(724, 273); + this.pictureBox12_end_5.Name = "pictureBox12_end_5"; + this.pictureBox12_end_5.Size = new System.Drawing.Size(64, 64); + this.pictureBox12_end_5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox12_end_5.TabIndex = 8; + this.pictureBox12_end_5.TabStop = false; + // + // pictureBox2_start_4 + // + this.pictureBox2_start_4.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_4.Location = new System.Drawing.Point(574, 344); + this.pictureBox2_start_4.Name = "pictureBox2_start_4"; + this.pictureBox2_start_4.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_4.TabIndex = 8; + this.pictureBox2_start_4.TabStop = false; + // + // pictureBox2_start_5 + // + this.pictureBox2_start_5.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_5.Location = new System.Drawing.Point(724, 273); + this.pictureBox2_start_5.Name = "pictureBox2_start_5"; + this.pictureBox2_start_5.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_5.TabIndex = 8; + this.pictureBox2_start_5.TabStop = false; + // + // pictureBox2_start_6 + // + this.pictureBox2_start_6.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_6.Location = new System.Drawing.Point(969, 273); + this.pictureBox2_start_6.Name = "pictureBox2_start_6"; + this.pictureBox2_start_6.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_6.TabIndex = 8; + this.pictureBox2_start_6.TabStop = false; + // + // pictureBox2_start_7 + // + this.pictureBox2_start_7.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_7.Location = new System.Drawing.Point(1184, 273); + this.pictureBox2_start_7.Name = "pictureBox2_start_7"; + this.pictureBox2_start_7.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_7.TabIndex = 8; + this.pictureBox2_start_7.TabStop = false; + // + // pictureBox2_start_8 + // + this.pictureBox2_start_8.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_8.Location = new System.Drawing.Point(1335, 273); + this.pictureBox2_start_8.Name = "pictureBox2_start_8"; + this.pictureBox2_start_8.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_8.TabIndex = 8; + this.pictureBox2_start_8.TabStop = false; + // + // pictureBox2_start_3 + // + this.pictureBox2_start_3.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_3.Location = new System.Drawing.Point(1503, 447); + this.pictureBox2_start_3.Name = "pictureBox2_start_3"; + this.pictureBox2_start_3.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_3.TabIndex = 8; + this.pictureBox2_start_3.TabStop = false; + // + // pictureBox2_start_1 + // + this.pictureBox2_start_1.Image = global::CCYQ_JieFang.Properties.Resources.StartWorkCircle; + this.pictureBox2_start_1.Location = new System.Drawing.Point(1503, 344); + this.pictureBox2_start_1.Name = "pictureBox2_start_1"; + this.pictureBox2_start_1.Size = new System.Drawing.Size(64, 64); + this.pictureBox2_start_1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox2_start_1.TabIndex = 8; + this.pictureBox2_start_1.TabStop = false; + // + // pictureBox1 + // + this.pictureBox1.BackColor = System.Drawing.Color.White; + this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.pictureBox1.Image = global::CCYQ_JieFang.Properties.Resources._05_微型减速机; + this.pictureBox1.Location = new System.Drawing.Point(130, 16); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(1689, 756); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 0; + this.pictureBox1.TabStop = false; + // + // DAS_OP50 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(1995, 1006); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.label9); + this.Controls.Add(this.labelTime); + this.Controls.Add(this.panel7); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "DAS_OP50"; + this.Text = "OP50工位-微型减速机"; + this.panel7.ResumeLayout(false); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_9)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_9)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_10)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_12)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_11)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_12)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_11)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_10)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12_end_5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_4)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_5)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_6)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_7)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_8)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2_start_1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Timer timHSCZ; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Timer timUI; + private System.Windows.Forms.Label labelTime; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Panel panel7; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.PictureBox pictureBox12_end_9; + private System.Windows.Forms.PictureBox pictureBox2_start_9; + private System.Windows.Forms.TextBox textBox_MeasureValue_3; + private System.Windows.Forms.TextBox textBox_MeasureValue_2; + private System.Windows.Forms.TextBox textBox_MeasureValue_4; + private System.Windows.Forms.TextBox textBox_MeasureValue_1; + private System.Windows.Forms.TextBox textBox_MeasureValue_7; + private System.Windows.Forms.TextBox textBox_MeasureValue_6; + private System.Windows.Forms.TextBox textBox_MeasureValue_5; + private System.Windows.Forms.TextBox textBox_MeasureValue_12; + private System.Windows.Forms.TextBox textBox_MeasureValue_11; + private System.Windows.Forms.TextBox textBox_MeasureValue_10; + private System.Windows.Forms.TextBox textBox_MeasureValue_9; + private System.Windows.Forms.TextBox textBox_MeasureValue_8; + private System.Windows.Forms.PictureBox pictureBox12_end_10; + private System.Windows.Forms.PictureBox pictureBox12_end_4; + private System.Windows.Forms.PictureBox pictureBox12_end_2; + private System.Windows.Forms.PictureBox pictureBox12_end_12; + private System.Windows.Forms.PictureBox pictureBox12_end_11; + private System.Windows.Forms.PictureBox pictureBox2_start_2; + private System.Windows.Forms.PictureBox pictureBox2_start_12; + private System.Windows.Forms.PictureBox pictureBox2_start_11; + private System.Windows.Forms.PictureBox pictureBox2_start_10; + private System.Windows.Forms.PictureBox pictureBox12_end_3; + private System.Windows.Forms.PictureBox pictureBox12_end_1; + private System.Windows.Forms.PictureBox pictureBox12_end_8; + private System.Windows.Forms.PictureBox pictureBox12_end_7; + private System.Windows.Forms.PictureBox pictureBox12_end_6; + private System.Windows.Forms.PictureBox pictureBox12_end_5; + private System.Windows.Forms.PictureBox pictureBox2_start_4; + private System.Windows.Forms.PictureBox pictureBox2_start_5; + private System.Windows.Forms.PictureBox pictureBox2_start_6; + private System.Windows.Forms.PictureBox pictureBox2_start_7; + private System.Windows.Forms.PictureBox pictureBox2_start_8; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.PictureBox pictureBox2_start_3; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.PictureBox pictureBox2_start_1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Button button_running; + private System.Windows.Forms.Button button_alarm; + private System.Windows.Forms.Button button_finished; + private System.Windows.Forms.Button button_empty; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Label label_AgvLeaved; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label_AgvCanLeave; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label_AgvRequestLeave; + private System.Windows.Forms.Button button5_heartBeat; + private System.Windows.Forms.Label label_AgvCanEnter; + private System.Windows.Forms.TextBox textBox1_PartPosition; + private System.Windows.Forms.Label label_AgvRequestEnter; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.TextBox textBox1_EngineID; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label_AgvSongliao; + private System.Windows.Forms.Button button5_heartBeat_Ning; + private System.Windows.Forms.PictureBox pictureBox1; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/OP50/DAS_OP50.cs b/CCYQ_JieFang/OP/OP50/DAS_OP50.cs new file mode 100644 index 0000000..b7cffa2 --- /dev/null +++ b/CCYQ_JieFang/OP/OP50/DAS_OP50.cs @@ -0,0 +1,654 @@ + +using DK_DC_Tool; +using HslCommunication.Core; +using Newtonsoft.Json; +using NPOI.SS.UserModel; +using OpcBasic; +using Robot.Common; +using Serilog.Events; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using SystemFramework; + +namespace MesWork +{ + public partial class DAS_OP50 + { + InitServer initServer = null; + /// + /// + /// + private static string OpNameCurrent = ""; + /// + /// 字典 ,存储12个开始测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicStartMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量图片控件,key为测量位置,value为图片控件 + /// + Dictionary dicEndMasurePictureBox = new Dictionary(); + /// + /// 字典 ,存储12个结束测量文本框控件,key为测量位置,value文本框的值 + /// + Dictionary dicMeasureTextBox = new Dictionary(); + /// + /// PLC事件变化委托 + /// + public static Action MIS_Funtion_PLC_OP = null; + + /// + /// PLC事件变化委托 + /// + public static Action AGV_Task_change = null; + /// + /// PLC事件变化委托--处理托盘信息 + /// + public static Action AGV_Task_Info = null; + + // 每个工位的满工件数量 + // 工位OP50 3个 + public static int partCount = 3; + + public static bool isConnect = false; + + public DAS_OP50(string opName) + { + InitializeComponent(); + + publicCore.partCount = partCount; + OpNameCurrent = opName; + + Tighten.E_DeviceHeartBeat -= DeviceHeartBeat_NingJinQiang; + Tighten.E_DeviceHeartBeat += DeviceHeartBeat_NingJinQiang; + + MesWorkForm.MIS_Funtion_PLC_MeasureFinish -= SolvePicAndMeasureValueWorking; + MesWorkForm.MIS_Funtion_PLC_MeasureFinish += SolvePicAndMeasureValueWorking; + + MIS_Funtion_PLC_OP -= MIS_Funtion_PLC; + MIS_Funtion_PLC_OP += MIS_Funtion_PLC; + + AGV_Task_change -= SolveAgvDeviceStatus; + AGV_Task_change += SolveAgvDeviceStatus; + + + if (MesWorkForm.IsDemoMesServer == 1) + { + MoNiHeartBeat(); + } + SolvePicAndMeasureValueInit(); + + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + } + catch (Exception err) { } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + + //var aa = + //new Thread(new ThreadStart(delegate () { + // while (true) + // { + // try + // { + // if (!isConnect) + // { + // if (publicCore.Get_PartPosition(OpNameCurrent) != -1) + // { + // isConnect = true; + // ProductInfo_search(); + // } + // } + // } + // catch (Exception err) { } + // Thread.Sleep(1000); + // } + //})); + //aa.IsBackground = true; + //aa.Start(); + + } + public void MIS_Funtion_PLC(DeviceDriver_BasicData.CustomeEvetnArgs msgEvent) + { + try + { + var tagID = msgEvent.TagID.ToString(); + // var opName = msgEvent.OpName.ToString(); + var tagTypeCodeID = (int)msgEvent.TagTypeCodeID; + var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID; + string tagValue; + switch (tagTypeID) + { + case EnumTagTypeID.BOOL: + tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString(); + break; + default: + tagValue = msgEvent.TagValue.ToString(); + break; + } + switch (tagTypeCodeID) + { + case 14: + DeviceHeartBeat(tagValue); + break; + // AGV任务 + case 50: + publicCore.SolveAgvTaskNum(OpNameCurrent, tagValue); + break; + // 51 空闲(请求上料) + // 52 完成(请求下料) + // 53 故障 + case 51: + case 52: + case 53: + publicCore.SolveDeviceStatus(OpNameCurrent); + SolveDeviceStatusInit(publicCore.SolveDeviceStatus_Read(OpNameCurrent)); + break; + // 54 第几个件 + case 54: + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + case 55: + publicCore.MeasurePositionChange(OpNameCurrent, 2); + SolvePicAndMeasureValueWorking(); + break; + //读电批 + case 56: + if (tagValue == "1") + { + publicCore.LogInsert("OP50", "Info", "【PLC_读电批置位】"); + // 不在这个地方写true,写在接收数据的地方写 + + } + else + { + publicCore.LogInsert("OP50", "Info", "【PLC_读电批复位】"); + MesWorkForm.WritePLC(83, OpNameCurrent, false); + publicCore.LogInsert("OP50", "Info", "【IPC_读电批完成复位】"); + } + break; + //读泄漏量1 2或者压力 + case 59: + if (tagValue == "1") + { + //publicCore.ReadQualityData_LeakageRate(OpNameCurrent); + //publicCore.ReadQualityData_Pressure(OpNameCurrent); + MesWorkForm.WritePLC(84, OpNameCurrent, true); + } + else + { + MesWorkForm.WritePLC(84, OpNameCurrent, false); + } + break; + } + } + catch (Exception ex) + { + } + } + /// + /// 初始化界面显示 + /// + private void SolvePicAndMeasureValueInit() + { + try + { + dicStartMasurePictureBox.Add(1, pictureBox2_start_1); + dicStartMasurePictureBox.Add(2, pictureBox2_start_2); + dicStartMasurePictureBox.Add(3, pictureBox2_start_3); + dicStartMasurePictureBox.Add(4, pictureBox2_start_4); + dicStartMasurePictureBox.Add(5, pictureBox2_start_5); + dicStartMasurePictureBox.Add(6, pictureBox2_start_6); + dicStartMasurePictureBox.Add(7, pictureBox2_start_7); + dicStartMasurePictureBox.Add(8, pictureBox2_start_8); + dicStartMasurePictureBox.Add(9, pictureBox2_start_9); + dicStartMasurePictureBox.Add(10, pictureBox2_start_10); + dicStartMasurePictureBox.Add(11, pictureBox2_start_11); + dicStartMasurePictureBox.Add(12, pictureBox2_start_12); + + dicEndMasurePictureBox.Add(1, pictureBox12_end_1); + dicEndMasurePictureBox.Add(2, pictureBox12_end_2); + dicEndMasurePictureBox.Add(3, pictureBox12_end_3); + dicEndMasurePictureBox.Add(4, pictureBox12_end_4); + dicEndMasurePictureBox.Add(5, pictureBox12_end_5); + dicEndMasurePictureBox.Add(6, pictureBox12_end_6); + dicEndMasurePictureBox.Add(7, pictureBox12_end_7); + dicEndMasurePictureBox.Add(8, pictureBox12_end_8); + dicEndMasurePictureBox.Add(9, pictureBox12_end_9); + dicEndMasurePictureBox.Add(10, pictureBox12_end_10); + dicEndMasurePictureBox.Add(11, pictureBox12_end_11); + dicEndMasurePictureBox.Add(12, pictureBox12_end_12); + + dicMeasureTextBox.Add(1, textBox_MeasureValue_1); + dicMeasureTextBox.Add(2, textBox_MeasureValue_2); + dicMeasureTextBox.Add(3, textBox_MeasureValue_3); + dicMeasureTextBox.Add(4, textBox_MeasureValue_4); + dicMeasureTextBox.Add(5, textBox_MeasureValue_5); + dicMeasureTextBox.Add(6, textBox_MeasureValue_6); + dicMeasureTextBox.Add(7, textBox_MeasureValue_7); + dicMeasureTextBox.Add(8, textBox_MeasureValue_8); + dicMeasureTextBox.Add(9, textBox_MeasureValue_9); + dicMeasureTextBox.Add(10, textBox_MeasureValue_10); + dicMeasureTextBox.Add(11, textBox_MeasureValue_11); + dicMeasureTextBox.Add(12, textBox_MeasureValue_12); + + + foreach (var item in dicStartMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicEndMasurePictureBox) + { + item.Value.Visible = false; + } + foreach (var item in dicMeasureTextBox) + { + item.Value.Text = ""; + } + + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "1") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 工作时界面显示 + /// + private void SolvePicAndMeasureValueWorking() + { + try + { + int partPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetQualityInfo_Init(OpNameCurrent, partPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + int measureStatus = Convert.ToInt32(dt.Rows[i]["测量状态"]); + int measurePosition = Convert.ToInt32(dt.Rows[i]["测量位置"]); + string tagValue = dt.Rows[i]["测量值"].ToString(); + string isOk = dt.Rows[i]["是否合格"].ToString(); + // 测量状态为1 表示初始状态,两张图片都不显示 + // 测量状态为2 表示正在测量,显示第二张图片 + // 测量状态为3 表示测量完成,显示第一张图片 + + var control_DicStartMasurePictureBox = dicStartMasurePictureBox[measurePosition]; + var control_DicEndMasurePictureBox = dicEndMasurePictureBox[measurePosition]; + var control_DicMeasureTextBox = dicMeasureTextBox[measurePosition]; + + if (measureStatus == 1) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 2) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, true); + ShowPicBoxControl(control_DicEndMasurePictureBox, false); + } + else if (measureStatus == 3) + { + ShowPicBoxControl(control_DicStartMasurePictureBox, false); + ShowPicBoxControl(control_DicEndMasurePictureBox, true); + } + if (isOk == "2") + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.Red); + } + else + { + ShowTextBoxControl(control_DicMeasureTextBox, tagValue, Color.White); + } + } + } + } + catch (Exception err) + { + } + + } + /// + /// 界面产品编码和装配位置的显示 + /// + public void ProductInfo_search() + { + try + { + //textBox1_EngineID.Text = ""; + //textBox1_PartPosition.Text = ""; + ShowTextBoxControl(textBox1_EngineID, "", Color.White); + ShowTextBoxControl(textBox1_PartPosition, "", Color.White); + int PartPosition = publicCore.Get_PartPosition(OpNameCurrent); + publicCore.GetProductInfo_Init(OpNameCurrent, PartPosition, out DataTable dt, out string errMsg); + if (dt.Rows.Count > 0) + { + ShowTextBoxControl(textBox1_EngineID, dt.Rows[0]["发动机号"].ToString(), Color.White); + ShowTextBoxControl(textBox1_PartPosition, dt.Rows[0]["装配位置"].ToString(), Color.White); + //textBox1_EngineID.Text = dt.Rows[0]["发动机号"].ToString(); + //textBox1_PartPosition.Text = dt.Rows[0]["装配位置"].ToString(); + } + } + catch (Exception err) + { + } + } + private void ShowPicBoxControl(Control c, bool ststus) + { + c.BeginInvoke(new Action(delegate () { + c.Visible = ststus; + })); + } + private void ShowTextBoxControl(Control c, string value, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.Text = value; + c.BackColor = color; + })); + } + private void ShowLabelControl(Control c, Color color) + { + //if (c.InvokeRequired) + //{ + + //} + //else + //{ + // c.ForeColor = color; + //} + c.BeginInvoke(new Action(delegate () { + c.ForeColor = color; + })); + } + private void ShowButtonControl(Control c, Color color) + { + c.BeginInvoke(new Action(delegate () { + c.BackColor = color; + })); + } + + + /// + /// 初始化设备状态 + /// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警 + /// + private void SolveDeviceStatusInit(string currentStatus) + { + try + { + ShowButtonControl(button_running, Color.Gray); + ShowButtonControl(button_finished, Color.Gray); + ShowButtonControl(button_empty, Color.Gray); + ShowButtonControl(button_alarm, Color.Gray); + //button_running.BackColor = Color.Gray; + //button_finished.BackColor = Color.Gray; + //button_empty.BackColor = Color.Gray; + //button_alarm.BackColor = Color.Gray; + + if (currentStatus == "1") + { + ShowButtonControl(button_running, Color.Green); + //button_running.BackColor = Color.Green; + } + else if (currentStatus == "2") + { + ShowButtonControl(button_empty, Color.SkyBlue); + + //button_empty.BackColor = Color.SkyBlue; + } + else if (currentStatus == "3") + { + ShowButtonControl(button_finished, Color.DarkOrange); + + //button_finished.BackColor = Color.DarkOrange; + } + else if (currentStatus == "4") + { + ShowButtonControl(button_alarm, Color.Red); + + //button_alarm.BackColor = Color.Red; + } + } + catch (Exception err) + { + + } + } + /// + /// AGV设备状态显示 + /// + /// + private void SolveAgvDeviceStatus(string PLC_AgvTaskNum) + { + try + { + // 77 反馈AGV任务 + switch (PLC_AgvTaskNum) + { + case "10": + // AGV触发装配任务 正在送料 + //label_AgvSongliao.ForeColor = Color.Green; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Black; + + ShowLabelControl(label_AgvSongliao, Color.Green); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Black); + + + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + + break; + case "11": + + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + + //label_AgvRequestEnter.ForeColor = Color.Green; + //label_AgvRequestLeave.ForeColor = Color.Black; + break; + // 允许AGV进行上料 --允许进入 + // 允许AGV进行下料 --允许进入 + case "2": + case "4": + ShowLabelControl(label_AgvCanEnter, Color.Green); + ShowLabelControl(label_AgvCanLeave, Color.Black); + //label_AgvCanEnter.ForeColor = Color.Green; + //label_AgvCanLeave.ForeColor = Color.Black; + break; + case "21": + // AGV 上料完成 + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Green); + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Green; + break; + case "3": + // 1.调用FSS-接收IPC下料请求的接口 + // 2.反馈任务号:30 AGV已呼叫成功正在去往下料区 + break; + case "31": + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Green); + //label_AgvRequestEnter.ForeColor = Color.Black; + //label_AgvRequestLeave.ForeColor = Color.Green; + // AGV已到达下料区 + break; + case "41": + // AGV下料完成 + break; + // 允许AGV离开 + case "5": + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Green); + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Green; + break; + case "51": + //label_AgvSongliao.ForeColor = Color.Black; + + //label_AgvRequestLeave.ForeColor = Color.Black; + //label_AgvRequestEnter.ForeColor = Color.Black; + + //label_AgvCanEnter.ForeColor = Color.Black; + //label_AgvCanLeave.ForeColor = Color.Black; + + //label_AgvLeaved.ForeColor = Color.Green; + ShowLabelControl(label_AgvSongliao, Color.Black); + ShowLabelControl(label_AgvRequestLeave, Color.Black); + ShowLabelControl(label_AgvRequestEnter, Color.Black); + ShowLabelControl(label_AgvCanEnter, Color.Black); + ShowLabelControl(label_AgvCanLeave, Color.Black); + ShowLabelControl(label_AgvLeaved, Color.Green); + ProductInfo_search(); + SolvePicAndMeasureValueWorking(); + break; + } + + + } + catch (Exception err) + { + } + } + + /// + /// 设备PLC心跳button5_heartBeat_Ning + /// + /// + private void DeviceHeartBeat(string tagValue) + { + WritePLC(15, OpNameCurrent, tagValue); + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat, Color.Green); + + //button5_heartBeat.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat, Color.Gray); + + //button5_heartBeat.BackColor = Color.Gray; + } + } + /// + /// 设备PLC心跳 + /// + /// + private void DeviceHeartBeat_NingJinQiang(string tagValue) + { + if (tagValue == "1") + { + ShowButtonControl(button5_heartBeat_Ning, Color.Green); + + //button5_heartBeat_Ning.BackColor = Color.Green; + } + else + { + ShowButtonControl(button5_heartBeat_Ning, Color.Red); + + //button5_heartBeat_Ning.BackColor = Color.Red; + } + } + + + + private void MoNiHeartBeat() + { + bool tv = false; + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + WritePLC(14, OpNameCurrent, tv); + tv = !tv; + } + catch (Exception err) { } + Thread.Sleep(2000); + } + })) + { IsBackground = true }.Start(); + } + + private void label5_Click(object sender, EventArgs e) + { + + } + + private void textBox_MeasureValue_4_TextChanged(object sender, EventArgs e) + { + + } + } +} diff --git a/CCYQ_JieFang/OP/OP50/DAS_OP50.resx b/CCYQ_JieFang/OP/OP50/DAS_OP50.resx new file mode 100644 index 0000000..55f2584 --- /dev/null +++ b/CCYQ_JieFang/OP/OP50/DAS_OP50.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 432, 221 + + + 573, 221 + + + 33 + + + + + AAABAAEAGhoAAAAAIAAHAgAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAaAAAAGggGAAAAqUpMzgAAAAFz + UkdCAK7OHOkAAAAEZ0FNQQAAsY8L/GEFAAAACXBIWXMAAA7DAAAOwwHHb6hkAAABnElEQVRIS+2Uz2rC + QBDGfZRc+h7ec/Mmxhgx2CQGYi65ivUB9NZCArl4EC/SqwgePBRKwUfw0AfZzrfshvVPY1IjlNKBj0xm + Z+a3m0xS+7ciZhjGqN1uM0iE7mO/D9RsNh+QXEZkRpIkDArDcJsLoqQREofDYUrFrIwkpBTItu3VaSPX + dVkURWwymXD/dL0yECDSB0xdgyoD4RQAqEBVlYGu6a6gfv8x828GbTYfXPP5ik2nz1zwZbxS0Gz2wkzT + PBJilYMcx2NBELDl8pUtFivuI3YzSP1g1+t3foLx+Ik3huAjhrUfgeI4rgOGq2xQ9ERpmmpUa6HecZw0 + F6SaCiryjkQZN7q//lOl3Wq6ru9RjPFFM+i7qZMj7vv+djAYpOhRCETJdSrKdpon9TtCDYQedF/sRPjd + 0OSVEmpokwf0AEiKN71kOL7cned5rNvtbqkAj/Kier3eTuYDhCciWuVbp9PZobllWXt5/FardaArRvZI + Io6cT9Q1Go03AieiVb6JQi7a8YgaaGLpzLBGORblZt8NiQ/EX7da7Qtz50LQDuTBxQAAAABJRU5ErkJg + gg== + + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/logInfo.Designer.cs b/CCYQ_JieFang/OP/logInfo.Designer.cs new file mode 100644 index 0000000..ae019ac --- /dev/null +++ b/CCYQ_JieFang/OP/logInfo.Designer.cs @@ -0,0 +1,171 @@ +namespace CCYQ_JieFang +{ + partial class logInfo + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dateTimePicker1_log = new System.Windows.Forms.DateTimePicker(); + this.dataGridView1_log = new System.Windows.Forms.DataGridView(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.工位号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.日志类型 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.日志内容 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.操作日期 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.操作时间 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.button1 = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1_log)).BeginInit(); + this.SuspendLayout(); + // + // dateTimePicker1_log + // + this.dateTimePicker1_log.CustomFormat = "yyyy-MM-dd"; + this.dateTimePicker1_log.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker1_log.Location = new System.Drawing.Point(6, 14); + this.dateTimePicker1_log.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.dateTimePicker1_log.Name = "dateTimePicker1_log"; + this.dateTimePicker1_log.Size = new System.Drawing.Size(162, 28); + this.dateTimePicker1_log.TabIndex = 1; + // + // dataGridView1_log + // + this.dataGridView1_log.AllowUserToAddRows = false; + this.dataGridView1_log.AllowUserToDeleteRows = false; + this.dataGridView1_log.AllowUserToResizeRows = false; + this.dataGridView1_log.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1_log.ColumnHeadersHeight = 29; + this.dataGridView1_log.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.dataGridView1_log.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ID, + this.工位号, + this.日志类型, + this.日志内容, + this.操作日期, + this.操作时间}); + this.dataGridView1_log.Location = new System.Drawing.Point(6, 52); + this.dataGridView1_log.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.dataGridView1_log.Name = "dataGridView1_log"; + this.dataGridView1_log.ReadOnly = true; + this.dataGridView1_log.RowHeadersVisible = false; + this.dataGridView1_log.RowHeadersWidth = 51; + this.dataGridView1_log.RowTemplate.Height = 27; + this.dataGridView1_log.Size = new System.Drawing.Size(1302, 793); + this.dataGridView1_log.TabIndex = 2; + // + // ID + // + this.ID.DataPropertyName = "ID"; + this.ID.HeaderText = "ID"; + this.ID.MinimumWidth = 6; + this.ID.Name = "ID"; + this.ID.ReadOnly = true; + this.ID.Width = 80; + // + // 工位号 + // + this.工位号.DataPropertyName = "工位号"; + this.工位号.HeaderText = "工位号"; + this.工位号.MinimumWidth = 6; + this.工位号.Name = "工位号"; + this.工位号.ReadOnly = true; + this.工位号.Width = 150; + // + // 日志类型 + // + this.日志类型.DataPropertyName = "日志类型"; + this.日志类型.HeaderText = "日志类型"; + this.日志类型.MinimumWidth = 6; + this.日志类型.Name = "日志类型"; + this.日志类型.ReadOnly = true; + this.日志类型.Width = 150; + // + // 日志内容 + // + this.日志内容.DataPropertyName = "日志内容"; + this.日志内容.HeaderText = "日志内容"; + this.日志内容.MinimumWidth = 6; + this.日志内容.Name = "日志内容"; + this.日志内容.ReadOnly = true; + this.日志内容.Width = 420; + // + // 操作日期 + // + this.操作日期.DataPropertyName = "操作日期"; + this.操作日期.HeaderText = "操作日期"; + this.操作日期.MinimumWidth = 6; + this.操作日期.Name = "操作日期"; + this.操作日期.ReadOnly = true; + this.操作日期.Width = 150; + // + // 操作时间 + // + this.操作时间.DataPropertyName = "操作时间"; + this.操作时间.HeaderText = "操作时间"; + this.操作时间.MinimumWidth = 6; + this.操作时间.Name = "操作时间"; + this.操作时间.ReadOnly = true; + this.操作时间.Width = 200; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(185, 10); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 32); + this.button1.TabIndex = 3; + this.button1.Text = "查询"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // logInfo + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1314, 859); + this.Controls.Add(this.button1); + this.Controls.Add(this.dataGridView1_log); + this.Controls.Add(this.dateTimePicker1_log); + this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.Name = "logInfo"; + this.Text = "logoInfo"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1_log)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.DateTimePicker dateTimePicker1_log; + private System.Windows.Forms.DataGridView dataGridView1_log; + private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn 工位号; + private System.Windows.Forms.DataGridViewTextBoxColumn 日志类型; + private System.Windows.Forms.DataGridViewTextBoxColumn 日志内容; + private System.Windows.Forms.DataGridViewTextBoxColumn 操作日期; + private System.Windows.Forms.DataGridViewTextBoxColumn 操作时间; + private System.Windows.Forms.Button button1; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/logInfo.cs b/CCYQ_JieFang/OP/logInfo.cs new file mode 100644 index 0000000..2f05b59 --- /dev/null +++ b/CCYQ_JieFang/OP/logInfo.cs @@ -0,0 +1,56 @@ +using MesWork; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CCYQ_JieFang +{ + public partial class logInfo : Form + { + string currentOpName; + + public logInfo(string opName) + { + currentOpName = opName; + InitializeComponent(); + this.dateTimePicker1_log.CustomFormat = "yyyy-MM-dd"; + dataGridView1_log.AutoGenerateColumns = false; + SearchLogInit(currentOpName, DateTime.Now.ToString("yyyy-MM-dd")); + } + + private void dateTimePicker1_ValueChanged(object sender, EventArgs e) + { + SearchLogInit(currentOpName, dateTimePicker1_log.Value.ToString()); + } + private void SearchLogInit(string opName, string logDate) + { + logDate = string.Format("{0:yyyy-MM-dd}", logDate); + SearchLog(opName, logDate, out DataTable dt, out string errorMsg); + if (dt.Rows.Count > 0) + { + dataGridView1_log.DataSource = dt; + } + } + private bool SearchLog(string opName, string logDate, out DataTable dt, out string errorMsg) + { + string procedureName; + procedureName = "系统_操作日志_查询"; + SqlParameter[] thisParms = new SqlParameter[2]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); + thisParms[1] = new System.Data.SqlClient.SqlParameter("@操作日期", logDate); + return publicCore.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg); + } + + private void button1_Click(object sender, EventArgs e) + { + SearchLogInit(currentOpName, dateTimePicker1_log.Value.ToString()); + } + } +} diff --git a/CCYQ_JieFang/OP/logInfo.resx b/CCYQ_JieFang/OP/logInfo.resx new file mode 100644 index 0000000..e04757a --- /dev/null +++ b/CCYQ_JieFang/OP/logInfo.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/partInfo.Designer.cs b/CCYQ_JieFang/OP/partInfo.Designer.cs new file mode 100644 index 0000000..6184945 --- /dev/null +++ b/CCYQ_JieFang/OP/partInfo.Designer.cs @@ -0,0 +1,305 @@ +namespace CCYQ_JieFang +{ + partial class partInfo + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.dataGridView1_part = new System.Windows.Forms.DataGridView(); + this.button1_search = new System.Windows.Forms.Button(); + this.dateTimePicker1_part = new System.Windows.Forms.DateTimePicker(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.comboBox1_isOk = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); + this.textBox1_partId = new System.Windows.Forms.TextBox(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.工位号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.产品编码 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.测量项目 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.测量位置 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.测量值 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.是否合格 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.NG原因 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.单位 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.上限值 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.下限值 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.测量时间 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1_part)).BeginInit(); + this.SuspendLayout(); + // + // dataGridView1_part + // + this.dataGridView1_part.AllowUserToAddRows = false; + this.dataGridView1_part.AllowUserToDeleteRows = false; + this.dataGridView1_part.AllowUserToResizeRows = false; + this.dataGridView1_part.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.dataGridView1_part.ColumnHeadersHeight = 29; + this.dataGridView1_part.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this.dataGridView1_part.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ID, + this.工位号, + this.产品编码, + this.测量项目, + this.测量位置, + this.测量值, + this.是否合格, + this.NG原因, + this.单位, + this.上限值, + this.下限值, + this.测量时间}); + this.dataGridView1_part.Location = new System.Drawing.Point(12, 49); + this.dataGridView1_part.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.dataGridView1_part.Name = "dataGridView1_part"; + this.dataGridView1_part.ReadOnly = true; + this.dataGridView1_part.RowHeadersVisible = false; + this.dataGridView1_part.RowHeadersWidth = 51; + this.dataGridView1_part.RowTemplate.Height = 27; + this.dataGridView1_part.Size = new System.Drawing.Size(1364, 842); + this.dataGridView1_part.TabIndex = 5; + // + // button1_search + // + this.button1_search.FlatStyle = System.Windows.Forms.FlatStyle.System; + this.button1_search.Location = new System.Drawing.Point(810, 8); + this.button1_search.Name = "button1_search"; + this.button1_search.Size = new System.Drawing.Size(75, 32); + this.button1_search.TabIndex = 8; + this.button1_search.Text = "查询"; + this.button1_search.UseVisualStyleBackColor = true; + this.button1_search.Click += new System.EventHandler(this.button1_search_Click); + // + // dateTimePicker1_part + // + this.dateTimePicker1_part.CustomFormat = "yyyy-MM-dd"; + this.dateTimePicker1_part.Format = System.Windows.Forms.DateTimePickerFormat.Custom; + this.dateTimePicker1_part.Location = new System.Drawing.Point(68, 12); + this.dateTimePicker1_part.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); + this.dateTimePicker1_part.Name = "dateTimePicker1_part"; + this.dateTimePicker1_part.Size = new System.Drawing.Size(162, 28); + this.dateTimePicker1_part.TabIndex = 7; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 11F); + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(54, 22); + this.label1.TabIndex = 9; + this.label1.Text = "日期"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 11F); + this.label2.Location = new System.Drawing.Point(566, 15); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(98, 22); + this.label2.TabIndex = 9; + this.label2.Text = "测量结果"; + // + // comboBox1_isOk + // + this.comboBox1_isOk.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1_isOk.FormattingEnabled = true; + this.comboBox1_isOk.Location = new System.Drawing.Point(671, 12); + this.comboBox1_isOk.Name = "comboBox1_isOk"; + this.comboBox1_isOk.Size = new System.Drawing.Size(121, 26); + this.comboBox1_isOk.TabIndex = 10; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 11F); + this.label3.Location = new System.Drawing.Point(236, 15); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(98, 22); + this.label3.TabIndex = 9; + this.label3.Text = "产品编码"; + // + // textBox1_partId + // + this.textBox1_partId.Location = new System.Drawing.Point(338, 12); + this.textBox1_partId.Name = "textBox1_partId"; + this.textBox1_partId.Size = new System.Drawing.Size(222, 28); + this.textBox1_partId.TabIndex = 11; + // + // ID + // + this.ID.DataPropertyName = "Id"; + this.ID.HeaderText = "ID"; + this.ID.MinimumWidth = 6; + this.ID.Name = "ID"; + this.ID.ReadOnly = true; + this.ID.Width = 80; + // + // 工位号 + // + this.工位号.DataPropertyName = "工位号"; + this.工位号.HeaderText = "工位号"; + this.工位号.MinimumWidth = 6; + this.工位号.Name = "工位号"; + this.工位号.ReadOnly = true; + this.工位号.Width = 80; + // + // 产品编码 + // + this.产品编码.DataPropertyName = "EngineID"; + this.产品编码.HeaderText = "产品编码"; + this.产品编码.MinimumWidth = 6; + this.产品编码.Name = "产品编码"; + this.产品编码.ReadOnly = true; + this.产品编码.Width = 150; + // + // 测量项目 + // + this.测量项目.DataPropertyName = "测量项目"; + this.测量项目.HeaderText = "测量项目"; + this.测量项目.MinimumWidth = 6; + this.测量项目.Name = "测量项目"; + this.测量项目.ReadOnly = true; + this.测量项目.Width = 80; + // + // 测量位置 + // + this.测量位置.DataPropertyName = "测量位置"; + this.测量位置.HeaderText = "测量位置"; + this.测量位置.MinimumWidth = 6; + this.测量位置.Name = "测量位置"; + this.测量位置.ReadOnly = true; + this.测量位置.Width = 80; + // + // 测量值 + // + this.测量值.DataPropertyName = "TagValue"; + this.测量值.HeaderText = "测量值"; + this.测量值.MinimumWidth = 8; + this.测量值.Name = "测量值"; + this.测量值.ReadOnly = true; + this.测量值.Width = 150; + // + // 是否合格 + // + this.是否合格.DataPropertyName = "IsOK"; + this.是否合格.HeaderText = "是否合格"; + this.是否合格.MinimumWidth = 8; + this.是否合格.Name = "是否合格"; + this.是否合格.ReadOnly = true; + this.是否合格.Width = 80; + // + // NG原因 + // + this.NG原因.DataPropertyName = "不合格原因"; + this.NG原因.HeaderText = "NG原因"; + this.NG原因.MinimumWidth = 8; + this.NG原因.Name = "NG原因"; + this.NG原因.ReadOnly = true; + this.NG原因.Width = 150; + // + // 单位 + // + this.单位.DataPropertyName = "测量单位"; + this.单位.HeaderText = "单位"; + this.单位.MinimumWidth = 8; + this.单位.Name = "单位"; + this.单位.ReadOnly = true; + this.单位.Width = 80; + // + // 上限值 + // + this.上限值.DataPropertyName = "上限值"; + this.上限值.HeaderText = "上限值"; + this.上限值.MinimumWidth = 8; + this.上限值.Name = "上限值"; + this.上限值.ReadOnly = true; + this.上限值.Width = 80; + // + // 下限值 + // + this.下限值.DataPropertyName = "下限值"; + this.下限值.HeaderText = "下限值"; + this.下限值.MinimumWidth = 8; + this.下限值.Name = "下限值"; + this.下限值.ReadOnly = true; + this.下限值.Width = 80; + // + // 测量时间 + // + this.测量时间.DataPropertyName = "操作时间"; + this.测量时间.HeaderText = "测量时间"; + this.测量时间.MinimumWidth = 6; + this.测量时间.Name = "测量时间"; + this.测量时间.ReadOnly = true; + this.测量时间.Width = 150; + // + // partInfo + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1388, 897); + this.Controls.Add(this.textBox1_partId); + this.Controls.Add(this.comboBox1_isOk); + this.Controls.Add(this.label2); + this.Controls.Add(this.label3); + this.Controls.Add(this.label1); + this.Controls.Add(this.button1_search); + this.Controls.Add(this.dateTimePicker1_part); + this.Controls.Add(this.dataGridView1_part); + this.Name = "partInfo"; + this.Text = "产品测量数据"; + ((System.ComponentModel.ISupportInitialize)(this.dataGridView1_part)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.DataGridView dataGridView1_part; + private System.Windows.Forms.Button button1_search; + private System.Windows.Forms.DateTimePicker dateTimePicker1_part; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox comboBox1_isOk; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox textBox1_partId; + private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn 工位号; + private System.Windows.Forms.DataGridViewTextBoxColumn 产品编码; + private System.Windows.Forms.DataGridViewTextBoxColumn 测量项目; + private System.Windows.Forms.DataGridViewTextBoxColumn 测量位置; + private System.Windows.Forms.DataGridViewTextBoxColumn 测量值; + private System.Windows.Forms.DataGridViewTextBoxColumn 是否合格; + private System.Windows.Forms.DataGridViewTextBoxColumn NG原因; + private System.Windows.Forms.DataGridViewTextBoxColumn 单位; + private System.Windows.Forms.DataGridViewTextBoxColumn 上限值; + private System.Windows.Forms.DataGridViewTextBoxColumn 下限值; + private System.Windows.Forms.DataGridViewTextBoxColumn 测量时间; + } +} \ No newline at end of file diff --git a/CCYQ_JieFang/OP/partInfo.cs b/CCYQ_JieFang/OP/partInfo.cs new file mode 100644 index 0000000..0f71583 --- /dev/null +++ b/CCYQ_JieFang/OP/partInfo.cs @@ -0,0 +1,79 @@ +using MesWork; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Data.SqlClient; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; + +namespace CCYQ_JieFang +{ + public partial class partInfo : Form + { + string currentOpName; + public partInfo(string opName) + { + currentOpName = opName; + InitializeComponent(); + initMeasureComboBox(); + dataGridView1_part.AutoGenerateColumns = false; + SearchPartInit(currentOpName, "全部", "", DateTime.Now.ToString("yyyy-MM-dd")); + } + + private void initMeasureComboBox() + { + // 全部 OK NG + comboBox1_isOk.Items.Add("全部"); + comboBox1_isOk.Items.Add("OK"); + comboBox1_isOk.Items.Add("NG"); + comboBox1_isOk.SelectedIndex = 0; + } + + private void button1_search_Click(object sender, EventArgs e) + { + string selectedItem = comboBox1_isOk.SelectedItem.ToString(); + SearchPartInit(Name, selectedItem, textBox1_partId.Text, dateTimePicker1_part.Value.ToString("yyyy-MM-dd")); + } + + private void dateTimePicker1_part_ValueChanged(object sender, EventArgs e) + { + // SearchPartInit(Name, dateTimePicker1_part.Value.ToString()); + } + + private void SearchPartInit(string opName, string isOk, string partId, string logDate) + { + try + { + SearchPartInfo(opName, logDate, isOk, partId, out DataTable dt, out string errorMsg); + if (dt.Rows.Count > 0) + { + dataGridView1_part.DataSource = dt; + } + else + { + dataGridView1_part.DataSource = dt; + } + } + catch (Exception err) + { + + } + + } + private bool SearchPartInfo(string opName, string partDate, string isOk, string partId, out DataTable dt, out string errorMsg) + { + string procedureName; + procedureName = "测量数据合格_查询"; + SqlParameter[] thisParms = new SqlParameter[3]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@操作日期", partDate); + thisParms[1] = new System.Data.SqlClient.SqlParameter("@IsOK", isOk); + thisParms[2] = new System.Data.SqlClient.SqlParameter("@EngineID", partId); + return publicCore.ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg); + } + } +} diff --git a/CCYQ_JieFang/OP/partInfo.resx b/CCYQ_JieFang/OP/partInfo.resx new file mode 100644 index 0000000..acfbf59 --- /dev/null +++ b/CCYQ_JieFang/OP/partInfo.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/CCYQ_JieFang/OP/publicCore.cs b/CCYQ_JieFang/OP/publicCore.cs new file mode 100644 index 0000000..67aeff2 --- /dev/null +++ b/CCYQ_JieFang/OP/publicCore.cs @@ -0,0 +1,676 @@ +using DataLinkMesWork; +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Robot.Common; +using NPOI.SS.UserModel; + +namespace MesWork +{ + public partial class publicCore + { + public static int partCount = 0; + public static string FSSRequestMsgId = ""; + public static string Hello_You_All_Never_Know(string[] args) + { + return Guid.NewGuid().ToString(); + } + /// + /// PLC事件变化委托 + /// + public static Action MIS_Funtion_PLC_OP = null; + + /// + /// 读取PLC正在装配第几个件 + /// + /// + /// + public static int Get_PartPosition(string opName) + { + // 当前装配第几个件 54 + int PartPosition = -1; + PartPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, opName)) ; + return PartPosition; + } + + /// + /// 设备状态发生变化,处理完成之后,发给管控系统 + /// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警 + /// + public static void SolveDeviceStatus(string opName) + { + // 空闲(请求上料) 51 + string isFree = "0"; + // 完成(请求下料) 52 + string isWorkFinish = "0"; + // 故障 53 + string isAlarm = "0"; + string finalStatus = "0"; + + isFree = MesWorkForm.ReadPLC(51, opName).ToString(); + if (isFree.ToLower() == "true" || isFree.ToLower() == "1") + { + isFree = "1"; + } + + isWorkFinish = MesWorkForm.ReadPLC(52, opName).ToString(); + if (isWorkFinish.ToLower() == "true" || isWorkFinish.ToLower() == "1") + { + isWorkFinish = "1"; + } + isAlarm = MesWorkForm.ReadPLC(53, opName).ToString(); + if (isAlarm.ToLower() == "true" || isAlarm.ToLower() == "1") + { + isAlarm = "1"; + } + + if (isAlarm == "1") + { + finalStatus = "4"; + } + else if (isWorkFinish == "1") + { + finalStatus = "3"; + } + else if (isFree == "1") + { + finalStatus = "2"; + } + else + { + finalStatus = "1"; + } + if (finalStatus == "3") + { + QualityData_Insert_Final(opName, out string errMag); + publicCore.LogInsert("Quality", "Info", "保存质量数据:" + errMag); + + } + AnalysisMsg.DeviceStatus(opName, Convert.ToInt32(finalStatus)); + } + + /// + /// 设备状态发生变化,处理完成之后,发给管控系统 + /// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警 + /// 接口用 不重复保存质量数据 + /// + public static void SolveDeviceStatus_WebApi_Use(string opName) + { + // 空闲(请求上料) 51 + string isFree = "0"; + // 完成(请求下料) 52 + string isWorkFinish = "0"; + // 故障 53 + string isAlarm = "0"; + string finalStatus = "0"; + + isFree = MesWorkForm.ReadPLC(51, opName).ToString(); + if (isFree.ToLower() == "true" || isFree.ToLower() == "1") + { + isFree = "1"; + } + + isWorkFinish = MesWorkForm.ReadPLC(52, opName).ToString(); + if (isWorkFinish.ToLower() == "true" || isWorkFinish.ToLower() == "1") + { + isWorkFinish = "1"; + } + isAlarm = MesWorkForm.ReadPLC(53, opName).ToString(); + if (isAlarm.ToLower() == "true" || isAlarm.ToLower() == "1") + { + isAlarm = "1"; + } + + if (isAlarm == "1") + { + finalStatus = "4"; + } + else if (isWorkFinish == "1") + { + finalStatus = "3"; + } + else if (isFree == "1") + { + finalStatus = "2"; + } + else + { + finalStatus = "1"; + } + AnalysisMsg.DeviceStatus(opName, Convert.ToInt32(finalStatus)); + } + + /// + /// 设备状态发生变化,处理完成之后,发给管控系统 + /// 1工作中 2空闲(请求上料) 3完成(请求下料) 4 报警 + /// + public static string SolveDeviceStatus_Read(string opName) + { + // 空闲(请求上料) 51 + string isFree = "0"; + // 完成(请求下料) 52 + string isWorkFinish = "0"; + // 故障 53 + string isAlarm = "0"; + string finalStatus = "0"; + + isFree = MesWorkForm.ReadPLC(51, opName).ToString(); + if(isFree.ToLower() == "true" || isFree.ToLower() == "1") + { + isFree = "1"; + } + + isWorkFinish = MesWorkForm.ReadPLC(52, opName).ToString(); + if (isWorkFinish.ToLower() == "true" || isWorkFinish.ToLower() == "1") + { + isWorkFinish = "1"; + } + isAlarm = MesWorkForm.ReadPLC(53, opName).ToString(); + if (isAlarm.ToLower() == "true" || isAlarm.ToLower() == "1") + { + isAlarm = "1"; + } + + if (isAlarm == "1") + { + finalStatus = "4"; + } + else if (isWorkFinish == "1") + { + finalStatus = "3"; + } + else if (isFree == "1") + { + finalStatus = "2"; + } + else + { + finalStatus = "1"; + } + return finalStatus; + } + + /// + /// AGV任务号 + /// + public static void SolveAgvTaskNum(string OpName, string PLC_AgvTaskNum) + { + + // 77 反馈AGV任务 + switch (PLC_AgvTaskNum) + { + // AGV已呼叫成功正在去往上料区 + case "10": + MesWorkForm.WritePLC(77, OpName, "10"); + break; + // AGV已到达上料区_带货,申请进入上料位置 + case "11": + string previousTaskValue = MesWorkForm.ReadPLC(77, OpName).ToString(); + string AgvCanEnter = MesWorkForm.ReadPLC(50, OpName).ToString(); + if (previousTaskValue == "10") + { + // 写任务--满AGV是达上料区 + MesWorkForm.WritePLC(77, OpName, "1"); + if (AgvCanEnter == "2") + { + // 1.调用FSS-接收允许进入或离开 (类型:允许进入)的接口 + AnalysisMsg.ResponseEnterOrLeave(OpName, 1); + MesWorkForm.WritePLC(77, OpName, "20"); + } + } + if (previousTaskValue == "30") + { + // 写任务--空AGV是达上料区 + MesWorkForm.WritePLC(77, OpName, "3"); + if (AgvCanEnter == "4") + { + // 1.调用FSS-接收允许进入或离开 (类型:允许进入)的接口 + AnalysisMsg.ResponseEnterOrLeave(OpName, 1); + MesWorkForm.WritePLC(77, OpName, "40"); + } + } + break; + // 允许AGV进行上料 --允许进入 + case "2": + string FullAgvIsRequestEnter = MesWorkForm.ReadPLC(77, OpName).ToString(); + // 需要判断前序任务是否完成-- 满AGV是否到达上料区 + if (FullAgvIsRequestEnter == "1") + { + // 1.调用FSS-接收允许进入或离开 (类型:允许进入)的接口 + AnalysisMsg.ResponseEnterOrLeave(OpName, 1); + MesWorkForm.WritePLC(77, OpName, "20"); + } + break; + case "21": + // AGV 上料完成 + string previousTaskValue1 = MesWorkForm.ReadPLC(77, OpName).ToString(); + if(previousTaskValue1 == "20") + { + MesWorkForm.WritePLC(77, OpName, "2"); + } + if (previousTaskValue1 == "40") + { + MesWorkForm.WritePLC(77, OpName, "4"); + } + + break; + // PLC呼叫AGV进行下料 + case "3": + // 1.调用FSS-接收IPC下料请求的接口 + AnalysisMsg.FinishCall(OpName); + // 2.反馈任务号:30 AGV已呼叫成功正在去往下料区 + MesWorkForm.WritePLC(77, OpName, "30"); + break; + // 允许AGV进行下料 --允许进入 + case "4": + string EmptyAgvIsRequestEnter = MesWorkForm.ReadPLC(77, OpName).ToString(); + // 需要判断前序任务是否完成-- 空AGV是否到达上料区 + if (EmptyAgvIsRequestEnter == "3") + { + // 1.调用FSS-接收允许进入或离开 (类型:允许进入)的接口 + AnalysisMsg.ResponseEnterOrLeave(OpName, 1); + MesWorkForm.WritePLC(77, OpName, "40"); + } + break; + // 允许AGV离开 + case "5": + string FullOrEmptyAgvIsRequestLeave = MesWorkForm.ReadPLC(77, OpName).ToString(); + // 需要判断前序任务是否完成-- AGV上料完成或者下料完成 + if(FullOrEmptyAgvIsRequestLeave == "2" || FullOrEmptyAgvIsRequestLeave == "4") + { + // 1.调用FSS-接收允许进入或离开 (类型:允许离开)的接口 + AnalysisMsg.ResponseEnterOrLeave(OpName, 2); + MesWorkForm.WritePLC(77, OpName, "50"); + } + break; + case "51": + // AGV 已离开 反馈任务号:5 + MesWorkForm.WritePLC(77, OpName, "5"); + break; + } + switch (OpName) + { + case "OP10": + if (DAS_OP10.AGV_Task_change != null) + { + DAS_OP10.AGV_Task_change(PLC_AgvTaskNum); + } + break; + case "OP20": + if (DAS_OP20.AGV_Task_change != null) + { + DAS_OP20.AGV_Task_change(PLC_AgvTaskNum); + } + break; + case "OP30": + if (DAS_OP30.AGV_Task_change != null) + { + DAS_OP30.AGV_Task_change(PLC_AgvTaskNum); + } + break; + case "OP40": + if (DAS_OP40.AGV_Task_change != null) + { + DAS_OP40.AGV_Task_change(PLC_AgvTaskNum); + } + break; + case "OP50": + if (DAS_OP50.AGV_Task_change != null) + { + DAS_OP50.AGV_Task_change(PLC_AgvTaskNum); + } + break; + } + } + + /// + /// 读取泄漏量的数据 + /// + public static void ReadQualityData_LeakageRate(string opName) + { + string Pressure = MesWorkForm.ReadPLC(57, opName).ToString(); + int partPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, opName)); + int MeasurePosition = 9; + string IsOK = "1"; + string NgStr = ""; + //保存质量数 + QualityData_MobyInsert(partPosition, MeasurePosition, opName, Pressure, IsOK, NgStr, out string errMsg); + + } + + /// + /// 拧紧数据的变化 + /// + public static void MeasurePositionChange(string opName, int MeasureStatus) + { + int MeasurePosition = Convert.ToInt32(MesWorkForm.ReadPLC(55, opName)); + int partPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, opName)); + QualityData_MobyUpdate(partPosition, MeasurePosition, opName, MeasureStatus, out string errMsg); + } + + /// + /// 读压力的数据 + /// + public static void ReadQualityData_Pressure(string opName) + { + string LeakageRate1 = MesWorkForm.ReadPLC(57, opName).ToString(); + string LeakageRate2 = MesWorkForm.ReadPLC(58, opName).ToString(); + int partPosition = Convert.ToInt32(MesWorkForm.ReadPLC(54, opName)); + int MeasurePosition = 1; + string IsOK1 = "1"; + string NgStr1 = ""; + //保存质量数 + QualityData_MobyInsert(partPosition, MeasurePosition, opName, LeakageRate1, IsOK1, NgStr1, out string errMsg); + MeasurePosition = 2; + string IsOK2 = "1"; + string NgStr2 = ""; + QualityData_MobyInsert(partPosition, MeasurePosition, opName, LeakageRate2, IsOK1, NgStr2, out string errMsg1); + } + /// + /// 质量数据的保存 + /// + /// + /// + /// + /// + /// + /// + public static bool QualityData_MobyUpdate(int PartPosition, int MeasurePosition, string opName, int MeasureStatus, out string errorMsg) + { + string procedureName; + procedureName = "测量数据合格_Moby_更新"; + SqlParameter[] thisParms = new SqlParameter[4]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@测量状态", MeasureStatus); + thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName); + thisParms[2] = new System.Data.SqlClient.SqlParameter("@测量位置", MeasurePosition); + thisParms[3] = new System.Data.SqlClient.SqlParameter("@装配位置", PartPosition); + return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out errorMsg); + } + + /// + /// 质量数据的保存 + /// + /// + /// + /// + /// + /// + /// + public static bool QualityData_MobyInsert(int PartPosition, int MeasurePosition, string opName, string TagValue, string IsOK, string NgStr, out string errorMsg) + { + string procedureName; + procedureName = "测量数据合格_Moby_增加"; + SqlParameter[] thisParms = new SqlParameter[6]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@TagValue", TagValue); + thisParms[1] = new System.Data.SqlClient.SqlParameter("@IsOK", IsOK); + thisParms[2] = new System.Data.SqlClient.SqlParameter("@工位号", opName); + thisParms[3] = new System.Data.SqlClient.SqlParameter("@测量位置", MeasurePosition); + thisParms[4] = new System.Data.SqlClient.SqlParameter("@装配位置", PartPosition); + thisParms[5] = new System.Data.SqlClient.SqlParameter("@不合格原因", NgStr); + return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out errorMsg); + } + /// + /// 质量数据的保存 + /// + /// + /// + /// + /// + /// + /// + public static bool QualityData_Insert_Final(string opName, out string errorMsg) + { + string procedureName; + procedureName = "测量数据合格_增加"; + SqlParameter[] thisParms = new SqlParameter[1]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); + return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out errorMsg); + } + /// + /// 判断来料是否满托盘 + /// + public static void JudgeMaterialFull(string opName, List product_AssemblyInformation) + { + int partCount = product_AssemblyInformation.Count; + if (publicCore.partCount == partCount) + { + MesWorkForm.WritePLC(78, opName, true); + } + else + { + MesWorkForm.WritePLC(78, opName, false); + } + MesWorkForm.WritePLC(79, opName, false); + MesWorkForm.WritePLC(80, opName, false); + MesWorkForm.WritePLC(81, opName, false); + MesWorkForm.WritePLC(82, opName, false); + foreach (var item in product_AssemblyInformation) + { + if(item.productPosition == 1) + { + MesWorkForm.WritePLC(79, opName, true); + } + if (item.productPosition == 2) + { + MesWorkForm.WritePLC(80, opName, true); + } + if (item.productPosition == 3) + { + MesWorkForm.WritePLC(81, opName, true); + } + if (item.productPosition == 4) + { + MesWorkForm.WritePLC(82, opName, true); + } + + MesWorkForm.WritePLC(60, opName, false); + } + } + /// + /// 是否允许工作 + /// + /// + /// + public static void FixedAllow(string opName, object isAllowWork) + { + MesWorkForm.WritePLC(85, opName, isAllowWork); + } + + /// + /// 测量数据_测量信息_初始化查询 + /// + /// + /// + /// + /// + /// + /// + public static bool GetQualityInfo_Init(string opName, int PartPosition, out DataTable dt, out string errorMsg) + { + string procedureName; + procedureName = "测量数据_测量信息_初始化查询"; + SqlParameter[] thisParms = new SqlParameter[2]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); + thisParms[1] = new System.Data.SqlClient.SqlParameter("@装配位置", PartPosition); + return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg); + } + + public static bool GetProductInfo_Init(string opName, int PartPosition, out DataTable dt, out string errorMsg) + { + string procedureName; + procedureName = "装配信息_初始化查询"; + SqlParameter[] thisParms = new SqlParameter[2]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); + thisParms[1] = new System.Data.SqlClient.SqlParameter("@装配位置", PartPosition); + return ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out dt, out errorMsg); + } + public static void LogInsert(string opName, string logType, string log) + { + string procedureName; + procedureName = "系统_操作日志_新增"; + SqlParameter[] thisParms = new SqlParameter[5]; + thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); + thisParms[1] = new System.Data.SqlClient.SqlParameter("@日志类型", logType); + thisParms[2] = new System.Data.SqlClient.SqlParameter("@日志内容", log); + thisParms[3] = new System.Data.SqlClient.SqlParameter("@操作日期", DateTime.Now.ToString("yyyy-MM-dd")); + thisParms[4] = new System.Data.SqlClient.SqlParameter("@操作时间", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); + ExecuteStoredProcedure(procedureName, MesWorkForm.ConnectionString, ref thisParms, out string errorMsg); + } + #region 数据库操作 + /// + /// 提供通用的调用存储过程的方法(需要返回查询的记录集的调用) + /// + /// 存储过程名称 + /// 连库字符串 + /// 存储过程参数数组 + /// 存储过程里面返回的记录集 + /// 错误信息 + /// 布尔值,true表示该执行成功,false表示执行失败 + public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out DataSet ds, out string errorMessage) + { + bool result = false; + errorMessage = ""; + ds = new DataSet(); + if (connectionString.Length < 1) return false; + using (SqlConnection conn = new SqlConnection(connectionString)) + { + try + { + //if (!SqlServerConnectionStatus) return false; + conn.Open(); + using (SqlDataAdapter dsCommand = new SqlDataAdapter()) + { + dsCommand.SelectCommand = new SqlCommand(procedureName, conn); + dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure; + for (int i = 0; i < sqlParameters.Length; i++) + { + dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]); + } + dsCommand.Fill(ds); + } + // SqlServerConnectionStatus = true; + result = true; + } + catch (Exception e) + { + errorMessage = e.ToString(); + // TestConnection(); + //ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n存储过程:\r\n" + procedureName + "\r\n连接字符串:\r\n" + connectionString); + } + finally + { + if (conn.State == ConnectionState.Open) + conn.Close(); + } + } + return result; + } + /// + /// 提供通用的调用存储过程的方法(需要返回查询的记录集的调用) + /// + /// 存储过程名称 + /// 连库字符串 + /// 存储过程参数数组 + /// 存储过程里面返回的记录表 + /// 错误信息 + /// 布尔值,true表示该执行成功,false表示执行失败 + public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out DataTable dt, out string errorMessage) + { + bool result = false; + errorMessage = ""; + dt = new DataTable(); + DataSet ds = new DataSet(); + if (connectionString.Length < 1) return false; + using (SqlConnection conn = new SqlConnection(connectionString)) + { + try + { + //if (!SqlServerConnectionStatus) return false; + conn.Open(); + using (SqlDataAdapter dsCommand = new SqlDataAdapter()) + { + dsCommand.SelectCommand = new SqlCommand(procedureName, conn); + dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure; + for (int i = 0; i < sqlParameters.Length; i++) + { + dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]); + } + dsCommand.Fill(ds); + } + if (ds.Tables.Count > 0) + { + dt = ds.Tables[0]; + } + result = true; + } + catch (Exception e) + { + errorMessage = e.ToString(); + // TestConnection(); + //ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n存储过程:\r\n" + procedureName + "\r\n连接字符串:\r\n" + connectionString); + } + finally + { + if (conn.State == ConnectionState.Open) + conn.Close(); + } + } + return result; + } + /// + /// 提供通用的调用存储过程的方法(需要返回查询的记录集的调用) + /// + /// 存储过程名称 + /// 连库字符串 + /// 存储过程参数数组 + /// 存储过程里面返回的记录表 + /// 错误信息 + /// 布尔值,true表示该执行成功,false表示执行失败 + public static bool ExecuteStoredProcedure(string procedureName, string connectionString, ref SqlParameter[] sqlParameters, out string errorMessage) + { + bool result = false; + errorMessage = ""; + DataSet ds = new DataSet(); + if (connectionString.Length < 1) return false; + using (SqlConnection conn = new SqlConnection(connectionString)) + { + try + { + //if (!SqlServerConnectionStatus) return false; + conn.Open(); + using (SqlDataAdapter dsCommand = new SqlDataAdapter()) + { + dsCommand.SelectCommand = new SqlCommand(procedureName, conn); + dsCommand.SelectCommand.CommandType = CommandType.StoredProcedure; + for (int i = 0; i < sqlParameters.Length; i++) + { + dsCommand.SelectCommand.Parameters.Add(sqlParameters[i]); + } + dsCommand.Fill(ds); + } + result = true; + } + catch (Exception e) + { + errorMessage = e.ToString(); + // TestConnection(); + //ApplicationLog.WriteLog(e, "\r\nExecuteStoredProcedure\r\n存储过程:\r\n" + procedureName + "\r\n连接字符串:\r\n" + connectionString); + } + finally + { + if (conn.State == ConnectionState.Open) + conn.Close(); + } + } + return result; + } + #endregion + } + + + +} diff --git a/CCYQ_JieFang/Properties/AssemblyInfo.cs b/CCYQ_JieFang/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..58ca676 --- /dev/null +++ b/CCYQ_JieFang/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("MesWork")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MesWork")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("a8d0b4ef-e223-4b9a-b2d9-0156b7b8b073")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CCYQ_JieFang/Properties/Resources.Designer.cs b/CCYQ_JieFang/Properties/Resources.Designer.cs new file mode 100644 index 0000000..fa471fa --- /dev/null +++ b/CCYQ_JieFang/Properties/Resources.Designer.cs @@ -0,0 +1,193 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace CCYQ_JieFang.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CCYQ_JieFang.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _01_微型减速机 { + get { + object obj = ResourceManager.GetObject("01-微型减速机", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _02_涡喷发动机 { + get { + object obj = ResourceManager.GetObject("02 涡喷发动机", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _03_卫星模型 { + get { + object obj = ResourceManager.GetObject("03-卫星模型", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _04_微型减速机 { + get { + object obj = ResourceManager.GetObject("04-微型减速机", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap _05_微型减速机 { + get { + object obj = ResourceManager.GetObject("05-微型减速机", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap green { + get { + object obj = ResourceManager.GetObject("green", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap red { + get { + object obj = ResourceManager.GetObject("red", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap StartWorkCircle { + get { + object obj = ResourceManager.GetObject("StartWorkCircle", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap 下压 { + get { + object obj = ResourceManager.GetObject("下压", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap 下压OK { + get { + object obj = ResourceManager.GetObject("下压OK", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap 关闭系统 { + get { + object obj = ResourceManager.GetObject("关闭系统", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap 断开连接 { + get { + object obj = ResourceManager.GetObject("断开连接", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap 连接 { + get { + object obj = ResourceManager.GetObject("连接", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/CCYQ_JieFang/Properties/Resources.resx b/CCYQ_JieFang/Properties/Resources.resx new file mode 100644 index 0000000..1eb9f44 --- /dev/null +++ b/CCYQ_JieFang/Properties/Resources.resx @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\icon\关闭系统.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\04-微型减速机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\StartWorkCircle.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\green.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\断开连接.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\01-微型减速机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\red.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\03-卫星模型.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\连接.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\02 涡喷发动机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\05-微型减速机.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\下压.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\icon\下压OK.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/CCYQ_JieFang/Properties/Settings.Designer.cs b/CCYQ_JieFang/Properties/Settings.Designer.cs new file mode 100644 index 0000000..79761ff --- /dev/null +++ b/CCYQ_JieFang/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace CCYQ_JieFang.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/CCYQ_JieFang/Properties/Settings.settings b/CCYQ_JieFang/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/CCYQ_JieFang/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/CCYQ_JieFang/app.manifest b/CCYQ_JieFang/app.manifest new file mode 100644 index 0000000..38b13d4 --- /dev/null +++ b/CCYQ_JieFang/app.manifest @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CCYQ_JieFang/icon/01-微型减速机.png b/CCYQ_JieFang/icon/01-微型减速机.png new file mode 100644 index 0000000..ed99ed0 Binary files /dev/null and b/CCYQ_JieFang/icon/01-微型减速机.png differ diff --git a/CCYQ_JieFang/icon/02 涡喷发动机.png b/CCYQ_JieFang/icon/02 涡喷发动机.png new file mode 100644 index 0000000..74e2fc1 Binary files /dev/null and b/CCYQ_JieFang/icon/02 涡喷发动机.png differ diff --git a/CCYQ_JieFang/icon/03-卫星模型.png b/CCYQ_JieFang/icon/03-卫星模型.png new file mode 100644 index 0000000..8aaff8e Binary files /dev/null and b/CCYQ_JieFang/icon/03-卫星模型.png differ diff --git a/CCYQ_JieFang/icon/04-微型减速机.png b/CCYQ_JieFang/icon/04-微型减速机.png new file mode 100644 index 0000000..0311f8a Binary files /dev/null and b/CCYQ_JieFang/icon/04-微型减速机.png differ diff --git a/CCYQ_JieFang/icon/05-微型减速机.png b/CCYQ_JieFang/icon/05-微型减速机.png new file mode 100644 index 0000000..8da71f9 Binary files /dev/null and b/CCYQ_JieFang/icon/05-微型减速机.png differ diff --git a/CCYQ_JieFang/icon/OP10OP50.ico b/CCYQ_JieFang/icon/OP10OP50.ico new file mode 100644 index 0000000..7a49107 Binary files /dev/null and b/CCYQ_JieFang/icon/OP10OP50.ico differ diff --git a/CCYQ_JieFang/icon/StartWorkCircle.gif b/CCYQ_JieFang/icon/StartWorkCircle.gif new file mode 100644 index 0000000..17464aa Binary files /dev/null and b/CCYQ_JieFang/icon/StartWorkCircle.gif differ diff --git a/CCYQ_JieFang/icon/green.png b/CCYQ_JieFang/icon/green.png new file mode 100644 index 0000000..e1cc704 Binary files /dev/null and b/CCYQ_JieFang/icon/green.png differ diff --git a/CCYQ_JieFang/icon/red.png b/CCYQ_JieFang/icon/red.png new file mode 100644 index 0000000..c4340e0 Binary files /dev/null and b/CCYQ_JieFang/icon/red.png differ diff --git a/CCYQ_JieFang/icon/下压.gif b/CCYQ_JieFang/icon/下压.gif new file mode 100644 index 0000000..4a23cf6 Binary files /dev/null and b/CCYQ_JieFang/icon/下压.gif differ diff --git a/CCYQ_JieFang/icon/下压OK.png b/CCYQ_JieFang/icon/下压OK.png new file mode 100644 index 0000000..d3ca9e7 Binary files /dev/null and b/CCYQ_JieFang/icon/下压OK.png differ diff --git a/CCYQ_JieFang/icon/关闭系统.png b/CCYQ_JieFang/icon/关闭系统.png new file mode 100644 index 0000000..ffd64a8 Binary files /dev/null and b/CCYQ_JieFang/icon/关闭系统.png differ diff --git a/CCYQ_JieFang/icon/断开连接.png b/CCYQ_JieFang/icon/断开连接.png new file mode 100644 index 0000000..8221ffc Binary files /dev/null and b/CCYQ_JieFang/icon/断开连接.png differ diff --git a/CCYQ_JieFang/icon/连接.png b/CCYQ_JieFang/icon/连接.png new file mode 100644 index 0000000..cc7650b Binary files /dev/null and b/CCYQ_JieFang/icon/连接.png differ diff --git a/CCYQ_JieFang/webApi/AnalysisMsg.cs b/CCYQ_JieFang/webApi/AnalysisMsg.cs new file mode 100644 index 0000000..9a9f92a --- /dev/null +++ b/CCYQ_JieFang/webApi/AnalysisMsg.cs @@ -0,0 +1,719 @@ +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; +using NPOI.POIFS.Properties; +using Robots; +using System.IO; +using System.Net; +using Opc.Ua; +using NPOI.SS.Formula.Functions; + +namespace MesWork +{ + public class AnalysisMsg + { + /// + /// UUID生成 + /// + /// + public static string UuidUtil() + { + string result = Guid.NewGuid().ToString(); + + return result; + } + /// + /// IPC-接收装配信息 + /// + /// + /// + public static string product(string url, [FromBody] JObject jobj) + { + string MsgId = ""; + var result = new msgResHeader(); + result.Code = "200"; + result.Message = ""; + + int AID = -1; + string errorMessage = ""; + if (jobj == null) + { + throw new Exception("参数格式不正确!"); + } + int isError = 0; + string str = jobj.ToString(); + publicCore.LogInsert("product", "Info", str); + try + { + //存储日志 + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var param1 = new SqlParameter[] { + new SqlParameter("@接口地址",url), + new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",str), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref param1, out DataTable dt, out errorMessage); + if (errorMessage != "") + { + throw new Exception("数据库存储过程【接口_IOT接口交互日志_请求记录】调用失败!"); + } + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + // 解析订单内容,存储数据库,根据实际业务来写 + IPC_product productDataList = JsonConvert.DeserializeObject(str); + List product_AssemblyInformation = productDataList.AssemblyInformation; + string Location = productDataList.Location; + MsgId = productDataList.MsgId; + if (MsgId == "") + { + throw new Exception("参数MsgId为空!"); + } + if (Location == "") + { + throw new Exception("参数Location为空!"); + } + var parsingParam1 = new SqlParameter[] { + new SqlParameter("@Location",Location), + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_工位装配信息_删除", MesWorkForm.ConnectionString, ref parsingParam1, out errorMessage); + if (errorMessage != "") + { + throw new Exception("数据库存储过程【接口_工位装配信息_删除】调用失败!"); + } + + foreach (var assemblyInformation in product_AssemblyInformation) + { + if (assemblyInformation.productPosition <= 0) + { + throw new Exception("参数productPosition不正确!"); + } + if (assemblyInformation.productNo == "") + { + throw new Exception("参数productNo不正确!"); + } + var parsingParam = new SqlParameter[] { + new SqlParameter("@Location",Location), + new SqlParameter("@productNo",assemblyInformation.productNo), + new SqlParameter("@MsgId",MsgId), + new SqlParameter("@productName",assemblyInformation.productName), + new SqlParameter("@productPosition",assemblyInformation.productPosition) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_工位装配信息", MesWorkForm.ConnectionString, ref parsingParam, out errorMessage); + if (errorMessage != "") + { + throw new Exception("数据库存储过程【接口_工位装配信息】调用失败!"); + } + } + publicCore.SolveAgvTaskNum(Location, "10"); + publicCore.JudgeMaterialFull(Location, product_AssemblyInformation); + publicCore.FixedAllow(Location, true); + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",JsonConvert.SerializeObject(result)) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + } + catch (Exception err) + { + result.Code = "500"; + result.Message = err.Message; + result.MsgId = MsgId; + } + + string retString = JsonConvert.SerializeObject(result); + publicCore.LogInsert("product", "Info", "IPC-接收装配信息:" + retString); + return retString; + } + /// + /// IPC-查询设备可进入或可离开状态 + /// + /// + /// + public static string RequestEnterOrLeave(string url, [FromBody] JObject jobj) + { + string MsgId = ""; + var result = new msgResHeader(); + result.Code = "200"; + result.Message = ""; + + int AID = -1; + string errorMessage = ""; + if (jobj == null) + { + throw new Exception("参数格式不正确!"); + } + int isError = 0; + string str = jobj.ToString(); + publicCore.LogInsert("RequestEnterOrLeave", "Info", str); + try + { + //存储日志 + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var param1 = new SqlParameter[] { + new SqlParameter("@接口地址",url), + new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",str), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref param1, out DataTable dt, out errorMessage); + if (errorMessage != "") + { + throw new Exception("数据库存储过程【接口_IOT接口交互日志_请求记录】调用失败!"); + } + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + // 解析订单内容,存储数据库,根据实际业务来写 + IPC_RequestEnterOrLeave requestEnterOrLeave = JsonConvert.DeserializeObject(str); + string Location = requestEnterOrLeave.Location; + int RequestType = requestEnterOrLeave.RequestType; + MsgId = requestEnterOrLeave.MsgId; + if (MsgId == "") + { + throw new Exception("参数MsgId为空!"); + } + if (Location == "") + { + throw new Exception("参数Location为空!"); + } + if (RequestType != 1 && RequestType != 2) + { + throw new Exception("参数RequestType错误!"); + } + // 1:查询是否可以进入 + if (RequestType == 1) + { + // 这块有问题,需要区分下是送 还是取 的请求进入 + // 如果是上料的请求进入 执行11 + // 1.AGV已到达上料区 + // 如果是下料的请求进入 执行31 + // 1.AGV已到达下料区 + publicCore.FSSRequestMsgId = MsgId; + publicCore.SolveAgvTaskNum(Location, "11"); + } + // 2:查询是否可以离开 + if (RequestType == 2) + { + // 这块有问题,需要区分下是送 还是取 的请求离开 + // 如果是上料的请求离开 执行21 + // 1:AGV 上料完成 + // 如果是下料的请求离开 执行41 + // AGV正在离开 + // 里面判断 + publicCore.FSSRequestMsgId = MsgId; + publicCore.SolveAgvTaskNum(Location, "21"); + } + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",JsonConvert.SerializeObject(result)) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + } + catch (Exception err) + { + result.Code = "500"; + result.Message = err.Message; + result.MsgId = MsgId; + } + + string retString = JsonConvert.SerializeObject(result); + publicCore.LogInsert("RequestEnterOrLeave", "Info", "IPC-查询设备可进入或可离开状态:" + retString); + return retString; + } + /// + /// IPC-上下料完成AGV离开 + /// + /// + /// + public static string WorkFinsih(string url, [FromBody] JObject jobj) + { + + string MsgId = ""; + var result = new msgResHeader(); + result.Code = "200"; + result.Message = ""; + + int AID = -1; + string errorMessage = ""; + if (jobj == null) + { + throw new Exception("参数格式不正确!"); + } + int isError = 0; + string str = jobj.ToString(); + publicCore.LogInsert("WorkFinsih", "Info", str); + try + { + //存储日志 + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var param1 = new SqlParameter[] { + new SqlParameter("@接口地址",url), + new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",str), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref param1, out DataTable dt, out errorMessage); + if (errorMessage != "") + { + throw new Exception("数据库存储过程【接口_IOT接口交互日志_请求记录】调用失败!"); + } + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + // 解析订单内容,存储数据库,根据实际业务来写 + IPC_WorkFinsih WorkFinsih = JsonConvert.DeserializeObject(str); + string Location = WorkFinsih.Location; + int finishType = WorkFinsih.FinishType; + + MsgId = WorkFinsih.MsgId; + if (MsgId == "") + { + throw new Exception("参数MsgId为空!"); + } + if (Location == "") + { + throw new Exception("参数Location为空!"); + } + if (finishType != 1 && finishType != 2) + { + throw new Exception("参数FinishType错误!"); + } + if (finishType == 1) + { + // 1.AGV上料完成 已离开 + publicCore.SolveAgvTaskNum(Location, "51"); + } + if (finishType == 2) + { + // 1.AGV下料完成 已离开 + publicCore.SolveAgvTaskNum(Location, "51"); + publicCore.FixedAllow(Location, false); + } + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",JsonConvert.SerializeObject(result)) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + } + catch (Exception err) + { + result.Code = "500"; + result.Message = err.Message; + result.MsgId = MsgId; + } + + string retString = JsonConvert.SerializeObject(result); + publicCore.LogInsert("WorkFinsih", "Info", "IPC-上下料完成AGV离开res:" + retString); + return retString; + } + public static string IPCDeviceStatus(string url, [FromBody] JObject jobj) + { + + string MsgId = ""; + var result = new msgResHeader(); + result.Code = "200"; + result.Message = ""; + + int AID = -1; + string errorMessage = ""; + if (jobj == null) + { + throw new Exception("参数格式不正确!"); + } + int isError = 0; + string str = jobj.ToString(); + publicCore.LogInsert("WorkFinsih", "Info", str); + try + { + //存储日志 + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var param1 = new SqlParameter[] { + new SqlParameter("@接口地址",url), + new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",str), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref param1, out DataTable dt, out errorMessage); + if (errorMessage != "") + { + throw new Exception("数据库存储过程【接口_IOT接口交互日志_请求记录】调用失败!"); + } + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + // 解析订单内容,存储数据库,根据实际业务来写 + IPC_DeviceStatus WorkFinsih = JsonConvert.DeserializeObject(str); + string Location = WorkFinsih.Location; + MsgId = WorkFinsih.MsgId; + if (MsgId == "") + { + throw new Exception("参数MsgId为空!"); + } + if (Location == "") + { + throw new Exception("参数Location为空!"); + } + // 调用接口 发送当前工位 状态 + MesWork.publicCore.SolveDeviceStatus_WebApi_Use(Location); + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",JsonConvert.SerializeObject(result)) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + } + catch (Exception err) + { + result.Code = "500"; + result.Message = err.Message; + result.MsgId = MsgId; + } + + string retString = JsonConvert.SerializeObject(result); + publicCore.LogInsert("WorkFinsih", "Info", "IPC-上下料完成AGV离开res:" + retString); + return retString; + } + /// + /// FSS-接收允许进入或离开 + /// + /// + /// + public static void ResponseEnterOrLeave(string Location, int ResponseType) + { + try + { + // 创建父集合 + FSS_ResponseEnterOrLeave responseEnterOrLeave = new FSS_ResponseEnterOrLeave(); + // 将管控传递来的MsgId 返回回去 + responseEnterOrLeave.MsgId = publicCore.FSSRequestMsgId; //UuidUtil(); + if (publicCore.FSSRequestMsgId == "") + { + publicCore.LogInsert("ResponseEnterOrLeave", "Info", "接口【FSS-接收允许进入或离开】未获取到请求时的MsgId 已使用随机UUID 请确认请求是否有误:" ); + responseEnterOrLeave.MsgId = UuidUtil(); + } + responseEnterOrLeave.ResponseType = ResponseType; + responseEnterOrLeave.Location = Location; + responseEnterOrLeave.MsgSource = 1; + responseEnterOrLeave.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //准备上传的数据 反序列化 + string bodydata = JsonConvert.SerializeObject(responseEnterOrLeave); + publicCore.LogInsert("ResponseEnterOrLeave", "Info", bodydata); + + string urlstr = MesWorkForm.ResponseEnterOrLeaveUrl; + string retString; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr); + request.Method = "post"; + byte[] bytes = Encoding.UTF8.GetBytes(bodydata); + request.Accept = "*/*"; + request.ContentType = "application/json;charset=utf-8"; + + // 反序列化后先把JSON做接口记录 + //存储日志 + int AID = -1; + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var reqParam = new SqlParameter[] { + new SqlParameter("@接口地址",urlstr), + new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",bodydata), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage); + if (reqDt.Rows.Count > 0) + { + AID = Convert.ToInt32(reqDt.Rows[0]["AID"]); + } + + request.ContentLength = bytes.Length; + + // 准备请求体 + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + //发送webapi请求 等待相应 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + retString = myStreamReader.ReadToEnd(); + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",retString) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + + // 序列化响应内容 + msgResHeader mrh = JsonConvert.DeserializeObject(retString); + int statusCode = (int)response.StatusCode; + // 对响应内容进行处理 更新数据库标志 + if (statusCode == 200) + { + // 清空FSS 请求MsgId + publicCore.FSSRequestMsgId = ""; + myStreamReader.Close(); + myResponseStream.Close(); + if (response != null) + { + // 失败 + if (mrh.Code != "200") + { + publicCore.LogInsert("ResponseEnterOrLeave", "Error", "接口【FSS-接收允许进入或离开】失败:" + mrh.Message); + } + response.Close(); + } + if (request != null) + { + request.Abort(); + } + publicCore.LogInsert("ResponseEnterOrLeave", "Info", retString); + } + else + { + publicCore.LogInsert("ResponseEnterOrLeave", "Info", "接口【FSS-接收允许进入或离开】失败:"+ statusCode); + } + } + catch (Exception err) + { + publicCore.LogInsert("ResponseEnterOrLeave", "Info", "接口【FSS-接收允许进入或离开】失败:" + err.Message); + } + } + /// + /// FSS-接收IPC下料请求 + /// + /// + /// + public static void FinishCall(string Location) + { + try + { + // 创建父集合 + FSS_FinishCall finishCall = new FSS_FinishCall(); + finishCall.MsgId = UuidUtil(); + finishCall.Location = Location; + finishCall.MsgSource = 1; + finishCall.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //准备上传的数据 反序列化 + string bodydata = JsonConvert.SerializeObject(finishCall); + publicCore.LogInsert("FinishCall", "Info", bodydata); + + string urlstr = MesWorkForm.FinishCallUrl; + string retString; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr); + request.Method = "post"; + byte[] bytes = Encoding.UTF8.GetBytes(bodydata); + request.Accept = "*/*"; + request.ContentType = "application/json;charset=utf-8"; + + // 反序列化后先把JSON做接口记录 + //存储日志 + int AID = -1; + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var reqParam = new SqlParameter[] { + new SqlParameter("@接口地址",urlstr), + new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",bodydata), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage); + if (reqDt.Rows.Count > 0) + { + AID = Convert.ToInt32(reqDt.Rows[0]["AID"]); + } + + request.ContentLength = bytes.Length; + + // 准备请求体 + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + //发送webapi请求 等待相应 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + retString = myStreamReader.ReadToEnd(); + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",retString) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + + // 序列化响应内容 + msgResHeader mrh = JsonConvert.DeserializeObject(retString); + int statusCode = (int)response.StatusCode; + // 对响应内容进行处理 更新数据库标志 + if (statusCode == 200) + { + myStreamReader.Close(); + myResponseStream.Close(); + if (response != null) + { + // 失败 + if (mrh.Code != "200") + { + publicCore.LogInsert("FinishCall", "Error", "接口【FSS-接收IPC下料请求】失败:" + mrh.Message); + } + response.Close(); + } + if (request != null) + { + request.Abort(); + } + publicCore.LogInsert("FinishCall", "Info", retString); + } + else + { + publicCore.LogInsert("FinishCall", "Error", "接口【FSS-接收IPC下料请求】失败:" + statusCode); + } + } + catch (Exception err) + { + publicCore.LogInsert("FinishCall", "Error", "接口【FSS-接收IPC下料请求】失败:" + err.Message); + } + } + /// + /// FSS-接收IPC状态变化 + /// + /// + /// + public static void DeviceStatus(string Location, int DeviceStatus) + { + try + { + // 创建父集合 + FSS_DeviceStatus deviceStatus = new FSS_DeviceStatus(); + deviceStatus.MsgId = UuidUtil(); + deviceStatus.Location = Location; + deviceStatus.DeviceStatus = DeviceStatus; + deviceStatus.MsgSource = 1; + deviceStatus.SendTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + //准备上传的数据 反序列化 + string bodydata = JsonConvert.SerializeObject(deviceStatus); + publicCore.LogInsert("DeviceStatus", "Info", bodydata); + + string urlstr = MesWorkForm.DeviceStatusUrl; + string retString; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlstr); + request.Method = "post"; + byte[] bytes = Encoding.UTF8.GetBytes(bodydata); + request.Accept = "*/*"; + request.ContentType = "application/json;charset=utf-8"; + + // 反序列化后先把JSON做接口记录 + //存储日志 + int AID = -1; + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var reqParam = new SqlParameter[] { + new SqlParameter("@接口地址",urlstr), + new SqlParameter("@接口类型",1), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",bodydata), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", MesWorkForm.ConnectionString, ref reqParam, out DataTable reqDt, out string errorMessage); + if (reqDt.Rows.Count > 0) + { + AID = Convert.ToInt32(reqDt.Rows[0]["AID"]); + } + + request.ContentLength = bytes.Length; + + // 准备请求体 + Stream myResponseStream = request.GetRequestStream(); + myResponseStream.Write(bytes, 0, bytes.Length); + //发送webapi请求 等待相应 + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8); + retString = myStreamReader.ReadToEnd(); + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",retString) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", MesWorkForm.ConnectionString, ref resParam, out errorMessage); + + // 序列化响应内容 + msgResHeader mrh = JsonConvert.DeserializeObject(retString); + int statusCode = (int)response.StatusCode; + // 对响应内容进行处理 更新数据库标志 + if (statusCode == 200) + { + myStreamReader.Close(); + myResponseStream.Close(); + if (response != null) + { + // 失败 + if (mrh.Code != "200") + { + publicCore.LogInsert("DeviceStatus", "Error", "接口【FSS-接收IPC状态变化】失败" + mrh.Message); + } + response.Close(); + } + if (request != null) + { + request.Abort(); + } + publicCore.LogInsert("DeviceStatus", "Info", retString); + } + else + { + publicCore.LogInsert("DeviceStatus", "Error", "接口【FSS-接收IPC状态变化】失败" + statusCode); + } + } + catch (Exception err) + { + publicCore.LogInsert("DeviceStatus", "Error", "接口【FSS-接收IPC状态变化】失败" + err.Message); + } + } + } +} diff --git a/CCYQ_JieFang/webApi/Controller/FSSController.cs b/CCYQ_JieFang/webApi/Controller/FSSController.cs new file mode 100644 index 0000000..5062bc4 --- /dev/null +++ b/CCYQ_JieFang/webApi/Controller/FSSController.cs @@ -0,0 +1,67 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Web; +using System.Web.Http; +using System.Collections.Concurrent; +using Newtonsoft.Json.Linq; +using System.Runtime.Remoting.Messaging; + + +namespace MesWork +{ + + public class FSSController : ApiController + { + readonly string headUrl = "Project/"; + + [HttpPost] + [Route("lx/ResponseEnterOrLeave")] + // FSS-接收允许进入或离开 + public HttpResponseMessage ResponseEnterOrLeave([FromBody] JObject jobj) + { + + var result = new msgResHeader(); + result.Code = "200"; + result.Message = ""; + string retString = JsonConvert.SerializeObject(result); + return new HttpResponseMessage + { + Content = new StringContent(retString, Encoding.GetEncoding("UTF-8"), "application/json") + }; + } + + [HttpPost] + [Route("lx/FinishCall")] + // FSS-接收IPC下料请求 + public HttpResponseMessage FinishCall([FromBody] JObject jobj) + { + var result = new msgResHeader(); + result.Code = "200"; + result.Message = ""; + string retString = JsonConvert.SerializeObject(result); + return new HttpResponseMessage + { + Content = new StringContent(retString, Encoding.GetEncoding("UTF-8"), "application/json") + }; + } + [HttpPost] + [Route("lx/DeviceStatus")] + // FSS-接收IPC状态变化 + public HttpResponseMessage DeviceStatus([FromBody] JObject jobj) + { + var result = new msgResHeader(); + result.Code = "200"; + result.Message = ""; + string retString = JsonConvert.SerializeObject(result); + return new HttpResponseMessage + { + Content = new StringContent(retString, Encoding.GetEncoding("UTF-8"), "application/json") + }; + } + } +} diff --git a/CCYQ_JieFang/webApi/Controller/IpcController.cs b/CCYQ_JieFang/webApi/Controller/IpcController.cs new file mode 100644 index 0000000..60d10bd --- /dev/null +++ b/CCYQ_JieFang/webApi/Controller/IpcController.cs @@ -0,0 +1,78 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Web; +using System.Web.Http; +using System.Collections.Concurrent; +using Newtonsoft.Json.Linq; +using System.Runtime.Remoting.Messaging; + + +namespace MesWork +{ + + public class IpcController : ApiController + { + readonly string headUrl = "Project/"; + + [HttpPost] + [Route("IPC/product")] + // IPC-接收装配信息 + public HttpResponseMessage product([FromBody] JObject jobj) + { + return new HttpResponseMessage + { + Content = new StringContent(AnalysisMsg.product(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json") + }; + } + + [HttpPost] + [Route("IPC/RequestEnterOrLeave")] + // IPC-设备可进入或可离开状态 + public HttpResponseMessage RequestEnterOrLeave([FromBody] JObject jobj) + { + return new HttpResponseMessage + { + Content = new StringContent(AnalysisMsg.RequestEnterOrLeave(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json") + }; + } + [HttpPost] + [Route("IPC/WorkFinsih")] + // IPC-上下料完成AGV离开 + public HttpResponseMessage WorkFinsih([FromBody] JObject jobj) + { + return new HttpResponseMessage + { + Content = new StringContent(AnalysisMsg.WorkFinsih(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json") + }; + } + [HttpPost] + [Route("IPC/DeviceStatus")] + // IPC-设备状态 + public HttpResponseMessage DeviceStatus([FromBody] JObject jobj) + { + return new HttpResponseMessage + { + Content = new StringContent(AnalysisMsg.IPCDeviceStatus(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json") + }; + } + [HttpGet] + [Route("getInfo")] + public HttpResponseMessage getInfo() + { + string pp = @"{\""Result\"":\""OK\""}"; + try + { + } + catch (Exception err) + { + // GlobalVar.log.Error(err.Message); + } + return new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; + } + } +} diff --git a/CCYQ_JieFang/webApi/IPC_product.cs b/CCYQ_JieFang/webApi/IPC_product.cs new file mode 100644 index 0000000..93666a3 --- /dev/null +++ b/CCYQ_JieFang/webApi/IPC_product.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using System.Data; + +namespace MesWork +{ + public class IPC_product + { + public string MsgId = ""; + /// + /// 1:IPC、2:FSS、3:AGV + /// + public int MsgSource = 0; + public string Location = ""; + public List AssemblyInformation = new List(); + public string SendTime = string.Empty; + } + public class IPC_product_AssemblyInformation + { + public string productNo = string.Empty; + public string productName = string.Empty; + public int productPosition = 0; + } + + public class IPC_RequestEnterOrLeave + { + public string MsgId = ""; + /// + /// 1:IPC、2:FSS、3:AGV + /// + public int MsgSource = 0; + public string Location = ""; + /// + /// 1:查询是否可以进入 + /// 2:查询是否可以离开 + /// + public int RequestType = 0; + public string SendTime = string.Empty; + } + + public class IPC_WorkFinsih + { + public string MsgId = ""; + /// + /// 1:IPC、2:FSS、3:AGV + /// + public int MsgSource = 0; + public string Location = ""; + /// + /// 1:上料完成离开 + /// 2:下料完成离开 + /// + public int FinishType = 0; + public string SendTime = string.Empty; + } + + /// + /// IPC提供WEBAPI接口,接收FSS发过来的请求设备状态 会调用FSS接口放回指定工位状态 + /// + public class IPC_DeviceStatus + { + public string MsgId = ""; + /// + /// 1:IPC、2:FSS、3:AGV + /// + public int MsgSource = 0; + public string Location = ""; + public string SendTime = string.Empty; + } + + /// + /// FSS提供WEBAPI接口,接收IPC发过来的AGV可进入或离开设备的接口 + /// + public class FSS_ResponseEnterOrLeave + { + public string MsgId = ""; + /// + /// 1:IPC、2:FSS、3:AGV + /// + public int MsgSource = 0; + public string Location = ""; + /// + /// 1:可以进入 + /// 2:可以离开 + /// + public int ResponseType = 0; + public string SendTime = string.Empty; + } + /// + /// FSS提供WEBAPI接口,接收IPC发过来的请求下料接口 + /// + public class FSS_FinishCall + { + public string MsgId = ""; + /// + /// 1:IPC、2:FSS、3:AGV + /// + public int MsgSource = 0; + public string Location = ""; + public string SendTime = string.Empty; + } + /// + /// FSS提供WEBAPI接口,接收IPC发过来的设备状态信息 + /// + public class FSS_DeviceStatus + { + public string MsgId = ""; + /// + /// 1:IPC、2:FSS、3:AGV + /// + public int MsgSource = 0; + public string Location = ""; + /// + /// 1:运行(既不可以上料也不可以下料) + /// 2:空闲(可以上料) + /// 3:完成(可以下料) + /// 4:报警(设备报警) + /// + public int DeviceStatus = 0; + public string SendTime = string.Empty; + } +} diff --git a/CCYQ_JieFang/webApi/InitServer.cs b/CCYQ_JieFang/webApi/InitServer.cs new file mode 100644 index 0000000..66d0e40 --- /dev/null +++ b/CCYQ_JieFang/webApi/InitServer.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Formatting; +using System.Net.Http.Headers; +using System.Web.Http; +using System.Web.Http.Cors; +using System.Web.Http.SelfHost; + +namespace MesWork +{ + + + public class InitServer + { + HttpSelfHostConfiguration config = null; + HttpSelfHostServer server = null; + public InitServer(string Url_WebApi) + { + // var Url_WebApi = System.Configuration.ConfigurationManager.AppSettings["Url_WebApi"]; + Init(Url_WebApi); + } + public void Init(string url) + { + config = new HttpSelfHostConfiguration(url); + + // 启用跨域 + config.EnableCors(new EnableCorsAttribute("*", "*", "*")); + // 启用特性路由 + config.MapHttpAttributeRoutes(); + + //config.Routes.MapHttpRoute( + // name: "DefaultApi", + // routeTemplate: "api/{controller}/{id}", + // defaults: new { id = RouteParameter.Optional } + //); + + // 自定义路由匹配到action + config.Routes.MapHttpRoute( + name: "API Default", + routeTemplate: "api/{controller}/{action}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + + + + server = new HttpSelfHostServer(config); + + server.OpenAsync().Wait(); + + + } + public class JsonContentNegotiator : IContentNegotiator + { + private readonly JsonMediaTypeFormatter _jsonFormatter; + + public JsonContentNegotiator(JsonMediaTypeFormatter formatter) + { + _jsonFormatter = formatter; + } + public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable formatters) + { + var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json")); + return result; + } + } + } +} diff --git a/CCYQ_JieFang/webApi/msgResHeader.cs b/CCYQ_JieFang/webApi/msgResHeader.cs new file mode 100644 index 0000000..a4ed5db --- /dev/null +++ b/CCYQ_JieFang/webApi/msgResHeader.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MesWork +{ + public class msgResHeader + { + public string Code = string.Empty; + public string Message = string.Empty; + public string MsgId = string.Empty; + } +} diff --git a/CCYQ_JieFang/任务管理.ico b/CCYQ_JieFang/任务管理.ico new file mode 100644 index 0000000..1ad3c11 Binary files /dev/null and b/CCYQ_JieFang/任务管理.ico differ diff --git a/CallWebApi/03_CallWebApi.csproj b/CallWebApi/03_CallWebApi.csproj new file mode 100644 index 0000000..61ad5b8 --- /dev/null +++ b/CallWebApi/03_CallWebApi.csproj @@ -0,0 +1,62 @@ + + + + + Debug + AnyCPU + {727A1B50-D83A-4319-BDF6-E923F4BD41B3} + Exe + CallWebApi + CallWebApi + v4.8 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CallWebApi/App.config b/CallWebApi/App.config new file mode 100644 index 0000000..6043180 --- /dev/null +++ b/CallWebApi/App.config @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CallWebApi/CallWebApi.cs b/CallWebApi/CallWebApi.cs new file mode 100644 index 0000000..810b81f --- /dev/null +++ b/CallWebApi/CallWebApi.cs @@ -0,0 +1,205 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace CallWebApi +{ + public class Post + { + public static string Postring(string url, Dictionary dic) + { + string result = ""; + //url = "http://172.16.22.15:8000/" + url; + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); + req.Method = "POST"; + req.ContentType = "application/x-www-form-urlencoded"; + req.Proxy = null; + + req.KeepAlive = false; + + #region 添加Post 参数 + StringBuilder builder = new StringBuilder(); + int i = 0; + foreach (var item in dic) + { + if (i > 0) + builder.Append("&"); + builder.AppendFormat("{0}={1}", item.Key, item.Value); + i++; + } + byte[] data = Encoding.UTF8.GetBytes(builder.ToString()); + req.ContentLength = data.Length; + using (Stream reqStream = req.GetRequestStream()) + { + reqStream.Write(data, 0, data.Length); + reqStream.Close(); + } + #endregion + HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); + Stream stream = resp.GetResponseStream(); + + //获取响应内容 + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) + { + result = reader.ReadToEnd(); + } + return result; + } + + public static string Postring1(string url, string token, Dictionary dic) + { + string results = ""; + //url = "http://172.16.22.15:8000/" + url; + + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); + req.Method = "POST"; + req.ContentType = "application/x-www-form-urlencoded"; + req.Headers.Add("Authorization", "Bearer " + token); + + StringBuilder builder = new StringBuilder(); + int i = 0; + foreach (var item in dic) + { + if (i > 0) + builder.Append("&"); + builder.AppendFormat("{0}={1}", item.Key, item.Value); + i++; + } + byte[] data = Encoding.UTF8.GetBytes(builder.ToString()); + req.ContentLength = data.Length; + try + { + using (Stream reqStream = req.GetRequestStream()) + { + reqStream.Write(data, 0, data.Length); + reqStream.Close(); + } + HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); + Stream stream = resp.GetResponseStream(); + //获取响应内容 + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) + { + results = reader.ReadToEnd(); + } + return results; + } + catch (Exception e) + { + Console.WriteLine(e.Message); + return e.Message; + throw; + } + + } + + + public static string MyPost() + { + // var url = "http://192.168.1.224:41190/"; + var url = "http://127.0.0.1:41190/"; + var controller = "ZSaveTag"; + var action = "SelectPage"; + Dictionary dict = new Dictionary(); + dict.Add("OpName",""); + dict.Add("StartTime", "2022-06-24 00:00:00"); + dict.Add("EndTime", "2022-06-30 00:00:00"); + dict.Add("PageCurrent", "1"); + dict.Add("PageSize", "2"); + + + var reqUrl = url + "/api/" + controller + "/" + action; + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(reqUrl); + req.Method = "POST"; + req.ContentType = "application/json"; + req.Proxy = null; + + req.KeepAlive = false; + + #region 添加Post 参数 + JObject jObject = new JObject(); + jObject.Add("OpName", ""); + jObject.Add("StartTime", "2022-06-24 00:00:00"); + jObject.Add("EndTime", "2022-06-30 00:00:00"); + jObject.Add("PageCurrent", "2"); + jObject.Add("PageSize", "3"); + var jStr = jObject.ToString(); + + //StringBuilder builder = new StringBuilder(); + //int i = 0; + //foreach (var item in dict) + //{ + // if (i > 0) + // builder.Append("&"); + // builder.AppendFormat("{0}={1}", item.Key, item.Value); + // i++; + //} + //byte[] data = Encoding.UTF8.GetBytes(builder.ToString()); + byte[] data = Encoding.UTF8.GetBytes(jStr); + req.ContentLength = data.Length; + using (Stream reqStream = req.GetRequestStream()) + { + reqStream.Write(data, 0, data.Length); + reqStream.Close(); + } + #endregion + HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); + Stream stream = resp.GetResponseStream(); + + string result = ""; + + //获取响应内容 + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) + { + result = reader.ReadToEnd(); + } + return result; + } + + public static string MyPost(string url,string jsonStr) + { + string result = ""; + + try + { + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); + req.Method = "POST"; + req.ContentType = "application/json"; + req.Proxy = null; + req.KeepAlive = false; + + byte[] data = Encoding.UTF8.GetBytes(jsonStr); + req.ContentLength = data.Length; + using (Stream reqStream = req.GetRequestStream()) + { + reqStream.Write(data, 0, data.Length); + reqStream.Close(); + } + + HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); + Stream stream = resp.GetResponseStream(); + + + //获取响应内容 + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) + { + result = reader.ReadToEnd(); + } + Console.WriteLine(result); + + + } + catch (Exception err) + { + Console.WriteLine(" " + err.Message); + } + + return result; + } + + } +} diff --git a/CallWebApi/Program.cs b/CallWebApi/Program.cs new file mode 100644 index 0000000..aaf6a2d --- /dev/null +++ b/CallWebApi/Program.cs @@ -0,0 +1,32 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CallWebApi +{ + internal class Program + { + static void Main(string[] args) + { + Post.MyPost(); + + var url = "http://localhost:41190/api/ZSaveTag/SelectPage"; + + JObject jObject = new JObject(); + jObject.Add("OpName", ""); + jObject.Add("StartTime", "2022-06-24 00:00:00"); + jObject.Add("EndTime", "2022-06-30 00:00:00"); + jObject.Add("PageCurrent", "2"); + jObject.Add("PageSize", "3"); + var jStr = jObject.ToString(); + + Post.MyPost(url, jStr); + + Console.ReadKey(); + + } + } +} diff --git a/CallWebApi/Properties/AssemblyInfo.cs b/CallWebApi/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7fca5ca --- /dev/null +++ b/CallWebApi/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CallWebApi")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CallWebApi")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("727a1b50-d83a-4319-bdf6-e923f4bd41b3")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CallWebApi/packages.config b/CallWebApi/packages.config new file mode 100644 index 0000000..ce3dc38 --- /dev/null +++ b/CallWebApi/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/DK_DC_Tool/.gitignore b/DK_DC_Tool/.gitignore new file mode 100644 index 0000000..e1e248c --- /dev/null +++ b/DK_DC_Tool/.gitignore @@ -0,0 +1,43 @@ +*.pyc +*.map +*.dblite +*.elf +*.bin +*.hex +*.axf +*.exe +*.pdb +*.idb +*.ilk +*.old +build +bin +obj +Debug +documentation/html +*~ +*.o +*.obj +*.out +*.bak +*.dep +*.lib +*.i +*.d +.DS_Stor* +.config 3 +.config 4 +.config 5 +Midea-X1 +*.uimg +GPATH +GRTAGS +GTAGS +.vscode +JLinkLog.txt +JLinkSettings.ini +DebugConfig/ +RTE/ +settings/ +*.uvguix* +cconfig.h diff --git a/DK_DC_Tool/App.config b/DK_DC_Tool/App.config new file mode 100644 index 0000000..4d782f9 --- /dev/null +++ b/DK_DC_Tool/App.config @@ -0,0 +1,53 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DK_DC_Tool/DK_DC_Tool.csproj b/DK_DC_Tool/DK_DC_Tool.csproj new file mode 100644 index 0000000..e8d79a9 --- /dev/null +++ b/DK_DC_Tool/DK_DC_Tool.csproj @@ -0,0 +1,104 @@ + + + + + Debug + AnyCPU + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7} + WinExe + DK_DC_Tool + DK_DC_Tool + v4.8 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + {1dc48c83-1842-4de8-acaf-26e1e7f7c58f} + 01_MyLog4Net + + + + \ No newline at end of file diff --git a/DK_DC_Tool/DK_DC_Tool.sln b/DK_DC_Tool/DK_DC_Tool.sln new file mode 100644 index 0000000..56a37a1 --- /dev/null +++ b/DK_DC_Tool/DK_DC_Tool.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31919.166 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DK_DC_Tool", "DK_DC_Tool.csproj", "{3C6FEF50-2014-4157-A12B-93FB4AD20FE7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3C6FEF50-2014-4157-A12B-93FB4AD20FE7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1894CA72-2F06-434D-A73A-03E306A66BA2} + EndGlobalSection +EndGlobal diff --git a/DK_DC_Tool/Form1.Designer.cs b/DK_DC_Tool/Form1.Designer.cs new file mode 100644 index 0000000..abb8d52 --- /dev/null +++ b/DK_DC_Tool/Form1.Designer.cs @@ -0,0 +1,483 @@ +namespace DK_DC_Tool +{ + partial class Form1 + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要修改 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.label6 = new System.Windows.Forms.Label(); + this.cbxDevType = new System.Windows.Forms.ComboBox(); + this.btnOpen = new System.Windows.Forms.Button(); + this.gbxSerial = new System.Windows.Forms.GroupBox(); + this.tbxSerialProtocol = new System.Windows.Forms.TextBox(); + this.label10 = new System.Windows.Forms.Label(); + this.tbxSerialAddr = new System.Windows.Forms.TextBox(); + this.label9 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.cbxSerial = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.cbxSerialCheckSum = new System.Windows.Forms.ComboBox(); + this.cbxSerialBaud = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.cbxSerialStopBit = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.cbxSerialDataBit = new System.Windows.Forms.ComboBox(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.tbxTcpDestIP = new System.Windows.Forms.TextBox(); + this.tbxTcpDestPort = new System.Windows.Forms.TextBox(); + this.gbxTcp = new System.Windows.Forms.GroupBox(); + this.gbxProtocol = new System.Windows.Forms.GroupBox(); + this.btnProtocolSend = new System.Windows.Forms.Button(); + this.tbxProtocolData = new System.Windows.Forms.TextBox(); + this.label13 = new System.Windows.Forms.Label(); + this.tbxProtocolMID = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); + this.cbxProtocolOp = new System.Windows.Forms.ComboBox(); + this.label11 = new System.Windows.Forms.Label(); + this.tbxProtocolDebug = new System.Windows.Forms.TextBox(); + this.btnClear = new System.Windows.Forms.Button(); + this.gbxSerial.SuspendLayout(); + this.gbxTcp.SuspendLayout(); + this.gbxProtocol.SuspendLayout(); + this.SuspendLayout(); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(30, 21); + this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(62, 18); + this.label6.TabIndex = 10; + this.label6.Text = "类型:"; + // + // cbxDevType + // + this.cbxDevType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxDevType.FormattingEnabled = true; + this.cbxDevType.Location = new System.Drawing.Point(118, 16); + this.cbxDevType.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbxDevType.Name = "cbxDevType"; + this.cbxDevType.Size = new System.Drawing.Size(130, 26); + this.cbxDevType.TabIndex = 11; + this.cbxDevType.SelectedIndexChanged += new System.EventHandler(this.cbxDevType_SelectedIndexChanged); + // + // btnOpen + // + this.btnOpen.Location = new System.Drawing.Point(418, 12); + this.btnOpen.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnOpen.Name = "btnOpen"; + this.btnOpen.Size = new System.Drawing.Size(142, 42); + this.btnOpen.TabIndex = 13; + this.btnOpen.Text = "打开"; + this.btnOpen.UseVisualStyleBackColor = true; + this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click); + // + // gbxSerial + // + this.gbxSerial.Controls.Add(this.tbxSerialProtocol); + this.gbxSerial.Controls.Add(this.label10); + this.gbxSerial.Controls.Add(this.tbxSerialAddr); + this.gbxSerial.Controls.Add(this.label9); + this.gbxSerial.Controls.Add(this.label1); + this.gbxSerial.Controls.Add(this.cbxSerial); + this.gbxSerial.Controls.Add(this.label2); + this.gbxSerial.Controls.Add(this.cbxSerialCheckSum); + this.gbxSerial.Controls.Add(this.cbxSerialBaud); + this.gbxSerial.Controls.Add(this.label5); + this.gbxSerial.Controls.Add(this.label3); + this.gbxSerial.Controls.Add(this.cbxSerialStopBit); + this.gbxSerial.Controls.Add(this.label4); + this.gbxSerial.Controls.Add(this.cbxSerialDataBit); + this.gbxSerial.Location = new System.Drawing.Point(638, 96); + this.gbxSerial.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.gbxSerial.Name = "gbxSerial"; + this.gbxSerial.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.gbxSerial.Size = new System.Drawing.Size(548, 218); + this.gbxSerial.TabIndex = 16; + this.gbxSerial.TabStop = false; + // + // tbxSerialProtocol + // + this.tbxSerialProtocol.Location = new System.Drawing.Point(400, 120); + this.tbxSerialProtocol.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbxSerialProtocol.Name = "tbxSerialProtocol"; + this.tbxSerialProtocol.Size = new System.Drawing.Size(130, 28); + this.tbxSerialProtocol.TabIndex = 19; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(294, 124); + this.label10.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(98, 18); + this.label10.TabIndex = 18; + this.label10.Text = "协议类型:"; + // + // tbxSerialAddr + // + this.tbxSerialAddr.Location = new System.Drawing.Point(400, 70); + this.tbxSerialAddr.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbxSerialAddr.Name = "tbxSerialAddr"; + this.tbxSerialAddr.Size = new System.Drawing.Size(130, 28); + this.tbxSerialAddr.TabIndex = 17; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(294, 76); + this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(62, 18); + this.label9.TabIndex = 10; + this.label9.Text = "地址:"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 26); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(80, 18); + this.label1.TabIndex = 0; + this.label1.Text = "串口号:"; + // + // cbxSerial + // + this.cbxSerial.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxSerial.FormattingEnabled = true; + this.cbxSerial.Location = new System.Drawing.Point(100, 21); + this.cbxSerial.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbxSerial.Name = "cbxSerial"; + this.cbxSerial.Size = new System.Drawing.Size(130, 26); + this.cbxSerial.TabIndex = 1; + this.cbxSerial.DropDown += new System.EventHandler(this.cbxSerial_DropDown); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 76); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(80, 18); + this.label2.TabIndex = 2; + this.label2.Text = "波特率:"; + // + // cbxSerialCheckSum + // + this.cbxSerialCheckSum.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxSerialCheckSum.FormattingEnabled = true; + this.cbxSerialCheckSum.Location = new System.Drawing.Point(400, 21); + this.cbxSerialCheckSum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbxSerialCheckSum.Name = "cbxSerialCheckSum"; + this.cbxSerialCheckSum.Size = new System.Drawing.Size(130, 26); + this.cbxSerialCheckSum.TabIndex = 9; + // + // cbxSerialBaud + // + this.cbxSerialBaud.FormattingEnabled = true; + this.cbxSerialBaud.Location = new System.Drawing.Point(100, 72); + this.cbxSerialBaud.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbxSerialBaud.Name = "cbxSerialBaud"; + this.cbxSerialBaud.Size = new System.Drawing.Size(130, 26); + this.cbxSerialBaud.TabIndex = 3; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(294, 26); + this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(98, 18); + this.label5.TabIndex = 8; + this.label5.Text = "校验格式:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(12, 124); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(80, 18); + this.label3.TabIndex = 4; + this.label3.Text = "数据位:"; + // + // cbxSerialStopBit + // + this.cbxSerialStopBit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxSerialStopBit.FormattingEnabled = true; + this.cbxSerialStopBit.Location = new System.Drawing.Point(100, 171); + this.cbxSerialStopBit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbxSerialStopBit.Name = "cbxSerialStopBit"; + this.cbxSerialStopBit.Size = new System.Drawing.Size(130, 26); + this.cbxSerialStopBit.TabIndex = 7; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(12, 176); + this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(80, 18); + this.label4.TabIndex = 5; + this.label4.Text = "停止位:"; + // + // cbxSerialDataBit + // + this.cbxSerialDataBit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxSerialDataBit.FormattingEnabled = true; + this.cbxSerialDataBit.Location = new System.Drawing.Point(100, 120); + this.cbxSerialDataBit.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbxSerialDataBit.Name = "cbxSerialDataBit"; + this.cbxSerialDataBit.Size = new System.Drawing.Size(130, 26); + this.cbxSerialDataBit.TabIndex = 6; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(9, 153); + this.label8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(80, 18); + this.label8.TabIndex = 2; + this.label8.Text = "端口号:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(9, 51); + this.label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(80, 18); + this.label7.TabIndex = 0; + this.label7.Text = "IP地址:"; + // + // tbxTcpDestIP + // + this.tbxTcpDestIP.Location = new System.Drawing.Point(98, 46); + this.tbxTcpDestIP.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbxTcpDestIP.Name = "tbxTcpDestIP"; + this.tbxTcpDestIP.Size = new System.Drawing.Size(148, 28); + this.tbxTcpDestIP.TabIndex = 3; + // + // tbxTcpDestPort + // + this.tbxTcpDestPort.Location = new System.Drawing.Point(98, 148); + this.tbxTcpDestPort.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbxTcpDestPort.Name = "tbxTcpDestPort"; + this.tbxTcpDestPort.Size = new System.Drawing.Size(148, 28); + this.tbxTcpDestPort.TabIndex = 4; + // + // gbxTcp + // + this.gbxTcp.Controls.Add(this.tbxTcpDestPort); + this.gbxTcp.Controls.Add(this.tbxTcpDestIP); + this.gbxTcp.Controls.Add(this.label7); + this.gbxTcp.Controls.Add(this.label8); + this.gbxTcp.Location = new System.Drawing.Point(18, 76); + this.gbxTcp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.gbxTcp.Name = "gbxTcp"; + this.gbxTcp.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.gbxTcp.Size = new System.Drawing.Size(548, 218); + this.gbxTcp.TabIndex = 15; + this.gbxTcp.TabStop = false; + // + // gbxProtocol + // + this.gbxProtocol.Controls.Add(this.btnProtocolSend); + this.gbxProtocol.Controls.Add(this.tbxProtocolData); + this.gbxProtocol.Controls.Add(this.label13); + this.gbxProtocol.Controls.Add(this.tbxProtocolMID); + this.gbxProtocol.Controls.Add(this.label12); + this.gbxProtocol.Controls.Add(this.cbxProtocolOp); + this.gbxProtocol.Controls.Add(this.label11); + this.gbxProtocol.Location = new System.Drawing.Point(18, 303); + this.gbxProtocol.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.gbxProtocol.Name = "gbxProtocol"; + this.gbxProtocol.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.gbxProtocol.Size = new System.Drawing.Size(548, 488); + this.gbxProtocol.TabIndex = 17; + this.gbxProtocol.TabStop = false; + // + // btnProtocolSend + // + this.btnProtocolSend.Location = new System.Drawing.Point(82, 62); + this.btnProtocolSend.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnProtocolSend.Name = "btnProtocolSend"; + this.btnProtocolSend.Size = new System.Drawing.Size(450, 50); + this.btnProtocolSend.TabIndex = 23; + this.btnProtocolSend.Text = "发送"; + this.btnProtocolSend.UseVisualStyleBackColor = true; + this.btnProtocolSend.Click += new System.EventHandler(this.btnProtocolSend_Click); + // + // tbxProtocolData + // + this.tbxProtocolData.Location = new System.Drawing.Point(15, 118); + this.tbxProtocolData.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbxProtocolData.Multiline = true; + this.tbxProtocolData.Name = "tbxProtocolData"; + this.tbxProtocolData.Size = new System.Drawing.Size(516, 358); + this.tbxProtocolData.TabIndex = 22; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(12, 72); + this.label13.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(62, 18); + this.label13.TabIndex = 21; + this.label13.Text = "数据:"; + // + // tbxProtocolMID + // + this.tbxProtocolMID.Location = new System.Drawing.Point(400, 21); + this.tbxProtocolMID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbxProtocolMID.Name = "tbxProtocolMID"; + this.tbxProtocolMID.Size = new System.Drawing.Size(130, 28); + this.tbxProtocolMID.TabIndex = 20; + this.tbxProtocolMID.Text = "0202"; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(339, 26); + this.label12.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(53, 18); + this.label12.TabIndex = 11; + this.label12.Text = "MID:"; + // + // cbxProtocolOp + // + this.cbxProtocolOp.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxProtocolOp.FormattingEnabled = true; + this.cbxProtocolOp.Location = new System.Drawing.Point(118, 21); + this.cbxProtocolOp.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.cbxProtocolOp.Name = "cbxProtocolOp"; + this.cbxProtocolOp.Size = new System.Drawing.Size(130, 26); + this.cbxProtocolOp.TabIndex = 10; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(12, 26); + this.label11.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(98, 18); + this.label11.TabIndex = 9; + this.label11.Text = "操作方式:"; + // + // tbxProtocolDebug + // + this.tbxProtocolDebug.Location = new System.Drawing.Point(590, 12); + this.tbxProtocolDebug.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tbxProtocolDebug.Multiline = true; + this.tbxProtocolDebug.Name = "tbxProtocolDebug"; + this.tbxProtocolDebug.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.tbxProtocolDebug.Size = new System.Drawing.Size(1069, 697); + this.tbxProtocolDebug.TabIndex = 23; + // + // btnClear + // + this.btnClear.Location = new System.Drawing.Point(590, 735); + this.btnClear.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnClear.Name = "btnClear"; + this.btnClear.Size = new System.Drawing.Size(282, 56); + this.btnClear.TabIndex = 25; + this.btnClear.Text = "清除"; + this.btnClear.UseVisualStyleBackColor = true; + this.btnClear.Click += new System.EventHandler(this.btnClear_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1702, 808); + this.Controls.Add(this.btnClear); + this.Controls.Add(this.tbxProtocolDebug); + this.Controls.Add(this.gbxProtocol); + this.Controls.Add(this.gbxSerial); + this.Controls.Add(this.gbxTcp); + this.Controls.Add(this.btnOpen); + this.Controls.Add(this.cbxDevType); + this.Controls.Add(this.label6); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Name = "Form1"; + this.Text = "DK_DC 报文调试助手"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); + this.Load += new System.EventHandler(this.Form1_Load); + this.gbxSerial.ResumeLayout(false); + this.gbxSerial.PerformLayout(); + this.gbxTcp.ResumeLayout(false); + this.gbxTcp.PerformLayout(); + this.gbxProtocol.ResumeLayout(false); + this.gbxProtocol.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Label label6; + private System.Windows.Forms.ComboBox cbxDevType; + private System.Windows.Forms.Button btnOpen; + private System.Windows.Forms.GroupBox gbxSerial; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox cbxSerial; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox cbxSerialCheckSum; + private System.Windows.Forms.ComboBox cbxSerialBaud; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox cbxSerialStopBit; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.ComboBox cbxSerialDataBit; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.TextBox tbxTcpDestIP; + private System.Windows.Forms.TextBox tbxTcpDestPort; + private System.Windows.Forms.GroupBox gbxTcp; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.TextBox tbxSerialAddr; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox tbxSerialProtocol; + private System.Windows.Forms.GroupBox gbxProtocol; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.ComboBox cbxProtocolOp; + private System.Windows.Forms.TextBox tbxProtocolMID; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.TextBox tbxProtocolData; + private System.Windows.Forms.Button btnProtocolSend; + private System.Windows.Forms.TextBox tbxProtocolDebug; + private System.Windows.Forms.Button btnClear; + } +} + diff --git a/DK_DC_Tool/Form1.cs b/DK_DC_Tool/Form1.cs new file mode 100644 index 0000000..0bf1338 --- /dev/null +++ b/DK_DC_Tool/Form1.cs @@ -0,0 +1,812 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.IO.Ports; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace DK_DC_Tool +{ + public enum RETURN_ERR_STATE + { + RETURN_EOK = 0, + RETURN_ERR = -1, + RETURN_ESTOP = -2, + RETURN_ECONNECT = -3, + RETURN_ETIMEOUT = -4, + RETURN_EDECOMPOSE = -5 + } + + public partial class Form1 : Form + { + readonly string[] dev_type_tab = new string[] { "串口", "TCP" }; + readonly string[] serial_baud_tab = new string[] { "1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200" }; + readonly string[] serial_databit_tab = new string[] { "5", "6", "7", "8" }; + readonly string[] serial_stopbit_tab = new string[] { "1", "1.5", "2" }; + readonly string[] serial_checksum_tab = new string[] { "无", "奇校验", "偶校验", "置1", "置0" }; + readonly string[] protocol_op_tab = new string[] { "R", "W" }; + + enum DevType { DEV_TYPE_SERIAL = 0, DEV_TYPE_TCP }; + + int _dev_type; + byte _serial_addr = 0; + byte _serial_protocol = 0; + SerialPort _serial = null; + TcpClient _client = null; + Thread _parse_tid = null; + bool _isconnected = false; + bool _is_run = false; + bool _is_show_packet = true; + bool _is_reconnect = true; + bool _first_connect = true; + UInt32 _reconnect_cnt = 0; + Mutex _hw_mtx = null; + + public Form1() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + cbxDevType.Items.AddRange(dev_type_tab); + cbxDevType.SelectedIndex = 0; + _dev_type = (int)DevType.DEV_TYPE_SERIAL; + + gbxSerial.Visible = true; + gbxSerial.BringToFront(); + gbxTcp.Visible = false; + + string[] ports = SerialPort.GetPortNames(); + cbxSerial.Items.AddRange(ports); + cbxSerial.SelectedIndex = cbxSerial.Items.Count > 0 ? 0 : -1; + cbxSerialBaud.Items.AddRange(serial_baud_tab); + cbxSerialBaud.SelectedIndex = 7; + cbxSerialDataBit.Items.AddRange(serial_databit_tab); + cbxSerialDataBit.SelectedIndex = 3; + cbxSerialStopBit.Items.AddRange(serial_stopbit_tab); + cbxSerialStopBit.SelectedIndex = 0; + cbxSerialCheckSum.Items.AddRange(serial_checksum_tab); + cbxSerialCheckSum.SelectedIndex = 0; + tbxSerialAddr.Text = "1"; + tbxSerialProtocol.Text = "1"; + + //tbxTcpDestIP.Text = "192.168.2.32"; + tbxTcpDestIP.Text = "192.168.3.31"; + tbxTcpDestPort.Text = "5000"; + + gbxProtocol.Enabled = false; + cbxProtocolOp.Items.AddRange(protocol_op_tab); + cbxProtocolOp.SelectedIndex = 0; + + _hw_mtx = new Mutex(); + + + _parse_tid = new Thread(new ThreadStart(parse_entry)); + _parse_tid.Name = "data_parse"; + _parse_tid.IsBackground = true; + _parse_tid.Start(); + } + + private void Form1_FormClosing(object sender, FormClosingEventArgs e) + { + try + { + if (_parse_tid != null) + _parse_tid.Abort(); + } + finally + { + _parse_tid = null; + } + + try + { + if (_serial != null) + _serial.Close(); + } + finally + { + _serial = null; + } + + try + { + if (_client != null) + _client.Close(); + } + finally + { + _client = null; + } + + Environment.Exit(0); + } + + private void btnOpen_Click(object sender, EventArgs e) + { + if (btnOpen.Text == "打开") + { + if (cbxDevType.SelectedIndex == 0) + _dev_type = (int)DevType.DEV_TYPE_SERIAL; + else + _dev_type = (int)DevType.DEV_TYPE_TCP; + + + + if (_dev_type == (int)DevType.DEV_TYPE_SERIAL) + { + try + { + _serial_addr = byte.Parse(tbxSerialAddr.Text); + _serial_protocol = byte.Parse(tbxSerialProtocol.Text); + } + catch + { + MessageBox.Show("串口地址和协议类型配置出错"); + return; + } + } + + //_log.Info("\r\n\r\n\r\n"); + //_log.Info("启动"); + + btnOpen.Text = "关闭"; + cbxDevType.Enabled = false; + gbxTcp.Enabled = false; + gbxSerial.Enabled = false; + gbxProtocol.Enabled = true; + + _is_run = true; + + if (_dev_type == (int)DevType.DEV_TYPE_SERIAL) + _is_reconnect = false; + else + _is_reconnect = true; + + _first_connect = true; + _reconnect_cnt = 0; + } + else + { + //_log.Info("\r\n\r\n\r\n"); + //_log.Info("结束"); + + btnOpen.Text = "打开"; + cbxDevType.Enabled = true; + gbxTcp.Enabled = true; + gbxSerial.Enabled = true; + gbxProtocol.Enabled = false; + _is_run = false; + } + } + + private void btnClear_Click(object sender, EventArgs e) + { + tbxProtocolDebug.Clear(); + } + + private void cbxDevType_SelectedIndexChanged(object sender, EventArgs e) + { + if (cbxDevType.SelectedIndex == 0) + { + gbxSerial.Visible = true; + gbxSerial.BringToFront(); + gbxTcp.Visible = false; + } + else + { + gbxTcp.Visible = true; + gbxTcp.BringToFront(); + gbxSerial.Visible = false; + } + } + + private void cbxSerial_DropDown(object sender, EventArgs e) + { + string[] ports = SerialPort.GetPortNames(); + cbxSerial.Items.Clear(); + cbxSerial.Items.AddRange(ports); + cbxSerial.SelectedIndex = cbxSerial.Items.Count > 0 ? 0 : -1; + } + + //代理 + private delegate void change_tbx_delegate(string str); + + private void tbxProtocolDebug_show(string str) + { + if (tbxProtocolDebug.InvokeRequired) + { + change_tbx_delegate cd = new change_tbx_delegate(tbxProtocolDebug_show); + tbxProtocolDebug.Invoke(cd, new object[] { str }); + + } + else + { + tbxProtocolDebug.Text += str; + tbxProtocolDebug.Text += "\r\n\r\n"; + tbxProtocolDebug.Select(tbxProtocolDebug.TextLength, 0); + tbxProtocolDebug.ScrollToCaret(); + } + } + + private string bytes_to_hex_string(byte[] buf, int offset, int len) + { + string str = ""; + + for (int i = 0; i < len; i++) + { + str += buf[offset + i].ToString("X2") + " "; + } + + return str; + } + + private string bytes_to_string(byte[] buf, int offset, int len) + { + string str = ""; + + for (int i = 0; i < len; i++) + { + if ((buf[offset + i] < 32) || (buf[offset + i] > 126)) + str += " ."; + else + str += " " + ((char)buf[offset + i]).ToString(); + + str += " "; + } + + return str; + } + + private bool serial_open(ref SerialPort port, ComboBox serialNo, ComboBox serialBaud, ComboBox serialDataBit, ComboBox serialStopBit, ComboBox serialCheckSum) + { + if (!_is_run) + return false; + + try + { + if (port != null) + port.Close(); + port = null; + + port = new SerialPort(); + port.PortName = serialNo.Text; + port.BaudRate = int.Parse(serial_baud_tab[serialBaud.SelectedIndex]); + port.DataBits = int.Parse(serial_databit_tab[serialDataBit.SelectedIndex]); + + switch (serialStopBit.SelectedIndex) + { + case 0: + port.StopBits = StopBits.One; + break; + + case 1: + port.StopBits = StopBits.OnePointFive; + break; + + case 2: + port.StopBits = StopBits.Two; + break; + + default: + port.StopBits = StopBits.One; + break; + } + + switch (serialCheckSum.SelectedIndex) + { + case 0: + port.Parity = Parity.None; + break; + + case 1: + port.Parity = Parity.Odd; + break; + + case 2: + port.Parity = Parity.Even; + break; + + case 3: + port.Parity = Parity.Mark; + break; + + case 4: + port.Parity = Parity.Space; + break; + + default: + port.Parity = Parity.None; + break; + } + + port.Handshake = Handshake.None; + + port.Open(); + } + catch + { + port = null; + return false; + } + + return true; + } + + private int serial_receive(SerialPort port, byte[] buffer, int offset, int max_len) + { + if (!_is_run) + return (int)RETURN_ERR_STATE.RETURN_ESTOP; + + if (!_isconnected) + return (int)RETURN_ERR_STATE.RETURN_ECONNECT; + + if (port == null) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + if (port.IsOpen == false) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + int len = 0; + int rc = 0; + + while (max_len > 0) + { + Thread.Sleep(35); + + if (!_is_run) + { + rc = (int)RETURN_ERR_STATE.RETURN_ESTOP; + break; + } + + if (!_isconnected) + { + rc = (int)RETURN_ERR_STATE.RETURN_ECONNECT; + break; + } + + try + { + if (port.BytesToRead < 0) + { + rc = (int)RETURN_ERR_STATE.RETURN_ERR; + break; + } + + if (port.BytesToRead == 0) + break; + + rc = port.Read(buffer, offset + len, max_len); + if (rc <= 0) + { + rc = (int)RETURN_ERR_STATE.RETURN_ERR; + break; + } + + len += rc; + max_len -= rc; + } + catch + { + rc = (int)RETURN_ERR_STATE.RETURN_ERR; + break; + } + } + + if (rc >= 0) + rc = len; + + return rc; + } + + private int serial_send(SerialPort port, byte[] buffer) + { + if (!_is_run) + return (int)RETURN_ERR_STATE.RETURN_ESTOP; + + if (!_isconnected) + return (int)RETURN_ERR_STATE.RETURN_ECONNECT; + + if (port == null) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + if (port.IsOpen == false) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + try + { + port.Write(buffer, 0, buffer.Length); + } + catch + { + return (int)RETURN_ERR_STATE.RETURN_ERR; + } + + return buffer.Length; + } + + private bool tcp_connect(ref TcpClient client, string ip, string port) + { + if (!_is_run) + return false; + + try + { + if (client != null) + client.Close(); + client = null; + + client = new TcpClient(); + if (!client.ConnectAsync(ip, int.Parse(port)).Wait(2000)) + { + client.Close(); + client = null; + + return false; + } + } + catch + { + client = null; + + return false; + } + + return true; + } + + private int tcp_receive(TcpClient client, byte[] buffer, int offset, int max_len) + { + if (!_is_run) + return (int)RETURN_ERR_STATE.RETURN_ESTOP; + + if (!_isconnected) + return (int)RETURN_ERR_STATE.RETURN_ECONNECT; + + if (client == null) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + if (client.Connected == false) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + NetworkStream networkStream = null; + + try + { + networkStream = client.GetStream(); + } + catch + { + return (int)RETURN_ERR_STATE.RETURN_ERR; + } + + int len = 0; + int rc = 0; + + while (max_len > 0) + { + Thread.Sleep(20); + + if (!_is_run) + { + rc = (int)RETURN_ERR_STATE.RETURN_ESTOP; + break; + } + + if (!_isconnected) + { + rc = (int)RETURN_ERR_STATE.RETURN_ECONNECT; + break; + } + + try + { + if (networkStream.DataAvailable == false) + break; + + rc = networkStream.Read(buffer, offset + len, max_len); + if (rc <= 0) + { + rc = (int)RETURN_ERR_STATE.RETURN_ERR; + break; + } + + len += rc; + max_len -= rc; + } + catch + { + rc = (int)RETURN_ERR_STATE.RETURN_ERR; + break; + } + } + + if (rc >= 0) + rc = len; + + return rc; + } + + private int tcp_send(TcpClient client, byte[] buffer) + { + if (!_is_run) + return (int)RETURN_ERR_STATE.RETURN_ESTOP; + + if (!_isconnected) + return (int)RETURN_ERR_STATE.RETURN_ECONNECT; + + if (client == null) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + if (client.Connected == false) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + try + { + NetworkStream networkStream = _client.GetStream(); + networkStream.Write(buffer, 0, buffer.Length); + } + catch + { + return (int)RETURN_ERR_STATE.RETURN_ERR; + } + + return buffer.Length; + } + + private int hw_receive(byte[] buffer, int offset, int max_len) + { + int rc = 0; + + if (_dev_type == (int)DevType.DEV_TYPE_SERIAL) + rc = serial_receive(_serial, buffer, offset, max_len); + else + rc = tcp_receive(_client, buffer, offset, max_len); + + string str = null; + if(rc < 0) + { + if(rc != (int)RETURN_ERR_STATE.RETURN_ESTOP) + { + string err_str = "接收数据异常"; + // _log.Warn(err_str); + + str = "\r\n" + DateTime.Now.ToString() + '.' + DateTime.Now.Millisecond.ToString("d3") + "\r\n"; + str += err_str + "\r\n"; + } + } + else if (rc > 0) + { + + //buffer = new byte[] { 0x02 ,0x00, 0x00, 0x00, 0xd9, 0x54, 0x30, 0x32, 0x30, 0x32, 0x30, 0x30, 0x30, 0x31, 0x30, 0x3d, 0x30, 0x2e, 0x32, 0x39, 0x37, 0x2c, 0x33, 0x32, 0x30, 0x38, 0x2e, 0x35, 0x36, 0x33, 0x2c, 0x31, 0x2e, 0x36, 0x35, 0x31, 0x3b, 0x30, 0x30, 0x30, 0x31, 0x31, 0x3d, 0x31, 0x3b, 0x30, 0x30, 0x30, 0x31, 0x32, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x31, 0x30, 0x3d, 0x30, 0x2e, 0x30, 0x31, 0x33, 0x2c, 0x2d, 0x38, 0x39, 0x2e, 0x39, 0x35, 0x34, 0x2c, 0x30, 0x2e, 0x31, 0x37, 0x34, 0x3b, 0x30, 0x31, 0x30, 0x31, 0x31, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x32, 0x30, 0x3d, 0x30, 0x2e, 0x30, 0x30, 0x38, 0x2c, 0x38, 0x39, 0x2e, 0x39, 0x35, 0x34, 0x2c, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x32, 0x31, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x33, 0x30, 0x3d, 0x30, 0x2e, 0x30, 0x30, 0x36, 0x2c, 0x32, 0x37, 0x39, 0x39, 0x2e, 0x34, 0x37, 0x32, 0x2c, 0x30, 0x2e, 0x34, 0x30, 0x39, 0x3b, 0x30, 0x31, 0x30, 0x33, 0x31, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x34, 0x30, 0x3d, 0x30, 0x2e, 0x30, 0x35, 0x39, 0x2c, 0x33, 0x30, 0x37, 0x2e, 0x36, 0x37, 0x38, 0x2c, 0x30, 0x2e, 0x32, 0x35, 0x36, 0x3b, 0x30, 0x31, 0x30, 0x34, 0x31, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x35, 0x30, 0x3d, 0x30, 0x2e, 0x32, 0x39, 0x37, 0x2c, 0x31, 0x30, 0x2e, 0x33, 0x31, 0x33, 0x2c, 0x30, 0x2e, 0x34, 0x39, 0x32, 0x3b, 0x30, 0x31, 0x30, 0x35, 0x31, 0x3d, 0x30, 0x3b, 0x03 }; + //rc = buffer.Length; + + //_log.Debug("接收到数据"); + string hex_str = "recv: " + bytes_to_hex_string(buffer, offset, rc); + string raw_str = " " + bytes_to_string(buffer, offset, rc); + //_log.Debug(hex_str); + //_log.Debug(raw_str); + + if (_is_show_packet) + { + str = "\r\n" + DateTime.Now.ToString() + '.' + DateTime.Now.Millisecond.ToString("d3") + "\r\n"; + str += hex_str + "\r\n" + raw_str + "\r\n"; + } + } + + if (str != null) + tbxProtocolDebug_show(str); + + return rc; + } + + private int hw_send(ToolPacket packet) + { + int rc = 0; + ToolPacket send_packet = null; + + if (_dev_type == (int)DevType.DEV_TYPE_SERIAL) + { + ToolSerialPacket serial_packet = new ToolSerialPacket(); + serial_packet.addr = _serial_addr; + serial_packet.protocol = _serial_protocol; + serial_packet.op = packet.op; + serial_packet.mid = packet.mid; + serial_packet.data_domain_str = packet.data_domain_str; + + send_packet = serial_packet; + } + else + { + send_packet = packet; + } + + byte[] buffer = send_packet.compose_protocol(); + + _hw_mtx.WaitOne(); + + if (_dev_type == (int)DevType.DEV_TYPE_SERIAL) + rc = serial_send(_serial, buffer); + else + rc = tcp_send(_client, buffer); + + _hw_mtx.ReleaseMutex(); + + string str = null; + if (rc < 0) + { + if(rc != (int)RETURN_ERR_STATE.RETURN_ESTOP) + { + string err_str = "发送失败"; + //_log.Warn(err_str); + + str = "\r\n" + DateTime.Now.ToString() + '.' + DateTime.Now.Millisecond.ToString("d3") + "\r\n"; + str += err_str + "\r\n"; + } + } + else + { + //_log.Debug("发送数据"); + string hex_str = "send: " + bytes_to_hex_string(buffer, 0, buffer.Length); + string raw_str = " " + bytes_to_string(buffer, 0, buffer.Length); + //_log.Debug(hex_str); + //_log.Debug(raw_str); + + if (_is_show_packet) + { + str = "\r\n" + DateTime.Now.ToString() + '.' + DateTime.Now.Millisecond.ToString("d3") + "\r\n"; + str += hex_str + "\r\n" + raw_str + "\r\n"; + } + } + + if(str != null) + tbxProtocolDebug_show(str); + + return rc; + } + + byte[] normal_buf = new byte[1024]; + + private void parse_entry() + { + Control.CheckForIllegalCrossThreadCalls = false; + + while (true) + { + // 未使能运行时,关闭连接,等待使能 + if(!_is_run) + { + try + { + if (_serial != null) + _serial.Close(); + } + finally + { + _serial = null; + } + + try + { + if (_client != null) + _client.Close(); + } + finally + { + _client = null; + } + + _isconnected = false; + _first_connect = true; + + Thread.Sleep(50); + continue; + } + + // 未连接时,连接硬件接口,失败 2s 周期重连 + if(!_isconnected) + { + // 不使能重连 + if(!_is_reconnect && !_first_connect) + { + try + { + if (_serial != null) + _serial.Close(); + } + finally + { + _serial = null; + } + + try + { + if (_client != null) + _client.Close(); + } + finally + { + _client = null; + } + + Thread.Sleep(50); + continue; + } + + _first_connect = false; + _reconnect_cnt++; + + if (_dev_type == (int)DevType.DEV_TYPE_SERIAL) + { + if (serial_open(ref _serial, cbxSerial, cbxSerialBaud, cbxSerialDataBit, cbxSerialStopBit, cbxSerialCheckSum)) + { + tbxProtocolDebug_show("\r\n\r\n" + DateTime.Now.ToString() + '.' + DateTime.Now.Millisecond.ToString("d3") + "\r\n打开串口成功!\r\n"); + //_log.Info("打开串口成功!"); + + _isconnected = true; + Thread.Sleep(50); + continue; + } + else + { + tbxProtocolDebug_show("\r\n\r\n" + DateTime.Now.ToString() + '.' + DateTime.Now.Millisecond.ToString("d3") + "\r\n打开串口失败!\r\n"); + //_log.Warn("打开串口失败!"); + } + } + else + { + if (tcp_connect(ref _client, tbxTcpDestIP.Text, tbxTcpDestPort.Text)) + { + tbxProtocolDebug_show("\r\n\r\n" + DateTime.Now.ToString() + '.' + DateTime.Now.Millisecond.ToString("d3") + "\r\n网络连接成功!\r\n"); + //_log.Info("网络连接成功!"); + + _isconnected = true; + Thread.Sleep(50); + continue; + } + else + { + tbxProtocolDebug_show("\r\n\r\n" + DateTime.Now.ToString() + '.' + DateTime.Now.Millisecond.ToString("d3") + "\r\n网络连接失败!\r\n"); + //_log.Warn("网络连接失败!"); + } + } + + Thread.Sleep(2000); + continue; + } + + int recv_len = hw_receive(normal_buf, 0, normal_buf.Length); + if (recv_len < 0) + { + Thread.Sleep(50); + _isconnected = false; + continue; + } + + } + } + + private void btnProtocolSend_Click(object sender, EventArgs e) + { + ToolPacket packet = new ToolPacket(); + + if (cbxProtocolOp.SelectedIndex == 0) + packet.op = 'R'; + else + packet.op = 'W'; + packet.mid = tbxProtocolMID.Text; + packet.data_domain_str = tbxProtocolData.Text; + hw_send(packet); + } + } +} diff --git a/DK_DC_Tool/Form1.resx b/DK_DC_Tool/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DK_DC_Tool/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DK_DC_Tool/Program.cs b/DK_DC_Tool/Program.cs new file mode 100644 index 0000000..a07076d --- /dev/null +++ b/DK_DC_Tool/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace DK_DC_Tool +{ + internal static class Program + { + /// + /// 应用程序的主入口点。 + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/DK_DC_Tool/Properties/AssemblyInfo.cs b/DK_DC_Tool/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..611493a --- /dev/null +++ b/DK_DC_Tool/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("DK_DC_Tool")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DK_DC_Tool")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("3c6fef50-2014-4157-a12b-93fb4ad20fe7")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 +//通过使用 "*",如下所示: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DK_DC_Tool/Properties/Resources.Designer.cs b/DK_DC_Tool/Properties/Resources.Designer.cs new file mode 100644 index 0000000..bd2f26b --- /dev/null +++ b/DK_DC_Tool/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace DK_DC_Tool.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DK_DC_Tool.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 重写当前线程的 CurrentUICulture 属性,对 + /// 使用此强类型资源类的所有资源查找执行重写。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/DK_DC_Tool/Properties/Resources.resx b/DK_DC_Tool/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/DK_DC_Tool/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DK_DC_Tool/Properties/Settings.Designer.cs b/DK_DC_Tool/Properties/Settings.Designer.cs new file mode 100644 index 0000000..62ee1a4 --- /dev/null +++ b/DK_DC_Tool/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace DK_DC_Tool.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/DK_DC_Tool/Properties/Settings.settings b/DK_DC_Tool/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/DK_DC_Tool/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/DK_DC_Tool/Tighten.cs b/DK_DC_Tool/Tighten.cs new file mode 100644 index 0000000..288a1ec --- /dev/null +++ b/DK_DC_Tool/Tighten.cs @@ -0,0 +1,482 @@ +using System; +using System.Collections.Generic; +using System.Net.Sockets; +using System.Runtime.ConstrainedExecution; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace DK_DC_Tool +{ + public class Tighten + { + public static Dictionary TightenNG_Code = new Dictionary() + { + // 00 = 无定意;01 = 最终扭矩过大;02 = 最终扭矩过大;03 = 最终角度过大;04 = 最终角度过小;n1 = 第 n 步扭矩过大;n2 = 第 n 步时间超限;1 < n < 5;90 = 总时间超限; + { "00", "无定意" }, + { "01", "最终扭矩过大" }, + { "02", "最终扭矩过大" }, + { "03", "最终角度过大" }, + { "04", "最终角度过小" }, + { "11", "第 1 步扭矩过大" }, + { "21", "第 2 步扭矩过大" }, + { "31", "第 3 步扭矩过大" }, + { "41", "第 4 步扭矩过大" }, + { "51", "第 5 步扭矩过大" }, + { "12", "第 1 步时间超限" }, + { "22", "第 2 步时间超限" }, + { "32", "第 3 步时间超限" }, + { "42", "第 4 步时间超限" }, + { "52", "第 5 步时间超限" }, + { "90", "总时间超限" } + }; + + TcpClient _client = null; + Thread _parse_tid = null; + Thread _tightenHeartBeat = null; + bool _isconnected = false; + bool _is_run = false; + bool _is_reconnect = true; + bool _first_connect = true; + string ip = "127.0.0.1"; + int port = 5000; + int _reconnect_cnt = 0; + string currentOpName = "127.0.0.1"; + public static Action E_ScanContent = null; + public static Action E_LogInsert = null; + public static Action E_DeviceHeartBeat = null; + + + public void Start(string ip ,int port, string opName) + { + this.currentOpName = opName; + this.ip = ip; + this.port = port; + + _parse_tid = new Thread(new ThreadStart(parse_entry)); + _parse_tid.Name = "data_parse"; + _parse_tid.IsBackground = true; + _parse_tid.Start(); + _tightenHeartBeat = new Thread(new ThreadStart(hw_send_HeartBeat)); + _tightenHeartBeat.Name = "tightenHeartBeat"; + _tightenHeartBeat.IsBackground = true; + _tightenHeartBeat.Start(); + + + _is_run = true; + _is_reconnect = true; + _first_connect = true; + _reconnect_cnt = 0; + + } + public void Stop() + { + _is_run = false; + _is_reconnect = false; + _first_connect = false; + } + + //代理 + private delegate void change_tbx_delegate(string str); + + private string bytes_to_hex_string(byte[] buf, int offset, int len) + { + string str = ""; + + for (int i = 0; i < len; i++) + { + str += buf[offset + i].ToString("X2") + " "; + } + + return str; + } + + private string bytes_to_string(byte[] buf, int offset, int len) + { + string str = ""; + + for (int i = 0; i < len; i++) + { + if ((buf[offset + i] < 32) || (buf[offset + i] > 126)) + str += " ."; + else + str += " " + ((char)buf[offset + i]).ToString(); + + str += " "; + } + + return str; + } + private bool tcp_connect(ref TcpClient client, string ip, string port) + { + if (!_is_run) + return false; + + try + { + if (client != null) + client.Close(); + client = null; + + client = new TcpClient(); + if (!client.ConnectAsync(ip, int.Parse(port)).Wait(2000)) + { + client.Close(); + client = null; + + return false; + } + } + catch(Exception err) + { + E_LogInsert("Tighten", "Error", "165:" + err.Message); + if (E_DeviceHeartBeat != null) + { + E_DeviceHeartBeat.Invoke("0"); + } + client = null; + return false; + } + + return true; + } + + private int tcp_receive(TcpClient client, byte[] buffer, int offset, int max_len) + { + if (!_is_run) + return (int)RETURN_ERR_STATE.RETURN_ESTOP; + + if (!_isconnected) + return (int)RETURN_ERR_STATE.RETURN_ECONNECT; + + if (client == null) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + if (client.Connected == false) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + NetworkStream networkStream = null; + + try + { + networkStream = client.GetStream(); + } + catch + { + return (int)RETURN_ERR_STATE.RETURN_ERR; + } + + int len = 0; + int rc = 0; + + while (max_len > 0) + { + Thread.Sleep(20); + + if (!_is_run) + { + rc = (int)RETURN_ERR_STATE.RETURN_ESTOP; + break; + } + + if (!_isconnected) + { + rc = (int)RETURN_ERR_STATE.RETURN_ECONNECT; + break; + } + + try + { + if (networkStream.DataAvailable == false) + break; + + rc = networkStream.Read(buffer, offset + len, max_len); + if (rc <= 0) + { + rc = (int)RETURN_ERR_STATE.RETURN_ERR; + break; + } + + len += rc; + max_len -= rc; + } + catch + { + rc = (int)RETURN_ERR_STATE.RETURN_ERR; + break; + } + } + + if (rc >= 0) + rc = len; + + return rc; + } + + private int tcp_send(TcpClient client, byte[] buffer) + { + if (!_is_run) + return (int)RETURN_ERR_STATE.RETURN_ESTOP; + + if (!_isconnected) + return (int)RETURN_ERR_STATE.RETURN_ECONNECT; + + if (client == null) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + if (client.Connected == false) + return (int)RETURN_ERR_STATE.RETURN_ERR; + + try + { + NetworkStream networkStream = _client.GetStream(); + networkStream.Write(buffer, 0, buffer.Length); + } + catch(Exception err) + { + E_LogInsert("Tighten", "Error", "270:" + err.Message); + return (int)RETURN_ERR_STATE.RETURN_ERR; + } + + return buffer.Length; + } + + private int hw_receive(byte[] buffer, int offset, int max_len) + { + int rc = tcp_receive(_client, buffer, offset, max_len); + + string str = null; + if(rc < 0) + { + if(rc != (int)RETURN_ERR_STATE.RETURN_ESTOP) + { + string err_str = "拧紧枪接收数据异常!"; + E_LogInsert("Tighten", "Error", err_str); + } + } + else if (rc > 0) + { + //buffer = new byte[] { 0x02 ,0x00, 0x00, 0x00, 0xd9, 0x54, 0x30, 0x32, 0x30, 0x32, 0x30, 0x30, 0x30, 0x31, 0x30, 0x3d, 0x30, 0x2e, 0x32, 0x39, 0x37, 0x2c, 0x33, 0x32, 0x30, 0x38, 0x2e, 0x35, 0x36, 0x33, 0x2c, 0x31, 0x2e, 0x36, 0x35, 0x31, 0x3b, 0x30, 0x30, 0x30, 0x31, 0x31, 0x3d, 0x31, 0x3b, 0x30, 0x30, 0x30, 0x31, 0x32, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x31, 0x30, 0x3d, 0x30, 0x2e, 0x30, 0x31, 0x33, 0x2c, 0x2d, 0x38, 0x39, 0x2e, 0x39, 0x35, 0x34, 0x2c, 0x30, 0x2e, 0x31, 0x37, 0x34, 0x3b, 0x30, 0x31, 0x30, 0x31, 0x31, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x32, 0x30, 0x3d, 0x30, 0x2e, 0x30, 0x30, 0x38, 0x2c, 0x38, 0x39, 0x2e, 0x39, 0x35, 0x34, 0x2c, 0x30, 0x2e, 0x31, 0x30, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x32, 0x31, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x33, 0x30, 0x3d, 0x30, 0x2e, 0x30, 0x30, 0x36, 0x2c, 0x32, 0x37, 0x39, 0x39, 0x2e, 0x34, 0x37, 0x32, 0x2c, 0x30, 0x2e, 0x34, 0x30, 0x39, 0x3b, 0x30, 0x31, 0x30, 0x33, 0x31, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x34, 0x30, 0x3d, 0x30, 0x2e, 0x30, 0x35, 0x39, 0x2c, 0x33, 0x30, 0x37, 0x2e, 0x36, 0x37, 0x38, 0x2c, 0x30, 0x2e, 0x32, 0x35, 0x36, 0x3b, 0x30, 0x31, 0x30, 0x34, 0x31, 0x3d, 0x30, 0x3b, 0x30, 0x31, 0x30, 0x35, 0x30, 0x3d, 0x30, 0x2e, 0x32, 0x39, 0x37, 0x2c, 0x31, 0x30, 0x2e, 0x33, 0x31, 0x33, 0x2c, 0x30, 0x2e, 0x34, 0x39, 0x32, 0x3b, 0x30, 0x31, 0x30, 0x35, 0x31, 0x3d, 0x30, 0x3b, 0x03 }; + //rc = buffer.Length; + var hex_str = bytes_to_hex_string(buffer, offset, rc); + var raw_str = bytes_to_string(buffer, offset, rc); + if (E_ScanContent != null) + { + E_ScanContent.Invoke(hex_str, raw_str); + } + + } + + //if (str != null) + // tbxProtocolDebug_show(str); + + return rc; + } + + private int hw_send(ToolPacket packet) + { + int rc = 0; + ToolPacket send_packet = null; + + send_packet = packet; + + byte[] buffer = send_packet.compose_protocol(); + + rc = tcp_send(_client, buffer); + + string str = null; + if (rc < 0) + { + try + { + E_LogInsert("Tighten", "Error", ((RETURN_ERR_STATE)rc).ToString()); + } + catch (Exception err) + { + E_LogInsert("Tighten", "Error", rc.ToString() + "_" + err.Message); + } + + } + else + { + string send_str = "拧紧枪发送数据!"; + E_LogInsert("Tighten", "Info", send_str); + //string hex_str = "send: " + bytes_to_hex_string(buffer, 0, buffer.Length); + string raw_str = " " + bytes_to_string(buffer, 0, buffer.Length); + E_LogInsert("Tighten", "Info", raw_str); + } + + //if(str != null) + // tbxProtocolDebug_show(str); + + return rc; + } + private void hw_send_HeartBeat() + { + ToolPacket packet = new ToolPacket(); + packet.op = 'R'; + packet.mid = "0204"; + packet.data_domain_str = ""; + + new Thread(new ThreadStart(delegate () { + while (true) + { + try + { + int rc = 0; + byte[] buffer = packet.compose_protocol(); + rc = tcp_send(_client, buffer); + if (rc < 0) + { + if (E_DeviceHeartBeat != null) + { + E_DeviceHeartBeat.Invoke("0"); + } + E_LogInsert("Tighten_HeartBeat", "Error", RETURN_ERR_STATE.RETURN_ESTOP.ToString()); + } + else + { + if (E_DeviceHeartBeat != null) + { + E_DeviceHeartBeat.Invoke("1"); + } + + } + } + catch (Exception err) + { + E_LogInsert("Tighten_HeartBeat", "Error", err.Message); + if (E_DeviceHeartBeat != null) + { + E_DeviceHeartBeat.Invoke("0"); + } + } + Thread.Sleep(5000); + } + })) + { IsBackground = true }.Start(); + } + byte[] normal_buf = new byte[1024]; + + private void parse_entry() + { + Control.CheckForIllegalCrossThreadCalls = false; + + while (true) + { + // 未使能运行时,关闭连接,等待使能 + if(!_is_run) + { + try + { + if (_client != null) + _client.Close(); + } + finally + { + _client = null; + } + + _isconnected = false; + _first_connect = true; + + Thread.Sleep(50); + continue; + } + + // 未连接时,连接硬件接口,失败 2s 周期重连 + if(!_isconnected) + { + // 不使能重连 + if(!_is_reconnect && !_first_connect) + { + try + { + if (_client != null) + _client.Close(); + } + finally + { + _client = null; + } + + Thread.Sleep(50); + continue; + } + + _first_connect = false; + _reconnect_cnt++; + + if (tcp_connect(ref _client, this.ip, this.port.ToString())) + { + string send_str = "拧紧枪网络连接成功"; + E_LogInsert("Tighten", "Info", send_str); + _isconnected = true; + + if (E_DeviceHeartBeat != null) + { + E_DeviceHeartBeat.Invoke("1"); + } + + + /* + MID 操作类型 描述 备注 + 0001 R 建立通信连接 + 0002 R 断开连接 + 0103 W Pset选择 + 0201 R 运行状态 Ready/RUN/OK/NG/Err + 0202 R 最终拧紧结果 + 0203 R 实时曲线数据 + 0301 W 电机运行正转/反转使能 CW/CCW + */ + var packet = new ToolPacket(); + packet.op = 'R'; + packet.mid = "0202"; + packet.data_domain_str = ""; + hw_send(packet); + + Thread.Sleep(50); + continue; + } + else + { + string send_str = "拧紧枪网络连接失败"; + E_LogInsert("Tighten", "Error", send_str); + if (E_DeviceHeartBeat != null) + { + E_DeviceHeartBeat.Invoke("0"); + } + } + + Thread.Sleep(2000); + continue; + } + + int recv_len = hw_receive(normal_buf, 0, normal_buf.Length); + if (recv_len < 0) + { + Thread.Sleep(50); + _isconnected = false; + if (E_DeviceHeartBeat != null) + { + E_DeviceHeartBeat.Invoke("0"); + } + continue; + } + + } + } + + } + + public class TightenParam + { + public string hex { get; set; } + public string raw { get; set; } + } + + + + +} diff --git a/DK_DC_Tool/ToolPacket.cs b/DK_DC_Tool/ToolPacket.cs new file mode 100644 index 0000000..bcba143 --- /dev/null +++ b/DK_DC_Tool/ToolPacket.cs @@ -0,0 +1,290 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace DK_DC_Tool +{ + public class ToolDataDomain + { + public string pid; + public List data; + } + + public class ToolPacket:ICloneable + { + const byte head = 0x02; + const byte tail = 0x03; + const byte min_length = 11; + + public int type; //0: TCP 报文格式 1: 串口报文格式 + public UInt32 data_packet_length; + public char op; + public string mid; + public string data_domain_str; + public List data_domains; + + public object Clone() + { + ToolPacket packet = (ToolPacket)this.MemberwiseClone(); + return packet; + } + + static List get_data_domains(string str) + { + List tds = new List(); + + string[] rs = str.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries); + foreach (string s in rs) + { + s.Trim(); + string[] ds = s.Split(new char[1] { '=' }, StringSplitOptions.RemoveEmptyEntries); + if (ds.Length != 2) + continue; + + ToolDataDomain data_domain = new ToolDataDomain(); + data_domain.pid = ds[0].Trim(); + string[] cs = ds[1].Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); + foreach (string cs2 in cs) + { + cs2.Trim(); + } + + data_domain.data = new List(cs); + tds.Add(data_domain); + } + + return tds; + } + + public void update_data_domain_str() + { + this.data_domain_str = ""; + + foreach (ToolDataDomain domain in this.data_domains) + { + this.data_domain_str += domain.pid + "="; + for (int i = 0; i < domain.data.Count; i++) + { + this.data_domain_str += domain.data[i]; + if (i != domain.data.Count - 1) + this.data_domain_str += ","; + } + this.data_domain_str += ";"; + } + } + + public virtual byte[] compose_protocol() + { + List data_list = new List(); + byte[] tmp = new byte[100]; + + data_list.Add(head); + + int data_len = 5 + this.data_domain_str.Length; + Array.Clear(tmp, 0, tmp.Length); + tmp[0] = (byte)(data_len >> 24); + tmp[1] = (byte)(data_len >> 16); + tmp[2] = (byte)(data_len >> 8); + tmp[3] = (byte)(data_len); + data_list.AddRange(tmp.Take(4)); + data_list.Add((byte)this.op); + byte[] mid_buf = Encoding.UTF8.GetBytes(this.mid); + Array.Clear(tmp, 0, tmp.Length); + Array.Copy(mid_buf, tmp, (mid_buf.Length > 4) ? 4 : mid_buf.Length); + data_list.AddRange(tmp.Take(4)); + data_list.AddRange(Encoding.UTF8.GetBytes(this.data_domain_str).ToList()); + data_list.Add(tail); + + this.type = 0; + this.data_domains = get_data_domains(this.data_domain_str); + this.data_packet_length = (UInt32)data_list.Count; + + return data_list.ToArray(); + } + + public static int decompose_protocol(byte[] buf, ToolPacket packet) + { + int rc = 0; + + do + { + if (buf.Length - min_length < 0) + break; + if (buf[0] != head) + break; + UInt32 _data_packet_len = (((UInt32)buf[1] << 24) + + ((UInt32)buf[2] << 16) + + ((UInt32)buf[3] << 8) + + (UInt32)buf[4]); + if ((buf.Length - (min_length + _data_packet_len - 5)) < 0) + break; + if (buf[5 + _data_packet_len] != tail) + break; + if (_data_packet_len < 5) + break; + + try + { + packet.type = 0; + packet.data_packet_length = _data_packet_len; + packet.op = (char)buf[5]; + packet.mid = Encoding.UTF8.GetString(buf, 6, 4); + packet.data_domain_str = Encoding.UTF8.GetString(buf, 10, (int)_data_packet_len - 5); + packet.data_domains = get_data_domains(packet.data_domain_str); + } + catch + { + break; + } + + rc = 6 + (int)_data_packet_len; + } while (false); + + return rc; + } + } + + internal class ToolSerialPacket : ToolPacket + { + const byte head = 0x55; + const byte min_length = 7; + + public byte addr; + public byte protocol; + + /* Table of CRC values for high-order byte */ + static Byte[] table_crc_hi = { + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, + 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, + 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, + 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, + 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, + 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, + 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, + 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +}; + + /* Table of CRC values for low-order byte */ + static Byte[] table_crc_lo = { + 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, + 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, + 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, + 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, + 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, 0x14, 0xD4, + 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3, + 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, + 0xF2, 0x32, 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, + 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, + 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, + 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, + 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26, + 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, + 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, + 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, + 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, + 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA, 0xBE, 0x7E, + 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5, + 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, + 0x70, 0xB0, 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, + 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, + 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, + 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, + 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, + 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, + 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 +}; + + static UInt16 crc16(Byte[] buffer, int buffer_length) + { + Byte crc_hi = 0xFF; /* high CRC byte initialized */ + Byte crc_lo = 0xFF; /* low CRC byte initialized */ + UInt32 i; /* will index into CRC lookup */ + UInt32 j = 0; + + /* pass through message buffer */ + while (buffer_length-- > 0) + { + i = (UInt32)(crc_hi ^ buffer[j++]); /* calculate the CRC */ + crc_hi = (Byte)(crc_lo ^ table_crc_hi[i]); + crc_lo = table_crc_lo[i]; + } + + return (UInt16)(crc_hi << 8 | crc_lo); + } + + public override byte[] compose_protocol() + { + byte[] packet_data = base.compose_protocol(); + this.type = 1; + + List data_list = new List(); + data_list.Add(head); + data_list.Add(this.addr); + data_list.Add(this.protocol); + int data_len = packet_data.Length; + data_list.Add((byte)(data_len >> 8)); + data_list.Add((byte)data_len); + data_list.AddRange(packet_data.ToList()); + UInt16 crc_calculated = crc16(data_list.ToArray(), data_list.Count); + data_list.Add((byte)(crc_calculated >> 8)); + data_list.Add((byte)crc_calculated); + + return data_list.ToArray(); + } + + public static int decompose_protocol(byte[] buf, ToolSerialPacket packet) + { + int rc = 0; + + do + { + if (buf.Length - min_length < 0) + break; + + if (buf[0] != head) + break; + + UInt32 _data_packet_len = ((UInt32)buf[3] << 8) + (UInt32)buf[4]; + if ((buf.Length - (min_length + _data_packet_len)) < 0) + break; + + UInt16 crc_recv = (UInt16)((buf[5 + _data_packet_len] << 8) + buf[6 + _data_packet_len]); + UInt16 crc_calc = crc16(buf, 5 + (int)_data_packet_len); + if (crc_recv != crc_calc) + break; + + if (ToolPacket.decompose_protocol(buf.Skip(5).Take((int)_data_packet_len).ToArray(), packet) <= 0) + break; + + packet.type = 1; + packet.addr = buf[1]; + packet.protocol = buf[2]; + + rc = min_length + (int)_data_packet_len; + } while (false); + + return rc; + } + } +} diff --git a/DK_DC_Tool/packages.config b/DK_DC_Tool/packages.config new file mode 100644 index 0000000..99ad1ad --- /dev/null +++ b/DK_DC_Tool/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/DLL/ABB.Robotics.Controllers.PC.dll b/DLL/ABB.Robotics.Controllers.PC.dll new file mode 100644 index 0000000..0c9985d Binary files /dev/null and b/DLL/ABB.Robotics.Controllers.PC.dll differ diff --git a/DLL/BasicData.dll b/DLL/BasicData.dll new file mode 100644 index 0000000..8dfe09b Binary files /dev/null and b/DLL/BasicData.dll differ diff --git a/DLL/BasicEdit.dll b/DLL/BasicEdit.dll new file mode 100644 index 0000000..a149b97 Binary files /dev/null and b/DLL/BasicEdit.dll differ diff --git a/DLL/BouncyCastle.Crypto.dll b/DLL/BouncyCastle.Crypto.dll new file mode 100644 index 0000000..0310983 Binary files /dev/null and b/DLL/BouncyCastle.Crypto.dll differ diff --git a/DLL/ConLink.dll b/DLL/ConLink.dll new file mode 100644 index 0000000..fa95f29 Binary files /dev/null and b/DLL/ConLink.dll differ diff --git a/DLL/ConLink19.dll b/DLL/ConLink19.dll new file mode 100644 index 0000000..510d43e Binary files /dev/null and b/DLL/ConLink19.dll differ diff --git a/DLL/DataLinkMesWork.dll b/DLL/DataLinkMesWork.dll new file mode 100644 index 0000000..57fcd25 Binary files /dev/null and b/DLL/DataLinkMesWork.dll differ diff --git a/DLL/DoWhatPlc.dll b/DLL/DoWhatPlc.dll new file mode 100644 index 0000000..6e73a5b Binary files /dev/null and b/DLL/DoWhatPlc.dll differ diff --git a/DLL/EnBaseM.dll b/DLL/EnBaseM.dll new file mode 100644 index 0000000..ebdeaa2 Binary files /dev/null and b/DLL/EnBaseM.dll differ diff --git a/DLL/Fanuc.Interface.dll b/DLL/Fanuc.Interface.dll new file mode 100644 index 0000000..66d406c Binary files /dev/null and b/DLL/Fanuc.Interface.dll differ diff --git a/DLL/Fwlib32.dll b/DLL/Fwlib32.dll new file mode 100644 index 0000000..58d10d9 Binary files /dev/null and b/DLL/Fwlib32.dll differ diff --git a/DLL/HslCommunication.dll b/DLL/HslCommunication.dll new file mode 100644 index 0000000..bcb2ca0 Binary files /dev/null and b/DLL/HslCommunication.dll differ diff --git a/DLL/ICSharpCode.SharpZipLib.dll b/DLL/ICSharpCode.SharpZipLib.dll new file mode 100644 index 0000000..84e8c68 Binary files /dev/null and b/DLL/ICSharpCode.SharpZipLib.dll differ diff --git a/DLL/MQTT.dll b/DLL/MQTT.dll new file mode 100644 index 0000000..c61c4f0 Binary files /dev/null and b/DLL/MQTT.dll differ diff --git a/DLL/MQTTnet.Extensions.ManagedClient.dll b/DLL/MQTTnet.Extensions.ManagedClient.dll new file mode 100644 index 0000000..99035f6 Binary files /dev/null and b/DLL/MQTTnet.Extensions.ManagedClient.dll differ diff --git a/DLL/MQTTnet.dll b/DLL/MQTTnet.dll new file mode 100644 index 0000000..2951433 Binary files /dev/null and b/DLL/MQTTnet.dll differ diff --git a/DLL/MW_Log.dll b/DLL/MW_Log.dll new file mode 100644 index 0000000..6aebc89 Binary files /dev/null and b/DLL/MW_Log.dll differ diff --git a/DLL/MesControl.dll b/DLL/MesControl.dll new file mode 100644 index 0000000..cd3960b Binary files /dev/null and b/DLL/MesControl.dll differ diff --git a/DLL/MesWork.DeviceDriver.dll b/DLL/MesWork.DeviceDriver.dll new file mode 100644 index 0000000..deb6243 Binary files /dev/null and b/DLL/MesWork.DeviceDriver.dll differ diff --git a/DLL/Microsoft.Extensions.DependencyInjection.Abstractions.dll b/DLL/Microsoft.Extensions.DependencyInjection.Abstractions.dll new file mode 100644 index 0000000..5583517 Binary files /dev/null and b/DLL/Microsoft.Extensions.DependencyInjection.Abstractions.dll differ diff --git a/DLL/Microsoft.Extensions.Logging.Abstractions.dll b/DLL/Microsoft.Extensions.Logging.Abstractions.dll new file mode 100644 index 0000000..1580585 Binary files /dev/null and b/DLL/Microsoft.Extensions.Logging.Abstractions.dll differ diff --git a/DLL/Microsoft.Extensions.Logging.dll b/DLL/Microsoft.Extensions.Logging.dll new file mode 100644 index 0000000..fc7d689 Binary files /dev/null and b/DLL/Microsoft.Extensions.Logging.dll differ diff --git a/DLL/Microsoft.Extensions.Options.dll b/DLL/Microsoft.Extensions.Options.dll new file mode 100644 index 0000000..f56ff80 Binary files /dev/null and b/DLL/Microsoft.Extensions.Options.dll differ diff --git a/DLL/Microsoft.Extensions.Primitives.dll b/DLL/Microsoft.Extensions.Primitives.dll new file mode 100644 index 0000000..d6560c9 Binary files /dev/null and b/DLL/Microsoft.Extensions.Primitives.dll differ diff --git a/DLL/Microsoft.Win32.Primitives.dll b/DLL/Microsoft.Win32.Primitives.dll new file mode 100644 index 0000000..8b69a69 Binary files /dev/null and b/DLL/Microsoft.Win32.Primitives.dll differ diff --git a/DLL/ModelBasic.dll b/DLL/ModelBasic.dll new file mode 100644 index 0000000..da91919 Binary files /dev/null and b/DLL/ModelBasic.dll differ diff --git a/DLL/Monitor.MesWork.dll b/DLL/Monitor.MesWork.dll new file mode 100644 index 0000000..1874ca5 Binary files /dev/null and b/DLL/Monitor.MesWork.dll differ diff --git a/DLL/MySql.Data.dll b/DLL/MySql.Data.dll new file mode 100644 index 0000000..a95e69e Binary files /dev/null and b/DLL/MySql.Data.dll differ diff --git a/DLL/MySql.Data.xml b/DLL/MySql.Data.xml new file mode 100644 index 0000000..f35ac41 --- /dev/null +++ b/DLL/MySql.Data.xml @@ -0,0 +1,17803 @@ + + + + MySql.Data + + + + + The implementation of the caching_sha2_password authentication plugin. + + + + + Generates a byte array set with the password of the user in the expected format based on the + SSL settings of the current connection. + + A byte array that contains the password of the user in the expected format. + + + + Defines the stage of the authentication. + + + + + Defines the default behavior for an authentication plugin. + + + + + Gets or sets the authentication data returned by the server. + + + + + This is a factory method that is used only internally. It creates an auth plugin based on the method type + + + + + + + + + Gets the connection option settings. + + + + + Gets the server version associated with this authentication plugin. + + + + + Gets the encoding assigned to the native driver. + + + + + Sets the authentication data required to encode, encrypt, or convert the password of the user. + + A byte array containing the authentication data provided by the server. + This method may be overriden based on the requirements by the implementing authentication plugin. + + + + Defines the behavior when checking for constraints. + + This method is intended to be overriden. + + + + Throws a that encapsulates the original exception. + + The exception to encapsulate. + + + + Defines the behavior when authentication is successful. + + This method is intended to be overriden. + + + + Defines the behavior when more data is required from the server. + + The data returned by the server. + The data to return to the server. + This method is intended to be overriden. + + + + Gets the plugin name based on the authentication plugin type defined during the creation of this object. + + + + + Gets the user name associated to the connection settings. + + The user name associated to the connection settings. + + + + Gets the encoded, encrypted, or converted password based on the authentication plugin type defined during the creation of this object. + This method is intended to be overriden. + + An object containing the encoded, encrypted, or converted password. + + + + Provides functionality to read, decode and convert PEM files to objects supported in .NET. + + + + + Converts the binary data of a PEM file to an object. + + A binary representation of the public key provided by the server. + An object containing the data found in the public key. + + + + Allows connections to a user account set with the mysql_native_password authentication plugin. + + + + + Returns a byte array containing the proper encryption of the + given password/seed according to the new 4.1.1 authentication scheme. + + + + + + + + The implementation of the sha256_password authentication plugin. + + + + + The byte array representation of the public key provided by the server. + + + + + Applies XOR to the byte arrays provided as input. + + A byte array that contains the results of the XOR operation. + + + + + + + + + Defines the type of the security buffer. + + + + + Defines a security handle. + + + + + Describes a buffer allocated by a transport to pass to a security package. + + + + + Specifies the size, in bytes, of the buffer. + + + + + Bit flags that indicate the type of the buffer. + + + + + Pointer to a buffer. + + + + + Hold a numeric value used in defining other data types. + + + + + Least significant digits. + + + + + Most significant digits. + + + + + Holds a pointer used to define a security handle. + + + + + Least significant digits. + + + + + Most significant digits. + + + + + Indicates the sizes of important structures used in the message support functions. + + + + + Specifies the maximum size of the security token used in the authentication changes. + + + + + Specifies the maximum size of the signature created by the MakeSignature function. + This member must be zero if integrity services are not requested or available. + + + + + Specifies the preferred integral size of the messages. + + + + + Size of the security trailer to be appended to messages. + This member should be zero if the relevant services are not requested or available. + + + + + Allows importing large amounts of data into a database with bulk loading. + + + + + Gets or sets the connection. + + The connection. + + + + Gets or sets the field terminator. + + The field terminator. + + + + Gets or sets the line terminator. + + The line terminator. + + + + Gets or sets the name of the table. + + The name of the table. + + + + Gets or sets the character set. + + The character set. + + + + Gets or sets the name of the file. + + The name of the file. + + + + Gets or sets the timeout. + + The timeout. + + + + Gets or sets a value indicating whether the file name that is to be loaded + is local to the client or not. The default value is false. + + true if local; otherwise, false. + + + + Gets or sets the number of lines to skip. + + The number of lines to skip. + + + + Gets or sets the line prefix. + + The line prefix. + + + + Gets or sets the field quotation character. + + The field quotation character. + + + + Gets or sets a value indicating whether [field quotation optional]. + + + true if [field quotation optional]; otherwise, false. + + + + + Gets or sets the escape character. + + The escape character. + + + + Gets or sets the conflict option. + + The conflict option. + + + + Gets or sets the priority. + + The priority. + + + + Gets the columns. + + The columns. + + + + Gets the expressions. + + The expressions. + + + + Executes the load operation. + + The number of rows inserted. + + + + Asynchronous version of the load operation. + + The number of rows inserted. + + + + Executes the load operation asynchronously while the cancellation isn't requested. + + The cancellation token. + The number of rows inserted. + + + + Represents the priority set for bulk loading operations. + + + + + This is the default and indicates normal priority + + + + + Low priority will cause the load operation to wait until all readers of the table + have finished. This only affects storage engines that use only table-level locking + such as MyISAM, Memory, and Merge. + + + + + Concurrent priority is only relevant for MyISAM tables and signals that if the table + has no free blocks in the middle that other readers can retrieve data from the table + while the load operation is happening. + + + + + Represents the behavior when conflicts arise during bulk loading operations. + + + + + This is the default and indicates normal operation. In the event of a LOCAL load, this + is the same as ignore. When the data file is on the server, then a key conflict will + cause an error to be thrown and the rest of the data file ignored. + + + + + Replace column values when a key conflict occurs. + + + + + Ignore any rows where the primary key conflicts. + + + + + Summary description for CharSetMap. + + + + + Returns the text encoding for a given MySQL character set name + + Version of the connection requesting the encoding + Name of the character set to get the encoding for + Encoding object for the given character set name + + + + Initializes the mapping. + + + + Represents a SQL statement to execute against a MySQL database. This class cannot be inherited. + MySqlCommand features the following methods for executing commands at a MySQL database: + + + Item + Description + + + + ExecuteReader + + Executes commands that return rows. + + + + ExecuteNonQuery + + Executes commands such as SQL INSERT, DELETE, and UPDATE statements. + + + + ExecuteScalar + + Retrieves a single value (for example, an aggregate value) from a database. + + + + You can reset the CommandText property and reuse the MySqlCommand + object. However, you must close the MySqlDataReader + before you can execute a new or previous command. + + If a MySqlException is + generated by the method executing a MySqlCommand, the MySqlConnection + remains open. It is the responsibility of the programmer to close the connection. + + + Using the '@' symbol for paramters is now the preferred approach although the old pattern of using + '?' is still supported. Please be aware though that using '@' can cause conflicts when user variables + are also used. To help with this situation please see the documentation on the 'allow user variables' + connection string option. The 'old syntax' connection string option has now been deprecated. + + + The following example creates a MySqlCommand and + a MySqlConnection. The MySqlConnection is opened and set as the Connection + for the MySqlCommand. The example then calls ExecuteNonQuery, + and closes the connection. To accomplish this, the ExecuteNonQuery is + passed a connection string and a query string that is a SQL INSERT + statement. + + Public Sub InsertRow(myConnectionString As String) + " If the connection string is null, use a default. + If myConnectionString = "" Then + myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass" + End If + Dim myConnection As New MySqlConnection(myConnectionString) + Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)" + Dim myCommand As New MySqlCommand(myInsertQuery) + myCommand.Connection = myConnection + myConnection.Open() + myCommand.ExecuteNonQuery() + myCommand.Connection.Close() + End Sub + + + public void InsertRow(string myConnectionString) + { + // If the connection string is null, use a default. + if(myConnectionString == "") + { + myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"; + } + MySqlConnection myConnection = new MySqlConnection(myConnectionString); + string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"; + MySqlCommand myCommand = new MySqlCommand(myInsertQuery); + myCommand.Connection = myConnection; + myConnection.Open(); + myCommand.ExecuteNonQuery(); + myCommand.Connection.Close(); + } + + + + + + + Initializes a new instance of the MySqlCommand class. + + + The following example creates a MySqlCommand and sets some of its properties. + + + This example shows how to use one of the overloaded + versions of the MySqlCommand constructor. For other examples that might be available, + see the individual overload topics. + + + + Public Sub CreateMySqlCommand() + Dim myConnection As New MySqlConnection _ + ("Persist Security Info=False;database=test;server=myServer") + myConnection.Open() + Dim myTrans As MySqlTransaction = myConnection.BeginTransaction() + Dim mySelectQuery As String = "SELECT * FROM MyTable" + Dim myCommand As New MySqlCommand(mySelectQuery, myConnection, myTrans) + myCommand.CommandTimeout = 20 + End Sub + + + public void CreateMySqlCommand() + { + MySqlConnection myConnection = new MySqlConnection("Persist Security Info=False; + database=test;server=myServer"); + myConnection.Open(); + MySqlTransaction myTrans = myConnection.BeginTransaction(); + string mySelectQuery = "SELECT * FROM myTable"; + MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection,myTrans); + myCommand.CommandTimeout = 20; + } + + + public: + void CreateMySqlCommand() + { + MySqlConnection* myConnection = new MySqlConnection(S"Persist Security Info=False; + database=test;server=myServer"); + myConnection->Open(); + MySqlTransaction* myTrans = myConnection->BeginTransaction(); + String* mySelectQuery = S"SELECT * FROM myTable"; + MySqlCommand* myCommand = new MySqlCommand(mySelectQuery, myConnection, myTrans); + myCommand->CommandTimeout = 20; + }; + + + + Initializes a new instance of the MySqlCommand class. + + The base constructor initializes all fields to their default values. The + following table shows initial property values for an instance of . + + + Properties + Initial Value + + + + + + empty string ("") + + + + + + 0 + + + + + + CommandType.Text + + + + + + Null + + + + You can change the value for any of these properties through a separate call to + the property. + + + The following example creates a and + sets some of its properties. + + + Public Sub CreateMySqlCommand() + Dim myCommand As New MySqlCommand() + myCommand.CommandType = CommandType.Text + End Sub + + + public void CreateMySqlCommand() + { + MySqlCommand myCommand = new MySqlCommand(); + myCommand.CommandType = CommandType.Text; + } + + + + + + Initializes a new instance of the class with the text of the query. + The text of the query. + When an instance of is created, + the following read/write properties are set to initial values. + + + + Properties + Initial Value + + + + + + + cmdText + + + + + + + 0 + + + + + + CommandType.Text + + + + + + Null + + + + You can change the value for any of these properties through a separate call to + the property. + + + The following example creates a and + sets some of its properties. + + + Public Sub CreateMySqlCommand() + Dim sql as String = "SELECT * FROM mytable" + Dim myCommand As New MySqlCommand(sql) + myCommand.CommandType = CommandType.Text + End Sub + + + public void CreateMySqlCommand() + { + string sql = "SELECT * FROM mytable"; + MySqlCommand myCommand = new MySqlCommand(sql); + myCommand.CommandType = CommandType.Text; + } + + + + + + Initializes a new instance of the class + with the text of the query and a . + The text of the query. + A that represents the + connection to an instance of SQL Server. + + When an instance of is created, + the following read/write properties are set to initial values. + + + + Properties + Initial Value + + + + + + + cmdText + + + + + + + 0 + + + + + + CommandType.Text + + + + + + + connection + + + + + You can change the value for any of these properties through a separate call to + the property. + + + The following example creates a and + sets some of its properties. + + + Public Sub CreateMySqlCommand() + Dim conn as new MySqlConnection("server=myServer") + Dim sql as String = "SELECT * FROM mytable" + Dim myCommand As New MySqlCommand(sql, conn) + myCommand.CommandType = CommandType.Text + End Sub + + + public void CreateMySqlCommand() + { + MySqlConnection conn = new MySqlConnection("server=myserver") + string sql = "SELECT * FROM mytable"; + MySqlCommand myCommand = new MySqlCommand(sql, conn); + myCommand.CommandType = CommandType.Text; + } + + + + + + Initializes a new instance of the class + with the text of the query, a , and the + . + The text of the query. + A that represents the + connection to an instance of SQL Server. + + The in which the executes. + + When an instance of is created, + the following read/write properties are set to initial values. + + + + Properties + Initial Value + + + + + + + cmdText + + + + + + + 0 + + + + + + CommandType.Text + + + + + + + connection + + + + + You can change the value for any of these properties through a separate call to + the property. + + + The following example creates a and + sets some of its properties. + + + Public Sub CreateMySqlCommand() + Dim conn as new MySqlConnection("server=myServer") + conn.Open(); + Dim txn as MySqlTransaction = conn.BeginTransaction() + Dim sql as String = "SELECT * FROM mytable" + Dim myCommand As New MySqlCommand(sql, conn, txn) + myCommand.CommandType = CommandType.Text + End Sub + + + public void CreateMySqlCommand() + { + MySqlConnection conn = new MySqlConnection("server=myserver") + conn.Open(); + MySqlTransaction txn = conn.BeginTransaction(); + string sql = "SELECT * FROM mytable"; + MySqlCommand myCommand = new MySqlCommand(sql, conn, txn); + myCommand.CommandType = CommandType.Text; + } + + + + + + Gets the last inserted id. + + + + + + Gets or sets the SQL statement to execute at the data source. + + The SQL statement or stored procedure to execute. The default is an empty string. + + + When the property is set to StoredProcedure, + the CommandText property should be set to the name of the stored procedure. + The user may be required to use escape character syntax if the stored procedure name + contains any special characters. The command executes this stored procedure when + you call one of the Execute methods. Starting with Connector/NET 5.0, having both a stored function + and stored procedure with the same name in the same database is not supported. It is + suggested that you provide unqiue names for your stored routines. + + + The following example creates a and sets some of its properties. + + Public Sub CreateMySqlCommand() + Dim myCommand As New MySqlCommand() + myCommand.CommandText = "SELECT * FROM Mytable ORDER BY id" + myCommand.CommandType = CommandType.Text + End Sub + + + public void CreateMySqlCommand() + { + MySqlCommand myCommand = new MySqlCommand(); + myCommand.CommandText = "SELECT * FROM mytable ORDER BY id"; + myCommand.CommandType = CommandType.Text; + } + + + + + + Gets or sets the wait time before terminating the attempt to execute a command + and generating an error. + + The time (in seconds) to wait for the command to execute. The default is 30 + seconds. + + CommandTimeout is dependent on the ability of MySQL to cancel an executing query. + Because of this, CommandTimeout is only supported when connected to MySQL + version 5.0.0 or higher. + + + + + Gets or sets a value indicating how the property is to be interpreted. + + One of the values. The default is Text. + + + When you set the CommandType property to StoredProcedure, you + should set the property to the name of the stored + procedure. The command executes this stored procedure when you call one of the + Execute methods. + + + The following example creates a and sets some of its properties. + + Public Sub CreateMySqlCommand() + Dim myCommand As New MySqlCommand() + myCommand.CommandType = CommandType.Text + End Sub + + + public void CreateMySqlCommand() + { + MySqlCommand myCommand = new MySqlCommand(); + myCommand.CommandType = CommandType.Text; + } + + + + + + Gets a boolean value that indicates whether the Prepared method has been called. + + + + + + Gets or sets the used by this instance of the + . + + The connection to a data source. The default value is a null reference + (Nothing in Visual Basic). + + + If you set Connection while a transaction is in progress and the + property is not null, an + is generated. If the Transaction property is not null and the transaction + has already been committed or rolled back, Transaction is set to + null. + + + The following example creates a and sets some of its properties. + + Public Sub CreateMySqlCommand() + Dim mySelectQuery As String = "SELECT * FROM mytable ORDER BY id" + Dim myConnectString As String = "Persist Security Info=False;database=test;server=myServer" + Dim myCommand As New MySqlCommand(mySelectQuery) + myCommand.Connection = New MySqlConnection(myConnectString) + myCommand.CommandType = CommandType.Text + End Sub + + + public void CreateMySqlCommand() + { + string mySelectQuery = "SELECT * FROM mytable ORDER BY id"; + string myConnectString = "Persist Security Info=False;database=test;server=myServer"; + MySqlCommand myCommand = new MySqlCommand(mySelectQuery); + myCommand.Connection = new MySqlConnection(myConnectString); + myCommand.CommandType = CommandType.Text; + } + + + + + + Get the + + The parameters of the SQL statement or stored procedure. The default is + an empty collection. + + Connector/NET does not support unnamed parameters. Every parameter added to the collection must + have an associated name. + + The following example creates a and displays its parameters. + To accomplish this, the method is passed a , a query string + that is a SQL SELECT statement, and an array of objects. + + Public Sub CreateMySqlCommand(myConnection As MySqlConnection, _ + mySelectQuery As String, myParamArray() As MySqlParameter) + Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) + myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age" + myCommand.UpdatedRowSource = UpdateRowSource.Both + myCommand.Parameters.Add(myParamArray) + Dim j As Integer + For j = 0 To myCommand.Parameters.Count - 1 + myCommand.Parameters.Add(myParamArray(j)) + Next j + Dim myMessage As String = "" + Dim i As Integer + For i = 0 To myCommand.Parameters.Count - 1 + myMessage += myCommand.Parameters(i).ToString() & ControlChars.Cr + Next i + Console.WriteLine(myMessage) + End Sub + + + public void CreateMySqlCommand(MySqlConnection myConnection, string mySelectQuery, + MySqlParameter[] myParamArray) + { + MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection); + myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age"; + myCommand.Parameters.Add(myParamArray); + for (int j=0; j<myParamArray.Length; j++) + { + myCommand.Parameters.Add(myParamArray[j]) ; + } + string myMessage = ""; + for (int i = 0; i < myCommand.Parameters.Count; i++) + { + myMessage += myCommand.Parameters[i].ToString() + "\n"; + } + MessageBox.Show(myMessage); + } + + + + + + Gets or sets the within which the executes. + + The . The default value is a null reference (Nothing in Visual Basic). + + You cannot set the Transaction property if it is already set to a + specific value, and the command is in the process of executing. If you set the + transaction property to a object that is not connected + to the same as the object, + an exception will be thrown the next time you attempt to execute a statement. + + + + + Gets or sets a boolean value that indicates whether caching is enabled. + + + + + Gets or sets the seconds for how long a TableDirect result should be cached. + + + + + Gets or sets how command results are applied to the DataRow when used by the + Update method of the DbDataAdapter. + + + + + Gets or sets a value indicating whether the command object should be visible in a Windows Form Designer control. + + + + + Attempts to cancel the execution of a currently active command + + + Cancelling a currently active query only works with MySQL versions 5.0.0 and higher. + + + + + Creates a new instance of a object. + + + This method is a strongly-typed version of . + + A object. + + + + + Check the connection to make sure + - it is open + - it is not currently being used by a reader + - and we have the right version of MySQL for the requested command type + + + + + Executes a SQL statement against the connection and returns the number of rows affected. + Number of rows affected + You can use ExecuteNonQuery to perform any type of database operation, + however any resultsets returned will not be available. Any output parameters + used in calling a stored procedure will be populated with data and can be + retrieved after execution is complete. + For UPDATE, INSERT, and DELETE statements, the return value is the number + of rows affected by the command. For all other types of statements, the return + value is -1. + + The following example creates a MySqlCommand and then + executes it using ExecuteNonQuery. The example is passed a string that is a + SQL statement (such as UPDATE, INSERT, or DELETE) and a string to use to + connect to the data source. + + Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As MySqlConnection) + Dim myCommand As New MySqlCommand(myExecuteQuery, myConnection) + myCommand.Connection.Open() + myCommand.ExecuteNonQuery() + myConnection.Close() + End Sub + + + public void CreateMySqlCommand(string myExecuteQuery, MySqlConnection myConnection) + { + MySqlCommand myCommand = new MySqlCommand(myExecuteQuery, myConnection); + myCommand.Connection.Open(); + myCommand.ExecuteNonQuery(); + myConnection.Close(); + } + + + + + + Reset reader to null, to avoid "There is already an open data reader" + on the next ExecuteReader(). Used in error handling scenarios. + + + + + Reset SQL_SELECT_LIMIT that could have been modified by CommandBehavior. + + + + + Sends the to the Connection + and builds a . + + A object. + + + When the property is set to StoredProcedure, + the property should be set to the name of the stored + procedure. The command executes this stored procedure when you call + ExecuteReader. + + + While the is in use, the associated + is busy serving the MySqlDataReader. + While in this state, no other operations can be performed on the + MySqlConnection other than closing it. This is the case until the + method of the MySqlDataReader is called. + + + The following example creates a , then executes it by + passing a string that is a SQL SELECT statement, and a string to use to connect to the + data source. + + Public Sub CreateMySqlDataReader(mySelectQuery As String, myConnection As MySqlConnection) + Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) + myConnection.Open() + Dim myReader As MySqlDataReader + myReader = myCommand.ExecuteReader() + Try + While myReader.Read() + Console.WriteLine(myReader.GetString(0)) + End While + Finally + myReader.Close + myConnection.Close + End Try + End Sub + + + public void CreateMySqlDataReader(string mySelectQuery, MySqlConnection myConnection) + { + MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection); + myConnection.Open(); + MMySqlDataReader myReader; + myReader = myCommand.ExecuteReader(); + try + { + while(myReader.Read()) + { + Console.WriteLine(myReader.GetString(0)); + } + } + finally + { + myReader.Close(); + myConnection.Close(); + } + } + + + + + + Sends the to the Connection, + and builds a using one of the values. + + One of the values. + + + When the property is set to StoredProcedure, + the property should be set to the name of the stored + procedure. The command executes this stored procedure when you call + ExecuteReader. + + + The supports a special mode that enables large binary + values to be read efficiently. For more information, see the SequentialAccess + setting for . + + + While the is in use, the associated + is busy serving the MySqlDataReader. + While in this state, no other operations can be performed on the + MySqlConnection other than closing it. This is the case until the + method of the MySqlDataReader is called. + If the MySqlDataReader is created with CommandBehavior set to + CloseConnection, closing the MySqlDataReader closes the connection + automatically. + + + When calling ExecuteReader with the SingleRow behavior, you should be aware that using a limit + clause in your SQL will cause all rows (up to the limit given) to be retrieved by the client. The + method will still return false after the first row but pulling all rows of data + into the client will have a performance impact. If the limit clause is not necessary, it should + be avoided. + + + A object. + + + + + Executes the query, and returns the first column of the first row in the + result set returned by the query. Extra columns or rows are ignored. + + The first column of the first row in the result set, or a null reference if the + result set is empty + + + Use the ExecuteScalar method to retrieve a single value (for example, + an aggregate value) from a database. This requires less code than using the + method, and then performing the operations necessary + to generate the single value using the data returned by a + + + The following example creates a and then + executes it using ExecuteScalar. The example is passed a string that is a + SQL statement that returns an aggregate result, and a string to use to + connect to the data source. + + + Public Sub CreateMySqlCommand(myScalarQuery As String, myConnection As MySqlConnection) + Dim myCommand As New MySqlCommand(myScalarQuery, myConnection) + myCommand.Connection.Open() + myCommand.ExecuteScalar() + myConnection.Close() + End Sub + + + public void CreateMySqlCommand(string myScalarQuery, MySqlConnection myConnection) + { + MySqlCommand myCommand = new MySqlCommand(myScalarQuery, myConnection); + myCommand.Connection.Open(); + myCommand.ExecuteScalar(); + myConnection.Close(); + } + + + public: + void CreateMySqlCommand(String* myScalarQuery, MySqlConnection* myConnection) + { + MySqlCommand* myCommand = new MySqlCommand(myScalarQuery, myConnection); + myCommand->Connection->Open(); + myCommand->ExecuteScalar(); + myConnection->Close(); + } + + + + + + + + + + Creates a prepared version of the command on an instance of MySQL Server. + + + Prepared statements are only supported on MySQL version 4.1 and higher. Calling + prepare while connected to earlier versions of MySQL will succeed but will execute + the statement in the same way as unprepared. + + + The following example demonstrates the use of the Prepare method. + + public sub PrepareExample() + Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection) + cmd.Parameters.Add( "@val", 10 ) + cmd.Prepare() + cmd.ExecuteNonQuery() + + cmd.Parameters(0).Value = 20 + cmd.ExecuteNonQuery() + end sub + + + private void PrepareExample() + { + MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection); + cmd.Parameters.Add( "@val", 10 ); + cmd.Prepare(); + cmd.ExecuteNonQuery(); + + cmd.Parameters[0].Value = 20; + cmd.ExecuteNonQuery(); + } + + + + + + Initiates the asynchronous execution of the SQL statement or stored procedure + that is described by this , and retrieves one or more + result sets from the server. + + An that can be used to poll, wait for results, + or both; this value is also needed when invoking EndExecuteReader, + which returns a instance that can be used to retrieve + the returned rows. + + + + Initiates the asynchronous execution of the SQL statement or stored procedure + that is described by this using one of the + CommandBehavior values. + + One of the values, indicating + options for statement execution and data retrieval. + An that can be used to poll, wait for results, + or both; this value is also needed when invoking EndExecuteReader, + which returns a instance that can be used to retrieve + the returned rows. + + + + Finishes asynchronous execution of a SQL statement, returning the requested + . + + The returned by the call to + . + A MySqlDataReader object that can be used to retrieve the requested rows. + + + + Initiates the asynchronous execution of the SQL statement or stored procedure + that is described by this . + + + An delegate that is invoked when the command's + execution has completed. Pass a null reference (Nothing in Visual Basic) + to indicate that no callback is required. + A user-defined state object that is passed to the + callback procedure. Retrieve this object from within the callback procedure + using the property. + An that can be used to poll or wait for results, + or both; this value is also needed when invoking , + which returns the number of affected rows. + + + + Initiates the asynchronous execution of the SQL statement or stored procedure + that is described by this . + + An that can be used to poll or wait for results, + or both; this value is also needed when invoking , + which returns the number of affected rows. + + + + Finishes asynchronous execution of a SQL statement. + + The returned by the call + to . + + + + + Verifies if a query is valid even if it has not spaces or is a stored procedure call + + Query to validate + If it is necessary to add call statement + + + + Creates a clone of this object. CommandText, Connection, and Transaction properties + are included as well as the entire parameter list. + + The cloned object. + + + + Summary description for API. + + + + + Summary description for CompressedStream. + + + + + Represents an open connection to a MySQL Server database. This class cannot be inherited. + + + A MySqlConnection object represents a session to a MySQL Server + data source. When you create an instance of MySqlConnection, all + properties are set to their initial values. For a list of these values, see the + MySqlConnection constructor. + + + + If the MySqlConnection goes out of scope, it is not closed. Therefore, + you must explicitly close the connection by calling + or . + + + The following example creates a and + a MySqlConnection. The MySqlConnection is opened and set as the + for the MySqlCommand. The example then calls + , and closes the connection. To accomplish this, the ExecuteNonQuery is + passed a connection string and a query string that is a SQL INSERT + statement. + + + Public Sub InsertRow(myConnectionString As String) + ' If the connection string is null, use a default. + If myConnectionString = "" Then + myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass" + End If + Dim myConnection As New MySqlConnection(myConnectionString) + Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)" + Dim myCommand As New MySqlCommand(myInsertQuery) + myCommand.Connection = myConnection + myConnection.Open() + myCommand.ExecuteNonQuery() + myCommand.Connection.Close() + End Sub + + + + + public void InsertRow(string myConnectionString) + { + // If the connection string is null, use a default. + if(myConnectionString == "") + { + myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"; + } + MySqlConnection myConnection = new MySqlConnection(myConnectionString); + string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"; + MySqlCommand myCommand = new MySqlCommand(myInsertQuery); + myCommand.Connection = myConnection; + myConnection.Open(); + myCommand.ExecuteNonQuery(); + myCommand.Connection.Close(); + } + + + + + + + The client used to handle SSH connections. + + + + Occurs when MySQL returns warnings as a result of executing a command or query. + + + + + Initializes a new instance of the class. + + When a new instance of is created, the read/write + properties are set to the following initial values unless they are specifically + set using their associated keywords in the property. + + + + Properties + Initial Value + + + + + + empty string ("") + + + + + + 15 + + + + + + empty string ("") + + + + + + empty string ("") + + + + + + empty string ("") + + + + You can change the value for these properties only by using the ConnectionString property. + + + + Initializes a new instance of the class. + + + + + + Initializes a new instance of the class when given a string containing the connection string. + + When a new instance of is created, the read/write + properties are set to the following initial values unless they are specifically + set using their associated keywords in the property. + + + + Properties + Initial Value + + + + + + empty string ("") + + + + + + 15 + + + + + + empty string ("") + + + + + + empty string ("") + + + + + + empty string ("") + + + + You can change the value for these properties only by using the ConnectionString property. + + The connection properties used to open the MySQL database. + + + + Determines whether the connection is a clone of other connection. + + + + + Returns the id of the server thread this connection is executing on + + + + + Gets the name of the MySQL server to which to connect. + + + + + Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error. + The value set is less than 0. + A value of 0 indicates no limit, and should be avoided in a + because an attempt to connect + will wait indefinitely. + + The following example creates a MySqlConnection + and sets some of its properties in the connection string. + + Public Sub CreateSqlConnection() + Dim myConnection As New MySqlConnection() + myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30" + myConnection.Open() + End Sub + + + public void CreateSqlConnection() + { + MySqlConnection myConnection = new MySqlConnection(); + myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30"; + myConnection.Open(); + } + + + + + Gets the name of the current database or the database to be used after a connection is opened.The name of the current database or the name of the database to be used after a connection is opened. The default value is an empty string. + + The Database property does not update dynamically. + If you change the current database using a SQL statement, then this property + may reflect the wrong value. If you change the current database using the + method, this property is updated to reflect the new database. + + + The following example creates a and displays + some of its read-only properties. + + + Public Sub CreateMySqlConnection() + Dim myConnString As String = _ + "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass" + Dim myConnection As New MySqlConnection( myConnString ) + myConnection.Open() + MessageBox.Show( "Server Version: " + myConnection.ServerVersion _ + + ControlChars.NewLine + "Database: " + myConnection.Database ) + myConnection.ChangeDatabase( "test2" ) + MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _ + + ControlChars.NewLine + "Database: " + myConnection.Database ) + myConnection.Close() + End Sub + + + + public void CreateMySqlConnection() + { + string myConnString = + "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"; + MySqlConnection myConnection = new MySqlConnection( myConnString ); + myConnection.Open(); + MessageBox.Show( "Server Version: " + myConnection.ServerVersion + + "\nDatabase: " + myConnection.Database ); + myConnection.ChangeDatabase( "test2" ); + MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion + + "\nDatabase: " + myConnection.Database ); + myConnection.Close(); + } + + + + + + Indicates if this connection should use compression when communicating with the server. + + + + Gets the current state of the connection. + A bitwise combination of the values. The default is Closed. + + The allowed state changes are: + + + From Closed to Open, using the Open method of the connection object. + + + From Open to Closed, using either the Close method or the Dispose method of the connection object. + + + + The following example creates a , opens it, + displays some of its properties, then closes the connection. + + + Public Sub CreateMySqlConnection(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _ + + ControlChars.Cr + "State: " + myConnection.State.ToString()) + myConnection.Close() + End Sub + + + public void CreateMySqlConnection(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + + "\nState: " + myConnection.State.ToString()); + myConnection.Close(); + } + + + + + Gets a string containing the version of the MySQL server to which the client is connected.The version of the instance of MySQL.The connection is closed. + The following example creates a , opens it, + displays some of its properties, then closes the connection. + + + Public Sub CreateMySqlConnection(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _ + + ControlChars.Cr + "State: " + myConnection.State.ToString()) + myConnection.Close() + End Sub + + + public void CreateMySqlConnection(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + + "\nState: " + myConnection.State.ToString()); + myConnection.Close(); + } + + + + + + Gets or sets the string used to connect to a MySQL Server database. + + + The ConnectionString returned may not be exactly like what was originally + set but will be indentical in terms of keyword/value pairs. Security information + will not be included unless the Persist Security Info value is set to true. + + + You can use the ConnectionString property to connect to a database. + The following example illustrates a typical connection string. + + "Persist Security Info=False;database=MyDB;server=MySqlServer;user id=myUser;Password=myPass" + + The ConnectionString property can be set only when the connection is + closed. Many of the connection string values have corresponding read-only + properties. When the connection string is set, all of these properties are + updated, except when an error is detected. In this case, none of the properties + are updated. properties return only those settings contained in the + ConnectionString. + + + To connect to a local machine, specify "localhost" for the server. If you do not + specify a server, localhost is assumed. + + + Resetting the ConnectionString on a closed connection resets all + connection string values (and related properties) including the password. For + example, if you set a connection string that includes "Database= MyDb", and + then reset the connection string to "Data Source=myserver;User Id=myUser;Password=myPass", + the property is no longer set to MyDb. + + + The connection string is parsed immediately after being set. If errors in + syntax are found when parsing, a runtime exception, such as , + is generated. Other errors can be found only when an attempt is made to open the + connection. + + + The basic format of a connection string consists of a series of keyword/value + pairs separated by semicolons. The equal sign (=) connects each keyword and its + value. To include values that contain a semicolon, single-quote character, or + double-quote character, the value must be enclosed in double quotes. If the + value contains both a semicolon and a double-quote character, the value can be + enclosed in single quotes. The single quote is also useful if the value begins + with a double-quote character. Conversely, the double quote can be used if the + value begins with a single quote. If the value contains both single-quote and + double-quote characters, the quote character used to enclose the value must be + doubled each time it occurs within the value. + + + To include preceding or trailing spaces in the string value, the value must + be enclosed in either single quotes or double quotes. Any leading or trailing + spaces around integer, Boolean, or enumerated values are ignored, even if + enclosed in quotes. However, spaces within a string literal keyword or value are + preserved. Using .NET Framework version 1.1, single or double quotes may be used + within a connection string without using delimiters (for example, Data Source= + my'Server or Data Source= my"Server), unless a quote character is the first or + last character in the value. + + + To include an equal sign (=) in a keyword or value, it must be preceded by + another equal sign. For example, in the hypothetical connection string + + "key==word=value" + + the keyword is "key=word" and the value is "value". + + If a specific keyword in a keyword= value pair occurs multiple times in a + connection string, the last occurrence listed is used in the value set. + + Keywords are not case sensitive. + + The following table lists the valid names for keyword values within the + ConnectionString. + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDefaultDescription
+ Connect Timeout -or- Connection Timeout + 15 + The length of time (in seconds) to wait for a connection to the server before + terminating the attempt and generating an error. +
+ Host -or- Server -or- Data Source -or- + DataSource -or- Address -or- Addr -or- + Network Address + localhost + + The name or network address of the instance of MySQL to which to connect. Multiple hosts can be + specified separated by &. This can be useful where multiple MySQL servers are configured for replication + and you are not concerned about the precise server you are connecting to. No attempt is made by the provider to + synchronize writes to the database so care should be taken when using this option. + + + In Unix environment with Mono, this can be a fully qualified path to MySQL socket filename. With this configuration, the Unix socket will be used instead of TCP/IP socket. + Currently only a single socket name can be given so accessing MySQL in a replicated environment using Unix sockets is not currently supported. + +
Port3306 + The port MySQL is using to listen for connections. This value is ignored if the connection protocol + is anything but socket. +
Protocolsocket + Specifies the type of connection to make to the server.Values can be: + socket or tcp for a socket connection
+ pipe for a named pipe connection
+ unix for a Unix socket connection
+ memory to use MySQL shared memory +
+ CharSet -or Character Set + + + Specifies the character set that should be used to encode all queries sent to the server. + Resultsets are still returned in the character set of the data returned. +
LoggingfalseWhen true, various pieces of information is output to any configured TraceListeners.
Allow Batchtrue + When true, multiple SQL statements can be sent with one command execution.

+ -Note-
+ Starting with MySQL 4.1.1, batch statements should be separated by the server-defined seperator character.
+ Commands sent to earlier versions of MySQL should be seperated with ';'. +
Encryptfalse + When true, SSL/TLS encryption is used for all data sent between the + client and server if the server has a certificate installed. Recognized values + are true, false, yes, and no. +
+ Initial Catalog -or- Database + mysqlThe name of the database to use intially
+ Password -or- pwd + + The password for the MySQL account being used.
Persist Security Infofalse + When set to false or no (strongly recommended), security-sensitive + information, such as the password, is not returned as part of the connection if + the connection is open or has ever been in an open state. Resetting the + connection string resets all connection string values including the password. + Recognized values are true, false, yes, and no. +
+ User Id -or- Username -or- Uid -or- User name + + The MySQL login account being used.
Shared Memory NameMYSQLThe name of the shared memory object to use for communication if the connection protocol is set to memory.
Allow Zero Datetimefalse + True to have MySqlDataReader.GetValue() return a MySqlDateTime for date or datetime columns that have illegal values. + False will cause a DateTime object to be returned for legal values and an exception will be thrown for illegal values. +
Convert Zero Datetimefalse + True to have MySqlDataReader.GetValue() and MySqlDataReader.GetDateTime() + return DateTime.MinValue for date or datetime columns that have illegal values. +
+ Pipe Name -or- Pipe + mysql + When set to the name of a named pipe, the MySqlConnection will attempt to connect to MySQL + on that named pipe.

This settings only applies to the Windows platform. +
+ Use Performance Monitor -or- UsePerformanceMonitor + false + Posts performance data that can be tracked using perfmon +
+ Procedure Cache Size + 25 + How many stored procedure definitions can be held in the cache +
+ Ignore Prepare + true + Instructs the provider to ignore any attempts to prepare commands. This option + was added to allow a user to disable prepared statements in an entire application + without modifying the code. A user might want to do this if errors or bugs are + encountered with MySQL prepared statements. +
Use Procedure Bodiestrue + Instructs the provider to attempt to call the procedure without first resolving the metadata. This + is useful in situations where the calling user does not have access to the mysql.proc table. To + use this mode, the parameters for the procedure must be added to the command in the same order + as they appear in the procedure definition and their types must be explicitly set. +
Auto Enlisttrue + Indicates whether the connection should automatically enlist in the current transaction, + if there is one. +
Respect Binary Flagstrue + Indicates whether the connection should respect all binary flags sent to the client + as part of column metadata. False will cause the connector to behave like + Connector/NET 5.0 and earlier. +
BlobAsUTF8IncludePatternnull + Pattern that should be used to indicate which blob columns should be treated as UTF-8. +
BlobAsUTF8ExcludePatternnull + Pattern that should be used to indicate which blob columns should not be treated as UTF-8. +
Default Command Timeout30 + The default timeout that new MySqlCommand objects will use unless changed. +
Allow User Variablesfalse + Should the provider expect user variables in the SQL. +
Interactive -or- Interactive Sessionfalse + Should this session be considered interactive? +
Functions Return Stringfalse + Set this option to true to force the return value of SQL functions to be string. +
Use Affected Rowsfalse + Set this option to true to cause the affected rows reported to reflect only the + rows that are actually changed. By default, the number of rows that are matched + is returned. +
+
+ + The following table lists the valid names for connection pooling values within + the ConnectionString. For more information about connection pooling, see + Connection Pooling for the MySql Data Provider. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDefaultDescription
Connection Lifetime0 + When a connection is returned to the pool, its creation time is compared with + the current time, and the connection is destroyed if that time span (in seconds) + exceeds the value specified by Connection Lifetime. This is useful in + clustered configurations to force load balancing between a running server and a + server just brought online. + + A value of zero (0) causes pooled connections to have the maximum connection + timeout. + +
Max Pool Size100The maximum number of connections allowed in the pool.
Min Pool Size0The minimum number of connections allowed in the pool.
Poolingtrue + When true, the MySqlConnection object is drawn from the appropriate + pool, or if necessary, is created and added to the appropriate pool. Recognized + values are true, false, yes, and no. +
Connection Resetfalse + Specifies whether the database connection should be reset when being + drawn from the pool. Leaving this as false will yeild much faster + connection opens but the user should understand the side effects + of doing this such as temporary tables and user variables from the previous + session not being cleared out. +
Cache Server Propertiesfalse + Specifies whether the server variables are cached between pooled connections. + On systems where the variables change infrequently and there are lots of + connection attempts, this can speed up things dramatically. +
+
+ + When setting keyword or connection pooling values that require a Boolean + value, you can use 'yes' instead of 'true', and 'no' instead of 'false'. + + + Note The MySql Data Provider uses the native socket protocol to + communicate with MySQL. Therefore, it does not support the use of an ODBC data source name (DSN) when + connecting to MySQL because it does not add an ODBC layer. + + + CAUTION In this release, the application should use caution when constructing a + connection string based on user input (for example when retrieving user ID and password information from a + dialog box, and appending it to the connection string). The application should + ensure that a user cannot embed extra connection string parameters in these + values (for example, entering a password as "validpassword;database=somedb" in + an attempt to attach to a different database). + +
+ The following example creates a and sets some of its properties + + Public Sub CreateConnection() + Dim myConnection As New MySqlConnection() + myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass" + myConnection.Open() + End Sub 'CreateConnection + + + public void CreateConnection() + { + MySqlConnection myConnection = new MySqlConnection(); + myConnection.ConnectionString = "Persist Security Info=False;database=myDB;server=myHost;Connect Timeout=30;user id=myUser; pwd=myPass"; + myConnection.Open(); + } + + + The following example creates a in Unix environment with Mono installed. MySQL socket filename used in this example is "/var/lib/mysql/mysql.sock". The actual filename depends on your MySQL configuration. + + Public Sub CreateConnection() + Dim myConnection As New MySqlConnection() + myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass" + myConnection.Open() + End Sub 'CreateConnection + + + public void CreateConnection() + { + MySqlConnection myConnection = new MySqlConnection(); + myConnection.ConnectionString = "database=myDB;server=/var/lib/mysql/mysql.sock;user id=myUser; pwd=myPass"; + myConnection.Open(); + } + + +
+ + + Gets a boolean value that indicates whether the password associated to the connection is expired. + + + + Begins a database transaction.An object representing the new transaction.Parallel transactions are not supported. + This command is equivalent to the MySQL BEGIN TRANSACTION command. + + You must explicitly commit or roll back the transaction using the or + method. + + If you do not specify an isolation level, the default isolation level is used. To specify an isolation + level with the method, use the overload that takes the iso parameter. Also + note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher. + On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status. + + + + The following example creates a and a + . It also demonstrates how to use the BeginTransaction, a + , and methods. + + Public Sub RunTransaction(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + + Dim myCommand As MySqlCommand = myConnection.CreateCommand() + Dim myTrans As MySqlTransaction + + ' Start a local transaction + myTrans = myConnection.BeginTransaction() + ' Must assign both transaction object and connection + ' to Command object for a pending local transaction + myCommand.Connection = myConnection + myCommand.Transaction = myTrans + + Try + myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')" + myCommand.ExecuteNonQuery() + myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')" + myCommand.ExecuteNonQuery() + myTrans.Commit() + Console.WriteLine("Both records are written to database.") + Catch e As Exception + Try + myTrans.Rollback() + Catch ex As MySqlException + If Not myTrans.Connection Is Nothing Then + Console.WriteLine("An exception of type " + ex.GetType().ToString() + _ + " was encountered while attempting to roll back the transaction.") + End If + End Try + + Console.WriteLine("An exception of type " + e.GetType().ToString() + _ + "was encountered while inserting the data.") + Console.WriteLine("Neither record was written to database.") + Finally + myConnection.Close() + End Try + End Sub + + + public void RunTransaction(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + + MySqlCommand myCommand = myConnection.CreateCommand(); + MySqlTransaction myTrans; + + // Start a local transaction + myTrans = myConnection.BeginTransaction(); + // Must assign both transaction object and connection + // to Command object for a pending local transaction + myCommand.Connection = myConnection; + myCommand.Transaction = myTrans; + + try + { + myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')"; + myCommand.ExecuteNonQuery(); + myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')"; + myCommand.ExecuteNonQuery(); + myTrans.Commit(); + Console.WriteLine("Both records are written to database."); + } + catch(Exception e) + { + try + { + myTrans.Rollback(); + } + catch (SqlException ex) + { + if (myTrans.Connection != null) + { + Console.WriteLine("An exception of type " + ex.GetType() + + " was encountered while attempting to roll back the transaction."); + } + } + + Console.WriteLine("An exception of type " + e.GetType() + + " was encountered while inserting the data."); + Console.WriteLine("Neither record was written to database."); + } + finally + { + myConnection.Close(); + } + } + + + + + Begins a database transaction with the specified isolation level.The isolation level under which the transaction should run. An object representing the new transaction.Parallel exceptions are not supported. + This command is equivalent to the MySQL BEGIN TRANSACTION command. + + You must explicitly commit or roll back the transaction using the or + method. + + If you do not specify an isolation level, the default isolation level is used. To specify an isolation + level with the method, use the overload that takes the iso parameter. + Also note that any attempt to begin a transaction while a transaction is in progress will throw an exception on MySQL 4.1 and higher. + On MySQL 4.0, an exception will not be thrown because servers 4.0 and earlier did not report their transacation status. + + + + The following example creates a and a + . It also demonstrates how to use the BeginTransaction, a + , and methods. + + Public Sub RunTransaction(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + + Dim myCommand As MySqlCommand = myConnection.CreateCommand() + Dim myTrans As MySqlTransaction + + ' Start a local transaction + myTrans = myConnection.BeginTransaction() + ' Must assign both transaction object and connection + ' to Command object for a pending local transaction + myCommand.Connection = myConnection + myCommand.Transaction = myTrans + + Try + myCommand.CommandText = "Insert into Test (id, desc) VALUES (100, 'Description')" + myCommand.ExecuteNonQuery() + myCommand.CommandText = "Insert into Test (id, desc) VALUES (101, 'Description')" + myCommand.ExecuteNonQuery() + myTrans.Commit() + Console.WriteLine("Both records are written to database.") + Catch e As Exception + Try + myTrans.Rollback() + Catch ex As MySqlException + If Not myTrans.Connection Is Nothing Then + Console.WriteLine("An exception of type " + ex.GetType().ToString() + _ + " was encountered while attempting to roll back the transaction.") + End If + End Try + + Console.WriteLine("An exception of type " + e.GetType().ToString() + _ + "was encountered while inserting the data.") + Console.WriteLine("Neither record was written to database.") + Finally + myConnection.Close() + End Try + End Sub + + + public void RunTransaction(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + + MySqlCommand myCommand = myConnection.CreateCommand(); + MySqlTransaction myTrans; + + // Start a local transaction + myTrans = myConnection.BeginTransaction(); + // Must assign both transaction object and connection + // to Command object for a pending local transaction + myCommand.Connection = myConnection; + myCommand.Transaction = myTrans; + + try + { + myCommand.CommandText = "insert into Test (id, desc) VALUES (100, 'Description')"; + myCommand.ExecuteNonQuery(); + myCommand.CommandText = "insert into Test (id, desc) VALUES (101, 'Description')"; + myCommand.ExecuteNonQuery(); + myTrans.Commit(); + Console.WriteLine("Both records are written to database."); + } + catch(Exception e) + { + try + { + myTrans.Rollback(); + } + catch (SqlException ex) + { + if (myTrans.Connection != null) + { + Console.WriteLine("An exception of type " + ex.GetType() + + " was encountered while attempting to roll back the transaction."); + } + } + + Console.WriteLine("An exception of type " + e.GetType() + + " was encountered while inserting the data."); + Console.WriteLine("Neither record was written to database."); + } + finally + { + myConnection.Close(); + } + } + + + + + Changes the current database for an open MySqlConnection.The name of the database to use. + + The value supplied in the database parameter must be a valid database + name. The database parameter cannot contain a null value, an empty + string, or a string with only blank characters. + + + + When you are using connection pooling against MySQL, and you close + the connection, it is returned to the connection pool. The next time the + connection is retrieved from the pool, the reset connection request + executes before the user performs any operations. + + The database name is not valid.The connection is not open.Cannot change the database. + The following example creates a and displays + some of its read-only properties. + + + Public Sub CreateMySqlConnection() + Dim myConnString As String = _ + "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass" + Dim myConnection As New MySqlConnection( myConnString ) + myConnection.Open() + MessageBox.Show( "Server Version: " + myConnection.ServerVersion _ + + ControlChars.NewLine + "Database: " + myConnection.Database ) + myConnection.ChangeDatabase( "test2" ) + MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion _ + + ControlChars.NewLine + "Database: " + myConnection.Database ) + myConnection.Close() + End Sub + + + + public void CreateMySqlConnection() + { + string myConnString = + "Persist Security Info=False;database=test;server=localhost;user id=joeuser;pwd=pass"; + MySqlConnection myConnection = new MySqlConnection( myConnString ); + myConnection.Open(); + MessageBox.Show( "Server Version: " + myConnection.ServerVersion + + "\nDatabase: " + myConnection.Database ); + myConnection.ChangeDatabase( "test2" ); + MessageBox.Show( "ServerVersion: " + myConnection.ServerVersion + + "\nDatabase: " + myConnection.Database ); + myConnection.Close(); + } + + + + + + Pings the server. + + true if the ping was successful; otherwise, false. + + + Opens a database connection with the property settings specified by the ConnectionString.Cannot open a connection without specifying a data source or server.A connection-level error occurred while opening the connection. + + The draws an open connection from the connection pool if one is available. + Otherwise, it establishes a new connection to an instance of MySQL. + + + The following example creates a , opens it, + displays some of its properties, then closes the connection. + + + Public Sub CreateMySqlConnection(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _ + + ControlChars.Cr + "State: " + myConnection.State.ToString()) + myConnection.Close() + End Sub + + + public void CreateMySqlConnection(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + + "\nState: " + myConnection.State.ToString()); + myConnection.Close(); + } + + + + + + Initializes the if more than one host is found. + + A string containing an unparsed list of hosts. + true if the connection data is a URI; otherwise false. + The number of hosts found, -1 if an error was raised during parsing. + + + + Creates a object based on the provided parameters. + + The host string which can be a simple host name or a host name and port. + The priority of the host. + The port number of the host. + + + + + Creates and returns a object associated with the . + + A object. + + + + Closes the connection to the database. This is the preferred method of closing any open connection. + + The Close method rolls back any pending transactions. It then releases + the connection to the connection pool, or closes the connection if connection + pooling is disabled. + + + An application can call Close more than one time. No exception is + generated. + + + The following example creates a , opens it, + displays some of its properties, then closes the connection. + + + Public Sub CreateMySqlConnection(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + MessageBox.Show("ServerVersion: " + myConnection.ServerVersion _ + + ControlChars.Cr + "State: " + myConnection.State.ToString()) + myConnection.Close() + End Sub + + + public void CreateMySqlConnection(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + MessageBox.Show("ServerVersion: " + myConnection.ServerVersion + + "\nState: " + myConnection.State.ToString()); + myConnection.Close(); + } + + + + + + Cancels the query after the specified time interval. + + The length of time (in seconds) to wait for the cancelation of the command execution. + + + + Sets query timeout. If timeout has been set prior and not + yet cleared ClearCommandTimeout(), it has no effect. + + timeout in seconds + true if + + + + Clears query timeout, allowing next SetCommandTimeout() to succeed. + + + + + Gets a schema collection based on the provided restriction values. + + The name of the collection. + The values to restrict. + A schema collection object. + + + Empties the connection pool associated with the specified connection. + The associated with the pool to be cleared. + + + ClearPool clears the connection pool that is associated with the connection. + If additional connections associated with connection are in use at the time of the call, + they are marked appropriately and are discarded (instead of being returned to the pool) + when Close is called on them. + + + + + Clears all connection pools. + + ClearAllPools essentially performs a on all current connection + pools. + + + + + + Initiates the asynchronous execution of a transaction. + + An object representing the new transaction. + + + + Asynchronous version of BeginTransaction. + + The cancellation token. + An object representing the new transaction. + + + + Asynchronous version of BeginTransaction. + + The isolation level under which the transaction should run. + An object representing the new transaction. + + + + Asynchronous version of BeginTransaction. + + The isolation level under which the transaction should run. + The cancellation token. + An object representing the new transaction. + + + + Asynchronous version of the ChangeDataBase method. + + The name of the database to use. + + + + + Asynchronous version of the ChangeDataBase method. + + The name of the database to use. + The cancellation token. + + + + + Asynchronous version of the Close method. + + + + + Asynchronous version of the Close method. + + The cancellation token. + + + + Asynchronous version of the ClearPool method. + + The connection associated with the pool to be cleared. + + + + Asynchronous version of the ClearPool method. + + The connection associated with the pool to be cleared. + The cancellation token. + + + + Asynchronous version of the ClearAllPools method. + + + + + Asynchronous version of the ClearAllPools method. + + The cancellation token. + + + + Asynchronous version of the GetSchemaCollection method. + + The name of the collection. + The values to restrict. + A collection of schema objects. + + + + Asynchronous version of the GetSchemaCollection method. + + The name of the collection. + The values to restrict. + The cancellation token. + A collection of schema objects. + + + + Returns schema information for the data source of this . + + A that contains schema information. + + + + Returns schema information for the data source of this + using the specified string for the schema name. + + Specifies the name of the schema to return. + A that contains schema information. + + + + Returns schema information for the data source of this + using the specified string for the schema name and the specified string array + for the restriction values. + + Specifies the name of the schema to return. + Specifies a set of restriction values for the requested schema. + A that contains schema information. + + + + Enlists in the specified transaction. + + + A reference to an existing in which to enlist. + + + + + Creates a new MySqlConnection object with the exact same ConnectionString value + + A cloned MySqlConnection object + + + + Represents the method that will handle the event of a + . + + + + + Provides data for the InfoMessage event. This class cannot be inherited. + + + + + Gets or sets an array of objects set with the errors found. + + + + + IDisposable wrapper around SetCommandTimeout and ClearCommandTimeout functionality. + + + + + Summary description for Crypt. + + + + + Simple XOR scramble + + Source array + Index inside source array + Destination array + Index inside destination array + Password used to xor the bits + Number of bytes to scramble + + + + Returns a byte array containing the proper encryption of the + given password/seed according to the new 4.1.1 authentication scheme. + + + + + + + + Encrypts a password using the MySql encryption scheme + + The password to encrypt + The encryption seed the server gave us + Indicates if we should use the old or new encryption scheme + + + + + Hashes a password using the algorithm from Monty's code. + The first element in the return is the result of the "old" hash. + The second element is the rest of the "new" hash. + + Password to be hashed + Two element array containing the hashed values + + + + Provides a means of reading a forward-only stream of rows from a MySQL database. This class cannot be inherited. + + + To create a MySQLDataReader, you must call the + method of the object, rather than directly using a constructor. + + + While the MySqlDataReader is in use, the associated + is busy serving the MySqlDataReader, and no other operations can be performed + on the MySqlConnection other than closing it. This is the case until the + method of the MySqlDataReader is called. + + + and + are the only properties that you can call after the MySqlDataReader is + closed. Though the RecordsAffected property may be accessed at any time + while the MySqlDataReader exists, always call Close before returning + the value of RecordsAffected to ensure an accurate return value. + + + For optimal performance, MySqlDataReader avoids creating + unnecessary objects or making unnecessary copies of data. As a result, multiple calls + to methods such as return a reference to the + same object. Use caution if you are modifying the underlying value of the objects + returned by methods such as GetValue. + + + The following example creates a , + a , and a MySqlDataReader. The example reads through + the data, writing it out to the console. Finally, the example closes the MySqlDataReader, then the + MySqlConnection. + + Public Sub ReadMyData(myConnString As String) + Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders" + Dim myConnection As New MySqlConnection(myConnString) + Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) + myConnection.Open() + Dim myReader As MySqlDataReader + myReader = myCommand.ExecuteReader() + ' Always call Read before accessing data. + While myReader.Read() + Console.WriteLine((myReader.GetInt32(0) & ", " & myReader.GetString(1))) + End While + ' always call Close when done reading. + myReader.Close() + ' Close the connection when done with it. + myConnection.Close() + End Sub 'ReadMyData + + + public void ReadMyData(string myConnString) { + string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders"; + MySqlConnection myConnection = new MySqlConnection(myConnString); + MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection); + myConnection.Open(); + MySqlDataReader myReader; + myReader = myCommand.ExecuteReader(); + // Always call Read before accessing data. + while (myReader.Read()) { + Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1)); + } + // always call Close when done reading. + myReader.Close(); + // Close the connection when done with it. + myConnection.Close(); + } + + + + + + Gets the number of columns in the current row. + + + + + Gets a value indicating whether the MySqlDataReader contains one or more rows. + + + + + Gets a value indicating whether the data reader is closed. + + + + + Gets the number of rows changed, inserted, or deleted by execution of the SQL statement. + + + + + Overloaded. Gets the value of a column in its native format. + In C#, this property is the indexer for the MySqlDataReader class. + + + + + Gets the value of a column in its native format. + [C#] In C#, this property is the indexer for the MySqlDataReader class. + + + + + Gets a value indicating the depth of nesting for the current row. This method is not + supported currently and always returns 0. + + + + + Closes the MySqlDataReader object. + + + + + Gets the value of the specified column as a Boolean. + + + + + + + Gets the value of the specified column as a Boolean. + + + + + + + Gets the value of the specified column as a byte. + + + + + + + Gets the value of the specified column as a byte. + + + + + + + Gets the value of the specified column as a sbyte. + + + + + + + Gets the value of the specified column as a sbyte. + + + + + + + Reads a stream of bytes from the specified column offset into the buffer an array starting at the given buffer offset. + + The zero-based column ordinal. + The index within the field from which to begin the read operation. + The buffer into which to read the stream of bytes. + The index for buffer to begin the read operation. + The maximum length to copy into the buffer. + The actual number of bytes read. + + + + + Gets the value of the specified column as a single character. + + + + + + + Gets the value of the specified column as a single character. + + + + + + + Reads a stream of characters from the specified column offset into the buffer as an array starting at the given buffer offset. + + + + + + + + + + + Gets the name of the source data type. + + + + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a DateTime object. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a DateTime object. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a DateTime object. + + + Call IsDBNull to check for null values before calling this method. + + + + MySql allows date columns to contain the value '0000-00-00' and datetime + columns to contain the value '0000-00-00 00:00:00'. The DateTime structure cannot contain + or represent these values. To read a datetime value from a column that might + contain zero values, use . + + + The behavior of reading a zero datetime column using this method is defined by the + ZeroDateTimeBehavior connection string option. For more information on this option, + please refer to . + + + The column name.The value of the specified column. + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a DateTime object. + + + Call IsDBNull to check for null values before calling this method. + + + + MySql allows date columns to contain the value '0000-00-00' and datetime + columns to contain the value '0000-00-00 00:00:00'. The DateTime structure cannot contain + or represent these values. To read a datetime value from a column that might + contain zero values, use . + + + The behavior of reading a zero datetime column using this method is defined by the + ZeroDateTimeBehavior connection string option. For more information on this option, + please refer to . + + + The zero-based column ordinal.The value of the specified column. + + + + Gets the value of the specified column as a . + + The name of the colum. + The value of the specified column as a . + + + + Gets the value of the specified column as a . + + The index of the colum. + The value of the specified column as a . + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a Decimal object. + + + Call IsDBNull to check for null values before calling this method. + + The column nameThe value of the specified column. + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a Decimal object. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinalThe value of the specified column. + + + Gets the value of the specified column as a double-precision floating point number. + + No conversions are performed; therefore, the data retrieved must already be a Double object. + + + Call IsDBNull to check for null values before calling this method. + + The column nameThe value of the specified column. + + + Gets the value of the specified column as a double-precision floating point number. + + No conversions are performed; therefore, the data retrieved must already be a Double object. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal.The value of the specified column. + + + + Gets the Type that is the data type of the object. + + + + + + + Gets the value of the specified column as a single-precision floating point number. + + + No conversions are performed; therefore, the data retrieved must already be a Float object. + + + Call IsDBNull to check for null values before calling this method. + + The column nameThe value of the specified column. + + + + Gets the value of the specified column as a single-precision floating point number. + + + No conversions are performed; therefore, the data retrieved must already be a Float object. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal.The value of the specified column. + + + + Gets the value of the specified column as a globally-unique identifier(GUID). + + The name of the column. + + + + + + + Gets the value of the specified column as a 16-bit signed integer. + + No conversions are performed; threfore, the data retrieved must already be a 16 bit integer value. + + + Call IsDBNull to check for null values before calling this method. + + The column nameThe value of the specified column. + + + Gets the value of the specified column as a 16-bit signed integer. + + No conversions are performed; therefore, the data retrieved must already be a 16 bit integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal.The value of the specified column. + + + Gets the value of the specified column as a 32-bit signed integer. + + No conversions are performed; therefore, the data retrieved must already be a 32 bit integer value. + + + Call IsDBNull to check for null values before calling this method. + + The column name.The value of the specified column. + + + Gets the value of the specified column as a 32-bit signed integer. + + No conversions are performed; therefore, the data retrieved must already be a 32 bit integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal.The value of the specified column. + + + Gets the value of the specified column as a 64-bit signed integer. + + No conversions are performed; therefore, the data retrieved must already be a 64 bit integer value. + + + Call IsDBNull to check for null values before calling this method. + + The column name.The value of the specified column. + + + Gets the value of the specified column as a 64-bit signed integer. + + No conversions are performed; therefore, the data retrieved must already be a 64 bit integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal.The value of the specified column. + + + + Gets the name of the specified column. + + + + + + + Gets the column ordinal, given the name of the column. + + + + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a String object. + + + Call IsDBNull to check for null values before calling this method. + + The column name.The value of the specified column. + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a String object. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal.The value of the specified column. + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a Time value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + + Gets the value of the specified column as a object. + + + No conversions are performed; therefore, the data retrieved must already be a Time value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + + Gets the value of the specified column in its native format. + + + + + + + Gets all attribute columns in the collection for the current row. + + + + + + Gets the value of the specified column as a 16-bit unsigned integer. + + No conversions are performed; therefore, the data retrieved must already be a 16 bit unsigned integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + Gets the value of the specified column as a 16-bit unsigned integer. + + No conversions are performed; therefore, the data retrieved must already be a 16 bit unsigned integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + Gets the value of the specified column as a 32-bit unsigned integer. + + No conversions are performed; therefore, the data retrieved must already be a 32 bit unsigned integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + Gets the value of the specified column as a 32-bit unsigned integer. + + No conversions are performed; therefore, the data retrieved must already be a 32 bit unsigned integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + Gets the value of the specified column as a 64-bit unsigned integer. + + No conversions are performed; therefore, the data retrieved must already be a 64 bit unsigned integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + Gets the value of the specified column as a 64-bit unsigned integer. + + No conversions are performed; therefore, the data retrieved must already be a 64 bit unsigned integer value. + + + Call IsDBNull to check for null values before calling this method. + + The zero-based column ordinal or column name.The value of the specified column. + + + + Gets a value indicating whether the column contains non-existent or missing values. + + + + + + + Advances the data reader to the next result, when reading the results of batch SQL statements. + + + + + + Advances the MySqlDataReader to the next record. + + + + + + Gets the value of the specified column as a . + + The index of the colum. + The value of the specified column as a . + + + + Gets the value of the specified column as a . + + The name of the colum. + The value of the specified column as a . + + + + Returns an that iterates through the . + + + + + Returns a DataTable that describes the column metadata of the MySqlDataReader. + + + + + + Summary description for BaseDriver. + + + + + For pooled connections, time when the driver was + put into idle queue + + + + + Loads the properties from the connected server into a hashtable + + + + + + + Loads all the current character set names and ids for this server + into the charSets hashtable + + + + + The exception that is thrown when MySQL returns an error. This class cannot be inherited. + + + + This class is created whenever the MySql Data Provider encounters an error generated from the server. + + + Any open connections are not automatically closed when an exception is thrown. If + the client application determines that the exception is fatal, it should close any open + objects or objects. + + + The following example generates a MySqlException due to a missing server, + and then displays the exception. + + + Public Sub ShowException() + Dim mySelectQuery As String = "SELECT column1 FROM table1" + Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;") + Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) + + Try + myCommand.Connection.Open() + Catch e As MySqlException + MessageBox.Show( e.Message ) + End Try + End Sub + + + public void ShowException() + { + string mySelectQuery = "SELECT column1 FROM table1"; + MySqlConnection myConnection = + new MySqlConnection("Data Source=localhost;Database=Sample;"); + MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection); + + try + { + myCommand.Connection.Open(); + } + catch (MySqlException e) + { + MessageBox.Show( e.Message ); + } + } + + + + + + Gets a number that identifies the type of error. + + + + + True if this exception was fatal and cause the closing of the connection, false otherwise. + + + + + Gets the SQL state. + + + + + Gets an integer that representes the MySQL error code. + + + + + Summary description for Field. + + + + + We are adding a custom installer class to our assembly so our installer + can make proper changes to the machine.config file. + + + + + We override Install so we can add our assembly to the proper + machine.config files. + + + + + + We override Uninstall so we can remove out assembly from the + machine.config files. + + + + + + Automatically generates single-table commands used to reconcile changes made to a DataSet with the associated MySQL database. This class cannot be inherited. + + + The does not automatically generate the SQL statements required to + reconcile changes made to a DataSet with the associated instance of MySQL. + However, you can create a MySqlCommandBuilder object to automatically generate SQL statements for + single-table updates if you set the SelectCommand property + of the MySqlDataAdapter. Then, any additional SQL statements that you do not set are generated by the + MySqlCommandBuilder. + + + + The MySqlCommandBuilder registers itself as a listener for RowUpdating + events whenever you set the property. You can only associate one + MySqlDataAdapter or MySqlCommandBuilder object with each other at one time. + + + + To generate INSERT, UPDATE, or DELETE statements, the MySqlCommandBuilder uses the + SelectCommand property to retrieve a required set of metadata automatically. If you change + the SelectCommand after the metadata has is retrieved (for example, after the first update), you + should call the method to update the metadata. + + + + The SelectCommand must also return at least one primary key or unique + column. If none are present, an InvalidOperation exception is generated, + and the commands are not generated. + + + + The MySqlCommandBuilder also uses the Connection, + CommandTimeout, and Transaction + properties referenced by the SelectCommand. The user should call + RefreshSchema if any of these properties are modified, or if the + SelectCommand itself is replaced. Otherwise the InsertCommand, + UpdateCommand, and + DeleteCommand properties retain + their previous values. + + + + If you call Dispose, the MySqlCommandBuilder is disassociated + from the MySqlDataAdapter, and the generated commands are no longer used. + + + + Caution must be used when using MySqlCOmmandBuilder on MySql 4.0 systems. With MySql 4.0, + database/schema information is not provided to the connector for a query. This means that + a query that pulls columns from two identically named tables in two or more different databases + will not cause an exception to be thrown but will not work correctly. Even more dangerous + is the situation where your select statement references database X but is executed in + database Y and both databases have tables with similar layouts. This situation can cause + unwanted changes or deletes. + This note does not apply to MySQL versions 4.1 and later. + + + + The following example uses the , along + and , to + select rows from a data source. The example is passed an initialized + , a connection string, a + query string that is a SQL SELECT statement, and a string that is the + name of the database table. The example then creates a MySqlCommandBuilder. + + + Public Shared Function SelectRows(myConnection As String, mySelectQuery As String, myTableName As String) As DataSet + Dim myConn As New MySqlConnection(myConnection) + Dim myDataAdapter As New MySqlDataAdapter() + myDataAdapter.SelectCommand = New MySqlCommand(mySelectQuery, myConn) + Dim cb As SqlCommandBuilder = New MySqlCommandBuilder(myDataAdapter) + + myConn.Open() + + Dim ds As DataSet = New DataSet + myDataAdapter.Fill(ds, myTableName) + + ' Code to modify data in DataSet here + + ' Without the MySqlCommandBuilder this line would fail. + myDataAdapter.Update(ds, myTableName) + + myConn.Close() + End Function 'SelectRows + + + public static DataSet SelectRows(string myConnection, string mySelectQuery, string myTableName) + { + MySqlConnection myConn = new MySqlConnection(myConnection); + MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(); + myDataAdapter.SelectCommand = new MySqlCommand(mySelectQuery, myConn); + MySqlCommandBuilder cb = new MySqlCommandBuilder(myDataAdapter); + + myConn.Open(); + + DataSet ds = new DataSet(); + myDataAdapter.Fill(ds, myTableName); + + //code to modify data in DataSet here + + //Without the MySqlCommandBuilder this line would fail + myDataAdapter.Update(ds, myTableName); + + myConn.Close(); + + return ds; + } + + + + + + + Initializes a new instance of the class. + + + + + Initializes a new instance of the class + with the associated object. + + The to use. + + + The registers itself as a listener for + events that are generated by the + specified in this property. + + + When you create a new instance MySqlCommandBuilder, any existing + MySqlCommandBuilder associated with this MySqlDataAdapter + is released. + + + + + + Gets or sets a object for which SQL statements are automatically generated. + + A object. + + + The registers itself as a listener for + events that are generated by the + specified in this property. + + + When you create a new instance MySqlCommandBuilder, any existing + MySqlCommandBuilder associated with this MySqlDataAdapter + is released. + + + + + + Retrieves parameter information from the stored procedure specified + in the MySqlCommand and populates the Parameters collection of the + specified MySqlCommand object. + This method is not currently supported since stored procedures are + not available in MySql. + + The MySqlCommand referencing the stored + procedure from which the parameter information is to be derived. + The derived parameters are added to the Parameters collection of the + MySqlCommand. + The command text is not + a valid stored procedure name. + + + + Gets the delete command. + + + + + + Gets the update command. + + + + + + Gets the insert command. + + + + + + + + + + + + + Represents a set of data commands and a database connection that are used to fill a dataset and update a MySQL database. This class cannot be inherited. + + + The MySQLDataAdapter, serves as a bridge between a + and MySQL for retrieving and saving data. The MySQLDataAdapter provides this + bridge by mapping , which changes the data in the + DataSet to match the data in the data source, and , + which changes the data in the data source to match the data in the DataSet, + using the appropriate SQL statements against the data source. + + + When the MySQLDataAdapter fills a DataSet, it will create the necessary + tables and columns for the returned data if they do not already exist. However, primary + key information will not be included in the implicitly created schema unless the + property is set to . + You may also have the MySQLDataAdapter create the schema of the DataSet, + including primary key information, before filling it with data using . + + + MySQLDataAdapter is used in conjunction with + and to increase performance when connecting to a MySQL database. + + + The MySQLDataAdapter also includes the , + , , + , and + properties to facilitate the loading and updating of data. + + + When an instance of MySQLDataAdapter is created, the read/write properties + are set to initial values. For a list of these values, see the MySQLDataAdapter + constructor. + + + Please be aware that the class allows only + Int16, Int32, and Int64 to have the AutoIncrement property set. + If you plan to use autoincremement columns with MySQL, you should consider + using signed integer columns. + + + The following example creates a and a . + The MySqlConnection is opened and set as the for the + MySqlCommand. The example then calls , and closes + the connection. To accomplish this, the ExecuteNonQuery is + passed a connection string and a query string that is a SQL INSERT + statement. + + Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet + Dim conn As New MySqlConnection(connection) + Dim adapter As New MySqlDataAdapter() + adapter.SelectCommand = new MySqlCommand(query, conn) + adapter.Fill(dataset) + Return dataset + End Function + + + public DataSet SelectRows(DataSet dataset,string connection,string query) + { + MySqlConnection conn = new MySqlConnection(connection); + MySqlDataAdapter adapter = new MySqlDataAdapter(); + adapter.SelectCommand = new MySqlCommand(query, conn); + adapter.Fill(dataset); + return dataset; + } + + + + + + Occurs during Update before a command is executed against the data source. The attempt to update is made, so the event fires. + + + + + Occurs during Update after a command is executed against the data source. The attempt to update is made, so the event fires. + + + + + Initializes a new instance of the MySqlDataAdapter class. + + + When an instance of is created, + the following read/write properties are set to the following initial + values. + + + + Properties + Initial Value + + + + + + + MissingMappingAction.Passthrough + + + + + + + + MissingSchemaAction.Add + + + + + You can change the value of any of these properties through a separate call + to the property. + + + The following example creates a and sets some of + its properties. + + Public Sub CreateSqlDataAdapter() + Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _ + "database=test") + Dim da As MySqlDataAdapter = New MySqlDataAdapter + da.MissingSchemaAction = MissingSchemaAction.AddWithKey + + da.SelectCommand = New MySqlCommand("SELECT id, name FROM mytable", conn) + da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _ + "VALUES (@id, @name)", conn) + da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _ + "WHERE id=@oldId", conn) + da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) + + da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") + + da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") + da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original + + da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original + End Sub + + + public static void CreateSqlDataAdapter() + { + MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test"); + MySqlDataAdapter da = new MySqlDataAdapter(); + da.MissingSchemaAction = MissingSchemaAction.AddWithKey; + + da.SelectCommand = new MySqlCommand("SELECT id, name FROM mytable", conn); + da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " + + "VALUES (@id, @name)", conn); + da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " + + "WHERE id=@oldId", conn); + da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); + + da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); + + da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); + da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; + + da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; + } + + + + + + Initializes a new instance of the class with + the specified as the + property. + + that is a SQL SELECT statement or stored procedure and is set + as the property of the . + + + When an instance of is created, + the following read/write properties are set to the following initial + values. + + + + Properties + Initial Value + + + + + + + MissingMappingAction.Passthrough + + + + + + + + MissingSchemaAction.Add + + + + + You can change the value of any of these properties through a separate call + to the property. + + + When SelectCommand (or any of the other command properties) is assigned + to a previously created , the MySqlCommand is not cloned. + The SelectCommand maintains a reference to the previously created MySqlCommand + object. + + + The following example creates a and sets some of + its properties. + + Public Sub CreateSqlDataAdapter() + Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _ + "database=test") + Dim cmd as new MySqlCommand("SELECT id, name FROM mytable", conn) + Dim da As MySqlDataAdapter = New MySqlDataAdapter(cmd) + da.MissingSchemaAction = MissingSchemaAction.AddWithKey + + da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _ + "VALUES (@id, @name)", conn) + da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _ + "WHERE id=@oldId", conn) + da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) + + da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") + + da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") + da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original + + da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original + End Sub + + + public static void CreateSqlDataAdapter() + { + MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test"); + MySqlCommand cmd = new MySqlCommand("SELECT id, name FROM mytable", conn); + MySqlDataAdapter da = new MySqlDataAdapter(cmd); + da.MissingSchemaAction = MissingSchemaAction.AddWithKey; + + da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " + + "VALUES (@id, @name)", conn); + da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " + + "WHERE id=@oldId", conn); + da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); + + da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); + + da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); + da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; + + da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; + } + + + + + + Initializes a new instance of the class with + a and a object. + + A String that is a SQL SELECT statement or stored procedure to be used by + the property of the . + + A that represents the connection. + + + This implementation of the opens and closes a + if it is not already open. This can be useful in a an application that must call the + method for two or more MySqlDataAdapter objects. + If the MySqlConnection is already open, you must explicitly call + or to close it. + + + When an instance of is created, + the following read/write properties are set to the following initial + values. + + + + Properties + Initial Value + + + + + + + MissingMappingAction.Passthrough + + + + + + + + MissingSchemaAction.Add + + + + + You can change the value of any of these properties through a separate call + to the property. + + + The following example creates a and sets some of + its properties. + + Public Sub CreateSqlDataAdapter() + Dim conn As MySqlConnection = New MySqlConnection("Data Source=localhost;" & _ + "database=test") + Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", conn) + da.MissingSchemaAction = MissingSchemaAction.AddWithKey + + da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _ + "VALUES (@id, @name)", conn) + da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _ + "WHERE id=@oldId", conn) + da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) + + da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") + + da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") + da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original + + da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original + End Sub + + + public static void CreateSqlDataAdapter() + { + MySqlConnection conn = new MySqlConnection("Data Source=localhost;database=test"); + MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", conn); + da.MissingSchemaAction = MissingSchemaAction.AddWithKey; + + da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " + + "VALUES (@id, @name)", conn); + da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " + + "WHERE id=@oldId", conn); + da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); + + da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); + + da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); + da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; + + da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; + } + + + + + + Initializes a new instance of the class with + a and a connection string. + + A that is a SQL SELECT statement or stored procedure to + be used by the property of the . + The connection string + + When an instance of is created, + the following read/write properties are set to the following initial + values. + + + + Properties + Initial Value + + + + + + + MissingMappingAction.Passthrough + + + + + + + + MissingSchemaAction.Add + + + + + You can change the value of any of these properties through a separate call + to the property. + + + The following example creates a and sets some of + its properties. + + Public Sub CreateSqlDataAdapter() + Dim da As MySqlDataAdapter = New MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test") + Dim conn As MySqlConnection = da.SelectCommand.Connection + da.MissingSchemaAction = MissingSchemaAction.AddWithKey + + da.InsertCommand = New MySqlCommand("INSERT INTO mytable (id, name) " & _ + "VALUES (@id, @name)", conn) + da.UpdateCommand = New MySqlCommand("UPDATE mytable SET id=@id, name=@name " & _ + "WHERE id=@oldId", conn) + da.DeleteCommand = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) + + da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") + + da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name") + da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original + + da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original + End Sub + + + public static void CreateSqlDataAdapter() + { + MySqlDataAdapter da = new MySqlDataAdapter("SELECT id, name FROM mytable", "Data Source=localhost;database=test"); + MySqlConnection conn = da.SelectCommand.Connection; + da.MissingSchemaAction = MissingSchemaAction.AddWithKey; + + da.InsertCommand = new MySqlCommand("INSERT INTO mytable (id, name) " + + "VALUES (@id, @name)", conn); + da.UpdateCommand = new MySqlCommand("UPDATE mytable SET id=@id, name=@name " + + "WHERE id=@oldId", conn); + da.DeleteCommand = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); + + da.InsertCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + da.InsertCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); + + da.UpdateCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + da.UpdateCommand.Parameters.Add("@name", MySqlDbType.VarChar, 40, "name"); + da.UpdateCommand.Parameters.Add("@oldId", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; + + da.DeleteCommand.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id").SourceVersion = DataRowVersion.Original; + } + + + + + + Gets or sets a SQL statement or stored procedure used to delete records from the data set. + + A used during to delete records in the + database that correspond to deleted rows in the . + + + During , if this property is not set and primary key information + is present in the , the DeleteCommand can be generated + automatically if you set the property and use the + . Then, any additional commands that you do not set are + generated by the MySqlCommandBuilder. This generation logic requires key column + information to be present in the DataSet. + + + When DeleteCommand is assigned to a previously created , + the MySqlCommand is not cloned. The DeleteCommand maintains a reference + to the previously created MySqlCommand object. + + + The following example creates a and sets the + and DeleteCommand properties. It assumes you have already + created a object. + + Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter + + Dim da As MySqlDataAdapter = New MySqlDataAdapter() + Dim cmd As MySqlCommand + Dim parm As MySqlParameter + + ' Create the SelectCommand. + cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn) + + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15) + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15) + + da.SelectCommand = cmd + + ' Create the DeleteCommand. + cmd = New MySqlCommand("DELETE FROM mytable WHERE id=@id", conn) + + parm = cmd.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id") + parm.SourceVersion = DataRowVersion.Original + + da.DeleteCommand = cmd + + Return da + End Function + + + public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn) + { + MySqlDataAdapter da = new MySqlDataAdapter(); + MySqlCommand cmd; + MySqlParameter parm; + + // Create the SelectCommand. + cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn); + + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15); + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15); + + da.SelectCommand = cmd; + + // Create the DeleteCommand. + cmd = new MySqlCommand("DELETE FROM mytable WHERE id=@id", conn); + + parm = cmd.Parameters.Add("@id", MySqlDbType.VarChar, 5, "id"); + parm.SourceVersion = DataRowVersion.Original; + + da.DeleteCommand = cmd; + + return da; + } + + + + + + Gets or sets a SQL statement or stored procedure used to insert records into the data set. + + A used during to insert records into the + database that correspond to new rows in the . + + + During , if this property is not set and primary key information + is present in the , the InsertCommand can be generated + automatically if you set the property and use the + . Then, any additional commands that you do not set are + generated by the MySqlCommandBuilder. This generation logic requires key column + information to be present in the DataSet. + + + When InsertCommand is assigned to a previously created , + the MySqlCommand is not cloned. The InsertCommand maintains a reference + to the previously created MySqlCommand object. + + + If execution of this command returns rows, these rows may be added to the DataSet + depending on how you set the property of the MySqlCommand object. + + + The following example creates a and sets the + and InsertCommand properties. It assumes you have already + created a object. + + Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter + + Dim da As MySqlDataAdapter = New MySqlDataAdapter() + Dim cmd As MySqlCommand + Dim parm As MySqlParameter + + ' Create the SelectCommand. + cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn) + + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15) + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15) + + da.SelectCommand = cmd + + ' Create the InsertCommand. + cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id, @name)", conn) + + cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" ) + cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" ) + da.InsertCommand = cmd + + Return da + End Function + + + public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn) + { + MySqlDataAdapter da = new MySqlDataAdapter(); + MySqlCommand cmd; + MySqlParameter parm; + + // Create the SelectCommand. + cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn); + + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15); + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15); + + da.SelectCommand = cmd; + + // Create the InsertCommand. + cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id,@name)", conn); + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" ); + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" ); + + da.InsertCommand = cmd; + + return da; + } + + + + + + Gets or sets a SQL statement or stored procedure used to select records in the data source. + + A used during to select records from the + database for placement in the . + + + When SelectCommand is assigned to a previously created , + the MySqlCommand is not cloned. The SelectCommand maintains a reference to the + previously created MySqlCommand object. + + + If the SelectCommand does not return any rows, no tables are added to the + , and no exception is raised. + + + The following example creates a and sets the + and InsertCommand properties. It assumes you have already + created a object. + + Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter + + Dim da As MySqlDataAdapter = New MySqlDataAdapter() + Dim cmd As MySqlCommand + Dim parm As MySqlParameter + + ' Create the SelectCommand. + cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn) + + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15) + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15) + + da.SelectCommand = cmd + + ' Create the InsertCommand. + cmd = New MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id, @name)", conn) + + cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" ) + cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" ) + da.InsertCommand = cmd + + Return da + End Function + + + public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn) + { + MySqlDataAdapter da = new MySqlDataAdapter(); + MySqlCommand cmd; + MySqlParameter parm; + + // Create the SelectCommand. + cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn); + + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15); + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15); + + da.SelectCommand = cmd; + + // Create the InsertCommand. + cmd = new MySqlCommand("INSERT INTO mytable (id,name) VALUES (@id,@name)", conn); + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" ); + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" ); + + da.InsertCommand = cmd; + + return da; + } + + + + + + Gets or sets a SQL statement or stored procedure used to updated records in the data source. + + A used during to update records in the + database with data from the . + + + During , if this property is not set and primary key information + is present in the , the UpdateCommand can be generated + automatically if you set the property and use the + . Then, any additional commands that you do not set are + generated by the MySqlCommandBuilder. This generation logic requires key column + information to be present in the DataSet. + + + When UpdateCommand is assigned to a previously created , + the MySqlCommand is not cloned. The UpdateCommand maintains a reference + to the previously created MySqlCommand object. + + + If execution of this command returns rows, these rows may be merged with the DataSet + depending on how you set the property of the MySqlCommand object. + + + The following example creates a and sets the + and UpdateCommand properties. It assumes you have already + created a object. + + Public Shared Function CreateCustomerAdapter(conn As MySqlConnection) As MySqlDataAdapter + + Dim da As MySqlDataAdapter = New MySqlDataAdapter() + Dim cmd As MySqlCommand + Dim parm As MySqlParameter + + ' Create the SelectCommand. + cmd = New MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn) + + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15) + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15) + + da.SelectCommand = cmd + + ' Create the UpdateCommand. + cmd = New MySqlCommand("UPDATE mytable SET id=@id, name=@name WHERE id=@oldId", conn) + + cmd.Parameters.Add( "@id", MySqlDbType.VarChar, 15, "id" ) + cmd.Parameters.Add( "@name", MySqlDbType.VarChar, 15, "name" ) + + parm = cmd.Parameters.Add("@oldId", MySqlDbType.VarChar, 15, "id") + parm.SourceVersion = DataRowVersion.Original + + da.UpdateCommand = cmd + + Return da + End Function + + + public static MySqlDataAdapter CreateCustomerAdapter(MySqlConnection conn) + { + MySqlDataAdapter da = new MySqlDataAdapter(); + MySqlCommand cmd; + MySqlParameter parm; + + // Create the SelectCommand. + cmd = new MySqlCommand("SELECT * FROM mytable WHERE id=@id AND name=@name", conn); + + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15); + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15); + + da.SelectCommand = cmd; + + // Create the UpdateCommand. + cmd = new MySqlCommand("UPDATE mytable SET id=@id, name=@name WHERE id=@oldId", conn); + cmd.Parameters.Add("@id", MySqlDbType.VarChar, 15, "id" ); + cmd.Parameters.Add("@name", MySqlDbType.VarChar, 15, "name" ); + + parm = cmd.Parameters.Add( "@oldId", MySqlDbType.VarChar, 15, "id" ); + parm.SourceVersion = DataRowVersion.Original; + + da.UpdateCommand = cmd; + + return da; + } + + + + + + Open connection if it was closed. + Necessary to workaround "connection must be open and valid" error + with batched updates. + + Row state + list of opened connections + If connection is opened by this function, the list is updated + + true if connection was opened + + + + Overridden. See . + + + + + + + + + + Overridden. See . + + + + + + + + + + Overridden. Raises the RowUpdating event. + + A MySqlRowUpdatingEventArgs that contains the event data. + + + + Overridden. Raises the RowUpdated event. + + A MySqlRowUpdatedEventArgs that contains the event data. + + + + Asynchronous version of the Fill method. + + The to fill records with. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill records with. + The cancellation token. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The name of the to use for table mapping. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The name of the to use for table mapping. + The cancellation token. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The name of the source table to use for table mapping. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The name of the source table to use for table mapping. + The cancellation token. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + An instance of . + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + An instance of . + The cancellation token. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The SQL SELECT statement used to retrieve rows from the data source. + One of the values. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The SQL SELECT statement used to retrieve rows from the data source. + One of the values. + The cancellation token. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The start record. + The max number of affected records. + The s to fill with records. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The start record. + The max number of affected records. + The cancellation token. + The s to fill with records. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The start record. + The max number of affected records. + The name of the source table to use for table mapping. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The start record. + The max number of affected records. + The name of the source table to use for table mapping. + The cancellation token. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The name of the source table to use for table mapping. + An instance of . + The start record. + The max number of affected records. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The name of the source table to use for table mapping. + An instance of . + The start record. + The max number of affected records. + The cancellation token. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The s to fill with records. + The start record. + The max number of affected records. + The SQL SELECT statement used to retrieve rows from the data source. + One of the values. + The number of rows successfully added to or refreshed in the s. + + + + Asynchronous version of the Fill method. + + The s to fill with records. + The start record. + The max number of affected records. + The SQL SELECT statement used to retrieve rows from the data source. + One of the values. + The cancellation token. + The number of rows successfully added to or refreshed in the s. + + + + Asynchronous version of the Fill method. + + The to fill with records. + The start record. + The max number of affected records. + The name of the source table to use for table mapping. + The SQL SELECT statement used to retrieve rows from the data source. + One of the values. + The number of rows successfully added to or refreshed in the . + + + + Asynchronous version of the Fill method. + + The to fill with records. + The start record. + The max number of affected records. + The name of the source table to use for table mapping. + The SQL SELECT statement used to retrieve rows from the data source. + One of the values. + The cancellation token. + The number of rows successfully added to or refreshed in the . + + + + Async version of FillSchema + + DataSet to use + Schema Type + DataTable[] + + + + Async version of FillSchema + + DataSet to use + Schema Type + Source Table + DataTable[] + + + + Async version of FillSchema + + DataSet to use + Schema Type + Source Table + DataReader to use + DataTable[] + + + + Async version of FillSchema + + DataSet to use + Schema Type + DBCommand to use + Source Table + Command Behavior + DataTable[] + + + + Async version of FillSchema + + DataTable to use + Schema Type + DataTable + + + + Async version of FillSchema + + DataTable to use + Schema Type + DataReader to use + DataTable + + + + Async version of FillSchema + + DataTable to use + Schema Type + DBCommand to use + Command Behavior + DataTable + + + + Async version of Update + + DataRow[] to use + int + + + + Async version of Update + + DataSet to use + int + + + + Async version of Update + + DataTable to use + int + + + + Async version of Update + + DataRow[] to use + Data Table Mapping + int + + + + Async version of Update + + DataSet to use + Source Table + + + + + Represents the method that will handle the event of a . + + + + + Represents the method that will handle the event of a . + + + + + Provides data for the RowUpdating event. This class cannot be inherited. + + + + + Initializes a new instance of the MySqlRowUpdatingEventArgs class. + + The to + . + The to execute during . + One of the values that specifies the type of query executed. + The sent through an . + + + + Gets or sets the MySqlCommand to execute when performing the Update. + + + + + Provides data for the RowUpdated event. This class cannot be inherited. + + + + + Initializes a new instance of the MySqlRowUpdatedEventArgs class. + + The sent through an . + The executed when is called. + One of the values that specifies the type of query executed. + The sent through an . + + + + Gets or sets the MySqlCommand executed when Update is called. + + + + + Enables the provider to help ensure that a user has a security level adequate for accessing data. + + + + + Adds a new connection string with set of restricted keywords to the MySqlClientPermission object + + Settings to be used for the connection + Keywords to define the restrictions + KeyRestrictionBehavior to be used + + + + Returns MySqlClientPermission as an IPermission + + + + + + Associates a security action with a custom security attribute. + + + + + Represents a section within a configuration file. + + + + + Gets the MySQL configuations associated to the current configuration. + + + + + Gets a collection of the exception interceptors available in the current configuration. + + + + + Gets a collection of the command interceptors available in the current configuration. + + + + + Gets a collection of the authentication plugins available in the current configuration. + + + + + Gets or sets the replication configurations. + + + + + Defines the configurations allowed for an authentication plugin. + + + + + Gets or sets the name of the authentication plugin. + + + + + Gets or sets the type of the authentication plugin. + + + + + Defines the configurations allowed for an interceptor. + + + + + Gets or sets the name of the interceptor. + + + + + Gets or sets the type of the interceptor. + + + + + Represents a generic configuration element. + + + + + + Gets an enumerator that iterates through the returned list. + + An enumerator that iterates through the returned list. + + + + Helper class that makes it easier to work with the provider. + + + + + Asynchronous version of ExecuteDataRow. + + The settings to be used for the connection. + The command to execute. + The parameters to use for the command. + The DataRow containing the first row of the resultset. + + + + Asynchronous version of ExecuteDataRow. + + The settings to be used for the connection. + The command to execute. + The cancellation token. + The parameters to use for the command. + The DataRow containing the first row of the resultset. + + + + Executes a single SQL command and returns the first row of the resultset. A new MySqlConnection object + is created, opened, and closed during this method. + + Settings to be used for the connection + Command to execute + Parameters to use for the command + DataRow containing the first row of the resultset + + + + Executes a single SQL command and returns the resultset in a . + A new MySqlConnection object is created, opened, and closed during this method. + + Settings to be used for the connection + Command to execute + containing the resultset + + + + Executes a single SQL command and returns the resultset in a . + A new MySqlConnection object is created, opened, and closed during this method. + + Settings to be used for the connection + Command to execute + Parameters to use for the command + containing the resultset + + + + Executes a single SQL command and returns the resultset in a . + The state of the object remains unchanged after execution + of this method. + + object to use + Command to execute + containing the resultset + + + + Executes a single SQL command and returns the resultset in a . + The state of the object remains unchanged after execution + of this method. + + object to use + Command to execute + Parameters to use for the command + containing the resultset + + + + Updates the given table with data from the given + + Settings to use for the update + Command text to use for the update + containing the new data to use in the update + Tablename in the dataset to update + + + + Async version of ExecuteDataset + + Settings to be used for the connection + Command to execute + containing the resultset + + + + Async version of ExecuteDataset + + Settings to be used for the connection + Command to execute + Parameters to use for the command + containing the resultset + + + + Async version of ExecuteDataset + + object to use + Command to execute + containing the resultset + + + + Async version of ExecuteDataset + + object to use + Command to execute + Parameters to use for the command + containing the resultset + + + + Async version of UpdateDataset + + Settings to use for the update + Command text to use for the update + containing the new data to use in the update + Tablename in the dataset to update + + + + Executes a single command against a MySQL database. The is assumed to be + open when the method is called and remains open after the method completes. + + The object to use + The SQL command to be executed. + An array of objects to use with the command. + The number of affected records. + + + + Executes a single command against a MySQL database. + + to use. + The SQL command to be executed. + An rray of objects to use with the command. + The number of affected records. + A new is created using the given. + + + + Executes a single command against a MySQL database, possibly inside an existing transaction. + + object to use for the command + object to use for the command + Command text to use + Array of objects to use with the command + True if the connection should be preserved, false if not + object ready to read the results of the command + + + + Executes a single command against a MySQL database. + + Settings to use for this command + Command text to use + object ready to read the results of the command + + + + Executes a single command against a MySQL database. + + object to use for the command + Command text to use + object ready to read the results of the command + + + + Executes a single command against a MySQL database. + + Settings to use for this command + Command text to use + Array of objects to use with the command + object ready to read the results of the command + + + + Executes a single command against a MySQL database. + + Connection to use for the command + Command text to use + Array of objects to use with the command + object ready to read the results of the command + + + + Execute a single command against a MySQL database. + + Settings to use for the update + Command text to use for the update + The first column of the first row in the result set, or a null reference if the result set is empty. + + + + Execute a single command against a MySQL database. + + Settings to use for the command + Command text to use for the command + Parameters to use for the command + The first column of the first row in the result set, or a null reference if the result set is empty. + + + + Execute a single command against a MySQL database. + + object to use + Command text to use for the command + The first column of the first row in the result set, or a null reference if the result set is empty. + + + + Execute a single command against a MySQL database. + + object to use + Command text to use for the command + Parameters to use for the command + The first column of the first row in the result set, or a null reference if the result set is empty. + + + + Escapes the string. + + The string to escape. + The string with all quotes escaped. + + + + Replaces quotes with double quotes. + + The string to modidify. + A string containing double quotes instead of single quotes. + + + + Async version of ExecuteNonQuery + + object to use + SQL command to be executed + Array of objects to use with the command. + Rows affected + + + + Asynchronous version of the ExecuteNonQuery method. + + to use. + The SQL command to be executed. + An array of objects to use with the command. + The number of rows affected. + + + + Asynchronous version of the ExecuteNonQuery method. + + to use. + The SQL command to be executed. + The cancellation token. + An array of objects to use with the command. + The number of rows affected. + + + + Async version of ExecuteReader + + object to use for the command + object to use for the command + Command text to use + Array of objects to use with the command + True if the connection should be preserved, false if not + object ready to read the results of the command + + + + Async version of ExecuteReader + + Settings to use for this command + Command text to use + object ready to read the results of the command + + + + Async version of ExecuteReader + + object to use for the command + Command text to use + object ready to read the results of the command + + + + Async version of ExecuteReader + + Settings to use for this command + Command text to use + Array of objects to use with the command + object ready to read the results of the command + + + + Async version of ExecuteReader + + Connection to use for the command + Command text to use + Array of objects to use with the command + object ready to read the results of the command + + + + Async version of ExecuteScalar + + Settings to use for the update + Command text to use for the update + The first column of the first row in the result set, or a null reference if the result set is empty. + + + + Async version of ExecuteScalar + + Settings to use for the command + Command text to use for the command + Parameters to use for the command + The first column of the first row in the result set, or a null reference if the result set is empty. + + + + Async version of ExecuteScalar + + object to use + Command text to use for the command + The first column of the first row in the result set, or a null reference if the result set is empty. + + + + Async version of ExecuteScalar + + object to use + Command text to use for the command + Parameters to use for the command + The first column of the first row in the result set, or a null reference if the result set is empty. + + + + Represents a parameter to a , This class cannot be inherited. + + + + + Gets or sets the to use when loading . + + + + + CLoses this object. + + An object that is a clone of this object. + + + + Initializes a new instance of the class with the parameter name, the , the size, and the source column name. + + The name of the parameter to map. + One of the values. + The length of the parameter. + The name of the source column. + + + + Initializes a new instance of the class with the parameter name and a value of the new MySqlParameter. + + The name of the parameter to map. + An that is the value of the . + + + + Initializes a new instance of the class with the parameter name and the data type. + + The name of the parameter to map. + One of the values. + + + + Initializes a new instance of the class with the parameter name, the , and the size. + + The name of the parameter to map. + One of the values. + The length of the parameter. + + + + Initializes a new instance of the class with the parameter name, the type of the parameter, the size of the parameter, a , the precision of the parameter, the scale of the parameter, the source column, a to use, and the value of the parameter. + + The name of the parameter to map. + One of the values. + The length of the parameter. + One of the values. + true if the value of the field can be null, otherwise false. + The total number of digits to the left and right of the decimal point to which is resolved. + The total number of decimal places to which is resolved. + The name of the source column. + One of the values. + An that is the value of the . + + + + + Gets or sets a value indicating whether the parameter is input-only, output-only, bidirectional, or a stored procedure return value parameter. + As of MySql version 4.1 and earlier, input-only is the only valid choice. + + + + + Gets or sets a value indicating whether the parameter accepts null values. + + + + + Gets or sets the of the parameter. + + + + + Gets or sets the maximum number of digits used to represent the property. + + + + + Gets or sets the number of decimal places to which is resolved. + + + + + Gets or sets the maximum size, in bytes, of the data within the column. + + + + + Gets or sets the value of the parameter. + + + + + Returns the possible values for this parameter if this parameter is of type + SET or ENUM. Returns null otherwise. + + + + + Gets or sets the name of the source column that is mapped to the and used for loading or returning the . + + + + + Sets or gets a value which indicates whether the source column is nullable. + This allows to correctly generate Update statements + for nullable columns. + + + + + Gets or sets the of the parameter. + + + + + Overridden. Gets a string containing the . + + + + + + Resets the DbType property to its original settings. + + + + + Represents a collection of parameters relevant to a as well as their respective mappings to columns in a . This class cannot be inherited. + + + The number of the parameters in the collection must be equal to the number of + parameter placeholders within the command text, or an exception will be generated. + + The following example creates multiple instances of + through the MySqlParameterCollection collection within the . + These parameters are used to select data within the data source and place the data in + the . This code assumes that a DataSet and a MySqlDataAdapter + have already been created with the appropriate schema, commands, and connection. + + Public Sub AddParameters() + ' ... + ' create myDataSet and myDataAdapter + ' ... + myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters" + myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239 + + myDataAdapter.Fill(myDataSet) + End Sub 'AddSqlParameters + + + public void AddSqlParameters() + { + // ... + // create myDataSet and myDataAdapter + // ... + + myDataAdapter.SelectCommand.Parameters.Add("@CategoryName", MySqlDbType.VarChar, 80).Value = "toasters"; + myDataAdapter.SelectCommand.Parameters.Add("@SerialNum", MySqlDbType.Long).Value = 239; + myDataAdapter.Fill(myDataSet); + + } + + + + + + Gets a value that indicates whether the + has a fixed size. + + + + + Gets a value that indicates whether the + is read-only. + + + + + Gets a value that indicates whether the + is synchronized. + + + + + Gets the number of MySqlParameter objects in the collection. + + + + + Gets the at the specified index. + + Gets the with a specified attribute. + [C#] In C#, this property is the indexer for the class. + + + + + Gets the with the specified name. + + + + + Adds a to the with the parameter name, the data type, the column length, and the source column name. + + The name of the parameter. + One of the values. + The length of the column. + The name of the source column. + The newly added object. + + + + Adds the specified object to the . + + The to add to the collection. + The newly added object. + + + + Adds a parameter and its value. + + The name of the parameter. + The value of the parameter. + A object representing the provided values. + + + + Adds a to the given the parameter name and the data type. + + The name of the parameter. + One of the values. + The newly added object. + + + + Adds a to the with the parameter name, the data type, and the column length. + + The name of the parameter. + One of the values. + The length of the column. + The newly added object. + + + + Removes all items from the collection. + + + + + Gets the location of the in the collection with a specific parameter name. + + The name of the object to retrieve. + The zero-based location of the in the collection. + + + + Gets the location of a in the collection. + + The object to locate. + The zero-based location of the in the collection. + Gets the location of a in the collection. + + + + This method will update all the items in the index hashes when + we insert a parameter somewhere in the middle + + + + + + + Adds an array of values to the end of the . + + + + + + Retrieve the parameter with the given name. + + + + + + + Adds the specified object to the . + + The to add to the collection. + The index of the new object. + + + + Gets a value indicating whether a with the specified parameter name exists in the collection. + + The name of the object to find. + true if the collection contains the parameter; otherwise, false. + + + + Gets a value indicating whether a MySqlParameter exists in the collection. + + The value of the object to find. + true if the collection contains the object; otherwise, false. + Gets a value indicating whether a exists in the collection. + + + + Copies MySqlParameter objects from the MySqlParameterCollection to the specified array. + + + + + + + Returns an enumerator that iterates through the . + + + + + + Inserts a MySqlParameter into the collection at the specified index. + + + + + + + Removes the specified MySqlParameter from the collection. + + + + + + Removes the specified from the collection using the parameter name. + + The name of the object to retrieve. + + + + Removes the specified from the collection using a specific index. + + The zero-based index of the parameter. + Removes the specified from the collection. + + + + Gets an object that can be used to synchronize access to the + . + + + + + Represents a single(not nested) TransactionScope + + + + + Defines security permissions assigned to a MySQL object. + + + + + Creates a set of permissions. + + A flag indicating if the reflection permission should be included. + A object representing a collection of permissions. + + + + BaseCommandInterceptor is the base class that should be used for all userland + command interceptors + + + + + Gets the active connection. + + + + + Executes an SQL statements that returns a scalar value such as a calculation. + + The SQL statement to execute. + A scalar value that represents the result returned by the execution of the SQL statement. + false. + This method is intended to be overriden. + + + + Executes an SQL statement that returns the number of affected rows. + + The SQL statement to execute. + The number of affected rows. + false. + This method is intended to be overriden. + + + + Executes an SQL statement that will return a resultset. + + The SQL statement to execute. + A value that describes the results of the query and its effect on the database. + A object containing the result of the statement execution. + false. + This method is intended to be overriden. + + + + Sets the active connection. + + The active connection. + + + + CommandInterceptor is the "manager" class that keeps the list of registered interceptors + for the given connection. + + + + + BaseExceptionInterceptor is the base class that should be used for all userland + exception interceptors. + + + + + Returns the received exception. + + The exception to be returned. + The exception originally received. + + + + Gets the active connection. + + + + + Initilizes this object by setting the active connection. + + The connection to become active. + + + + StandardExceptionInterceptor is the standard interceptor that simply returns the exception. + It is the default action. + + + + + Returns the received exception, which is the default action + + The exception to be returned. + The exception originally received. + + + + ExceptionInterceptor is the "manager" class that keeps the list of registered interceptors + for the given connection. + + + + + Interceptor is the base class for the "manager" classes such as ExceptionInterceptor, + CommandInterceptor, etc + + + + + Return schema information about procedures and functions + Restrictions supported are: + schema, name, type + + + + + + + Return schema information about parameters for procedures and functions + Restrictions supported are: + schema, name, type, parameter name + + + + + Initializes a new row for the procedure parameters table. + + + + + Parses out the elements of a procedure parameter data type. + + + + + Implementation of memcached binary client protocol. + + According to http://code.google.com/p/memcached/wiki/BinaryProtocolRevamped + + + + Sends an store command (add, replace, set). + + + + + + + + + + + Sends a get command. + + + + + + + + + Sends a delete command. + + + + + + + + Sends a command without args (like flush). + + + + + + + + Sends a command with amount (INCR/DECR) + + + + + + + + + Encodes in the binary protocol the a command of the kind set, add or replace. + + + + + + + If true applies to set, add or replace commands; if false applies to append and prepend commands. + + + + + An interface of the client memcached protocol. This class is abstract for + implementation of the Memcached client interface see for the + text protocol version and for the binary protocol version. + + + + + The port used by the connection. + + + + + The server DNS or IP address used by the connection. + + + + + The network stream used by the connecition. + + + + + Factory method for creating instances of that implement a connection with the requested features. + The connection object returned must be explicitely opened see method . + + The Memcached server DNS or IP address. + The port for the Memcached server + A set of flags indicating characterestics requested. + An instance of a client connection ready to be used. + + + + Opens the client connection. + + + + + Closes the client connection. + + + + + Adds a new key/value pair with the given TimeSpan expiration. + + The key for identifying the entry. + The data to associate with the key. + The interval of timespan, use TimeSpan.Zero for no expiration. + + + + Appens the data to the existing data for the associated key. + + The key for identifying the entry. + The data to append with the data associated with the key. + + + + Executes the Check-and-set Memcached operation. + + The key for identifying the entry. + The data to use in the CAS. + The interval of timespan, use TimeSpan.Zero for no expiration. + The CAS unique value to use. + + + + + Decrements the value associated with a key by the given amount. + + The key associated with the value to decrement. + The amount to decrement the value. + + + + Removes they pair key/value given the specified key. + + + + + + Removes all entries from the storage, effectively invalidating the whole cache. + + The interval after which the cache will be cleaned. Can be TimeSpan.Zero for immediately. + + + + Get the key/value pair associated with a given key. + + The key for which to returm the key/value. + The key/value associated with the key or a MemcachedException if it does not exists. + + + + Increments the value associated with a key by the given amount. + + The key associated with the value to increment. + The amount to increment the value. + + + + Prepends the data to the existing data for the associated key. + + The key for identifying the entry. + The data to append with the data associated with the key. + + + + Replaces the value associated with the given key with another value. + + The key for identifying the entry. + The data to replace the value associated with the key. + The interval of timespan, use TimeSpan.Zero for no expiration. + + + + Set the value of a given key. + + The key for identifying the entry. + The data to associate with the given key. + The interval of timespan, use TimeSpan.Zero for no expiration. + + + + A set of flags for requesting new instances of connections + + + + + Requests a connection implememting the text protocol. + + + + + Requests a connection implementing the binary protocol. + + + + + Requests a TCP connection. Currently UDP is not supported. + + + + + The base exception class for all Memcached exceptions. + + + + + Implementation of the Memcached text client protocol. + + + + + Sends a command to the memcached server. + + + + + + + This version is for commands that take a key, data, expiration and casUnique. + + + + Sends a command to the memcached server. + + + + + + This version is for commands that take a key, data and expiration + + + + Send a command to memcached server. + + + + + This version is for commands that don't need flags neither expiration fields. + + + + Sends a command to the server. + + + + This version is for commands that only require a key + + + + Sends a command to the server. + + + + + This version is for commands that only require a key and an integer value. + + + + Sends a command to the server. + + + + This version is for commands that only require a key and expiration. + + + + Abstract class that provides common functionality for connection options that apply for all protocols. + + + + + Readonly field containing a collection of protocol shared connection options. + + + + + Gets or sets a flag indicating if the object has access to procedures. + + + + + Gets or sets a dictionary representing key-value pairs for each connection option. + + + + + Gets or sets the name of the server. + + The server. + + + + Gets or sets the name of the database for the initial connection. + + + + + Gets or sets the protocol that should be used for communicating + with MySQL. + + + + + Gets or sets the port number that is used when the socket + protocol is being used. + + + + + Gets or sets a boolean value that indicates whether this connection + should resolve DNS SRV records. + + + + + Gets or sets the user ID that should be used to connect with. + + + + + Gets or sets the password that should be used to make a connection. + + + + + Gets or sets the path to the certificate file to be used. + + + + + Gets or sets the password to be used in conjunction with the certificate file. + + + + + Gets or sets the location to a personal store where a certificate is held. + + + + + Gets or sets a certificate thumbprint to ensure correct identification of a certificate contained within a personal store. + + + + + Indicates whether to use SSL connections and how to handle server certificate errors. + + + + + Sets the TLS versions to use in a SSL connection to the server. + + + Tls version=TLSv1.1,TLSv1.2; + + + + + Gets or sets the path to a local key file in PEM format to use for establishing an encrypted connection. + + + + + Gets or sets the path to a local certificate file in PEM format to use for establishing an encrypted connection. + + + + + Gets or sets the name of the SSH server. + + + + + Gets or sets the port number to use when authenticating to the SSH server. + + + + + Gets or sets the user name to authenticate to the SSH server. + + + + + Gets or sets the password to authenticate to the SSH server. + + + + + Gets or sets the SSH key file to authenticate to the SSH server. + + + + + Gets or sets the passphrase of the key file to authenticate to the SSH server. + + + + + Gets or sets the idle connection time(seconds) for TCP connections. + + + + + Gets or sets the character set that should be used for sending queries to the server. + + + + + Analyzes the connection string for potential duplicated or invalid connection options. + + Connection string. + Flag that indicates if the connection is using X Protocol. + Flag that indicates if the default port is used. + + + + Represents a set of methods for creating instances of the MySQL client implementation of the data source classes. + + + + + Gets an instance of the . + This can be used to retrieve strongly typed data objects. + + + + + Returns a strongly typed instance. + + A new strongly typed instance of DbCommand. + + + + Returns a strongly typed instance. + + A new strongly typed instance of DbConnection. + + + + Returns a strongly typed instance. + + A new strongly typed instance of DbParameter. + + + + Returns a strongly typed instance. + + A new strongly typed instance of DbConnectionStringBuilder. + + + + Returns a strongly typed instance. + + A new strongly typed instance of DbCommandBuilder. + + + + Returns a strongly typed instance. + + A new strongly typed instance of DbDataAdapter. + + + + Provide a simple caching layer + + + + + Aids in the creation of connection strings by exposing the connection options as properties. + Contains connection options specific to the Classic protocol. + + + + + Main constructor. + + + + + Constructor accepting a connection string. + + The connection string. + + + + Readonly field containing a collection of classic protocol and protocol shared connection options. + + + + + Gets or sets the name of the named pipe that should be used + for communicating with MySQL. + + + + + Gets or sets a boolean value that indicates whether this connection + should use compression. + + + + + Gets or sets a boolean value that indicates whether this connection will allow + commands to send multiple SQL statements in one execution. + + + + + Gets or sets a boolean value that indicates whether logging is enabled. + + + + + Gets or sets the base name of the shared memory objects used to + communicate with MySQL when the shared memory protocol is being used. + + + + + Gets or sets the default command timeout. + + + + + Gets or sets the connection timeout. + + + + + Gets or sets a boolean value that indicates whether this connection will allow + to load data local infile. + + + + + Gets or sets a boolean value that indicates if the password should be persisted + in the connection string. + + + + + Gets or sets a boolean value that indicates if the connection should be encrypted. + + Obsolte. Use instead. + + + + Gets or sets a boolean value that indicates if RSA public keys should be retrieved from the server. + + This option is only relevant when SSL is disabled. Setting this option to true in + 8.0 servers that have the caching_sha2_password authentication plugin as the default plugin will + cause the connection attempt to fail if the user hasn't successfully connected to the server on a + previous occasion. + + + + Gets or sets a boolean value that indicates if zero date time values are supported. + + Default value is false. + + + + Gets or sets a boolean value that indicates if zero datetime values should be + converted to DateTime.MinValue. + + Default value is false. + + + + Gets or sets a boolean value that indicates if the Usage Advisor should be enabled. + + Default value is false. + + + + Gets or sets the size of the stored procedure cache. + + Default value is 25. + + + + Gets or sets a boolean value that indicates if the performance monitor hooks should be enabled. + + Default value is false. + + + + Gets or sets a boolean value that indicates if calls to the Prepare method should be ignored. + + Default value is false. + + + + Gets or sets a boolean value that indicates if an opened connection should particiapte in the current scope. + + Default value is true. + + + + Gets or sets a boolean value that indicates if security asserts must be included. + + Must be set to true when using the class in a partial trust environment, + with the library installed in the GAC of the hosting environment. Not supported in .NET Core. + Default value is false. + + + + Gets or sets a boolean value that indicates if column binary flags set by the server are ignored. + + Default value is true. + + + + Gets or sets a boolean value that indicates if TINYINT(1) shound be treated as a BOOLEAN. + + Default value is true. + + + + Gets or sets a boolean value that indicates if the provider expects user variables in the SQL. + + Default value is false. + + + + Gets or sets a boolean value that indicates if the session should be interactive. + + Default value is false. + + + + Gets or sets a boolean value that indicates if server functions should be treated as returning a string. + + Default value is false. + + + + Gets or sets a boolean value that indicates if the server should report affected rows instead of found rows. + + Default value is false. + + + + Gets or sets a boolean value that indicates if items of data type BINARY(16) should be treated as guids. + + Default value is false. + + + + Gets or sets a boolean value that indicates if SQL Server syntax should be allowed by supporting square brackets + around symbols instead of backticks. + + Default value is false. + + + + Gets or sets a boolean value that indicates if caching of TableDirect commands is enabled. + + Default value is false. + + + + Gets or sets the seconds for how long a TableDirect result should be cached. + + Default value is 0. + + + + Gets or sets a boolean value that indicates if stored routine parameters should be checked against the server. + + Default value is true. + + + + Gets or sets a boolean value that indicates if this connection will use replication. + + Default value is false. + + + + Gets or sets the list of interceptors that can triage thrown MySqlExceptions. + + + + + Gets or sets the list of interceptors that can intercept command operations. + + + + + Gets or sets the lifetime of a pooled connection. + + Default value is 0. + + + + Gets or sets a boolean value indicating if connection pooling is enabled. + + Default value is true. + + + + Gets the minimum connection pool size. + + Default value is 0. + + + + Gets or sets the maximum connection pool setting. + + Default value is 100. + + + + Gets or sets a boolean value that indicates if the connection should be reset when retrieved + from the pool. + + Default value is false. + + + + Gets or sets a boolean value that indicates whether the server variable settings are updated by a + SHOW VARIABLES command each time a pooled connection is returned. + + Default value is false. + + + + Indicates whether the driver should treat binary BLOBs as UTF8. + + Default value is false. + + + + Gets or sets the pattern to match for the columns that should be treated as UTF8. + + + + + Gets or sets the pattern to match for the columns that should not be treated as UTF8. + + + + + Gets or sets a connection option. + + The keyword that identifies the connection option to modify. + + + + Summary description for ClientParam. + + + + + DB Operations Code + + + + + Specifies MySQL specific data type of a field, property, for use in a . + + + + + + A fixed precision and scale numeric value between -1038 + -1 and 10 38 -1. + + + + + The signed range is -128 to 127. The unsigned + range is 0 to 255. + + + + + A 16-bit signed integer. The signed range is + -32768 to 32767. The unsigned range is 0 to 65535 + + + + + Specifies a 24 (3 byte) signed or unsigned value. + + + + + A 32-bit signed integer + + + + + A 64-bit signed integer. + + + + + A small (single-precision) floating-point + number. Allowable values are -3.402823466E+38 to -1.175494351E-38, + 0, and 1.175494351E-38 to 3.402823466E+38. + + + + + A normal-size (double-precision) + floating-point number. Allowable values are -1.7976931348623157E+308 + to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to + 1.7976931348623157E+308. + + + + + A timestamp. The range is '1970-01-01 00:00:00' to sometime in the + year 2037 + + + + + Date The supported range is '1000-01-01' to '9999-12-31'. + + + + + Time The range is '-838:59:59' to '838:59:59'. + + + + + DateTime The supported range is '1000-01-01 00:00:00' to + '9999-12-31 23:59:59'. + + + + + Datetime The supported range is '1000-01-01 00:00:00' to + '9999-12-31 23:59:59'. + + + + + A year in 2- or 4-digit format (default is 4-digit). The + allowable values are 1901 to 2155, 0000 in the 4-digit year + format, and 1970-2069 if you use the 2-digit format (70-69). + + + + + Obsolete Use Datetime or Date type + + + + + A variable-length string containing 0 to 65535 characters + + + + + Bit-field data type + + + + + JSON + + + + + New Decimal + + + + + An enumeration. A string object that can have only one value, + chosen from the list of values 'value1', 'value2', ..., NULL + or the special "" error value. An ENUM can have a maximum of + 65535 distinct values + + + + + A set. A string object that can have zero or more values, each + of which must be chosen from the list of values 'value1', 'value2', + ... A SET can have a maximum of 64 members. + + + + + A binary column with a maximum length of 255 (2^8 - 1) + characters + + + + + A binary column with a maximum length of 16777215 (2^24 - 1) bytes. + + + + + A binary column with a maximum length of 4294967295 or + 4G (2^32 - 1) bytes. + + + + + A binary column with a maximum length of 65535 (2^16 - 1) bytes. + + + + + A variable-length string containing 0 to 255 bytes. + + + + + A fixed-length string. + + + + + Geometric (GIS) data type. + + + + + Unsigned 8-bit value. + + + + + Unsigned 16-bit value. + + + + + Unsigned 24-bit value. + + + + + Unsigned 32-bit value. + + + + + Unsigned 64-bit value. + + + + + Fixed length binary string. + + + + + Variable length binary string. + + + + + A text column with a maximum length of 255 (2^8 - 1) characters. + + + + + A text column with a maximum length of 16777215 (2^24 - 1) characters. + + + + + A text column with a maximum length of 4294967295 or + 4G (2^32 - 1) characters. + + + + + A text column with a maximum length of 65535 (2^16 - 1) characters. + + + + + A guid column. + + + + + Allows the user to specify the type of connection that should + be used. + + + + + TCP/IP style connection. Works everywhere. + + + + + TCP/IP style connection. Works everywhere. + + + + + TCP/IP style connection. Works everywhere. + + + + + Named pipe connection. Works only on Windows systems. + + + + + Named pipe connection. Works only on Windows systems. + + + + + Unix domain socket connection. Works only with Unix systems. + + + + + Unix domain socket connection. Works only with Unix systems. + + + + + Shared memory connection. Currently works only with Windows systems. + + + + + Shared memory connection. Currently works only with Windows systems. + + + + + SSL options for connection. + + + + + Do not use SSL. + + + + + Use SSL, if server supports it. This option is only available for the classic protocol. + + + + + Always use SSL. Deny connection if server does not support SSL. + Do not perform server certificate validation. + This is the default SSL mode when the same isn't specified as part of the connection string. + + + + + Always use SSL. Validate server SSL certificate, but different host name mismatch. + + + + + Always use SSL and perform full certificate validation. + + + + + Specifies the connection types supported + + + + + Use TCP/IP sockets. + + + + + Use client library. + + + + + Use MySQL embedded server. + + + + + Defines the location of the certificate store. + + + + + Do not use certificate store. + + + + + Use certificate store for the current user. + + + + + User certificate store for the machine. + + + + + Specifies the authentication mechanism that should be used. + + + + + If SSL is enabled or Unix sockets are being used, sets PLAIN as the authentication mechanism; + otherwise, it tries to use MYSQL41 and then SHA256_MEMORY. + + + + + Authenticate using PLAIN. + + + + + Authenticate using MYSQL41. + + + + + Authenticate using EXTERNAL. + + + + + Authenticate using SHA256_MEMORY. + + + + + Defines waiting options that may be used with row locking options. + + + + + Waits until the blocking transaction releases the row lock. + + + + + Never waits to acquire a row lock. The query executes immediately, + failing with an error if a requested row is locked. + + + + + Never waits to acquire a row lock. The query executes immediately, + removing locked rows from the result set. + + + + + Defines the type of compression used when data is exchanged between client and server. + + + + + Uses compression if client and server are able to reach a concensus. Otherwise, compression + is not used. + + + + + Enforces the use of compression. If no concensus is reached, an error is raised. + + + + + Disables compression. + + + + + Collection of error codes that can be returned by the server + + + + + + + + + + + Error level + + + + + Error code + + + + + Error message + + + + + Provides a reference to error codes returned by MySQL. + + + + + ER_HASHCHK + + + + ER_NISAMCHK + + + + ER_NO + + + + ER_YES + + + The file couldn't be created. + ER_CANT_CREATE_FILE + + + The table couldn't be created. + ER_CANT_CREATE_TABLE + + + The database couldn't be created. + ER_CANT_CREATE_DB + + + The database couldn't be created, it already exists. + ER_DB_CREATE_EXISTS + + + The database couldn't be dropped, it doesn't exist. + ER_DB_DROP_EXISTS + + + The database couldn't be dropped, the file can't be deleted. + ER_DB_DROP_DELETE + + + The database couldn't be dropped, the directory can't be deleted. + ER_DB_DROP_RMDIR + + + The file couldn't be deleted. + ER_CANT_DELETE_FILE + + + The record couldn't be read from the system table. + ER_CANT_FIND_SYSTEM_REC + + + The status couldn't be retrieved. + ER_CANT_GET_STAT + + + The working directory couldn't be retrieved. + ER_CANT_GET_WD + + + The file couldn't be locked. + ER_CANT_LOCK + + + The file couldn't be opened. + ER_CANT_OPEN_FILE + + + The file couldn't be found. + ER_FILE_NOT_FOUND + + + The directory couldn't be read. + ER_CANT_READ_DIR + + + The working directory couldn't be entered. + ER_CANT_SET_WD + + + The record changed since it was last read. + ER_CHECKREAD + + + The disk is full. + ER_DISK_FULL + + + + There is already a key with the given values. + + + + An error occurred when closing the file. + ER_ERROR_ON_CLOSE + + + An error occurred when reading from the file. + ER_ERROR_ON_READ + + + An error occurred when renaming then file. + ER_ERROR_ON_RENAME + + + An error occurred when writing to the file. + ER_ERROR_ON_WRITE + + + The file is in use. + ER_FILE_USED + + + Sorting has been aborted. + ER_FILSORT_ABORT + + + The view doesn't exist. + ER_FORM_NOT_FOUND + + + Got the specified error from the table storage engine. + ER_GET_ERRNO + + + The table storage engine doesn't support the specified option. + ER_ILLEGAL_HA + + + + The specified key was not found. + + + + The file contains incorrect information. + ER_NOT_FORM_FILE + + + The key file is incorrect for the table, it should be repaired. + ER_NOT_KEYFILE + + + The key file is old for the table, it should be repaired. + ER_OLD_KEYFILE + + + The table is read-only + ER_OPEN_AS_READONLY + + + The server is out of memory, it should be restarted. + ER_OUTOFMEMORY + + + The server is out of sort-memory, the sort buffer size should be increased. + ER_OUT_OF_SORTMEMORY + + + An unexpected EOF was found when reading from the file. + ER_UNEXPECTED_EOF + + + Too many connections are open. + ER_CON_COUNT_ERROR + + + The server is out of resources, check if MySql or some other process is using all available memory. + ER_OUT_OF_RESOURCES + + + + Given when the connection is unable to successfully connect to host. + + + + The handshake was invalid. + ER_HANDSHAKE_ERROR + + + Access was denied for the specified user using the specified database. + ER_DBACCESS_DENIED_ERROR + + + + Normally returned when an incorrect password is given + + + + No database has been selected. + ER_NO_DB_ERROR + + + The command is unknown. + ER_UNKNOWN_COM_ERROR + + + The specified column cannot be NULL. + ER_BAD_NULL_ERROR + + + The specified database is not known. + + + The specified table already exists. + ER_TABLE_EXISTS_ERROR + + + The specified table is unknown. + ER_BAD_TABLE_ERROR + + + The specified column is ambiguous. + ER_NON_UNIQ_ERROR + + + The server is currently being shutdown. + ER_SERVER_SHUTDOWN + + + The specified columns is unknown. + ER_BAD_FIELD_ERROR + + + The specified column isn't in GROUP BY. + ER_WRONG_FIELD_WITH_GROUP + + + The specified columns cannot be grouped on. + ER_WRONG_GROUP_FIELD + + + There are sum functions and columns in the same statement. + ER_WRONG_SUM_SELECT + + + The column count doesn't match the value count. + ER_WRONG_VALUE_COUNT + + + The identifier name is too long. + ER_TOO_LONG_IDENT + + + The column name is duplicated. + ER_DUP_FIELDNAME + + + + Duplicate Key Name + + + + + Duplicate Key Entry + + + + The column specifier is incorrect. + ER_WRONG_FIELD_SPEC + + + An error occurred when parsing the statement. + ER_PARSE_ERROR + + + The statement is empty. + ER_EMPTY_QUERY + + + The table alias isn't unique. + ER_NONUNIQ_TABLE + + + The default value is invalid for the specified field. + ER_INVALID_DEFAULT + + + The table has multiple primary keys defined. + ER_MULTIPLE_PRI_KEY + + + Too many keys were defined for the table. + ER_TOO_MANY_KEYS + + + Too many parts to the keys were defined for the table. + ER_TOO_MANY_KEY_PARTS + + + The specified key is too long + ER_TOO_LONG_KEY + + + The specified key column doesn't exist in the table. + ER_KEY_COLUMN_DOES_NOT_EXITS + + + The BLOB column was used as a key, this can't be done. + ER_BLOB_USED_AS_KEY + + + The column length is too big for the specified column type. + ER_TOO_BIG_FIELDLENGTH + + + There can only be one auto-column, and it must be defined as a PK. + ER_WRONG_AUTO_KEY + + + The server is ready to accept connections. + ER_READY + + + + ER_NORMAL_SHUTDOWN + + + The server received the specified signal and is aborting. + ER_GOT_SIGNAL + + + The server shutdown is complete. + ER_SHUTDOWN_COMPLETE + + + The server is forcing close of the specified thread. + ER_FORCING_CLOSE + + + An error occurred when creating the IP socket. + ER_IPSOCK_ERROR + + + The table has no index like the one used in CREATE INDEX. + ER_NO_SUCH_INDEX + + + The field separator argument is not what is expected, check the manual. + ER_WRONG_FIELD_TERMINATORS + + + The BLOB columns must terminated, fixed row lengths cannot be used. + ER_BLOBS_AND_NO_TERMINATED + + + The text file cannot be read. + ER_TEXTFILE_NOT_READABLE + + + The specified file already exists. + ER_FILE_EXISTS_ERROR + + + Information returned by the LOAD statement. + ER_LOAD_INFO + + + Information returned by an UPDATE statement. + ER_ALTER_INFO + + + The prefix key is incorrect. + ER_WRONG_SUB_KEY + + + All columns cannot be removed from a table, use DROP TABLE instead. + ER_CANT_REMOVE_ALL_FIELDS + + + Cannot DROP, check that the column or key exists. + ER_CANT_DROP_FIELD_OR_KEY + + + Information returned by an INSERT statement. + ER_INSERT_INFO + + + The target table cannot be specified for update in FROM clause. + ER_UPDATE_TABLE_USED + + + The specified thread ID is unknown. + ER_NO_SUCH_THREAD + + + The thread cannot be killed, the current user is not the owner. + ER_KILL_DENIED_ERROR + + + No tables used in the statement. + ER_NO_TABLES_USED + + + Too many string have been used for the specified column and SET. + ER_TOO_BIG_SET + + + A unique filename couldn't be generated. + ER_NO_UNIQUE_LOGFILE + + + The specified table was locked with a READ lock, and can't be updated. + ER_TABLE_NOT_LOCKED_FOR_WRITE + + + The specified table was not locked with LOCK TABLES. + ER_TABLE_NOT_LOCKED + + + BLOB and Text columns cannot have a default value. + ER_BLOB_CANT_HAVE_DEFAULT + + + The specified database name is incorrect. + ER_WRONG_DB_NAME + + + The specified table name is incorrect. + ER_WRONG_TABLE_NAME + + + The SELECT command would examine more than MAX_JOIN_SIZE rows, check the WHERE clause and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is ok. + ER_TOO_BIG_SELECT + + + An unknown error occurred. + ER_UNKNOWN_ERROR + + + The specified procedure is unknown. + ER_UNKNOWN_PROCEDURE + + + The number of parameters provided for the specified procedure is incorrect. + ER_WRONG_PARAMCOUNT_TO_PROCEDURE + + + The parameters provided for the specified procedure are incorrect. + ER_WRONG_PARAMETERS_TO_PROCEDURE + + + The specified table is unknown. + ER_UNKNOWN_TABLE + + + The specified column has been specified twice. + ER_FIELD_SPECIFIED_TWICE + + + The group function has been incorrectly used. + ER_INVALID_GROUP_FUNC_USE + + + The specified table uses an extension that doesn't exist in this MySQL version. + ER_UNSUPPORTED_EXTENSION + + + The table must have at least one column. + ER_TABLE_MUST_HAVE_COLUMNS + + + The specified table is full. + ER_RECORD_FILE_FULL + + + The specified character set is unknown. + ER_UNKNOWN_CHARACTER_SET + + + Too many tables, MySQL can only use the specified number of tables in a JOIN. + ER_TOO_MANY_TABLES + + + Too many columns + ER_TOO_MANY_FIELDS + + + The row size is too large, the maximum row size for the used tables (not counting BLOBS) is specified, change some columns or BLOBS. + ER_TOO_BIG_ROWSIZE + + + A thread stack overrun occurred. Stack statistics are specified. + ER_STACK_OVERRUN + + + A cross dependency was found in the OUTER JOIN, examine the ON conditions. + ER_WRONG_OUTER_JOIN + + + The table handler doesn't support NULL in the given index, change specified column to be NOT NULL or use another handler. + ER_NULL_COLUMN_IN_INDEX + + + The specified user defined function cannot be loaded. + ER_CANT_FIND_UDF + + + The specified user defined function cannot be initialised. + ER_CANT_INITIALIZE_UDF + + + No paths are allowed for the shared library. + ER_UDF_NO_PATHS + + + The specified user defined function already exists. + ER_UDF_EXISTS + + + The specified shared library cannot be opened. + ER_CANT_OPEN_LIBRARY + + + The specified symbol cannot be found in the library. + ER_CANT_FIND_DL_ENTRY + + + The specified function is not defined. + ER_FUNCTION_NOT_DEFINED + + + The specified host is blocked because of too many connection errors, unblock with 'mysqladmin flush-hosts'. + ER_HOST_IS_BLOCKED + + + + The given host is not allowed to connect + + + + + The anonymous user is not allowed to connect + + + + + The given password is not allowed + + + + + The given password does not match + + + + Information returned by an UPDATE statement. + ER_UPDATE_INFO + + + A new thread couldn't be created. + ER_CANT_CREATE_THREAD + + + The column count doesn't match the value count. + ER_WRONG_VALUE_COUNT_ON_ROW + + + The specified table can't be re-opened. + ER_CANT_REOPEN_TABLE + + + The NULL value has been used incorrectly. + ER_INVALID_USE_OF_NULL + + + The regular expression contains an error. + ER_REGEXP_ERROR + + + GROUP columns (MIN(), MAX(), COUNT(), ...) cannot be mixes with no GROUP columns if there is not GROUP BY clause. + ER_MIX_OF_GROUP_FUNC_AND_FIELDS + + + + ER_NONEXISTING_GRANT + + + + ER_TABLEACCESS_DENIED_ERROR + + + + ER_COLUMNACCESS_DENIED_ERROR + + + + ER_ILLEGAL_GRANT_FOR_TABLE + + + + ER_GRANT_WRONG_HOST_OR_USER + + + + ER_NO_SUCH_TABLE + + + + ER_NONEXISTING_TABLE_GRANT + + + + ER_NOT_ALLOWED_COMMAND + + + + ER_SYNTAX_ERROR + + + + ER_DELAYED_CANT_CHANGE_LOCK + + + + ER_TOO_MANY_DELAYED_THREADS + + + + ER_ABORTING_CONNECTION + + + + An attempt was made to send or receive a packet larger than + max_allowed_packet_size + + + + + ER_NET_READ_ERROR_FROM_PIPE + + + + ER_NET_FCNTL_ERROR + + + + ER_NET_PACKETS_OUT_OF_ORDER + + + + ER_NET_UNCOMPRESS_ERROR + + + + ER_NET_READ_ERROR + + + + ER_NET_READ_INTERRUPTED + + + + ER_NET_ERROR_ON_WRITE + + + + ER_NET_WRITE_INTERRUPTED + + + + ER_TOO_LONG_STRING + + + + ER_TABLE_CANT_HANDLE_BLOB + + + + ER_TABLE_CANT_HANDLE_AUTO_INCREMENT + + + + ER_DELAYED_INSERT_TABLE_LOCKED + + + + ER_WRONG_COLUMN_NAME + + + + ER_WRONG_KEY_COLUMN + + + + ER_WRONG_MRG_TABLE + + + + ER_DUP_UNIQUE + + + + ER_BLOB_KEY_WITHOUT_LENGTH + + + + ER_PRIMARY_CANT_HAVE_NULL + + + + ER_TOO_MANY_ROWS + + + + ER_REQUIRES_PRIMARY_KEY + + + + ER_NO_RAID_COMPILED + + + + ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE + + + + ER_KEY_DOES_NOT_EXITS + + + + ER_CHECK_NO_SUCH_TABLE + + + + ER_CHECK_NOT_IMPLEMENTED + + + + ER_CANT_DO_THIS_DURING_AN_TRANSACTION + + + + ER_ERROR_DURING_COMMIT + + + + ER_ERROR_DURING_ROLLBACK + + + + ER_ERROR_DURING_FLUSH_LOGS + + + + ER_ERROR_DURING_CHECKPOINT + + + + ER_NEW_ABORTING_CONNECTION + + + + ER_DUMP_NOT_IMPLEMENTED + + + + ER_FLUSH_MASTER_BINLOG_CLOSED + + + + ER_INDEX_REBUILD + + + + ER_MASTER + + + + ER_MASTER_NET_READ + + + + ER_MASTER_NET_WRITE + + + + ER_FT_MATCHING_KEY_NOT_FOUND + + + + ER_LOCK_OR_ACTIVE_TRANSACTION + + + + ER_UNKNOWN_SYSTEM_VARIABLE + + + + ER_CRASHED_ON_USAGE + + + + ER_CRASHED_ON_REPAIR + + + + ER_WARNING_NOT_COMPLETE_ROLLBACK + + + + ER_TRANS_CACHE_FULL + + + + ER_SLAVE_MUST_STOP + + + + ER_SLAVE_NOT_RUNNING + + + + ER_BAD_SLAVE + + + + ER_MASTER_INFO + + + + ER_SLAVE_THREAD + + + + ER_TOO_MANY_USER_CONNECTIONS + + + + ER_SET_CONSTANTS_ONLY + + + + ER_LOCK_WAIT_TIMEOUT + + + + ER_LOCK_TABLE_FULL + + + + ER_READ_ONLY_TRANSACTION + + + + ER_DROP_DB_WITH_READ_LOCK + + + + ER_CREATE_DB_WITH_READ_LOCK + + + + ER_WRONG_ARGUMENTS + + + + ER_NO_PERMISSION_TO_CREATE_USER + + + + ER_UNION_TABLES_IN_DIFFERENT_DIR + + + + ER_LOCK_DEADLOCK + + + + ER_TABLE_CANT_HANDLE_FT + + + + ER_CANNOT_ADD_FOREIGN + + + + ER_NO_REFERENCED_ROW + + + + ER_ROW_IS_REFERENCED + + + + ER_CONNECT_TO_MASTER + + + + ER_QUERY_ON_MASTER + + + + ER_ERROR_WHEN_EXECUTING_COMMAND + + + + ER_WRONG_USAGE + + + + ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT + + + + ER_CANT_UPDATE_WITH_READLOCK + + + + ER_MIXING_NOT_ALLOWED + + + + ER_DUP_ARGUMENT + + + + ER_USER_LIMIT_REACHED + + + + ER_SPECIFIC_ACCESS_DENIED_ERROR + + + + ER_LOCAL_VARIABLE + + + + ER_GLOBAL_VARIABLE + + + + ER_NO_DEFAULT + + + + ER_WRONG_VALUE_FOR_VAR + + + + ER_WRONG_TYPE_FOR_VAR + + + + ER_VAR_CANT_BE_READ + + + + ER_CANT_USE_OPTION_HERE + + + + ER_NOT_SUPPORTED_YET + + + + ER_MASTER_FATAL_ERROR_READING_BINLOG + + + + ER_SLAVE_IGNORED_TABLE + + + + ER_INCORRECT_GLOBAL_LOCAL_VAR + + + + ER_WRONG_FK_DEF + + + + ER_KEY_REF_DO_NOT_MATCH_TABLE_REF + + + + ER_OPERAND_COLUMNS + + + + ER_SUBQUERY_NO_1_ROW + + + + ER_UNKNOWN_STMT_HANDLER + + + + ER_CORRUPT_HELP_DB + + + + ER_CYCLIC_REFERENCE + + + + ER_AUTO_CONVERT + + + + ER_ILLEGAL_REFERENCE + + + + ER_DERIVED_MUST_HAVE_ALIAS + + + + ER_SELECT_REDUCED + + + + ER_TABLENAME_NOT_ALLOWED_HERE + + + + ER_NOT_SUPPORTED_AUTH_MODE + + + + ER_SPATIAL_CANT_HAVE_NULL + + + + ER_COLLATION_CHARSET_MISMATCH + + + + ER_SLAVE_WAS_RUNNING + + + + ER_SLAVE_WAS_NOT_RUNNING + + + + ER_TOO_BIG_FOR_UNCOMPRESS + + + + ER_ZLIB_Z_MEM_ERROR + + + + ER_ZLIB_Z_BUF_ERROR + + + + ER_ZLIB_Z_DATA_ERROR + + + + ER_CUT_VALUE_GROUP_CONCAT + + + + ER_WARN_TOO_FEW_RECORDS + + + + ER_WARN_TOO_MANY_RECORDS + + + + ER_WARN_NULL_TO_NOTNULL + + + + ER_WARN_DATA_OUT_OF_RANGE + + + + WARN_DATA_TRUNCATED + + + + ER_WARN_USING_OTHER_HANDLER + + + + ER_CANT_AGGREGATE_2COLLATIONS + + + + ER_DROP_USER + + + + ER_REVOKE_GRANTS + + + + ER_CANT_AGGREGATE_3COLLATIONS + + + + ER_CANT_AGGREGATE_NCOLLATIONS + + + + ER_VARIABLE_IS_NOT_STRUCT + + + + ER_UNKNOWN_COLLATION + + + + ER_SLAVE_IGNORED_SSL_PARAMS + + + + ER_SERVER_IS_IN_SECURE_AUTH_MODE + + + + ER_WARN_FIELD_RESOLVED + + + + ER_BAD_SLAVE_UNTIL_COND + + + + ER_MISSING_SKIP_SLAVE + + + + ER_UNTIL_COND_IGNORED + + + + ER_WRONG_NAME_FOR_INDEX + + + + ER_WRONG_NAME_FOR_CATALOG + + + + ER_WARN_QC_RESIZE + + + + ER_BAD_FT_COLUMN + + + + ER_UNKNOWN_KEY_CACHE + + + + ER_WARN_HOSTNAME_WONT_WORK + + + + ER_UNKNOWN_STORAGE_ENGINE + + + + ER_WARN_DEPRECATED_SYNTAX + + + + ER_NON_UPDATABLE_TABLE + + + + ER_FEATURE_DISABLED + + + + ER_OPTION_PREVENTS_STATEMENT + + + + ER_DUPLICATED_VALUE_IN_TYPE + + + + ER_TRUNCATED_WRONG_VALUE + + + + ER_TOO_MUCH_AUTO_TIMESTAMP_COLS + + + + ER_INVALID_ON_UPDATE + + + + ER_UNSUPPORTED_PS + + + + ER_GET_ERRMSG + + + + ER_GET_TEMPORARY_ERRMSG + + + + ER_UNKNOWN_TIME_ZONE + + + + ER_WARN_INVALID_TIMESTAMP + + + + ER_INVALID_CHARACTER_STRING + + + + ER_WARN_ALLOWED_PACKET_OVERFLOWED + + + + ER_CONFLICTING_DECLARATIONS + + + + ER_SP_NO_RECURSIVE_CREATE + + + + ER_SP_ALREADY_EXISTS + + + + ER_SP_DOES_NOT_EXIST + + + + ER_SP_DROP_FAILED + + + + ER_SP_STORE_FAILED + + + + ER_SP_LILABEL_MISMATCH + + + + ER_SP_LABEL_REDEFINE + + + + ER_SP_LABEL_MISMATCH + + + + ER_SP_UNINIT_VAR + + + + ER_SP_BADSELECT + + + + ER_SP_BADRETURN + + + + ER_SP_BADSTATEMENT + + + + ER_UPDATE_LOG_DEPRECATED_IGNORED + + + + ER_UPDATE_LOG_DEPRECATED_TRANSLATED + + + + ER_QUERY_INTERRUPTED + + + + ER_SP_WRONG_NO_OF_ARGS + + + + ER_SP_COND_MISMATCH + + + + ER_SP_NORETURN + + + + ER_SP_NORETURNEND + + + + ER_SP_BAD_CURSOR_QUERY + + + + ER_SP_BAD_CURSOR_SELECT + + + + ER_SP_CURSOR_MISMATCH + + + + ER_SP_CURSOR_ALREADY_OPEN + + + + ER_SP_CURSOR_NOT_OPEN + + + + ER_SP_UNDECLARED_VAR + + + + ER_SP_WRONG_NO_OF_FETCH_ARGS + + + + ER_SP_FETCH_NO_DATA + + + + ER_SP_DUP_PARAM + + + + ER_SP_DUP_VAR + + + + ER_SP_DUP_COND + + + + ER_SP_DUP_CURS + + + + ER_SP_CANT_ALTER + + + + ER_SP_SUBSELECT_NYI + + + + ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG + + + + ER_SP_VARCOND_AFTER_CURSHNDLR + + + + ER_SP_CURSOR_AFTER_HANDLER + + + + ER_SP_CASE_NOT_FOUND + + + + ER_FPARSER_TOO_BIG_FILE + + + + ER_FPARSER_BAD_HEADER + + + + ER_FPARSER_EOF_IN_COMMENT + + + + ER_FPARSER_ERROR_IN_PARAMETER + + + + ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER + + + + ER_VIEW_NO_EXPLAIN + + + + ER_FRM_UNKNOWN_TYPE + + + + ER_WRONG_OBJECT + + + + ER_NONUPDATEABLE_COLUMN + + + + ER_VIEW_SELECT_DERIVED + + + + ER_VIEW_SELECT_CLAUSE + + + + ER_VIEW_SELECT_VARIABLE + + + + ER_VIEW_SELECT_TMPTABLE + + + + ER_VIEW_WRONG_LIST + + + + ER_WARN_VIEW_MERGE + + + + ER_WARN_VIEW_WITHOUT_KEY + + + + ER_VIEW_INVALID + + + + ER_SP_NO_DROP_SP + + + + ER_SP_GOTO_IN_HNDLR + + + + ER_TRG_ALREADY_EXISTS + + + + ER_TRG_DOES_NOT_EXIST + + + + ER_TRG_ON_VIEW_OR_TEMP_TABLE + + + + ER_TRG_CANT_CHANGE_ROW + + + + ER_TRG_NO_SUCH_ROW_IN_TRG + + + + ER_NO_DEFAULT_FOR_FIELD + + + + ER_DIVISION_BY_ZERO + + + + ER_TRUNCATED_WRONG_VALUE_FOR_FIELD + + + + ER_ILLEGAL_VALUE_FOR_TYPE + + + + ER_VIEW_NONUPD_CHECK + + + + ER_VIEW_CHECK_FAILED + + + + ER_PROCACCESS_DENIED_ERROR + + + + ER_RELAY_LOG_FAIL + + + + ER_PASSWD_LENGTH + + + + ER_UNKNOWN_TARGET_BINLOG + + + + ER_IO_ERR_LOG_INDEX_READ + + + + ER_BINLOG_PURGE_PROHIBITED + + + + ER_FSEEK_FAIL + + + + ER_BINLOG_PURGE_FATAL_ERR + + + + ER_LOG_IN_USE + + + + ER_LOG_PURGE_UNKNOWN_ERR + + + + ER_RELAY_LOG_INIT + + + + ER_NO_BINARY_LOGGING + + + + ER_RESERVED_SYNTAX + + + + ER_WSAS_FAILED + + + + ER_DIFF_GROUPS_PROC + + + + ER_NO_GROUP_FOR_PROC + + + + ER_ORDER_WITH_PROC + + + + ER_LOGGING_PROHIBIT_CHANGING_OF + + + + ER_NO_FILE_MAPPING + + + + ER_WRONG_MAGIC + + + + ER_PS_MANY_PARAM + + + + ER_KEY_PART_0 + + + + ER_VIEW_CHECKSUM + + + + ER_VIEW_MULTIUPDATE + + + + ER_VIEW_NO_INSERT_FIELD_LIST + + + + ER_VIEW_DELETE_MERGE_VIEW + + + + ER_CANNOT_USER + + + + ER_XAER_NOTA + + + + ER_XAER_INVAL + + + + ER_XAER_RMFAIL + + + + ER_XAER_OUTSIDE + + + + ER_XAER_RMERR + + + + ER_XA_RBROLLBACK + + + + ER_NONEXISTING_PROC_GRANT + + + + ER_PROC_AUTO_GRANT_FAIL + + + + ER_PROC_AUTO_REVOKE_FAIL + + + + ER_DATA_TOO_LONG + + + + ER_SP_BAD_SQLSTATE + + + + ER_STARTUP + + + + ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR + + + + ER_CANT_CREATE_USER_WITH_GRANT + + + + ER_WRONG_VALUE_FOR_TYPE + + + + ER_TABLE_DEF_CHANGED + + + + ER_SP_DUP_HANDLER + + + + ER_SP_NOT_VAR_ARG + + + + ER_SP_NO_RETSET + + + + ER_CANT_CREATE_GEOMETRY_OBJECT + + + + ER_FAILED_ROUTINE_BREAK_BINLOG + + + + ER_BINLOG_UNSAFE_ROUTINE + + + + ER_BINLOG_CREATE_ROUTINE_NEED_SUPER + + + + ER_EXEC_STMT_WITH_OPEN_CURSOR + + + + ER_STMT_HAS_NO_OPEN_CURSOR + + + + ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG + + + + ER_NO_DEFAULT_FOR_VIEW_FIELD + + + + ER_SP_NO_RECURSION + + + + ER_TOO_BIG_SCALE + + + + ER_TOO_BIG_PRECISION + + + + ER_M_BIGGER_THAN_D + + + + ER_WRONG_LOCK_OF_SYSTEM_TABLE + + + + ER_CONNECT_TO_FOREIGN_DATA_SOURCE + + + + ER_QUERY_ON_FOREIGN_DATA_SOURCE + + + + ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST + + + + ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE + + + + ER_FOREIGN_DATA_STRING_INVALID + + + + ER_CANT_CREATE_FEDERATED_TABLE + + + + ER_TRG_IN_WRONG_SCHEMA + + + + ER_STACK_OVERRUN_NEED_MORE + + + + ER_TOO_LONG_BODY + + + + ER_WARN_CANT_DROP_DEFAULT_KEYCACHE + + + + ER_TOO_BIG_DISPLAYWIDTH + + + + ER_XAER_DUPID + + + + ER_DATETIME_FUNCTION_OVERFLOW + + + + ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG + + + + ER_VIEW_PREVENT_UPDATE + + + + ER_PS_NO_RECURSION + + + + ER_SP_CANT_SET_AUTOCOMMIT + + + + ER_MALFORMED_DEFINER + + + + ER_VIEW_FRM_NO_USER + + + + ER_VIEW_OTHER_USER + + + + ER_NO_SUCH_USER + + + + ER_FORBID_SCHEMA_CHANGE + + + + ER_ROW_IS_REFERENCED_2 + + + + ER_NO_REFERENCED_ROW_2 + + + + ER_SP_BAD_VAR_SHADOW + + + + ER_TRG_NO_DEFINER + + + + ER_OLD_FILE_FORMAT + + + + ER_SP_RECURSION_LIMIT + + + + ER_SP_PROC_TABLE_CORRUPT + + + + ER_SP_WRONG_NAME + + + + ER_TABLE_NEEDS_UPGRADE + + + + ER_SP_NO_AGGREGATE + + + + ER_MAX_PREPARED_STMT_COUNT_REACHED + + + + ER_VIEW_RECURSIVE + + + + ER_NON_GROUPING_FIELD_USED + + + + ER_TABLE_CANT_HANDLE_SPKEYS + + + + ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA + + + + ER_REMOVED_SPACES + + + + ER_AUTOINC_READ_FAILED + + + + ER_USERNAME + + + + ER_HOSTNAME + + + + ER_WRONG_STRING_LENGTH + + + + ER_NON_INSERTABLE_TABLE + + + + ER_ADMIN_WRONG_MRG_TABLE + + + + ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT + + + + ER_NAME_BECOMES_EMPTY + + + + ER_AMBIGUOUS_FIELD_TERM + + + + ER_FOREIGN_SERVER_EXISTS + + + + ER_FOREIGN_SERVER_DOESNT_EXIST + + + + ER_ILLEGAL_HA_CREATE_OPTION + + + + ER_PARTITION_REQUIRES_VALUES_ERROR + + + + ER_PARTITION_WRONG_VALUES_ERROR + + + + ER_PARTITION_MAXVALUE_ERROR + + + + ER_PARTITION_SUBPARTITION_ERROR + + + + ER_PARTITION_SUBPART_MIX_ERROR + + + + ER_PARTITION_WRONG_NO_PART_ERROR + + + + ER_PARTITION_WRONG_NO_SUBPART_ERROR + + + + ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR + + + + ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR + + + + ER_FIELD_NOT_FOUND_PART_ERROR + + + + ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR + + + + ER_INCONSISTENT_PARTITION_INFO_ERROR + + + + ER_PARTITION_FUNC_NOT_ALLOWED_ERROR + + + + ER_PARTITIONS_MUST_BE_DEFINED_ERROR + + + + ER_RANGE_NOT_INCREASING_ERROR + + + + ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR + + + + ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR + + + + ER_PARTITION_ENTRY_ERROR + + + + ER_MIX_HANDLER_ERROR + + + + ER_PARTITION_NOT_DEFINED_ERROR + + + + ER_TOO_MANY_PARTITIONS_ERROR + + + + ER_SUBPARTITION_ERROR + + + + ER_CANT_CREATE_HANDLER_FILE + + + + ER_BLOB_FIELD_IN_PART_FUNC_ERROR + + + + ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF + + + + ER_NO_PARTS_ERROR + + + + ER_PARTITION_MGMT_ON_NONPARTITIONED + + + + ER_FOREIGN_KEY_ON_PARTITIONED + + + + ER_DROP_PARTITION_NON_EXISTENT + + + + ER_DROP_LAST_PARTITION + + + + ER_COALESCE_ONLY_ON_HASH_PARTITION + + + + ER_REORG_HASH_ONLY_ON_SAME_NO + + + + ER_REORG_NO_PARAM_ERROR + + + + ER_ONLY_ON_RANGE_LIST_PARTITION + + + + ER_ADD_PARTITION_SUBPART_ERROR + + + + ER_ADD_PARTITION_NO_NEW_PARTITION + + + + ER_COALESCE_PARTITION_NO_PARTITION + + + + ER_REORG_PARTITION_NOT_EXIST + + + + ER_SAME_NAME_PARTITION + + + + ER_NO_BINLOG_ERROR + + + + ER_CONSECUTIVE_REORG_PARTITIONS + + + + ER_REORG_OUTSIDE_RANGE + + + + ER_PARTITION_FUNCTION_FAILURE + + + + ER_PART_STATE_ERROR + + + + ER_LIMITED_PART_RANGE + + + + ER_PLUGIN_IS_NOT_LOADED + + + + ER_WRONG_VALUE + + + + ER_NO_PARTITION_FOR_GIVEN_VALUE + + + + ER_FILEGROUP_OPTION_ONLY_ONCE + + + + ER_CREATE_FILEGROUP_FAILED + + + + ER_DROP_FILEGROUP_FAILED + + + + ER_TABLESPACE_AUTO_EXTEND_ERROR + + + + ER_WRONG_SIZE_NUMBER + + + + ER_SIZE_OVERFLOW_ERROR + + + + ER_ALTER_FILEGROUP_FAILED + + + + ER_BINLOG_ROW_LOGGING_FAILED + + + + ER_BINLOG_ROW_WRONG_TABLE_DEF + + + + ER_BINLOG_ROW_RBR_TO_SBR + + + + ER_EVENT_ALREADY_EXISTS + + + + ER_EVENT_STORE_FAILED + + + + ER_EVENT_DOES_NOT_EXIST + + + + ER_EVENT_CANT_ALTER + + + + ER_EVENT_DROP_FAILED + + + + ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG + + + + ER_EVENT_ENDS_BEFORE_STARTS + + + + ER_EVENT_EXEC_TIME_IN_THE_PAST + + + + ER_EVENT_OPEN_TABLE_FAILED + + + + ER_EVENT_NEITHER_M_EXPR_NOR_M_AT + + + + ER_COL_COUNT_DOESNT_MATCH_CORRUPTED + + + + ER_CANNOT_LOAD_FROM_TABLE + + + + ER_EVENT_CANNOT_DELETE + + + + ER_EVENT_COMPILE_ERROR + + + + ER_EVENT_SAME_NAME + + + + ER_EVENT_DATA_TOO_LONG + + + + ER_DROP_INDEX_FK + + + + ER_WARN_DEPRECATED_SYNTAX_WITH_VER + + + + ER_CANT_WRITE_LOCK_LOG_TABLE + + + + ER_CANT_LOCK_LOG_TABLE + + + + ER_FOREIGN_DUPLICATE_KEY + + + + ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE + + + + ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR + + + + ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT + + + + ER_NDB_CANT_SWITCH_BINLOG_FORMAT + + + + ER_PARTITION_NO_TEMPORARY + + + + ER_PARTITION_CONST_DOMAIN_ERROR + + + + ER_PARTITION_FUNCTION_IS_NOT_ALLOWED + + + + ER_DDL_LOG_ERROR + + + + ER_NULL_IN_VALUES_LESS_THAN + + + + ER_WRONG_PARTITION_NAME + + + + ER_CANT_CHANGE_TRANSACTION_ISOLATION + + + + ER_DUP_ENTRY_AUTOINCREMENT_CASE + + + + ER_EVENT_MODIFY_QUEUE_ERROR + + + + ER_EVENT_SET_VAR_ERROR + + + + ER_PARTITION_MERGE_ERROR + + + + ER_CANT_ACTIVATE_LOG + + + + ER_RBR_NOT_AVAILABLE + + + + ER_BASE64_DECODE_ERROR + + + + ER_EVENT_RECURSION_FORBIDDEN + + + + ER_EVENTS_DB_ERROR + + + + ER_ONLY_INTEGERS_ALLOWED + + + + ER_UNSUPORTED_LOG_ENGINE + + + + ER_BAD_LOG_STATEMENT + + + + ER_CANT_RENAME_LOG_TABLE + + + + ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT + + + + ER_WRONG_PARAMETERS_TO_NATIVE_FCT + + + + ER_WRONG_PARAMETERS_TO_STORED_FCT + + + + ER_NATIVE_FCT_NAME_COLLISION + + + + ER_DUP_ENTRY_WITH_KEY_NAME + + + + ER_BINLOG_PURGE_EMFILE + + + + ER_EVENT_CANNOT_CREATE_IN_THE_PAST + + + + ER_EVENT_CANNOT_ALTER_IN_THE_PAST + + + + ER_SLAVE_INCIDENT + + + + ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT + + + + ER_BINLOG_UNSAFE_STATEMENT + + + + ER_SLAVE_FATAL_ERROR + + + + ER_SLAVE_RELAY_LOG_READ_FAILURE + + + + ER_SLAVE_RELAY_LOG_WRITE_FAILURE + + + + ER_SLAVE_CREATE_EVENT_FAILURE + + + + ER_SLAVE_MASTER_COM_FAILURE + + + + ER_BINLOG_LOGGING_IMPOSSIBLE + + + + ER_VIEW_NO_CREATION_CTX + + + + ER_VIEW_INVALID_CREATION_CTX + + + + ER_SR_INVALID_CREATION_CTX + + + + ER_TRG_CORRUPTED_FILE + + + + ER_TRG_NO_CREATION_CTX + + + + ER_TRG_INVALID_CREATION_CTX + + + + ER_EVENT_INVALID_CREATION_CTX + + + + ER_TRG_CANT_OPEN_TABLE + + + + ER_CANT_CREATE_SROUTINE + + + + ER_SLAVE_AMBIGOUS_EXEC_MODE + + + + ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT + + + + ER_SLAVE_CORRUPT_EVENT + + + + ER_LOAD_DATA_INVALID_COLUMN + + + + ER_LOG_PURGE_NO_FILE + + + + ER_XA_RBTIMEOUT + + + + ER_XA_RBDEADLOCK + + + + ER_NEED_REPREPARE + + + + ER_DELAYED_NOT_SUPPORTED + + + + WARN_NO_MASTER_INFO + + + + WARN_OPTION_IGNORED + + + + WARN_PLUGIN_DELETE_BUILTIN + + + + WARN_PLUGIN_BUSY + + + + ER_VARIABLE_IS_READONLY + + + + ER_WARN_ENGINE_TRANSACTION_ROLLBACK + + + + ER_SLAVE_HEARTBEAT_FAILURE + + + + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE + + + + ER_NDB_REPLICATION_SCHEMA_ERROR + + + + ER_CONFLICT_FN_PARSE_ERROR + + + + ER_EXCEPTIONS_WRITE_ERROR + + + + ER_TOO_LONG_TABLE_COMMENT + + + + ER_TOO_LONG_FIELD_COMMENT + + + + ER_FUNC_INEXISTENT_NAME_COLLISION + + + + ER_DATABASE_NAME + + + + ER_TABLE_NAME + + + + ER_PARTITION_NAME + + + + ER_SUBPARTITION_NAME + + + + ER_TEMPORARY_NAME + + + + ER_RENAMED_NAME + + + + ER_TOO_MANY_CONCURRENT_TRXS + + + + WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED + + + + ER_DEBUG_SYNC_TIMEOUT + + + + ER_DEBUG_SYNC_HIT_LIMIT + + + + ER_ERROR_LAST + + + + WriteInteger + + + + + + + Summary description for MySqlPool. + + + + + It is assumed that this property will only be used from inside an active + lock. + + + + + Indicates whether this pool is being cleared. + + + + + It is assumed that this method is only called from inside an active lock. + + + + + It is assumed that this method is only called from inside an active lock. + + + + + Removes a connection from the in use pool. The only situations where this method + would be called are when a connection that is in use gets some type of fatal exception + or when the connection is being returned to the pool and it's too old to be + returned. + + + + + + Clears this pool of all idle connections and marks this pool and being cleared + so all other connections are closed when they are returned. + + + + + Remove expired drivers from the idle pool + + + + Closing driver is a potentially lengthy operation involving network + IO. Therefore we do not close expired drivers while holding + idlePool.SyncRoot lock. We just remove the old drivers from the idle + queue and return them to the caller. The caller will need to close + them (or let GC close them) + + + + + Summary description for MySqlPoolManager. + + + + + Queue of demoted hosts. + + + + + List of hosts that will be attempted to connect to. + + + + + Timer to be used when a host have been demoted. + + + + + Remove drivers that have been idle for too long. + + + + + Remove hosts that have been on the demoted list for more + than 120,000 milliseconds and add them to the available hosts list. + + + + + Provides a class capable of executing a SQL script containing + multiple SQL statements including CREATE PROCEDURE statements + that require changing the delimiter + + + + + Handles the event raised whenever a statement is executed. + + + + + Handles the event raised whenever an error is raised by the execution of a script. + + + + + Handles the event raised whenever a script execution is finished. + + + + + Initializes a new instance of the + class. + + + + + Initializes a new instance of the + class. + + The connection. + + + + Initializes a new instance of the + class. + + The query. + + + + Initializes a new instance of the + class. + + The connection. + The query. + + + + Gets or sets the connection. + + The connection. + + + + Gets or sets the query. + + The query. + + + + Gets or sets the delimiter. + + The delimiter. + + + + Executes this instance. + + The number of statements executed as part of the script. + + + + Initiates the asynchronous execution of SQL statements. + + The number of statements executed as part of the script inside. + + + + Initiates the asynchronous execution of SQL statements. + + The cancellation token. + The number of statements executed as part of the script inside. + + + + Represents the method that will handle errors when executing MySQL statements. + + + + + Represents the method that will handle errors when executing MySQL scripts. + + + + + Sets the arguments associated to MySQL scripts. + + + + + Gets the statement text. + + The statement text. + + + + Gets the line. + + The line. + + + + Gets the position. + + The position. + + + + Sets the arguments associated to MySQL script errors. + + + + + Initializes a new instance of the class. + + The exception. + + + + Gets the exception. + + The exception. + + + + Gets or sets a value indicating whether this is ignored. + + true if ignore; otherwise, false. + + + + Summary description for MySqlStream. + + + + + ReadPacket is called by NativeDriver to start reading the next + packet on the stream. + + + + + Reads the specified number of bytes from the stream and stores them at given + offset in the buffer. + Throws EndOfStreamException if not all bytes can be read. + + Stream to read from + Array to store bytes read from the stream + The offset in buffer at which to begin storing the data read from the current stream. + Number of bytes to read + + + + LoadPacket loads up and decodes the header of the incoming packet. + + + + + Traces information about the client execution. + + + + + Gets the list of trace listeners. + + + + + Gets or sets the switch to control tracing and debugging. + + + + + Gets or sets a flag indicating if query analysis is enabled. + + + + + Enables query analysis. + + The host on which to enable query analysis. + The interval of time for logging trace information. + + + + Disables query analysis. + + + + + Specifies the types of warning flags. + + + + + No index exists. + + + + + Bad index exists. + + + + + Rows have been excluded from the result. + + + + + Columns have been excluded from the result. + + + + + Type conversions took place. + + + + + Specifies the event that triggered the trace. + + + + + A connection has been opened. + + + + + A connection has been closed. + + + + + A query has been executed. + + + + + Data has been retrieved from the resultset. + + + + + Data retrieval has ended. + + + + + Query execution has ended. + + + + + The statement to be executed has been created. + + + + + The statement has been executed. + + + + + The statement is no longer required. + + + + + The query provided is of a nonquery type. + + + + + Usage advisor warnings have been requested. + + + + + Noncritical problem. + + + + + An error has been raised during data retrieval. + + + + + The query has been normalized. + + + + + Summary description for Driver. + + + + + Sets the current database for the this connection + + + + + + Return the appropriate set of connection flags for our + server capabilities and our user requested options. + + + + + Query is the method that is called to send all queries to the server + + + + + Sends the specified file to the server. + This supports the LOAD DATA LOCAL INFILE + + + + + + FetchDataRow is the method that the data reader calls to see if there is another + row to fetch. In the non-prepared mode, it will simply read the next data packet. + In the prepared mode (statementId > 0), it will + + + + + Execution timeout, in milliseconds. When the accumulated time for network IO exceeds this value + TimeoutException is thrown. This timeout needs to be reset for every new command + + + + + + Summary description for PreparedStatement. + + + + + Prepares CommandText for use with the Prepare method + + Command text stripped of all paramter names + + Takes the output of TokenizeSql and creates a single string of SQL + that only contains '?' markers for each parameter. It also creates + the parameterMap array list that includes all the paramter names in the + order they appeared in the SQL + + + + + Defines a replication configurarion element in the configuration file. + + + + + Gets a collection of objects representing the server groups. + + + + + Defines a replication server group in the configuration file. + + + + + Gets or sets the name of the replication server group configuration. + + + + + Gets or sets the group type of the replication server group configuration. + + + + + Gets or sets the number of seconds to wait for retry. + + + + + Gets a collection of objects representing the + server configurations associated to this group configuration. + + + + + Defines a replication server in configuration file. + + + + + Gets or sets the name of the replication server configuration. + + + + + Gets or sets whether the replication server is configured as master. + + + + + Gets or sets the connection string associated to this replication server. + + + + + Manager for Replication and Load Balancing features + + + + + Returns Replication Server Group List + + + + + Adds a Default Server Group to the list + + Group name + Time between reconnections for failed servers + Replication Server Group added + + + + Adds a Server Group to the list + + Group name + ServerGroup type reference + Time between reconnections for failed servers + Server Group added + + + + Gets the next server from a replication group + + Group name + True if the server to return must be a master + Replication Server defined by the Load Balancing plugin + + + + Gets a Server Group by name + + Group name + Server Group if found, otherwise throws an MySqlException + + + + Validates if the replication group name exists + + Group name to validate + true if the replication group name is found; otherwise, false + + + + Assigns a new server driver to the connection object + + Group name + True if the server connection to assign must be a master + MySqlConnection object where the new driver will be assigned + + + + Class that implements Round Robing Load Balancing technique. + + + + + Gets an available server based on Round Robin load balancing. + + Flag indicating if the server to return must be a master. + A object representing the next available server. + + + + Represents a server in a Replication environment. + + + + + Gets the server name. + + + + + Gets a value indicating whether the server is master or slave. + + + + + Gets the connection string used to connect to the server. + + + + + Gets a flag indicating if the server is available to be considered in load balancing. + + + + + Base class used to implement load balancing features. + + + + + List of servers available for replication. + + + + The group name. + The number of seconds to perform a retry. + + + + Gets the group name. + + + + + Gets the retry time between connections to failed servers. + + + + + Gets the server list in the group. + + + + + Adds a server into the group. + + The server name. + A flag indicating if the server to add is master or slave. + The connection string used by this server. + A object representing the recently added object. + + + + Removes a server from the group. + + The server name. + + + + Gets a server by name. + + The server name. + The replication server. + + + + Must be implemented. Defines the next server for a custom load balancing implementation. + + Defines if the server to return is a master or any. + The next server based on the load balancing implementation. + Null if no available server is found. + + + + + Defines the next server for a custom load balancing implementation. + + Defines if the server to return is a master or any. + Currently not being used. + The next server based on the load balancing implementation. + Null if no available server is found. + + + + + Handles a failed connection to a server. + + The failed server. + This method can be overrided to implement a custom failover handling. + + + + Handles a failed connection to a server. + + The failed server. + The exception that caused the failover. + + + + return the ordinal for the given column name + + + + + + + Retrieve the value as the given column index + + The column value to retrieve + The value as the given column + + + + Closes the current resultset, dumping any data still on the wire + + + + + Loads the column metadata for the current resultset + + + + + Represents a schema and its contents. + + + + + Gets or sets the name of the schema. + + + + + Gets the list of columns in the schema. + + + + + Gets the list of rows in the schema. + + + + + Represents a row within a schema. + + + + + Represents a column within a schema. + + + + + The name of the column. + + + + + The type of the column. + + + + + GetForeignKeysOnTable retrieves the foreign keys on the given table. + Since MySQL supports foreign keys on versions prior to 5.0, we can't use + information schema. MySQL also does not include any type of SHOW command + for foreign keys so we have to resort to use SHOW CREATE TABLE and parsing + the output. + + The table to store the key info in. + The table to get the foeign key info for. + Only get foreign keys that match this name. + Should column information be included in the table. + + + + Serializes the given parameter to the given memory stream + + + This method is called by PrepareSqlBuffers to convert the given + parameter to bytes and write those bytes to the given memory stream. + + + True if the parameter was successfully serialized, false otherwise. + + + + Summary description for StoredProcedure. + + + + + Defines the basic operations to be performed on the table cache. + + + + + The maximum age allowed for cache entries. + + + + + Adds the given command and result set to the cache. + + The command to store in the cache. + The resultset associated to the stored command. + + + + Retrieves the specified command from the cache. + + The command to retrieve. + The allowed age for the cache entry. + + + + + Removes the specified command from the cache. + + The command to remove from the cache. + + + + Clears the cache. + + + + + Removes cache entries older than the value defined by . + + + + + Stream that supports timeout of IO operations. + This class is used is used to support timeouts for SQL command, where a + typical operation involves several network reads/writes. + Timeout here is defined as the accumulated duration of all IO operations. + + + + + Construct a TimedStream + + Undelying stream + + + + Figure out whether it is necessary to reset timeout on stream. + We track the current value of timeout and try to avoid + changing it too often, because setting Read/WriteTimeout property + on network stream maybe a slow operation that involves a system call + (setsockopt). Therefore, we allow a small difference, and do not + reset timeout if current value is slightly greater than the requested + one (within 0.1 second). + + + + + Common handler for IO exceptions. + Resets timeout to infinity if timeout exception is + detected and stops the times. + + original exception + + + + Represents a SQL transaction to be made in a MySQL database. This class cannot be inherited. + + The application creates a MySqlTransaction object by calling + on the object. All subsequent operations associated with the + transaction (for example, committing or aborting the transaction), are performed on the + MySqlTransaction object. + + The following example creates a and a MySqlTransaction. + It also demonstrates how to use the , + , and methods. + + Public Sub RunTransaction(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + + Dim myCommand As MySqlCommand = myConnection.CreateCommand() + Dim myTrans As MySqlTransaction + + ' Start a local transaction + myTrans = myConnection.BeginTransaction() + ' Must assign both transaction object and connection + ' to Command object for a pending local transaction + myCommand.Connection = myConnection + myCommand.Transaction = myTrans + + Try + myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')" + myCommand.ExecuteNonQuery() + myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')" + myCommand.ExecuteNonQuery() + myTrans.Commit() + Console.WriteLine("Both records are written to database.") + Catch e As Exception + Try + myTrans.Rollback() + Catch ex As MySqlException + If Not myTrans.Connection Is Nothing Then + Console.WriteLine("An exception of type " & ex.GetType().ToString() & _ + " was encountered while attempting to roll back the transaction.") + End If + End Try + + Console.WriteLine("An exception of type " & e.GetType().ToString() & _ + "was encountered while inserting the data.") + Console.WriteLine("Neither record was written to database.") + Finally + myConnection.Close() + End Try + End Sub 'RunTransaction + + + public void RunTransaction(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + + MySqlCommand myCommand = myConnection.CreateCommand(); + MySqlTransaction myTrans; + + // Start a local transaction + myTrans = myConnection.BeginTransaction(); + // Must assign both transaction object and connection + // to Command object for a pending local transaction + myCommand.Connection = myConnection; + myCommand.Transaction = myTrans; + + try + { + myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')"; + myCommand.ExecuteNonQuery(); + myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')"; + myCommand.ExecuteNonQuery(); + myTrans.Commit(); + Console.WriteLine("Both records are written to database."); + } + catch(Exception e) + { + try + { + myTrans.Rollback(); + } + catch (MySqlException ex) + { + if (myTrans.Connection != null) + { + Console.WriteLine("An exception of type " + ex.GetType() + + " was encountered while attempting to roll back the transaction."); + } + } + + Console.WriteLine("An exception of type " + e.GetType() + + " was encountered while inserting the data."); + Console.WriteLine("Neither record was written to database."); + } + finally + { + myConnection.Close(); + } + } + + + + + + Gets the object associated with the transaction, or a null reference (Nothing in Visual Basic) if the transaction is no longer valid. + + The object associated with this transaction. + + A single application may have multiple database connections, each + with zero or more transactions. This property enables you to + determine the connection object associated with a particular + transaction created by . + + + + + Specifies the for this transaction. + + + The for this transaction. The default is ReadCommitted. + + + Parallel transactions are not supported. Therefore, the IsolationLevel + applies to the entire transaction. + + + + + Commits the database transaction. + + The Commit method is equivalent to the MySQL SQL statement + COMMIT. + + The following example creates a and a + . It also demonstrates how to use the + , , and Rollback + methods. + + Public Sub RunSqlTransaction(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + + Dim myCommand As MySqlCommand = myConnection.CreateCommand() + Dim myTrans As MySqlTransaction + + ' Start a local transaction + myTrans = myConnection.BeginTransaction() + + ' Must assign both transaction object and connection + ' to Command object for a pending local transaction + myCommand.Connection = myConnection + myCommand.Transaction = myTrans + + Try + myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')" + myCommand.ExecuteNonQuery() + myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')" + myCommand.ExecuteNonQuery() + myTrans.Commit() + Console.WriteLine("Success.") + Catch e As Exception + Try + myTrans.Rollback() + Catch ex As MySqlException + If Not myTrans.Connection Is Nothing Then + Console.WriteLine("An exception of type " & ex.GetType().ToString() & _ + " was encountered while attempting to roll back the transaction.") + End If + End Try + + Console.WriteLine("An exception of type " & e.GetType().ToString() & _ + "was encountered while inserting the data.") + Console.WriteLine("Neither record was written to database.") + Finally + myConnection.Close() + End Try + End Sub + + + public void RunSqlTransaction(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + + MySqlCommand myCommand = myConnection.CreateCommand(); + MySqlTransaction myTrans; + + // Start a local transaction + myTrans = myConnection.BeginTransaction(); + // Must assign both transaction object and connection + // to Command object for a pending local transaction + myCommand.Connection = myConnection; + myCommand.Transaction = myTrans; + + try + { + myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"; + myCommand.ExecuteNonQuery(); + myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"; + myCommand.ExecuteNonQuery(); + myTrans.Commit(); + Console.WriteLine("Both records are written to database."); + } + catch(Exception e) + { + try + { + myTrans.Rollback(); + } + catch (MySqlException ex) + { + if (myTrans.Connection != null) + { + Console.WriteLine("An exception of type " + ex.GetType() + + " was encountered while attempting to roll back the transaction."); + } + } + + Console.WriteLine("An exception of type " + e.GetType() + + " was encountered while inserting the data."); + Console.WriteLine("Neither record was written to database."); + } + finally + { + myConnection.Close(); + } + } + + + + + + Rolls back a transaction from a pending state. + + The Rollback method is equivalent to the MySQL statement ROLLBACK. + The transaction can only be rolled back from a pending state + (after BeginTransaction has been called, but before Commit is + called). + + The following example creates a and a + . It also demonstrates how to use the + , , and Rollback + methods. + + Public Sub RunSqlTransaction(myConnString As String) + Dim myConnection As New MySqlConnection(myConnString) + myConnection.Open() + + Dim myCommand As MySqlCommand = myConnection.CreateCommand() + Dim myTrans As MySqlTransaction + + ' Start a local transaction + myTrans = myConnection.BeginTransaction() + + ' Must assign both transaction object and connection + ' to Command object for a pending local transaction + myCommand.Connection = myConnection + myCommand.Transaction = myTrans + + Try + myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')" + myCommand.ExecuteNonQuery() + myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')" + myCommand.ExecuteNonQuery() + myTrans.Commit() + Console.WriteLine("Success.") + Catch e As Exception + Try + myTrans.Rollback() + Catch ex As MySqlException + If Not myTrans.Connection Is Nothing Then + Console.WriteLine("An exception of type " & ex.GetType().ToString() & _ + " was encountered while attempting to roll back the transaction.") + End If + End Try + + Console.WriteLine("An exception of type " & e.GetType().ToString() & _ + "was encountered while inserting the data.") + Console.WriteLine("Neither record was written to database.") + Finally + myConnection.Close() + End Try + End Sub + + + public void RunSqlTransaction(string myConnString) + { + MySqlConnection myConnection = new MySqlConnection(myConnString); + myConnection.Open(); + + MySqlCommand myCommand = myConnection.CreateCommand(); + MySqlTransaction myTrans; + + // Start a local transaction + myTrans = myConnection.BeginTransaction(); + // Must assign both transaction object and connection + // to Command object for a pending local transaction + myCommand.Connection = myConnection; + myCommand.Transaction = myTrans; + + try + { + myCommand.CommandText = "Insert into mytable (id, desc) VALUES (100, 'Description')"; + myCommand.ExecuteNonQuery(); + myCommand.CommandText = "Insert into mytable (id, desc) VALUES (101, 'Description')"; + myCommand.ExecuteNonQuery(); + myTrans.Commit(); + Console.WriteLine("Both records are written to database."); + } + catch(Exception e) + { + try + { + myTrans.Rollback(); + } + catch (MySqlException ex) + { + if (myTrans.Connection != null) + { + Console.WriteLine("An exception of type " + ex.GetType() + + " was encountered while attempting to roll back the transaction."); + } + } + + Console.WriteLine("An exception of type " + e.GetType() + + " was encountered while inserting the data."); + Console.WriteLine("Neither record was written to database."); + } + finally + { + myConnection.Close(); + } + } + + + + + + DNS resolver that runs queries against a server. + + + + + Initializes a new instance of the class. + + + + + Gets the DNS SVR records of the service name that is provided. + + A list of s sorted as described in RFC2782. + + + + Sorts a list of DNS SRV records according to the sorting rules described in RFC2782. + + List of s to sort. + A new list of sorted s. + + + + Resets the DnsSrvResolver + + + + + Class that represents a DNS SRV record. + RFC 2782 (https://tools.ietf.org/html/rfc2782) + + + + + Gets the port. + + + + + Gets the priority. + + + + + Gets the target domain name. + + + + + Gets the weight. + + + + + Initializes a new instance of class. + + The port. + The priority. + The target. + The weight. + + + + Initializes a new instance of class. + + The DNS SRV record. + + + + Compare two objects. First, using their priority and + if both have the same, then using their weights. + + A to compare. + A to compare. + + + + + Initializes a new instance of the class from a . + + The DNS SRV record. + + + + This class is modeled after .NET Stopwatch. It provides better + performance (no system calls).It is however less precise than + .NET Stopwatch, measuring in milliseconds. It is adequate to use + when high-precision is not required (e.g for measuring IO timeouts), + but not for other tasks. + + + + + Wrapper around NetworkStream. + + MyNetworkStream is equivalent to NetworkStream, except + 1. It throws TimeoutException if read or write timeout occurs, instead + of IOException, to match behavior of other streams (named pipe and + shared memory). This property comes handy in TimedStream. + + 2. It implements workarounds for WSAEWOULDBLOCK errors, that can start + occuring after stream has times out. For a discussion about the CLR bug, + refer to http://tinyurl.com/lhgpyf. This error should never occur, as + we're not using asynchronous operations, but apparerntly it does occur + directly after timeout has expired. + The workaround is hinted in the URL above and implemented like this: + For each IO operation, if it throws WSAEWOULDBLOCK, we explicitely set + the socket to Blocking and retry the operation once again. + + + + + Set keepalive + timeout on socket. + + socket + keepalive timeout, in seconds + + + + Static class to manage SSH connections created with SSH .NET. + + + + + Gets or sets the SSH client initialized when calling the method. + + + + + Stores a list of SSH clients having different connection settings. + + + + + Removes the MySQL unsupported encryptions (SSH Ciphers), MACs and key exchange algorithms. + + The instance containing the list of supported elements. + See https://confluence.oraclecorp.com/confluence/display/GPS/Approved+Security+Technologies%3A+Standards+-+SSH+Ciphers+and+Versions for an updated list. + + + + Initializes an instance if no SSH client with similar connection options has already been initialized. + + The SSH host name. + The SSH user name. + The SSH password. + The SSH key file. + The SSH pass phrase. + The SSH port. + The local host name. + The local port number. + Flag to indicate if the connection will be created for the classic or X Protocol. + + + + + Raises warning messages if the SSH client is using a deprecated encryption, MAC or key exchanged algorithm. + + The instance containing the + encryption, MAC algorithm and key exchange algorithm currently being used. + + + + Read a single quoted identifier from the stream + + + + + + + Helper class to encapsulate shared memory functionality + Also cares of proper cleanup of file mapping object and cew + + + + + Summary description for SharedMemoryStream. + + + + + By creating a private ctor, we keep the compiler from creating a default ctor + + + + + Mark - or + signs that are unary ops as no output + + + + + + Wrapper class used for handling SSH connections. + + + + + Starts the SSH client. + + + + + Stops the SSH client. + + + + + Handles SSL connections for the Classic and X protocols. + + + + + Contains the connection options provided by the user. + + + + + A flag to establish how certificates are to be treated and validated. + + + + + Defines the supported TLS protocols. + + + + + Retrieves a collection containing the client SSL PFX certificates. + + Dependent on connection string settings. + Either file or store based certificates are used. + + + + Initiates the SSL connection. + + The base stream. + The encoding used in the SSL connection. + The connection string used to establish the connection. + A instance ready to initiate an SSL connection. + + + + Verifies the SSL certificates used for authentication. + + An object that contains state information for this validation. + The MySQL server certificate used to authenticate the remote party. + The chain of certificate authorities associated with the remote certificate. + One or more errors associated with the remote certificate. + true if no errors were found based on the selected SSL mode; false, otherwise. + + + + Gets the extension of the specified file. + + The path of the file. + Flag to indicate if the result should be converted to lower case. + The . character is ommited from the result. + + + + + Summary description for StreamCreator. + + + + + Set the keepalive timeout on the socket. + + The socket object. + The keepalive timeout, in seconds. + + + + Summary description for Version. + + + + + Provides functionality to read SSL PEM certificates and to perform multiple validations via Bouncy Castle. + + + + + Raises an exception if the specified connection option is null, empty or whitespace. + + The connection option to verify. + + + + Reads the specified file as a byte array. + + The path of the file to read. + A byte array representing the read file. + + + + Reads the SSL certificate file. + + The path to the certificate file. + A instance representing the SSL certificate file. + + + + Reads the SSL certificate key file. + + The path to the certificate key file. + A instance representing the SSL certificate key file. + + + + Verifies that the certificate has not yet expired. + + The certificate to verify. + + + + Verifies a certificate CA status. + + The certificate to validate. + A flag indicating the expected CA status. + + + + Verifies that the certificate was signed using the private key that corresponds to the specified public key + + The client side certificate containing the public key. + The server certificate. + + + + Verifies that no SSL policy errors regarding the identitfy of the host were raised. + + A instance set with the raised SSL errors. + + + + Verifies that the issuer matches the CA by comparing the CA certificate issuer and the server certificate issuer. + + The CA certificate. + The server certificate. + + + + + Gets and sets the host list. + + + + + Gets the active host. + + + + + Active host. + + + + + Sets the initial active host. + + + + + Determines the next host. + + object that represents the next available host. + + + + Implements common elements that allow to manage the hosts available for client side failover. + + + + + Gets and sets the failover group which consists of a host list. + + + + + Resets the manager. + + + + + Sets the host list to be used during failover operations. + + The host list. + The failover method. + + + + Attempts to establish a connection to a host specified from the list. + + The original connection string set by the user. + An out parameter that stores the updated connection string. + A object in case this is a pooling scenario. + An instance if the connection was succesfully established, a exception is thrown otherwise. + + + + + Creates a if more than one host is found. + + A string containing an unparsed list of hosts. + true if the connection is X Protocol; otherwise false. + true if the connection data is a URI; otherwise false. + The number of hosts found, -1 if an error was raised during parsing. + + + + Creates a object based on the provided parameters. + + The host string that can be a simple host name or a host name and port. + The priority of the host. + The port number of the host. + true if the connection data is a URI; otherwise false. + + + + + Attempts the next host in the list. Moves to the first element if the end of the list is reached. + + + + + Determines the next host on which to attempt a connection by checking the value of the Priority property in descending order. + + + + + Determines the next host on which to attempt a connection randomly. + + + + + Depicts a host which can be failed over to. + + + + + Gets and sets the name or address of the host. + + + + + Gets and sets the port number. + + + + + Gets a value between 0 and 100 which represents the priority of the host. + + + + + Flag to indicate if this host is currently being used. + + + + + Flag to indicate if this host has been attempted to connection. + + + + + Time since the host has been demoted. + + + + + Initializes a object. + + The host. + The port. + The priority. + + + + Compares two objects of type . + + FailoverServer object to compare. + True if host properties are the same. Otherwise, false. + + + + Manages the hosts available for client side failover using the Random Failover method. + The Random Failover method attempts to connect to the hosts specified in the list randomly until all the hosts have been attempted. + + + + + The initial host taken from the list. + + + + + The host for the current connection attempt. + + + + + Random object to get the next host. + + + + + Sets the initial active host. + + + + + Determines the next host. + + A object that represents the next available host. + + + + Manages the hosts available for client side failover using the Sequential Failover method. + The Sequential Failover method attempts to connect to the hosts specified in the list one after another until the initial host is reached. + + + + + The initial host taken from the list. + + + + + The index of the current host. + + + + + The host for the current connection attempt. + + + + + Sets the initial active host. + + + + + Determines the next host. + + A object that represents the next available host. + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Improper MySqlCommandBuilder state: adapter is null. + + + + + Looks up a localized string similar to Improper MySqlCommandBuilder state: adapter's SelectCommand is null. + + + + + Looks up a localized string similar to Invalid attempt to access a field before calling Read(). + + + + + Looks up a localized string similar to Authentication to host '{0}' for user '{1}' using method '{2}' failed with message: {3}. + + + + + Looks up a localized string similar to Authentication method '{0}' not supported by any of the available plugins.. + + + + + Looks up a localized string similar to Version string not in acceptable format. + + + + + Looks up a localized string similar to The buffer cannot be null. + + + + + Looks up a localized string similar to Buffer is not large enough. + + + + + Looks up a localized string similar to Canceling an executing query requires MySQL 5.0 or higher.. + + + + + Looks up a localized string similar to Canceling an active query is only supported on MySQL 5.0.0 and above. . + + + + + Looks up a localized string similar to Parameters can only be derived for commands using the StoredProcedure command type.. + + + + + Looks up a localized string similar to MySqlCommandBuilder does not support multi-table statements. + + + + + Looks up a localized string similar to MySqlCommandBuilder cannot operate on tables with no unique or key columns. + + + + + Looks up a localized string similar to Chaos isolation level is not supported . + + + + + Looks up a localized string similar to The CommandText property has not been properly initialized.. + + + + + Looks up a localized string similar to Compression is not supported.. + + + + + Looks up a localized string similar to The connection is already open.. + + + + + Looks up a localized string similar to Connection unexpectedly terminated.. + + + + + Looks up a localized string similar to Connection must be valid and open. + + + + + Looks up a localized string similar to The connection is not open.. + + + + + Looks up a localized string similar to The connection property has not been set or is null.. + + + + + Looks up a localized string similar to Could not find specified column in results: {0}. + + + + + Looks up a localized string similar to Count cannot be negative. + + + + + Looks up a localized string similar to SetLength is not a valid operation on CompressedStream. + + + + + Looks up a localized string similar to The given value was not in a supported format.. + + + + + Looks up a localized string similar to There is already an open DataReader associated with this Connection which must be closed first.. + + + + + Looks up a localized string similar to The default connection encoding was not found. Please report this as a bug along with your connection string and system details.. + + + + + Looks up a localized string similar to The {0} algorithm being used by the server({1}) has been deprecated and will be removed in a future version. It is recommended that you configure the server to use a non-deprecated {0} algorithm.. + + + + + Looks up a localized string similar to MySQL Connector/NET does not currently support distributed transactions.. + + + + + Looks up a localized string similar to Specifying multiple host names with DNS SRV lookup is not permitted.. + + + + + Looks up a localized string similar to Specifying a port number with DNS SRV lookup is not permitted.. + + + + + Looks up a localized string similar to Using Unix domain sockets with DNS SRV lookup is not permitted.. + + + + + Looks up a localized string similar to Unable to locate any hosts for {0}.. + + + + + Looks up a localized string similar to Connection option '{0}' is duplicated.. + + + + + Looks up a localized string similar to SSL connection option '{0}' is duplicated.. + + + + + Looks up a localized string similar to Encoding error during validation.. + + + + + Looks up a localized string similar to Error creating socket connection. + + + + + Looks up a localized string similar to Verify that user '{0}'@'{1}' has enough privileges to execute.. + + + + + Looks up a localized string similar to Fatal error encountered during command execution.. + + + + + Looks up a localized string similar to Fatal error encountered during data read.. + + + + + Looks up a localized string similar to Fatal error encountered attempting to read the resultset.. + + + + + Looks up a localized string similar to File based certificates are only supported when connecting to MySQL Server 5.1 or greater.. + + + + + Looks up a localized string similar to The specified file cannot be converted to a certificate.. + + + + + Looks up a localized string similar to The specified file cannot be converted to a key.. + + + + + Looks up a localized string similar to Failed to read file at the specified location.. + + + + + Looks up a localized string similar to No file path has been provided for the connection option {0}.. + + + + + Looks up a localized string similar to From index and length use more bytes than from contains. + + + + + Looks up a localized string similar to From index must be a valid index inside the from buffer. + + + + + Looks up a localized string similar to Call to GetHostEntry failed after {0} while querying for hostname '{1}': SocketErrorCode={2}, ErrorCode={3}, NativeErrorCode={4}.. + + + + + Looks up a localized string similar to Retrieving procedure metadata for {0} from server.. + + + + + Looks up a localized string similar to Value has an unsupported format.. + + + + + Looks up a localized string similar to An incorrect response was received from the server.. + + + + + Looks up a localized string similar to Index and length use more bytes than to has room for. + + + + + Looks up a localized string similar to Index must be a valid position in the buffer. + + + + + Looks up a localized string similar to The provided key is invalid.. + + + + + Looks up a localized string similar to You have specified an invalid column ordinal.. + + + + + Looks up a localized string similar to The requested value '{0}' is invalid for the given keyword '{1}'.. + + + + + Looks up a localized string similar to The host name or IP address is invalid.. + + + + + Looks up a localized string similar to Microsecond must be a value between 0 and 999999.. + + + + + Looks up a localized string similar to Millisecond must be a value between 0 and 999. For more precision use Microsecond.. + + + + + Looks up a localized string similar to No other SSL options are accepted when SSL Mode is set to None.. + + + + + Looks up a localized string similar to Procedure or function '{0}' cannot be found in database '{1}'.. + + + + + Looks up a localized string similar to The certificate is invalid.. + + + + + Looks up a localized string similar to Unable to validate the signature.. + + + + + Looks up a localized string similar to Unable to verify the signature.. + + + + + Looks up a localized string similar to Value '{0}' is not of the correct type.. + + + + + Looks up a localized string similar to Option "tls-version" can not be specified when SSL connections are disabled.. + + + + + Looks up a localized string similar to '{0}' not recognized as a valid TLS protocol version (should be one of TLSv1, TLSv1.1, TLSv1.2{1}).. + + + + + Looks up a localized string similar to '{0}' is an illegal value for a boolean option.. + + + + + Looks up a localized string similar to Keyword does not allow null values.. + + + + + Looks up a localized string similar to Option not supported.. + + + + + Looks up a localized string similar to ACCESSIBLE + ADD + ALL + ALTER + ANALYZE + AND + AS + ASC + ASENSITIVE + BEFORE + BEGIN + BETWEEN + BIGINT + BINARY + BLOB + BOTH + BY + CALL + CASCADE + CASE + CHANGE + CHAR + CHARACTER + CHECK + COLLATE + COLUMN + COMMIT + CONDITION + CONNECTION + CONSTRAINT + CONTINUE + CONVERT + CREATE + CROSS + CURRENT_DATE + CURRENT_TIME + CURRENT_TIMESTAMP + CURRENT_USER + CURSOR + DATABASE + DATABASES + DAY_HOUR + DAY_MICROSECOND + DAY_MINUTE + DAY_SECOND + DEC + DECIMAL + DECLARE + DEFAULT + DELAYED + DELETE + DESC + DESCRIBE + DETERMINISTIC + DISTINCT + DISTINCTROW + DIV + DO + DOUBLE + DROP + DUAL + EACH + ELSE + ELSEIF + ENCLOSED + END + ESC [rest of string was truncated]";. + + + + + Looks up a localized string similar to Server asked for stream in response to LOAD DATA LOCAL INFILE, but the functionality is disabled by the client setting 'allowlocalinfile' to 'false'.. + + + + + Looks up a localized string similar to Mixing named and unnamed parameters is not allowed.. + + + + + Looks up a localized string similar to INTERNAL ERROR: More than one output parameter row detected.. + + + + + Looks up a localized string similar to Multiple simultaneous connections or connections with different connection strings inside the same transaction are not currently supported.. + + + + + Looks up a localized string similar to NamedPipeStream does not support seeking. + + + + + Looks up a localized string similar to NamedPipeStream doesn't support SetLength. + + + + + Looks up a localized string similar to The new value must be a MySqlParameter object.. + + + + + Looks up a localized string similar to Invalid attempt to call NextResult when the reader is closed.. + + + + + Looks up a localized string similar to When calling stored procedures and 'Use Procedure Bodies' is false, all parameters must have their type explicitly set.. + + + + + Looks up a localized string similar to Nested transactions are not supported.. + + + + + Looks up a localized string similar to The host {0} does not support SSL connections.. + + + + + Looks up a localized string similar to Unix sockets are not supported on Windows.. + + + + + Looks up a localized string similar to Cannot retrieve Windows identity for current user. Connections that use IntegratedSecurity cannot be pooled. Use either 'ConnectionReset=true' or 'Pooling=false' in the connection string to fix.. + + + + + Looks up a localized string similar to The object is not open or has been disposed.. + + + + + Looks up a localized string similar to Offset cannot be negative. + + + + + Looks up a localized string similar to Offset must be a valid position in buffer. + + + + + Looks up a localized string similar to Authentication with old password no longer supported, use 4.1 style passwords.. + + + + + Looks up a localized string similar to The option '{0}' is not currently supported.. + + + + + Looks up a localized string similar to Parameter '{0}' has already been defined.. + + + + + Looks up a localized string similar to Parameter cannot have a negative value. + + + + + Looks up a localized string similar to Parameter cannot be null. + + + + + Looks up a localized string similar to Parameter '{0}' can't be null or empty.. + + + + + Looks up a localized string similar to Parameter index was not found in Parameter Collection.. + + + + + Looks up a localized string similar to Parameter is invalid.. + + + + + Looks up a localized string similar to Parameter '{0}' must be defined.. + + + + + Looks up a localized string similar to Parameter '{0}' was not found during prepare.. + + + + + Looks up a localized string similar to Parameter can't be null or empty.. + + + + + Looks up a localized string similar to Password must be valid and contain length characters. + + + + + Looks up a localized string similar to This category includes a series of counters for MySQL. + + + + + Looks up a localized string similar to .NET Data Provider for MySQL. + + + + + Looks up a localized string similar to The number of times a procedures metadata had to be queried from the server.. + + + + + Looks up a localized string similar to Hard Procedure Queries. + + + + + Looks up a localized string similar to The number of times a procedures metadata was retrieved from the client-side cache.. + + + + + Looks up a localized string similar to Soft Procedure Queries. + + + + + Looks up a localized string similar to same name are not supported.. + + + + + Looks up a localized string similar to Packets larger than max_allowed_packet are not allowed.. + + + + + Looks up a localized string similar to Reading from the stream has failed.. + + + + + Looks up a localized string similar to Invalid attempt to read a prior column using SequentialAccess. + + + + + Looks up a localized string similar to Replicated connections allow only readonly statements.. + + + + + Looks up a localized string similar to Attempt to connect to '{0}' server failed.. + + + + + Looks up a localized string similar to No available server found.. + + + + + Looks up a localized string similar to Replication group '{0}' not found.. + + + + + Looks up a localized string similar to Replicated server not found: '{0}'. + + + + + Looks up a localized string similar to Routine '{0}' cannot be found. Either check the spelling or make sure you have sufficient rights to execute the routine.. + + + + + Looks up a localized string similar to Attempt to call stored function '{0}' without specifying a return parameter. + + + + + Looks up a localized string similar to Retrieval of the RSA public key is not enabled for insecure connections.. + + + + + Looks up a localized string similar to Connector/NET no longer supports server versions prior to 5.0. + + + + + Looks up a localized string similar to Snapshot isolation level is not supported.. + + + + + Looks up a localized string similar to Socket streams do not support seeking. + + + + + Looks up a localized string similar to Retrieving procedure metadata for {0} from procedure cache.. + + + + + Looks up a localized string similar to Stored procedures are not supported on this version of MySQL. + + + + + Looks up a localized string similar to The SSH Key File and/or SSH Password must be provided.. + + + + + Looks up a localized string similar to The provided passphrase is invalid.. + + + + + Looks up a localized string similar to The certificate authority (CA) does not match.. + + + + + Looks up a localized string similar to The host name does not match the name on the certificate.. + + + + + Looks up a localized string similar to The certificate is not a certificate authority (CA).. + + + + + Looks up a localized string similar to SSL Connection error.. + + + + + Looks up a localized string similar to The stream has already been closed. + + + + + Looks up a localized string similar to The stream does not support reading. + + + + + Looks up a localized string similar to The stream does not support writing. + + + + + Looks up a localized string similar to String can't be empty.. + + + + + Looks up a localized string similar to Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.. + + + + + Looks up a localized string similar to error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.. + + + + + Looks up a localized string similar to All server connection attempts were aborted. Timeout of {0} seconds was exceeded for each selected server.. + + + + + Looks up a localized string similar to TLSv1.3 is supported in .NET Framework 4.8 or .NET Core 3.0.. + + + + + Looks up a localized string similar to No supported TLS protocol version found in the 'tls-versions' list.. + + + + + Looks up a localized string similar to {0}: Connection Closed. + + + + + Looks up a localized string similar to Unable to trace. There are more than Int32.MaxValue connections in use.. + + + + + Looks up a localized string similar to {0}: Error encountered during row fetch. Number = {1}, Message={2}. + + + + + Looks up a localized string similar to {0}: Connection Opened: connection string = '{1}'. + + + + + Looks up a localized string similar to {0}: Error encountered attempting to open result: Number={1}, Message={2}. + + + + + Looks up a localized string similar to {0}: Query Closed. + + + + + Looks up a localized string similar to {0}: Query Normalized: {2}. + + + + + Looks up a localized string similar to {0}: Query Opened: {2}. + + + + + Looks up a localized string similar to {0}: Resultset Opened: field(s) = {1}, affected rows = {2}, inserted id = {3}. + + + + + Looks up a localized string similar to {0}: Resultset Closed. Total rows={1}, skipped rows={2}, size (bytes)={3}. + + + + + Looks up a localized string similar to {0}: Set Database: {1}. + + + + + Looks up a localized string similar to {0}: Statement closed: statement id = {1}. + + + + + Looks up a localized string similar to {0}: Statement executed: statement id = {1}. + + + + + Looks up a localized string similar to {0}: Statement prepared: sql='{1}', statement id={2}. + + + + + Looks up a localized string similar to {0}: Usage Advisor Warning: Query is using a bad index. + + + + + Looks up a localized string similar to {0}: Usage Advisor Warning: The field '{2}' was converted to the following types: {3}. + + + + + Looks up a localized string similar to {0}: Usage Advisor Warning: Query does not use an index. + + + + + Looks up a localized string similar to {0}: Usage Advisor Warning: The following columns were not accessed: {2}. + + + + + Looks up a localized string similar to {0}: Usage Advisor Warning: Skipped {2} rows. Consider a more focused query.. + + + + + Looks up a localized string similar to {0}: MySql Warning: Level={1}, Code={2}, Message={3}. + + + + + Looks up a localized string similar to Type '{0}' is not derived from BaseCommandInterceptor. + + + + + Looks up a localized string similar to Type '{0}' is not derived from BaseExceptionInterceptor. + + + + + Looks up a localized string similar to Unable to connect to any of the specified MySQL hosts.. + + + + + Looks up a localized string similar to Unable to create plugin for authentication method '{0}'. Please see inner exception for details.. + + + + + Looks up a localized string similar to Unable to derive stored routine parameters. The 'Parameters' information schema table is not available and access to the stored procedure body has been disabled.. + + + + + Looks up a localized string similar to Unable to enable query analysis. Be sure the MySql.Data.EMTrace assembly is properly located and registered.. + + + + + Looks up a localized string similar to An error occured attempting to enumerate the user-defined functions. Do you have SELECT privileges on the mysql.func table?. + + + + + Looks up a localized string similar to Unable to execute stored procedure '{0}'.. + + + + + Looks up a localized string similar to There was an error parsing the foreign key definition.. + + + + + Looks up a localized string similar to Error encountered reading the RSA public key.. + + + + + Looks up a localized string similar to Unable to retrieve stored procedure metadata for routine '{0}'. Either grant SELECT privilege to mysql.proc for this user or use "check parameters=false" with your connection string.. + + + + + Looks up a localized string similar to Unable to start a second async operation while one is running.. + + + + + Looks up a localized string similar to Unix sockets are not supported on Windows. + + + + + Looks up a localized string similar to Unknown authentication method '{0}' was requested.. + + + + + Looks up a localized string similar to Unknown connection protocol. + + + + + Looks up a localized string similar to Value '{0}' is not of the correct type.. + + + + + Looks up a localized string similar to The requested column value could not be treated as or conveted to a Guid.. + + + + + Looks up a localized string similar to Windows authentication connections are not supported on {0}. + + + + + Looks up a localized string similar to Writing to the stream failed.. + + + + + Looks up a localized string similar to Parameter '{0}' is not found but a parameter with the name '{1}' is found. Parameter names must include the leading parameter marker.. + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a localized string similar to Appdata path is not defined.. + + + + + Looks up a localized string similar to Authentication failed using MYSQL41 and SHA256_MEMORY. Check the user name and password or try using a secure connection.. + + + + + Looks up a localized string similar to You can't get more sessions because Client is closed.. + + + + + Looks up a localized string similar to Client option '{0}' does not support value '{1}'.. + + + + + Looks up a localized string similar to Client option '{0}' is not recognized as valid.. + + + + + Looks up a localized string similar to {0} '{1}' does not exist in schema '{2}'.. + + + + + Looks up a localized string similar to '{0}' cannot be set to false with DNS SRV lookup enabled.. + + + + + Looks up a localized string similar to Scheme '{0}' is not valid.. + + + + + + Looks up a localized string similar to Compression using {0} is not supported.. + + + + + Looks up a localized string similar to Failed to load libzstd.dll. Removing zstd_stream from the client supported compression algorithms.. + + + + + Looks up a localized string similar to Compression using {0} is not supported in .NET Framework.. + + + + + Looks up a localized string similar to The connection property 'compression' acceptable values are: 'preferred', 'required' or 'disabled'. The value '{0}' is not acceptable.. + + + + + Looks up a localized string similar to Compression is not enabled.. + + + + + Looks up a localized string similar to Compression requested but the server does not support it.. + + + + + Looks up a localized string similar to There are still decompressed messages pending to be processed.. + + + + + Looks up a localized string similar to Duplicate key '{0}' used in "connection-attributes".. + + + + + Looks up a localized string similar to Key name in connection attribute cannot be an empty string.. + + + + + Looks up a localized string similar to At least one option must be specified.. + + + + + Looks up a localized string similar to This feature is currently not supported.. + + + + + Looks up a localized string similar to This functionality is only supported in MySQL {0} and higher.. + + + + + Looks up a localized string similar to Collation with id '{0}' not found.. + + + + + Looks up a localized string similar to The value of "connection-attributes" must be either a boolean or a list of key-value pairs.. + + + + + Looks up a localized string similar to Connection Data is incorrect.. + + + + + Looks up a localized string similar to The connection string is invalid.. + + + + + Looks up a localized string similar to '{0}' is not a valid connection string attribute.. + + + + + Looks up a localized string similar to The connection timeout value must be a positive integer (including 0).. + + + + + Looks up a localized string similar to Decimal (BCD) format is invalid.. + + + + + Looks up a localized string similar to Field type with name '{0}' not found.. + + + + + Looks up a localized string similar to Index type with name '{0}' not found.. + + + + + Looks up a localized string similar to The value provided is not a valid JSON document. {0}. + + + + + Looks up a localized string similar to {0} is not a valid column name in the row.. + + + + + Looks up a localized string similar to {0} is not a valid index for the row.. + + + + + Looks up a localized string similar to Session state is not valid.. + + + + + Looks up a localized string similar to Invalid Uri . + + + + + Looks up a localized string similar to Invalid uri query value. + + + + + Looks up a localized string similar to Key names in "connection-attributes" cannot start with "_".. + + + + + Looks up a localized string similar to Json configuration must contain 'uri' or 'host' but not both.. + + + + + Looks up a localized string similar to Keyword '{0}' not found.. + + + + + Looks up a localized string similar to Keyword not supported.. + + + + + Looks up a localized string similar to Field '{0}' is mandatory.. + + + + + Looks up a localized string similar to Missed required 'schema' option.. + + + + + Looks up a localized string similar to More than one document id was generated. Please use the DocumentIds property instead.. + + + + + Looks up a localized string similar to There is no data at index {0}. + + + + + Looks up a localized string similar to No 'host' has been specified.. + + + + + Looks up a localized string similar to No more data in resultset.. + + + + + Looks up a localized string similar to Object '{0}' not found. + + + + + Looks up a localized string similar to No placeholders.. + + + + + Looks up a localized string similar to {0} must be a value greater than 0.. + + + + + Looks up a localized string similar to Path not found '{0}'.. + + + + + Looks up a localized string similar to Queue timeout expired. The timeout period elapsed prior to getting a session from the pool.. + + + + + Looks up a localized string similar to Providing a port number as part of the host address isn't supported when using connection strings in basic format or anonymous objects. Use URI format instead.. + + + + + Looks up a localized string similar to You must either assign no priority to any of the hosts or give a priority for every host.. + + + + + Looks up a localized string similar to The priority must be between 0 and 100.. + + + + + Looks up a localized string similar to ProgramData path is not defined.. + + + + + Looks up a localized string similar to The server doesn't support the requested operation. Please update the MySQL Server and/or Client library. + + + + + Looks up a localized string similar to The process of closing the resultset and resulted in results being lost.. + + + + + Looks up a localized string similar to All server connection attempts were aborted. Timeout of {0} milliseconds was exceeded for each selected server.. + + + + + Looks up a localized string similar to All server connection attempts were aborted. Timeout was exceeded for each selected server.. + + + + + Looks up a localized string similar to Connection attempt to the server was aborted. Timeout of {0} milliseconds was exceeded.. + + + + + Looks up a localized string similar to Connection attempt to the server was aborted. Timeout was exceeded.. + + + + + Looks up a localized string similar to Unable to connect to any specified host.. + + + + + Looks up a localized string similar to Unable to read or decode data value.. + + + + + Looks up a localized string similar to Unable to open a session.. + + + + + Looks up a localized string similar to Unexpected end of packet found while reading data values. + + + + + Looks up a localized string similar to Field name '{0}' is not allowed.. + + + + + Looks up a localized string similar to Unknown placeholder :{0}. + + + + + Looks up a localized string similar to Value '{0}' is not of the correct type.. + + + + + Summary description for MySqlUInt64. + + + + + An exception thrown by MySQL when a type conversion does not succeed. + + + + Initializes a new instance of the class with a specified error message. + Message describing the error. + + + + Represents a datetime data type object in a MySql database. + + + + + Defines whether the UTF or local timezone will be used. + + + + + Constructs a new MySqlDateTime object by setting the individual time properties to + the given values. + + The year to use. + The month to use. + The day to use. + The hour to use. + The minute to use. + The second to use. + The microsecond to use. + + + + Constructs a new MySqlDateTime object by using values from the given object. + + The object to copy. + + + + Constructs a new MySqlDateTime object by copying the current value of the given object. + + The MySqlDateTime object to copy. + + + + Enables the contruction of a MySqlDateTime object by parsing a string. + + + + + Indicates if this object contains a value that can be represented as a DateTime + + + + Returns the year portion of this datetime + + + Returns the month portion of this datetime + + + Returns the day portion of this datetime + + + Returns the hour portion of this datetime + + + Returns the minute portion of this datetime + + + Returns the second portion of this datetime + + + + Returns the milliseconds portion of this datetime + expressed as a value between 0 and 999 + + + + + Returns the microseconds portion of this datetime (6 digit precision) + + + + + Returns true if this datetime object has a null value + + + + + Retrieves the value of this as a DateTime object. + + + + Returns this value as a DateTime + + + Returns a MySQL specific string representation of this value + + + + + + + + + Represents a decimal data type object in a MySql database. + + + + + Gets a boolean value signaling if the type is null. + + + + + Gets or sets the decimal precision of the type. + + + + + Gets or sets the scale of the type. + + + + + Gets the decimal value associated to this type. + + + + + Converts this decimal value to a double value. + + The value of this type converted to a dobule value. + + + + Represents a geometry data type object in a MySql database. + + + + + Gets the x coordinate. + + + + + Gets the y coordinate. + + + + + Gets the SRID value. + + + + + Gets a boolean value that signals if the type is null. + + + + + Gets the value associated to this type. + + + + + Gets the value associated to this type. + + + + Returns the Well-Known Text representation of this value + POINT({0} {1})", longitude, latitude + http://dev.mysql.com/doc/refman/4.1/en/gis-wkt-format.html + + + + Get value from WKT format + SRID=0;POINT (x y) or POINT (x y) + + WKT string format + + + + Try to get value from WKT format + SRID=0;POINT (x y) or POINT (x y) + + WKT string format + Out mysqlGeometryValue + + + + Sets the DSInfo when GetSchema is called for the DataSourceInformation collection. + + + + + Gets the well-known text representation of the geomtry object. + + A string representation of the WKT. + + + + Provides functionality for loading unmanaged libraries. + + + + + Loads the specified unmanaged library from the embedded resources. + + The application name. + The library name. + + + + Provides support for configuring X Protocol compressed messages. + + + + + The capabilities sub-key used to specify the compression algorithm. + + + + + The capabilities key used to specify the compression capability. + + + + + Messages with a value lower than this threshold will not be compressed. + + + + + Default value for enabling or disabling combined compressed messages. + + + + + Default value for the maximum number of combined compressed messages contained in a compression message. + + + + + deflate_stream compression algorithm. + + + + + lz4_message compression algorithm. + + + + + The capabilities sub-key used to specify if combining compressed messages is permitted. + + + + + The capabilities sub-key used to specify the maximum number of compressed messages contained in a compression message. + + + + + zstd_stream compression algorithm. + + + + + Buffer used to store the data received from the server. + + + + + Deflate stream used for compressing data. + + + + + Deflate stream used for decompressing data. + + + + + Flag indicating if the initialization is for compression or decompression. + + + + + Stores the communication packet generated the last time ReadNextBufferedMessage method was called. + + + + + Indicates if the libzstd.dll has been loaded. + + + + + Stream used to store multiple X Protocol messages. + + + + + ZStandard stream used for decompressing data. + + + + + Static constructor used to initialize the client supported compression algorithms. + + + + + Main constructor used to set the compression algorithm and initialize the list of messages to + be compressed by the client. + + The compression algorithm to use. + Flag indicating if the initialization is for compression or decompression. + + + + Gets or sets the list of messages that should be compressed by the client when compression is enabled. + + + + + Gets or sets an array containing the compression algorithms supported by the client. + + + + + Gets or sets the compression algorithm. + + + + + Flag indicating if compression is enabled. + + + + + Flag indicating if the last decompressed message contains multiple messages. + + + + + General method used to compress data using the compression algorithm defined in the constructor. + + The data to compress. + A compressed byte array. + + + + Compresses data using the deflate_stream algorithm. + + The data to compress. + A compressed byte array. + + + + Compresses data using the lz4_message algorithm. + + The data to compress. + A compressed byte array. + + + + Compresses data using the zstd_stream algorithm. + + The data to compress. + A compressed byte array. + + + + General method used to decompress data using the compression algorithm defined in the constructor. + + The data to decompress. + The expected length of the decompressed data. + A decompressed byte array. + + + + Decompresses data using the deflate_stream compression algorithm. + + The data to decompress. + The expected length of the decompressed data. + A decompressed byte array. + + + + Decompresses data using the lz4_message compression algorithm. + + The data to decompress. + The expected length of the decompressed data. + A decompressed byte array. + + + + Decompresses data using the zstd_stream compression algorithm. + + The data to decompress. + The expected length of the decompressed data. + A decompressed byte array. + + + + Closes and disposes of any open streams. + + + + + Gets the byte array representing the next X Protocol frame that is stored in cache. + + A byte array representing an X Protocol frame. + + + + Gets a representing the next X Protocol frame that is stored in cache. + + A with the next X Protocol frame. + + + + Loads the libzstd.dll assembly. + + + + + This object store the required parameters to create a Collection with schema validation. + + If false, throws an exception if the collection exists. + Object which hold the Level and Schema parameters + + + + + This object store the required parameters to Modify a Collection with schema validation. + + Object which hold the Level and Schema parameters + + + + + This object store the required parameters to create a Collection with schema validation. + + It can be STRICT to enable schema validation or OFF to disable + The JSON which define the rules to be validated in the collection + + + + The possible values for parameter Level in Validation object. + + Enforce schema validation. + Schema validation disabled. + + + + Implementation of EXTERNAL authentication type. + + + + + Implementation of MySQL41 authentication type. + + + + + Implementation of PLAIN authentication type. + + + + + Compares two Guids in string format. + + The first string to compare. + The first string to compare. + An integer that indicates the lexical relationship between the two comparands, similar to + + + + Compares two objects. + + The first to compare. + The second to compare. + An integer that indicates the lexical relationship between the two comparands, similar to + + + + Constructor that sets the stream used to read or write data. + + The stream used to read or write data. + + + + Constructor that sets the stream used to read or write data and the compression controller. + + The stream used to read or write data. + The compression controller. + + + + Gets or sets the compression controller uses to manage compression operations. + + + + + Writes X Protocol frames to the X Plugin. + + The integer representation of the client message identifier used for the message. + The message to include in the X Protocol frame. + + + + Writes X Protocol frames to the X Plugin. + + The client message identifier used for the message. + The message to include in the X Protocol frame. + + + + Reads X Protocol frames incoming from the X Plugin. + + A instance representing the X Protocol frame that was read. + + + + Abstract class for the protocol base operations in client/server communication. + + + + + Expression parser for MySQL-X protocol. + + + string being parsed. + + + Token stream produced by lexer. + + + Parser's position in token stream. + + + Mapping of names to positions for named placeholders. Used for both string values ":arg" and numeric values ":2". + + + Number of positional placeholders. + + + Are relational columns identifiers allowed? + + + Token types used by the lexer. + + + Token. Includes type and string value of the token. + + + Mapping of reserved words to token types. + + + Does the next character equal the given character? (respects bounds) + + + Helper function to match integer or floating point numbers. This function should be called when the position is on the first character of the number (a + digit or '.'). + + @param i The current position in the string + @return the next position in the string after the number. + + + Lexer for MySQL-X expression language. + + + Assert that the token at pos is of type type. + + + Does the current token have type `t'? + + + Does the next token have type `t'? + + + Does the token at position `pos' have type `t'? + + + Consume token. + + @return the string value of the consumed token + + + Parse a paren-enclosed expression list. This is used for function params or IN params. + + @return a List of expressions + + + Parse a function call of the form: IDENTIFIER PAREN_EXPR_LIST. + + @return an Expr representing the function call. + + + Parse an identifier for a function call: [schema.]name + + + Parse a document path member. + + + Parse a document path array index. + + + Parse a JSON-style document path, like WL#7909, but prefix by @. instead of $. + + + Parse a document field. + + + Parse a column identifier (which may optionally include a JSON document path). + + + Build a unary operator expression. + + + Parse an atomic expression. (c.f. grammar at top) + + + Parse a left-associated binary operator. + + @param types + The token types that denote this operator. + @param innerParser + The inner parser that should be called to parse operands. + @return an expression tree of the binary operator or a single operand + + + Parse the entire string as an expression. + + @return an X-protocol expression tree + + + + Parse an ORDER BY specification which is a comma-separated list of expressions, each may be optionally suffixed by ASC/DESC. + + + Parse a SELECT projection which is a comma-separated list of expressions, each optionally suffixed with a target alias. + + + Parse an INSERT field name. + @todo unit test + + + Parse an UPDATE field which can include can document paths. + + + Parse a document projection which is similar to SELECT but with document paths as the target alias. + + + Parse a list of expressions used for GROUP BY. + + + @return the number of positional placeholders in the expression. + + + @return a mapping of parameter names to positions. + + + Proto-buf helper to build a LITERAL Expr with a Scalar NULL type. + + + Proto-buf helper to build a LITERAL Expr with a Scalar DOUBLE type (wrapped in Any). + + + Proto-buf helper to build a LITERAL Expr with a Scalar SINT (signed int) type (wrapped in Any). + + + Proto-buf helper to build a LITERAL Expr with a Scalar UINT (unsigned int) type (wrapped in Any). + + + Proto-buf helper to build a LITERAL Expr with a Scalar STRING type (wrapped in Any). + + + Proto-buf helper to build a LITERAL Expr with a Scalar OCTETS type (wrapped in Any). + + + Proto-buf helper to build a LITERAL Expr with a Scalar BOOL type (wrapped in Any). + + + Wrap an Any value in a LITERAL expression. + + + Build an Any with a string value. + + + + Parses an anonymous object into a dictionary. + + The object to parse. + A dictionary if the provided object is an anonymous object; otherwise, null. + + + List of operators which will be serialized as infix operators. + + + Scalar to string. + + + JSON document path to string. + + + Column identifier (or JSON path) to string. + + + Function call to string. + + + Create a string from a list of (already stringified) parameters. Surround by parens and separate by commas. + + + Convert an operator to a string. Includes special cases for chosen infix operators (AND, OR) and special forms such as LIKE and BETWEEN. + + + Escape a string literal. + + + Quote a named identifer. + + + Serialize an expression to a string. + + + + Build the message to be sent to MySQL Server to execute statement "Create" or "Modify" collection with schema options + + The namespace + The name of the command to be executed on MySql Server + Array of KeyValuePairs with the parameters required to build the message + void. + + + + Sends the delete documents message + + + + + Sends the CRUD modify message + + + + + Class implementation for a default communication kind. + + + + + Constructor method for the communication routing service + + A MySqlXConnectionStringBuilder setted with the information to use in the connection + + + + Gets the current connection base on the connection mode + + One of the values of ConnectionMode Offline, ReadOnly, WriteOnly, ReadWrite + + + + + Abstract class used to define the kind of server in environments with multiple types of distributed systems. + + + + + Main class for parsing json strings. + + + + + Initializes a new instance of the JsonParser class. + + + + + Parses the received string into a dictionary. + + The string to parse. + A object that represents the parsed string. + + + + Abstract class to manage and encapsulate one or more actual connections. + + + + + Creates a new session object with the values of the settings parameter. + + Settings to be used in the session object + + + + Sets the connection's charset default collation. + + The opened session. + The character set. + + + + Gets the version of the server. + + An instance of containing the server version. + + + + Gets the thread Id of the connection. + + Thread Id + + + + Implementation class for object that manages low-level work of queuing tasks onto threads. + + + + + Implementation class of InternalSession to manage connections using the Xprotocol type object. + + + + + Defines the compression controller that will be passed on the instance when + compression is enabled. + + + + + Defines the compression controller that will be passed on the instance when + compression is enabled. + + + + + The used client to handle SSH connections. + + + + + Negotiates compression capabilities with the server. + + An array containing the compression algorithms supported by the server. + + + + Prepare the dictionary of arguments required to create a MySQL message. + + The name of the MySQL schema. + The name of the collection. + This object hold the parameters required to create the collection. + + Collection referente. + + + + Prepare the dictionary of arguments required to Modify a MySQL message. + + The name of the MySQL schema. + The name of the collection. + This object hold the parameters required to Modify the collection. + + Collection referente. + + + + Gets the compression algorithm being used to compress or decompress data. + + Flag to indicate if the compression algorithm should be + retrieved from the reader or writer controller. + The name of the compression algorithm being used if any. + null if no compression algorithm is being used. + + + + Represents a base class for a Session. + + + + + Flag to set if prepared statements are supported. + + + + + Gets the connection settings for this session. + + + + + Gets the currently active schema. + + + + + Gets the default schema provided when creating the session. + + + + + Gets the connection uri representation of the connection options provided during the creation of the session. + + + + + Initializes a new instance of the BaseSession class based on the specified connection string. + + The connection used to create the session. + is null. + Unable to parse the when + in URI format. + + When using Unix sockets the protocol=unix or protocol=unixsocket connection option is required. + This will enable elements passed in the server connection option to be treated as Unix sockets. The user is also required + to explicitly set sslmode to none since X Plugin does not support SSL when using Unix sockets. Note that + protocol=unix and protocol=unixsocket are synonyms. +   + Multiple hosts can be specified as part of the , + which enables client-side failover when trying to establish a connection. +   + Connection URI examples: + - mysqlx://test:test@[192.1.10.10,localhost] + - mysqlx://test:test@[192.1.10.10,127.0.0.1] + - mysqlx://root:@[../tmp/mysqlx.sock,/tmp/mysqld.sock]?protocol=unix&sslmode=none + - mysqlx://test:test@[192.1.10.10:33060,127.0.0.1:33060] + - mysqlx://test:test@[192.1.10.10,120.0.0.2:22000,[::1]:33060]/test?connectiontimeout=10 + - mysqlx://test:test@[(address=server.example,priority=20),(address=127.0.0.1,priority=100)] + - mysqlx://test:test@[(address=server.example,priority=100),(address=127.0.0.1,priority=75),(address=192.0.10.56,priority=25)] + +   + Connection string examples: + - server=10.10.10.10,localhost;port=33060;uid=test;password=test; + - host=10.10.10.10,192.101.10.2,localhost;port=5202;uid=test;password=test; + - host=./tmp/mysqld.sock,/var/run/mysqldx.sock;port=5202;uid=root;protocol=unix;sslmode=none; + - server=(address=server.example,priority=20),(address=127.0.0.1,priority=100);port=33060;uid=test;password=test; + - server=(address=server.example,priority=100),(address=127.0.0.1,priority=75),(address=192.0.10.56,priority=25);port=33060;uid=test;password=test; + +   + Failover methods + - Sequential: Connection attempts will be performed in a sequential order, that is, one after another until + a connection is successful or all the elements from the list have been tried. + + - Priority based: If a priority is provided, the connection attemps will be performed in descending order, starting + with the host with the highest priority. Priority must be a value between 0 and 100. Additionally, it is required to either + give a priority for every host or no priority to any host. + + + + + + Initializes a new instance of the BaseSession class based on the specified anonymous type object. + + The connection data as an anonymous type used to create the session. + is null. + + Multiple hosts can be specified as part of the , which enables client-side failover when trying to + establish a connection. +   + To assign multiple hosts, create a property similar to the connection string examples shown in + . Note that the value of the property must be a string. + + + + + + Drops the database/schema with the given name. + + The name of the schema. + is null. + + + + Creates a schema/database with the given name. + + The name of the schema/database. + A object that matches the recently created schema/database. + + + + Gets the schema with the given name. + + The name of the schema. + A object set with the provided schema name. + + + + Gets a list of schemas (or databases) in this session. + + A list containing all existing schemas (or databases). + + + + Starts a new transaction. + + + + + Commits the current transaction. + + A object containing the results of the commit operation. + + + + Rolls back the current transaction. + + + + + Closes this session or releases it to the pool. + + + + + Closes this session + + + + + Sets a transaction savepoint with an autogenerated name. + + The autogenerated name of the transaction savepoint. + + + + Sets a named transaction savepoint. + + The name of the transaction savepoint. + The name of the transaction savepoint. + + + + Removes the named savepoint from the set of savepoints within the current transaction. + + The name of the transaction savepoint. + + + + Rolls back a transaction to the named savepoint without terminating the transaction. + + The name of the transaction savepoint. + + + + Parses the connection data. + + The connection string or connection URI. + An updated connection string representation of the provided connection string or connection URI. + + + + Parses a connection URI. + + The connection URI to parse. + The connection string representation of the provided . + + + + Validates if the string provided is a Unix socket file. + + The Unix socket to evaluate. + true if is a valid Unix socket; otherwise, false. + + + + Converts the URI object into a connection string. + + An instance with the values for the provided connection options. + The path of the Unix socket file. + If true the replaces the value for the server connection option; otherwise, false + A connection string. + + + + Parses a connection string. + + The connection string to parse. + The parsed connection string. + + + + Normalizes the Unix socket by removing leading and ending parenthesis as well as removing special characters. + + The Unix socket to normalize. + A normalized Unix socket. + + + + Disposes the current object. Disposes of the managed state if the flag is set to true. + + Flag to indicate if the managed state is to be disposed. + + + + Disposes the current object. Code added to correctly implement the disposable pattern. + + + + + Describes the state of the session. + + + + + The session is closed. + + + + + The session is open. + + + + + The session object is connecting to the data source. + + + + + The session object is executing a command. + + + + + Class encapsulating a session pooling functionality. + + + + + Queue of demoted hosts. + + + + + List of hosts that will be attempted to connect to. + + + + + Timer to be used when a host have been demoted. + + + + + Remove hosts from the demoted list that have already been there for more + than 120,000 milliseconds and add them to the available hosts list. + + + + + Get a session from pool or create a new one. + + + + + + Closes all sessions the Client object created and destroys the managed pool. + + + + + Represents a collection of documents. + + + + + Creates an containing the provided objects that can be used to add + one or more items to a collection. + + The objects to add. + An object containing the objects to add. + is null. + This method can take anonymous objects, domain objects, or just plain JSON strings. + The statement can be further modified before execution. + + + + Creates a with the given condition that can be used to remove + one or more documents from a collection.The statement can then be further modified before execution. + + The condition to match documents. + A object set with the given condition. + is null or white space. + The statement can then be further modified before execution. + + + + Removes the document with the given identifier. + + The unique identifier of the document to replace. + A object containing the results of the execution. + is null or white space. + This is a direct execution method. + + + + Creates a with the given condition that can be used to modify one or more + documents from a collection. + + The condition to match documents. + A object set with the given condition. + is null or white space. + The statement can then be further modified before execution. + + + + Replaces the document matching the given identifier. + + The unique identifier of the document to replace. + The document to replace the matching document. + A object containing the results of the execution. + is null or whitespace. + is null. + This is a direct execution method. Operation succeeds even if no matching document was found; + in which case, the Result.RecordsAffected property is zero. If the new document contains an identifier, the value + is ignored. + + + + Adds the given document to the collection unless the identifier or any other field that has a unique index + already exists, in which case it will update the matching document. + + The unique identifier of the document to replace. + The document to replace the matching document. + A object containing the results of the execution. + The server version is lower than 8.0.3. + is null or white space. + is null. + The is different from the one in . + This is a direct execution method. + + + + Returns the number of documents in this collection on the server. + + The number of documents found. + + + + Creates a with the given condition which can be used to find documents in a + collection. + + An optional condition to match documents. + A object set with the given condition. + The statement can then be further modified before execution. + + + + Creates an index based on the properties provided in the JSON document. + + The index name. + JSON document describing the index to be created. + + is a JSON document with the following fields: + + - fields: array of IndexField objects, each describing a single document member to be + included in the index (see below). + - type: string, (optional) the type of index. One of INDEX or SPATIAL. Default is INDEX and may + be omitted. + +   + A single IndexField description consists of the following fields: + + - field: string, the full document path to the document member or field to be indexed. + - type: string, one of the supported SQL column types to map the field into (see the following list). + For numeric types, the optional UNSIGNED keyword may follow. For the TEXT type, the length to consider for + indexing may be added. + - required: bool, (optional) true if the field is required to exist in the document. defaults to + false, except for GEOJSON where it defaults to true. + - options: int, (optional) special option flags for use when decoding GEOJSON data. + - srid: int, (optional) srid value for use when decoding GEOJSON data. + +   + Supported SQL column types: + + - INT [UNSIGNED] + - TINYINT [UNSIGNED] + - SMALLINT [UNSIGNED] + - MEDIUMINT [UNSIGNED] + - INTEGER [UNSIGNED] + - BIGINT [UNSIGNED] + - REAL [UNSIGNED] + - FLOAT [UNSIGNED] + - DOUBLE [UNSIGNED] + - DECIMAL [UNSIGNED] + - NUMERIC [UNSIGNED] + - DATE + - TIME + - TIMESTAMP + - DATETIME + - TEXT[(length)] + - CHAR[(lenght)] + - GEOJSON (extra options: options, srid) + + + + + + Drops a collection index. + + The index name. + is null or white space. + + + + Verifies if the current collection exists in the server schema. + + true if the collection exists; otherwise, false. + + + + Returns the document with the given identifier. + + The unique identifier of the document to replace. + A object if a document matching given identifier exists; otherwise, null. + is null or white space. + This is a direct execution method. + + + + Base abstract class that defines elements inherited by all result types. + + + + + Gets the number of records affected by the statement that generated this result. + + + + + Gets the object of the session. + + + + + Gets a read-only collection of objects derived from statement execution. + + + + + Gets the number of warnings in the collection derived from statement execution. + + + + + No action is performed by this method. It is intended to be overriden by child classes if required. + + + + + Base abstract class for API statement. + + + + + + Initializes a new instance of the BaseStatement class based on the specified session. + + The session where the statement will be executed. + + + + Gets the that owns the statement. + + + + + Executes the base statements. This method is intended to be defined by child classes. + + A result object containing the details of the execution. + + + + Executes a statement asynchronously. + + A result object containing the details of the execution. + + + + Validates if the session is open and valid. + + + + + Sets the status as Changed for prepared statement validation. + + + + + Converts a statement to prepared statement for a second execution + without any change but Bind, Limit, or Offset. + + + + + Abstract class for buffered results. + + Generic result type. + + + + Index of the current item. + + + + + List of generic items in this buffered result. + + + + + Flag that indicates if all items have been read. + + + + + Gets a dictionary containing the column names and their index. + + + + + Gets the page size set for this buffered result. + + + + + Loads the column data into the field. + + + + + Retrieves a read-only list of the generic items associated to this buffered result. + + A generic list representing items in this buffered result. + + + + Retrieves one element from the generic items associated to this buffered result. + + A generic object that corresponds to the current or default item. + + + + Determines if all items have already been read. + + True if all items have been retrived, false otherwise. + + + + Gets the current item. + + All items have already been read. + + + + Determines if all items have already been read. + + True if all items have been retrived, false otherwise. + + + + Resets the value of the field to zero. + + + + + Gets an representation of this object. + + An representation of this object. + + + + Gets an representation of this object. + + An representation of this object. + + + + Retrieves a read-only list of the generic items associated to this buffered result. + + A generic list representing items in this buffered result. + + + + No body has been defined for this method. + + + + + Class to represent an error in this result. + + + + + Numeric code. + + + + + Return code indicating the outcome of the executed SQL statement. + + + + + Error message. + + + + + Initializes a new instance of the ErrorInfo class. + + + + + Abstract class for filterable statements. + + The filterable statement. + The database object. + The type of result. + + + + Initializes a new instance of the FiltarableStatement class based on the target and condition. + + The database object. + The optional filter condition. + + + + Enables the setting of Where condition for this operation. + + The Where condition. + The implementing statement type. + + + + Sets the number of items to be returned by the operation. + + The number of items to be returned. + The implementing statement type. + is equal or lower than 0. + + + + Sets the number of items to be skipped before including them into the result. + + The number of items to be skipped. + The implementing statement type. + + + + Binds the parameter values in filter expression. + + The parameter name. + The value of the parameter. + A generic object representing the implementing statement type. + + + + Binds the parameter values in filter expression. + + The parameters as a DbDoc object. + A generic object representing the implementing statement type. + + + + Binds the parameter values in filter expression. + + The parameters as a JSON string. + The implementing statement type. + + + + Binds the parameter values in filter expression. + + The parameters as an anonymous object: new { param1 = value1, param2 = value2, ... }. + The implementing statement type. + + + + Executes the statement. + + The function to execute. + The generic object to use. + A generic result object containing the results of the execution. + + + + Clones the filterable data but Session and Target remain the + same. + + A clone of this filterable statement. + + + + Represents a general statement result. + + + + + Gets the last inserted identifier (if there is one) by the statement that generated this result. + + + + + Gets the list of generated identifiers in the order of the Add() calls. + + + + + Abstract class to select a database object target. + + The database object. + The execution result. + + + + Initializes a new instance of the TargetedBaseStatement class based on the provided target. + + The database object. + + + + Gets the database target. + + + + + Represents a warning in this result. + + + + + Numeric value associated to the warning message. + + + + + Error message. + + + + + Strict level for the warning. + + + + + Initializes a new instance of the WarningInfo class based on the code and msg. + + The code for the warning. + The error message for the warning. + + + + Represents a chaining collection insert statement. + + + + + Adds documents to the collection. + + The documents to add. + This object. + The array is null. + + + + Executes the Add statement. + + A object containing the results of the execution. + + + + Implementation class for CRUD statements with collections using an index. + + + + + Executes this statement. + + A object containing the results of the execution. + + + + Represents a collection statement. + + + + + + Converts base s into objects. + + Array of objects to be converted to objects. + An enumerable collection of objects. + + + + Represents the result of an operation that includes a collection of documents. + + + + + Represents a chaining collection find statement. + + + + + List of column projections that shall be returned. + + List of columns. + This object set with the specified columns or fields. + + + + Executes the Find statement. + + A object containing the results of execution and data. + + + + Locks matching rows against updates. + + Optional row lock option to use. + This same object set with the lock shared option. + The server version is lower than 8.0.3. + + + + Locks matching rows so no other transaction can read or write to it. + + Optional row lock option to use. + This same object set with the lock exclusive option. + The server version is lower than 8.0.3. + + + + Sets the collection aggregation. + + The field list for aggregation. + This same object set with the specified group-by criteria. + + + + Filters criteria for aggregated groups. + + The filter criteria for aggregated groups. + This same object set with the specified filter criteria. + + + + Sets user-defined sorting criteria for the operation. The strings use normal SQL syntax like + "order ASC" or "pages DESC, age ASC". + + The order criteria. + A generic object representing the implementing statement type. + + + + Enables the setting of Where condition for this operation. + + The Where condition. + The implementing statement type. + + + + Represents a chaining collection modify statement. + + + + + Sets key and value. + + The document path key. + The new value. + This object. + + + + Changes value for a key. + + The document path key. + The new value. + This object. + + + + Removes keys or values from a document. + + An array of document paths representing the keys to be removed. + This object. + + + + Creates a object set with the changes to be applied to all matching documents. + + The JSON-formatted object describing the set of changes. + A object set with the changes described in . + can be a object, an anonymous object, or a JSON string. + is null. + is null or white space. + + + + Inserts an item into the specified array. + + The document path key including the index on which the item will be inserted. + The value to insert into the array. + A object containing the updated array. + + + + Appends an item to the specified array. + + The document path key. + The value to append to the array. + A object containing the updated array. + + + + Allows the user to set the sorting criteria for the operation. The strings use normal SQL syntax like + "order ASC" or "pages DESC, age ASC". + + The order criteria. + A generic object representing the implementing statement type. + + + + Enables the setting of Where condition for this operation. + + The Where condition. + The implementing statement type. + + + + Executes the modify statement. + + A object containing the results of the execution. + + + + Represents a chaining collection remove statement. + + + + + Sets user-defined sorting criteria for the operation. The strings use normal SQL syntax like + "order ASC" or "pages DESC, age ASC". + + The order criteria. + A generic object representing the implementing statement type. + + + + Enables the setting of Where condition for this operation. + + The Where condition. + The implementing statement type. + + + + Executes the remove statement. + + A object containing the results of the execution. + + + + Represents a database object. + + + + + Gets the session that owns the database object. + + + + + Gets the schema that owns the database object. + + + + + Gets the database object name. + + + + + Verifies that the database object exists in the database. + + True if the object exists in database, false otherwise. + + + + Represents a generic document in JSON format. + + + + + Initializes a new instance of the DbDoc class based on the object provided. The value can be a domain object, anonymous object, or JSON string. + + The value for this DbDoc. + + + + Gets the value of a document property. + + The key path for the property. + + + + + Gets the identifier of the document. + + + + + Gets a value indicating if this document has an identifier (property named _id with a value). + + + + + Sets a property on this document. + + The key of the property. + The new property value. + + + + Returns this document in Json format. + + A Json formatted string. + + + + Compares this DbDoc with another one. + + The DbDoc to compare to. + True if they are equal, false otherwise. + + + + Gets a value that serves as a hash function for a particular type. + + A hash code for the current object. + + + + Represents a collection of documents with a generic type. + + + + + Initializes a new instance of the generic Collection class based on the specified schema + and name. + + The object associated to this collection. + The name of the collection. + + + + Creates an containing the provided generic object. The add + statement can be further modified before execution. + + The generic object to add. + An object containing the object to add. + + + + Defines elements that allow to iterate through the contents of various items. + + + + + Initializes a new instance of the Iterator class. + + + + + This method is not yet implemented. + + + + Exception is always thrown since the body of the method is not yet implemented. + + + + Main class for session operations related to Connector/NET implementation of the X DevAPI. + + + + + Opens a session to the server given or to the first available server if multiple servers were specified. + + The connection string or URI string format. + A object representing the established session. + Multiple hosts can be specified as part of the which + will enable client side failover when trying to establish a connection. For additional details and syntax + examples refer to the remarks section. + + + + Opens a session to the server given. + + The connection data for the server. + A object representing the established session. + + + + Creates a new instance. + + The connection string or URI string format. + The connection options in JSON string format. + A object representing a session pool. + + + + Creates a new instance. + + The connection string or URI string format. + The connection options in object format. + + + new { pooling = new + { + enabled = true, + maxSize = 15, + maxIdleTime = 60000, + queueTimeout = 60000 + } + } + + + + A object representing a session pool. + + + + Creates a new instance. + + The connection data. + The connection options in JSON string format. + A object representing a session pool. + + + + Creates a new instance. + + The connection data. + The connection options in object format. + + + new { pooling = new + { + enabled = true, + maxSize = 15, + maxIdleTime = 60000, + queueTimeout = 60000 + } + } + + + + A object representing a session pool. + + + + Enables the creation of connection strings by exposing the connection options as properties. + Contains connection options specific to the X protocol. + + + + + Main constructor. + + + + + Constructor accepting a connection string. + + The connection string. + + + + Readonly field containing a collection of classic protocol and protocol shared connection options. + + + + + Gets or sets the connection timeout. + + + + + Gets or sets the connection attributes. + + + + + Path to a local file containing certificate revocation lists. + + + + + Gets or sets the compression type between client and server. + + + + + Gets or sets a connection option. + + The keyword that identifies the connection option to modify. + + + + Represents a table column. + + + + + Gets the original column name. + + + + + Gets the alias of the column name. + + + + + Gets the table name the column orginates from. + + + + + Gets the alias of the table name . + + + + + Gets the schema name the column originates from. + + + + + Gets the catalog the schema originates from. + In MySQL protocol this is `def` by default. + + + + + Gets the collation used for this column. + + + + + Gets the character set used for this column. + + + + + Gets the column length. + + + + + Gets the fractional decimal digits for floating point and fixed point numbers. + + + + + Gets the Mysql data type. + + + + + Gets the .NET Clr data type. + + + + + True if it's a signed number. + + + + + True if column is UINT zerofill or BYTES rightpad. + + + + + Initializes a new instance of the Column class. + + + + + Represents a resultset that contains rows of data. + + + + + Gets the columns in this resultset. + + + + + Gets the number of columns in this resultset. + + + + + Gets a list containing the column names in this resultset. + + + + + Gets the rows of this resultset. This collection will be incomplete unless all the rows have been read + either by using the Next method or the Buffer method. + + + + + Gets the value of the column value at the current index. + + The column index. + The CLR value at the column index. + + + + Allows getting the value of the column value at the current index. + + The column index. + The CLR value at the column index. + + + + Returns the index of the given column name. + + The name of the column to find. + The numeric index of column. + + + + Represents a single row of data in a table. + + + + + Gets the value of the row at the given index. + + The column index to retrieve the value. + The value at the index. + + + + Gets the value of the column as a string. + + The name of the column. + The value of the column as a string. + + + + Gets a string based indexer into the row. Returns the value as a CLR type. + + The column index to get. + The CLR value for the column. + + + + Inherits from . Creates a resultset that contains rows of data. + + + + + Represents a resultset that contains rows of data for relational operations. + + + + + Gets a boolean value indicating if this result has data. + + + + + Moves to next resultset. + + True if there is a new resultset, false otherwise. + + + + Represents a sql statement. + + + + + Initializes a new instance of the SqlStament class bassed on the session and sql statement. + + The session the Sql statement belongs to. + The Sql statement. + + + + Gets the current Sql statement. + + + + + Gets the list of parameters associated to this Sql statement. + + + + + Executes the current Sql statement. + + A object with the resultset and execution status. + + + + Binds the parameters values by position. + + The parameter values. + This set with the binded parameters. + + + + Represents a server Table or View. + + + + + Gets a value indicating whether the object is + a View (True) or a Table (False). + + + + + Creates a set with the columns to select. The table select + statement can be further modified before execution. This method is intended to select a set + of table rows. + + The optional column names to select. + A object for select chain operations. + + + + Creates a set with the fileds to insert to. The table + insert statement can be further modified before exeuction. This method is intended to + insert one or multiple rows into a table. + + The list of fields to insert. + A object for insert chain operations. + + + + Creates a . This method is intended to update table rows + values. + + A object for update chain operations. + + + + Creates a . This method is intended to delete rows from a + table. + + A object for delete chain operations. + + + + Returns the number of rows in the table on the server. + + The number of rows. + + + + Verifies if the table exists in the database. + + true if the table exists; otherwise, false. + + + + Represents a chaining table delete statement. + + + + + Sets user-defined sorting criteria for the operation. The strings use normal SQL syntax like + "order ASC" or "pages DESC, age ASC". + + The order criteria. + A generic object representing the implementing statement type. + + + + Executes the delete statement. + + A object containing the results of the delete execution. + + + + Represents a chaining table insert statement. + + + + + Executes the insert statement. + + A object containing the results of the insert statement. + + + + Values to be inserted. + Multiple rows supported. + + The values to be inserted. + This same object. + + + + Represents a chaining table select statement. + + + + + Executes the select statement. + + A object containing the results of the execution and data. + + + + Locks matching rows against updates. + + Optional row lock option to use. + This same object set with lock shared option. + The server version is lower than 8.0.3. + + + + Locks matching rows so no other transaction can read or write to it. + + Optional row lock option to use. + This same object set with the lock exclusive option. + The server version is lower than 8.0.3. + + + + Sets the table aggregation. + + The column list for aggregation. + This same object set with the specified group-by criteria. + + + + Filters criteria for aggregated groups. + + The filter criteria for aggregated groups. + This same object set with the specified filter criteria. + + + + Sets user-defined sorting criteria for the operation. The strings use normal SQL syntax like + "order ASC" or "pages DESC, age ASC". + + The order criteria. + A generic object that represents the implementing statement type. + + + + Represents a chaining table update statement. + + + + + Executes the update statement. + + A object ocntaining the results of the update statement execution. + + + + Column and value to be updated. + + Column name. + Value to be updated. + This same object. + + + + Sets user-defined sorting criteria for the operation. The strings use normal SQL syntax like + "order ASC" or "pages DESC, age ASC". + + The order criteria. + A generic object that represents the implementing statement type. + + + + Represents a schema or database. + + + + + Session related to current schema. + + + + + Returns a list of all collections in this schema. + + A list representing all found collections. + + + + Returns a list of all tables in this schema. + + A list representing all found tables. + + + + Gets a collection by name. + + The name of the collection to get. + Ensures the collection exists in the schema. + A object matching the given name. + + + + Gets a typed collection object. This is useful for using domain objects. + + The type of collection returned. + The name of collection to get. + A generic object set with the given name. + + + + Gets the given collection as a table. + + The name of the collection. + A object set with the given name. + + + + Gets a table object. Upon return the object may or may not be valid. + + The name of the table object. + A object set with the given name. + + + + Creates a collection. + + The name of the collection to create. + If false, throws an exception if the collection exists. + Collection referente. + + + + Creates a collection including a schema validation. + + The name of the collection to create. + This object hold the parameters required to create the collection. + + Collection referente. + + + + Modify a collection adding or removing schema validation parameters. + + The name of the collection to create. + This object encapsulate the Validation parameters level and schema. + Collection referente. + + + + Drops the given collection. + + The name of the collection to drop. + is null. + + + + Determines if this schema actually exists. + + True if exists, false otherwise. + + + + Represents a single server session. + + + + + Returns a object that can be used to execute the given SQL. + + The SQL to execute. + A object set with the provided SQL. + + + + Sets the schema in the database. + + The schema name to be set. + + + + Executes a query in the database to get the current schema. + + Current database object or null if no schema is selected. + + + Holder for reflection information generated from mysqlx.proto + + + File descriptor for mysqlx.proto + + + + IDs of messages that can be sent from client to the server + + .. note:: + this message is never sent on the wire. It is only used to let ``protoc`` + + * generate constants + * check for uniqueness + + + + Container for nested types declared in the ClientMessages message type. + + + + IDs of messages that can be sent from server to client + + .. note:: + this message is never sent on the wire. It is only used to let ``protoc`` + + * generate constants + * check for uniqueness + + + + Container for nested types declared in the ServerMessages message type. + + + + NOTICE has to stay at 11 forever + + + + + generic Ok message + + + + Field number for the "msg" field. + + + + generic Error message + + A ``severity`` of ``ERROR`` indicates the current message sequence is + aborted for the given error and the session is ready for more. + + In case of a ``FATAL`` error message the client should not expect + the server to continue handling any further messages and should + close the connection. + + :param severity: severity of the error message + :param code: error-code + :param sql_state: SQL state + :param msg: human readable error message + + + + Field number for the "severity" field. + + + Field number for the "code" field. + + + Field number for the "sql_state" field. + + + Field number for the "msg" field. + + + Container for nested types declared in the Error message type. + + + Holder for reflection information generated from mysqlx_connection.proto + + + File descriptor for mysqlx_connection.proto + + + + a Capability + + a tuple of a ``name`` and a :protobuf:msg:`Mysqlx.Datatypes::Any` + + + + Field number for the "name" field. + + + Field number for the "value" field. + + + + Capabilities + + + + Field number for the "capabilities" field. + + + + get supported connection capabilities and their current state + + :returns: :protobuf:msg:`Mysqlx.Connection::Capabilities` or :protobuf:msg:`Mysqlx::Error` + + + + + sets connection capabilities atomically + + only provided values are changed, other values are left unchanged. + If any of the changes fails, all changes are discarded. + + :precond: active sessions == 0 + :returns: :protobuf:msg:`Mysqlx::Ok` or :protobuf:msg:`Mysqlx::Error` + + + + Field number for the "capabilities" field. + + + + announce to the server that the client wants to close the connection + + it discards any session state of the server + + :Returns: :protobuf:msg:`Mysqlx::Ok` + + + + Field number for the "uncompressed_size" field. + + + Field number for the "server_messages" field. + + + Field number for the "client_messages" field. + + + Field number for the "payload" field. + + + Holder for reflection information generated from mysqlx_crud.proto + + + File descriptor for mysqlx_crud.proto + + + + DataModel to use for filters, names, ... + + + + + ViewAlgorithm defines how MySQL Server processes the view + + + + + MySQL chooses which algorithm to use + + + + + the text of a statement that refers to the view and the view definition are merged + + + + + the view are retrieved into a temporary table + + + + + ViewSqlSecurity defines the security context in which the view is going to be + executed, this means that VIEW can be executed with current user permissions or + with permissions of the uses who defined the VIEW + + + + + ViewCheckOption limits the write operations done on a `VIEW` + (`INSERT`, `UPDATE`, `DELETE`) to rows in which the `WHERE` clause is `TRUE` + + + + + the view WHERE clause is checked, but no underlying views are checked + + + + + the view WHERE clause is checked, then checking recurses to underlying views + + + + + column definition + + + + Field number for the "name" field. + + + + optional + + + + Field number for the "alias" field. + + + + optional + + + + Field number for the "document_path" field. + + + + a projection + + :param source: the expression identifying an element from the source data + which can include a column identifier or any expression + :param alias: optional alias. Required for DOCUMENTs (clients may use + the source string as default) + + + + Field number for the "source" field. + + + + required + + + + Field number for the "alias" field. + + + + optional + + + + + collection + + + + Field number for the "name" field. + + + + required + + + + Field number for the "schema" field. + + + + optional + + + + + limit + + :param row_count: maximum rows to filter + :param offset: maximum rows to skip before applying the row_count + + + + Field number for the "row_count" field. + + + + required + + + + Field number for the "offset" field. + + + + optional + + + + + limit expression + + LimitExpr in comparison to Limit, is able to specify that row_count and + offset are placeholders. + This message support expressions of following types Expr/literal/UINT, + Expr/PLACEHOLDER. + + :param row_count: maximum rows to filter + :param offset: maximum rows to skip before applying the row_count + + + + Field number for the "row_count" field. + + + + required + + + + Field number for the "offset" field. + + + + optional + + + + + sort order + + + + Field number for the "expr" field. + + + + required + + + + Field number for the "direction" field. + + + + optional//[ default=ASC ] + + + + Container for nested types declared in the Order message type. + + + + update operations + + :param source: specification of the value to be updated + if data_model is TABLE, a column name may be specified and also a document path, if the column has type JSON + if data_model is DOCUMENT, only document paths are allowed + in both cases, schema and table must be not set + :param operation: the type of operation to be performed + :param value: an expression to be computed as the new value for the operation + + + + Field number for the "source" field. + + + + required + + + + Field number for the "operation" field. + + + + required + + + + Field number for the "value" field. + + + + optional + + + + Container for nested types declared in the UpdateOperation message type. + + + + only allowed for TABLE + + + + + no value (removes the identified path from a object or array) + + + + + sets the new value on the identified path + + + + + replaces a value if the path exists + + + + + source and value must be documents + + + + + insert the value in the array at the index identified in the source path + + + + + append the value on the array at the identified path + + + + + merge JSON object value with the provided patch expression + + + + + Find Documents/Rows in a Collection/Table + + .. uml:: + + client -> server: Find + ... one or more Resultset ... + + :param collection: collection to insert into + :param data_model: datamodel that the operations refer to + :param projection: list of column projections that shall be returned + :param args: values for parameters used in filter expression + :param criteria: filter criteria + :param limit: numbers of rows that shall be skipped and returned (user can set one of: limit, limit_expr) + :param order: sort-order in which the rows/document shall be returned in + :param grouping: column expression list for aggregation (GROUP BY) + :param grouping_criteria: filter criteria for aggregated groups + :param locking: perform row locking on matches + :param locking_options: additional options how to handle locked rows + :param limit_expr: numbers of rows that shall be skipped and returned (user can set one of: limit, limit_expr) + :Returns: :protobuf:msg:`Mysqlx.Resultset::` + + + + Field number for the "collection" field. + + + + required + + + + Field number for the "data_model" field. + + + + optional + + + + Field number for the "projection" field. + + + Field number for the "criteria" field. + + + + optional + + + + Field number for the "args" field. + + + Field number for the "order" field. + + + Field number for the "grouping" field. + + + Field number for the "grouping_criteria" field. + + + + optional + + + + Field number for the "locking" field. + + + + optional + + + + Field number for the "locking_options" field. + + + + optional + + + + Field number for the "limit" field. + + + + optional + + + + Field number for the "limit_expr" field. + + + + optional + + + + Container for nested types declared in the Find message type. + + + + Lock matching rows against updates + + + + + Lock matching rows so no other transaction can read or write to it + + + + + Do not wait to acquire row lock, fail with an error if a requested row is locked + + + + + Do not wait to acquire a row lock, remove locked rows from the result set + + + + + Insert documents/rows into a collection/table + + :param collection: collection to insert into + :param data_model: datamodel that the operations refer to + :param projection: name of the columns to insert data into (empty if data_model is DOCUMENT) + :param row: set of rows to insert into the collection/table (a single expression with a JSON document literal or an OBJECT expression) + :param args: values for parameters used in row expressions + :param upsert: true if this should be treated as an Upsert (that is, update on duplicate key) + :Returns: :protobuf:msg:`Mysqlx.Resultset::` + + + + Field number for the "collection" field. + + + + required + + + + Field number for the "data_model" field. + + + + optional + + + + Field number for the "projection" field. + + + Field number for the "row" field. + + + Field number for the "args" field. + + + Field number for the "upsert" field. + + + + optional//[default = false] + + + + Container for nested types declared in the Insert message type. + + + Field number for the "field" field. + + + + Update documents/rows in a collection/table + + :param collection: collection to change + :param data_model: datamodel that the operations refer to + :param criteria: filter expression to match rows that the operations will apply on + :param args: values for parameters used in filter expression + :param limit: limits the number of rows to match (user can set one of: limit, limit_expr) + :param order: specifies order of matched rows + :param operation: list of operations to be applied. Valid operations will depend on the data_model. + :param limit_expr: limits the number of rows to match (user can set one of: limit, limit_expr) + :Returns: :protobuf:msg:`Mysqlx.Resultset::` + + + + Field number for the "collection" field. + + + + required + + + + Field number for the "data_model" field. + + + + optional + + + + Field number for the "criteria" field. + + + + optional + + + + Field number for the "args" field. + + + Field number for the "order" field. + + + Field number for the "operation" field. + + + Field number for the "limit" field. + + + + optional + + + + Field number for the "limit_expr" field. + + + + optional + + + + + Delete documents/rows from a Collection/Table + + :param collection: collection to change + :param data_model: datamodel that the operations refer to + :param criteria: filter expression to match rows that the operations will apply on + :param args: values for parameters used in filter expression + :param limit: limits the number of rows to match (user can set one of: limit, limit_expr) + :param order: specifies order of matched rows + :param limit_expr: limits the number of rows to match (user can set one of: limit, limit_expr) + :Returns: :protobuf:msg:`Mysqlx.Resultset::` + + + + Field number for the "collection" field. + + + + required + + + + Field number for the "data_model" field. + + + + optional + + + + Field number for the "criteria" field. + + + + optional + + + + Field number for the "args" field. + + + Field number for the "order" field. + + + Field number for the "limit" field. + + + + optional + + + + Field number for the "limit_expr" field. + + + + optional + + + + Field number for the "collection" field. + + + + required + + + + Field number for the "definer" field. + + + + optional + + + + Field number for the "algorithm" field. + + + + optional//[default = UNDEFINED] + + + + Field number for the "security" field. + + + + optional//[default = DEFINER] + + + + Field number for the "check" field. + + + + optional + + + + Field number for the "column" field. + + + Field number for the "stmt" field. + + + + required + + + + Field number for the "replace_existing" field. + + + + optional//[default = false] + + + + Field number for the "collection" field. + + + + required + + + + Field number for the "definer" field. + + + + optional + + + + Field number for the "algorithm" field. + + + + optional + + + + Field number for the "security" field. + + + + optional + + + + Field number for the "check" field. + + + + optional + + + + Field number for the "column" field. + + + Field number for the "stmt" field. + + + + optional + + + + Field number for the "collection" field. + + + + required + + + + Field number for the "if_exists" field. + + + + optional//[ default = false ] + + + + Holder for reflection information generated from mysqlx_cursor.proto + + + File descriptor for mysqlx_cursor.proto + + + + Open a cursor + + .. uml:: + + client -> server: Open + alt Success + ... none or partial Resultsets or full Resultsets ... + client <- server: StmtExecuteOk + else Failure + client <- server: Error + end + + :param cursor_id: client side assigned cursor id, the ID is going to represent new cursor and assigned to it statement + :param stmt: statement which resultset is going to be iterated through the cursor + :param fetch_rows: number of rows which should be retrieved from sequential cursor + :Returns: :protobuf:msg:`Mysqlx.Ok::` + + + + Field number for the "cursor_id" field. + + + + required + + + + Field number for the "stmt" field. + + + + required + + + + Field number for the "fetch_rows" field. + + + + optional + + + + Container for nested types declared in the Open message type. + + + Field number for the "type" field. + + + + required + + + + Field number for the "prepare_execute" field. + + + + optional + + + + Container for nested types declared in the OneOfMessage message type. + + + + Fetch next portion of data from a cursor + + .. uml:: + + client -> server: Fetch + alt Success + ... none or partial Resultsets or full Resultsets ... + client <- server: StmtExecuteOk + else + client <- server: Error + end + + :param cursor_id: client side assigned cursor id, must be already open + :param fetch_rows: number of rows which should be retrieved from sequential cursor + + + + Field number for the "cursor_id" field. + + + + required + + + + Field number for the "fetch_rows" field. + + + + optional + + + + + Close cursor + + .. uml:: + + client -> server: Close + alt Success + client <- server: Ok + else Failure + client <- server: Error + end + + :param cursor_id: client side assigned cursor id, must be allocated/open + :Returns: :protobuf:msg:`Mysqlx.Ok|Mysqlx.Error` + + + + Field number for the "cursor_id" field. + + + + required + + + + Holder for reflection information generated from mysqlx_datatypes.proto + + + File descriptor for mysqlx_datatypes.proto + + + + a scalar + + + + Field number for the "type" field. + + + + required + + + + Field number for the "v_signed_int" field. + + + Field number for the "v_unsigned_int" field. + + + Field number for the "v_octets" field. + + + + 4 is unused, was Null which doesn't have a storage anymore + + + + Field number for the "v_double" field. + + + Field number for the "v_float" field. + + + Field number for the "v_bool" field. + + + Field number for the "v_string" field. + + + Enum of possible cases for the "DefaultOneOf" oneof. + + + Container for nested types declared in the Scalar message type. + + + + a string with a charset/collation + + + + Field number for the "value" field. + + + + required + + + + Field number for the "collation" field. + + + Enum of possible cases for the "String_present" oneof. + + + + an opaque octet sequence, with an optional content_type + See ``Mysqlx.Resultset.ColumnMetadata`` for list of known values. + + + + Field number for the "value" field. + + + + required + + + + Field number for the "content_type" field. + + + + a object + + + + Field number for the "fld" field. + + + Container for nested types declared in the Object message type. + + + Field number for the "key" field. + + + + required + + + + Field number for the "value" field. + + + + required + + + + + a Array + + + + Field number for the "value" field. + + + + a helper to allow all field types + + + + Field number for the "type" field. + + + + required + + + + Field number for the "scalar" field. + + + Field number for the "obj" field. + + + Field number for the "array" field. + + + Container for nested types declared in the Any message type. + + + Holder for reflection information generated from mysqlx_expect.proto + + + File descriptor for mysqlx_expect.proto + + + + open an Expect block and set/unset the conditions that have to be fulfilled + + if any of the conditions fail, all enclosed messages will fail with + a Mysqlx.Error message. + + :returns: :protobuf:msg:`Mysqlx::Ok` on success, :protobuf:msg:`Mysqlx::Error` on error + + + + Field number for the "op" field. + + + + [ default = EXPECT_CTX_COPY_PREV ];//optional + + + + Field number for the "cond" field. + + + Container for nested types declared in the Open message type. + + + + copy the operations from the parent Expect-block + + + + + start with a empty set of operations + + + + Field number for the "condition_key" field. + + + + required + + + + Field number for the "condition_value" field. + + + + optional + + + + Field number for the "op" field. + + + + [ default = EXPECT_OP_SET ];//optional + + + + Container for nested types declared in the Condition message type. + + + + Change error propagation behaviour + + + + + Check if X Protocol field exists + + + + + Check if X Protocol support document _id generation + + + + + set the condition + + set, if not set + overwrite, if set + + + + + unset the condition + + + + + close a Expect block + + closing a Expect block restores the state of the previous Expect block + for the following messages + + :returns: :protobuf:msg:`Mysqlx::Ok` on success, :protobuf:msg:`Mysqlx::Error` on error + + + + Holder for reflection information generated from mysqlx_expr.proto + + + File descriptor for mysqlx_expr.proto + + + + Expressions + + the "root" of the expression tree + + .. productionlist:: + expr: `operator` | + : `identifier` | + : `function_call` | + : variable | + : `literal` | + : placeholder + + If expression type is PLACEHOLDER then it refers to the value of a parameter + specified when executing a statement (see `args` field of `StmtExecute` command). + Field `position` (which must be present for such an expression) gives 0-based + position of the parameter in the parameter list. + + + + Field number for the "type" field. + + + + required + + + + Field number for the "identifier" field. + + + Field number for the "variable" field. + + + Field number for the "literal" field. + + + Field number for the "function_call" field. + + + Field number for the "operator" field. + + + Field number for the "position" field. + + + Field number for the "object" field. + + + Field number for the "array" field. + + + Container for nested types declared in the Expr message type. + + + + identifier: name, schame.name + + .. productionlist:: + identifier: string "." string | + : string + + + + Field number for the "name" field. + + + + required + + + + Field number for the "schema_name" field. + + + + DocumentPathItem + + .. productionlist:: + document_path: path_item | path_item document_path + path_item : member | array_index | "**" + member : "." string | "." "*" + array_index : "[" number "]" | "[" "*" "]" + + + + Field number for the "type" field. + + + + required + + + + Field number for the "value" field. + + + Field number for the "index" field. + + + Container for nested types declared in the DocumentPathItem message type. + + + + .member + + + + + .* + + + + + [index] + + + + + [*] + + + + + ** + + + + + col_identifier (table): col@doc_path, tbl.col@doc_path col, tbl.col, schema.tbl.col + col_identifier (document): doc_path + + .. productionlist:: + col_identifier: string "." string "." string | + : string "." string | + : string | + : string "." string "." string "@" document_path | + : string "." string "@" document_path | + : string "@" document_path | + : document_path + document_path: member | arrayLocation | doubleAsterisk + member = "." string | "." "*" + arrayLocation = "[" index "]" | "[" "*" "]" + doubleAsterisk = "**" + + + + Field number for the "document_path" field. + + + Field number for the "name" field. + + + Field number for the "table_name" field. + + + Field number for the "schema_name" field. + + + + function call: ``func(a, b, "1", 3)`` + + .. productionlist:: + function_call: `identifier` "(" [ `expr` ["," `expr` ]* ] ")" + + + + Field number for the "name" field. + + + + required + + + + Field number for the "param" field. + + + + operator: ``<<(a, b)`` + + .. note:: + + Non-authoritative list of operators implemented (case sensitive): + + Nullary + * ``*`` + * ``default`` + + Unary + * ``!`` + * ``sign_plus`` + * ``sign_minus`` + * ``~`` + + Binary + * ``&&`` + * ``||`` + * ``xor`` + * ``==`` + * ``!=`` + * ``>`` + * ``>=`` + * ``<`` + * ``<=`` + * ``&`` + * ``|`` + * ``^`` + * ``<<`` + * ``>>`` + * ``+`` + * ``-`` + * ``*`` + * ``/`` + * ``div`` + * ``%`` + * ``is`` + * ``is_not`` + * ``regexp`` + * ``not_regexp`` + * ``like`` + * ``not_like`` + * ``cast`` + * ``cont_in`` + * ``not_cont_in`` + + Using special representation, with more than 2 params + * ``in`` (param[0] IN (param[1], param[2], ...)) + * ``not_in`` (param[0] NOT IN (param[1], param[2], ...)) + + Ternary + * ``between`` + * ``between_not`` + * ``date_add`` + * ``date_sub`` + + Units for date_add/date_sub + * ``MICROSECOND`` + * ``SECOND`` + * ``MINUTE`` + * ``HOUR`` + * ``DAY`` + * ``WEEK`` + * ``MONTH`` + * ``QUARTER`` + * ``YEAR`` + * ``SECOND_MICROSECOND`` + * ``MINUTE_MICROSECOND`` + * ``MINUTE_SECOND`` + * ``HOUR_MICROSECOND`` + * ``HOUR_SECOND`` + * ``HOUR_MINUTE`` + * ``DAY_MICROSECOND`` + * ``DAY_SECOND`` + * ``DAY_MINUTE`` + * ``DAY_HOUR`` + + Types for cast + * ``BINARY[(N)]`` + * ``CHAR[(N)]`` + * ``DATE`` + * ``DATETIME`` + * ``DECIMAL[(M[,D])]`` + * ``JSON`` + * ``SIGNED [INTEGER]`` + * ``TIME`` + * ``UNSIGNED [INTEGER]`` + + .. productionlist:: + operator: `name` "(" [ `expr` ["," `expr` ]* ] ")" + + + + Field number for the "name" field. + + + + required + + + + Field number for the "param" field. + + + + an object (with expression values) + + + + Field number for the "fld" field. + + + Container for nested types declared in the Object message type. + + + Field number for the "key" field. + + + + required + + + + Field number for the "value" field. + + + + required + + + + + a Array of expressions + + + + Field number for the "value" field. + + + Holder for reflection information generated from mysqlx_notice.proto + + + File descriptor for mysqlx_notice.proto + + + + Common Frame for all Notices + + ===================================================== ===== + .type value + ===================================================== ===== + :protobuf:msg:`Mysqlx.Notice::Warning` 1 + :protobuf:msg:`Mysqlx.Notice::SessionVariableChanged` 2 + :protobuf:msg:`Mysqlx.Notice::SessionStateChanged` 3 + ===================================================== ===== + + :param type: the type of the payload + :param payload: the payload of the notification + :param scope: global or local notification + + + + Field number for the "type" field. + + + + required + + + + Field number for the "scope" field. + + + + [ default = GLOBAL ];//optional + + + + Field number for the "payload" field. + + + + optional + + + + Container for nested types declared in the Frame message type. + + + + Server-side warnings and notes + + ``.scope`` == ``local`` + ``.level``, ``.code`` and ``.msg`` map the content of + + .. code-block:: sql + + SHOW WARNINGS + + ``.scope`` == ``global`` + (undefined) will be used for global, unstructured messages like: + + * server is shutting down + * a node disconnected from group + * schema or table dropped + + ========================================== ======================= + :protobuf:msg:`Mysqlx.Notice::Frame` field value + ========================================== ======================= + ``.type`` 1 + ``.scope`` ``local`` or ``global`` + ========================================== ======================= + + :param level: warning level: Note or Warning + :param code: warning code + :param msg: warning message + + + + Field number for the "level" field. + + + + [ default = WARNING ];//optional + + + + Field number for the "code" field. + + + + required + + + + Field number for the "msg" field. + + + + required + + + + Container for nested types declared in the Warning message type. + + + + Notify clients about changes to the current session variables + + Every change to a variable that is accessible through: + + .. code-block:: sql + + SHOW SESSION VARIABLES + + ========================================== ========= + :protobuf:msg:`Mysqlx.Notice::Frame` field value + ========================================== ========= + ``.type`` 2 + ``.scope`` ``local`` + ========================================== ========= + + :param namespace: namespace that param belongs to + :param param: name of the variable + :param value: the changed value of param + + + + Field number for the "param" field. + + + + required + + + + Field number for the "value" field. + + + + optional + + + + + Notify clients about changes to the internal session state + + ========================================== ========= + :protobuf:msg:`Mysqlx.Notice::Frame` field value + ========================================== ========= + ``.type`` 3 + ``.scope`` ``local`` + ========================================== ========= + + :param param: parameter key + :param value: updated value + + + + Field number for the "param" field. + + + + required + + + + Field number for the "value" field. + + + Container for nested types declared in the SessionStateChanged message type. + + + + .. more to be added + + + + Holder for reflection information generated from mysqlx_prepare.proto + + + File descriptor for mysqlx_prepare.proto + + + + Prepare a new statement + + .. uml:: + + client -> server: Prepare + alt Success + client <- server: Ok + else Failure + client <- server: Error + end + + :param stmt_id: client side assigned statement id, which is going to identify the result of preparation + :param stmt: defines one of following messages to be prepared - Crud.Find, Crud.Insert, Crud.Delete, Crud.Upsert, Sql.StmtExecute + :Returns: :protobuf:msg:`Mysqlx.Ok|Mysqlx.Error` + + + + Field number for the "stmt_id" field. + + + + required + + + + Field number for the "stmt" field. + + + + required + + + + Container for nested types declared in the Prepare message type. + + + Field number for the "type" field. + + + + required + + + + Field number for the "find" field. + + + + optional + + + + Field number for the "insert" field. + + + + optional + + + + Field number for the "update" field. + + + + optional + + + + Field number for the "delete" field. + + + + optional + + + + Field number for the "stmt_execute" field. + + + + optional + + + + Enum of possible cases for the "Type_present" oneof. + + + Container for nested types declared in the OneOfMessage message type. + + + + Determine which of optional fields was set by the client + (Workaround for missing "oneof" keyword in pb2.5) + + + + + Execute already prepared statement + + .. uml:: + + client -> server: Execute + alt Success + ... Resultsets... + client <- server: StmtExecuteOk + else Failure + client <- server: Error + end + + :param stmt_id: client side assigned statement id, must be already prepared + :param args_list: Arguments to bind to the prepared statement + :param compact_metadata: send only type information for :protobuf:msg:`Mysqlx.Resultset::ColumnMetadata`, skipping names and others + :Returns: :protobuf:msg:`Mysqlx.Ok::` + + + + Field number for the "stmt_id" field. + + + + required + + + + Field number for the "args" field. + + + Field number for the "compact_metadata" field. + + + + [ default = false ]; optional + + + + + Deallocate already prepared statement + + Deallocating the statement. + + .. uml:: + + client -> server: Deallocate + alt Success + client <- server: Ok + else Failure + client <- server: Error + end + + :param stmt_id: client side assigned statement id, must be already prepared + :Returns: :protobuf:msg:`Mysqlx.Ok|Mysqlx.Error` + + + + Field number for the "stmt_id" field. + + + + required + + + + Holder for reflection information generated from mysqlx_resultset.proto + + + File descriptor for mysqlx_resultset.proto + + + + a hint about the higher-level encoding of a BYTES field + + ====== ====== =========== + type value description + ====== ====== =========== + BYTES 0x0001 GEOMETRY (WKB encoding) + BYTES 0x0002 JSON (text encoding) + BYTES 0x0003 XML (text encoding) + ====== ====== =========== + + .. note:: + this list isn't comprehensive. As guideline: the field's value is expected + to pass a validator check on client and server if this field is set. + If the server adds more internal datatypes that rely on BLOB storage + like image manipulation, seeking into complex types in BLOBs, ... more + types will be added. + + + + + a hint about the higher-level encoding of a DATETIME field + + ====== ====== =========== + type value description + ======== ====== =========== + DATE 0x0001 DATETIME contains only date part + DATETIME 0x0002 DATETIME contains both date and time parts + ====== ====== =========== + + + + + resultsets are finished, OUT paramset is next + + + + + resultset and out-params are finished, but more resultsets available + + + + + all resultsets are finished + + + + + cursor is opened still the execution of PrepFetch or PrepExecute ended + + + + + meta data of a Column + + .. note:: the encoding used for the different ``bytes`` fields in the meta data is externally + controlled. + .. seealso:: https://dev.mysql.com/doc/refman/8.0/en/charset-connection.html + + .. note:: + The server may not set the ``original_{table|name}`` fields if they are equal to the plain + ``{table|name}`` field. + + A client has to reconstruct it like:: + + if .original_name is empty and .name is not empty: + .original_name = .name + + if .original_table is empty and .table is not empty: + .original_table = .table + + .. note:: + ``compact metadata format`` can be requested by the client. In that case only ``.type`` is set and + all other fields are empty. + + :param type: + .. table:: Expected Datatype of Mysqlx.Resultset.Row per SQL Type for non NULL values + + ================= ============ ======= ========== ====== ======== + SQL Type .type .length .frac_dig .flags .charset + ================= ============ ======= ========== ====== ======== + TINY SINT x + TINY UNSIGNED UINT x x + SHORT SINT x + SHORT UNSIGNED UINT x x + INT24 SINT x + INT24 UNSIGNED UINT x x + INT SINT x + INT UNSIGNED UINT x x + LONGLONG SINT x + LONGLONG UNSIGNED UINT x x + DOUBLE DOUBLE x x x + FLOAT FLOAT x x x + DECIMAL DECIMAL x x x + VARCHAR,CHAR,... BYTES x x x + GEOMETRY BYTES + TIME TIME x + DATE DATETIME x + DATETIME DATETIME x + YEAR UINT x x + TIMESTAMP DATETIME x + SET SET x + ENUM ENUM x + NULL BYTES + BIT BIT x + ================= ============ ======= ========== ====== ======== + + .. note:: the SQL "NULL" value is sent as an empty field value in :protobuf:msg:`Mysqlx.Resultset::Row` + .. seealso:: protobuf encoding of primitive datatypes are decribed in https://developers.google.com/protocol-buffers/docs/encoding + + SINT + + ``.length`` + maximum number of displayable decimal digits (including minus sign) of the type + + .. note:: + valid range is 0-255, but usually you'll see 1-20 + + =============== == + SQL Type max digits per type + =============== == + TINY SIGNED 4 + SHORT SIGNED 6 + INT24 SIGNED 8 + INT SIGNED 11 + LONGLONG SIGNED 20 + =============== == + + .. seealso:: definition of ``M`` in https://dev.mysql.com/doc/refman/8.0/en/numeric-type-overview.html + + ``value`` + variable length encoded signed 64 integer + + UINT + + ``.flags & 1`` (zerofill) + the client has to left pad with 0's up to .length + + ``.length`` + maximum number of displayable decimal digits of the type + + .. note:: + valid range is 0-255, but usually you'll see 1-20 + + ================= == + SQL Type max digits per type + ================= == + TINY UNSIGNED 3 + SHORT UNSIGNED 5 + INT24 UNSIGNED 8 + INT UNSIGNED 10 + LONGLONG UNSIGNED 20 + ================= == + + .. seealso:: definition of ``M`` in https://dev.mysql.com/doc/refman/8.0/en/numeric-type-overview.html + + ``value`` + variable length encoded unsigned 64 integer + + BIT + + ``.length`` + maximum number of displayable binary digits + + .. note:: valid range for M of the ``BIT`` type is 1 - 64 + .. seealso:: https://dev.mysql.com/doc/refman/8.0/en/numeric-type-overview.html + + ``value`` + variable length encoded unsigned 64 integer + + DOUBLE + + ``.length`` + maximum number of displayable decimal digits (including the decimal point and ``.fractional_digits``) + + ``.fractional_digits`` + maximum number of displayable decimal digits following the decimal point + + ``value`` + encoded as Protobuf's 'double' + + FLOAT + + ``.length`` + maximum number of displayable decimal digits (including the decimal point and ``.fractional_digits``) + + ``.fractional_digits`` + maximum number of displayable decimal digits following the decimal point + + ``value`` + encoded as Protobuf's 'float' + + BYTES, ENUM + BYTES is used for all opaque byte strings that may have a charset + + * TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB + * TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT + * VARCHAR, VARBINARY + * CHAR, BINARY + * ENUM + + ``.length`` + the maximum length of characters of the underlying type + + ``.flags & 1`` (rightpad) + if the length of the field is less than ``.length``, the receiver is + supposed to add padding characters to the right end of the string. + If the ``.charset`` is "binary", the padding character is ``0x00``, + otherwise it is a space character as defined by that character set. + + ============= ======= ======== ======= + SQL Type .length .charset .flags + ============= ======= ======== ======= + TINYBLOB 256 binary + BLOB 65535 binary + VARCHAR(32) 32 utf8 + VARBINARY(32) 32 utf8_bin + BINARY(32) 32 binary rightpad + CHAR(32) 32 utf8 rightpad + ============= ======= ======== ======= + + ``value`` + sequence of bytes with added one extra '\0' byte at the end. To obtain the + original string, the extra '\0' should be removed. + .. note:: the length of the string can be acquired with protobuf's field length() method + length of sequence-of-bytes = length-of-field - 1 + .. note:: the extra byte allows to distinguish between a NULL and empty byte sequence + + TIME + A time value. + + ``value`` + the following bytes sequence: + + ``| negate [ | hour | [ | minutes | [ | seconds | [ | useconds | ]]]]`` + + * negate - one byte, should be one of: 0x00 for "+", 0x01 for "-" + * hour - optional variable length encoded unsigned64 value for the hour + * minutes - optional variable length encoded unsigned64 value for the minutes + * seconds - optional variable length encoded unsigned64 value for the seconds + * useconds - optional variable length encoded unsigned64 value for the microseconds + + .. seealso:: protobuf encoding in https://developers.google.com/protocol-buffers/docs/encoding + .. note:: hour, minutes, seconds, useconds are optional if all the values to the right are 0 + + Example: 0x00 -> +00:00:00.000000 + + DATETIME + A date or date and time value. + + ``value`` + a sequence of variants, arranged as follows: + + ``| year | month | day | [ | hour | [ | minutes | [ | seconds | [ | useconds | ]]]]`` + + * year - variable length encoded unsigned64 value for the year + * month - variable length encoded unsigned64 value for the month + * day - variable length encoded unsigned64 value for the day + * hour - optional variable length encoded unsigned64 value for the hour + * minutes - optional variable length encoded unsigned64 value for the minutes + * seconds - optional variable length encoded unsigned64 value for the seconds + * useconds - optional variable length encoded unsigned64 value for the microseconds + + .. note:: hour, minutes, seconds, useconds are optional if all the values to the right are 0 + + ``.flags & 1`` (timestamp) + + ============= ======= + SQL Type .flags + ============= ======= + DATETIME + TIMESTAMP 1 + + DECIMAL + An arbitrary length number. The number is encoded as a single byte + indicating the position of the decimal point followed by the Packed BCD + encoded number. Packed BCD is used to simplify conversion to and + from strings and other native arbitrary precision math datatypes. + .. seealso:: packed BCD in https://en.wikipedia.org/wiki/Binary-coded_decimal + + ``.length`` + maximum number of displayable decimal digits (*excluding* the decimal point and sign, but including ``.fractional_digits``) + + .. note:: should be in the range of 1 - 65 + + ``.fractional_digits`` + is the decimal digits to display out of length + + .. note:: should be in the range of 0 - 30 + + ``value`` + the following bytes sequence: + + ``| scale | BCD | sign | [0x0] |`` + + * scale - 8bit scale value (number of decimal digit after the '.') + * BCD - BCD encoded digits (4 bits for each digit) + * sign - sign encoded on 4 bits (0xc = "+", 0xd = "-") + * 0x0 - last 4bits if length(digits) % 2 == 0 + + Example: x04 0x12 0x34 0x01 0xd0 -> -12.3401 + + SET + A list of strings representing a SET of values. + + ``value`` + A sequence of 0 or more of protobuf's bytes (length prepended octets) or one of + the special sequences with a predefined meaning listed below. + + Example (length of the bytes array shown in brackets): + * ``[0]`` - the NULL value + * ``[1] 0x00`` - a set containing a blank string '' + * ``[1] 0x01`` - this would be an invalid value, but is to be treated as the empty set + * ``[2] 0x01 0x00`` - a set with a single item, which is the '\0' character + * ``[8] 0x03 F O O 0x03 B A R`` - a set with 2 items: FOO,BAR + + :param name: name of the column + :param original_name: name of the column before an alias was applied + :param table: name of the table the column orginates from + :param original_table: name of the table the column orginates from before an alias was applied + :param schema: schema the column originates from + :param catalog: + catalog the schema originates from + + .. note:: + as there is current no support for catalogs in MySQL, don't expect this field to be set. + In the MySQL C/S protocol the field had the value ``def`` all the time. + + :param fractional_digits: displayed factional decimal digits for floating point and fixed point numbers + :param length: maximum count of displayable characters of .type + :param flags: + ``.type`` specific flags + + ======= ====== =========== + type value description + ======= ====== =========== + UINT 0x0001 zerofill + DOUBLE 0x0001 unsigned + FLOAT 0x0001 unsigned + DECIMAL 0x0001 unsigned + BYTES 0x0001 rightpad + ======= ====== =========== + + ====== ================ + value description + ====== ================ + 0x0010 NOT_NULL + 0x0020 PRIMARY_KEY + 0x0040 UNIQUE_KEY + 0x0080 MULTIPLE_KEY + 0x0100 AUTO_INCREMENT + ====== ================ + + default: 0 + :param content_type: + a hint about the higher-level encoding of a BYTES field, for more informations + please refer to Mysqlx.Resultset.ContentType_BYTES enum. + + + + Field number for the "type" field. + + + + datatype of the field in a row + + + + Field number for the "name" field. + + + Field number for the "original_name" field. + + + Field number for the "table" field. + + + Field number for the "original_table" field. + + + Field number for the "schema" field. + + + Field number for the "catalog" field. + + + Field number for the "collation" field. + + + Field number for the "fractional_digits" field. + + + Field number for the "length" field. + + + Field number for the "flags" field. + + + Field number for the "content_type" field. + + + Container for nested types declared in the ColumnMetaData message type. + + + + Row in a Resultset + + a row is represented as a list of fields encoded as byte blobs. + Blob of size 0 represents the NULL value. Otherwise, if it contains at least + one byte, it encodes a non-null value of the field using encoding appropriate for the + type of the value given by ``ColumnMetadata``, as specified + in the :protobuf:msg:`Mysqlx.Resultset::ColumnMetaData` description. + + + + Field number for the "field" field. + + + Holder for reflection information generated from mysqlx_session.proto + + + File descriptor for mysqlx_session.proto + + + + the initial message send from the client to the server to start the + authentication proccess + + :param mech_name: authentication mechanism name + :param auth_data: authentication data + :param initial_response: initial response + :Returns: :protobuf:msg:`Mysqlx.Session::AuthenticateContinue` + + + + Field number for the "mech_name" field. + + + + required + + + + Field number for the "auth_data" field. + + + Field number for the "initial_response" field. + + + + send by client or server after a :protobuf:msg:`Mysqlx.Session::AuthenticateStart` to + exchange more auth data + + :param auth_data: authentication data + :Returns: :protobuf:msg:`Mysqlx.Session::AuthenticateContinue` + + + + Field number for the "auth_data" field. + + + + required + + + + + sent by the server after successful authentication + + :param auth_data: authentication data + + + + Field number for the "auth_data" field. + + + + reset the current session + param keep_open: if is true the session will be reset, but stays authenticated. + otherwise, the session will be closed and needs to be authenticated again. + + :Returns: :protobuf:msg:`Mysqlx::Ok` + + + + Field number for the "keep_open" field. + + + + close the current session + + :Returns: :protobuf:msg:`Mysqlx::Ok` + + + + Holder for reflection information generated from mysqlx_sql.proto + + + File descriptor for mysqlx_sql.proto + + + + execute a statement in the given namespace + + .. uml:: + + client -> server: StmtExecute + ... zero or more Resultsets ... + server --> client: StmtExecuteOk + + Notices: + This message may generate a notice containing WARNINGs generated by its execution. + This message may generate a notice containing INFO messages generated by its execution. + + :param namespace: namespace of the statement to be executed + :param stmt: statement that shall be executed. + :param args: values for wildcard replacements + :param compact_metadata: send only type information for :protobuf:msg:`Mysqlx.Resultset::ColumnMetadata`, skipping names and others + :returns: + * zero or one :protobuf:msg:`Mysqlx.Resultset::` followed by :protobuf:msg:`Mysqlx.Sql::StmtExecuteOk` + + + + Field number for the "namespace" field. + + + + optional [ default = "sql" ] + + + + Field number for the "stmt" field. + + + + required + + + + Field number for the "args" field. + + + Field number for the "compact_metadata" field. + + + + optional [ default = false ] + + + + + statement executed successful + + +
+
diff --git a/DLL/NPOI.OOXML.dll b/DLL/NPOI.OOXML.dll new file mode 100644 index 0000000..031d41d Binary files /dev/null and b/DLL/NPOI.OOXML.dll differ diff --git a/DLL/NPOI.OpenXml4Net.dll b/DLL/NPOI.OpenXml4Net.dll new file mode 100644 index 0000000..8da4ac2 Binary files /dev/null and b/DLL/NPOI.OpenXml4Net.dll differ diff --git a/DLL/NPOI.OpenXmlFormats.dll b/DLL/NPOI.OpenXmlFormats.dll new file mode 100644 index 0000000..4a8f87b Binary files /dev/null and b/DLL/NPOI.OpenXmlFormats.dll differ diff --git a/DLL/NPOI.dll b/DLL/NPOI.dll new file mode 100644 index 0000000..1a500e9 Binary files /dev/null and b/DLL/NPOI.dll differ diff --git a/DLL/Nai.Communication.Robot.FanucVarProxy.dll b/DLL/Nai.Communication.Robot.FanucVarProxy.dll new file mode 100644 index 0000000..ad9e8f8 Binary files /dev/null and b/DLL/Nai.Communication.Robot.FanucVarProxy.dll differ diff --git a/DLL/Newtonsoft.Json.dll b/DLL/Newtonsoft.Json.dll new file mode 100644 index 0000000..7af125a Binary files /dev/null and b/DLL/Newtonsoft.Json.dll differ diff --git a/DLL/Opc.Ua.Client.dll b/DLL/Opc.Ua.Client.dll new file mode 100644 index 0000000..8874d8f Binary files /dev/null and b/DLL/Opc.Ua.Client.dll differ diff --git a/DLL/Opc.Ua.Configuration.dll b/DLL/Opc.Ua.Configuration.dll new file mode 100644 index 0000000..b3f3970 Binary files /dev/null and b/DLL/Opc.Ua.Configuration.dll differ diff --git a/DLL/Opc.Ua.Core.dll b/DLL/Opc.Ua.Core.dll new file mode 100644 index 0000000..ee01d0d Binary files /dev/null and b/DLL/Opc.Ua.Core.dll differ diff --git a/DLL/OpcUaHelper.dll b/DLL/OpcUaHelper.dll new file mode 100644 index 0000000..e95e509 Binary files /dev/null and b/DLL/OpcUaHelper.dll differ diff --git a/DLL/Rhino3dm.dll b/DLL/Rhino3dm.dll new file mode 100644 index 0000000..76d1cb8 Binary files /dev/null and b/DLL/Rhino3dm.dll differ diff --git a/DLL/Robot.Common.dll b/DLL/Robot.Common.dll new file mode 100644 index 0000000..57679fd Binary files /dev/null and b/DLL/Robot.Common.dll differ diff --git a/DLL/Robot.MessageBus.dll b/DLL/Robot.MessageBus.dll new file mode 100644 index 0000000..2bede9f Binary files /dev/null and b/DLL/Robot.MessageBus.dll differ diff --git a/DLL/RobotMapper.dll b/DLL/RobotMapper.dll new file mode 100644 index 0000000..3bf3d77 Binary files /dev/null and b/DLL/RobotMapper.dll differ diff --git a/DLL/RobotStudio.Services.RobApi.Desktop.dll b/DLL/RobotStudio.Services.RobApi.Desktop.dll new file mode 100644 index 0000000..f265f71 Binary files /dev/null and b/DLL/RobotStudio.Services.RobApi.Desktop.dll differ diff --git a/DLL/RobotStudio.Services.RobApi.dll b/DLL/RobotStudio.Services.RobApi.dll new file mode 100644 index 0000000..c06854b Binary files /dev/null and b/DLL/RobotStudio.Services.RobApi.dll differ diff --git a/DLL/Robots.dll b/DLL/Robots.dll new file mode 100644 index 0000000..ff28838 Binary files /dev/null and b/DLL/Robots.dll differ diff --git a/DLL/Serilog.Extensions.Logging.dll b/DLL/Serilog.Extensions.Logging.dll new file mode 100644 index 0000000..27dc8cf Binary files /dev/null and b/DLL/Serilog.Extensions.Logging.dll differ diff --git a/DLL/Serilog.dll b/DLL/Serilog.dll new file mode 100644 index 0000000..d13a6f4 Binary files /dev/null and b/DLL/Serilog.dll differ diff --git a/DLL/SqlCmd.dll b/DLL/SqlCmd.dll new file mode 100644 index 0000000..b6b25f9 Binary files /dev/null and b/DLL/SqlCmd.dll differ diff --git a/DLL/System.Net.Http.Formatting.dll b/DLL/System.Net.Http.Formatting.dll new file mode 100644 index 0000000..e9e80be Binary files /dev/null and b/DLL/System.Net.Http.Formatting.dll differ diff --git a/DLL/System.Net.Http.dll b/DLL/System.Net.Http.dll new file mode 100644 index 0000000..1c5c6fd Binary files /dev/null and b/DLL/System.Net.Http.dll differ diff --git a/DLL/System.Runtime.InteropServices.RuntimeInformation.dll b/DLL/System.Runtime.InteropServices.RuntimeInformation.dll new file mode 100644 index 0000000..360e92a Binary files /dev/null and b/DLL/System.Runtime.InteropServices.RuntimeInformation.dll differ diff --git a/DLL/System.Web.Cors.dll b/DLL/System.Web.Cors.dll new file mode 100644 index 0000000..6f3da24 Binary files /dev/null and b/DLL/System.Web.Cors.dll differ diff --git a/DLL/System.Web.Http.Cors.dll b/DLL/System.Web.Http.Cors.dll new file mode 100644 index 0000000..fd0b539 Binary files /dev/null and b/DLL/System.Web.Http.Cors.dll differ diff --git a/DLL/System.Web.Http.SelfHost.dll b/DLL/System.Web.Http.SelfHost.dll new file mode 100644 index 0000000..852728e Binary files /dev/null and b/DLL/System.Web.Http.SelfHost.dll differ diff --git a/DLL/System.Web.Http.dll b/DLL/System.Web.Http.dll new file mode 100644 index 0000000..7e3bd30 Binary files /dev/null and b/DLL/System.Web.Http.dll differ diff --git a/DLL/Ubiety.Dns.Core.dll b/DLL/Ubiety.Dns.Core.dll new file mode 100644 index 0000000..2f0c84e Binary files /dev/null and b/DLL/Ubiety.Dns.Core.dll differ diff --git a/DLL/WeifenLuo.WinFormsUI.Docking.dll b/DLL/WeifenLuo.WinFormsUI.Docking.dll new file mode 100644 index 0000000..52623c7 Binary files /dev/null and b/DLL/WeifenLuo.WinFormsUI.Docking.dll differ diff --git a/DLL/Zstandard.Net.dll b/DLL/Zstandard.Net.dll new file mode 100644 index 0000000..83934d1 Binary files /dev/null and b/DLL/Zstandard.Net.dll differ diff --git a/DLL/fwlibe1.dll b/DLL/fwlibe1.dll new file mode 100644 index 0000000..1ade6a9 Binary files /dev/null and b/DLL/fwlibe1.dll differ diff --git a/DLL/log4net.dll b/DLL/log4net.dll new file mode 100644 index 0000000..8646b6f Binary files /dev/null and b/DLL/log4net.dll differ diff --git a/DLL/netstandard.dll b/DLL/netstandard.dll new file mode 100644 index 0000000..1f1ab22 Binary files /dev/null and b/DLL/netstandard.dll differ diff --git a/DatabaseClient/01_DatabaseClient.csproj b/DatabaseClient/01_DatabaseClient.csproj new file mode 100644 index 0000000..c05ab38 --- /dev/null +++ b/DatabaseClient/01_DatabaseClient.csproj @@ -0,0 +1,134 @@ + + + + + Debug + AnyCPU + {C7C5E929-BE10-4ED6-94DB-B8D65E05E52F} + Exe + DatabaseClient + DatabaseClient + v4.8 + 512 + true + true + + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + LocalIntranet + + + false + + + + + ..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll + + + ..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll + + + ..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll + + + ..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll + + + ..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll + + + ..\packages\log4net.2.0.14\lib\net45\log4net.dll + + + ..\packages\MySql.Data.8.0.29\lib\net452\MySql.Data.dll + + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + + + + + + ..\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\lib\net46\System.Data.SQLite.dll + + + + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll + + + + + + + + + + + ..\packages\MySql.Data.8.0.29\lib\net452\Ubiety.Dns.Core.dll + + + ..\packages\MySql.Data.8.0.29\lib\net452\ZstdNet.dll + + + + + + + + + + + + + + + + + PreserveNewest + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/DatabaseClient/App.config b/DatabaseClient/App.config new file mode 100644 index 0000000..fbf0811 --- /dev/null +++ b/DatabaseClient/App.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/DatabaseClient/DBClient.cs b/DatabaseClient/DBClient.cs new file mode 100644 index 0000000..96ee82d --- /dev/null +++ b/DatabaseClient/DBClient.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseClient +{ + public abstract class DBClient + { + /// + /// 根据连接字符串连接 + /// + /// 连接字符串 + public abstract void Connect(string connString); + + /// + /// 执行sql查询语句,返回DataTable + /// + /// 查询sql字符串 + /// + public abstract DataTable ExecQuery(string sql); + + /// + /// 执行sql非查询语句,返回执行结果 + /// + /// 非查询sql字符串 + /// + public abstract int ExecNonQuery(string sql); + + /// + /// 分页,将原始表分成子表。约束为当前页数和每页记录数 + /// + /// 泛型类型 + /// 原始表 + /// 每页记录数 + /// 当前页数 + /// + public static List SplitePage(List originList,int pageSize,int currentPage) + { + List resList = new List(); + + var numAll = originList.Count; + var numPage = numAll / pageSize + 1; + + var start = (currentPage - 1) * pageSize; + var end = start + pageSize; + + for (int i = 0; i < originList.Count; i++) + { + var origin = originList[i]; + if (i >= start && i < end) + { + resList.Add(origin); + } + } + + return resList; + } + } +} diff --git a/DatabaseClient/DBClientFactory.cs b/DatabaseClient/DBClientFactory.cs new file mode 100644 index 0000000..cffba85 --- /dev/null +++ b/DatabaseClient/DBClientFactory.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseClient +{ + public class DBClientFactory + { + DatabaseFactory factory; + + public DBClientFactory(string dbTypeStr) + { + switch (dbTypeStr.ToLower()) + { + case "mysql": + { + factory = new MysqlDatabaseFactory(); + break; + } + case "sqlite": + { + factory = new SqliteDatabaseFactory(); + break; + } + case "mssql": + { + factory = new MssqlDatabaseFactory(); + break; + } + default: + { + factory = new MysqlDatabaseFactory(); + break; + } + } + } + + public DBClient Create() + { + return factory.Create(); + } + } +} diff --git a/DatabaseClient/DBClientLog4net.config b/DatabaseClient/DBClientLog4net.config new file mode 100644 index 0000000..2842f30 --- /dev/null +++ b/DatabaseClient/DBClientLog4net.config @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DatabaseClient/DatabaseFactory.cs b/DatabaseClient/DatabaseFactory.cs new file mode 100644 index 0000000..240cf43 --- /dev/null +++ b/DatabaseClient/DatabaseFactory.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseClient +{ + public abstract class DatabaseFactory + { + public abstract DBClient Create(); + } + + class MysqlDatabaseFactory : DatabaseFactory + { + public override DBClient Create() + { + return new MysqlClient(); + } + } + + class SqliteDatabaseFactory : DatabaseFactory + { + public override DBClient Create() + { + return new SqliteClient(); + } + } + + class MssqlDatabaseFactory : DatabaseFactory + { + public override DBClient Create() + { + return new MssqlClient(); + } + } +} diff --git a/DatabaseClient/GlobalVar.cs b/DatabaseClient/GlobalVar.cs new file mode 100644 index 0000000..15deaac --- /dev/null +++ b/DatabaseClient/GlobalVar.cs @@ -0,0 +1,9 @@ +using log4net; + +namespace DatabaseClient +{ + class GlobalVar + { + public static ILog log = LogManager.GetLogger("DBClient"); + } +} diff --git a/DatabaseClient/MssqlClient.cs b/DatabaseClient/MssqlClient.cs new file mode 100644 index 0000000..9e5b022 --- /dev/null +++ b/DatabaseClient/MssqlClient.cs @@ -0,0 +1,75 @@ +using System; +using System.Data; +using System.Data.SqlClient; + +namespace DatabaseClient +{ + class MssqlClient : DBClient + { + SqlConnection conn = null; + + public MssqlClient(){} + + public override void Connect(string connString) + { + try + { + conn = new SqlConnection(connString); + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + } + + public override DataTable ExecQuery(string sql) + { + DataTable dt = null; + try + { + if (conn != null) + { + conn.Open(); + + var cmd = new SqlCommand(sql, conn); + SqlDataAdapter da = new SqlDataAdapter(cmd); + DataSet ds = new DataSet(); + da.Fill(ds); + + conn.Close(); + if (ds.Tables.Count > 0) + { + dt = ds.Tables[0]; + } + } + + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + + return dt; + } + + public override int ExecNonQuery(string sql) + { + int res = 0; + try + { + if (conn!=null) + { + var cmd = new SqlCommand(sql, conn); + conn.Open(); + res = cmd.ExecuteNonQuery(); + conn.Close(); + } + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + return res; + } + } +} \ No newline at end of file diff --git a/DatabaseClient/MysqlClient.cs b/DatabaseClient/MysqlClient.cs new file mode 100644 index 0000000..a22e42f --- /dev/null +++ b/DatabaseClient/MysqlClient.cs @@ -0,0 +1,126 @@ +using MySql.Data.MySqlClient; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseClient +{ + public class MysqlClient : DBClient + { + MySqlConnection conn; + + public MysqlClient() { } + + public override void Connect(string connString) + { + try + { + conn = new MySqlConnection(connString); + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + } + + public override DataTable ExecQuery(string sql) + { + DataTable dt = null; + try + { + if (conn != null) + { + conn.Open(); + + MySqlCommand command = new MySqlCommand(sql, conn); + MySqlDataAdapter da = new MySqlDataAdapter(command); + DataSet ds = new DataSet(); + da.Fill(ds); + + conn.Close(); + + if (ds.Tables.Count > 0) + { + dt = ds.Tables[0]; + } + + } + + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + return dt; + } + + public override int ExecNonQuery(string sql) + { + int res = 0; + + try + { + if (conn != null) + { + conn.Open(); + + MySqlCommand command = new MySqlCommand(sql, conn); + res = command.ExecuteNonQuery(); + + conn.Close(); + } + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + + return res; + } + + public static bool ExecQueryDataTable(string sql,string ConnectStr,out DataTable dt, out string err) + { + bool success = false; + err = ""; + dt = null; + using (MySqlConnection conn = new MySqlConnection(ConnectStr)) + { + try + { + conn.Open(); + + MySqlCommand command = new MySqlCommand(sql, conn); + MySqlDataAdapter da = new MySqlDataAdapter(command); + DataSet ds = new DataSet(); + da.Fill(ds); + + if (ds.Tables.Count > 0) + { + dt = ds.Tables[0]; + } + success = true; + } + catch (Exception er) + { + err = er.Message; + } + finally + { + if (conn != null) + { + conn.Close(); + } + } + + } + + return success; + } + + + + } +} diff --git a/DatabaseClient/Program.cs b/DatabaseClient/Program.cs new file mode 100644 index 0000000..9f03a4b --- /dev/null +++ b/DatabaseClient/Program.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseClient +{ + internal class Program + { + static void Main(string[] args) + { + + // TestSqlite(); + TestMysql(); + //TestMssql(); + Console.ReadKey(); + } + static void TestSqlite() + { + var sqlClient = new DBClientFactory("Sqlite").Create(); + sqlClient.Connect("Data Source=mytest.sqlite;Version=3;"); + var ds = sqlClient.ExecQuery("select * from Z_Save_Position"); + } + static void TestMysql() + { + var sqlClient = new DBClientFactory("Mysql").Create(); + sqlClient.Connect("server=192.168.1.204;port=33060;database=zkeco;username=mesuser;password=Mes147258;"); + var ds = sqlClient.ExecQuery("select * from vw_mes_userinfo;"); + } + + static void TestMssql() + { + var sqlClient = new DBClientFactory("Mssql").Create(); + + sqlClient.Connect(@"server=.\WINCC;database=MW_DataFactory_App_Add;uid=sa;pwd=126.com;Connection Reset=FALSE;Max Pool Size = 1000"); + var ds = sqlClient.ExecQuery("select * from ProjectList"); + } + } +} diff --git a/DatabaseClient/Properties/AssemblyInfo.cs b/DatabaseClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8b1127e --- /dev/null +++ b/DatabaseClient/Properties/AssemblyInfo.cs @@ -0,0 +1,38 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Database")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Database")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c7c5e929-be10-4ed6-94db-b8d65e05e52f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +[assembly: log4net.Config.XmlConfigurator(ConfigFile = "DBClientLog4net.config", Watch = true)] \ No newline at end of file diff --git a/DatabaseClient/SqliteClient.cs b/DatabaseClient/SqliteClient.cs new file mode 100644 index 0000000..051c462 --- /dev/null +++ b/DatabaseClient/SqliteClient.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using System.Data.SQLite; + + + +namespace DatabaseClient +{ + class SqliteClient : DBClient + { + SQLiteConnection conn; + + public SqliteClient() { } + + public override void Connect(string connString) + { + try + { + conn = new SQLiteConnection(connString); + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + } + + public override int ExecNonQuery(string sql) + { + int res = 0; + try + { + if (conn!=null) + { + conn.Open(); + + var cmd = new SQLiteCommand(sql, conn); + res = cmd.ExecuteNonQuery(); + + conn.Close(); + } + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + return res; + } + + public override DataTable ExecQuery(string sql) + { + DataTable dt = null; + try + { + if (conn!=null) + { + conn.Open(); + + var cmd = new SQLiteCommand(sql, conn); + SQLiteDataAdapter da = new SQLiteDataAdapter(cmd); + DataSet ds = new DataSet(); + da.Fill(ds); + conn.Close(); + if (ds.Tables.Count > 0) + { + dt = ds.Tables[0]; + } + } + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + + + return dt; + } + } +} diff --git a/DatabaseClient/packages.config b/DatabaseClient/packages.config new file mode 100644 index 0000000..2a1becf --- /dev/null +++ b/DatabaseClient/packages.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/GlobalVar/07_GlobalVar.csproj b/GlobalVar/07_GlobalVar.csproj new file mode 100644 index 0000000..35df210 --- /dev/null +++ b/GlobalVar/07_GlobalVar.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {FCFBEF3B-BD04-432F-9B74-579FF8568EAA} + Library + GlobalVar + GlobalVar + v4.8 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + ..\packages\MQTTnet.4.2.0.706\lib\net461\MQTTnet.dll + + + ..\packages\MQTTnet.Extensions.ManagedClient.4.2.0.706\lib\net461\MQTTnet.Extensions.ManagedClient.dll + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + + + {1dc48c83-1842-4de8-acaf-26e1e7f7c58f} + 01_MyLog4Net + + + + \ No newline at end of file diff --git a/GlobalVar/App.config b/GlobalVar/App.config new file mode 100644 index 0000000..0630019 --- /dev/null +++ b/GlobalVar/App.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/GlobalVar/AppConfig.cs b/GlobalVar/AppConfig.cs new file mode 100644 index 0000000..6de8375 --- /dev/null +++ b/GlobalVar/AppConfig.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DNC_CSharp_Demo +{ + public class ToolInfo + { + public string Name { get; set; } + public string TimeRated { get; set; } + public string TimeUsed { get; set; } + } + + public class AxisInfo + { + public string AxisName { get; set; } + public string AxisValue { get; set; } + } + + public class ParameterInfo + { + public string ParameterName { get; set; } + public string ParameterValue { get; set; } + } + + public class AlarmInfo + { + public string Alarm { get; set; } + public string AlarmTime { get; set; } + } + + public class DeviceInfo + { + public string order { get; set; } = ""; + public string Name { get; set; } + public string Id { get; set; } + public string Status { get; set; } + public string Program { get; set; } + public string Feed { get; set; } + public string Speed { get; set; } + public string Rapid { get; set; } + public string ProgramStatus { get; set; } + public ToolInfo Tool { get; set; } + public List Axis { get; set; } + + public List OtherParameter { get; set; } + public List Alarm { get; set; } + + } + + public class JointConfig + { + public string JointName { get; set; } + public string ModelCode { get; set; } + public string JointType { get; set; } + public string Axis { get; set; } + public string Flip { get; set; } + public string Value { get; set; } + public string ValueFactor { get; set; } + public string Delta { get; set; } + public string Order { get; set; } + } + + public class MachineToolConfig + { + public string Enable { get; set; } + public string Type { get; set; } + public string ConnectStr { get; set; } + public string Id { get; set; } + public string Name { get; set; } + public string DataTimeInterval { get; set; } + public string AxesTimeInterval { get; set; } + public List Joints { get; set; } + + } + + + + public class AppConfig + { + public List MachineTool { get; set; } + } +} diff --git a/GlobalVar/GlobalVar.cs b/GlobalVar/GlobalVar.cs new file mode 100644 index 0000000..da37eb0 --- /dev/null +++ b/GlobalVar/GlobalVar.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Text; +//using MQTTnet; +//using MQTTnet.Extensions.ManagedClient; +//using DatabaseClient; +using System.Security.Cryptography; + +namespace DNC_CSharp_Demo +{ + public class GlobalVar + { + // public static SafeMqttClient mqttClient = null; + public static AppConfig appConfig = new AppConfig(); + + //public static IManagedMqttClient mqttClient = null; + + //public static DBClient dbClient = null; + + public static bool enableLog = false; + public static string DatabaseConnectStr = ""; + + public static bool saveHistory = true; + public static int isFirstConnect = 0; + + public static string OpName = "F56AE937-A27E-40A3-A4E1-1217CD71C9BC"; + + public static void Init(bool isEnableLog) + { + enableLog = isEnableLog; + //mqttClient = new MqttFactory().CreateManagedMqttClient(); + } + + public static void InitDatabase(string connStr) + { + DatabaseConnectStr = connStr; + //dbClient = new DBClientFactory("Mysql").Create(); + //dbClient.Connect(connStr); + } + + public static void SendMessage(string topic, string msg) + { + //if (mqttClient != null) + //{ + // mqttClient.EnqueueAsync(topic, msg); + //} + + //if (saveHistory) + //{ + // ThreadPool.QueueUserWorkItem((object obj) => + // { + // var opName = topic; + + + // var now = DateTime.Now; + // var currentDay = now.ToString("yyyyMMdd"); + + // string sql = " INSERT INTO z_save_position_" + currentDay + "(ID, OpName, Value, OperationTime, ProjectCode) VALUES('" + + + // Guid.NewGuid() + "', '" + opName + "', '" + msg + "', '" + now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "', '" + "PLC" + "');\n"; + + // MysqlClient.ExecQuerySQL(sql, DatabaseConnectStr, out string error); + // }); + //} + + if (enableLog) + { + MyLog4Net.MyLogHelper.Info("MQTT", "【TOPIC】" + topic + "【MESSAGE】" + msg); + } + + } + } + + public class Tools + { + public static string GetMd5(string str) + { + MD5 md5 = new MD5CryptoServiceProvider(); + var bytes = Encoding.UTF8.GetBytes(str); + return Encoding.UTF8.GetString(md5.ComputeHash(bytes)); + } + } +} diff --git a/GlobalVar/Program.cs b/GlobalVar/Program.cs new file mode 100644 index 0000000..4ee58d8 --- /dev/null +++ b/GlobalVar/Program.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace GlobalVar +{ + internal class Program + { + static void Main(string[] args) + { + + } + } +} diff --git a/GlobalVar/Properties/AssemblyInfo.cs b/GlobalVar/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..62fef0a --- /dev/null +++ b/GlobalVar/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("GlobalVar")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GlobalVar")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("fcfbef3b-bd04-432f-9b74-579ff8568eaa")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/GlobalVar/config.json b/GlobalVar/config.json new file mode 100644 index 0000000..a87795a --- /dev/null +++ b/GlobalVar/config.json @@ -0,0 +1,35 @@ +{ + "MachineTool": [ + { + "Enable": "1", + "Type": "Fanuc_CNC", + "ConnectStr": "10.10.59.103", + "Id": "307BF923-DEA4-446F-8B52-0C0A119C146D", + "Name": "Fanuc_CNC_1", + "DataTimeInterval": "10000", + "AxesTimeInterval": "50", + "Joints": [ + { + "Order": "0", + "JointName": "X1", + "ModelCode": "da2e82eb-0452-4a95-b437-1f846d85f6a6", + "JointType": "position", + "Axis": "y", + "Flip": "1", + "ValueFactor": "0.001", + "Delta": "0" + }, + { + "Order": "1", + "JointName": "Y1", + "ModelCode": "5cdbe8f5-70b1-4119-af20-a794e14d1b7d", + "JointType": "position", + "Axis": "z", + "Flip": "1", + "ValueFactor": "0.001", + "Delta": "0" + } + ] + } + ] +} \ No newline at end of file diff --git a/GlobalVar/packages.config b/GlobalVar/packages.config new file mode 100644 index 0000000..ec08056 --- /dev/null +++ b/GlobalVar/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/MyLog4Net/01_MyLog4Net.csproj b/MyLog4Net/01_MyLog4Net.csproj new file mode 100644 index 0000000..1c1c6ad --- /dev/null +++ b/MyLog4Net/01_MyLog4Net.csproj @@ -0,0 +1,61 @@ + + + + + Debug + AnyCPU + {1DC48C83-1842-4DE8-ACAF-26E1E7F7C58F} + Library + Properties + MyLog4Net + MyLog4Net + v4.8 + 512 + true + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\log4net.2.0.14\lib\net45\log4net.dll + + + + + + + + + + + + + + + + + + + + + Always + + + + \ No newline at end of file diff --git a/MyLog4Net/MyLogEventArgs.cs b/MyLog4Net/MyLogEventArgs.cs new file mode 100644 index 0000000..a913363 --- /dev/null +++ b/MyLog4Net/MyLogEventArgs.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MyLog4Net +{ + public class MyLogEventArgs : EventArgs + { + public string Message { get; set; } + public string Module { get; set; } + } +} diff --git a/MyLog4Net/MyLogHelper.cs b/MyLog4Net/MyLogHelper.cs new file mode 100644 index 0000000..cb446e4 --- /dev/null +++ b/MyLog4Net/MyLogHelper.cs @@ -0,0 +1,65 @@ +using log4net; +using System; + +namespace MyLog4Net +{ + public class MyLogHelper + { + public delegate void MyLogEventHandler(object sender, MyLogEventArgs e); + public static event MyLogEventHandler LogCommit; + + /// + /// 普通日志 + /// + /// 日志内容 + public static void Info(string module, string message) + { + ILog log = LogManager.GetLogger(module); + if (log.IsInfoEnabled) + { + log.Info(message); + + var e = new MyLogEventArgs(); + e.Module = module; + e.Message = message; + LogCommit?.Invoke(null, e); + } + } + /// + /// 错误日志带异常 + /// + /// 错误日志 + public static void Error(string module, string message, Exception ex) + { + ILog log = LogManager.GetLogger(module); + if (log.IsErrorEnabled) + { + log.Error(message, ex); + + var e = new MyLogEventArgs(); + e.Module = module; + e.Message = message; + LogCommit?.Invoke(null, e); + } + } + + /// + /// 错误日志不带异常 + /// + /// 错误日志 + public static void Error(string module, string message) + { + ILog log = LogManager.GetLogger(module); + if (log.IsErrorEnabled) + { + log.Error(message); + + var e = new MyLogEventArgs(); + e.Module = module; + e.Message = message; + LogCommit?.Invoke(null, e); + } + } + } + +} diff --git a/MyLog4Net/Properties/AssemblyInfo.cs b/MyLog4Net/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1228254 --- /dev/null +++ b/MyLog4Net/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Log4Net")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Log4Net")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("1dc48c83-1842-4de8-acaf-26e1e7f7c58f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)] diff --git a/MyLog4Net/log4net.config b/MyLog4Net/log4net.config new file mode 100644 index 0000000..92f4d40 --- /dev/null +++ b/MyLog4Net/log4net.config @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MyLog4Net/packages.config b/MyLog4Net/packages.config new file mode 100644 index 0000000..a0798f9 --- /dev/null +++ b/MyLog4Net/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/WebApi/02_WebApi.csproj b/WebApi/02_WebApi.csproj new file mode 100644 index 0000000..cd2e873 --- /dev/null +++ b/WebApi/02_WebApi.csproj @@ -0,0 +1,115 @@ + + + + + Debug + AnyCPU + {5C6E31A8-8B45-4459-BA62-07AF6135DF4A} + Exe + WebApi + WebApi + v4.8 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + LocalIntranet + + + false + + + Properties\app.manifest + + + + ..\DLL\DataLinkMesWork.dll + + + ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll + + + + + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll + + + + ..\packages\Microsoft.AspNet.Cors.5.2.9\lib\net45\System.Web.Cors.dll + + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.9\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.Cors.5.2.9\lib\net45\System.Web.Http.Cors.dll + + + ..\packages\Microsoft.AspNet.WebApi.SelfHost.5.2.9\lib\net45\System.Web.Http.SelfHost.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + + + + + + + {c7c5e929-be10-4ed6-94db-b8d65e05e52f} + 01_DatabaseClient + + + {1dc48c83-1842-4de8-acaf-26e1e7f7c58f} + 01_MyLog4Net + + + + \ No newline at end of file diff --git a/WebApi/AnalysisMsg.cs b/WebApi/AnalysisMsg.cs new file mode 100644 index 0000000..ef0fb90 --- /dev/null +++ b/WebApi/AnalysisMsg.cs @@ -0,0 +1,177 @@ +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; + +namespace WebApi +{ + public class AnalysisMsg + { + /// + /// UUID生成 + /// + /// + public static string UuidUtil() + { + string result = Guid.NewGuid().ToString(); + + return result; + } + /// + /// 人员基础数据下发(OK) + /// + /// + /// + public static string product(string url, [FromBody] JObject jobj) + { + var result = new msgResHeader(); + result.Code = "200"; + result.Message = ""; + + string errorMessage = ""; + string parentID = ""; + int AID = -1; + + if (jobj == null) + { + result.Message = "参数格式不正确!"; + result.Code = "500"; + string retString1 = JsonConvert.SerializeObject(result); + MyLog4Net.MyLogHelper.Info("装配信息res:", retString1); + return retString1; + } + int isError = 0; + string str = jobj.ToString(); + try + { + //存储日志 + var CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + //Event_MOM_Log_Insert,@创建时间,@内容 + var param1 = new SqlParameter[] { + new SqlParameter("@接口地址",url), + new SqlParameter("@接口类型",2), // 1. 主动调用接口 2. 被调用接口 + new SqlParameter("@请求内容",str), + new SqlParameter("@请求时间",CreateTime) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_请求记录", ConnectionString, ref param1, out DataTable dt, out errorMessage); + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + // 解析订单内容,存储数据库,根据实际业务来写 + IPC_product productDataList = JsonConvert.DeserializeObject(str); + List product_AssemblyInformation = productDataList.AssemblyInformation; + + + foreach (var personnelBaseData in personnelBaseDataList) + { + var parsingParam = new SqlParameter[] { + new SqlParameter("@所属公司",personnelBaseData.company), + new SqlParameter("@所属工厂",personnelBaseData.facility), + new SqlParameter("@所属部门",personnelBaseData.department), + new SqlParameter("@人员编号",personnelBaseData.employeeNo), + new SqlParameter("@人员名称",personnelBaseData.employeeName), + new SqlParameter("@电话",personnelBaseData.phone), + new SqlParameter("@邮箱",personnelBaseData.mail), + new SqlParameter("@班组",personnelBaseData.shift) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_接收_人员基础数据_增加", Program.ConnectionString, ref parsingParam, out DataTable parsingDt, out errorMessage); + if (errorMessage != "") + { + isError = 1; + } + if (parsingDt.Rows.Count > 0) + { + if (Convert.ToInt32(parsingDt.Rows[0]["result"]) == 1) + { + parentID = personnelBaseData.employeeNo; + // 权限工位 + List workStationList = personnelBaseData.workStationList; + if (workStationList != null) + { + foreach (PersonnelBaseWorkStationData item in workStationList) + { + var parsingParam2 = new SqlParameter[] { + new SqlParameter("@人员编号",parentID), + new SqlParameter("@产线编号",item.productionLineNo), + new SqlParameter("@工位编号",item.workStation), + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_接收_人员基础数据_权限工位_增加", Program.ConnectionString, ref parsingParam2, out DataTable parsingDt2, out errorMessage); + if (errorMessage != "") + { + isError = 1; + } + } + } + // 技能 + List skillList = personnelBaseData.skillList; + if (skillList != null) + { + foreach (PersonnelBaseSkillListData item in skillList) + { + var parsingParam2 = new SqlParameter[] { + new SqlParameter("@人员编号",parentID), + new SqlParameter("@技能编号",item.skillNo), + new SqlParameter("@技能名称",item.skillName), + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_接收_人员基础数据_技能_增加", Program.ConnectionString, ref parsingParam2, out DataTable parsingDt2, out errorMessage); + if (errorMessage != "") + { + isError = 1; + } + } + } + + // 返回响应结果 + // 包头 + if (errorMessage != "") + { + isError = 1; + } + } + else + { + isError = 1; + } + } + } + if (isError == 1) + { + result.msg = "存储过程调用失败!"; + result.code = "501"; + result.returnData = "ERROR"; + } + + //响应结果 + CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); + var resParam = new SqlParameter[] { + new SqlParameter("@AID",AID), + new SqlParameter("@响应时间",CreateTime), + new SqlParameter("@响应内容",JsonConvert.SerializeObject(result)) + }; + DataLinkMesWork.SQLCommon.ExecuteStoredProcedure("接口_IOT接口交互日志_响应记录", Program.ConnectionString, ref resParam, out errorMessage); + if (dt.Rows.Count > 0) + { + AID = Convert.ToInt32(dt.Rows[0]["AID"]); + } + } + catch (Exception err) + { + result.code = "501"; + result.msg = err.Message; + result.returnData = "ERROR"; + } + + string retString = JsonConvert.SerializeObject(result); + MyLog4Net.MyLogHelper.Info("人员基础数据下发res:", retString); + return retString; + } + + } +} diff --git a/WebApi/ApiTools.cs b/WebApi/ApiTools.cs new file mode 100644 index 0000000..a51e14d --- /dev/null +++ b/WebApi/ApiTools.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; +using System.Net.Http; +using System.Text.RegularExpressions; + +namespace WebApi +{ + public enum ResponseCode + { + Fail = 00000, + Success = 00200, + } + + public class ApiTools + { + private string msgModel = "{{\"code\":{0},\"message\":\"{1}\",\"result\":{2}}}"; + public ApiTools() + { + } + public HttpResponseMessage MsgFormat(ResponseCode code, string explanation, string result) + { + string r = @"^(\-|\+)?\d+(\.\d+)?$"; + string json = string.Empty; + if (Regex.IsMatch(result, r) || result.ToLower() == "true" || result.ToLower() == "false" || result == "[]" || result.Contains('{')) + { + json = string.Format(msgModel, (int)code, explanation, result); + } + else + { + if (result.Contains('"')) + { + json = string.Format(msgModel, (int)code, explanation, result); + } + else + { + json = string.Format(msgModel, (int)code, explanation, "\"" + result + "\""); + } + } + return new HttpResponseMessage { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") }; + } + } +} diff --git a/WebApi/App.config b/WebApi/App.config new file mode 100644 index 0000000..c2f5d55 --- /dev/null +++ b/WebApi/App.config @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebApi/Controller/IpcController.cs b/WebApi/Controller/IpcController.cs new file mode 100644 index 0000000..7418852 --- /dev/null +++ b/WebApi/Controller/IpcController.cs @@ -0,0 +1,51 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Web; +using System.Web.Http; +using System.Collections.Concurrent; +using Newtonsoft.Json.Linq; +using System.Runtime.Remoting.Messaging; + + +namespace WebApi +{ + + public class IpcController : ApiController + { + readonly string headUrl = "Project/"; + /// + /// 插入数据库 + /// + /// + /// + [HttpPost] + [Route("IPC/product")] + public HttpResponseMessage product([FromBody] JObject jobj) + { + return new HttpResponseMessage + { + Content = new StringContent(AnalysisMsg.product(headUrl + System.Reflection.MethodBase.GetCurrentMethod().Name, jobj), Encoding.GetEncoding("UTF-8"), "application/json") + }; + } + + [HttpGet] + [Route("getInfo")] + public HttpResponseMessage getInfo() + { + string pp = @"{\""Result\"":\""OK\""}"; + try + { + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + return new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; + } + } +} diff --git a/WebApi/Controller/ZSavePositionController.cs b/WebApi/Controller/ZSavePositionController.cs new file mode 100644 index 0000000..9bfb916 --- /dev/null +++ b/WebApi/Controller/ZSavePositionController.cs @@ -0,0 +1,119 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Web; +using System.Web.Http; +using System.Collections.Concurrent; +using Newtonsoft.Json.Linq; + + +namespace WebApi +{ + + [RoutePrefix("api/ZSavePosition")] //定义路由前缀 + public class ZSavePositionController : ApiController + { + /// + /// 插入数据库 + /// + /// + /// + [HttpPost] + public void Insert(JObject jObject) + { + string pp = ""; + try + { + var z_Save_Position = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(jObject)); + + //z_Save_Position.OpName = "a1"; + //z_Save_Position.Value = "asd"; + //z_Save_Position.OperationTime = "2022/06/29 16:40:43"; + //z_Save_Position.ProjectCode = "123"; + + string sql = "INSERT INTO z_save_position(OpName, Value, OperationTime, ProjectCode) VALUES('" + z_Save_Position.OpName + "', '" + z_Save_Position.Value + "', '" + z_Save_Position.OperationTime + "', '" + z_Save_Position.ProjectCode + "');\n"; + var res = GlobalVar.dbClient.ExecNonQuery(sql); + + pp = res.ToString(); + + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + // Console.WriteLine(err.Message); + } + } + + [HttpPost] + public HttpResponseMessage SelectPage([FromBody] JObject jobj) + { + string pp = ""; + try + { + var OpName = jobj["OpName"].ToString(); + var StartTime = jobj["StartTime"].ToString(); + var EndTime = jobj["EndTime"].ToString(); + var PageCurrent = jobj["PageCurrent"].ToString(); + var PageSize = jobj["PageSize"].ToString(); + + string sql = "SELECT * FROM z_save_position " + + "WHERE(OperationTime BETWEEN '" + StartTime + "' AND '" + EndTime + "') AND OpName like '" + OpName + "%' " + + "ORDER BY OperationTime;\n"; + var res = GlobalVar.dbClient.ExecQuery(sql); + + var zSavePersonList = Z_Save_Position.DataTableToClass(res); + + var newZSaveList = DatabaseClient.DBClient.SplitePage(zSavePersonList, Convert.ToInt32(PageSize), Convert.ToInt32(PageCurrent)); + var tableData = (JArray)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(newZSaveList)); + JObject resjobj = new JObject() { + new JProperty("ItemCount", zSavePersonList.Count.ToString()), + new JProperty("TableData",tableData) + }; + + pp = resjobj.ToString(); + + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + // Console.WriteLine(err.Message); + } + HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; + return result; + } + + [HttpPost] + public HttpResponseMessage Select([FromBody] JObject jobj) + { + string pp = ""; + try + { + var OpName = jobj["OpName"].ToString(); + var StartTime = jobj["StartTime"].ToString(); + var EndTime = jobj["EndTime"].ToString(); + + string sql = "SELECT * FROM z_save_position " + + "WHERE(OperationTime BETWEEN '"+StartTime+"' AND '"+EndTime+"') AND OpName like '"+OpName+"%' " + + "ORDER BY OperationTime;\n"; + var res = GlobalVar.dbClient.ExecQuery(sql); + + var zSavePersonList = Z_Save_Position.DataTableToClass(res); + + var zSavePersonListStr = JsonConvert.SerializeObject(zSavePersonList); + + pp = zSavePersonListStr.ToString(); + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + // Console.WriteLine (err.Message); + } + HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; + return result; + } + } +} diff --git a/WebApi/Controller/ZSaveTagController.cs b/WebApi/Controller/ZSaveTagController.cs new file mode 100644 index 0000000..4371fde --- /dev/null +++ b/WebApi/Controller/ZSaveTagController.cs @@ -0,0 +1,122 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Web; +using System.Web.Http; +using System.Collections.Concurrent; +using Newtonsoft.Json.Linq; + + +namespace WebApi +{ + + [RoutePrefix("api/ZSaveTag")] //定义路由前缀 + public class ZSaveTagController : ApiController + { + + /// + /// 插入数据库 + /// + /// + /// + [HttpPost] + public void Insert(JObject jObject) + { + string pp = ""; + try + { + var z_Save_Tag = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(jObject)); + + string sql = "" + + "INSERT INTO z_save_tag (OpName, TagID, Value, KeepTime, OperationTime, ProjectCode) " + + " VALUES('"+ z_Save_Tag.OpName+ "', '"+ z_Save_Tag.TagID+ "', '"+ z_Save_Tag.Value+ "', '"+ z_Save_Tag .KeepTime+ "', '"+ z_Save_Tag .OperationTime+ "', '"+ z_Save_Tag .ProjectCode+ "'); \n"; + var res = GlobalVar.dbClient.ExecNonQuery(sql); + + pp = res.ToString(); + + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + } + // HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; + // return result; + } + + [HttpPost] + public HttpResponseMessage SelectPage([FromBody]JObject jobj) + { + string pp = ""; + + try + { + var OpName = jobj["OpName"].ToString(); + var StartTime = jobj["StartTime"].ToString(); + var EndTime = jobj["EndTime"].ToString(); + var PageCurrent = jobj["PageCurrent"].ToString(); + var PageSize = jobj["PageSize"].ToString(); + + + string sql = "SELECT * FROM z_save_tag " + + "WHERE(OperationTime BETWEEN '" + StartTime + "' AND '" + EndTime + "') AND OpName like '" + OpName + "%' " + + "ORDER BY OperationTime;\n"; + var res = GlobalVar.dbClient.ExecQuery(sql); + + var zSavePersonList = Z_Save_Position.DataTableToClass(res); + + var newZSaveList = DatabaseClient.DBClient.SplitePage(zSavePersonList, Convert.ToInt32(PageSize), Convert.ToInt32(PageCurrent)); + var tableData = (JArray)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(newZSaveList)); + JObject resjobj = new JObject() { + new JProperty("ItemCount", zSavePersonList.Count.ToString()), + new JProperty("TableData",tableData) + }; + + pp = resjobj.ToString() + //.Replace("\r\n","") + ; + + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + // Console.WriteLine(err.Message); + } + HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; + return result; + } + + [HttpPost] + public HttpResponseMessage Select([FromBody] JObject jobj) + { + string pp = ""; + try + { + string OpName = jobj["OpName"].ToString(); + string StartTime = jobj["StartTime"].ToString(); + string EndTime = jobj["EndTime"].ToString(); + + string sql = "SELECT * FROM z_save_tag " + + "WHERE(OperationTime BETWEEN '"+StartTime+"' AND '"+EndTime+"') AND OpName like '"+OpName+"%' " + + "ORDER BY OperationTime;\n"; + var res = GlobalVar.dbClient.ExecQuery(sql); + + var zSavePersonList = Z_Save_Position.DataTableToClass(res); + + var zSavePersonListStr = JsonConvert.SerializeObject(zSavePersonList); + + pp = zSavePersonListStr.ToString(); + } + catch (Exception err) + { + GlobalVar.log.Error(err.Message); + // Console.WriteLine(err.Message); + } + HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(pp, Encoding.GetEncoding("UTF-8"), "application/json") }; + return result; + } + } +} diff --git a/WebApi/GlobalVar.cs b/WebApi/GlobalVar.cs new file mode 100644 index 0000000..1f22604 --- /dev/null +++ b/WebApi/GlobalVar.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DatabaseClient; +using log4net; + +namespace WebApi +{ + class GlobalVar + { + public static DatabaseClient.DBClient dbClient; + public static ILog log = LogManager.GetLogger("WebApi"); + } +} diff --git a/WebApi/IPC_product.cs b/WebApi/IPC_product.cs new file mode 100644 index 0000000..f59d31d --- /dev/null +++ b/WebApi/IPC_product.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using System.Data; + +namespace WebApi +{ + public class IPC_product + { + public string MsgId = ""; + public int MsgSource = 0; + public List AssemblyInformation = new List(); + public string SendTime = string.Empty; + } + + public class IPC_product_AssemblyInformation + { + public string productNo = string.Empty; + public string productName = string.Empty; + public int productPosition = 0; + } + +} diff --git a/WebApi/InitServer.cs b/WebApi/InitServer.cs new file mode 100644 index 0000000..6c5c09c --- /dev/null +++ b/WebApi/InitServer.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Net.Http.Formatting; +using System.Net.Http.Headers; +using System.Web.Http; +using System.Web.Http.Cors; +using System.Web.Http.SelfHost; + +namespace WebApi +{ + + + public class InitServer + { + HttpSelfHostConfiguration config = null; + HttpSelfHostServer server = null; + public InitServer(string Url_WebApi) + { + // var Url_WebApi = System.Configuration.ConfigurationManager.AppSettings["Url_WebApi"]; + Init(Url_WebApi); + } + public void Init(string url) + { + config = new HttpSelfHostConfiguration(url); + + // 启用跨域 + config.EnableCors(new EnableCorsAttribute("*", "*", "*")); + // 启用特性路由 + config.MapHttpAttributeRoutes(); + + //config.Routes.MapHttpRoute( + // name: "DefaultApi", + // routeTemplate: "api/{controller}/{id}", + // defaults: new { id = RouteParameter.Optional } + //); + + // 自定义路由匹配到action + config.Routes.MapHttpRoute( + name: "API Default", + routeTemplate: "api/{controller}/{action}/{id}", + defaults: new { id = RouteParameter.Optional } + ); + + + + server = new HttpSelfHostServer(config); + + server.OpenAsync().Wait(); + + + } + public class JsonContentNegotiator : IContentNegotiator + { + private readonly JsonMediaTypeFormatter _jsonFormatter; + + public JsonContentNegotiator(JsonMediaTypeFormatter formatter) + { + _jsonFormatter = formatter; + } + public ContentNegotiationResult Negotiate(Type type, HttpRequestMessage request, IEnumerable formatters) + { + var result = new ContentNegotiationResult(_jsonFormatter, new MediaTypeHeaderValue("application/json")); + return result; + } + } + } +} diff --git a/WebApi/Program.cs b/WebApi/Program.cs new file mode 100644 index 0000000..531e9ae --- /dev/null +++ b/WebApi/Program.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DatabaseClient; + + +namespace WebApi +{ + + internal class Program + { + static void Main(string[] args) + { + + // CallDbFactoryTest(); + + #region DBConfig + var DatabaseType = System.Configuration.ConfigurationManager.AppSettings["DatabaseType"]; + var connString = ""; + switch (DatabaseType.ToLower()) + { + case "mysql": + { + connString = System.Configuration.ConfigurationManager.AppSettings["MysqlConnectString"]; + break; + } + case "mssql": + { + connString = System.Configuration.ConfigurationManager.AppSettings["MssqlConnectString"]; + break; + } + case "sqlite": + { + connString = System.Configuration.ConfigurationManager.AppSettings["SqliteConnectString"]; + break; + } + default: + { + connString = System.Configuration.ConfigurationManager.AppSettings["MysqlConnectString"]; + break; + } + } + + GlobalVar.dbClient = new DBClientFactory(DatabaseType).Create(); + GlobalVar.dbClient.Connect(connString); + #endregion + + var WebApiUrl = System.Configuration.ConfigurationManager.AppSettings["WebApiUrl"]; + new InitServer(WebApiUrl); + + + //GlobalVar.log.Error("错误", new Exception("发生了一个异常"));//错误 + //GlobalVar.log.Fatal("严重错误", new Exception("发生了一个致命错误"));//严重错误 + //GlobalVar.log.Info("信息"); //记录一般信息 + //GlobalVar.log.Debug("调试信息");//记录调试信息 + //GlobalVar.log.Warn("警告");//记录警告信息 + + + GlobalVar.log.Info("Start WebApi server..."); //记录一般信息 + GlobalVar.log.Info(" " + WebApiUrl); //记录一般信息 + // Console.WriteLine("Start WebApi server..."); + // Console.WriteLine(" " + WebApiUrl); + + Console.ReadKey(); + } + + static void CallDbFactoryTest() + { + DBClientFactory factory = new DBClientFactory("Mysql"); + // 只需切换 MySqlDatabaseFactory 就可切换数据库 + var mySqlClient = factory.Create(); + + + // MySqlClient sqlClient = new MySqlClient(); + mySqlClient.Connect("server=localhost;database=mytest;username=root;password=123456;"); + var ds = mySqlClient.ExecQuery("select * from Z_Save_Position"); + var zSavePositionList = Z_Save_Position.DataTableToClass(ds); + } + } +} diff --git a/WebApi/Properties/AssemblyInfo.cs b/WebApi/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..35fc201 --- /dev/null +++ b/WebApi/Properties/AssemblyInfo.cs @@ -0,0 +1,39 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WebApi")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WebApi")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5c6e31a8-8b45-4459-ba62-07af6135df4a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +// 指定log4net 的配置文件 +[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)] \ No newline at end of file diff --git a/WebApi/Properties/app.manifest b/WebApi/Properties/app.manifest new file mode 100644 index 0000000..db843ba --- /dev/null +++ b/WebApi/Properties/app.manifest @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebApi/Z_Save_Position.cs b/WebApi/Z_Save_Position.cs new file mode 100644 index 0000000..004c84a --- /dev/null +++ b/WebApi/Z_Save_Position.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using System.Data; + +namespace WebApi +{ + class Z_Save_Position + { + + public int ID; + public string OpName; + public string Value; + public string OperationTime; + public string ProjectCode; + + public Z_Save_Position() { } + + public static List DataTableToClass(DataTable dt_Z_Save_Position) + { + List z_Save_PositionList = new List(); + Z_Save_Position z_Save_Position; + for (int i = 0; i < dt_Z_Save_Position.Rows.Count; i++) + { + z_Save_Position = new Z_Save_Position(); + var row = dt_Z_Save_Position.Rows[i]; + z_Save_Position.ID = Convert.ToInt32(row["ID"]); + z_Save_Position.OpName = row["OpName"].ToString(); + z_Save_Position.Value = row["Value"].ToString(); + z_Save_Position.OperationTime = row["OperationTime"].ToString(); + z_Save_Position.ProjectCode = row["ProjectCode"].ToString(); + z_Save_PositionList.Add(z_Save_Position); + } + + return z_Save_PositionList; + } + } diff --git a/WebApi/Z_Save_Tag.cs b/WebApi/Z_Save_Tag.cs new file mode 100644 index 0000000..4626848 --- /dev/null +++ b/WebApi/Z_Save_Tag.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WebApi +{ + class Z_Save_Tag + { + public int ID; + public string OpName; + public string TagID; + public string Value; + public string KeepTime; + public string OperationTime; + public string ProjectCode; + public Z_Save_Tag() + { + + } + public static List DataTableToClass(DataTable dt_Z_Save_Tag) + { + List z_Save_TagList = new List(); + Z_Save_Tag z_Save_Tag; + for (int i = 0; i < dt_Z_Save_Tag.Rows.Count; i++) + { + z_Save_Tag = new Z_Save_Tag(); + + var row = dt_Z_Save_Tag.Rows[i]; + z_Save_Tag.ID = Convert.ToInt32(row["ID"]); + z_Save_Tag.OpName = row["OpName"].ToString(); + z_Save_Tag.TagID = row["TagID"].ToString(); + z_Save_Tag.Value = row["Value"].ToString(); + z_Save_Tag.KeepTime = row["KeepTime"].ToString(); + z_Save_Tag.OperationTime = row["OperationTime"].ToString(); + z_Save_Tag.ProjectCode = row["ProjectCode"].ToString(); + + z_Save_TagList.Add(z_Save_Tag); + } + + return z_Save_TagList; + } + } +} diff --git a/WebApi/log4net.config b/WebApi/log4net.config new file mode 100644 index 0000000..5ec9cd8 --- /dev/null +++ b/WebApi/log4net.config @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebApi/msgResHeader.cs b/WebApi/msgResHeader.cs new file mode 100644 index 0000000..0b3fe72 --- /dev/null +++ b/WebApi/msgResHeader.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace WebApi +{ + public class msgResHeader + { + public string Code = string.Empty; + public string Message = string.Empty; + public string MsgId = string.Empty; + } +} diff --git a/WebApi/mysql.sql b/WebApi/mysql.sql new file mode 100644 index 0000000..af19273 --- /dev/null +++ b/WebApi/mysql.sql @@ -0,0 +1,30 @@ +CREATE DATABASE mytest; +USE mytest; +# show databases; +# show engines; +# show variables like '%character%'; + +-- auto-generated definition +create table z_save_position +( + ID int auto_increment + primary key, + OpName varchar(50) null, + Value varchar(200) null, + OperationTime datetime null, + ProjectCode varchar(50) null +)engine = InnoDB; + + +-- auto-generated definition +create table z_save_tag +( + ID int auto_increment + primary key, + OpName varchar(50) null, + TagID varchar(50) null, + Value varchar(200) null, + KeepTime varchar(50) null, + OperationTime datetime null, + ProjectCode varchar(50) null +)engine = InnoDB; \ No newline at end of file diff --git a/WebApi/packages.config b/WebApi/packages.config new file mode 100644 index 0000000..49b7fab --- /dev/null +++ b/WebApi/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file