F_PC_1204.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*******************************************************************************
  2. * Copyright(c) 2014 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_PC_1204.cs
  5. * 2.功能描述:模具库存自动结转设置
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 陈晓野 2017/12/14 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Data;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. using Dongke.IBOSS.PRD.Client.CommonModule;
  15. using Dongke.IBOSS.PRD.Client.Controls;
  16. using Dongke.IBOSS.PRD.WCF.DataModels;
  17. using Dongke.IBOSS.PRD.WCF.Proxys;
  18. namespace Dongke.IBOSS.PRD.Client.PCModule
  19. {
  20. /// <summary>
  21. /// 模具库存自动结转设置
  22. /// </summary>
  23. public partial class F_PC_1204 : DKFormBase
  24. {
  25. /// <summary>
  26. /// 模具库存自动结转设置
  27. /// </summary>
  28. public F_PC_1204()
  29. {
  30. InitializeComponent();
  31. this.Text = "模具库存自动结转设置";
  32. }
  33. private void btnCancel_Click(object sender, EventArgs e)
  34. {
  35. this.Close();
  36. }
  37. private void F_MST_040101_Load(object sender, EventArgs e)
  38. {
  39. try
  40. {
  41. // 异步处理,获取系统参数信息
  42. ClientRequestEntity cre = new ClientRequestEntity();
  43. cre.NameSpace = "FPC1201";
  44. cre.Name = "GetFPC1204Data";
  45. // 调用服务器端获取数据集(DataSet)DoAsync(new BaseAsyncMethod(GetSystemData));
  46. //ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
  47. // {
  48. // return CommonModuleProxy.Service.DoRequest(cre);
  49. // }
  50. //);
  51. ServiceResultEntity sre = PCModuleProxyNew.Service.HandleRequest(cre);
  52. if (sre.Status == Constant.ServiceResultStatus.Success &&
  53. sre.Data != null && sre.Data.Tables.Count > 0 && sre.Data.Tables[0].Rows.Count > 0)
  54. {
  55. DataRow jobRow = sre.Data.Tables[0].Rows[0];
  56. string[] infos = jobRow["REPEAT_INTERVAL"].ToString().Split(';');
  57. foreach (string item in infos)
  58. {
  59. if (item.StartsWith("ByMonthDay="))
  60. {
  61. this.txtCDay.Text = item.Replace("ByMonthDay=", "");
  62. this.txtSDay.Value = int.Parse(this.txtCDay.Text);
  63. }
  64. else if (item.StartsWith("ByHour="))
  65. {
  66. this.txtCHour.Text = item.Replace("ByHour=", "");
  67. this.txtSHour.Value = int.Parse(this.txtCHour.Text);
  68. }
  69. else if (item.StartsWith("ByMinute="))
  70. {
  71. this.txtCMi.Text = item.Replace("ByMinute=", "");
  72. if ("30" == this.txtCMi.Text)
  73. {
  74. this.txtSMi.SelectedIndex = 1;
  75. }
  76. else
  77. {
  78. this.txtSMi.SelectedIndex = 0;
  79. }
  80. }
  81. }
  82. this.lblRunInfo.Text = string.Format("上次执行时间:【{0:yyyy-MM-dd HH:mm:ss}】",
  83. jobRow["LAST_START_DATE"]);
  84. this.lblRunInfo2.Text = string.Format("下次执行时间:【{0:yyyy-MM-dd HH:mm:ss}】",
  85. jobRow["NEXT_RUN_DATE"]);
  86. if ("TRUE" == jobRow["ENABLED"].ToString())
  87. {
  88. this.chkEnabled.Checked = true;
  89. }
  90. else
  91. {
  92. this.lblRunInfo2.Text = "下次执行时间:【】";
  93. }
  94. }
  95. }
  96. catch (Exception ex)
  97. {
  98. // 对异常进行共通处理
  99. ExceptionManager.HandleEventException(this.ToString(),
  100. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  101. }
  102. }
  103. private void btnSave_Click(object sender, EventArgs e)
  104. {
  105. try
  106. {
  107. DialogResult dialogResult = MessageBox.Show("保存后将直接修改设置,是否继续", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
  108. if (dialogResult != System.Windows.Forms.DialogResult.Yes)
  109. {
  110. return;
  111. }
  112. // 异步处理,获取系统参数信息
  113. ClientRequestEntity cre = new ClientRequestEntity();
  114. cre.NameSpace = "FPC1201";
  115. cre.Name = "SetFPC1204Data";
  116. 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);
  117. cre.Properties["Enabled"] = (this.chkEnabled.Checked ? "1" : "0");
  118. ServiceResultEntity sre = (ServiceResultEntity)DoAsync(() =>
  119. {
  120. return PCModuleProxyNew.Service.HandleRequest(cre);
  121. }
  122. );
  123. if (sre.Status == Constant.ServiceResultStatus.Success)
  124. {
  125. MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
  126. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
  127. // 关闭窗体
  128. this.Close();
  129. }
  130. else
  131. {
  132. MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "保存"),
  133. this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
  134. }
  135. }
  136. catch (Exception ex)
  137. {
  138. // 对异常进行共通处理
  139. ExceptionManager.HandleEventException(this.ToString(),
  140. System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
  141. }
  142. }
  143. }
  144. }