| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control;
- using CoreFS.CA06;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.StlMes.Client.Mcp.Mch.Entity;
- namespace Core.StlMes.Client.Mcp.Mch.Report
- {
- public partial class FrmMchProcessQurey : FrmBase
- {
- private string plineCode = "";
- private string manageNmae = ""; //科室名称
- private string[] plineCodes = new string[] { };
- public FrmMchProcessQurey()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void FrmMchProcessQurey_Load(object sender, EventArgs e)
- {
- //DateTime now = DateTime.Now;
- //DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
- //DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
- //StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- //EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- StartTime.Value = DateTime.Parse(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 21:00"));
- EndTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 20:59"));
- manageNmae = UserInfo.GetDepartment();
- //plineCode = YdmBaseClass.GetPCode(manageNmae, this.ob);//获取 用户 对应的产线
- plineCodes= comm.InitDropPlineCodePower("G", txt_PlinCode, this.ValidDataPurviewIds, this.ob);
- txt_PlinCode.SelectedIndex = 0;
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = true;
-
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- //base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query":
- DoQuery();
- break;
- case "Export":
- GridHelper.ulGridToExcel(ultraGrid1, "加工线进程数据统计");
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <returns></returns>
- private void DoQuery()
- {
- var wf = new WaitingForm2("正在查询,请稍候....");
- try
- {
- Cursor = Cursors.WaitCursor;
-
-
- if (!CheckQuery()) return;
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = true;
- foreach (var ultraGridColumn in ultraGrid1.DisplayLayout.Bands[0].Columns)
- {
- if (ultraGridColumn.Key.StartsWith("GROUP"))
- {
- ultraGridColumn.Hidden = true;
- ultraGridColumn.Header.Caption = ultraGridColumn.Key.Replace("GROUP", "");
- }
- }
- string staTime = "";
- string endTime = "";
- if (chkTim.Checked)
- {
- staTime = StartTime.Value.ToString();
- endTime = EndTime.Value.ToString();
- }
- ArrayList list = new ArrayList();
- list.Add(staTime);
- list.Add(endTime);
- list.Add(chkJugeHeatNo.Checked?this.txtJugeNo.Text.Trim():"");
- list.Add(this.txtLotNo.Text.Trim());
- list.Add(chkOrder.Checked?this.txtOrder.Text.Trim():"");
- list.Add(uceStatus.SelectedIndex == -1 ? "" : uceStatus.SelectedItem.DataValue.ToString2());
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmJGXPerformance.doQueryPort", new object[] { list, plineCode == "" ? plineCodes : new string[] { plineCode } }, ob);
- GridHelper.CopyDataToDatatable(ref dt1, ref dataTable1, true);
- string OrderNo = chkOrder.Checked ? this.txtOrder.Text.Trim() : "";
- if (!string.IsNullOrWhiteSpace(OrderNo))
- {
- List<MchGroupnoEntity> listGroup= EntityHelper.GetData<MchGroupnoEntity>(
- "com.steering.mes.mcp.Mch.FrmGroupSetting.doQuery",
- new object[] { OrderNo },
- ob);
- foreach (var entity in listGroup)
- {
- if (ultraGrid1.DisplayLayout.Bands[0].Columns.Exists("GROUP" + entity.GroupNo))
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP" + entity.GroupNo].Header.Caption =
- entity.GroupMin + "-" + entity.GroupMax;
- }
- }
- }
- }
- catch (Exception ex)
- {
- if (ex.Message.ToString2() != "")
- MessageBox.Show(ex.Message);
- }
- finally
- {
- wf.Close();
- Cursor = Cursors.Default;
- }
- }
- private void chkTim_CheckedChanged(object sender, EventArgs e)
- {
- if (chkTim.Checked) { StartTime.Enabled = true; EndTime.Enabled = true; } else { StartTime.Enabled = false; EndTime.Enabled = false; }
- if (chkJugeHeatNo.Checked) { txtJugeNo.Enabled = true; } else { txtJugeNo.Enabled = false; }
- if (chkLotNo.Checked) { txtLotNo.Enabled = true; } else { txtLotNo.Enabled = false; }
- if (chkOrder.Checked) { txtOrder.Enabled = true; }
- else
- {
- txtOrder.Enabled = false;
- }
- }
- /// <summary>
- /// 数据验证
- /// </summary>
- /// <returns></returns>
- private bool CheckQuery()
- {
- if (DataTimeUtil.JudgeTime(DateTime.Parse(StartTime.Value.ToString()), DateTime.Parse(EndTime.Value.ToString())) == 0)
- {
- MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
- return false;
- }
- if (this.chkJugeHeatNo.Checked && string.IsNullOrEmpty(this.txtJugeNo.Text.Trim()))
- {
- MessageUtil.ShowWarning("请输入炉号!");
- return false;
- }
- if (this.chkLotNo.Checked && string.IsNullOrEmpty(this.txtLotNo.Text.Trim()))
- {
- MessageUtil.ShowWarning("请输入批号!");
- return false;
- }
- if (this.chkOrder.Checked && string.IsNullOrEmpty(this.txtOrder.Text.Trim()))
- {
- MessageUtil.ShowWarning("请输入合同号!");
- return false;
- }
- return true;
- }
- private void txt_PlinCode_TextChanged(object sender, EventArgs e)
- {
- plineCode = txt_PlinCode.SelectedItem.DataValue.ToString();
- }
- private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
- {
- if (int.Parse(e.Row.Cells["FLAG1"].Value.ToString3()) > 0)
- {
- e.Row.Appearance.BackColor = lbColor1.BackColor;
- }
- else if (int.Parse(e.Row.Cells["FLAG"].Value.ToString3()) > 0)
- {
- e.Row.Appearance.BackColor = lbColor2.BackColor;
- }
- if (int.Parse(e.Row.Cells["GROUP001"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP001"].Hidden = false;
- }
- if (int.Parse(e.Row.Cells["GROUP002"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP002"].Hidden = false;
- }
- if (int.Parse(e.Row.Cells["GROUP003"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP003"].Hidden = false;
- }
- if (int.Parse(e.Row.Cells["GROUP004"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP004"].Hidden = false;
- }
- if (int.Parse(e.Row.Cells["GROUP005"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP005"].Hidden = false;
- }
- if (int.Parse(e.Row.Cells["GROUP006"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP001"].Hidden = false;
- }
- if (int.Parse(e.Row.Cells["GROUP006"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP006"].Hidden = false;
- }
- if (int.Parse(e.Row.Cells["GROUP007"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP007"].Hidden = false;
- }
- if (int.Parse(e.Row.Cells["GROUP008"].Value.ToString3()) > 0)
- {
- ultraGrid1.DisplayLayout.Bands[0].Groups["GROUP"].Hidden = false;
- ultraGrid1.DisplayLayout.Bands[0].Columns["GROUP008"].Hidden = false;
- }
- }
- }
- }
|