| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.Common;
- using Core.StlMes.Client.ZGMil.Entity;
- using Core.StlMes.Client.ZGMil.ResultConrtrol;
- using Core.StlMes.Client.ZGMil.Signature;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- 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;
- namespace Core.StlMes.Client.ZGMil.Report
- {
- public partial class FrmBcDateWaitingDecision : FrmBase
- {
- private string departm = "";
- private string plineCode = "";
- private string Process = "";//参数
- private string[] arrId;//数据权限
- private DataTable _dtPline = null;
- public FrmBcDateWaitingDecision()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Save":
- doSave();
- break;
- case "Export":
- ExportData();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void doSave()
- {
- ultraGrid1.UpdateData();
- ArrayList parm = new ArrayList();
- IQueryable<UltraGridRow> uGrid = ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (uGrid.Count() == 0)
- {
- MessageUtil.ShowTips("请选择要保存的数据!");
- return;
- }
- foreach (UltraGridRow uRow in uGrid)
- {
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["WAITING_DECISION_MEMO"].Value.ToString());
- list.Add(uRow.Cells["IS_VISIBLE"].Value.ToString());
- if (Process.Equals("G"))
- {
- list.Add(uRow.Cells["MEMO2"].Value.ToString());
- }
- list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
- list.Add(uRow.Cells["HEAT_PLAN_NO"].Value.ToString());
- parm.Add(list);
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.saveFrmBcDateWaitingDecision", new object[] { parm, Process }, this.ob);
- MessageUtil.ShowTips("保存成功!");
- doQuery();
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- ultraGrid1.UpdateData();
- dataTable2.Clear();
- string date = "";
- string endDate = "";
- string JudgeStoveNo = "";
- string LotNo = "";
- string ContractNo = "";
- string plineCode = "";
- string VALIDFLAG = "";
- string IsVisible = "";
- string Factory = "";
- if (chkDate.Checked)
- {
- if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
- {
- MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
- return;
- }
- else
- {
- date = cmbDate.Value.ToString();
- endDate = cmbEndDate.Value.ToString();
- }
- }
- if (chkJudgeStoveNo.Checked)
- {
- if (uteJudgeStoveNo.Text.Trim() == "")
- {
- JudgeStoveNo = "";
- }
- else
- {
- JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
- }
- }
- if (chkLotNo.Checked)
- {
- if (uteLotNo.Text.Trim() == "")
- {
- LotNo = "";
- }
- else
- {
- LotNo = uteLotNo.Value.ToString();
- }
- }
- if (chkContractNo.Checked)
- {
- if (uteContractNo.Text.Trim() == "")
- {
- ContractNo = "";
- }
- else
- {
- ContractNo = uteContractNo.Value.ToString();
- }
- }
- if (chkPlineCode.Checked)
- {
- //if (this.cobPlineCode.CheckedItems.Count > 0)
- //{
- // plineCode = this.cobPlineCode.CheckedItems.Select(p => p.DataValue.ToString()).Aggregate((a, b) => a + (a == "" ? "" : "','") + b);
- //}
- plineCode = ultraTextEditor1.Tag.ToString().Replace(",","', '");
- }
- if (chkVALIDFLAG.Checked)
- {
- VALIDFLAG = cobVALIDFLAG.Value.ToString();
- }
- if (chkIsVisible.Checked)
- {
- IsVisible = cobIsVisible.Value.ToString();
- }
- if (chkFactory.Checked)
- {
- if (this.cobFactory.CheckedItems.Count > 0)
- {
- Factory = this.cobFactory.CheckedItems.Select(p => p.DataValue.ToString()).Aggregate((a, b) => a + (a == "" ? "" : "','") + b);
- }
- }
- WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
- DataTable dt = ZGServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.getFrmBcDateWaitingDecision", new Object[] { date, endDate, JudgeStoveNo, LotNo, ContractNo, plineCode, Process, VALIDFLAG, IsVisible, Factory }, this.ob);
- if (dt.Rows.Count > 0)
- {
- GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- }
- wf.Close();
- }
-
- /// <summary>
- /// 查询条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
- if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.Enabled = false; }
- if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; }
- if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
- if (chkContractNo.Checked) { uteContractNo.Enabled = true; } else { uteContractNo.Enabled = false; }
- if (chkPlineCode.Checked) { cobPlineCode.Enabled = true; } else { cobPlineCode.Enabled = false; }
- if (chkVALIDFLAG.Checked) { cobVALIDFLAG.Enabled = true; } else { cobVALIDFLAG.Enabled = false; }
- if (chkIsVisible.Checked) { cobIsVisible.Enabled = true; } else { cobIsVisible.Enabled = false; }
- if (chkFactory.Checked) { cobFactory.Enabled = true; } else { cobFactory.Enabled = false; }
- }
- private void FrmBcDateWaitingDecision_Load(object sender, EventArgs e)
- {
- cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
- NativeMethodNew na = new NativeMethodNew(this.ob);
- departm = UserInfo.GetDepartment();
- //plineCode = na.GetPCode(departm);//获取 用户 对应的产线
- arrId = this.ValidDataPurviewIds;//获取数据权限
-
- DateTime now = DateTime.Now;
- DateTime date = new DateTime(now.Year, now.Month, 1);
- cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd"));
- cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
- Process = this.CustomInfo.ToString();//参数
- _dtPline = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.JudgeBaseInfo", new object[] { Process }, ob);
- //_dtPline.AcceptChanges();
- string strPlineNames = string.Join(",", _dtPline.Rows.Cast<DataRow>().Select(a => a["plineName"].ToString()).ToArray());
- string strPineCodes = string.Join(",", _dtPline.Rows.Cast<DataRow>().Select(a => a["plineCode"].ToString()).ToArray());
- ultraTextEditor1.Text = strPlineNames;
- ultraTextEditor1.Tag = strPineCodes;
- if (Process != "G")
- {
- this.chkFactory.Visible = false;
- this.cobFactory.Visible = false;
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["is_flag"].Width = 0;
- ultraGrid1.DisplayLayout.Bands[0].Columns["XXZ"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["XXD"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["INSTOCK_TIME"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["LXZ"].Hidden = true;
- ultraGrid1.DisplayLayout.Bands[0].Columns["LXD"].Hidden = true;
- }
- //加载产线
- DataTable ds = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.doQueryPlineCode", new object[] { Process, arrId }, ob);
- if (ds != null && ds.Rows.Count > 0)
- {
- cobPlineCode.DataSource = ds;
- cobPlineCode.ValueMember = "PLINE_CODE";
- cobPlineCode.DisplayMember = "PLINE_NAME";
- }
- //加载查加工部的厂
- DataTable df = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.doQueryFactory", new object[] { }, ob);
- if (df != null && df.Rows.Count > 0)
- {
- cobFactory.DataSource = df;
- cobFactory.ValueMember = "BASECODE";
- cobFactory.DisplayMember = "BASENAME";
- }
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void ExportData()
- {
- if (Process == "E")
- {
- GridHelper.ulGridToExcel(ultraGrid1, "镦拔扩生产按炉跟踪判定情况");
- }
- if (Process == "F")
- {
- GridHelper.ulGridToExcel(ultraGrid1, "热处理生产按炉跟踪判定情况");
- }
- if (Process == "G")
- {
- GridHelper.ulGridToExcel(ultraGrid1, "加工线生产按炉跟踪判定情况");
- }
-
- }
- private void ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- ChoicePlineFrm frm = new ChoicePlineFrm(_dtPline, ultraTextEditor1.Tag.ToString2(), this.ob);
- if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- ultraTextEditor1.Text = frm.ChoicePlineName;
- ultraTextEditor1.Tag = frm.ChoicePlineCode;
- }
- }
- private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
- {
- }
- //private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- //{
- // UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- // if (uRow == null)
- // {
- // return;
- // }
- // //doQueryJudgeBath(uRow.Cells["HeatPlanNo"].Text, uRow.Cells["JudgeStoveNo"].Text, uRow.Cells["JugdeApplyCode"].Text);
-
- //// List<QcmZgJugdeApplyEntity> listSource = EntityHelper.GetData<QcmZgJugdeApplyEntity>(
- ////"com.steering.mes.zgmil.report.FrmMilDateStatistics.doQueryQcmZgApplyData", new object[] { uRow.Cells["JUDGE_STOVE_NO"].Text }, this.ob);
- // DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.report.FrmMilDateStatistics.doQueryQcmZgApplyData", new object[] { uRow.Cells["JUDGE_STOVE_NO"].Text }, ob);
- // if (dt != null && dt.Rows.Count > 0)
- // {
- // ultraGrid1.DisplayLayout.Bands[0].Columns["is_flag"].Header.Caption = "前工序是否紧急放行";
- // foreach (UltraGridRow row in this.ultraGrid1.Rows)
- // {
- // row.Cells["is_flag"].Value = "是";
- // }
- // }
- // else
- // {
- // ultraGrid1.DisplayLayout.Bands[0].Columns["is_flag"].Header.Caption = "前工序是否紧急放行";
- // foreach (UltraGridRow row in this.ultraGrid1.Rows)
- // {
- // row.Cells["is_flag"].Value = "否";
- // }
- // }
- //}
-
-
- }
- }
|