From c3fdd3ead425cf39da619a8e69a1a1784a28b492 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 02 10月 2024 09:34:15 +0800 Subject: [PATCH] 调整sda --- SDA/iWareSda/iWareSda.csproj | 11 + SDA/iWareModel/iWareModel.csproj | 2 SDA/iWareModel/EnumType/EDevice/EDevice.cs | 3 SDA/LA24030_LuLiPackageLine_SDA.sln | 2 SDA/iWareCommon/Utils/Log4Net/LogType.cs | 6 SDA/iWareCommon/log4net_iWare.config | 17 +- SDA/iWareSda/Common/Struct/WareSdaStruct.cs | 43 +++++ SDA/iWareSda/SdaMainForm.cs | 212 ++++++++------------------ SDA/iWareSda/App.config | 18 - SDA/iWareSda/SdaMainForm.Designer.cs | 149 +---------------- 10 files changed, 154 insertions(+), 309 deletions(-) diff --git a/SDA/LA24030_LuLiPackageLine_SDA.sln b/SDA/LA24030_LuLiPackageLine_SDA.sln index 8b0016b..2d3fed8 100644 --- a/SDA/LA24030_LuLiPackageLine_SDA.sln +++ b/SDA/LA24030_LuLiPackageLine_SDA.sln @@ -71,7 +71,7 @@ {3302F4AE-FF0A-49CA-BF38-D6F7E16E2153} = {50A3ECEF-B287-46BD-8271-AF2387438D62} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - VisualSVNWorkingCopyRoot = . SolutionGuid = {F9CA2CC3-85DB-4A04-8692-1EC016FC394A} + VisualSVNWorkingCopyRoot = . EndGlobalSection EndGlobal diff --git a/SDA/iWareCommon/Utils/Log4Net/LogType.cs b/SDA/iWareCommon/Utils/Log4Net/LogType.cs index 49ad21b..5314e60 100644 --- a/SDA/iWareCommon/Utils/Log4Net/LogType.cs +++ b/SDA/iWareCommon/Utils/Log4Net/LogType.cs @@ -27,10 +27,8 @@ /// RGV浠诲姟绾跨▼鏃ュ織 /// </summary> RgvThreadService = 14, - /// <summary> - /// 妗佹灦浠诲姟绾跨▼鏃ュ織 - /// </summary> - TrussThreadService = 15, + + StationSdaService = 15, #region SDA鐩稿叧 diff --git a/SDA/iWareCommon/log4net_iWare.config b/SDA/iWareCommon/log4net_iWare.config index 1270697..648f331 100644 --- a/SDA/iWareCommon/log4net_iWare.config +++ b/SDA/iWareCommon/log4net_iWare.config @@ -5,9 +5,8 @@ <appSettings> </appSettings> <log4net> - <!-- 閲嶆柊鑾峰彇鍙戝姩鏈轰俊鎭�愪俊鎭�戞棩蹇�--> - <appender name="AutoUpdateEngineInfoTask_Info" type="log4net.Appender.RollingFileAppender"> - <file value="d:\\Log\\XiGangLog\\iWareCC\\AutoUpdateEngineInfoTask_Info\\" /> + <appender name="StationSdaService_Info" type="log4net.Appender.RollingFileAppender"> + <file value="d:\\Log\\XiGangLog\\iWareCC\\StationSdaService_Info\\" /> <appendToFile value="true" /> <rollingStyle value="Date" /> <staticLogFileName value="false" /> @@ -17,13 +16,13 @@ <param name="ConversionPattern" value="%n娑堟伅鏃堕棿锛�%d [%t] %n娑堟伅绾у埆锛�%-5p %n娑� 鎭� 绫伙細%c [%x] %n%m %n "/> </layout> <filter type="log4net.Filter.LoggerMatchFilter"> - <loggerToMatch value="AutoUpdateEngineInfoTask_Info" /> + <loggerToMatch value="StationSdaService_Info" /> </filter> <filter type="log4net.Filter.DenyAllFilter" /> </appender> <!--閲嶆柊鑾峰彇鍙戝姩鏈轰俊鎭�愰敊璇�戞棩蹇�--> - <appender name="AutoUpdateEngineInfoTask_Error" type="log4net.Appender.RollingFileAppender"> - <file value="d:\\Log\\XiGangLog\\iWareCC\\AutoUpdateEngineInfoTask_Error\\" /> + <appender name="StationSdaService_Error" type="log4net.Appender.RollingFileAppender"> + <file value="d:\\Log\\XiGangLog\\iWareCC\\StationSdaService_Error\\" /> <appendToFile value="true" /> <rollingStyle value="Date" /> <staticLogFileName value="false" /> @@ -33,7 +32,7 @@ <param name="ConversionPattern" value="%n寮傚父鏃堕棿锛�%d [%t] %n寮傚父绾у埆锛�%-5p %n寮� 甯� 绫伙細%c [%x] %n%m %n "/> </layout> <filter type="log4net.Filter.LoggerMatchFilter"> - <loggerToMatch value="AutoUpdateEngineInfoTask_Error" /> + <loggerToMatch value="StationSdaService_Error" /> </filter> <filter type="log4net.Filter.DenyAllFilter" /> </appender> @@ -624,8 +623,8 @@ </appender> <root> <level value="ALL"/> - <appender-ref ref="AutoUpdateEngineInfoTask_Info"/> - <appender-ref ref="AutoUpdateEngineInfoTask_Error"/> + <appender-ref ref="StationSdaService_Info"/> + <appender-ref ref="StationSdaService_Error"/> <appender-ref ref="AutoIssueInStoreTask_Info"/> <appender-ref ref="AutoIssueInStoreTask_Error"/> <appender-ref ref="EmptySalverTransferTask_Info"/> diff --git a/SDA/iWareModel/EnumType/EDevice/EDevice.cs b/SDA/iWareModel/EnumType/EDevice/EDevice.cs index 73c3706..3eeddcc 100644 --- a/SDA/iWareModel/EnumType/EDevice/EDevice.cs +++ b/SDA/iWareModel/EnumType/EDevice/EDevice.cs @@ -46,5 +46,8 @@ //AGV = 1019, AGV = 1099, + + + Station = 7777 } } diff --git a/SDA/iWareModel/iWareModel.csproj b/SDA/iWareModel/iWareModel.csproj index 2b99e58..9eadaa7 100644 --- a/SDA/iWareModel/iWareModel.csproj +++ b/SDA/iWareModel/iWareModel.csproj @@ -86,7 +86,9 @@ <Compile Include="EnumType\EDevice\Rgv\ERgvCmd.cs" /> <Compile Include="EnumType\EDevice\Rgv\ERgvEvent.cs" /> <Compile Include="EnumType\EDevice\Rgv\ERgvBodyTest.cs" /> + <Compile Include="EnumType\EDevice\Rgv\EStationMode.cs" /> <Compile Include="EnumType\EDevice\Rgv\ERgvMode.cs" /> + <Compile Include="EnumType\EDevice\Rgv\EStationState.cs" /> <Compile Include="EnumType\EDevice\Rgv\ERgvState.cs" /> <Compile Include="EnumType\EDevice\ESrmAlarm.cs" /> <Compile Include="EnumType\EDevice\Line\RgvErrorReason.cs" /> diff --git a/SDA/iWareSda/App.config b/SDA/iWareSda/App.config index 1b9bebc..654c61e 100644 --- a/SDA/iWareSda/App.config +++ b/SDA/iWareSda/App.config @@ -3,19 +3,11 @@ <appSettings> <!-- 璇█閰嶇疆 閰嶇疆 0 涓枃 1 鑻辨枃 --> <add key="LanguageFlg" value="0"/> - <!-- 鍫嗗灈鏈虹殑PLC 閰嶇疆 --> - <add key="Srm1_Address" value="192.168.10.60"/> - <add key="Srm2_Address" value="192.168.10.68"/> - <add key="Srm3_Address" value="192.168.10.76"/> - <add key="Srm4_Address" value="192.168.10.84"/> - <add key="Srm_Rack" value="0"/> - <add key="Srm_Slot" value="1"/> - <add key="Srm_Port" value="102"/> - <!-- RGV鐨凱LC 閰嶇疆 --> - <add key="RGV_Address" value="192.168.10.10"/> - <add key="RGV_Rack" value="0"/> - <add key="RGV_Slot" value="1"/> - <add key="RGV_Port" value="102"/> + <!-- 绔欑偣鐨凱LC 閰嶇疆 --> + <add key="Station_Address" value="192.168.10.10"/> + <add key="Station_Rack" value="0"/> + <add key="Station_Slot" value="1"/> + <add key="Station_Port" value="102"/> </appSettings> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> diff --git a/SDA/iWareSda/Common/Struct/WareSdaStruct.cs b/SDA/iWareSda/Common/Struct/WareSdaStruct.cs index e5d9b68..abac5b2 100644 --- a/SDA/iWareSda/Common/Struct/WareSdaStruct.cs +++ b/SDA/iWareSda/Common/Struct/WareSdaStruct.cs @@ -59,6 +59,17 @@ #endregion + #region 绔欑偣鐨凱LC鍦板潃 + + public const CpuType Station_PLC_CpuType = CpuType.S71500; + public const SiemensPLCS Station_SiemensPLCS = SiemensPLCS.S1500; + public static string Station_Address = ConfigHelper.GetConfigString("Station_Address"); + public static short Station_Rack = (short)ConfigHelper.GetConfigInt("Station_Rack"); + public static short Station_Slot = (short)ConfigHelper.GetConfigInt("Station_Slot"); + public static short Station_Port = (short)ConfigHelper.GetConfigInt("Station_Port"); + + #endregion + #region 杈撻�佺嚎鐨凱LC鍦板潃 //public const CpuType Line_PLC_CpuType = CpuType.S71500; @@ -76,6 +87,16 @@ /// RGV绔欑偣闆嗗悎 /// </summary> public static List<string> RgvStationList = new List<string>() { + "1001","1002","1003","1004","1005","1006","1007","1008","1009","1010", + "1011","1012","1013","1014","1015", + "1020","1030","1040", //鎷嗙洏鏈� 鎻愬崌鏈� RGV + "1019" + }; + + /// <summary> + /// 绔欑偣闆嗗悎 + /// </summary> + public static List<string> StationStationList = new List<string>() { "1001","1002","1003","1004","1005","1006","1007","1008","1009","1010", "1011","1012","1013","1014","1015", "1020","1030","1040", //鎷嗙洏鏈� 鎻愬崌鏈� RGV @@ -209,6 +230,28 @@ {"1.4","杈撻�佺嚎閫氳寮傚父"} }; + + //閲岄潰鏈夌┖鏍硷紝鍒繕浜嗘渶鍚巘rim涓� + /// <summary> + /// RGV鎶ヨ瀛楀吀 + /// key:鎶ヨ浠g爜 value锛氭姤璀﹀唴瀹� + /// </summary> + public static IDictionary<string, string> StationAlertDict = new System.Collections.Generic.Dictionary<string, string>() { + {"0.0","鍓嶆瀬闄愬紓甯�"}, + {"0.1","鍚庢瀬闄愬紓甯�"}, + {"0.2","鎬ュ仠寮傚父"}, + {"0.3","琛岃蛋婵�鍏夋祴璺濆�兼棤鍙樺寲"}, + {"0.4","琛岃蛋婵�鍏夋祴璺濆�间綅闆�"}, + {"0.5","琛岃蛋鍙橀鍣ㄥ紓甯�"}, + {"0.6","杈撻�佸彉棰戝櫒寮傚父"}, + {"0.7","琛岃蛋瓒呮椂寮傚父"}, + {"1.0","杈撻�佽秴鏃跺紓甯�"}, + {"1.1","宸︿晶绐佸嚭寮傚父"}, + {"1.2","鍙充晶绐佸嚭寮傚父"}, + {"1.3","杈撻�佺嚎绐佸嚭寮傚父"}, + {"1.4","杈撻�佺嚎閫氳寮傚父"} + }; + #endregion } } diff --git a/SDA/iWareSda/SdaMainForm.Designer.cs b/SDA/iWareSda/SdaMainForm.Designer.cs index d4298a1..4635990 100644 --- a/SDA/iWareSda/SdaMainForm.Designer.cs +++ b/SDA/iWareSda/SdaMainForm.Designer.cs @@ -43,16 +43,8 @@ this.lbl_Main2 = new System.Windows.Forms.Label(); this.lbl_Main1 = new System.Windows.Forms.Label(); this.pictureBox5 = new System.Windows.Forms.PictureBox(); - this.tabPage_Srm1 = new System.Windows.Forms.TabPage(); - this.tb_Srm1 = new System.Windows.Forms.TextBox(); - this.tabPage_Srm2 = new System.Windows.Forms.TabPage(); - this.tb_Srm2 = new System.Windows.Forms.TextBox(); - this.tabPage_Srm3 = new System.Windows.Forms.TabPage(); - this.tb_Srm3 = new System.Windows.Forms.TextBox(); - this.tabPage_Srm4 = new System.Windows.Forms.TabPage(); - this.tb_Srm4 = new System.Windows.Forms.TextBox(); this.tabPage_RGV = new System.Windows.Forms.TabPage(); - this.tb_Rgv = new System.Windows.Forms.TextBox(); + this.tb_Station = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.panel1.SuspendLayout(); @@ -60,10 +52,6 @@ this.tabPage_Main.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit(); - this.tabPage_Srm1.SuspendLayout(); - this.tabPage_Srm2.SuspendLayout(); - this.tabPage_Srm3.SuspendLayout(); - this.tabPage_Srm4.SuspendLayout(); this.tabPage_RGV.SuspendLayout(); this.SuspendLayout(); // @@ -82,10 +70,6 @@ // tabControl1 // this.tabControl1.Controls.Add(this.tabPage_Main); - this.tabControl1.Controls.Add(this.tabPage_Srm1); - this.tabControl1.Controls.Add(this.tabPage_Srm2); - this.tabControl1.Controls.Add(this.tabPage_Srm3); - this.tabControl1.Controls.Add(this.tabPage_Srm4); this.tabControl1.Controls.Add(this.tabPage_RGV); this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControl1.Location = new System.Drawing.Point(0, 0); @@ -235,117 +219,28 @@ this.pictureBox5.TabIndex = 15; this.pictureBox5.TabStop = false; // - // tabPage_Srm1 - // - this.tabPage_Srm1.Controls.Add(this.tb_Srm1); - this.tabPage_Srm1.Location = new System.Drawing.Point(4, 25); - this.tabPage_Srm1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tabPage_Srm1.Name = "tabPage_Srm1"; - this.tabPage_Srm1.Size = new System.Drawing.Size(1082, 728); - this.tabPage_Srm1.TabIndex = 2; - this.tabPage_Srm1.Text = "鍫嗗灈鏈�1"; - this.tabPage_Srm1.UseVisualStyleBackColor = true; - // - // tb_Srm1 - // - this.tb_Srm1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tb_Srm1.Font = new System.Drawing.Font("瀹嬩綋", 9.75F, System.Drawing.FontStyle.Bold); - this.tb_Srm1.Location = new System.Drawing.Point(0, 0); - this.tb_Srm1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tb_Srm1.Multiline = true; - this.tb_Srm1.Name = "tb_Srm1"; - this.tb_Srm1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tb_Srm1.Size = new System.Drawing.Size(1082, 728); - this.tb_Srm1.TabIndex = 1; - // - // tabPage_Srm2 - // - this.tabPage_Srm2.Controls.Add(this.tb_Srm2); - this.tabPage_Srm2.Location = new System.Drawing.Point(4, 25); - this.tabPage_Srm2.Name = "tabPage_Srm2"; - this.tabPage_Srm2.Size = new System.Drawing.Size(1082, 728); - this.tabPage_Srm2.TabIndex = 4; - this.tabPage_Srm2.Text = "鍫嗗灈鏈�2"; - this.tabPage_Srm2.UseVisualStyleBackColor = true; - // - // tb_Srm2 - // - this.tb_Srm2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tb_Srm2.Font = new System.Drawing.Font("瀹嬩綋", 9.75F, System.Drawing.FontStyle.Bold); - this.tb_Srm2.Location = new System.Drawing.Point(0, 0); - this.tb_Srm2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tb_Srm2.Multiline = true; - this.tb_Srm2.Name = "tb_Srm2"; - this.tb_Srm2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tb_Srm2.Size = new System.Drawing.Size(1082, 728); - this.tb_Srm2.TabIndex = 2; - // - // tabPage_Srm3 - // - this.tabPage_Srm3.Controls.Add(this.tb_Srm3); - this.tabPage_Srm3.Location = new System.Drawing.Point(4, 25); - this.tabPage_Srm3.Name = "tabPage_Srm3"; - this.tabPage_Srm3.Size = new System.Drawing.Size(1082, 728); - this.tabPage_Srm3.TabIndex = 5; - this.tabPage_Srm3.Text = "鍫嗗灈鏈�3"; - this.tabPage_Srm3.UseVisualStyleBackColor = true; - // - // tb_Srm3 - // - this.tb_Srm3.Dock = System.Windows.Forms.DockStyle.Fill; - this.tb_Srm3.Font = new System.Drawing.Font("瀹嬩綋", 9.75F, System.Drawing.FontStyle.Bold); - this.tb_Srm3.Location = new System.Drawing.Point(0, 0); - this.tb_Srm3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tb_Srm3.Multiline = true; - this.tb_Srm3.Name = "tb_Srm3"; - this.tb_Srm3.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tb_Srm3.Size = new System.Drawing.Size(1082, 728); - this.tb_Srm3.TabIndex = 2; - // - // tabPage_Srm4 - // - this.tabPage_Srm4.Controls.Add(this.tb_Srm4); - this.tabPage_Srm4.Location = new System.Drawing.Point(4, 25); - this.tabPage_Srm4.Name = "tabPage_Srm4"; - this.tabPage_Srm4.Size = new System.Drawing.Size(1082, 728); - this.tabPage_Srm4.TabIndex = 6; - this.tabPage_Srm4.Text = "鍫嗗灈鏈�4"; - this.tabPage_Srm4.UseVisualStyleBackColor = true; - // - // tb_Srm4 - // - this.tb_Srm4.Dock = System.Windows.Forms.DockStyle.Fill; - this.tb_Srm4.Font = new System.Drawing.Font("瀹嬩綋", 9.75F, System.Drawing.FontStyle.Bold); - this.tb_Srm4.Location = new System.Drawing.Point(0, 0); - this.tb_Srm4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tb_Srm4.Multiline = true; - this.tb_Srm4.Name = "tb_Srm4"; - this.tb_Srm4.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tb_Srm4.Size = new System.Drawing.Size(1082, 728); - this.tb_Srm4.TabIndex = 2; - // // tabPage_RGV // - this.tabPage_RGV.Controls.Add(this.tb_Rgv); + this.tabPage_RGV.Controls.Add(this.tb_Station); this.tabPage_RGV.Location = new System.Drawing.Point(4, 25); this.tabPage_RGV.Margin = new System.Windows.Forms.Padding(4); this.tabPage_RGV.Name = "tabPage_RGV"; this.tabPage_RGV.Size = new System.Drawing.Size(1082, 728); this.tabPage_RGV.TabIndex = 3; - this.tabPage_RGV.Text = "RGV"; + this.tabPage_RGV.Text = "绔欑偣"; this.tabPage_RGV.UseVisualStyleBackColor = true; // - // tb_Rgv + // tb_Station // - this.tb_Rgv.Dock = System.Windows.Forms.DockStyle.Fill; - this.tb_Rgv.Font = new System.Drawing.Font("瀹嬩綋", 9.75F, System.Drawing.FontStyle.Bold); - this.tb_Rgv.Location = new System.Drawing.Point(0, 0); - this.tb_Rgv.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.tb_Rgv.Multiline = true; - this.tb_Rgv.Name = "tb_Rgv"; - this.tb_Rgv.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.tb_Rgv.Size = new System.Drawing.Size(1082, 728); - this.tb_Rgv.TabIndex = 2; + this.tb_Station.Dock = System.Windows.Forms.DockStyle.Fill; + this.tb_Station.Font = new System.Drawing.Font("瀹嬩綋", 9.75F, System.Drawing.FontStyle.Bold); + this.tb_Station.Location = new System.Drawing.Point(0, 0); + this.tb_Station.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.tb_Station.Multiline = true; + this.tb_Station.Name = "tb_Station"; + this.tb_Station.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.tb_Station.Size = new System.Drawing.Size(1082, 728); + this.tb_Station.TabIndex = 2; // // label3 // @@ -385,14 +280,6 @@ this.tabPage_Main.ResumeLayout(false); this.panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit(); - this.tabPage_Srm1.ResumeLayout(false); - this.tabPage_Srm1.PerformLayout(); - this.tabPage_Srm2.ResumeLayout(false); - this.tabPage_Srm2.PerformLayout(); - this.tabPage_Srm3.ResumeLayout(false); - this.tabPage_Srm3.PerformLayout(); - this.tabPage_Srm4.ResumeLayout(false); - this.tabPage_Srm4.PerformLayout(); this.tabPage_RGV.ResumeLayout(false); this.tabPage_RGV.PerformLayout(); this.ResumeLayout(false); @@ -411,19 +298,11 @@ private System.Windows.Forms.Label lbl_Main2; private System.Windows.Forms.Label lbl_Main1; private System.Windows.Forms.PictureBox pictureBox5; - private System.Windows.Forms.TabPage tabPage_Srm1; - private System.Windows.Forms.TextBox tb_Srm1; private System.Windows.Forms.TabPage tabPage_RGV; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Button btn_Show; private System.Windows.Forms.Button btn_Hide; - private System.Windows.Forms.TextBox tb_Rgv; - private System.Windows.Forms.TabPage tabPage_Srm2; - private System.Windows.Forms.TextBox tb_Srm2; - private System.Windows.Forms.TabPage tabPage_Srm3; - private System.Windows.Forms.TextBox tb_Srm3; - private System.Windows.Forms.TabPage tabPage_Srm4; - private System.Windows.Forms.TextBox tb_Srm4; + private System.Windows.Forms.TextBox tb_Station; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; } diff --git a/SDA/iWareSda/SdaMainForm.cs b/SDA/iWareSda/SdaMainForm.cs index fa08681..c005de3 100644 --- a/SDA/iWareSda/SdaMainForm.cs +++ b/SDA/iWareSda/SdaMainForm.cs @@ -32,16 +32,16 @@ private static IDictionary<string, string> realtimePlcValueDict_Srm = new Dictionary<string, string>(); /// <summary> - /// RGV瀹炴椂PLC鍊煎瓧鍏� + /// Station瀹炴椂PLC鍊煎瓧鍏� /// </summary> - private static IDictionary<string, string> realtimePlcValueDict_Rgv = new Dictionary<string, string>(); + private static IDictionary<string, string> realtimePlcValueDict_Station = new Dictionary<string, string>(); #region 鍙戦�乄CS蹇冭烦 /// <summary> /// 鍙戦�佸爢鍨涙満鐨勫績璺� /// </summary> private List<Thread> SendStackerHeartToSrmThreads = new List<Thread>(); - private List<Thread> SendStackerHeartToRgvThreads = new List<Thread>(); + private List<Thread> SendStackerHeartToStationThreads = new List<Thread>(); /// <summary> /// 鍙戦�佽緭閫佺嚎鐨勫績璺� /// </summary> @@ -51,7 +51,7 @@ private List<Thread> GetSrmStateThreads = new List<Thread>(); - private List<Thread> GetRgvStateThreads = new List<Thread>(); + private List<Thread> GetStationStateThreads = new List<Thread>(); private List<Thread> GetLineStateThreads = new List<Thread>(); #endregion @@ -62,16 +62,16 @@ public static bool isShowPlcValue_Srm = false; /// <summary> - /// 鏄惁瑕佹樉绀哄疄鏃禦gv鐨凱LC鍊煎爢鍨涙満 + /// 鏄惁瑕佹樉绀哄疄鏃禨tation鐨凱LC鍊煎爢鍨涙満 /// </summary> - public static bool isShowPlcValue_Rgv = false; + public static bool isShowPlcValue_Station = false; static string errorStr = string.Empty; static string infoStr_ChangeHandshake = string.Empty; static string errorStr_Line = string.Empty; static string errorStr_Srm = string.Empty; - static string errorStr_Rgv = string.Empty; + static string errorStr_Station = string.Empty; static string infoStr_SaveLine = string.Empty; static string infoStr_Connection = string.Empty; @@ -107,14 +107,9 @@ try { #region 瀵瑰鍙戝竷WCF褰㈠紡鏁版嵁璁块棶鏈嶅姟 - var srmServiceHost = new ServiceHost(typeof(iWareSda.SrmService)); - srmServiceHost.Open(); - //var lineServiceHost = new ServiceHost(typeof(iWareSda.LineService)); - //lineServiceHost.Open(); - - var rgvServiceHost = new ServiceHost(typeof(iWareSda.RgvService)); - rgvServiceHost.Open(); + var StationServiceHost = new ServiceHost(typeof(iWareSda.StationService)); + StationServiceHost.Open(); #endregion @@ -140,91 +135,35 @@ #region 鐘舵�佷俊鎭幏鍙� - //鑾峰彇鍫嗗灈鏈虹殑鐘舵�佷俊鎭� - Srm_CacheEntity.DeviceObjs.ForEach(x => - { - var thread = new Thread(new ParameterizedThreadStart(GetSrmInfo)); - thread.Name = string.Format("鑾峰彇鍫嗗灈鏈簕0}鐨勭姸鎬�", x.View.DeviceName); - GetSrmStateThreads.Add(thread); - StartThread(thread, x); - }); - ////妯℃嫙娴嬭瘯 - //var y = Srm_CacheEntity.DeviceObjs[3]; - //var thread_test = new Thread(new ParameterizedThreadStart(GetSrmInfo)); - //thread_test.Name = string.Format("鑾峰彇鍫嗗灈鏈簕0}鐨勭姸鎬�", y.View.DeviceName); - //GetSrmStateThreads.Add(thread_test); - //StartThread(thread_test, y); - - //鑾峰彇Rgv鐨勭姸鎬佷俊鎭� - Rgv_CacheEntity.DeviceObjs.ForEach(x => + //鑾峰彇Station鐨勭姸鎬佷俊鎭� + Station_CacheEntity.DeviceObjs.ForEach(x => { - var thread = new Thread(new ParameterizedThreadStart(GetRgvInfo)); - thread.Name = string.Format("鑾峰彇Rgv{0}鐨勭姸鎬�", x.View.DeviceName); - GetRgvStateThreads.Add(thread); + var thread = new Thread(new ParameterizedThreadStart(GetStationInfo)); + thread.Name = string.Format("鑾峰彇Station{0}鐨勭姸鎬�", x.View.DeviceName); + GetStationStateThreads.Add(thread); StartThread(thread, x); }); - /* - Rgv_CacheEntity.DeviceObjs.ForEach(x => - { - var thread = new Thread(new ParameterizedThreadStart(HandleRGVAckBug)); - thread.Name = string.Format("淇Rgv{0}鐨凙CK BUG", x.View.DeviceName); - GetRgvStateThreads.Add(thread); - StartThread(thread, x); - }); - //*/ - - ////鑾峰彇杈撻�佺嚎鐨勭姸鎬佷俊鎭� - //HuscoLine_CacheEntity.DeviceObjs.ForEach(x => - //{ - // var thread = new Thread(new ParameterizedThreadStart(GetLineInfo)); - // thread.Name = string.Format("鑾峰彇杈撻�佺嚎{0}鐨勭姸鎬�", x.View.DeviceName); - // GetLineStateThreads.Add(thread); - // StartThread(thread, x); - //}); #endregion #region 璁惧鍙戦�佸績璺� - //寮�鍚� 鍫嗗灈鏈� 蹇冭烦鐨勭嚎绋� - Srm_CacheEntity.DeviceObjs.ForEach(x => + + //寮�鍚� Station 蹇冭烦鐨勭嚎绋� + Station_CacheEntity.DeviceObjs.ForEach(x => { - var thread = new Thread(new ParameterizedThreadStart(SendStackerHeartToSrm)); - thread.Name = string.Format("鑷姩鍙戦�佸爢鍨涙満{0}蹇冭烦", x.View.DeviceName); - SendStackerHeartToSrmThreads.Add(thread); + var thread = new Thread(new ParameterizedThreadStart(SendStackerHeartToStation)); + thread.Name = string.Format("鑷姩鍙戦�丼tation{0}蹇冭烦", x.View.DeviceName); + SendStackerHeartToStationThreads.Add(thread); StartThread(thread, x); }); - //寮�鍚� Rgv 蹇冭烦鐨勭嚎绋� - Rgv_CacheEntity.DeviceObjs.ForEach(x => - { - var thread = new Thread(new ParameterizedThreadStart(SendStackerHeartToRgv)); - thread.Name = string.Format("鑷姩鍙戦�丷gv{0}蹇冭烦", x.View.DeviceName); - SendStackerHeartToRgvThreads.Add(thread); - StartThread(thread, x); - }); - /* - //寮�鍚� 杈撻�佺嚎 蹇冭烦鐨勭嚎绋� - HuscoLine_CacheEntity.DeviceObjs.ForEach(x => - { - var thread = new Thread(new ParameterizedThreadStart(SendStackerHeartToLine)); - thread.Name = string.Format("鑷姩鍙戦�佽緭閫佺嚎{0}蹇冭烦", x.View.DeviceName); - SendStackerHeartToLineThreads.Add(thread); - StartThread(thread, x); - }); - //*/ #endregion - #region UI鏄剧ず - - var treadShowUI = new Thread(ShowUI); - treadShowUI.Start(); - - #endregion new Thread(DeleteData).Start(); //*/ @@ -492,16 +431,16 @@ #endregion - #region Rgv + #region Station #region 璁惧鐘舵�佷俊鎭� /// <summary> - /// 鑾峰彇 Rgv 鐨勭姸鎬佷俊鎭� + /// 鑾峰彇 Station 鐨勭姸鎬佷俊鎭� /// </summary> /// <param name="obj"></param> - private void GetRgvInfo(object obj) + private void GetStationInfo(object obj) { - var s = (RgvEntity)obj; + var s = (StationEntity)obj; if (s.plcService != null && !s.plcService.IsConnected) { s.plcService.Close(); @@ -514,8 +453,8 @@ s.InitData(); if (s.plcService == null || !s.plcService.IsConnected) { - errorStr_Rgv = "Rgv" + s.View.DeviceName + "杩炴帴宸叉柇寮�锛屾鍦ㄥ皾璇曟墦寮�銆傘�傘��"; - errorStr_Rgv = SysHelper.Language(WareSdaStruct.LanguageFlg, errorStr_Rgv, "Piler connection disconnected,waiting for reconnection "); + errorStr_Station = "Station" + s.View.DeviceName + "杩炴帴宸叉柇寮�锛屾鍦ㄥ皾璇曟墦寮�銆傘�傘��"; + errorStr_Station = SysHelper.Language(WareSdaStruct.LanguageFlg, errorStr_Station, "Piler connection disconnected,waiting for reconnection "); s.plcService.Close(); s.plcService.OpenService(); Thread.Sleep(100); @@ -524,7 +463,7 @@ else { var s7 = s.plcService; - var Rgv_db = s.DBBlockForWrite; + var Station_db = s.DBBlockForWrite; s.SetPropertyValueForRead(); s.SetPropertyValueForWrite(); @@ -533,44 +472,44 @@ //s.View.BodyTestName = s.GetBodyTestName(s.View.r_S); //s.View.StateName = s.GetStateName(s.View.R_State); - if (SdaMainForm.isShowPlcValue_Rgv) + if (SdaMainForm.isShowPlcValue_Station) { - string dbValues = SdaHelper.GetStrShow<RgvView, RgvDBForWrite, RgvDBForRead>(s.View, s.DBBlockForWrite, s.DBBlockForRead, "", "", s.View.DeviceId, s.View.DeviceName); - realtimePlcValueDict_Rgv[s.View.DeviceName] = dbValues; + string dbValues = SdaHelper.GetStrShow<StationView, StationDBForWrite, StationDBForRead>(s.View, s.DBBlockForWrite, s.DBBlockForRead, "", "", s.View.DeviceId, s.View.DeviceName); + realtimePlcValueDict_Station[s.View.DeviceName] = dbValues; } else { - realtimePlcValueDict_Rgv[s.View.DeviceName] = ""; + realtimePlcValueDict_Station[s.View.DeviceName] = ""; } - foreach (var item in s.View.R_RgvForReadCommList) + foreach (var item in s.View.R_StationForReadCommList) { //鍒ゆ柇濡傛灉ACK=1锛屽垯鍐欏叆STB涓�0 if (item.R_ACK == true) { - var writeObj = s.View.W_RgvForWriteCommList.Where(x => x.StationCode == item.StationCode).FirstOrDefault(); - var writeAddressObj = s.DBBlockForWrite.W_RgvForWriteCommList.Where(x => x.StationCode == item.StationCode).FirstOrDefault(); - MessageModel fr = s.plcService.WriteValuePoint(writeAddressObj.W_STP, false, writeObj.W_STP); + var writeObj = s.View.W_StationForWriteCommList.Where(x => x.StationCode == item.StationCode).FirstOrDefault(); + var writeAddressObj = s.DBBlockForWrite.W_StationForWriteCommList.Where(x => x.StationCode == item.StationCode).FirstOrDefault(); + MessageModel fr = null; if (fr.result == false) { - Log4NetHelper.WriteErrorLog(LogType.SrmTheadService, "鑾峰彇 RGV鍜岃緭閫佺嚎 鐨勭姸鎬佷俊鎭椂锛屽垽鏂瑼CK=1锛屾洿鏂癝TB涓�0鏃堕敊璇�:" + fr.resMsg, null); + Log4NetHelper.WriteErrorLog(LogType.SrmTheadService, "鑾峰彇 Station鍜岃緭閫佺嚎 鐨勭姸鎬佷俊鎭椂锛屽垽鏂瑼CK=1锛屾洿鏂癝TB涓�0鏃堕敊璇�:" + fr.resMsg, null); } } } //璧嬪�兼姤璀� //s.View.R_Line_WarningDBList = s.GetLineAlertDatas(); - s.View.R_Rgv_WarningDBList = s.GetRgvAlertDatas(); + s.View.R_Station_WarningDBList = s.GetStationAlertDatas(); } } catch (Exception ex) { s.InitData(); - errorStr_Rgv = "GetRgvInfo鍑虹幇寮傚父:" + ex.Message; - errorStr_Rgv = SysHelper.Language(WareSdaStruct.LanguageFlg, errorStr_Rgv, - "GetRgvInfo throw exceptions: " + ex.Message); + errorStr_Station = "GetStationInfo鍑虹幇寮傚父:" + ex.Message; + errorStr_Station = SysHelper.Language(WareSdaStruct.LanguageFlg, errorStr_Station, + "GetStationInfo throw exceptions: " + ex.Message); - Log4NetHelper.WriteErrorLog(LogType.RgvSdaService, "鑾峰彇 Rgv 鐨勭姸鎬佷俊鎭嚭鐜板紓甯�", ex); + Log4NetHelper.WriteErrorLog(LogType.StationSdaService, "鑾峰彇 Station 鐨勭姸鎬佷俊鎭嚭鐜板紓甯�", ex); } Thread.Sleep(1000); } @@ -582,26 +521,26 @@ #region 蹇冭烦鐩稿叧 /// <summary> - /// 鍙戦�佺粰Rgv鐨勫績璺� + /// 鍙戦�佺粰Station鐨勫績璺� /// </summary> /// <param name="obj"></param> - private void SendStackerHeartToRgv(object obj) + private void SendStackerHeartToStation(object obj) { bool handShakeValue = true; while (true) { - var s = (RgvEntity)obj; + var s = (StationEntity)obj; handShakeValue = !handShakeValue; try { if (s.plcService != null && !s.plcService.IsConnected) { - errorStr_Rgv = SysHelper.Language(WareSdaStruct.LanguageFlg, "Rgv" + s.View.DeviceName + "杩炴帴宸叉柇寮�", "Piler connection disconnected "); + errorStr_Station = SysHelper.Language(WareSdaStruct.LanguageFlg, "Station" + s.View.DeviceName + "杩炴帴宸叉柇寮�", "Piler connection disconnected "); Thread.Sleep(100); continue; } - errorStr_Rgv = SysHelper.Language(WareSdaStruct.LanguageFlg, "Rgv" + s.View.DeviceName + "杩炴帴宸茶繛鎺ャ�傘�傘��", "Piler connection connected "); + errorStr_Station = SysHelper.Language(WareSdaStruct.LanguageFlg, "Station" + s.View.DeviceName + "杩炴帴宸茶繛鎺ャ�傘�傘��", "Piler connection connected "); if (s.plcService != null && s.plcService.IsConnected) { MessageModel fr = s.plcService.WriteValuePoint(s.DBBlockForWrite.W_HandShake, handShakeValue, s.View.W_HandShake); @@ -615,8 +554,8 @@ } catch (Exception ex) { - errorStr_Rgv = SysHelper.Language(WareSdaStruct.LanguageFlg, "鍙戦�佸績璺崇粰Rgv鍑虹幇寮傚父銆傘�傘��" + ex.Message, "Send to stacker for heart beat throw expection: " + ex.Message); - Log4NetHelper.WriteErrorLog(LogType.SdaService, "鍙戦�佺粰Rgv鐨勫績璺冲嚭鐜板紓甯�:" + ex.Message, ex); + errorStr_Station = SysHelper.Language(WareSdaStruct.LanguageFlg, "鍙戦�佸績璺崇粰Station鍑虹幇寮傚父銆傘�傘��" + ex.Message, "Send to stacker for heart beat throw expection: " + ex.Message); + Log4NetHelper.WriteErrorLog(LogType.SdaService, "鍙戦�佺粰Station鐨勫績璺冲嚭鐜板紓甯�:" + ex.Message, ex); } } } @@ -675,7 +614,7 @@ //line.View.R_WarningDBList = line.GetAlertDatas(); string dbValues = SdaHelper.GetStrShow<HuscoLineView, HuscoLineDBForWrite, HuscoLineDBForRead>(line.View, line.DBBlockForWrite, line.DBBlockForRead, HuscoLine_CacheEntity.W_DBHeader, HuscoLine_CacheEntity.R_DBHeader, line.View.DeviceId, line.View.DeviceName); - this.tb_Rgv.Text = dbValues + " \r\n AssemblyBarcode:" + _AssemblyBarcode + " \r\n CoilCode:" + _CoilCode + " \r\n"; + this.tb_Station.Text = dbValues + " \r\n AssemblyBarcode:" + _AssemblyBarcode + " \r\n CoilCode:" + _CoilCode + " \r\n"; //棣栧厛璇诲彇鎻℃墜淇″彿鏄惁鏄痶rue锛屽彧鏈塼rue 鐨勬椂鍊欐墠鑳芥嬁鍊� var isRead = Convert.ToInt32(line.plcService.ReadValuePoint("", handShareAddress, typeof(Int32))); @@ -796,32 +735,13 @@ Thread.Sleep(1000); try { - foreach (var item in realtimePlcValueDict_Srm) - { - if (item.Key == "Srm1") - { - this.tb_Srm1.Text = item.Value; - } - else if (item.Key == "Srm2") - { - this.tb_Srm2.Text = item.Value; - } - else if (item.Key == "Srm3") - { - this.tb_Srm3.Text = item.Value; - } - else if (item.Key == "Srm4") - { - this.tb_Srm4.Text = item.Value; - } - } - var str_rgv = ""; - foreach (var item in realtimePlcValueDict_Rgv) + var str_Station = ""; + foreach (var item in realtimePlcValueDict_Station) { - str_rgv += item.Value; + str_Station += item.Value; } - this.tb_Rgv.Text = str_rgv; + this.tb_Station.Text = str_Station; } catch (Exception) @@ -856,7 +776,7 @@ { realtimePlcValueDict_Srm.Add(x.View.DeviceName, ""); }); - Rgv_CacheEntity.DeviceObjs.ForEach(x => + Station_CacheEntity.DeviceObjs.ForEach(x => { realtimePlcValueDict_Srm.Add(x.View.DeviceName, ""); }); @@ -1012,36 +932,36 @@ private void button2_Click_1(object sender, EventArgs e) { - isShowPlcValue_Rgv = true; + isShowPlcValue_Station = true; } private void button1_Click_1(object sender, EventArgs e) { - isShowPlcValue_Rgv = false; + isShowPlcValue_Station = false; } /* /// <summary> - /// 涓�鐩村瓨鍦≧GVACK淇″彿鏃犳硶娓呴櫎鐨凚UG锛屽仛涓畾鏃舵竻闄ょ殑绾跨▼ + /// 涓�鐩村瓨鍦⊿tationACK淇″彿鏃犳硶娓呴櫎鐨凚UG锛屽仛涓畾鏃舵竻闄ょ殑绾跨▼ /// </summary> - public void HandleRGVAckBug(object obj) + public void HandleStationAckBug(object obj) { - var s = (RgvEntity)obj; + var s = (StationEntity)obj; while (true) { Thread.Sleep(1000); - bool finishRgv = (bool)s.plcService.ReadValuePoint(s.DBBlockForRead.R_RGV_Finish, typeof(bool)); - bool finisAck = (bool)s.plcService.ReadValuePoint(s.DBBlockForWrite.W_RGV_FinishACK, typeof(bool)); + bool finishStation = (bool)s.plcService.ReadValuePoint(s.DBBlockForRead.R_Station_Finish, typeof(bool)); + bool finisAck = (bool)s.plcService.ReadValuePoint(s.DBBlockForWrite.W_Station_FinishACK, typeof(bool)); - if (finisAck == false && finishRgv == true) + if (finisAck == false && finishStation == true) { Thread.Sleep(10000);//濡傛灉10绉掕繕娌℃竻闄わ紝灏卞己鍒舵竻闄� - finishRgv = (bool)s.plcService.ReadValuePoint(s.DBBlockForRead.R_RGV_Finish, typeof(bool)); - finisAck = (bool)s.plcService.ReadValuePoint(s.DBBlockForWrite.W_RGV_FinishACK, typeof(bool)); - if (finisAck == false && finishRgv == true) + finishStation = (bool)s.plcService.ReadValuePoint(s.DBBlockForRead.R_Station_Finish, typeof(bool)); + finisAck = (bool)s.plcService.ReadValuePoint(s.DBBlockForWrite.W_Station_FinishACK, typeof(bool)); + if (finisAck == false && finishStation == true) { - s.plcService.WriteValuePoint(s.DBBlockForWrite.W_RGV_FinishACK, true, s.View.W_RGV_FinishACK);//閲嶅彂涓�娆� 20230503 鐜嬮摦 + s.plcService.WriteValuePoint(s.DBBlockForWrite.W_Station_FinishACK, true, s.View.W_Station_FinishACK);//閲嶅彂涓�娆� 20230503 鐜嬮摦 } } diff --git a/SDA/iWareSda/iWareSda.csproj b/SDA/iWareSda/iWareSda.csproj index b81d1b9..9fe70ce 100644 --- a/SDA/iWareSda/iWareSda.csproj +++ b/SDA/iWareSda/iWareSda.csproj @@ -8,7 +8,7 @@ <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>iWareSda</RootNamespace> - <AssemblyName>XiGang_iWareSda</AssemblyName> + <AssemblyName>iWareSda</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <WcfConfigValidationEnabled>True</WcfConfigValidationEnabled> @@ -127,6 +127,15 @@ <Compile Include="Devices\3-Rgv\RgvModel\Rgv_CacheEntity.cs" /> <Compile Include="Devices\3-Rgv\RgvService\IRgvService.cs" /> <Compile Include="Devices\3-Rgv\RgvService\RgvService.cs" /> + <Compile Include="Devices\4-Station\StationModel\DB\RgvComm.cs" /> + <Compile Include="Devices\4-Station\StationModel\DB\RgvDB2Obj.cs" /> + <Compile Include="Devices\4-Station\StationModel\DB\RgvDBForRead.cs" /> + <Compile Include="Devices\4-Station\StationModel\DB\RgvDBForWrite.cs" /> + <Compile Include="Devices\4-Station\StationModel\StationEntity.cs" /> + <Compile Include="Devices\4-Station\StationModel\StationView.cs" /> + <Compile Include="Devices\4-Station\StationModel\Station_CacheEntity.cs" /> + <Compile Include="Devices\4-Station\StationService\IStationService.cs" /> + <Compile Include="Devices\4-Station\StationService\StationService.cs" /> <Compile Include="Interface\IDevice.cs" /> <Compile Include="Model\DeviceWarningInfo.cs" /> <Compile Include="Model\SdaResEntity.cs" /> -- Gitblit v1.9.3