123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- 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.Make
- {
- public partial class Make_CancleSndown : Form
- {
- DataHelper dh;
- LogStringBuilder sql = new LogStringBuilder();
- AutoSizeFormClass asc = new AutoSizeFormClass();
- DataTable ComBoxData = new DataTable();
- DataTable Dbfind;
- public Make_CancleSndown()
- {
- InitializeComponent();
- }
- private void Query_OnlineTraceBack_Load(object sender, EventArgs e)
- {
- asc.controllInitializeSize(this);
- dh = SystemInf.dh;
-
- //工单号放大镜配置
- 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;
- DataTable dt = (DataTable)dh.ExecuteSql(" select li_code,li_name from line ", "select");
- linecode.DisplayMember = "li_name";
- linecode.ValueMember = "li_name";
- linecode.DataSource = dt;
- linecode.Text = "";
-
-
- }
- private void Ma_code_DbChange(object sender, EventArgs e)
- {
- Dbfind = ma_code.ReturnData;
- // BaseUtil.SetFormValue(this.Controls, Dbfind);
- // Query.PerformClick();
- }
- private void Query_OnlineTraceBack_SizeChanged(object sender, EventArgs e)
- {
- asc.controlAutoSize(this);
- }
- private void Query_Click(object sender, EventArgs e)
- {
- //if (dh.CheckExist("make", "ma_code='" + ma_code.Text + "'"))
- //{
- string condition = BaseUtil.GetScreenSqlCondition(ma_code, linecode, ms_stepcode);
- sql.Clear();
- sql.Append("select md_id,md_sncode,md_macode,md_prodcode,md_linecode,md_stepcode,md_downdate from makedown ");
- sql.Append(condition);
- sql.Append("and md_downdate between to_date('" + BeginDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss') and to_date('" + EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + "', 'yyyy-mm-dd hh24:mi:ss') and md_status = 0");
- sql.Append(" order by md_id asc ");
- DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- BaseUtil.FillDgvWithDataTable(SnInf, dt);
-
- checkBox1.Checked = false;
- Count.Text = "";
- //}
- //else
- //{
- // MessageBox.Show("工单号" + ma_code.Text + "不存在");
- // //BaseUtil.CleanDataGridView(SnInf);
- // //ma_code.Text = "";
- //}
- }
-
- private void normalButton1_Click(object sender, EventArgs e)
- {
- Thread InitPrint;
- InitPrint = new Thread(InPrint);
- SetLoadingWindow stw = new SetLoadingWindow(InitPrint, "SN解锁中");
- BaseUtil.SetFormCenter(stw);
- stw.ShowDialog();
- }
- private void InPrint()
- {
- try
- {
- int count = SnInf.Rows.Count;
- int check = 0;
- for (int i = 0; i < count; i++)
- {
- DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)SnInf.Rows[i].Cells["choose1"];
- Boolean flag = Convert.ToBoolean(checkCell.Value);
- if (flag == true)
- {
- sql.Clear();
- sql.Append("update makedown set md_status = -1,md_update = sysdate,md_upman = '"+User.UserCode+"' where md_id = "+ SnInf.Rows[i].Cells["md_id"].Value.ToString() + " ");
- //执行
- dh.ExecuteSql(sql.GetString(), "insert");
- check++;
- }
- }
- MessageBox.Show(check + "条数据解除锁定成功");
- Thread.Sleep(500);
- Query_Click(null,null);
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.Message);
- }
-
- }
- private void Query_OnlineTraceBack_FormClosing(object sender, FormClosingEventArgs e)
- {
- dh.Dispose();
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- int count = SnInf.Rows.Count;
- for (int i = 0; i < count; i++)
- {
- DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)SnInf.Rows[i].Cells["choose1"];
- Boolean flag = Convert.ToBoolean(checkCell.Value);
- if (flag != checkBox1.Checked)
- {
- checkCell.Value = checkBox1.Checked;
- }
- else
- {
- continue;
- }
- }
- countcheck();
- }
- private void normalButton2_Click(object sender, EventArgs e)
- {
- }
- private void countcheck()
- {
- int checkedRowCount = 0;
- foreach (DataGridViewRow row in SnInf.Rows)
- {
- DataGridViewCheckBoxCell checkBoxCell = row.Cells["choose1"] as DataGridViewCheckBoxCell;
- if (checkBoxCell != null && Convert.ToBoolean(checkBoxCell.Value) == true)
- {
- checkedRowCount++;
- }
- }
- Count.Text = checkedRowCount.ToString();
- }
- private void ma_code_UserControlTextChanged(object sender, EventArgs e)
- {
- DataTable dt = (DataTable)dh.ExecuteSql(" select mcd_stepcode,mcd_stepname from MAKECRAFTDETAIL where mcd_macode = '" + ma_code.Text+"' order by mcd_detno asc ", "select");
- ms_stepcode.DisplayMember = "mcd_stepname";
- ms_stepcode.ValueMember = "mcd_stepname";
- ms_stepcode.DataSource = dt;
- ms_stepcode.Text = "";
- }
- private void SnInf_CurrentCellDirtyStateChanged(object sender, EventArgs e)
- {
- if (SnInf.CurrentCell is DataGridViewCheckBoxCell)
- {
- SnInf.CommitEdit(DataGridViewDataErrorContexts.Commit);
- countcheck();
- // 执行你的操作,使用 checkedRows
- }
- }
- }
- }
|