| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- /*******************************************************************************
- * Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_SAP_HEGII_010301.cs
- * 2.功能描述:手动同步
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2018/11/16 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.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.SAPDataModule
- {
- public partial class F_SAP_HEGII_010301 : FormBase
- {
- public F_SAP_HEGII_010301(string date, string datacode)
- {
- InitializeComponent();
- DataTable datacodes = new DataTable();
- datacodes.Columns.Add("datacode");
- datacodes.Columns.Add("datacodeName");
- datacodes.Rows.Add("10", "模具");
- datacodes.Rows.Add("20", "湿坯");
- datacodes.Rows.Add("30", "精坯");
- datacodes.Rows.Add("40", "釉坯");
- datacodes.Rows.Add("50", "烧成");
- datacodes.Rows.Add("6001", "成品明细");
- datacodes.Rows.Add("6002", "成品明细(小时)");
- cmbDataCode.ValueMember = "datacode";
- cmbDataCode.DisplayMember = "datacodeName";
- cmbDataCode.DataSource = datacodes;
- if (string.IsNullOrEmpty(date))
- {
- this.dtpSynTime.Value = DateTime.Now;
- }
- //else
- //{
- // this.dtpDatebegin.Value = DateTime.ParseExact(date, "yyyyMMdd HH:mm", null);
- //}
- if (!string.IsNullOrEmpty(datacode))
- {
- cmbDataCode.SelectedValue = datacode;
- }
- }
- private void btnCancel_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.Cancel;
- this.Close();
- }
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- string datacode = cmbDataCode.SelectedValue + "";
- string datacodename = cmbDataCode.Text;
- string date = this.dtpSynTime.Value.ToString("yyyyMMdd HH:mm");
- DialogResult dr = MessageBox.Show("是否同步【" + date + "】的【" + datacodename + "】数据。",
- this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
- if (dr != DialogResult.Yes)
- {
- return;
- }
- ServiceResultEntity sre = null;
- if (datacode == "6001")
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "Hegii";
- cre.Name = "SetFP6001";
- //cre.Request = DateTime.ParseExact(date, "yyyyMMdd", null);
- cre.Request = this.dtpSynTime.Value.Date;
- sre = (ServiceResultEntity)DoAsync(() =>
- {
- return SAPDataModuleProxy.Service.DoRequest(cre);
- }
- );
- }
- else if (datacode == "6002")
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "Hegii";
- cre.Name = "SetFP6002";
- //cre.Request = DateTime.ParseExact(date, "yyyyMMdd", null);
- cre.Request = this.dtpSynTime.Value.Date;
- sre = (ServiceResultEntity)DoAsync(() =>
- {
- return SAPDataModuleProxy.Service.DoRequest(cre);
- }
- );
- }
- else
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "Hegii";
- cre.Name = "SetWorkData10_50";
- //cre.Request = DateTime.ParseExact(date, "yyyyMMdd", null);
- cre.Request = this.dtpSynTime.Value;
- cre.Properties["datacode"] = datacode;
- sre = (ServiceResultEntity)DoAsync(() =>
- {
- return SAPDataModuleProxy.Service.DoRequest(cre);
- });
- }
- if (sre == null)
- {
- MessageBox.Show("数据同步失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (sre.Status == Constant.ServiceResultStatus.Other)
- {
- MessageBox.Show("数据同步失败\n" + sre.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre.Result + "" == "S")
- {
- MessageBox.Show("数据同步成功。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
- else
- {
- MessageBox.Show("数据同步失败\n" + sre.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else
- {
- MessageBox.Show("数据同步失败。", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|