using DevExpress.XtraMap.Native; using LabelManager2; using System; using System.Data; using System.Linq; using System.Threading; using System.Windows.Forms; using UAS_MES_NEW.DataOperate; using UAS_MES_NEW.Entity; using UAS_MES_NEW.PublicForm; using UAS_MES_NEW.PublicMethod; namespace UAS_MES_NEW.Query { public partial class Query_LoadMake : Form { DataHelper dh = SystemInf.dh; ApplicationClass lbl; Document doc; DataTable Dbfind; Thread InitPrint; public Query_LoadMake() { InitializeComponent(); } private void Query_LoadMake_Load(object sender, EventArgs e) { ma_code.TableName = "make left join product on ma_prodcode=pr_code"; ma_code.SelectField = "ma_code # 工单号,ma_prodcode # 产品编号,ma_qty # 工单数量,pr_detail # 产品名称,ma_softversion # 软件版本"; ma_code.FormName = Name; ma_code.SetValueField = new string[] { "ma_code" }; ma_code.Condition = "ma_statuscode='STARTED'"; ma_code.DbChange += Ma_code_DbChange; li_code.TableName = "line"; li_code.SelectField = "li_code # 线别编号,li_name # 线别名称"; li_code.FormName = Name; li_code.SetValueField = new string[] { "li_code" }; li_code.Condition = "li_statuscode='AUDITED'"; li_code.DbChange += Ma_code_DbChange; LoadGridData(); } private void Ma_code_DbChange(object sender, EventArgs e) { Dbfind = ma_code.ReturnData; BaseUtil.SetFormValue(this.Controls, Dbfind); } private void UpLoadMake_Click(object sender, EventArgs e) { if (ma_code.Text == "" || li_code.Text == "") { MessageBox.Show("工单和线别不允许为空"); return; } if (mancount.Value == 0) { MessageBox.Show("人数必须大于0"); return; } if (dh.CheckExist("loadmake", "lm_linecode='" + li_code.Text + "' and lm_downtime is null")) { MessageBox.Show("线别" + li_code.Text + "存在在线工单,不允许上线"); return; } dh.ExecuteSql("insert into loadmake(lm_id,lm_makecode,lm_linecode,lm_uptime,lm_inman,lm_mannum)" + "values(loadmake_seq.nextval,'" + ma_code.Text + "','" + li_code.Text + "',sysdate,'" + User.UserName + "','" + mancount.Value + "')", "insert"); LoadGridData(); } private void DownLoadMake_Click(object sender, EventArgs e) { if (!ifcheckrow()) { MessageBox.Show("请勾选需要操作的行"); return; } for (int i = 0; i < DGV.Rows.Count; i++) { if (DGV.Rows[i].Cells["Choose"].Value != null && DGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True") { dh.ExecuteSql("update loadmake set lm_downtime=sysdate where lm_id='" + DGV.Rows[i].Cells["lm_id"].Value.ToString() + "'", "update"); } } LoadGridData(); } private void LoadGridData() { DataTable dt = (DataTable)dh.ExecuteSql("select * from loadmake where lm_downtime is null", "select"); BaseUtil.FillDgvWithDataTable(DGV, dt); } private void ChangeMan_Click(object sender, EventArgs e) { if (!ifcheckrow()) { MessageBox.Show("请勾选需要操作的行"); return; } for (int i = 0; i < DGV.Rows.Count; i++) { if (DGV.Rows[i].Cells["Choose"].Value != null && DGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True") { dh.ExecuteSql("update loadmake set lm_downtime=sysdate where lm_id='" + DGV.Rows[i].Cells["lm_id"].Value.ToString() + "'", "update"); string makecode = DGV.Rows[i].Cells["lm_makecode"].Value.ToString(); string licode = DGV.Rows[i].Cells["lm_linecode"].Value.ToString(); string mannum = DGV.Rows[i].Cells["LM_MANNUM"].Value.ToString(); dh.ExecuteSql("insert into loadmake(lm_id,lm_makecode,lm_linecode,lm_uptime,lm_inman,lm_mannum)" + "values(loadmake_seq.nextval,'" + makecode + "','" + licode + "',sysdate,'" + User.UserName + "','" + mannum + "')", "insert"); } } LoadGridData(); } private bool ifcheckrow() { for (int i = 0; i < DGV.Rows.Count; i++) { if (DGV.Rows[i].Cells["Choose"].Value != null && DGV.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True") { return true; } } return false; } } }