| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.Lims.Data.PipeAndOutdec.封装类.实体类;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- 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.Lims.Data.PipeAndOutdec
- {
- public partial class FrmTpopi25 : FrmBase
- {
- public FrmTpopi25()
- {
- InitializeComponent();
- EntityHelper.ShowGridCaption<Tpopi26Entity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<Tpopi25Entity>(ultraGrid2.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<Tpopi26Entity>(ultraGrid3.DisplayLayout.Bands[0]);
- }
- /// <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 "Add":
- doSave("ADD");
- break;
- case "Update":
- doSave("Update");
- break;
- case "Delete":
- doDelete();
- break;
- //case "Recover":
- // doNullifyOrRecover("0");
- // break;
- //case "StdCopy":
- // StdCopy();
- // break;
- case "Close":
- if (MessageUtil.ShowYesNoAndQuestion("是否确认关闭页面?") == DialogResult.Yes)
- {
- this.Close();
- }
- break;
- }
- }
- private void doQuery()
- {
- try
- {
- List<Tpopi26Entity> listSource = EntityHelper.GetData<Tpopi26Entity>(
- "com.steering.lims.data.pipe.Tpopi26.doQuery", new object[] { text_code.Text, "", "", text_name.Text }, this.ob);
- Tpopi26bindingSource.DataSource = listSource;
- //Tpopi26bindingSourceDetails.DataSource = listSource;
- //for (int i = 0; i < ultraGrid1.Rows.Count; i++)
- //{
- // UltraGridRow row = ultraGrid1.Rows[i];
- //}
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "提示");
- }
- }
- private void doQueryDetail()
- {
- var ugr = ultraGrid2.ActiveRow;
- if (ugr != null) ugr.RowSelectorAppearance.Reset();
- string InspectStandCode = ugr.Cells["InspectStandCode"].Value.ToString();
- List<Tpopi25Entity> listSource25 = EntityHelper.GetData<Tpopi25Entity>(
- "com.steering.lims.data.pipe.Tpopi25.doQuery", new object[] { InspectStandCode }, this.ob);
- Tpopi25bindingSource.DataSource = listSource25;
- }
- private void doSave(string ToolbarKey)
- {
- try
- {
- if (ultraGrid2.Rows.Count == 0)
- return;
- if (ultraGrid2.ActiveRow == null)
- {
- MessageBox.Show("请选择要修改的使用记录!", "提示");
- return;
- }
- if (text_itemName.Text == null || text_itemName.Text.Equals(""))
- {
- MessageUtil.ShowTips("物料名称不能为空!");
- return;
- }
- if (text_itemCode.Text == null || text_itemCode.Text.Equals(""))
- {
- MessageUtil.ShowTips("物料代码不能为空!");
- return;
- }
- if (text_itemUom.Text == null || text_itemUom.Text.Equals(""))
- {
- MessageUtil.ShowTips("采购物料单位不能为空!");
- return;
- }
- if (text_leafCode.Text == null || text_leafCode.Text.Equals(""))
- {
- MessageUtil.ShowTips("采购叶类代码不能为空!");
- return;
- }
- if (text_inspectStandCode.Text == null || text_inspectStandCode.Text.Equals(""))
- {
- MessageUtil.ShowTips("质检标准号不能为空!");
- return;
- }
-
- Tpopi25Entity entity = new Tpopi25Entity();
- entity.ItemName = text_itemName.Text;
- entity.ItemId = text_itemCode.Text;
- entity.ItemUom = text_itemUom.Text;
- entity.LeafCode = text_leafCode.Text;
- entity.InspectStandCode = text_inspectStandCode.Text;
- entity.ItemDesc = text_itemDesc.Text;
- entity.UnitWeight = text_unitWeight.Text;
- entity.Class1 = text_calss1.Text;
- entity.Class2 = text_calss2.Text;
- entity.Class3 = text_calss3.Text;
- entity.RecCreator = UserInfo.GetUserName();
- entity.RecRevisor = UserInfo.GetUserName();
- entity.CompanyCode = Convert.ToString(ultraGrid2.ActiveRow.Cells["CompanyCode"].Value);
- entity.SeqNo = Convert.ToString(ultraGrid2.ActiveRow.Cells["SeqNo"].Value);
- string baseEntity = JSONFormat.Format(entity);
- if (ToolbarKey.Equals("ADD"))
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi25";
- ccp.MethodName = "doAdd";
- ccp.ServerParams = new object[] { new ArrayList { baseEntity } };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQueryDetail();
- MessageUtil.ShowTips("新增成功!");
- }
- }
- if (ToolbarKey.Equals("Update"))
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi25";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { new ArrayList { baseEntity } };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQueryDetail();
- MessageUtil.ShowTips("保存成功!");
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "提示");
- }
- }
- private void doUpdate()
- {
- try
- {
- this.ultraGrid1.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要修改的信息!");
- return;
- }
- ArrayList parmList = new ArrayList();
- foreach (UltraGridRow row in checkMagRows)
- {
- Tpopi26Entity entity = row.ListObject as Tpopi26Entity;
- if (String.IsNullOrEmpty(entity.InspectStandCode) || String.IsNullOrEmpty(entity.JdeLevel) || String.IsNullOrEmpty(entity.ElmCode))
- continue;
- //entity.RecRevisor = UserInfo.GetUserName();
- string baseEntity = JSONFormat.Format(entity);
- parmList.Add(baseEntity);
- }
- if (parmList.Count > 0)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi26";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { parmList };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQuery();
- MessageUtil.ShowTips("修改成功!");
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "提示");
- }
- }
- private void doDelete()
- {
- try
- {
- if (ultraGrid2.Rows.Count == 0)
- return;
- if (ultraGrid2.ActiveRow == null)
- {
- MessageBox.Show("请选择要删除的使用记录!", "提示");
- return;
- }
- ArrayList parmList = new ArrayList();
- Tpopi25Entity entity = new Tpopi25Entity();
- entity.CompanyCode = Convert.ToString(ultraGrid2.ActiveRow.Cells["CompanyCode"].Value);
- entity.SeqNo = Convert.ToString(ultraGrid2.ActiveRow.Cells["SeqNo"].Value);
- entity.ItemId = Convert.ToString(ultraGrid2.ActiveRow.Cells["ItemId"].Value);
- string baseEntity = JSONFormat.Format(entity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.lims.data.pipe.Tpopi25";
- ccp.MethodName = "doDelete";
- ccp.ServerParams = new object[] { new ArrayList { baseEntity } };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- doQueryDetail();
- MessageUtil.ShowTips("删除成功!");
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "提示");
- }
-
- }
- private void FrmTpopi24_Load(object sender, EventArgs e)
- {
- doQuery();
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- var ugr = ultraGrid1.ActiveRow;
- if (ugr != null) ugr.RowSelectorAppearance.Reset();
- string InspectStandCode = ugr.Cells["InspectStandCode"].Value.ToString();
- string JdeLevel = ugr.Cells["JdeLevel"].Value.ToString();
- string ElmCode = ugr.Cells["ElmCode"].Value.ToString();
- if (!String.IsNullOrEmpty(InspectStandCode))
- {
- if (!String.IsNullOrEmpty(JdeLevel) && !String.IsNullOrEmpty(ElmCode))
- {
- List<Tpopi26Entity> listSource = EntityHelper.GetData<Tpopi26Entity>(
- "com.steering.lims.data.pipe.Tpopi26.doQuery", new object[] { InspectStandCode, JdeLevel, ElmCode,"" }, this.ob);
- Tpopi26bindingSourceDetails.DataSource = listSource;
- }
- List<Tpopi25Entity> listSource25 = EntityHelper.GetData<Tpopi25Entity>(
- "com.steering.lims.data.pipe.Tpopi25.doQuery", new object[] { InspectStandCode }, this.ob);
- Tpopi25bindingSource.DataSource = listSource25;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "提示");
- }
- }
- private void text_unitWeight_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == '.' && this.text_unitWeight.Text.IndexOf(".") != -1)
- {
- e.Handled = true;
- }
- if (!((e.KeyChar >= 48 && e.KeyChar <= 57) || e.KeyChar == '.' || e.KeyChar == 8))
- {
- e.Handled = true;
- }
- }
- private void ultraGrid2_DoubleClick(object sender, EventArgs e)
- {
-
- }
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- try
- {
- if (ultraGrid2.ActiveRow == null)
- return;
- Infragistics.Win.UltraWinGrid.UltraGridRow ulRow = ultraGrid2.ActiveRow;
- text_itemName.Text = Convert.ToString(ulRow.Cells["ItemName"].Value);
- text_itemCode.Text = Convert.ToString(ulRow.Cells["ItemID"].Value);
- text_itemDesc.Text = Convert.ToString(ulRow.Cells["ItemDesc"].Value);
- text_itemUom.Text = Convert.ToString(ulRow.Cells["ItemUom"].Value);
- text_unitWeight.Text = Convert.ToString(ulRow.Cells["UnitWeight"].Value);
- text_leafCode.Text = Convert.ToString(ulRow.Cells["LeafCode"].Value);
- text_calss1.Text = Convert.ToString(ulRow.Cells["Class1"].Value);
- text_calss2.Text = Convert.ToString(ulRow.Cells["Class2"].Value);
- text_calss3.Text = Convert.ToString(ulRow.Cells["Class3"].Value);
- text_inspectStandCode.Text = Convert.ToString(ulRow.Cells["InspectStandCode"].Value);
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "提示");
- }
- }
- }
- }
|