From ef3318c39fe8358b663e66daeb98adf1de1b97a8 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周四, 28 11月 2024 11:30:45 +0800 Subject: [PATCH] 增加 齐套验证县城 --- CC/iWareCC_ASRS/Common/SystemWarningMsg.cs | 2 CC/iWareCommon/log4net_iWare.config | 16 ++-- CC/iWareCC_ASRS/FormCC.Designer.cs | 50 ++++++------ CC/iWareCommon/Utils/Log4Net/LogType.cs | 2 CC/iWareCC_ASRS/FormCC.cs | 2 CC/iWareCC_ASRS/Common/SystemValue.cs | 2 CC/iWareCC_ASRS/ThreadService/05_BZ30(齐套验证)/DataProcess_ValidateQiTao.cs | 109 +++++++++++++++++++++++++++ CC/iWareCC_ASRS/iWareCC.csproj | 1 8 files changed, 147 insertions(+), 37 deletions(-) diff --git a/CC/iWareCC_ASRS/Common/SystemValue.cs b/CC/iWareCC_ASRS/Common/SystemValue.cs index c94df98..e43c28f 100644 --- a/CC/iWareCC_ASRS/Common/SystemValue.cs +++ b/CC/iWareCC_ASRS/Common/SystemValue.cs @@ -134,7 +134,7 @@ /// </summary> public static bool isAllowRuning_DataProcess_RobotBuffer_ModeChange = false; - public static bool isAllowRuning_PrintHandler = false; + public static bool isAllowRuning_DataProcess_ValidateQiTao = false; /// <summary> /// 鏄惁鍏佽鎵ц 鍫嗗灈鏈哄叆鍙f壂鐮佹娴嬬嚎绋� diff --git a/CC/iWareCC_ASRS/Common/SystemWarningMsg.cs b/CC/iWareCC_ASRS/Common/SystemWarningMsg.cs index 7c8e007..e5efb8d 100644 --- a/CC/iWareCC_ASRS/Common/SystemWarningMsg.cs +++ b/CC/iWareCC_ASRS/Common/SystemWarningMsg.cs @@ -101,7 +101,7 @@ /// <summary> /// 杈撻�佺嚎浠诲姟瀹屾垚纭鐨勮鍛婃秷鎭� /// </summary> - public static string _lbl_Alert_PrintHandler = string.Empty; + public static string _lbl_Alert_DataProcess_ValidateQiTao = string.Empty; /// <summary> /// 娓呯悊鏁版嵁鐜板満 鐨勮鍛婃秷鎭� diff --git a/CC/iWareCC_ASRS/FormCC.Designer.cs b/CC/iWareCC_ASRS/FormCC.Designer.cs index 20736dc..ff78685 100644 --- a/CC/iWareCC_ASRS/FormCC.Designer.cs +++ b/CC/iWareCC_ASRS/FormCC.Designer.cs @@ -244,8 +244,8 @@ this.ckDataProcess_RobotBuffer_AutoQiTaoOutbound = new System.Windows.Forms.CheckBox(); this.lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask = new System.Windows.Forms.Label(); this.ck_DataProcess_RobotBuffer_IssueOutboundTask = new System.Windows.Forms.CheckBox(); - this.lbl_Alert_PrintHandler = new System.Windows.Forms.Label(); - this.ck_PrintHandler = new System.Windows.Forms.CheckBox(); + this.lbl_DataProcess_ValidateQiTao = new System.Windows.Forms.Label(); + this.ck_DataProcess_ValidateQiTao = new System.Windows.Forms.CheckBox(); this.lbl_MainTaskDecompose = new System.Windows.Forms.Label(); this.ckMainTaskDecompose = new System.Windows.Forms.CheckBox(); this.lbl_Alert_DeleteData = new System.Windows.Forms.Label(); @@ -3016,8 +3016,8 @@ this.groupBox1.Controls.Add(this.ckDataProcess_RobotBuffer_AutoQiTaoOutbound); this.groupBox1.Controls.Add(this.lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask); this.groupBox1.Controls.Add(this.ck_DataProcess_RobotBuffer_IssueOutboundTask); - this.groupBox1.Controls.Add(this.lbl_Alert_PrintHandler); - this.groupBox1.Controls.Add(this.ck_PrintHandler); + this.groupBox1.Controls.Add(this.lbl_DataProcess_ValidateQiTao); + this.groupBox1.Controls.Add(this.ck_DataProcess_ValidateQiTao); this.groupBox1.Controls.Add(this.lbl_MainTaskDecompose); this.groupBox1.Controls.Add(this.ckMainTaskDecompose); this.groupBox1.Controls.Add(this.lbl_Alert_DeleteData); @@ -3286,28 +3286,28 @@ this.ck_DataProcess_RobotBuffer_IssueOutboundTask.UseVisualStyleBackColor = true; this.ck_DataProcess_RobotBuffer_IssueOutboundTask.CheckedChanged += new System.EventHandler(this.CommonCheckedChanged); // - // lbl_Alert_PrintHandler + // lbl_DataProcess_ValidateQiTao // - this.lbl_Alert_PrintHandler.AutoSize = true; - this.lbl_Alert_PrintHandler.BackColor = System.Drawing.Color.White; - this.lbl_Alert_PrintHandler.ForeColor = System.Drawing.Color.Red; - this.lbl_Alert_PrintHandler.Location = new System.Drawing.Point(215, 492); - this.lbl_Alert_PrintHandler.Name = "lbl_Alert_PrintHandler"; - this.lbl_Alert_PrintHandler.Size = new System.Drawing.Size(70, 15); - this.lbl_Alert_PrintHandler.TabIndex = 37; - this.lbl_Alert_PrintHandler.Text = "label11"; + this.lbl_DataProcess_ValidateQiTao.AutoSize = true; + this.lbl_DataProcess_ValidateQiTao.BackColor = System.Drawing.Color.White; + this.lbl_DataProcess_ValidateQiTao.ForeColor = System.Drawing.Color.Red; + this.lbl_DataProcess_ValidateQiTao.Location = new System.Drawing.Point(215, 492); + this.lbl_DataProcess_ValidateQiTao.Name = "lbl_DataProcess_ValidateQiTao"; + this.lbl_DataProcess_ValidateQiTao.Size = new System.Drawing.Size(70, 15); + this.lbl_DataProcess_ValidateQiTao.TabIndex = 37; + this.lbl_DataProcess_ValidateQiTao.Text = "label11"; // - // ck_PrintHandler + // ck_DataProcess_ValidateQiTao // - this.ck_PrintHandler.AutoSize = true; - this.ck_PrintHandler.Location = new System.Drawing.Point(4, 492); - this.ck_PrintHandler.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.ck_PrintHandler.Name = "ck_PrintHandler"; - this.ck_PrintHandler.Size = new System.Drawing.Size(125, 19); - this.ck_PrintHandler.TabIndex = 36; - this.ck_PrintHandler.Text = "打印服务线程"; - this.ck_PrintHandler.UseVisualStyleBackColor = true; - this.ck_PrintHandler.CheckedChanged += new System.EventHandler(this.CommonCheckedChanged); + this.ck_DataProcess_ValidateQiTao.AutoSize = true; + this.ck_DataProcess_ValidateQiTao.Location = new System.Drawing.Point(4, 492); + this.ck_DataProcess_ValidateQiTao.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.ck_DataProcess_ValidateQiTao.Name = "ck_DataProcess_ValidateQiTao"; + this.ck_DataProcess_ValidateQiTao.Size = new System.Drawing.Size(161, 19); + this.ck_DataProcess_ValidateQiTao.TabIndex = 36; + this.ck_DataProcess_ValidateQiTao.Text = "BZ30齐套验证线程"; + this.ck_DataProcess_ValidateQiTao.UseVisualStyleBackColor = true; + this.ck_DataProcess_ValidateQiTao.CheckedChanged += new System.EventHandler(this.CommonCheckedChanged); // // lbl_MainTaskDecompose // @@ -6152,8 +6152,8 @@ private System.Windows.Forms.CheckBox ckDeleteData; private System.Windows.Forms.Label lbl_MainTaskDecompose; private System.Windows.Forms.CheckBox ckMainTaskDecompose; - private System.Windows.Forms.Label lbl_Alert_PrintHandler; - private System.Windows.Forms.CheckBox ck_PrintHandler; + private System.Windows.Forms.Label lbl_DataProcess_ValidateQiTao; + private System.Windows.Forms.CheckBox ck_DataProcess_ValidateQiTao; private System.Windows.Forms.Label lbl_Alert_DataProcess_RobotBuffer_IssueOutboundTask; private System.Windows.Forms.CheckBox ck_DataProcess_RobotBuffer_IssueOutboundTask; private System.Windows.Forms.Button btn_1007; diff --git a/CC/iWareCC_ASRS/FormCC.cs b/CC/iWareCC_ASRS/FormCC.cs index 0e2098c..99387b2 100644 --- a/CC/iWareCC_ASRS/FormCC.cs +++ b/CC/iWareCC_ASRS/FormCC.cs @@ -1549,7 +1549,7 @@ DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_ModeChange, ck_DataProcess_RobotBuffer_ModeChange); - DoCommonCheckedChanged(ref SystemValue.isAllowRuning_PrintHandler, ck_PrintHandler); + DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_ValidateQiTao, ck_DataProcess_ValidateQiTao); DoCommonCheckedChanged(ref SystemValue.isAllowRuning_DataProcess_RobotBuffer_FinishTaskForOutbound, checkBox_DataProcess_RobotBuffer_FinishTaskForOutbound); diff --git "a/CC/iWareCC_ASRS/ThreadService/05_BZ30\050\351\275\220\345\245\227\351\252\214\350\257\201\051/DataProcess_ValidateQiTao.cs" "b/CC/iWareCC_ASRS/ThreadService/05_BZ30\050\351\275\220\345\245\227\351\252\214\350\257\201\051/DataProcess_ValidateQiTao.cs" new file mode 100644 index 0000000..e9df6a5 --- /dev/null +++ "b/CC/iWareCC_ASRS/ThreadService/05_BZ30\050\351\275\220\345\245\227\351\252\214\350\257\201\051/DataProcess_ValidateQiTao.cs" @@ -0,0 +1,109 @@ +锘縰sing Admin.NET.Application; +using iWareCC.Common.Helper; +using iWareCC.StationService; +using iWareCommon.Common.Globle; +using iWareCommon.Utils; +using iWareModel; +using iWareSql.DataAccess; +using iWareSql.DBModel; +using iWareSql.WmsDBModel; +using System; +using System.Collections.Generic; +using System.Linq; +using System.ServiceModel.Configuration; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using WZ.Useful.Commons; +using XiGang.Core.Model; + +namespace iWareCC.ThreadService +{ + /// <summary> + /// BZ30榻愬楠岃瘉 + /// </summary> + public static class DataProcess_ValidateQiTao + { + public static async void Handler() + { + var alertMsg = ""; + LogType logType = LogType.DataProcess_ValidateQiTao; + while (true) + { + Thread.Sleep(2000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆� + SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = string.Empty; + try + { + if (SystemValue.isAllowRuning_DataProcess_ValidateQiTao && SystemValue.isStartedModel) + { + var rgvLocation = StationLocationEnum.BZ39.ToString(); + if (FormCC.IsAllowRunOutMode) + { + using (WmsDBModel wmsDB = new WmsDBModel()) + { + var rbRunMode = wmsDB.wms_rbline_runmode.FirstOrDefault(); + + if (TaskHandler.ValidateNoFinishOutTaskForRobotBuffer(wmsDB)) + {//涓嶅瓨鍦� + rbRunMode.LineRunMode = (int)RbRunModeEnum.鍏ュ簱妯″紡; + rbRunMode.LineRunModeName = RbRunModeEnum.鍏ュ簱妯″紡.ToString(); + rbRunMode.UpdateTime = DateTime.Now; + + //鎺ㄩ�佺粰PLC鍒囨崲妯″紡 + using (StationServiceClient client = new StationServiceClient()) + { + var res = await client.ChangeModeAsync((int)EDevice.Station, (int)RbRunModeEnum.鍏ュ簱妯″紡, rgvLocation); + if (!res.result) + { + SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"{rgvLocation.ToString()}-鎺ㄩ�佺粰PLC鍒囨崲妯″紡 澶辫触,ChangeModeAsync 杩斿洖:{res.resMsg}"; + continue; + } + else + { + Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-鎺ㄩ�佺粰PLC鍒囨崲妯″紡 鎴愬姛,ChangeModeAsync锛屽弬鏁�: 绔欑偣{rgvLocation}"); + } + } + FormCC.IsAllowRunOutMode = false; + } + else + {//瀛樺湪 + if (rbRunMode.LineRunMode == (int)RbRunModeEnum.鍑哄簱妯″紡) + { + SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"宸茬粡鏄嚭搴撴ā寮忎簡,姝ゆ寰幆缁撴潫"; + continue; + } + rbRunMode.LineRunMode = (int)RbRunModeEnum.鍑哄簱妯″紡; + rbRunMode.LineRunModeName = RbRunModeEnum.鍑哄簱妯″紡.ToString(); + rbRunMode.UpdateTime = DateTime.Now; + + //鎺ㄩ�佺粰PLC鍒囨崲妯″紡 + using (StationServiceClient client = new StationServiceClient()) + { + var res = await client.ChangeModeAsync((int)EDevice.Station, (int)RbRunModeEnum.鍑哄簱妯″紡, rgvLocation); + if (!res.result) + { + SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao = $"{rgvLocation.ToString()}-鎺ㄩ�佺粰PLC鍒囨崲妯″紡 澶辫触,ChangeModeAsync 杩斿洖:{res.resMsg}"; + continue; + } + else + { + Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-鎺ㄩ�佺粰PLC鍒囨崲妯″紡 鎴愬姛,ChangeModeAsync锛屽弬鏁�: 绔欑偣{rgvLocation}"); + } + } + } + + wmsDB.SaveChanges(); + } + } + } + } + catch (Exception ex) + { + SystemWarningMsg._lbl_Alert_DataProcess_ValidateQiTao += " 鍑虹幇寮傚父:" + ex.Message + SysGloble.SPLIT_STR; + Log4NetHelper.WriteErrorLog(logType, " 鍑虹幇寮傚父锛�" + ex.Message, ex); + } + } + } + + } +} diff --git a/CC/iWareCC_ASRS/iWareCC.csproj b/CC/iWareCC_ASRS/iWareCC.csproj index a4a5b7d..4f7ae2e 100644 --- a/CC/iWareCC_ASRS/iWareCC.csproj +++ b/CC/iWareCC_ASRS/iWareCC.csproj @@ -171,6 +171,7 @@ <Compile Include="ThreadService\03_BZ12%28鏈哄櫒浜虹爜鍖呭伐浣�%29\DataProcess_BZ12_FinishTask.cs" /> <Compile Include="ThreadService\04_BZ21锛堟惉杩愭暣鍨涙満鍣ㄤ汉锛塡DataProcess_BZ21.cs" /> <Compile Include="ThreadService\04_BZ21锛堟惉杩愭暣鍨涙満鍣ㄤ汉锛塡DataProcess_BZ21_FinishTask.cs" /> + <Compile Include="ThreadService\05_BZ30%28榻愬楠岃瘉%29\DataProcess_ValidateQiTao.cs" /> <Compile Include="WCF\CCWcfService.cs" /> <Compile Include="WCF\ICCWcfService.cs" /> <Compile Include="WmsTask\AutoUpdateEngineInfoTask.cs" /> diff --git a/CC/iWareCommon/Utils/Log4Net/LogType.cs b/CC/iWareCommon/Utils/Log4Net/LogType.cs index 77b1216..6cb4de5 100644 --- a/CC/iWareCommon/Utils/Log4Net/LogType.cs +++ b/CC/iWareCommon/Utils/Log4Net/LogType.cs @@ -62,7 +62,7 @@ /// <summary> /// 鍑哄簱璁″垝 /// </summary> - PrintHandler = 300, + DataProcess_ValidateQiTao = 300, /// <summary> /// MES鏈嶅姟 diff --git a/CC/iWareCommon/log4net_iWare.config b/CC/iWareCommon/log4net_iWare.config index 8ccb8a7..2e1ab7c 100644 --- a/CC/iWareCommon/log4net_iWare.config +++ b/CC/iWareCommon/log4net_iWare.config @@ -262,8 +262,8 @@ <filter type="log4net.Filter.DenyAllFilter" /> </appender> <!--鍑哄簱璁″垝銆愪俊鎭�戞棩蹇�--> - <appender name="PrintHandler_Info" type="log4net.Appender.RollingFileAppender"> - <file value="d:\\Log\\LuLiMuYe\\iWareCC\\PrintHandler_Info\\" /> + <appender name="DataProcess_ValidateQiTao_Info" type="log4net.Appender.RollingFileAppender"> + <file value="d:\\Log\\LuLiMuYe\\iWareCC\\DataProcess_ValidateQiTao_Info\\" /> <appendToFile value="true" /> <rollingStyle value="Date" /> <staticLogFileName value="false" /> @@ -273,13 +273,13 @@ <param name="ConversionPattern" value="%n娑堟伅鏃堕棿锛�%d [%t] %n娑堟伅绾у埆锛�%-5p %n娑� 鎭� 绫伙細%c [%x] %n%m %n "/> </layout> <filter type="log4net.Filter.LoggerMatchFilter"> - <loggerToMatch value="PrintHandler_Info" /> + <loggerToMatch value="DataProcess_ValidateQiTao_Info" /> </filter> <filter type="log4net.Filter.DenyAllFilter" /> </appender> <!--鍑哄簱璁″垝銆愰敊璇�戞棩蹇�--> - <appender name="PrintHandler_Error" type="log4net.Appender.RollingFileAppender"> - <file value="d:\\Log\\LuLiMuYe\\iWareCC\\PrintHandler_Error\\" /> + <appender name="DataProcess_ValidateQiTao_Error" type="log4net.Appender.RollingFileAppender"> + <file value="d:\\Log\\LuLiMuYe\\iWareCC\\DataProcess_ValidateQiTao_Error\\" /> <appendToFile value="true" /> <rollingStyle value="Date" /> <staticLogFileName value="false" /> @@ -289,7 +289,7 @@ <param name="ConversionPattern" value="%n寮傚父鏃堕棿锛�%d [%t] %n寮傚父绾у埆锛�%-5p %n寮� 甯� 绫伙細%c [%x] %n%m %n "/> </layout> <filter type="log4net.Filter.LoggerMatchFilter"> - <loggerToMatch value="PrintHandler_Error" /> + <loggerToMatch value="DataProcess_ValidateQiTao_Error" /> </filter> <filter type="log4net.Filter.DenyAllFilter" /> </appender> @@ -640,8 +640,8 @@ <appender-ref ref="DataProcess_RobotBuffer_AutoQiTaoOutbound_Error"/> <appender-ref ref="DataProcess_RobotBuffer_ModeChange_Info"/> <appender-ref ref="DataProcess_RobotBuffer_ModeChange_Error"/> - <appender-ref ref="PrintHandler_Info"/> - <appender-ref ref="PrintHandler_Error"/> + <appender-ref ref="DataProcess_ValidateQiTao_Info"/> + <appender-ref ref="DataProcess_ValidateQiTao_Error"/> <!--鍫嗗灈鏈轰换鍔$嚎绋嬫棩蹇�--> <appender-ref ref="SrmTheadService_Info"/> <appender-ref ref="SrmTheadService_Error"/> -- Gitblit v1.9.3