private static ZeroConfirmSOIncomeJobResp CallRestfulService(List <SOIncomeInfo> lstSOIncome) { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["InvoiceRestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; string relativeUrl = "/SOIncome/BatchConfirmJob"; ZeroConfirmSOIncomeJobResp response = null; List <int> lstSOIncomeSysNo = new List <int>(); foreach (SOIncomeInfo item in lstSOIncome) { lstSOIncomeSysNo.Add(item.SysNo.Value); } var ar = client.Update <ZeroConfirmSOIncomeJobResp>(relativeUrl, lstSOIncomeSysNo, out response, out error); var messageBuilder = new StringBuilder(); if (error != null && error.Faults != null && error.Faults.Count > 0) { foreach (var errorItem in error.Faults) { messageBuilder.AppendFormat(" {0} <br/>", errorItem.ErrorDescription); } throw new Exception(messageBuilder.ToString()); } return(response); }
public void Run(JobContext context) { //SOAutoAuditBP.AuditSO(context); string baseUrl = System.Configuration.ConfigurationManager.AppSettings["SORestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; int auditUserSysNo = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["AuditUserSysNo"]); ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; JobAutoAuditSOReq req = new JobAutoAuditSOReq(); req.CompanyCode = companyCode; req.AutoAuditUserSysNo = auditUserSysNo; //特定用户的订单不检查,比如Intel订单,#代表不过滤 req.Interorder = "#"; var ar = client.Update("/SO/Job/AutoAuditSO", req, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { foreach (var errorItem in error.Faults) { context.Message += errorItem.ErrorDescription; } } }
public void Run(JobContext context) { //SOFPCheckBP.Check(context); string baseUrl = System.Configuration.ConfigurationManager.AppSettings["SORestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; JobFPCheckReq req = new JobFPCheckReq(); //特定用户的订单不检查,比如Intel订单,#代表不过滤 req.Interorder = "#"; req.CompanyCode = companyCode; req.IgnoreCustomIDList = new List <string>(); req.OutStockList = new List <int>(); var ar = client.Update("/SO/Job/FPCheck", req, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { foreach (var errorItem in error.Faults) { context.Message += errorItem.ErrorDescription; } } }
public void Run(Newegg.Oversea.Framework.JobConsole.Client.JobContext context) { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["RestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; var ar = client.Update("/SO/Job/CreateBuyMobileSettlementSO", null, out error); }
public static bool BlankOutSO(int SoSysNo) { //IMaintainSOV31 service = ServiceBroker.FindService<IMaintainSOV31>(); try { // SOV31 actionPara = new SOV31() //{ // Header = new Newegg.Oversea.Framework.Contract.MessageHeader() // { // OperationUser = new OperationUser // (Settings.UserDisplayName, // Settings.UserLoginName, // Settings.StoreSourceDirectoryKey, // Settings.CompanyCode), // CompanyCode = Settings.CompanyCode, // StoreCompanyCode=Settings.CompanyCode, // FromSystem = "127.0.0.1" // } // , // Body = new SOMsg { SOMaster = new SOMasterMsg { SystemNumber = SoSysNo } } //}; // actionPara = service.EmployeeAbandonSO(actionPara); SOAbandonReq req = new SOAbandonReq(); req.SOSysNoList = new List <int>(); req.SOSysNoList.Add(SoSysNo); req.ImmediatelyReturnInventory = true; req.IsCreateAO = false; string baseUrl = System.Configuration.ConfigurationManager.AppSettings["SORestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; var ar = client.Update("/SO/Abandon", req, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { string tmpSendMessageException = error.Faults[0].ErrorDescription + "\r\n" + error.Faults[0].ErrorCode; WriteLog(string.Format("订单{0}作废失败:\r\n{1}.", SoSysNo, tmpSendMessageException)); return(false); } else { WriteLog(string.Format("订单{0}作废成功.", SoSysNo)); return(true); } } catch (Exception ex) { WriteErrorLog(string.Format("订单[{0}]作废异常\r\n{1}", SoSysNo, ex.Message)); return(false); } }
public void Run(JobContext context) { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["SORestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; //可以传入null ,表示所有 companyCode = companyCode == null ? null : (companyCode.Trim() == String.Empty ? null : companyCode.Trim()); ECCentral.Job.Utility.RestServiceError error; var ar = client.Update("/SO/Job/AbandonNotPayGroupBuySO", companyCode, out error); }
//[RetryErrorHandling] private void ProcessMessagae(string message, SSBProcesser processer) { string serviceName = processer.ProcessService; if (processer.CallType == CallType.SP) { CommonDA.SPProcess(message, serviceName); } else { RequestMessage req = new RequestMessage(); req.Message = message; req.ActionType = processer.ActionType; //IProcessMessage service = ServiceBroker.GetService<IProcessMessage>(serviceName); //try //{ // service.Process(message, processer.ActionType); //} //finally //{ // ServiceBroker.Close(service); //} if (ConfigHelper.RestServiceConfig.RestServices.Contains(processer.ProcessService)) { RestService restServiceConfig = ConfigHelper.RestServiceConfig.RestServices[processer.ProcessService]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(restServiceConfig.BaseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; var ar = client.Update(restServiceConfig.RelativeUrl, req, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { string errorMsg = ""; foreach (var errorItem in error.Faults) { errorMsg += errorItem.ErrorDescription; } ECCentral.Job.Utility.Logger.WriteLog(errorMsg, "JobConsole"); } } else { throw new Exception(string.Format("未找到{0}对应的Rest Service配置!", processer.ProcessService)); } } }
public void Run(Newegg.Oversea.Framework.JobConsole.Client.JobContext context) { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["RestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; //可以传入null ,表示所有 companyCode = companyCode == null ? null : (companyCode.Trim() == String.Empty ? null : companyCode.Trim()); //client.AsyncUpdate("/SO/Job/ProcessFinishedAndInvalidGroupBuySO", companyCode, () => //{ // Console.WriteLine("Processed"); //}); ECCentral.Job.Utility.RestServiceError error; var ar = client.Update("/SO/Job/ProcessFinishedAndInvalidGroupBuySO", companyCode, out error); }
/// <summary> /// 调用Invoice的服务新增单据跟踪信息 /// </summary> /// <param name="trackingInfoList">跟踪信息列表</param> private void CallService(List <TrackingInfo> trackingInfoList) { if (trackingInfoList == null || trackingInfoList.Count == 0) { return; } string baseUrl = System.Configuration.ConfigurationManager.AppSettings["InvoiceMgmtRestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; string relativeUrl = "/Job/BatchCreateTracking"; string resultMsg = string.Empty; var ar = client.Update <string>(relativeUrl, trackingInfoList, out resultMsg, out error); if (!string.IsNullOrEmpty(resultMsg)) { OnDisplayMessage(resultMsg); } var messageBuilder = new StringBuilder(); if (error != null && error.Faults != null && error.Faults.Count > 0) { foreach (var errorItem in error.Faults) { messageBuilder.AppendFormat(" 错误: {0} <br/>", errorItem.ErrorDescription); } } if (messageBuilder.Length > 0) { SendMail(GlobalSettings.MailSubject, messageBuilder.ToString()); throw new Exception(messageBuilder.ToString()); } }
public void Run(JobContext context) { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["RestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); client.Timeout = 100000; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; companyCode = companyCode == null ? null : (companyCode.Trim() == String.Empty ? null : companyCode.Trim()); List <WaitDeclareProduct> productList = new List <WaitDeclareProduct>(); ECCentral.Job.Utility.RestServiceError error; #region 获取审核通过的商品,进行提交商检操作 client.Query <List <WaitDeclareProduct> >("/SO/Job/GetEntryAuditSucess", out productList, out error); if (productList != null && productList.Count > 0) { for (int i = 0; i < productList.Count; i += 10) { client.Update("/SO/Job/MarkInInspection", productList.Skip(i).Take(10).ToList(), out error); if (error != null) { string errorMessage = "商品申请商检:"; foreach (var errItem in error.Faults) { errorMessage += errItem.ErrorDescription; } context.Message += errorMessage + "\r\n"; } } } else { context.Message += "商品申请商检数量:0" + "\r\n"; } #endregion #region 获取商检中的商品,进行商检通过操作 client.Query <List <WaitDeclareProduct> >("/SO/Job/GetInInspectionProduct", out productList, out error); if (productList != null && productList.Count > 0) { for (int i = 0; i < productList.Count; i += 10) { client.Update("/SO/Job/MarkSuccessInspection", productList.Skip(i).Take(10).ToList(), out error); if (error != null) { string errorMessage = "商品通过商检:"; foreach (var errItem in error.Faults) { errorMessage += errItem.ErrorDescription; } context.Message += errorMessage + "\r\n"; } } } else { context.Message += "商品通过商检数量:0" + "\r\n"; } #endregion #region 获取商检通过的商品,进行报关申请 client.Query <List <WaitDeclareProduct> >("/SO/Job/GetWaitDeclareProduct", out productList, out error); if (productList != null && productList.Count > 0) { var group = productList.GroupBy(t => t.MerchantSysNo); var enumerator = group.GetEnumerator(); while (enumerator.MoveNext()) { var pList = enumerator.Current.ToList(); int totalDeclareCnt = pList.Count; int successCnt = 0; int failCnt = 0; for (int i = 0; i < pList.Count; i += 10) { DeclareProductResult bResult; var data = pList.Skip(i).Take(10).ToList(); client.Query("/SO/Job/DeclareProduct", data, out bResult, out error); if (error != null) { string errorMessage = "商品申请报关:"; foreach (var errItem in error.Faults) { errorMessage += errItem.ErrorDescription; } context.Message += errorMessage + "\r\n"; } if (bResult.Success) { successCnt += data.Count; } else { failCnt += data.Count; } context.Message += bResult.Message + "\r\n"; } context.Message += string.Format("商家【{3}】商品总申报数量:{0},成功数量:{1},失败数量:{2}", totalDeclareCnt, successCnt, failCnt, enumerator.Current.FirstOrDefault().MerchantSysNo) + "\r\n"; } } else { context.Message += "商品总申报数量:0" + "\r\n"; } #endregion }