| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- 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_UpdateDownLine : Form
- {
- public Make_UpdateDownLine()
- {
- InitializeComponent();
- }
- StringBuilder SQL = new StringBuilder();
- DataTable dt;
- DataHelper dh;
- bool authenticate;
- private void Make_UpdateDownLine_Load(object sender, EventArgs e)
- {
- dh = SystemInf.dh;
- SQL.Clear();
- SQL.Append("SELECT dl_linecode FROM deviceline WHERE dl_type = 'SMT'");
- dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
- if (dt.Rows.Count > 0)
- {
- for(int i = dt.Rows.Count - 1; i >= 0; i--)
- {
- Line.Items.Add(dt.Rows[i]["dl_linecode"]);
- }
- Down.Enabled = true;
- }
- SQL.Clear();
- SQL.Append("SELECT * FROM deviceline_smt_log ORDER BY dl_indate DESC");
- dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
- if (dt.Rows.Count > 0)
- {
- DGV.DataSource = dt;
- }
- SQL.Clear();
- SQL.Append($"select * from employee where em_type = 'admin' and em_name = '{User.UserName}'");
- dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
- if (dt.Rows.Count > 0)
- {
- authenticate = true;
- Down.Enabled = true;
- }
- }
- private void Down_Click(object sender, EventArgs e)
- {
- if (!authenticate)
- {
- return;
- }
- if (Line.SelectedIndex == -1)
- {
- return;
- }
- DialogResult result = MessageBox.Show("确定是否下线在制工单","警告",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning);
- if(result != DialogResult.OK)
- {
- return;
- }
- string line = Line.Text;
- SQL.Clear();
- SQL.Append($"INSERT INTO DEVICELINE_SMT_LOG SELECT * FROM DEVICELINE WHERE DL_LINECODE = '{line}' AND DL_TYPE = 'SMT'");
- dh.ExecuteSql(SQL.ToString(), "insert");
- SQL.Clear();
- SQL.Append($"DELETE DEVICELINE WHERE DL_TYPE = 'SMT' AND DL_LINECODE = '{line}'");
- dh.ExecuteSql(SQL.ToString(), "delete");
- SQL.Clear();
- SQL.Append("SELECT * FROM deviceline_smt_log ORDER BY dl_indate DESC");
- dt = (DataTable)dh.ExecuteSql(SQL.ToString(), "select");
- if (dt.Rows.Count > 0)
- {
- DGV.DataSource = dt;
- }
- }
- }
- }
|