123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- 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.DataOperate;
- using UAS_MES.Entity;
- using UAS_MES.PublicMethod;
- namespace UAS_MES.Query
- {
- public partial class Query_OnlineTraceBack : Form
- {
- DataHelper dh;
- LogStringBuilder sql = new LogStringBuilder();
- AutoSizeFormClass asc = new AutoSizeFormClass();
- DataTable ComBoxData = new DataTable();
- DataTable Dbfind;
- public Query_OnlineTraceBack()
- {
- InitializeComponent();
- }
- private void Query_OnlineTraceBack_Load(object sender, EventArgs e)
- {
- asc.controllInitializeSize(this);
- dh = SystemInf.dh;
- DataColumn status = new DataColumn("status");
- DataColumn statuscode = new DataColumn("statuscode");
- ComBoxData.Columns.Add(status);
- ComBoxData.Columns.Add(statuscode);
- DataRow dr = ComBoxData.NewRow();
- dr[0] = "全部"; dr[1] = "ALL"; ComBoxData.Rows.Add(dr);
- dr = ComBoxData.NewRow();
- dr[0] = "未生产"; dr[1] = "null"; ComBoxData.Rows.Add(dr);
- dr = ComBoxData.NewRow();
- dr[0] = "已归属"; dr[1] = "0"; ComBoxData.Rows.Add(dr);
- dr = ComBoxData.NewRow();
- dr[0] = "在线"; dr[1] = "1"; ComBoxData.Rows.Add(dr);
- dr = ComBoxData.NewRow();
- dr[0] = "已完工"; dr[1] = "2"; ComBoxData.Rows.Add(dr);
- dr = ComBoxData.NewRow();
- dr[0] = "不良待维修"; dr[1] = "3"; ComBoxData.Rows.Add(dr);
- dr = ComBoxData.NewRow();
- dr[0] = "已报废"; dr[1] = "4"; ComBoxData.Rows.Add(dr);
- ms_status.DataSource = ComBoxData;
- ms_status.DisplayMember = "status";
- ms_status.ValueMember = "statuscode";
- //工单号放大镜配置
- 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;
- }
- 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, ms_stepcode, ms_nextstepcode);
- string statuscode = ms_status.SelectedValue.ToString();
- sql.Clear();
- sql.Append("select distinct sncode ms_sncode,ms_linecode,ms_stepcode,ms_nextstepcode,ms_craftcode,makecode ms_makecode, ");
- sql.Append("case when ms_status is null then '未生产' when ms_status=0 then '已归属' when ms_status=1 then '在线' when ms_status=2 ");
- sql.Append(" then '已完工' when ms_status=3 then '不良待维修' when ms_status=4 then '已报废' ");
- sql.Append("else 'null' end ms_status from((select msd_sncode sncode,msd_makecode makecode,msd_type type ");
- sql.Append("from makesnruledetail where msd_makecode='" + ma_code.Text + "') union (select msl_sncode sncode,msl_makecode ");
- sql.Append("makecode,msl_type type from makesnlist where msl_makecode='" + ma_code.Text + "') union (");
- sql.Append("select ms_sncode,ms_makecode,'' type from makeserial where ms_makecode='" + ma_code.Text + "'))");
- sql.Append("A left join makeserial on ms_sncode=sncode and ms_makecode=makecode ");
- sql.Append(condition);
- if (statuscode == "null")
- {
- sql.Append("and ms_status is null");
- }
- else if (statuscode == "ALL")
- {
- }
- else
- {
- sql.Append("and ms_status ='" + statuscode + "'");
- }
- sql.Append(" order by ms_sncode ");
- DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
- BaseUtil.FillDgvWithDataTable(SnInf, dt);
- Count.Text = SnInf.Rows.Count.ToString();
- ma_qty.Text = dh.getFieldDataByCondition("make", "ma_qty", "ma_code='" + ma_code.Text + "'").ToString();
- }
- else
- {
- MessageBox.Show("工单号" + ma_code.Text + "不存在");
- BaseUtil.CleanDataGridView(SnInf);
- ma_code.Text = "";
- }
- }
- private void ms_status_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (ma_code.Text != "")
- Query.PerformClick();
- }
- }
- }
|