From 95561e2415939408310c9509525cb1b3f443d776 Mon Sep 17 00:00:00 2001 From: lhiven Date: Sat, 23 Sep 2023 16:47:48 +0900 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E6=8E=92=E6=96=99=E5=8C=BA=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8F=96=E6=96=99=E5=A4=B1=E8=B4=A5=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.SkyLine/Commom/Scheduling.cs | 49 +++ Rs.SkyLine/Flow/LoadAndUnloadTask.cs | 11 + Rs.SkyLine/Flow/TestCenter.cs | 296 ++++++++++-------- Rs.SkyLine/Flow/WorkFlow.cs | 45 ++- Rs.SkyLine/MsgBox/TakeFailMsg.Designer.cs | 147 +++++++++ Rs.SkyLine/MsgBox/TakeFailMsg.cs | 67 ++++ Rs.SkyLine/MsgBox/TakeFailMsg.resx | 120 +++++++ Rs.SkyLine/Rs.SkyLine.csproj | 9 + .../SysConfig/StartPosConfig.Designer.cs | 26 -- Rs.SkyLine/SysConfig/StartPosConfig.cs | 22 +- 10 files changed, 623 insertions(+), 169 deletions(-) create mode 100644 Rs.SkyLine/MsgBox/TakeFailMsg.Designer.cs create mode 100644 Rs.SkyLine/MsgBox/TakeFailMsg.cs create mode 100644 Rs.SkyLine/MsgBox/TakeFailMsg.resx diff --git a/Rs.SkyLine/Commom/Scheduling.cs b/Rs.SkyLine/Commom/Scheduling.cs index f173296..bd62639 100644 --- a/Rs.SkyLine/Commom/Scheduling.cs +++ b/Rs.SkyLine/Commom/Scheduling.cs @@ -35,6 +35,49 @@ namespace Rs.MotionPlat.Commom public DateTime Time { get; set; } = DateTime.Now; public override string ToString() => JsonConvert.SerializeObject(this, new StringEnumConverter()); + + /// + /// 获取json,最后一个可能不是合法json + /// + /// + /// + /// 嵌套太深 + public static IEnumerable GetJsons(string msg) + { + int curlyBrackets = 0, startIndex = 0, len = msg.Length, i = 0; + for (; i < len; ++i) + { + switch (msg[i]) + { + case '{': + if (curlyBrackets < 0) + { + curlyBrackets = 0; + } + + if (++curlyBrackets == 1) + { + startIndex = i; + } + else if (curlyBrackets > 100) + { + throw new FormatException("nesting too deep"); + } + break; + case '}': + if (--curlyBrackets == 0) + { + int end = i + 1; + yield return msg.Substring(startIndex,end-startIndex); + startIndex = end; + } + break; + } + } + if (startIndex < len) + yield return msg.Substring(startIndex); + yield break; + } } public class SchedulingConnectionInfo : Scheduling @@ -48,6 +91,8 @@ namespace Rs.MotionPlat.Commom } } + + /// /// 上下料 /// @@ -740,6 +785,10 @@ namespace Rs.MotionPlat.Commom /// 倒计时结束时按下的按钮 /// public ETipButton CountdownResult { get; set; } = ETipButton.Yes; + /// + /// 定制弹窗按钮文本内容 + /// + public Dictionary ButtonContexts { get; set; } public SchedulingMessageBox() { } diff --git a/Rs.SkyLine/Flow/LoadAndUnloadTask.cs b/Rs.SkyLine/Flow/LoadAndUnloadTask.cs index 436f0fa..bd30e69 100644 --- a/Rs.SkyLine/Flow/LoadAndUnloadTask.cs +++ b/Rs.SkyLine/Flow/LoadAndUnloadTask.cs @@ -100,6 +100,17 @@ namespace Rs.MotionPlat.Flow tilist.AddRange(changeTaskList.Where(tr => tr.Dealed == false)); return tilist; } + /// + /// 清除未执行的任务 + /// + public void ClearUndoTask() + { + List removeList = loadTaskList.Where(t => t.Dealed == false).ToList(); + foreach(var t in removeList) + { + loadTaskList.Remove(t); + } + } public void AddTurnoverResult(Nozzle nozzle) diff --git a/Rs.SkyLine/Flow/TestCenter.cs b/Rs.SkyLine/Flow/TestCenter.cs index 0b562c3..1a5a923 100644 --- a/Rs.SkyLine/Flow/TestCenter.cs +++ b/Rs.SkyLine/Flow/TestCenter.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using HalconDotNet; +using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Rs.Framework; using Rs.MotionPlat.Commom; @@ -9,6 +10,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using static System.Windows.Forms.AxHost; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Rs.MotionPlat.Flow { @@ -69,143 +71,152 @@ namespace Rs.MotionPlat.Flow } private void Client_DataRecived(System.Net.Sockets.Socket socket, byte[] data) { - string msg=Encoding.UTF8.GetString(data); - //LogHelper.TestCenterLog("接收:"+msg); - ReciveTaskEvent?.Invoke(msg); - Scheduling schedule = JsonConvert.DeserializeObject(msg); - EInstruction eInstructioneInstruction = schedule.Instruction; - switch (eInstructioneInstruction) + string msg = Encoding.UTF8.GetString(data); + foreach (string json in Scheduling.GetJsons(msg)) { - case EInstruction.InquireSiloStatus: - break; - case EInstruction.InquireConnectionInfo: - SchedulingConnectionInfo info = JsonConvert.DeserializeObject(msg); - info.Type = SchedulingConnectionInfo.EType.Scheduling; - client.Send(info.ToString()); - LogHelper.Debug(info.ToString()); - ReplayTaskEvent?.Invoke(info.ToString()); - break; - case EInstruction.LoadAndUnload: - LogHelper.TestCenterLog("接收:" + msg); - MachineManage.Instance.RunState = ERunState.Busying; - sm = JsonConvert.DeserializeObject(msg); - schedulResult = new SchedulingResult() { Instruction = sm.Instruction, State = ERunState.Busying, GroupID = sm.GroupID, TurnoverID = sm.TurnoverID }; - string buffer = schedulResult.ToString(); - client.Send(buffer); - LogHelper.TestCenterLog(buffer); - LoadAndUnloadTask.Instance.Add(sm); - MessageQueue.Instance.Insert(sm.Instruction.ToString()); - ReplayTaskEvent?.Invoke(schedulResult.ToString()); - break; - case EInstruction.CancelLoadAndUnload: - //schedulResult = new SchedulingResult() { Instruction = EInstruction.CancelLoadAndUnload, State = ERunState.Busying, GroupID = sm.GroupID, TurnoverID = sm.TurnoverID }; - client.Send(schedule.ToString()); - break; - case EInstruction.InquireStatus: - SchedulingStatusInfo statusInto=JsonConvert.DeserializeObject(msg); - switch (statusInto.Type) - { - case SchedulingStatusInfo.InfoType.State: - statusInto.Info = MachineManage.Instance.RunState.ToString();// ERunState.Waiting.ToString(); - //MessageQueue.Instance.Insert(statusInto.Info); - //File.AppendAllText("c://runstate.txt",statusInto.Info.ToString()+"\r\n"); - break; - case SchedulingStatusInfo.InfoType.RunStatus: - statusInto.Info = MachineManage.Instance.RunStatus.ToString();// ERunStatus.Started.ToString(); - break; - case SchedulingStatusInfo.InfoType.RunMode: - statusInto.Info = MachineManage.Instance.RunMode.ToString(); - break; - case SchedulingStatusInfo.InfoType.InitializeState: - statusInto.Info = MachineManage.Instance.InitializeState.ToString();// EInitializeState.Initialized.ToString(); - break; - case SchedulingStatusInfo.InfoType.AssignMode: - statusInto.Info = EAssignMode.Normal.ToString(); - break; - case SchedulingStatusInfo.InfoType.Temperature: - statusInto.Info = "22"; - break; - default: - break; - } - client.Send(statusInto.ToString()); - LogHelper.Debug(statusInto.ToString()); - ReplayTaskEvent?.Invoke(statusInto.ToString()); - break; - case EInstruction.SwitchStatus: - SchedulingStatusInfo switchStatus=JsonConvert.DeserializeObject(msg); - SwitchStatus(switchStatus); - //MachineManage.Instance.MachineStatus= EMachineStatus. - //if (ss.TryConvertInfoTo(out ERunMode runMode)) - // MachineManage.Instance.RunMode = runMode; - //client.Send(ss.ToString()); - //ReplayTaskEvent?.Invoke(ss.ToString()); - break; - case EInstruction.ClearAlarm: - break; - case EInstruction.GetRecipeList: - SchedulingResult sr = JsonConvert.DeserializeObject(msg); - sr.Message = "Default"; - client.Send(sr.ToString()); - ReplayTaskEvent?.Invoke(sr.ToString()); - break; - case EInstruction.SetRecipe: - break; - case EInstruction.GetCurrentRecipe: - SchedulingResult srcur = JsonConvert.DeserializeObject(msg); - srcur.Message = "Default"; - client.Send(srcur.ToString()); - ReplayTaskEvent?.Invoke(srcur.ToString()); - break; - case EInstruction.TurnoverReady: - break; - case EInstruction.ChangeState: - SchedulingResult cs = JsonConvert.DeserializeObject(msg); - client.Send(cs.ToString()); - ReplayTaskEvent?.Invoke(cs.ToString()); - break; - case EInstruction.ShowMessage: - break; - case EInstruction.CloseMessage: - break; - case EInstruction.MachineButtonDown: - break; - case EInstruction.MachineButtonUp: - break; - case EInstruction.TrayProductRange: - break; - case EInstruction.ClearTrayProductRange: - schedulResult = JsonConvert.DeserializeObject(msg); - client.Send(schedulResult.ToString()); - ReplayTaskEvent?.Invoke(schedulResult.ToString()); - break; - case EInstruction.RequestSwitchTray: - break; - case EInstruction.BeginSwitchTray: - break; - case EInstruction.MoveScanner: - break; - case EInstruction.InquireMoveScannerState: - break; - case EInstruction.SetAlarms: - break; - case EInstruction.CancelAlarms: - break; - case EInstruction.IsLastBeforeTray: - break; - case EInstruction.EndInput: - break; - case EInstruction.TakingError: - break; - case EInstruction.CancelTakingError: - break; - case EInstruction.Rearrange: - break; - case EInstruction.RearrangeResult: - break; - case EInstruction.ScanBarcode: - break; + Scheduling schedule = JsonConvert.DeserializeObject(json); + EInstruction eInstructioneInstruction = schedule.Instruction; + switch (eInstructioneInstruction) + { + case EInstruction.InquireSiloStatus: + break; + case EInstruction.InquireConnectionInfo: + SchedulingConnectionInfo info = JsonConvert.DeserializeObject(json); + info.Type = SchedulingConnectionInfo.EType.Scheduling; + client.Send(info.ToString()); + LogHelper.Debug(info.ToString()); + ReplayTaskEvent?.Invoke(info.ToString()); + break; + case EInstruction.LoadAndUnload: + LogHelper.Debug("接收:" + json); + MachineManage.Instance.RunState = ERunState.Busying; + sm = JsonConvert.DeserializeObject(json); + schedulResult = new SchedulingResult() { Instruction = sm.Instruction, State = ERunState.Busying, GroupID = sm.GroupID, TurnoverID = sm.TurnoverID }; + string buffer = schedulResult.ToString(); + client.Send(buffer); + LogHelper.TestCenterLog(buffer); + LoadAndUnloadTask.Instance.Add(sm); + MessageQueue.Instance.Insert(sm.Instruction.ToString()); + ReplayTaskEvent?.Invoke(schedulResult.ToString()); + break; + case EInstruction.CancelLoadAndUnload: + //schedulResult = new SchedulingResult() { Instruction = EInstruction.CancelLoadAndUnload, State = ERunState.Busying, GroupID = sm.GroupID, TurnoverID = sm.TurnoverID }; + client.Send(schedule.ToString()); + break; + case EInstruction.InquireStatus: + SchedulingStatusInfo statusInto = JsonConvert.DeserializeObject(json); + switch (statusInto.Type) + { + case SchedulingStatusInfo.InfoType.State: + statusInto.Info = MachineManage.Instance.RunState.ToString();// ERunState.Waiting.ToString(); + //MessageQueue.Instance.Insert(statusInto.Info); + //File.AppendAllText("c://runstate.txt",statusInto.Info.ToString()+"\r\n"); + break; + case SchedulingStatusInfo.InfoType.RunStatus: + statusInto.Info = MachineManage.Instance.RunStatus.ToString();// ERunStatus.Started.ToString(); + break; + case SchedulingStatusInfo.InfoType.RunMode: + statusInto.Info = MachineManage.Instance.RunMode.ToString(); + break; + case SchedulingStatusInfo.InfoType.InitializeState: + statusInto.Info = MachineManage.Instance.InitializeState.ToString();// EInitializeState.Initialized.ToString(); + break; + case SchedulingStatusInfo.InfoType.AssignMode: + statusInto.Info = EAssignMode.Normal.ToString(); + break; + case SchedulingStatusInfo.InfoType.Temperature: + statusInto.Info = "22"; + break; + default: + break; + } + client.Send(statusInto.ToString()); + LogHelper.Debug(statusInto.ToString()); + ReplayTaskEvent?.Invoke(statusInto.ToString()); + break; + case EInstruction.SwitchStatus: + SchedulingStatusInfo switchStatus = JsonConvert.DeserializeObject(msg); + SwitchStatus(switchStatus); + //MachineManage.Instance.MachineStatus= EMachineStatus. + //if (ss.TryConvertInfoTo(out ERunMode runMode)) + // MachineManage.Instance.RunMode = runMode; + //client.Send(ss.ToString()); + //ReplayTaskEvent?.Invoke(ss.ToString()); + break; + case EInstruction.ClearAlarm: + break; + case EInstruction.GetRecipeList: + SchedulingResult sr = JsonConvert.DeserializeObject(msg); + sr.Message = "Default"; + client.Send(sr.ToString()); + ReplayTaskEvent?.Invoke(sr.ToString()); + break; + case EInstruction.SetRecipe: + break; + case EInstruction.GetCurrentRecipe: + SchedulingResult srcur = JsonConvert.DeserializeObject(msg); + srcur.Message = "Default"; + client.Send(srcur.ToString()); + ReplayTaskEvent?.Invoke(srcur.ToString()); + break; + case EInstruction.TurnoverReady: + break; + case EInstruction.ChangeState: + SchedulingResult cs = JsonConvert.DeserializeObject(msg); + client.Send(cs.ToString()); + ReplayTaskEvent?.Invoke(cs.ToString()); + break; + case EInstruction.ShowMessage: + break; + case EInstruction.CloseMessage: + SchedulingMessageBox mbox = JsonConvert.DeserializeObject(json); + break; + case EInstruction.MachineButtonDown: + break; + case EInstruction.MachineButtonUp: + break; + case EInstruction.TrayProductRange: + break; + case EInstruction.ClearTrayProductRange: + schedulResult = JsonConvert.DeserializeObject(msg); + client.Send(schedulResult.ToString()); + ReplayTaskEvent?.Invoke(schedulResult.ToString()); + break; + case EInstruction.RequestSwitchTray: + break; + case EInstruction.BeginSwitchTray: + break; + case EInstruction.MoveScanner: + break; + case EInstruction.InquireMoveScannerState: + break; + case EInstruction.SetAlarms: + break; + case EInstruction.CancelAlarms: + break; + case EInstruction.IsLastBeforeTray: + break; + case EInstruction.EndInput: + break; + case EInstruction.TakingError: + break; + case EInstruction.CancelTakingError: + break; + case EInstruction.Rearrange: + break; + case EInstruction.RearrangeResult: + break; + case EInstruction.ScanBarcode: + break; + } + } + + + //string msg=Encoding.UTF8.GetString(data); + //LogHelper.TestCenterLog("接收:"+msg); + //ReciveTaskEvent?.Invoke(msg); + } /// @@ -263,5 +274,18 @@ namespace Rs.MotionPlat.Flow string content = LoadAndUnloadTask.Instance.GetTestUnLoadString(); return client.Send(content) > 0; } + + public int Send(string content) + { + return client.Send(content); + } + + public void EndInput() + { + Scheduling s = new Scheduling(); + s.Instruction = EInstruction.EndInput; + string content = JsonConvert.SerializeObject(s, new StringEnumConverter()); + client.Send(content); + } } } diff --git a/Rs.SkyLine/Flow/WorkFlow.cs b/Rs.SkyLine/Flow/WorkFlow.cs index ff4c3e8..4fb52bc 100644 --- a/Rs.SkyLine/Flow/WorkFlow.cs +++ b/Rs.SkyLine/Flow/WorkFlow.cs @@ -5,6 +5,7 @@ using Rs.Framework; using Rs.Motion; using Rs.MotionPlat.Commom; using Rs.MotionPlat.Flow.Space; +using Rs.MotionPlat.MsgBox; using System; using System.Collections.Generic; using System.Diagnostics; @@ -326,13 +327,48 @@ namespace Rs.MotionPlat.Flow FetchNum++; if (FetchNum == 6) { - DialogResult dr = Msg.ShowError($"吸嘴{curNozzle.NozzleIndex}取料{FetchNum}次失败报警,请处理后点击确定", MessageBoxButtons.RetryCancel); - if(dr== DialogResult.Retry) + //DialogResult dr = Msg.ShowError($"吸嘴{curNozzle.NozzleIndex}取料{FetchNum}次失败报警,请处理后点击确定", MessageBoxButtons.RetryCancel); + CloseResult cr = new TakeFailMsg().ShowMsg($"吸嘴{curNozzle.NozzleIndex}取料{FetchNum}次失败报警,请处理后点击确定"); + if (cr.Result == ECloseButton.Retry) { FetchNum = 0; flowStep = EWorkFlowStep.到取料位下方; } - else + else if (cr.Result == ECloseButton.Skip)//switch + { + FetchNum = 0; + if (curTask.FromType == TurnoverType.Turnover) + { + GlobalTray.TurnoverTray.ChangeStatus(curTask.FromIndex + 1, ESlotStatus.NotHave); + } + else if (curTask.FromType == TurnoverType.ToBeTested) + { + GlobalTray.InputTray.ChangeStatus(GlobalTray.InputTray.GetSlot(ESlotStatus.Have).Index, ESlotStatus.NotHave); + } + if (LoadAndUnloadTask.Instance.GetTaskNum(curTask.taskMode) > 0 && NozzleManager.GetNozzlesByStatus(ENozzleStatus.IDLE).Count > 0) + { + flowStep = EWorkFlowStep.到取料位上方; + } + else + { + flowStep = EWorkFlowStep.到下相机拍照起始位; + } + } + else if(cr.Result== ECloseButton.EndInput) + { + FetchNum = 0; + TestCenter.Instance.EndInput(); + LoadAndUnloadTask.Instance.ClearUndoTask(); + if(NozzleManager.GetNozzlesByStatus(ENozzleStatus.ToUnload).Count>0) + { + flowStep = EWorkFlowStep.到下相机拍照起始位; + } + else + { + flowStep = EWorkFlowStep.任务结束到安全位; + } + } + else if (cr.Result == ECloseButton.Continue) { FetchNum = 0; curNozzle.Status = ENozzleStatus.ToUnload; @@ -343,8 +379,6 @@ namespace Rs.MotionPlat.Flow curNozzle.ToIndex = curTask.ToIndex; curTask.SuckerNo = curNozzle.NozzleIndex; curNozzle.TurnoverGUID = curTask.GUID; - - FetchNum = 0; if (curTask.FromType == TurnoverType.Turnover) { curNozzle.SN = curTask.SN; @@ -503,6 +537,7 @@ namespace Rs.MotionPlat.Flow } //CameraOkEvent?.Invoke(imgs, mrs); OnMatchResult?.Invoke(mrs); + //TestCenter.Instance.EndInput(); flowStep = EWorkFlowStep.到放料位上方; //Thread.Sleep(2000); } diff --git a/Rs.SkyLine/MsgBox/TakeFailMsg.Designer.cs b/Rs.SkyLine/MsgBox/TakeFailMsg.Designer.cs new file mode 100644 index 0000000..f35a83c --- /dev/null +++ b/Rs.SkyLine/MsgBox/TakeFailMsg.Designer.cs @@ -0,0 +1,147 @@ +namespace Rs.MotionPlat.MsgBox +{ + partial class TakeFailMsg + { + /// + /// 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.panel2 = new System.Windows.Forms.Panel(); + this.btnContinue = new System.Windows.Forms.Button(); + this.btnRetry = new System.Windows.Forms.Button(); + this.btnSkip = new System.Windows.Forms.Button(); + this.btnEndInput = new System.Windows.Forms.Button(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.panel2.SuspendLayout(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // panel2 + // + this.panel2.Controls.Add(this.btnContinue); + this.panel2.Controls.Add(this.btnRetry); + this.panel2.Controls.Add(this.btnSkip); + this.panel2.Controls.Add(this.btnEndInput); + this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel2.Location = new System.Drawing.Point(0, 234); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(476, 48); + this.panel2.TabIndex = 4; + // + // btnContinue + // + this.btnContinue.Location = new System.Drawing.Point(373, 3); + this.btnContinue.Name = "btnContinue"; + this.btnContinue.Size = new System.Drawing.Size(89, 39); + this.btnContinue.TabIndex = 0; + this.btnContinue.Text = "继续"; + this.btnContinue.UseVisualStyleBackColor = true; + this.btnContinue.Click += new System.EventHandler(this.btnContinue_Click); + // + // btnRetry + // + this.btnRetry.Location = new System.Drawing.Point(260, 3); + this.btnRetry.Name = "btnRetry"; + this.btnRetry.Size = new System.Drawing.Size(89, 39); + this.btnRetry.TabIndex = 0; + this.btnRetry.Text = "重试"; + this.btnRetry.UseVisualStyleBackColor = true; + this.btnRetry.Click += new System.EventHandler(this.btnRetry_Click); + // + // btnSkip + // + this.btnSkip.Location = new System.Drawing.Point(147, 4); + this.btnSkip.Name = "btnSkip"; + this.btnSkip.Size = new System.Drawing.Size(89, 39); + this.btnSkip.TabIndex = 0; + this.btnSkip.Text = "跳过"; + this.btnSkip.UseVisualStyleBackColor = true; + this.btnSkip.Click += new System.EventHandler(this.btnSkip_Click); + // + // btnEndInput + // + this.btnEndInput.Location = new System.Drawing.Point(34, 4); + this.btnEndInput.Name = "btnEndInput"; + this.btnEndInput.Size = new System.Drawing.Size(89, 39); + this.btnEndInput.TabIndex = 0; + this.btnEndInput.Text = "结束上料"; + this.btnEndInput.UseVisualStyleBackColor = true; + this.btnEndInput.Click += new System.EventHandler(this.btnEndInput_Click); + // + // panel1 + // + this.panel1.Controls.Add(this.label1); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(0, 40); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(476, 194); + this.panel1.TabIndex = 5; + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.ForeColor = System.Drawing.Color.White; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(476, 194); + this.label1.TabIndex = 0; + this.label1.Text = "label1"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // TakeFailMsg + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0))))); + this.ClientSize = new System.Drawing.Size(476, 282); + this.Controls.Add(this.panel1); + this.Controls.Add(this.panel2); + this.HeadText = "提示"; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "TakeFailMsg"; + this.ShowMax = false; + this.ShowMin = false; + this.Text = "TakeFailMsg"; + this.Controls.SetChildIndex(this.panel2, 0); + this.Controls.SetChildIndex(this.panel1, 0); + this.panel2.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Button btnRetry; + private System.Windows.Forms.Button btnSkip; + private System.Windows.Forms.Button btnEndInput; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button btnContinue; + private System.Windows.Forms.Label label1; + } +} \ No newline at end of file diff --git a/Rs.SkyLine/MsgBox/TakeFailMsg.cs b/Rs.SkyLine/MsgBox/TakeFailMsg.cs new file mode 100644 index 0000000..78d7901 --- /dev/null +++ b/Rs.SkyLine/MsgBox/TakeFailMsg.cs @@ -0,0 +1,67 @@ +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; + +namespace Rs.MotionPlat.MsgBox +{ + + public partial class TakeFailMsg : BaseFormHeader + { + CloseResult result = new CloseResult(); + public TakeFailMsg() + { + InitializeComponent(); + this.StartPosition = FormStartPosition.CenterScreen; + } + + public CloseResult ShowMsg(string msg) + { + this.label1.Text = msg; + this.ShowDialog(); + return result; + } + + private void btnEndInput_Click(object sender, EventArgs e) + { + result.Result = ECloseButton.EndInput; + this.Close(); + } + + private void btnSkip_Click(object sender, EventArgs e) + { + result.Result = ECloseButton.Skip; + this.Close(); + } + + private void btnRetry_Click(object sender, EventArgs e) + { + result.Result = ECloseButton.Retry; + this.Close(); + } + + private void btnContinue_Click(object sender, EventArgs e) + { + result.Result = ECloseButton.Continue; + this.Close(); + } + } + + public enum ECloseButton + { + EndInput, + Skip, + Retry, + Continue + } + public class CloseResult + { + public ECloseButton Result { get; set; } + } +} diff --git a/Rs.SkyLine/MsgBox/TakeFailMsg.resx b/Rs.SkyLine/MsgBox/TakeFailMsg.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Rs.SkyLine/MsgBox/TakeFailMsg.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/Rs.SkyLine/Rs.SkyLine.csproj b/Rs.SkyLine/Rs.SkyLine.csproj index dda1d5a..06b9e59 100644 --- a/Rs.SkyLine/Rs.SkyLine.csproj +++ b/Rs.SkyLine/Rs.SkyLine.csproj @@ -217,6 +217,12 @@ MoveDebug.cs + + Form + + + TakeFailMsg.cs + Form @@ -429,6 +435,9 @@ MoveDebug.cs + + TakeFailMsg.cs + OldTest.cs diff --git a/Rs.SkyLine/SysConfig/StartPosConfig.Designer.cs b/Rs.SkyLine/SysConfig/StartPosConfig.Designer.cs index 0451084..ff74ad0 100644 --- a/Rs.SkyLine/SysConfig/StartPosConfig.Designer.cs +++ b/Rs.SkyLine/SysConfig/StartPosConfig.Designer.cs @@ -121,8 +121,6 @@ this.btnTeachNozzleZ2GrabHeight = new System.Windows.Forms.Button(); this.btnTeachNozzleZ3GrabHeight = new System.Windows.Forms.Button(); this.btnTeachNozzleZ1GrabHeight = new System.Windows.Forms.Button(); - this.button9 = new System.Windows.Forms.Button(); - this.button10 = new System.Windows.Forms.Button(); this.panelEx1.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -1468,33 +1466,11 @@ this.btnTeachNozzleZ1GrabHeight.UseVisualStyleBackColor = false; this.btnTeachNozzleZ1GrabHeight.Click += new System.EventHandler(this.Teach_Click); // - // button9 - // - this.button9.Location = new System.Drawing.Point(1262, 102); - this.button9.Name = "button9"; - this.button9.Size = new System.Drawing.Size(75, 23); - this.button9.TabIndex = 4; - this.button9.Text = "button9"; - this.button9.UseVisualStyleBackColor = true; - this.button9.Click += new System.EventHandler(this.button9_Click); - // - // button10 - // - this.button10.Location = new System.Drawing.Point(1262, 181); - this.button10.Name = "button10"; - this.button10.Size = new System.Drawing.Size(75, 23); - this.button10.TabIndex = 4; - this.button10.Text = "button9"; - this.button10.UseVisualStyleBackColor = true; - this.button10.Click += new System.EventHandler(this.button10_Click); - // // StartPosConfig // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1405, 704); - this.Controls.Add(this.button10); - this.Controls.Add(this.button9); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox2); this.Controls.Add(this.panelEx1); @@ -1609,7 +1585,5 @@ private System.Windows.Forms.Button btnTeachNozzleZ2GrabHeight; private System.Windows.Forms.Button btnTeachNozzleZ3GrabHeight; private System.Windows.Forms.Button btnTeachNozzleZ1GrabHeight; - private System.Windows.Forms.Button button9; - private System.Windows.Forms.Button button10; } } \ No newline at end of file diff --git a/Rs.SkyLine/SysConfig/StartPosConfig.cs b/Rs.SkyLine/SysConfig/StartPosConfig.cs index 1a397a5..f60df94 100644 --- a/Rs.SkyLine/SysConfig/StartPosConfig.cs +++ b/Rs.SkyLine/SysConfig/StartPosConfig.cs @@ -1,4 +1,7 @@ -using Rs.Controls; +using HalconDotNet; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json; +using Rs.Controls; using Rs.Framework; using Rs.MotionPlat.Commom; using Rs.MotionPlat.Flow; @@ -11,6 +14,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using static Rs.MotionPlat.Commom.SchedulingMessageBox; +using Rs.MotionPlat.MsgBox; namespace Rs.MotionPlat.SysConfig { @@ -58,7 +63,20 @@ namespace Rs.MotionPlat.SysConfig private void button10_Click(object sender, EventArgs e) { - Ops.HomeAndGoStartPos(nozz); + SchedulingMessageBox s = new SchedulingMessageBox(); + s.ID = 111; + s.ButtonContexts = new Dictionary() { { ETipButton.Retry, "abc"} }; + s.Instruction = EInstruction.ShowMessage; + s.Message = "hello"; + s.Button = SchedulingMessageBox.ETipButton.RetrySkip; + string content = JsonConvert.SerializeObject(s, new StringEnumConverter()); + TestCenter.Instance.Send(content); + } + + private void button12_Click(object sender, EventArgs e) + { + TakeFailMsg msg = new TakeFailMsg(); + CloseResult cr = msg.ShowMsg("dfsd"); } } }