123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- 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;
- }
- }
- }
|