using DevExpress.Printing.Core.PdfExport.Metafile; using NPOI.SS.Formula.Eval; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Assemblies; using System.Data; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; using System.Xml; using UAS_MES_NEW.DataOperate; using UAS_MES_NEW.Entity; using UAS_MES_NEW.PublicMethod; namespace UAS_MES_NEW.Make { public partial class Make_WirelessTest : Form { StringBuilder sql = new StringBuilder(); DataHelper dh = new DataHelper(); DataTable dt = new DataTable(); string SN,WO = ""; public Make_WirelessTest() { InitializeComponent(); } private void Make_WirelessTest_Load(object sender, EventArgs e) { } private void GetSNCode_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (GetSNCode.Text == "") { ShowMsg(0, "序列号不允许为空"); ClearSnDetail(); return; } string oStatus, ErrorMessage = ""; if (LogicHandler.GetMakeInfo(GetSNCode.Text.Trim(), out WO, out oStatus, out ErrorMessage)) { sql.Clear(); sql.Append($@"SELECT ms_sncode,ma_code,ms_prodcode,pr_detail FROM makeserial,make,product WHERE ms_sncode = '{GetSNCode.Text.Trim()}' AND ms_makecode = ma_code AND ma_prodcode = pr_code"); dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select"); if (dt.Rows.Count > 0) { SetSnDetail(dt); } } else { ShowMsg(0, "序列号不存在"); ClearSnDetail(); return; } SN = GetSNCode.Text.Trim(); GetSNCode.Focus(); GetSNCode.SelectAll(); } } private void Clean_Click(object sender, EventArgs e) { OperatResult.Clear(); } private void SetSnDetail(DataTable dt) { snVal.Text = dt.Rows[0]["ms_sncode"].ToString(); woVal.Text = dt.Rows[0]["ma_code"].ToString(); prodVal.Text = dt.Rows[0]["ms_prodcode"].ToString(); prodNameVal.Text = dt.Rows[0]["pr_detail"].ToString(); } private void ClearSnDetail() { snVal.Text = ""; woVal.Text = ""; prodVal.Text = ""; prodNameVal.Text = ""; } private void OK_Click(object sender, EventArgs e) { PassStation("OK"); } private void NG_Click(object sender, EventArgs e) { PassStation("NG"); } private void PassStation(string testResult) { if (GetSNCode.Text.Trim() == "" || string.IsNullOrEmpty(SN)) { ShowMsg(0, "序列号不允许为空,请Enter"); ClearSnDetail(); return; } string omakeCode, oMsid, oErrorMessage; if (LogicHandler.CheckStepSNAndMacode(WO, User.UserSourceCode, SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage)) { if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, SN, "无线吞吐量测试", testResult, User.UserCode, out oErrorMessage)) { LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, WO, User.UserLineCode, User.UserSourceCode, "无线吞吐量测试", "", SN, ""); sql.Clear(); sql.Append($@"INSERT INTO steptestdetail (std_id,std_sn,std_makecode, std_rescode,std_date,std_indate,std_class,std_value1,std_stepcode) VALUES (steptestdetail_seq.NEXTVAL,'{SN}','{WO}', '{User.UserSourceCode}',sysdate,sysdate,'无线吞吐量测试','{testResult}', '{User.CurrentStepCode}' )"); dh.ExecuteSql(sql.ToString(), "insert"); ShowMsg(1, $"{SN}: 过站记录成功,结果为{testResult}"); GetSNCode.Text = ""; ClearSnDetail(); } else { ShowMsg(0, $"过站处理记录NG: {oErrorMessage}"); } } else { ShowMsg(0, $"过站核对NG: {oErrorMessage}"); } } private void ShowMsg(int type, string msg) { string fullDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (type == 0) { OperatResult.AppendText($"{fullDateTime}: {msg}\n", Color.Red); } else if (type == 1) { OperatResult.AppendText($"{fullDateTime}: {msg}\n", Color.Black); } } } }