/*******************************************************************************
* Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_SAP_HEGII_0113.cs
* 2.功能描述:中台同步日志
* 编辑履历:
* 作者 日期 版本 修改内容
* 付斌 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.Client.DataModels;
using Dongke.IBOSS.PRD.WCF.DataModels;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.SAPDataModule
{
///
/// 中台同步日志
///
public partial class F_SAP_HEGII_0113 : DKDockPanelBase
{
#region 成员变量
private static F_SAP_HEGII_0113 _instance = null;
#endregion
#region 单例模式
///
/// 单例模式,防止重复创建窗体
///
public static F_SAP_HEGII_0113 Instance
{
get
{
if (_instance == null)
{
_instance = new F_SAP_HEGII_0113();
}
return _instance;
}
}
#endregion
#region 构造函数
///
/// 成品SAP日志
///
public F_SAP_HEGII_0113()
{
InitializeComponent();
tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
}
#endregion
#region 控件事件
///
/// 关闭
///
///
///
private void F_SAP_HEGII_0113_FormClosed(object sender, FormClosedEventArgs e)
{
_instance = null;
}
///
/// 画面加载
///
///
///
private void F_SAP_HEGII_0113_Load(object sender, System.EventArgs e)
{
try
{
// 加载权限
FormPermissionManager.FormPermissionControl(Name, this,
LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
dgvBarcode.AutoGenerateColumns = false;
dtpFhtimeBegin.Value = DateTime.Now.Date;
dtpFhtimeEnd.Value = DateTime.Now.Date;
DataTable dtToZhongTaiFlag = new DataTable();
dtToZhongTaiFlag.Columns.Add("Flag", typeof(string));
dtToZhongTaiFlag.Columns.Add("FlagName", typeof(string));
DataRow newRow = dtToZhongTaiFlag.NewRow();
dtToZhongTaiFlag.Rows.Add(newRow);
newRow = dtToZhongTaiFlag.NewRow();
newRow["Flag"] = "1";
newRow["FlagName"] = "已同步";
dtToZhongTaiFlag.Rows.Add(newRow);
newRow = dtToZhongTaiFlag.NewRow();
newRow["Flag"] = "0";
newRow["FlagName"] = "未同步";
dtToZhongTaiFlag.Rows.Add(newRow);
this.cmbToZhongTaiFlag.DisplayMember = "FlagName";
this.cmbToZhongTaiFlag.ValueMember = "Flag";
this.cmbToZhongTaiFlag.DataSource = dtToZhongTaiFlag;
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(ToString(),
MethodBase.GetCurrentMethod().Name, Text, ex);
}
}
///
/// 查询
///
///
///
private void tsbtnSearch_Click(object sender, EventArgs e)
{
try
{
tsrToolStrip1.Focus();
dgvBarcode.DataSource = null;
if (dtpFhtimeBegin.Value == null || dtpFhtimeEnd.Value == null)
{
return;
}
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "Hegii";
cre.Name = "GetKunChuanDataLog";
cre.Properties["FhtimeBegin"] = dtpFhtimeBegin.Value.Value;
cre.Properties["FhtimeEnd"] = dtpFhtimeEnd.Value.Value.AddDays(1);
cre.Properties["ToKunChuanFlag"] = cmbToZhongTaiFlag.SelectedValue;
cre.Properties["KunChuanMsg"] = txtZhongTaiMsg.Text;
ServiceResultEntity sre = DoAsync(() =>
{
return SAPDataModuleProxy.Service.DoRequest(cre);
});
if (sre.Status == Constant.ServiceResultStatus.Success)
{
if (sre.Data.Tables[0].Rows.Count == 0)
{
DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_001);
return;
}
// 查询成功
dgvBarcode.DataSource = sre.Data.Tables[0];
dgvBarcode.AutoResizeColumns();
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(ToString(),
MethodBase.GetCurrentMethod().Name, Text, ex);
}
}
///
/// 同步操作
///
///
///
private void tsbtnSynLog_Click(object sender, EventArgs e)
{
try
{
F_SAP_HEGII_011301 f = new F_SAP_HEGII_011301();
DialogResult dialogResult = f.ShowDialog();
if (dialogResult == DialogResult.OK)
{
this.tsbtnSearch_Click(null, null);
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
///
/// 清除条件
///
///
///
private void tsbtnClearCondition_Click(object sender, EventArgs e)
{
dtpFhtimeBegin.Value = DateTime.Now.Date;
dtpFhtimeEnd.Value = DateTime.Now.Date;
this.cmbToZhongTaiFlag.SelectedIndex = 0;
txtZhongTaiMsg.Text = string.Empty;
}
///
/// 自适应列宽
///
///
///
private void tsbtnAdaptive_Click(object sender, EventArgs e)
{
dgvBarcode.AutoResizeColumns();
}
///
/// 关闭画面
///
///
///
private void tsbtnClose_Click(object sender, EventArgs e)
{
Close();
}
#endregion
}
}