| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using UAS_MES_NEW.DataOperate;
- using UAS_MES_NEW.Entity;
- namespace UAS_MES_NEW.Make
- {
- public partial class Make_EquiConnect : Form
- {
- public Make_EquiConnect()
- {
- InitializeComponent();
- }
- StringBuilder SQL = new StringBuilder();
- DataHelper dh = SystemInf.dh;
- DataTable dt;
- private void Make_EquiConnect_Load(object sender, EventArgs e)
- {
- dt = (DataTable)dh.ExecuteSql("SELECT * FROM line WHERE li_wcname = 'SMT' ORDER BY li_auditdate", "select");
- if (dt.Rows.Count > 0)
- {
- foreach (DataRow item in dt.Rows)
- {
- LineVal.Items.Add(item["li_code"].ToString());
- }
- }
- }
- private void OK_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(LineVal.Text))
- {
- ShowMsg(0, "请选择线体");
- return;
- }
- if (string.IsNullOrEmpty(SNVal.Text))
- {
- ShowMsg(0, "请选择扫描序列号");
- return;
- }
- InsertLog("OK");
- }
- private void NG_Click(object sender, EventArgs e)
- {
- if (string.IsNullOrEmpty(LineVal.Text))
- {
- ShowMsg(0, "请选择线体");
- return;
- }
- if (string.IsNullOrEmpty(SNVal.Text))
- {
- ShowMsg(0, "请选择扫描序列号");
- return;
- }
- InsertLog("NG");
- }
- private void InsertLog(string resType)
- {
- UpdateSN("L", SNVal.Text.Trim());
- dh.ExecuteSql($@"INSERT INTO steptestdetail (std_id,std_sn,std_makecode,std_class,std_testresult,std_indate,std_rescode)
- VALUES (steptestdetail_seq.NEXTVAL, '{SNVal.Text.Trim()}','{workOrder.Text.Trim()}','Xray抽检','{resType}',sysdate, '{User.CurrentStepCode}')", "insert");
- ShowMsg(1, $"已记录 {SNVal.Text.Trim()},测试结果为 {resType}");
- SNVal.Focus();
- SNVal.SelectAll();
- }
- private void ShowMsg(int type, string msg)
- {
- msg = msg.Replace("\r", "").Replace("\n", "");
- string msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- string showMsg = $"{msgTime}: {msg}\n";
- if (type == 0)
- {
- OperatResult.AppendText(showMsg, Color.Red);
- }
- else if (type == 1)
- {
- OperatResult.AppendText(showMsg, Color.Green);
- }
- else if (type == 2)
- {
- OperatResult.AppendText(showMsg, Color.GreenYellow);
- }
- }
- private void UpdateSN(string type, string sn)
- {
- if (type == "C")
- {
- serialNumber.Text = "";
- workOrder.Text = "";
- productCode.Text = "";
- productName.Text = "";
- }
- else if (type == "L")
- {
- SQL.Clear();
- SQL.Append($@"SELECT ms_sncode,ma_code,pr_code,pr_spec FROM makeserial,make,product
- WHERE ms_sncode = '{sn}' AND ms_makecode = ma_code AND ms_prodcode = pr_code");
- dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
- if (dt.Rows.Count > 0)
- {
- serialNumber.Text = dt.Rows[0]["ms_sncode"].ToString();
- workOrder.Text = dt.Rows[0]["ma_code"].ToString();
- productCode.Text = dt.Rows[0]["pr_code"].ToString();
- productName.Text = dt.Rows[0]["pr_spec"].ToString();
- }
- else
- {
- UpdateSN("C", sn);
- }
- }
- }
- }
- }
|