| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- using com.steering.mes.mcp.entity;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Mcp.Control.Common;
- using Core.StlMes.Client.Mcp.Control.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.Mcp.Treatment.HeatTreatment
- {
- public partial class FrmReportDefault : FrmBase
- {
- public FrmReportDefault()
- {
- InitializeComponent();
- uceMachineNo.SelectedIndex = 0;
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- string[] plineCodes = comm.InitDropPlinePower(CustomInfo, ucePlinCode, ValidDataPurviewIds, ob);
- if (plineCodes.Length <= 0)
- {
- MessageBox.Show("无数据权限");
- this.Close();
- }
- commonCrackDetection1.Init(ob,null);
- ucePlinCode.SelectedIndex = 0;
- ucReportNo.SelectedIndex = 0;
- EntityHelper.ShowGridCaption<HttReportDefaultEntity>(ugDefault.DisplayLayout.Bands[0]);
- DataTable dt1 = ServerHelper.GetData(
- "com.steering.mes.mcp.heatTreatment.FrmReportDefault.getReportColumns",
- new object[] { }, ob);
- var dt =
- ServerHelper.GetData(
- "com.steering.mes.mcp.collarMaterial.ComBaseInfo.getBaseInfo",
- new object[] { "4097" }, ob);
- if (dt != null && dt.Rows.Count > 0 && dt1!=null)
- {
- foreach (DataRow row in dt.Rows)
- {
- DataRow datarow = dt1.NewRow();
- datarow[0] = "PROBE_QTY_" + row["BASECODE"];
- datarow[1] = "[" + row["BASENAME"] + "]探头个数";
- dt1.Rows.Add(datarow);
- DataRow datarow1 = dt1.NewRow();
- datarow1[0] = "PROBE_PARAMETERS_" + row["BASECODE"];
- datarow1[1] = "[" + row["BASENAME"] + "]探头参数";
- dt1.Rows.Add(datarow1);
- }
- }
- cmbReportColumn.DataSource = dt1;
- cmbReportColumn.DisplayMember = "COMMENTS";
- cmbReportColumn.ValueMember = "COLUMN_NAME";
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- //base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "DoQuery":
- Query();
- break;
- case "DoSave":
- DoSave();
- break;
- case "DoDelete":
- DoReturn();
- break;
- case "DoUpdate":
- DoUpdate();
- break;
- case "DoClose":
- Close();
- break;
- case "Copy":
- Copy();
- break;
-
- }
- }
- private void Copy()
- {
- var matfrm = new FrmReportDefaultCopy(ob, ucePlinCode.SelectedItem.DataValue.ToString(), ucReportNo.SelectedItem.DataValue.ToString2(), uceMachineNo.SelectedItem.DataValue.ToString2());
- matfrm.ShowDialog();
- if (matfrm.DialogResult == DialogResult.OK)
- {
- Query();
- }
- }
- private void DoUpdate()
- {
- List<HttReportDefaultEntity> list = httReportDefaultEntityBindingSource.DataSource as List<HttReportDefaultEntity>;
- if (list == null || !list.Any()) return;
- list = list.Where(p => p.Chk && !p.isNew).ToList();
- if (!list.Any())
- {
- MessageBox.Show("请选择需要修改的行");
- return;
- }
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.FrmReportDefault";
- ccp.MethodName = "UpdateDefault";
- ccp.ServerParams = new object[]
- {
- list.Select(JSONFormat.Format).ToList()
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- Query();
- }
- }
- }
- private void DoReturn()
- {
- List<HttReportDefaultEntity> list = httReportDefaultEntityBindingSource.DataSource as List<HttReportDefaultEntity>;
- if (list == null || !list.Any()) return;
- list = list.Where(p => p.Chk && !p.isNew).ToList();
- if (!list.Any())
- {
- MessageBox.Show("请选择需要删除的行");
- return;
- }
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.FrmReportDefault";
- ccp.MethodName = "DeleteDefault";
- ccp.ServerParams = new object[]
- {
- list.Select(JSONFormat.Format).ToList()
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("删除成功!"))
- {
- Query();
- }
- }
- }
- private void DoSave()
- {
- List<HttReportDefaultEntity> list = httReportDefaultEntityBindingSource.DataSource as List<HttReportDefaultEntity>;
- if (list == null || !list.Any()) return;
- list = list.Where(p => p.Chk && p.isNew).ToList();
- if (!list.Any())
- {
- MessageBox.Show("请选择需要新增的行");
- return;
- }
- var ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.FrmReportDefault";
- ccp.MethodName = "AddDefault";
- ccp.ServerParams = new object[]
- {
- list.Select(JSONFormat.Format).ToList()
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("新增成功!"))
- {
- Query();
- }
- }
-
- }
- private void Query()
- {
- List<HttReportDefaultEntity> list = EntityHelper.GetData<HttReportDefaultEntity>(
- "com.steering.mes.mcp.heatTreatment.FrmReportDefault.Query",
- new object[] { ucePlinCode.SelectedItem.DataValue.ToString(), ucReportNo.SelectedItem.DataValue.ToString2(), uceMachineNo.SelectedItem.DataValue.ToString2()}, ob);
- httReportDefaultEntityBindingSource.DataSource = list;
- commonCrackDetection1.SettingModeValue(list, ucePlinCode.SelectedItem.DataValue.ToString());
- commHelper.RefreshAndAutoSize(ugDefault);
- }
- private void ugDefault_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- try
- {
- ugDefault.UpdateData();
- HttReportDefaultEntity HttReportDefaultEntity = e.Cell.Row.ListObject as HttReportDefaultEntity;
- commonCrackDetection1.SetValue(HttReportDefaultEntity.ReportNo, HttReportDefaultEntity,e.Cell.Column.Key);
- if (e.Cell.Column.Key != "Chk")
- HttReportDefaultEntity.Chk = true;
- }
- catch (Exception)
- {
- }
- }
-
- private void utProbe_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- TextEdit TextEdit = new TextEdit() {data = ugDefault.ActiveCell.Text};
- TextEdit.ShowDialog();
- if (TextEdit.DialogResult == DialogResult.OK)
- {
- ugDefault.ActiveCell.Value = TextEdit.data;
- ugDefault_CellChange(null, new CellEventArgs(ugDefault.ActiveCell));
- }
- }
- private void egbView_ExpandedStateChanged(object sender, EventArgs e)
- {
-
- }
- private void utUsed_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- HttReportDefaultEntity HttReportDefaultEntity = ugDefault.ActiveRow.ListObject as HttReportDefaultEntity;
- if(HttReportDefaultEntity==null) return;
- SelectEdit SelectEdit = new SelectEdit(ob,
- HttReportDefaultEntity.ReportColumn == "PROBE_NAME" ||
- HttReportDefaultEntity.ReportColumn == "STANDARD_NAME",
- HttReportDefaultEntity.ReportColumn == "PROBE_NAME"?"4097": HttReportDefaultEntity.ReportColumn == "STANDARD_NAME"? "4021":HttReportDefaultEntity.DroplistDefult, HttReportDefaultEntity.DroplistUsed.Split(';').ToList());
- SelectEdit.ShowDialog();
- if (SelectEdit.DialogResult == DialogResult.OK)
- {
- ugDefault.ActiveCell.Value = SelectEdit.Codes;
- ugDefault_CellChange(null, new CellEventArgs(ugDefault.ActiveCell));
- }
- }
- private void ugDefault_AfterRowInsert(object sender, RowEventArgs e)
- {
- e.Row.Cells["isNew"].Value = true;
- e.Row.Appearance.BackColor = Color.LightGreen;
- e.Row.Cells["PlineCode"].Value = ucePlinCode.SelectedItem.DataValue;
- e.Row.Cells["ReportNo"].Value = ucReportNo.SelectedItem.DataValue.ToString2();
- e.Row.Cells["ReportNo"].Activation = Activation.AllowEdit;
- e.Row.Cells["ReportNo"].IgnoreRowColActivation = true;
- e.Row.Cells["ReportColumn"].Activation = Activation.AllowEdit;
- e.Row.Cells["ReportColumn"].IgnoreRowColActivation = true;
- e.Row.Cells["MachineNo"].Value = uceMachineNo.SelectedItem.DataValue.ToString();
- }
- }
- }
|