| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- 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 CoreFS.CA06;
- using System.Collections;
- namespace Core.StlMes.Client.LgCommon
- {
- public partial class frmSelectWeight : FrmBase
- {
- public string sWeight = "";
- public string MaterCode = "";
- public string MaterName = "";
- public string Weight = "";
- public string HeatProcessNo = "";
- public string Weightno = "";
- public string VDate = "";
- public string WorkShopNo = "";
- public bool flag = false;
- public bool isCancel = false;
- public string vProcessNo = "";
- public bool isResult = false;
- private OpeBase _ob;
- public frmSelectWeight(OpeBase ob)
- {
- InitializeComponent();
- _ob = ob;
- }
- private void frmSelectWeight_Load(object sender, EventArgs e)
- {
- label2.Text = "";
- label4.Text = "";
- label6.Text = sWeight;
- label2.Text = MaterName;
- if (isResult)
- {
- buttcancel.Visible = false;
- buttsave.Text = "选择";
- getResultHJWeight();
- }
- else
- {
- getHJWeight();
- }
- }
- // 查询合金重量
- /// <summary>
- /// 查询合金重量
- /// </summary>
- private void getHJWeight()
- {
- try
- {
- string strErr = "";
- ArrayList arry = new ArrayList();
- ArrayList sqlList = new ArrayList();
- arry.Add("GetBofOptTime.Select");//此ID为XML文件ID
- arry.Add(HeatProcessNo.Substring(5, 8));
- arry.Add(HeatProcessNo.Substring(1, 2));
- arry.Add(HeatProcessNo.Substring(3, 2));
- arry.Add(HeatProcessNo.Substring(5, 8));
- arry.Add(HeatProcessNo.Substring(1, 2));
- arry.Add(HeatProcessNo.Substring(3, 2));
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = this._ob;
- DataSet ds1 = cctos.ExecuteQueryFunctions("Core.LgMes.Server.Common.ComDBQuery",
- "doSimpleQuery", arry, out strErr);
- DateTime strDate = DateTime.Now;
- if (ds1 != null && ds1.Tables.Count > 0 && ds1.Tables[0].Rows.Count > 0)
- {
- strDate = Convert.ToDateTime(ds1.Tables[0].Rows[0]["OPTDATE"].ToString());
- vProcessNo = ds1.Tables[0].Rows[0]["HEATPROCESSNO"].ToString();
- }
- strErr = "";
- string vLd = "";
- if (HeatProcessNo.Substring(2, 1) == "3")
- {
- vLd = "1";
- WorkShopNo = "2";
- }
- else if (HeatProcessNo.Substring(2, 1) == "4")
- {
- vLd = "2";
- WorkShopNo = "2";
- }
- else if (HeatProcessNo.Substring(2, 1) == "5")
- {
- vLd = "3";
- WorkShopNo = "2";
- }
- string strFrom = strDate.AddMinutes(-10).ToString("yyyy-MM-dd HH:mm:ss");
- string strTo = strDate.AddMinutes(30).ToString("yyyy-MM-dd HH:mm:ss");
- arry.Clear();
- arry.Add(vLd);
- arry.Add(WorkShopNo);
- arry.Add(strFrom);
- arry.Add(strTo);
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = _ob;
- //查询合金记录
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_JOB0014", 5, arry, out strErr);
-
- //arry.Add("GetBofHJMater.Select");//此ID为XML文件ID
- //sqlList = GetSqlWhere(strDate);
- //CoreClientParam CCP_LgEts = new CoreClientParam();
- //DataTable dt = new DataTable();
- //CCP_LgEts.ServerName = "Core.LgMes.Server.Common.ComDBMcmsQuery";
- //CCP_LgEts.MethodName = "doQuery";
- //CCP_LgEts.ServerParams = new object[] { arry, sqlList };
- //CCP_LgEts.SourceDataTable = dt;
- //this.ob = _ob;
- //this.ExecuteSortResultByQueryToDataTable(CCP_LgEts, CoreInvokeType.Internal);
- //ultraDataSource1.Rows.Clear();
- //DataSet ds = new DataSet();
- //ds.Tables.Add(dt);
- if (strErr == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
- {
- ultraDataSource1.Rows.Clear();
- for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
- {
- DataRow dr = ds.Tables[0].Rows[i];
- this.ultraDataSource1.Rows.Add(new object[]{
- dr["WEIGHTNO"].ToString(),
- dr["POINT"].ToString(),
- dr["WEIGHT"].ToString(),
- dr["FLAG"].ToString(),
- dr["WEIGTHTIME"].ToString(),
- dr["HEATNO"].ToString(),
- dr["MATIELCODE"].ToString(),
- dr["MATIELNAME"].ToString(),
- dr["HEATPROCESSNO"].ToString(),
- dr["WORKSHOP"].ToString(),
- dr["SHIFTCODE"].ToString(),
- dr["COUNTTIME"].ToString()
- });
- }
- }
- // PublicMethod.RefreshAndAutoSize(ultraGrid1);
- }
- catch { }
- }
- // 查询实绩合金重量
- /// <summary>
- /// 查询实绩合金重量
- /// </summary>
- private void getResultHJWeight()
- {
- try
- {
- string strErr = "";
- string strHeatno = "";
- ArrayList arry = new ArrayList();
- arry.Add(vProcessNo);
- arry.Add(vProcessNo);
- CommonClientToServer cctos = new CommonClientToServer();
- cctos.ob = _ob;
- //查询合金记录
- DataSet ds1 = cctos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_JOB0016", 5, arry, out strErr);
- DateTime strDate = DateTime.Now;
- if (ds1 != null && ds1.Tables.Count > 0 && ds1.Tables[0].Rows.Count > 0)
- {
- strDate = Convert.ToDateTime(ds1.Tables[0].Rows[0]["OPTDATE"].ToString());
- strHeatno = ds1.Tables[0].Rows[0]["HEATNO"].ToString();
- }
- strErr = "";
- string vLd = "";
- if (strHeatno.Substring(2, 1) == "3")
- {
- vLd = "1";
- WorkShopNo = "2";
- }
- else if (strHeatno.Substring(2, 1) == "4")
- {
- vLd = "2";
- WorkShopNo = "2";
- }
- else if (strHeatno.Substring(2, 1) == "5")
- {
- vLd = "3";
- WorkShopNo = "2";
- }
- string strFrom = strDate.AddMinutes(-10).ToString("yyyy-MM-dd HH:mm:ss");
- string strTo = strDate.AddMinutes(30).ToString("yyyy-MM-dd HH:mm:ss");
- arry.Clear();
- arry.Add(vLd);
- arry.Add(WorkShopNo);
- arry.Add(strFrom);
- arry.Add(strTo);
- CommonClientToServer ccTos = new CommonClientToServer();
- ccTos.ob = _ob;
- //查询合金记录
- DataSet ds = ccTos.ExecuteQueryFunctionsSqlID("Core.Mes.Server.Common.ComDataAccess",
- "QueryWithParameter", "STL_JOB0014", 5, arry, out strErr);
- if (strErr == "" && ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
- {
- ultraDataSource1.Rows.Clear();
- for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
- {
- DataRow dr = ds.Tables[0].Rows[i];
- this.ultraDataSource1.Rows.Add(new object[]{
- dr["WEIGHTNO"].ToString(),
- dr["POINT"].ToString(),
- dr["WEIGHT"].ToString(),
- dr["FLAG"].ToString(),
- dr["WEIGTHTIME"].ToString(),
- dr["HEATNO"].ToString(),
- dr["MATIELCODE"].ToString(),
- dr["MATIELNAME"].ToString(),
- dr["HEATPROCESSNO"].ToString(),
- dr["WORKSHOP"].ToString(),
- dr["SHIFTCODE"].ToString(),
- dr["COUNTTIME"].ToString()
- });
- }
- }
- // PublicMethod.RefreshAndAutoSize(ultraGrid1);
- }
- catch { }
- }
- private void buttrefrsh_Click(object sender, EventArgs e)
- {
- if (isResult)
- {
- getResultHJWeight();
- }
- else
- {
- getHJWeight();
- }
- }
- private void buttsave_Click(object sender, EventArgs e)
- {
- try
- {
- flag = true;
- isCancel = false;
- this.Close();
- }
- catch { }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- label4.Text = ultraGrid1.ActiveRow.Cells["WEIGHT"].Value.ToString();
- Weight = ultraGrid1.ActiveRow.Cells["WEIGHT"].Value.ToString();
- Weightno = ultraGrid1.ActiveRow.Cells["WEIGHTNO"].Value.ToString();
- VDate = ultraGrid1.ActiveRow.Cells["WEIGTHTIME"].Value.ToString();
- }
- catch { }
- }
- private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
- {
- //设置Row颜色
- if (e.Row.Cells["FLAG"].Value.ToString().Trim() == "已选")
- {
- e.Row.Cells["FLAG"].Appearance.BackColor = Color.SandyBrown;
- e.Row.Cells["FLAG"].Appearance.ForeColor = Color.Black;
- }
- }
- private void buttcancel_Click(object sender, EventArgs e)
- {
- flag = true;
- isCancel = true;
- this.Close();
- }
- }
- }
|