| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- /*******************************************************************************
- * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_SAP_HEGII_0104.cs
- * 2.功能描述:成品WMS同步日志
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 付斌 2022/09/02 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Reflection;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- 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;
- namespace Dongke.IBOSS.PRD.Client.SAPDataModule
- {
- /// <summary>
- /// 成品SAP日志
- /// </summary>
- public partial class F_SAP_HEGII_0104 : DKDockPanelBase
- {
- #region 成员变量
- private static F_SAP_HEGII_0104 _instance = null;
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_SAP_HEGII_0104 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_SAP_HEGII_0104();
- }
- return _instance;
- }
- }
- #endregion
- #region 构造函数
- /// <summary>
- /// 成品SAP日志
- /// </summary>
- public F_SAP_HEGII_0104()
- {
- InitializeComponent();
- tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- }
- #endregion
- #region 控件事件
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_SAP_HEGII_0104_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 画面加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_SAP_HEGII_0104_Load(object sender, System.EventArgs e)
- {
- try
- {
- // 加载权限
- //FormPermissionManager.FormPermissionControl(Name, this,
- // LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- // LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- dgvBarcode.AutoGenerateColumns = false;
- dtpDatebegin.Value = DateTime.Now.Date;
- dtpDateend.Value = DateTime.Now.Date;
- DataTable dtLogType = new DataTable();
- dtLogType.Columns.Add("LogType", typeof(string));
- dtLogType.Columns.Add("LogTypeName", typeof(string));
- DataRow newRow = dtLogType.NewRow();
- dtLogType.Rows.Add(newRow);
- newRow = dtLogType.NewRow();
- newRow["LogType"] = "1";
- newRow["LogTypeName"] = "交接";
- dtLogType.Rows.Add(newRow);
- newRow = dtLogType.NewRow();
- newRow["LogType"] = "2";
- newRow["LogTypeName"] = "撤销";
- dtLogType.Rows.Add(newRow);
- this.cmbLogType.DisplayMember = "LogTypeName";
- this.cmbLogType.ValueMember = "LogType";
- this.cmbLogType.DataSource = dtLogType;
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(ToString(),
- MethodBase.GetCurrentMethod().Name, Text, ex);
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- tsrToolStrip1.Focus();
- dgvBarcode.DataSource = null;
- if (dtpDatebegin.Value == null || dtpDateend.Value == null)
- {
- return;
- }
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "Hegii";
- cre.Name = "GetWMSDataLog";
- cre.Properties["datebegin"] = dtpDatebegin.Value.Value;
- cre.Properties["dateend"] = dtpDateend.Value.Value.AddDays(1);
- cre.Properties["LogType"] = cmbLogType.SelectedValue;
- cre.Properties["ReturnDesc"] = txtReturnDesc.Text;
- ServiceResultEntity sre = DoAsync(() =>
- {
- return SAPDataModuleProxy.Service.DoRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- // 查询成功
- dgvBarcode.DataSource = sre.Data.Tables[0];
- dgvBarcode.IsSetInputColumnsColor = true;
- if (dgvBarcode.RowCount == 0)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_001);
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(ToString(),
- MethodBase.GetCurrentMethod().Name, Text, ex);
- }
- }
- /// <summary>
- /// 清除条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClearCondition_Click(object sender, EventArgs e)
- {
- dtpDatebegin.Value = DateTime.Now.Date;
- dtpDateend.Value = DateTime.Now.Date;
- this.cmbLogType.SelectedIndex = 0;
- txtReturnDesc.Text = string.Empty;
- }
- /// <summary>
- /// 自适应列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- dgvBarcode.AutoResizeColumns();
- }
- /// <summary>
- /// 关闭画面
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- Close();
- }
- #endregion
- /// <summary>
- /// 同步操作
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnSynLog_Click(object sender, EventArgs e)
- {
- try
- {
- tsrToolStrip1.Focus();
- DataTable dtBarcode = dgvBarcode.DataSource as DataTable;
- if (dtBarcode == null)
- {
- return;
- }
- DataTable dtSelBarcode = dtBarcode.Copy();
- dtSelBarcode.DefaultView.RowFilter = "Sel = 1";
- dtSelBarcode = dtSelBarcode.DefaultView.ToTable();
- if (dtSelBarcode.Rows.Count == 0)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, "未选择任何数据");
- return;
- }
- DataRow[] rows = dtSelBarcode.Select("RETURNDESC = '同步成功'");
- if (rows.Length > 0)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, "同步成功不允许再同步");
- return;
- }
- string logtype;
- rows = dtSelBarcode.Select("LOGTYPE = '1'");
- if (rows.Length == dtSelBarcode.Rows.Count)
- {
- logtype = "1";
- }
- else if(rows.Length == 0)
- {
- logtype = "2";
- }
- else
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, "交接和撤销不能一起同步");
- return;
- }
- foreach (DataRow row in dtSelBarcode.Rows)
- {
- rows = dtSelBarcode.Select("CODEI = '" + row["CODEI"] + "'");
- if (rows.Length > 1)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.W_CMN_S_004, row["CODEI"] + ":出现两次以上");
- return;
- }
- }
- DialogResult dr = MessageBox.Show("是否对所选数据进行同步?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (dr != System.Windows.Forms.DialogResult.Yes)
- {
- return;
- }
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "Hegii";
- cre.Name = "SyncWMSDataLog";
- cre.Properties["LogType"] = logtype;
- cre.Data = new DataSet();
- cre.Data.Tables.Add(dtSelBarcode);
- ServiceResultEntity sre = DoAsync(() =>
- {
- return SAPDataModuleProxy.Service.DoRequest(cre);
- });
- if (sre.OtherStatus > 0)
- {
- DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_002);
- tsbtnSearch_Click(null, null);
- }
- else
- {
- MessageBox.Show(this, sre.Message);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(ToString(),
- MethodBase.GetCurrentMethod().Name, Text, ex);
- }
- }
- }
- }
|