using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.YdmBcPipeManage.Entity; 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.YdmBcPipeManage { public partial class FrmSupervisonInfo : FrmBase { public FrmSupervisonInfo() { InitializeComponent(); } private void FrmSupervisonInfo_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); this.txtPline.Enabled = false; this.txtUser.Enabled = false; initPline(); } /// /// 加载产线信息 /// private void initPline() { DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryPline", new object[] { }, this.ob); if (dt.Rows.Count > 0) { txtPline.DataSource = dt; txtPline.DisplayMember = "PLINE_NAME"; txtPline.ValueMember = "PLINE_CODE"; } } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "Add": doAdd(); break; case"Delete": doDelete(); break; case "Close": close(); break; } } /// /// 查询 /// private void doQuery() { string plineCode = ""; string txtUser = ""; if (utrPlineChk.Checked && this.txtPline.Text != "") { plineCode = this.txtPline.Value.ToString2(); } if (userChk.Checked && this.txtUser.Text != "") { txtUser = this.txtUser.Text.Trim().ToString(); } ArrayList ayyList = new ArrayList(); ayyList.Add(plineCode); ayyList.Add(txtUser); List listSource = EntityHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQuery", new object[] { ayyList }, ob); YdmBcSupervisorEntitybindingSource.DataSource = listSource; } /// /// 新增 /// private void doAdd() { if(this.texPlineBom.Text == "") { MessageUtil.ShowTips("请选择产线信息!"); return; } if (this.ultraTextEditor2.Text == "") { MessageUtil.ShowTips("请选择仓库信息!"); return; } if(this.txtUserBom.Text == "") { MessageUtil.ShowTips("请填入监装人信息!"); return; } if(this.txtGroupBom.Text == "") { MessageUtil.ShowTips("请选择班组信息!"); return; } YdmBcSupervisorEntity ydmBcEntity = new YdmBcSupervisorEntity(); ydmBcEntity.SupervisorName = this.txtUserBom.Text; ydmBcEntity.PlineCode = this.texPlineBom.Tag.ToString2(); ydmBcEntity.PlineName = this.texPlineBom.Text; ydmBcEntity.SupervisorCall = this.txtCall.Text; ydmBcEntity.ColGroup = this.txtGroupBom.Value.ToString2(); ydmBcEntity.Memo = this.memoBom.Text; ydmBcEntity.CreateName = this.UserInfo.GetUserName(); ydmBcEntity.StorageNo = this.ultraTextEditor2.Tag.ToString2(); ydmBcEntity.StorageName = this.ultraTextEditor2.Text.ToString2(); string ydmBcSuerEntity = JSONFormat.Format(ydmBcEntity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.ydm.bc.FrmSupervisonInfo"; ccp.MethodName = "doAdd"; ccp.ServerParams = new object[] { ydmBcSuerEntity }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("新增成功!")) { doQuery(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } /// /// 删除数据 /// private void doDelete() { this.ultraGrid1.UpdateData(); UltraGridRow row = this.ultraGrid1.ActiveRow; if (row == null) return; YdmBcSupervisorEntity ydmEntity = (YdmBcSupervisorEntity)row.ListObject; string ydmBcEntity = JSONFormat.Format(ydmEntity); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.ydm.bc.FrmSupervisonInfo"; ccp.MethodName = "doDelete"; ccp.ServerParams = new object[] { ydmBcEntity }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("删除成功!")) { doQuery(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void close() { this.Close(); } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow row = this.ultraGrid1.ActiveRow; this.texPlineBom.Tag = row.Cells["PlineCode"].Text; this.texPlineBom.Text = row.Cells["PlineName"].Text; this.txtUserBom.Text = row.Cells["SupervisorName"].Text; this.txtCall.Text = row.Cells["SupervisorCall"].Text; this.txtGroupBom.Text = row.Cells["ColGroup"].Text; this.memoBom.Text = row.Cells["Memo"].Text; this.ultraTextEditor2.Tag = row.Cells["StorageNo"].Text; } private void utrPlineChk_CheckedChanged(object sender, EventArgs e) { this.txtPline.Enabled = this.utrPlineChk.Checked; } private void userChk_CheckedChanged(object sender, EventArgs e) { this.txtUser.Enabled = this.userChk.Checked; } private void texPlineBom_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryPline", new object[] { }, ob); dt.Columns["PLINE_NAME"].Caption = "产线"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "PLINE_NAME", "PLINE_CODE"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("PLINE_CODE") == this.texPlineBom.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { texPlineBom.Tag = baseInfo.ChoicedRow.GetValue("PLINE_CODE"); texPlineBom.Text = baseInfo.ChoicedRow.GetValue("PLINE_NAME"); } } private void ultraTextEditor2_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryStorageNo", new object[] { }, ob); dt.Columns["STORAGE_NAME"].Caption = "仓库"; BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "STORAGE_NAME", "STORAGE_NO"); baseInfo.Shown += new EventHandler((a, b) => { var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where( c => c.GetValue("STORAGE_NO") == this.ultraTextEditor2.Tag.ToString2()).FirstOrDefault(); if (actRow != null) actRow.Activate(); }); if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ultraTextEditor2.Tag = baseInfo.ChoicedRow.GetValue("STORAGE_NO"); ultraTextEditor2.Text = baseInfo.ChoicedRow.GetValue("STORAGE_NAME"); } } } }