/*******************************************************************************
* Copyright(c) 2014 dongke All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_PC_1204.cs
* 2.功能描述:模具库存自动结转设置
* 编辑履历:
* 作者 日期 版本 修改内容
* 陈晓野 2017/12/14 1.00 新建
*******************************************************************************/
using System;
using System.Data;
using System.Windows.Forms;
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.PCModule
{
///
/// 模具库存自动结转设置
///
public partial class F_PC_1204 : DKFormBase
{
///
/// 模具库存自动结转设置
///
public F_PC_1204()
{
InitializeComponent();
this.Text = "模具库存自动结转设置";
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void F_MST_040101_Load(object sender, EventArgs e)
{
try
{
// 异步处理,获取系统参数信息
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "FPC1201";
cre.Name = "GetFPC1204Data";
// 调用服务器端获取数据集(DataSet)DoAsync(new BaseAsyncMethod(GetSystemData));
//ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
// {
// return CommonModuleProxy.Service.DoRequest(cre);
// }
//);
ServiceResultEntity sre = PCModuleProxyNew.Service.HandleRequest(cre);
if (sre.Status == Constant.ServiceResultStatus.Success &&
sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
{
DataRow jobRow = sre.Data.Tables[0].Rows[0];
string[] infos = jobRow["REPEAT_INTERVAL"].ToString().Split(';');
foreach (string item in infos)
{
if (item.StartsWith("ByMonthDay="))
{
this.txtCDay.Text = item.Replace("ByMonthDay=", "");
this.txtSDay.Value = int.Parse(this.txtCDay.Text);
}
else if (item.StartsWith("ByHour="))
{
this.txtCHour.Text = item.Replace("ByHour=", "");
this.txtSHour.Value = int.Parse(this.txtCHour.Text);
}
else if (item.StartsWith("ByMinute="))
{
this.txtCMi.Text = item.Replace("ByMinute=", "");
if ("30" == this.txtCMi.Text)
{
this.txtSMi.SelectedIndex = 1;
}
else
{
this.txtSMi.SelectedIndex = 0;
}
}
}
this.lblRunInfo.Text = string.Format("上次执行时间:【{0:yyyy-MM-dd HH:mm:ss}】",
jobRow["LAST_START_DATE"]);
this.lblRunInfo2.Text = string.Format("下次执行时间:【{0:yyyy-MM-dd HH:mm:ss}】",
jobRow["NEXT_RUN_DATE"]);
if ("TRUE" == jobRow["ENABLED"].ToString())
{
this.chkEnabled.Checked = true;
}
else
{
this.lblRunInfo2.Text = "下次执行时间:【】";
}
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
private void btnSave_Click(object sender, EventArgs e)
{
try
{
DialogResult dialogResult = MessageBox.Show("保存后将直接修改设置,是否继续", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (dialogResult != System.Windows.Forms.DialogResult.Yes)
{
return;
}
// 异步处理,获取系统参数信息
ClientRequestEntity cre = new ClientRequestEntity();
cre.NameSpace = "FPC1201";
cre.Name = "SetFPC1204Data";
cre.Request = string.Format("Freq=Monthly;Interval=1;ByMonthDay={0:00};ByHour={1:00};ByMinute={2:00}", this.txtSDay.Value, this.txtSHour.Value, this.txtSMi.Text);
cre.Properties["Enabled"] = (this.chkEnabled.Checked ? "1" : "0");
ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
{
return PCModuleProxyNew.Service.HandleRequest(cre);
}
);
if (sre.Status == Constant.ServiceResultStatus.Success)
{
MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
// 关闭窗体
this.Close();
}
else
{
MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "保存"),
this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
catch (Exception ex)
{
// 对异常进行共通处理
ExceptionManager.HandleEventException(this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
}
}
}
}