using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Basics.DockPanel; using Dongke.IBOSS.PRD.Client.CommonModule; using Dongke.IBOSS.PRD.Client.DataModels; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; 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 Dongke.IBOSS.PRD.Client.SystemModule { public partial class F_MST_1601 : DockPanelBase { #region 成员变量 private static F_MST_1601 _instance; private bool _init = false; //订单详细 ArrayList arraylist = new ArrayList(); #endregion #region 构造函数 public F_MST_1601() { InitializeComponent(); this.Text = "订单信息"; this.tsbtnAdd.Text = ButtonText.TSBTN_ADD; this.tsbtnEdit.Text = ButtonText.TSBTN_EDIT; this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE; this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE; this.btnSearch.Text = ButtonText.BTN_SEARCH; this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION; } #endregion #region 单列模式 public static F_MST_1601 Instance { get { if (_instance == null) { _instance = new F_MST_1601(); } return _instance; } } #endregion #region 事件 /// /// 页面加载事件 /// /// /// private void F_MST_1401_Load(object sender, EventArgs e) { try { // 加载权限 FormPermissionManager.FormPermissionControl(this.Name, this, LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData, LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData); // 设置表格不自动创建列 this.dgvRpt.AutoGenerateColumns = false; this.dgvRpt2.AutoGenerateColumns = false; } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 查询事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { _init = true; if (this.dgvOrder.SelectedIndex == 0) { this.dgvRpt.DataSource = null; ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1601"; cre.Name = "GetOrder"; cre.Properties["ORDERSCODE"] = txtOrdersCode.Text; cre.Properties["GOODSCODE"] = txtProductModel.Text; cre.Properties["ORDERSDETAILID"] = ""; cre.Properties["GOODSNAME"] = this.goodsnamess.Text; cre.Properties["CUSTOMERNAME"] = this.customcode.Text; cre.Properties["LAYOUTNAME"] = this.layoutcode.Text; cre.Properties["ENTRUCKINGCODE"] = this.ENTRUCKINGCODES.Text; if (this.chkCreateTimes.Checked) { cre.Properties["CreateTimeStart"] = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0"); cre.Properties["CreateTimeStartEnd"] = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59"); } else { cre.Properties["CreateTimeStart"] = ""; cre.Properties["CreateTimeStartEnd"] = ""; } if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true) { cre.Properties["VALUEFLAG"] = ""; } else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false) { cre.Properties["VALUEFLAG"] = 1; } else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true) { cre.Properties["VALUEFLAG"] = 0; } else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false) { cre.Properties["VALUEFLAG"] = 2; } ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre); if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success) { this.DataSource = sre.Data; if (this.DataSource != null) { if (this.DataSource.Tables[0] != null && this.DataSource.Tables[0].Rows.Count > 0) { this.dgvRpt.DataSource = this.DataSource.Tables[0]; } else { // 清空明细中的数据 this.dgvRpt.DataSource = null; // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { // 清空明细中的数据 this.dgvRpt.DataSource = null; // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (this.dgvOrder.SelectedIndex == 1) { this.dgvRpt2.DataSource = null; ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1601"; cre.Name = "GetOrderDetails"; cre.Properties["ORDERCODE"] = txtOrdersCode.Text; cre.Properties["GOODSCODE"] = txtProductModel.Text; cre.Properties["ORDERSDETAILID"] = ""; cre.Properties["GOODSNAME"] = this.goodsnamess.Text; cre.Properties["CUSTOMERNAME"] = this.customcode.Text; cre.Properties["LAYOUTNAME"] = this.layoutcode.Text; cre.Properties["ENTRUCKINGCODE"] = this.ENTRUCKINGCODES.Text; if (this.chkCreateTimes.Checked) { cre.Properties["CreateTimeStart"] = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0"); cre.Properties["CreateTimeStartEnd"] = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59"); } else { cre.Properties["CreateTimeStart"] = ""; cre.Properties["CreateTimeStartEnd"] = ""; } if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true) { cre.Properties["VALUEFLAG"] = ""; } else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false) { cre.Properties["VALUEFLAG"] = 1; } else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true) { cre.Properties["VALUEFLAG"] = 0; } else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false) { cre.Properties["VALUEFLAG"] = 2; } ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre); if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success) { this.DataSource = sre.Data; if (this.DataSource != null) { this.dgvRpt2.DataSource = this.DataSource.Tables[0]; } } } else if (this.dgvOrder.SelectedIndex == 2) { this.dgvRpt2.DataSource = null; ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1601"; cre.Name = "GetOrderNumber"; cre.Properties["ORDERCODE"] = txtOrdersCode.Text; cre.Properties["GOODSCODE"] = txtProductModel.Text; cre.Properties["ORDERSDETAILID"] = ""; cre.Properties["GOODSNAME"] = this.goodsnamess.Text; cre.Properties["CUSTOMERNAME"] = this.customcode.Text; cre.Properties["LAYOUTNAME"] = this.layoutcode.Text; cre.Properties["ENTRUCKINGCODE"] = this.ENTRUCKINGCODES.Text; if (this.chkCreateTimes.Checked) { cre.Properties["CreateTimeStart"] = DateTime.Parse(this.dtpGroutingDateStart.Value.ToString("yyyy-MM-dd") + " 0:0:0"); cre.Properties["CreateTimeStartEnd"] = DateTime.Parse(this.dtpGroutingDateEnd.Value.ToString("yyyy-MM-dd") + " 23:59:59"); } else { cre.Properties["CreateTimeStart"] = ""; cre.Properties["CreateTimeStartEnd"] = ""; } if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == true) { cre.Properties["VALUEFLAG"] = ""; } else if (this.cbflagtrue.Checked == true && this.cbflagfalse.Checked == false) { cre.Properties["VALUEFLAG"] = 1; } else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == true) { cre.Properties["VALUEFLAG"] = 0; } else if (this.cbflagtrue.Checked == false && this.cbflagfalse.Checked == false) { cre.Properties["VALUEFLAG"] = 2; } ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre); if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success) { this.DataSource = sre.Data; if (this.DataSource != null) { this.dgvRpt3.DataSource = this.DataSource.Tables[0]; } } } } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } finally { _init = false; } } /// /// 清空按钮 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { this.txtOrdersCode.Text = null; this.txtProductModel.Text = null; this.customcode.Text = null; this.layoutcode.Text = null; this.goodsnamess.Text = null; this.ENTRUCKINGCODES.Text = null; } /// /// 自适应列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { this.dgvRpt.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); this.dgvRpt2.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); this.dgvRpt3.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); } /// /// 退出 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 编辑 /// /// /// private void tsbtnEdit_Click(object sender, EventArgs e) { try { if (this.dgvRpt.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 0) { arraylist.Add(this.dgvRpt.SelectedRows[0].Cells["ORDERSCODES"].Value.ToString()); F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 1); DialogResult dialogresult = frmFPC1602.ShowDialog(); btnSearch_Click(sender, null); arraylist.Clear(); } if (this.dgvRpt2.SelectedRows.Count != 0 && this.dgvOrder.SelectedIndex == 1) { arraylist.Add(this.dgvRpt2.SelectedRows[0].Cells["ORDERSDETAILID"].Value.ToString()); F_MST_1602 frmFPC1602 = new F_MST_1602(Constant.FormMode.Edit, arraylist, 2); DialogResult dialogresult = frmFPC1602.ShowDialog(); btnSearch_Click(sender, null); arraylist.Clear(); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 新建 /// /// /// private void tsbtnAdd_Click(object sender, EventArgs e) { try{ if(this.dgvOrder.SelectedIndex == 0){ F_MST_1602 frmMST1602 = new F_MST_1602(Constant.FormMode.Add, arraylist,0); DialogResult dialogResult = frmMST1602.ShowDialog(); // 重新加载GridView btnSearch_Click(sender, null); } } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 窗体关闭事件 /// /// /// private void F_MST_1601_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } #endregion #region 私有方法 /// /// 根据界面查询条件获取数据集 /// private DataSet GetSearchData() { try { ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_MST_1601"; cre.Name = "GetCustomer"; ServiceResultEntity sre = SystemModuleProxy.Service.DoRequest(cre); if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success) { return sre.Data; } return null; } catch (Exception ex) { throw ex; } } #endregion private void dgvRpt2_ColumnStateChanged(object sender, DataGridViewColumnStateChangedEventArgs e) { if (this.dgvOrder.SelectedIndex == 0) { this.tsbtnAdd.Enabled = true; } if (this.dgvOrder.SelectedIndex == 1) { this.tsbtnAdd.Enabled = false; } } private void chkCreateTimes_CheckedChanged(object sender, EventArgs e) { this.dtpGroutingDateStart.Enabled = this.chkCreateTimes.Checked; this.dtpGroutingDateEnd.Enabled = this.chkCreateTimes.Checked; if (!this.chkCreateTimes.Checked) { this.dtpGroutingDateStart.Value = DateTime.Now.Date; this.dtpGroutingDateEnd.Value = DateTime.Now.Date; } } } }