using Estsh.Client.Base; namespace Estsh.Client.StepLibrary { public class RF182CRFIDClearWrite : StepBase { public override bool Do () { try { //RF182C rf182c=new RF182C (); RFIDApp app = new RFIDApp (httpClient); string el_no = Context [ "serial_number" ] .ToString (); string terminal_id = Context [ "terminal_id" ] .ToString (); // 执行父类的 Do 方法并返回 bool initializeRFIDState =Convert .ToBoolean (Context [ "initializeRFIDState" ] .ToString ()); bool TAGState =Convert .ToBoolean (Context [ "TAGState" ] .ToString ()); if (initializeRFIDState == true) { if (TAGState == false) { ShowMessage(this, "red|未检测到TAG!"); } else { List RFIDOperationType = app.GetRFIDOperationType(Convert.ToInt32(terminal_id), "RFID_IP"); string perationType = ""; if (RFIDOperationType.Count > 0) { perationType = RFIDOperationType[0]["operation_type"].ToString(); } RF182C.Write("****************************************"); Thread.Sleep(200); Complate(this, new EventArgs()); } } else { ShowMessage(this, "red|RFID清除失败失败,请检查RFID信号!"); } } 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 (); ShowMessage(this, "red|RFID清除失败,程序未连接RFID!"); } } return base.Do(); } private void InitializeComponent () { this.SuspendLayout(); // // RF182CRFIDClearWrite // this.Name = "RF182CRFIDClearWrite"; this.Size = new System.Drawing.Size(831, 409); this.Load += new System.EventHandler(this.RF182CRFIDClearWrite_Load); this.ResumeLayout(false); } private void RF182CRFIDClearWrite_Load(object sender, EventArgs e) { // 工步执行完成后调用此方法 // Complate (this , e); } } }