| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Qcm.BLL;
- using Core.StlMes.Client.Qcm.model;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Qcm.Control
- {
- public partial class ComMscRJgCtrl : UserControl
- {
- private ComMscRJgBLL _mscRJgBLL;
- public ComMscRJgCtrl(OpeBase ob, System.Windows.Forms.Control container)
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<ComMscRJgEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- _mscRJgBLL = new ComMscRJgBLL(ob);
- container.Controls.Add(this);
- this.Dock = DockStyle.Fill;
- }
- public void GetMscRJgBySpec(string ordLnPk, bool isCraft)
- {
- List<ComMscRJgEntity> listSource = _mscRJgBLL.GetMscRJgBySpec(ordLnPk);
- comMscRJgEntityBindingSource.DataSource = listSource;
- SlmOrdDesignMscJgEntity designMscJg = _mscRJgBLL.GetKeyJgByOrdLnPk(ordLnPk, isCraft);
- if (designMscJg != null)
- {
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.GetValue("KeyJg") == designMscJg.KeyJg)
- {
- row.Cells["CHK"].Value = true;
- }
- }
- }
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- ultraGrid1.UpdateData();
- }
- public void InsertDesignMscRJg(string ordLnPk, bool isCraft)
- {
- ultraGrid1.UpdateData();
- if (MessageUtil.ShowYesNoAndQuestion("是否确认设定接箍?") == DialogResult.No)
- {
- return;
- }
- List<SlmOrdDesignMscJgEntity> parms = new List<SlmOrdDesignMscJgEntity>();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- SlmOrdDesignMscJgEntity parm = EntityHelper.CopyEntity<SlmOrdDesignMscJgEntity>(row.ListObject);
- if (row.GetValue("CHK").ToString() == "True")
- {
- parm.SetJg = "1";
- }
- else
- {
- parm.SetJg = "0";
- }
- parms.Add(parm);
- }
- _mscRJgBLL.InsertDesignMscRJg(parms, ordLnPk, isCraft);
- MessageUtil.ShowTips("设定接箍成功!");
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid1.UpdateData();
- if (e.Cell.Column.Key == "CHK")
- {
- if (e.Cell.Value.ToString() == "True")
- {
- IQueryable<UltraGridRow> rows = ultraGrid1.Rows.AsQueryable().Where(
- a => a.GetValue("KeyJg") != e.Cell.Row.GetValue("KeyJg") &&
- a.GetValue("CHK") == "True");
- if (rows.Count() > 0)
- {
- rows.First().Cells["CHK"].Value = false;
- }
- }
- }
- ultraGrid1.UpdateData();
- }
- }
- }
|