/******************************************************************************* * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:F_PM_3501.cs * 2.功能描述:发货单 * 编辑履历: * 作者 日期 版本 修改内容 * 冯林勇 2024/1/11 1.00 新建 *******************************************************************************/ using Dongke.IBOSS.PRD.Basics.BaseResources; using Dongke.IBOSS.PRD.Client.CommonModule; using Dongke.IBOSS.PRD.Client.Controls; using Dongke.IBOSS.PRD.WCF.DataModels; using Dongke.IBOSS.PRD.WCF.Proxys; using System; using System.Data; using System.Windows.Forms; namespace Dongke.IBOSS.PRD.Client.PMModule { public partial class F_PM_3501 : DKDockPanelBase { #region 成员变量 // 窗体的单例模式 private static F_PM_3501 _instance; #endregion #region 构造函数 public F_PM_3501() { InitializeComponent(); // 窗体显示的Title this.Text = "发货单"; this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE; this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE; this.btnSearch.Text = ButtonText.BTN_SEARCH; this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION; this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS; } #endregion #region 单例模式 /// /// 单例模式,防止重复创建窗体 /// public static F_PM_3501 Instance { get { if (_instance == null || _instance.IsDisposed) { _instance = new F_PM_3501(); } return _instance; } } #endregion #region 事件处理 /// /// 窗体加载事件 /// /// /// private void F_PM_3501_Load(object sender, EventArgs e) { try { #region 页面数据源 #region 发出/接收仓库 ClientRequestEntity creWarehouse = new ClientRequestEntity(); creWarehouse.NameSpace = "F_PM_3501"; creWarehouse.Name = "GetSendWarehouse"; ServiceResultEntity sreWarehouse = DoAsync(() => { return PMModuleProxyNew.Service.HandleRequest(creWarehouse); }); if (sreWarehouse.Status == Constant.ServiceResultStatus.Success) { if (sreWarehouse.Data.Tables[0] != null && sreWarehouse.Data.Tables[0].Rows.Count > 0) { //发出仓库 DataTable dtWarehouse = new DataTable(); dtWarehouse = sreWarehouse.Data.Tables[0].Copy(); string filterdtWarehouse = "WAREHOUSETYPE = '1'"; dtWarehouse.DefaultView.RowFilter = filterdtWarehouse; dtWarehouse = dtWarehouse.DefaultView.ToTable(); DataRow drWarehouse = dtWarehouse.NewRow(); drWarehouse["WAREHOUSENAME"] = ""; drWarehouse["WAREHOUSECODE"] = "1"; dtWarehouse.Rows.Add(drWarehouse); cmbWAREHOUSINGCODE.DisplayMember = "WAREHOUSENAME"; cmbWAREHOUSINGCODE.ValueMember = "WAREHOUSECODE"; cmbWAREHOUSINGCODE.DataSource = dtWarehouse; cmbWAREHOUSINGCODE.SelectedValue = "1"; //接收仓库 DataTable dtReceive = new DataTable(); dtReceive = sreWarehouse.Data.Tables[0].Copy(); string filterdtReceive = "WAREHOUSETYPE = '2'"; dtReceive.DefaultView.RowFilter = filterdtReceive; dtReceive = dtReceive.DefaultView.ToTable(); DataRow drReceive = dtReceive.NewRow(); drReceive["WAREHOUSENAME"] = ""; drReceive["WAREHOUSECODE"] = "1"; dtReceive.Rows.Add(drReceive); cmbRECEIVECODE.DisplayMember = "WAREHOUSENAME"; cmbRECEIVECODE.ValueMember = "WAREHOUSECODE"; cmbRECEIVECODE.DataSource = dtReceive; cmbRECEIVECODE.SelectedValue = "1"; } } #endregion #region 车牌号 ClientRequestEntity creNumberplaten = new ClientRequestEntity() ; creNumberplaten.NameSpace = "F_PM_3501"; creNumberplaten.Name = "GetNumberplaten"; ServiceResultEntity sreNumberplaten = DoAsync(() => { return PMModuleProxyNew.Service.HandleRequest(creNumberplaten); }); if (sreNumberplaten.Status == Constant.ServiceResultStatus.Success) { if (sreNumberplaten.Data.Tables[0] != null && sreNumberplaten.Data.Tables[0].Rows.Count > 0) { DataTable dtNumberplaten = new DataTable(); dtNumberplaten = sreNumberplaten.Data.Tables[0].Copy(); DataRow drNumberplaten = dtNumberplaten.NewRow(); drNumberplaten["NUMBERPLATECODE"] = ""; dtNumberplaten.Rows.Add(drNumberplaten); cmbNUMBERPLATE.DisplayMember = "NUMBERPLATECODE"; cmbNUMBERPLATE.ValueMember = "NUMBERPLATECODE"; cmbNUMBERPLATE.DataSource = dtNumberplaten; cmbNUMBERPLATE.SelectedValue = ""; } } #endregion #region 同步状态 DataTable dtSyncStatus = new DataTable(); dtSyncStatus.Columns.Add("SyncStatusID"); dtSyncStatus.Columns.Add("SyncStatusNames"); DataRow drSyncStatus = dtSyncStatus.NewRow(); drSyncStatus["SyncStatusID"] = "1"; drSyncStatus["SyncStatusNames"] = "成功"; dtSyncStatus.Rows.Add(drSyncStatus); drSyncStatus = dtSyncStatus.NewRow(); drSyncStatus["SyncStatusID"] = "0"; drSyncStatus["SyncStatusNames"] = "失败"; dtSyncStatus.Rows.Add(drSyncStatus); drSyncStatus = dtSyncStatus.NewRow(); drSyncStatus["SyncStatusID"] = "2"; drSyncStatus["SyncStatusNames"] = ""; dtSyncStatus.Rows.Add(drSyncStatus); cmbSYNCSTATUS.DisplayMember = "SyncStatusNames"; cmbSYNCSTATUS.ValueMember = "SyncStatusID"; cmbSYNCSTATUS.DataSource = dtSyncStatus; cmbSYNCSTATUS.SelectedValue = "2"; #endregion #endregion } catch (Exception ex) { // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 窗体关闭事件 /// /// /// private void F_PM_3501_FormClosed(object sender, FormClosedEventArgs e) { _instance = null; } /// /// 关闭按钮 /// /// /// private void tsbtnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 查询按钮事件 /// /// /// private void btnSearch_Click(object sender, EventArgs e) { try { #region 总单 ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PM_3501"; cre.Name = "GetSendOutGoodsLog"; cre.Properties["SENDOUTCODE"] = txtSendOutCode.TextValue; cre.Properties["WAREHOUSINGCODE"] = cmbWAREHOUSINGCODE.SelectedValue; cre.Properties["RECEIVECODE"] = cmbRECEIVECODE.SelectedValue; cre.Properties["NUMBERPLATE"] = cmbNUMBERPLATE.SelectedValue; cre.Properties["ACCOUNTDATE"] = dtpACCOUNTDATE.Value; cre.Properties["DELIVERDATE"] = dtpDELIVERDATE.Value; cre.Properties["SYNCSTATUS"] = cmbSYNCSTATUS.SelectedValue; ServiceResultEntity sre = DoAsync(() => { return PMModuleProxyNew.Service.HandleRequest(cre); }); if (sre.Status == Constant.ServiceResultStatus.Success) { if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0) { dgvSend.DataSource = sre.Data.Tables[0]; } else { // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } #endregion #region 明细 dgvSend_SelectionChanged(null, null); #endregion } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 总单选择事件 /// /// /// private void dgvSend_SelectionChanged(object sender, EventArgs e) { try { int sendoutGoodsLogID = Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString()); ClientRequestEntity cre = new ClientRequestEntity(); cre.NameSpace = "F_PM_3501"; cre.Name = "GetSendOutGoodsLogDetail"; cre.Properties["SENDOUTGOODSLOGID"] = sendoutGoodsLogID; ServiceResultEntity sre = DoAsync(() => { return PMModuleProxyNew.Service.HandleRequest(cre); }); if (sre.Status == Constant.ServiceResultStatus.Success) { if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0) { dgvSendDetail.DataSource = sre.Data.Tables[0]; } else { // 提示未查找到数据 MessageBox.Show(Messages.MSG_CMN_I002, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 清空条件按钮事件 /// /// /// private void btnClearCondition_Click(object sender, EventArgs e) { try { } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 自动适应列宽 /// /// /// private void tsbtnAdaptive_Click(object sender, EventArgs e) { try { } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 发货单编辑 /// /// /// private void btnSendEdit_Click(object sender, EventArgs e) { try { F_PM_3502 sendEdit = new F_PM_3502(); sendEdit.ShowDialog(); } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 发货单撤销 /// /// /// private void btnSendBack_Click(object sender, EventArgs e) { try { } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 发货单补推 /// /// /// private void btnSendPush_Click(object sender, EventArgs e) { try { } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 发货单总表删除 /// /// /// private void btnSendDelete_Click(object sender, EventArgs e) { try { } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } /// /// 发货单明细删除 /// /// /// private void btnSendDetailDelete_Click(object sender, EventArgs e) { try { } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } #endregion #region 私有方法 /// /// 按钮状态 /// private void buttonStatus() { try { } catch (Exception ex) { this.btnSearch.Enabled = true; this.btnClearCondition.Enabled = true; // 对异常进行共通处理 ExceptionManager.HandleEventException(this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex); } } #endregion } }