using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.PnCost.Models; using CoreFS.CA06; 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.PnCost { public partial class frmBasePl : FrmBase { #region 定义变量 public frmBasePl() { InitializeComponent(); } private DataTable dtgang; #endregion #region 方法 public override void ToolBar_Click(object sender, string ToolbarKey) { base.ToolBar_Click(sender, ToolbarKey); switch (ToolbarKey) { case "doSing": doSing(); break; case "doSave": doSave(); break; case "Close": this.Close(); break; } } /// /// 配料 /// private void doSing() { this.ucHj1.setHj(this.ucCf1.TqnqD01Entity()); } /// /// 保存 /// private void doSave() { try { TqnqD01Entity cfentity = ucCf1.TqnqD01Entity(); TqnqD01Entity hjentity = ucHj1.TqnqD01Entity(); if (hjentity.OutFeigang.Equals("") || hjentity.OutFeigang == null) return; if (hjentity.OutTieshui.Equals("") || hjentity.OutTieshui == null) return; hjentity.RecCreator = this.UserInfo.GetUserName().ToString(); ArrayList parm = new ArrayList(); parm.Add(JSONFormat.Format(cfentity)); parm.Add(JSONFormat.Format(hjentity)); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.cost.FrmTqnqd01"; ccp.MethodName = "doSave"; ccp.ServerParams = new object[] { parm }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { MessageUtil.ShowTips("操作成功"); } } catch { return; } } /// 查询方法 /// /// 查询方法 /// private void Query() { //#region 条件验证 ////钢种 //string strPei = ""; //if (ultraCheckEditor3.Checked)//钢种是否选择 //{ // if (ultraTextEditor1.Text == "")//钢种是否输入 // { // MessageUtil.ShowWarning("请输入钢种!"); // return; // } // else // { // strPei = ultraTextEditor1.Text.Trim();//钢种 // } //} //#endregion //List data = EntityHelper.GetData( // "com.steering.pss.pncost.base.ComBaseGrade.query", new object[] { strPei }, ob); //comBaseGradeEntityBindingSource.DataSource = data; //for (int i = 0; i < ultraGrid1.Rows.Count; i++) //{ // ultraGrid1.Rows[i].Cells["xuanze"].Value = false; // ultraGrid1.Rows[i].Cells["BATCHINGCODE"].Appearance.BackColor = Color.LightGoldenrodYellow; //} //ultraGrid1.UpdateData(); } /// 保存方法 /// /// 保存方法 /// private void Save() { //string stringnew = ""; //string xuanze = "false"; //try //{ // #region 验证信息 // ultraGrid1.UpdateData(); // for (int i = 0; i < ultraGrid1.Rows.Count; i++) // { // if (ultraGrid1.Rows[i].Cells["xuanze"].Value.ToString() == "True") // { // xuanze = "true"; // break; // } // } // if (xuanze == "false") // { // MessageUtil.ShowWarning("请选择你要保存的记录!"); // return; // } // if (MessageUtil.ShowYesNoAndQuestion("是否确认保存?") == System.Windows.Forms.DialogResult.No) // { // return; // } // #endregion // for (int i = 0; i < ultraGrid1.Rows.Count; i++) // { // if (ultraGrid1.Rows[i].Cells["xuanze"].Value.ToString() == "True") // { // stringnew = ultraGrid1.ActiveRow.Cells["GRADECODE"].Value.ToString2(); // ComBaseGradeEntity parm = new ComBaseGradeEntity(); // parm.Gradecode = ultraGrid1.Rows[i].Cells["GRADECODE"].Value.ToString(); // parm.Gradename = ultraGrid1.Rows[i].Cells["GRADENAME"].Value.ToString(); // parm.BatchingCode = ultraGrid1.Rows[i].Cells["BATCHINGCODE"].Value.ToString(); // string JsonStr = JSONFormat.Format(parm); // ServerHelper.SetData("com.steering.pss.pncost.base.ComBaseGrade.save", new object[] { JsonStr }, ob); // } // } //} //catch (Exception ex) //{ // MessageUtil.ShowError("保存失败!'" + ex.Message + "'"); // return; //} //MessageUtil.ShowTips("保存成功!"); //Query(); //for (int i = 0; i < ultraGrid1.Rows.Count; i++) //{ // if (ultraGrid1.Rows[i].Cells["GRADECODE"].Value.ToString() == stringnew) // { // ultraGrid1.Rows[i].Activate(); // } //} } #endregion #region 事件 /// 钢种选择事件 /// /// 钢种选择事件 /// private void ultraCheckEditor3_CheckedChanged(object sender, EventArgs e) { // ultraTextEditor1.Enabled = this.ultraCheckEditor3.Checked; } private void ultraGrid1_CellChange(object sender, CellEventArgs e) { // ultraGrid1.UpdateData(); } #endregion private void frmBasePl_Load(object sender, EventArgs e) { ucCf1.SetBase(this.ob); ucHj1.SetBase(this.ob); } } }