| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Data;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class FrmProductPlane : FrmBase
- {
- public FrmProductPlane()
- {
- InitializeComponent();
- }
- int isselect = 0;
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- DoQuery();
- break;
- case "Save":
- DoSave();
- break;
- case "doClose":
- this.Close();
- break;
- }
- }
- private void SetGridNoEdit(UltraGrid ug)
- {
- ug.UpdateData();
- foreach (UltraGridRow row in ug.Rows)
- {
- for (int i = 0; i < row.Cells.Count; i++)
- {
- if (!row.Cells[i].Column.Key.Equals("CHK") && !row.Cells[i].Column.Key.Equals("MEMO"))
- row.Cells[i].Activation = Activation.ActivateOnly;
- else
- row.Cells[i].Activation = Activation.AllowEdit;
- }
- }
- }
- private void FrmProductPlane_Load_1(object sender, EventArgs e)
- {
- DoQuery();
- }
- private void DoQuery()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreProductionPlane.doQuery", null, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
- isselect = 0;
- }
- private void GetPlineStation(string plinecode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreProductionPlane.getPlineStation", new Object[] { plinecode }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
- //SetGridNoEdit(ultraGrid1);
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGrid2.ActiveRow;
- if (ugr == null)
- return;
- string plinecode = ugr.Cells["PLINE_CODE"].Value.ToString();
- GetPlineStation(plinecode);
- }
- private void DoSave()
- {
- ultraGrid1.UpdateData();
- ultraGrid2.UpdateData();
- if (isselect == 0)
- {
- MessageBox.Show("您没有做任何的修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (MessageBox.Show("是否确认保存修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- UltraGridRow ugr1 = this.ultraGrid2.ActiveRow;
- if (ugr1 == null) return;
- ArrayList list = new ArrayList();
- string plinecode = ugr1.Cells["PLINE_CODE"].Value.ToString();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- ArrayList parm = new ArrayList();
- parm.Add(plinecode);
- parm.Add(ugr1.Cells["PLINE_NAME"].Value.ToString());
- parm.Add(row.Cells["STATION_CODE"].Value.ToString());
- parm.Add(row.Cells["STATION_DESC"].Value.ToString());
- parm.Add(row.Cells["STATION_ID"].Value.ToString());
- parm.Add(this.UserInfo.GetUserName());
- parm.Add(row.Cells["MEMO"].Value.ToString());
- list.Add(parm);
- }
- }
- int count = ServerHelper.SetData("com.steering.pss.qcm.CoreProductionPlane.doSave", new Object[] { list, plinecode }, this.ob);
- if (count > 0)
- {
- MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- DoQuery();
- foreach (UltraGridRow ugr in ultraGrid2.Rows)
- {
- if (ugr.Cells["PLINE_CODE"].Value.ToString().Equals(plinecode))
- {
- ugr.Activate();
- break;
- }
- }
- }
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Column.Key.Equals("CHK"))
- isselect += 1;
- ultraGrid1.UpdateData();
- }
- }
- }
|