using System;
using System.ServiceModel;
using System.ServiceModel.Activation;
using Dongke.IBOSS.PRD.Service.SAPHegiiDataService;
using Dongke.IBOSS.PRD.WCF.Contracts;
using Dongke.IBOSS.PRD.WCF.DataModels;
namespace Dongke.IBOSS.PRD.WCF.Services
{
///
/// SAP数据接口
///
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(ConfigurationName = "SAPDataService",
InstanceContextMode = InstanceContextMode.PerCall,
ConcurrencyMode = ConcurrencyMode.Multiple,
UseSynchronizationContext = false)]
public class SAPDataService : ServicesBase, ISAPData
{
#region 共通接口
///
/// 共通接口
///
///
///
public ServiceResultEntity DoRequest(ClientRequestEntity cre)
{
try
{
#region Hegii
if ("Hegii" == cre.NameSpace)
{
// 获取同步最后一次同步成功的日期
if ("GetLastDateByCode" == cre.Name)
{
string dataCode = cre.Request + "";
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.GetLastDateByCode(dataCode));
return result;
}
// 获取成品交接同步数据
if ("GetWorkData60" == cre.Name)
{
DateTime date = (DateTime)cre.Request;
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.GetWorkData60(date));
return result;
}
// 同步成品交接数据
if ("SetWorkData60" == cre.Name)
{
DateTime date = (DateTime)cre.Request;
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.SetWorkData60(date, cre.Data.Tables[0], SUserInfo.UserID));
return result;
}
// 查询同步日志
if ("GetDataLog" == cre.Name)
{
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.GetDataLog(cre));
return result;
}
// 查询产量同步明细
if ("GetWorkDataByDataLog" == cre.Name)
{
int logid = Convert.ToInt32(cre.Request);
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.GetWorkDataByDataLog(logid));
return result;
}
// 查询
if ("GetWorkDataSPSumByDate" == cre.Name)
{
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.GetWorkDataSPSumByDate(cre));
return result;
}
// 查询成品条码同步明细
if ("GetFinishedProductByDataLog" == cre.Name)
{
int logid = Convert.ToInt32(cre.Request);
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.GetFinishedProductByDataLog(logid));
return result;
}
// 同步产量数据
if ("SetWorkData10_50" == cre.Name)
{
DateTime date = (DateTime)cre.Request;
string datacode = cre.Properties["datacode"] + "";
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.SetWorkData10_50(date, datacode, SUserInfo.UserID));
return result;
}
// 同步成品条码明细数据
if ("SetFP6001" == cre.Name)
{
DateTime date = (DateTime)cre.Request;
//if (date.Year < 2018)
//{
// ServiceResultEntity result1 = ServiceInvoker.Invoke(this,
// () => SAPDataLogic.SetFP6001_1(date, SUserInfo.UserID));
// return result1;
//}
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.SetFP6001(date, SUserInfo.UserID));
return result;
}
// 同步成品条码明细数据
if ("SetFP6002" == cre.Name)
{
DateTime date = (DateTime)cre.Request;
ServiceResultEntity result = ServiceInvoker.Invoke(this,
() => SAPDataLogic.SetFP6002(date, SUserInfo.UserID));
return result;
}
return null;
}
#endregion
return null;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region Hegii
/////
///// 获取同步最后一次同步成功的日期
/////
/////
//public ServiceResultEntity GetLastDateBy(string dataCode)
//{
// try
// {
// }
// catch (Exception ex)
// {
// throw ex;
// }
//}
#endregion
}
}