using com.steering.mes.mcp.entity; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Core.StlMes.Client.Mcp.Control; using Core.StlMes.Client.Mcp.Report; 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.Mcp.CollarLibrary { public partial class FrmRecipientsJg : FrmBase { private string[] plineCode = null; public FrmRecipientsJg() { InitializeComponent(); } private void FrmRecipientsJg_Load(object sender, EventArgs e) { DateTime now = DateTime.Now; RegStartTime.Value = DateTime.Parse(now.AddDays(1 - now.Day).ToString("yyyy-MM-dd")); RegEndTime.Value = DateTime.Parse(DateTime.Today.AddDays(1).AddSeconds(-1).ToString("yyyy-MM-dd") + " 23:59:59"); EntityHelper.ShowGridCaption(ultraGrid2.DisplayLayout.Bands[0]); plineCode = comm.GetPlineCode(ValidDataPurviewIds, "G", ob); PipeManageClass.setUltraGridColumnInput(ultraGrid2, new string[] { "DealNum" });//支数 PipeManageClass.setUltraGridColumnMaxInput(ultraGrid2, new string[] { "DealWt" });//重量 } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": doQuery(); break; case "BreakUp": doBreakUp(); break; case "Export": GridHelper.ulGridToExcel(ultraGrid2, "领用信息"); break; case "Close": this.Close(); break; } } ///查询时验证必填项 private bool CheckQuery() { if (chkRegTime.Checked && DataTimeUtil.JudgeTime(DateTime.Parse(RegStartTime.Value.ToString()), DateTime.Parse(RegEndTime.Value.ToString())) == 0) { MessageUtil.ShowTips("开始时间不能大于结束时间!"); return false; } if (chkOrderNo.Checked && string.IsNullOrEmpty(txtOrderNo.Text.Trim())) { MessageBox.Show("请输入合同号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } if (chcCodeJg.Checked && string.IsNullOrEmpty(txtCodeJg.Text.Trim())) { MessageBox.Show("请输入接箍码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } //if (chkMaterial.Checked && string.IsNullOrEmpty(cmbMaterial.Text.Trim())) //{ // MessageBox.Show("请选择框号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return false; //} if (chkFurnace.Checked && string.IsNullOrEmpty(txtFurnace.Text.Trim())) { MessageBox.Show("请输入炉号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return false; } return true; } /// /// 查询 /// private void doQuery() { string strRegStart = ""; string strRegEnd = ""; string orderNo = ""; string strFurnace = ""; if (!CheckQuery()) return; if (chkOrderNo.Checked) { orderNo = txtOrderNo.Value.ToString(); } string codeJg = ""; if (chcCodeJg.Checked) { codeJg = txtCodeJg.Value.ToString(); } if (chkRegTime.Checked) { strRegStart = RegStartTime.Value.ToString(); strRegEnd = RegEndTime.Value.ToString(); } if (chkFurnace.Checked) { strFurnace = txtFurnace.Text.Trim(); } string flag = "0"; if (ultraCheckEditor1.Checked) { flag = "1"; } List listSource = EntityHelper.GetData ("com.steering.mes.mcp.CollarLibrary.FrmOutManagJg.queryRecipients", new object[] { strFurnace, strRegStart, strRegEnd, orderNo, codeJg, flag, plineCode }, this.ob); couplingMatDealEntityBindingSource.DataSource = listSource; GridHelper.RefreshAndAutoSize(ultraGrid2); } /// /// 拆分 /// private void doBreakUp() { UltraGridRow row = ultraGrid2.ActiveRow; if (row == null) return; string dealOrde = row.Cells["DealOrde"].Text.ToString(); string orderNo = row.Cells["OrderNo"].Text.ToString(); string codeJg = row.Cells["CodeJg"].Text.ToString(); string codeJgBl = row.Cells["CodeJgBl"].Text.ToString(); //string demandCopper = row.Cells["DemandCopper"].Text.ToString();//压印喷标 //string demandDetection = row.Cells["DemandDetection"].Text.ToString();//探伤 //string demandBlast = row.Cells["DemandBlast"].Text.ToString();//喷砂 //string demandBonderizing = row.Cells["DemandBonderizing"].Text.ToString();//磷化镀铜 string gowhereNameF = row.Cells["GowhereName"].Text.ToString(); string ordLnDyPk = row.Cells["OrdLnDlyPk"].Text.ToString(); int num = int.Parse(row.Cells["DealNum"].Value.ToString()) - int.Parse(row.Cells["UsedNum"].Value.ToString()) - int.Parse(row.Cells["FaillNum"].Value.ToString()) - int.Parse(row.Cells["BackNum"].Value.ToString()); FrmOrderJg order = new FrmOrderJg(this.ob, orderNo, codeJg, dealOrde, num, ordLnDyPk, codeJgBl, gowhereNameF); order.ShowDialog(); PlnOrderJgEntity baseEntity = order.BaseEntity; if (baseEntity == null) { return; } string gowhereName= baseEntity.GowhereName; string numRe = baseEntity.Num; if (MessageUtil.ShowYesNoAndQuestion("是否拆分数据?") == DialogResult.No) { return; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.steering.mes.mcp.CollarLibrary.FrmOutManagJg"; ccp.MethodName = "doBreakUp"; ccp.ServerParams = new object[] { dealOrde,baseEntity.JgOrderno,gowhereName,numRe, this.UserInfo.GetUserOrder(), this.UserInfo.GetUserGroup(), this.UserInfo.GetUserName() }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode == -1) return; MessageUtil.ShowTips(ccp.ReturnInfo); if (ccp.ReturnInfo.Equals("拆分成功!")) { doQuery(); } } /// /// 验证Checked是否勾选,显示控件可编辑 打勾表示可编辑,不打勾表示不可编辑 /// /// /// private void chk_CheckedChanged(object sender, EventArgs e) { if (chkOrderNo.Checked) { txtOrderNo.Enabled = true; } else { txtOrderNo.Enabled = false; } if (chcCodeJg.Checked) { txtCodeJg.Enabled = true; } else { txtCodeJg.Enabled = false; } if (chkFurnace.Checked) { txtFurnace.Enabled = true; } else { txtFurnace.Enabled = false; } if (chkRegTime.Checked) { RegStartTime.Enabled = true; RegEndTime.Enabled = true; } else { RegStartTime.Enabled = false; RegEndTime.Enabled = false; } } } }