| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539 |
- /*******************************************************************************
- * 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 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PM_3501 Instance
- {
- get
- {
- if (_instance == null || _instance.IsDisposed)
- {
- _instance = new F_PM_3501();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件处理
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_3501_Load(object sender, EventArgs e)
- {
- try
- {
- #region 页面数据源
- #region 发出/接收仓库
- //发出仓库
- ServiceResultEntity sreType = DoAsync<ServiceResultEntity>(() =>
- {
- return ReportModuleProxy.Service.GetRptDictionaryData(0, "TPC027");
- }
- );
- if (sreType.Data == null)
- {
- return;
- }
- if (sreType.Data != null && sreType.Data.Tables[0].Rows.Count > 0)
- {
- // 设置空选项
- DataRow dataRow = sreType.Data.Tables[0].NewRow();
- dataRow["DictionaryID"] = DBNull.Value;
- dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
- dataRow["DisplayNo"] = 0;
- sreType.Data.Tables[0].Rows.InsertAt(dataRow, 0);
- this.cmbWAREHOUSINGCODE.DisplayMember = "DictionaryValue";
- this.cmbWAREHOUSINGCODE.ValueMember = "DictionaryID";
- this.cmbWAREHOUSINGCODE.DataSource = sreType.Data.Tables[0];
- }
- //接收仓库
- sreType = DoAsync<ServiceResultEntity>(() =>
- {
- return ReportModuleProxy.Service.GetRptDictionaryData(0, "TPC028");
- }
- );
- if (sreType.Data == null)
- {
- return;
- }
- if (sreType.Data != null && sreType.Data.Tables[0].Rows.Count > 0)
- {
- // 设置空选项
- DataRow dataRow = sreType.Data.Tables[0].NewRow();
- dataRow["DictionaryID"] = DBNull.Value;
- dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
- dataRow["DisplayNo"] = 0;
- sreType.Data.Tables[0].Rows.InsertAt(dataRow, 0);
- this.cmbRECEIVECODE.DisplayMember = "DictionaryValue";
- this.cmbRECEIVECODE.ValueMember = "DictionaryID";
- this.cmbRECEIVECODE.DataSource = sreType.Data.Tables[0];
- }
-
- #endregion
- #region 车牌号
- //接收仓库
- sreType = DoAsync<ServiceResultEntity>(() =>
- {
- return ReportModuleProxy.Service.GetRptDictionaryData(0, "TPC029");
- }
- );
- if (sreType.Data == null)
- {
- return;
- }
- if (sreType.Data != null && sreType.Data.Tables[0].Rows.Count > 0)
- {
- // 设置空选项
- DataRow dataRow = sreType.Data.Tables[0].NewRow();
- dataRow["DictionaryID"] = DBNull.Value;
- dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
- dataRow["DisplayNo"] = 0;
- sreType.Data.Tables[0].Rows.InsertAt(dataRow, 0);
- this.cmbCARPLATENAME.DisplayMember = "DictionaryValue";
- this.cmbCARPLATENAME.ValueMember = "DictionaryID";
- this.cmbCARPLATENAME.DataSource = sreType.Data.Tables[0];
- }
-
- #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"] = "2";
- drSyncStatus["SyncStatusNames"] = "失败";
- dtSyncStatus.Rows.Add(drSyncStatus);
- drSyncStatus = dtSyncStatus.NewRow();
- drSyncStatus["SyncStatusID"] = "";
- drSyncStatus["SyncStatusNames"] = "";
- dtSyncStatus.Rows.Add(drSyncStatus);
- cmbSYNCSTATUS.DisplayMember = "SyncStatusNames";
- cmbSYNCSTATUS.ValueMember = "SyncStatusID";
- cmbSYNCSTATUS.DataSource = dtSyncStatus;
- cmbSYNCSTATUS.SelectedValue = "";
- #endregion
- #endregion
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 窗体关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_3501_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 关闭按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 查询按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- //清除表格数据
- if (dgvSend.DataSource is DataTable dataTable)
- {
- // 清除所有行,但保留列结构
- dataTable.Rows.Clear();
- }
- #region 总单
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3501";
- cre.Name = "GetSendOutGoodsLog";
- cre.Properties["SENDOUTCODE"] = txtSendOutCode.TextValue;
- cre.Properties["WAREHOUSINGID"] = cmbWAREHOUSINGCODE.SelectedValue;
- cre.Properties["RECEIVEID"] = cmbRECEIVECODE.SelectedValue;
- cre.Properties["CARPLATEID"] = cmbCARPLATENAME.SelectedValue;
- cre.Properties["ACCOUNTDATE"] = dtpACCOUNTDATE.Value.ToString("yyyy-MM-dd");
- cre.Properties["DELIVERDATE"] = dtpDELIVERDATE.Value.ToString("yyyy-MM-dd");
- cre.Properties["SYNCSTATUS"] = cmbSYNCSTATUS.SelectedValue;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- 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
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 总单选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvSend_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvSend.CurrentRow != null)
- {
- 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<ServiceResultEntity>(() =>
- {
- 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);
- }
- }
- /// <summary>
- /// 清空条件按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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);
- }
- }
- /// <summary>
- /// 自动适应列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- try
- {
- this.dgvSendDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvSend.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 发货单编辑
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSendEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvSend.CurrentRow;
- if (currentRow != null)
- {
- if (Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SYNCSTATUS"].Value.ToString()) == 1)
- {
- MessageBox.Show("同步成功的发货单不可编辑");
- return;
- }
- F_PM_3502 frmPM3602 = new F_PM_3502(Constant.FormMode.Edit, Convert.ToInt32(currentRow.Cells["SENDOUTGOODSLOGID"].Value));
- DialogResult dialogresult = frmPM3602.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- // 刷新窗口数据
- btnSearch_Click(sender, e);
- }
- }
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 发货单撤销
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSendBack_Click(object sender, EventArgs e)
- {
- try
- {
- if (Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SYNCSTATUS"].Value.ToString()) != 1)
- {
- MessageBox.Show("未同步成功的发货单不可撤销");
- return;
- }
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3501";
- cre.Name = "KHDRevokeInvoice";
- cre.Properties["ementy"] = "["+this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString()+"]";
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- MessageBox.Show(sre.Message);
- btnSearch_Click(sender, e);
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 发货单补推
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSendPush_Click(object sender, EventArgs e)
- {
- try
- {
- if (Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SYNCSTATUS"].Value.ToString()) == 1)
- {
- MessageBox.Show("同步成功的发货单不可补推");
- return;
- }
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3501";
- cre.Name = "KHDSupplementaryPush";
- cre.Properties["ementy"] = "[" + this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString() + "]";
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- MessageBox.Show(sre.Message);
- btnSearch_Click(sender, e);
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 发货单总表删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSendDelete_Click(object sender, EventArgs e)
- {
- try
- {
- if (Convert.ToInt32(this.dgvSend.CurrentRow.Cells["SYNCSTATUS"].Value.ToString())==1)
- {
- MessageBox.Show("同步成功的发货单不可删除");
- return;
- }
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3501";
- cre.Name = "KHDDestroyInvoice";
- cre.Properties["ementy"] ="["+ this.dgvSend.CurrentRow.Cells["SENDOUTGOODSLOGID"].Value.ToString()+"]";
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- MessageBox.Show(sre.Message);
- btnSearch_Click(sender, e);
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 发货单明细删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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 私有方法
- /// <summary>
- /// 按钮状态
- /// </summary>
- 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
- }
- }
|