| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- /*******************************************************************************
- * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_RPT_010201_1.cs
- * 2.功能描述:发货单编辑
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 冯林勇 2023/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_3502 : DKDockPanelBase
- {
- #region 成员变量
- // 窗体的单例模式
- private static F_PM_3502 _instance;
- // 存储窗口的编辑状态
- private Constant.FormMode _editStatus;
- private int _sendoutGoodsLogID;
- #endregion
- #region 构造函数
- public F_PM_3502()
- {
- InitializeComponent();
- }
- public F_PM_3502(Constant.FormMode editStatus, int sendoutGoodsLogID)
- {
- InitializeComponent();
- this._editStatus = editStatus;
- // 根据新建、编辑状态为标题赋值
- if (editStatus == Constant.FormMode.Edit)
- {
- this.Text = "编辑发货单";
- this._sendoutGoodsLogID = sendoutGoodsLogID;
- }
- // 按钮文本
- this.btnSave.Text = ButtonText.BTN_SAVE;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PM_3502 Instance
- {
- get
- {
- if (_instance == null || _instance.IsDisposed)
- {
- _instance = new F_PM_3502();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件处理
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_3502_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
- #endregion
- //编辑查询数据
- if (this._sendoutGoodsLogID > 0)
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3502";
- cre.Name = "GetSendInfo";
- cre.Properties["SENDOUTGOODSLOGID"] = this._sendoutGoodsLogID;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
- {
- DataTable dtable = sre.Data.Tables[0];
- this.txtSENDOUTCODE.Text = dtable.Rows[0]["SENDOUTCODE"].ToString();
- this.cmbWAREHOUSINGCODE.SelectedValue = Convert.ToInt32(dtable.Rows[0]["WAREHOUSINGID"]);
- this.cmbRECEIVECODE.SelectedValue = Convert.ToInt32(dtable.Rows[0]["RECEIVEID"]);
- this.cmbCARPLATENAME.SelectedValue = Convert.ToInt32(dtable.Rows[0]["CARPLATEID"]);
-
- if (sre.Data.Tables[1].Rows.Count > 0)
- {
- DataTable dtable2 = sre.Data.Tables[1];
- this.dgvSendDetail.DataSource = dtable2;
- }
- }
- }
- }
- }
- 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_3502_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3502";
- cre.Name = "SaveSendInfo";
- cre.Properties["SENDOUTGOODSLOGID"] = this._sendoutGoodsLogID;
- cre.Properties["OUTLABELCODE"] = this.txtOUTLABELCODE.Text;
- cre.Properties["WAREHOUSINGCODE"] = this.cmbWAREHOUSINGCODE.SelectedValue;
- cre.Properties["RECEIVECODE"] = this.cmbRECEIVECODE.SelectedValue;
- cre.Properties["CARPLATECODE"] = this.cmbCARPLATENAME.SelectedValue;
- cre.Properties["WAREHOUSINGENAME"] = this.cmbWAREHOUSINGCODE.Text;
- cre.Properties["RECEIVEENAME"] = this.cmbRECEIVECODE.Text;
- cre.Properties["CARPLATENAME"] = this.cmbCARPLATENAME.Text;
- cre.Properties["AccountDateStart"] = this.dtpAccountDateStart.Value;
- cre.Properties["DELIVERDATE"] = this.c_DateTimePicker1.Value;
- if (dgvSendDetail.DataSource != null)
- {
- DataTable detail = (DataTable)(dgvSendDetail.DataSource);
- cre.Data = new DataSet();
- cre.Data.Tables.Add(detail.Copy());
- }
- else
- {
- MessageBox.Show(string.Format("发货单信息不能为空"),
- this.Text,
- MessageBoxButtons.OK,
- MessageBoxIcon.Warning);
- return;
- }
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- MessageBox.Show("保存成功",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- else if (sre.Status == Constant.ServiceResultStatus.DataChanged)//"库存不足"
- {
- MessageBox.Show("sap库存不足",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- else if (sre.Status == Constant.ServiceResultStatus.Other) // "存在已发货产品";
- {
- MessageBox.Show("存在已发货产品",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- else if (sre.Status == Constant.ServiceResultStatus.DataDuplicated) // "存在已发货产品";
- {
- MessageBox.Show("发货单信息不能为空",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- else if (sre.Status == Constant.ServiceResultStatus.NoModifyData) // "存在已发货产品";
- {
- MessageBox.Show("同步返回空值",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- else
- {
- MessageBox.Show("保存失败",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- }
- catch (Exception ex)
- {
- this.btnSave.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 txtOUTLABELCODE_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter && !string.IsNullOrEmpty(this.txtOUTLABELCODE.Text.Trim()))
- {
- //调用查询
- //调用查询
- string code = this.txtOUTLABELCODE.Text.Trim();
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3502";
- cre.Name = "CheckSendInfo";
- cre.Properties["code"] = code;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- if (string.IsNullOrEmpty(sre.Message))
- {
- if (sre.Data.Tables != null && sre.Data.Tables[0].Rows.Count > 0)
- {
- DataRow data = sre.Data.Tables[0].Rows[0];
- var dt = (DataTable)this.dgvSendDetail.DataSource;
- DataRow dr = dt.NewRow();
- dr["BANMA"] = data["BANMA"];
- dr["GOODSCODE"] = data["GOODSCODE"];
- dr["MATERIALCODE"] = data["MATERIALCODE"];
- dr["MATERIALREMARK"] = data["MATERIALREMARK"];
- dr["BINDINGCOUNT"] = data["COUNT"];
- //FINISHEDLOADBATCHNO
- dt.Rows.Add(dr);
- this.dgvSendDetail.DataSource = dt;
- }
- }
- else
- {
- MessageBox.Show(sre.Message,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- }
- }
- #endregion
- }
- }
|