using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using Estsh.Client.Base; using System.Configuration; using System.IO; namespace Estsh.Client.StepLibrary { public partial class CompleteCheck : StepBase { private StepLibraryAPP app = null; private List _CheckData = null; //绑定数据 private delegate void DeleGrdBind(List dt); private int _terminalID = 0; private string _sn = ""; ////PASS上一次成功扫描时间 //private DateTime _lastPassDatetime; //PASS扫描间隔 private int _passIntervalValue = 2000; //PASS间隔限制工位集合 private string _passIntervalLimit = string.Empty; public CompleteCheck() { InitializeComponent(); // 有用户界面的工步在初始化时需要设置为不可见 // 开始执行此工步后再置为可见 this.Visible = false; } public override bool Do() { try { // 置为可见并加载到最前端 this.Visible = true; this.BringToFront(); // 从配置文件中加载工位编号 _terminalID = Convert.ToInt32(Context["terminal_id"].ToString()); _sn = Context["serial_number"].ToString(); app = new StepLibraryAPP(httpClient); string _PartNo = app.GetPartNo(_sn); string rule = app.GetRuleNo(_PartNo); string partLocation = app.GetPartLoc(_PartNo); // 执行父类的 Do 方法并返回 return base.Do(); } catch (Exception ex) { // 记录日志 using (StreamWriter sw = new StreamWriter("Error_Log_" + DateTime.Now.ToString("yyyyMM") + ".txt", true)) { sw.WriteLine(string.Format("{0} {1}", "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] ", ex.ToString())); sw.Flush(); sw.Close(); } return false; } } private void OutPdline_Load(object sender, EventArgs e) { _sn = Context["serial_number"].ToString(); app = new StepLibraryAPP(httpClient); _terminalID = Convert.ToInt32(Context["terminal_id"].ToString()); // 工步执行完成后调用此方法 Complate(this, e); } private void txtSN_KeyPress(object sender, KeyPressEventArgs e) { } } }