| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Qcm.Control;
- using Core.StlMes.Client.Qcm.model;
- using CoreFS.CA06;
- using System;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm
- {
- public partial class ComBaseSplineFrm : FrmBase
- {
- private ComBaseSplineCtrl _splineCtrl;
- private ComBaseSplineCCtrl _splineCCtrl;
- public ComBaseSplineFrm()
- {
- InitializeComponent();
- }
- private string flag = "";
- public ComBaseSplineFrm(OpeBase ob, string phyNameMin, string flag)
- : this()
- {
- this.ob = ob;
- this.flag = flag;
- ultraToolbarsManager1.Visible = true;
- labelTextBox1.Checked = true;
- labelTextBox1.Text = phyNameMin;
- }
- private void ComBaseSplineFrm_Load(object sender, EventArgs e)
- {
- _splineCtrl = new ComBaseSplineCtrl(ultraGroupBox1, ob);
- _splineCtrl.BringToFront();
- GridHelper.HidenColumns(_splineCtrl.UltraGrid1.DisplayLayout.Bands[0], "Chk2", "Chk3");
- _splineCtrl.UltraGrid1.AfterRowActivate += _splineCtrl_AfterRowActivate;
- _splineCCtrl = new ComBaseSplineCCtrl(ultraGroupBox2, ob);
- _splineCCtrl.UltraGrid1.BeforeRowInsert += _splineCCtrl_BeforeRowInsert;
- _splineCCtrl.UltraGrid1.AfterRowInsert += _splineCCtrl_AfterRowInsert;
- _splineCCtrl.BringToFront();
- LoadData();
- if (flag != "")
- {
- Query();
- }
- }
- private void LoadData()
- {
- ClsBaseInfo.FillComBaseInfo(labelComboBox1.ComboBox, "4081", ob, true);
- }
- void _splineCCtrl_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs e)
- {
- if (_splineCtrl.UltraGrid1.ActiveRow == null)
- {
- e.Cancel = true;
- return;
- }
- ComBaseSplineEntity splineEntity = (ComBaseSplineEntity)_splineCtrl.UltraGrid1.ActiveRow.ListObject;
- if (splineEntity.Validflag == "")
- {
- e.Cancel = true;
- return;
- }
- }
- void _splineCCtrl_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)
- {
- ComBaseSplineEntity splineEntity = (ComBaseSplineEntity)_splineCtrl.UltraGrid1.ActiveRow.ListObject;
- ComBaseSplineCEntity splineCEntity = (ComBaseSplineCEntity)e.Row.ListObject;
- splineCEntity.Eic = splineEntity.Eic;
- splineCEntity.PhyCodeMin = splineEntity.PhyCodeMin;
- splineCEntity.PhyNameMin = splineEntity.PhyNameMin;
- }
- void _splineCtrl_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- ComBaseSplineEntity splineEntity = (ComBaseSplineEntity)_splineCtrl.UltraGrid1.ActiveRow.ListObject;
- string validflag = labelCheckBox1.Checked ? "0" : "1";
- _splineCCtrl.Query(splineEntity.Eic, validflag);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query":
- Query();
- break;
- case "Save":
- Save();
- break;
- case "Delete":
- Delete();
- break;
- case "Resume":
- Resume();
- break;
- case "CopyStd":
- CopyStd();
- break;
- case "Export":
- Export();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void CopyStd()
- {
- ComBaseSplineCopyStdFrm copyStdFrm = new ComBaseSplineCopyStdFrm(ob);
- string oldStdName = "";
- string oldStdCode = "";
- string newStdName = "";
- string newStdCode = "";
- if (copyStdFrm.ShowDialog() == DialogResult.OK)
- {
- oldStdName = copyStdFrm.OldStdName;
- oldStdCode = copyStdFrm.OldStdCode;
- newStdName = copyStdFrm.NewStdName;
- newStdCode = copyStdFrm.NewStdCode;
- }
- else
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.qcm.DAL.ComBaseSplineCDAL.CopyStd", new object[] { oldStdCode, newStdCode, newStdName }, ob);
- MessageUtil.ShowTips("保存成功");
- }
- private void Export()
- {
- GridHelper.ulGridToExcel(_splineCtrl.UltraGrid1, "试样码主信息");
- }
- private void Query()
- {
- try
- {
- this.Cursor = Cursors.WaitCursor;
- string phyNameMin = labelTextBox1.Checked ? labelTextBox1.Text.Trim() : "";
- string sampleStyle = labelComboBox1.Checked ? labelComboBox1.SelecteValue.ToString2() : "";
- string validflag = labelCheckBox1.Checked ? "0" : "1";
- string seamArea = labelComboBox2.Checked ? labelComboBox2.SelecteValue.ToString2() : "";
- _splineCCtrl.Clear();
- _splineCtrl.Query(phyNameMin, sampleStyle, validflag, seamArea);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- private void Save()
- {
- int chkCnt = _splineCtrl.UltraGrid1.Rows.AsQueryable().Where(a => a.GetValue("Chk") == "True").Count() +
- _splineCCtrl.UltraGrid1.Rows.AsQueryable().Where(a => a.GetValue("Chk") == "True").Count();
- if (chkCnt == 0)
- {
- MessageUtil.ShowWarning("请选择记录保存!");
- return;
- }
- var splineCEntitys = _splineCCtrl.GetSaveParms();
- if (splineCEntitys == null) return;
- bool result = _splineCtrl.Save(splineCEntitys);
- if (result)
- {
- MessageUtil.ShowTips("保存成功!");
- _splineCtrl_AfterRowActivate(null, null);
- }
- }
- private void Delete()
- {
- int splineCnt = _splineCtrl.UltraGrid1.Rows.AsQueryable().Where(a => a.GetValue("Chk") == "True").Count();
- int spineCCnt = _splineCCtrl.UltraGrid1.Rows.AsQueryable().Where(a => a.GetValue("Chk") == "True").Count();
- if ((splineCnt + spineCCnt) == 0)
- {
- MessageUtil.ShowWarning("请选择记录!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认作废选择的记录?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- if (splineCnt > 0)
- {
- _splineCtrl.UpdateValidflag("0");
- }
- else
- {
- _splineCCtrl.UpdateValidflag("0");
- }
- MessageUtil.ShowTips("作废成功!");
- Query();
- //_splineCtrl_AfterRowActivate(null, null);
- }
- private void Resume()
- {
- int chkCnt = _splineCtrl.UltraGrid1.Rows.AsQueryable().Where(a => a.GetValue("Chk") == "True").Count() +
- _splineCCtrl.UltraGrid1.Rows.AsQueryable().Where(a => a.GetValue("Chk") == "True").Count();
- if (chkCnt == 0)
- {
- MessageUtil.ShowWarning("请选择记录!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认恢复选择的记录?") == System.Windows.Forms.DialogResult.No)
- {
- return;
- }
- _splineCtrl.UpdateValidflag("1");
- _splineCCtrl.UpdateValidflag("1");
- MessageUtil.ShowTips("恢复成功!");
- Query();
- //_splineCtrl_AfterRowActivate(null, null);
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "查询":
- Query();
- break;
- case "保存":
- Save();
- break;
- case "作废":
- Delete();
- break;
- case "恢复":
- Resume();
- break;
- case "关闭":
- this.Close();
- break;
- }
- }
- }
- }
|