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 static void SendEmail(MailEntity mailEntity) { try { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; MailInfo mInfo = new MailInfo(); mInfo.Subject = mailEntity.Subject; mInfo.Body = mailEntity.Body; mInfo.FromName = mailEntity.From; mInfo.ToName = mailEntity.To; mInfo.CCName = mailEntity.CC; mInfo.Priority = 1; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; var ar = client.Create("/Message/SendMail", mInfo, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { throw new Exception(error.Faults[0].ErrorDescription); } } catch (Exception ex) { string errorLog = ConfigurationManager.AppSettings["ErrorLog"]; Log.WriteLog("邮件发送失败!\r\n" + ex.ToString(), errorLog); } }
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; } } }
/// <summary> /// 赠送客户积分校验 /// </summary> /// <param name="pointRequest"></param> public static void PresentedCustomerPointPrecheck(AdjustPointRequestInfo pointRequest) { if (pointRequest == null) { 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 = "/InvoiceService/Job/AdjustPointPreCheck"; var ar = client.Create(relativeUrl, pointRequest, 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()); } }
static void Main(string[] args) { try { SendCommentPointsBP.jobContext = new JobContext(); SendCommentPointsBP.BizLogFile = ConfigurationManager.AppSettings["BizLogFile"]; new SendCommentPointsBP().Process(); Log.WriteLog("最有用评论处理完成", "Log\\ServiceInfo.txt"); } catch (Exception ex) { //MailHelper.SendMail(ex.ToString(), "最有用评论Job出现异常,请联系管理员!"); string baseUrl = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; ECCentral.BizEntity.Common.MailInfo mInfo = new ECCentral.BizEntity.Common.MailInfo(); mInfo.Subject = "最有用评论Job出现异常,请联系管理员!"; mInfo.Body = ex.ToString(); mInfo.FromName = ConfigurationManager.AppSettings["EmailFrom"]; mInfo.ToName = ConfigurationManager.AppSettings["EmailTo"]; mInfo.CCName = ConfigurationManager.AppSettings["EmailCC"]; mInfo.Priority = 1; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; var ar = client.Create("/Message/SendMail", mInfo, out error); Log.WriteLog(ex.ToString(), "Log\\ServiceInfo.txt"); } }
/// <summary> /// 团购开始,结束 后都需要验证销售规则内差价是否小于0 /// </summary> /// <param name="item"></param> private static void CheckSaleRule(int productSysNo) { //IMaintainSaleRuleV31 service = ServiceBroker.FindService<IMaintainSaleRuleV31>(); try { //SaleRuleV31 saleRule = new SaleRuleV31(); //saleRule.Body = new SaleRuleMsg(); //saleRule.Body.ProductSysNo = productSysNo; //saleRule.Header = new Newegg.Oversea.Framework.Contract.MessageHeader(); //saleRule.Header.CompanyCode = AppConfig.CompanyCode; //saleRule.Header.OperationUser = AppConfig.GetOperationUser(); //service.CheckSaleRulePrice(saleRule); string baseUrl = System.Configuration.ConfigurationManager.AppSettings["MKTRestFulBaseUrl"]; 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.Create("/Combo/CheckComboPriceAndSetStatus", productSysNo, out error); } catch (Exception ex) { throw new BusinessException(ex.Message); } finally { //ServiceBroker.DisposeService(service); } }
public void Run(Newegg.Oversea.Framework.JobConsole.Client.JobContext context) { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["RestFulBaseUrl"]; ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl); client.AsyncUpdate("/SO/Job/InsertKnownFraudCustomer", null, () => { }); }
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); }
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); client.Timeout = 100000; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; companyCode = companyCode == null ? null : (companyCode.Trim() == String.Empty ? null : companyCode.Trim()); ECCentral.Job.Utility.RestServiceError error; List <WaitDeclareSO> waitDeclareSOList = new List <WaitDeclareSO>(); client.Query <List <WaitDeclareSO> >("/SO/Job/GetWaitDeclareSO", out waitDeclareSOList, out error); if (waitDeclareSOList != null && waitDeclareSOList.Count > 0) { int totalDeclareCnt = waitDeclareSOList.Count; int successCnt = 0; int failCnt = 0; waitDeclareSOList = waitDeclareSOList.FindAll(m => !string.IsNullOrWhiteSpace(m.TrackingNumber)); foreach (var item in waitDeclareSOList) { bool bResult = false; client.Query("/SO/Job/DeclareSO", item, out bResult, out error); if (error != null) { string errorMessage = ""; foreach (var errItem in error.Faults) { errorMessage = errItem.ErrorDescription; } throw new Exception(error.StatusDescription + errorMessage); } if (bResult) { successCnt++; } else { failCnt++; } } context.Message = string.Format("总申报数量:{0},成功数量:{1},失败数量:{2}", totalDeclareCnt, successCnt, failCnt); } else { context.Message = "总申报数量:0"; } }
//[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); }
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()); int Cnt = int.Parse(System.Configuration.ConfigurationManager.AppSettings["SigleCount"]); ECCentral.Job.Utility.RestServiceError error; List <string> trackingNumberList = new List <string>(); client.Query <List <string> >("/SO/Job/GetWaitingFinishShippingList", ExpressType.KD100, out trackingNumberList, out error); if (trackingNumberList != null && trackingNumberList.Count > 0) { trackingNumberList = trackingNumberList.FindAll(m => !string.IsNullOrWhiteSpace(m)); for (int i = 0; i < trackingNumberList.Count; i = i + Cnt) { List <string> currHandleList = new List <string>(); int thisCnt = i + Cnt; for (int j = i; j < thisCnt; j++) { if (j >= trackingNumberList.Count) { break; } currHandleList.Add(trackingNumberList[j]); } object obj = new object(); client.Query("/SO/Job/QueryTracking", new ExpressQueryEntity() { Type = ExpressType.KD100, TrackingNumberList = trackingNumberList }, out obj, out error); //if (error != null) //{ // ECCentral.Job.Utility.Logger.WriteLog("Service:" + error.ToString(), "ECCentral.Job.SO.KD100Express"); //} } } }
/// <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()); } }
/// <summary> /// 发送内部邮件 /// </summary> /// <param name="mailList">内部邮件实体列表</param> public static void SendMail(List <MailInfo> mailList) { string baseUrl = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"]; 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; foreach (MailInfo mailInfo in mailList) { mailInfo.FromName = JobConfig.SendMailAddress; if (string.IsNullOrEmpty(mailInfo.ToName)) { throw new Exception("收件人为空"); } else { mailInfo.ToName = mailInfo.ToName.Trim(); } mailInfo.IsHtmlType = false; mailInfo.IsAsync = true; mailInfo.IsInternal = true; var ar = client.Create("/Message/SendMail", mailInfo, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { string errorMsg = ""; foreach (var errorItem in error.Faults) { errorMsg += errorItem.ErrorDescription; } throw new Exception("发送邮件异常:" + errorMsg); } } }
private static List <ErpOrder> CallCreateSOIncomeService(List <ErpOrder> orderList) { //获取配置参数 string baseUrl = System.Configuration.ConfigurationManager.AppSettings["RestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; int? UserSysNo = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["UserSysNo"]); ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; foreach (var item in orderList) { SOIncomeInfo so = new SOIncomeInfo { OrderType = SOIncomeOrderType.SO, OrderSysNo = Convert.ToInt32(item.RefOrderNo), OrderAmt = item.OrderAmt, IncomeStyle = SOIncomeOrderStyle.Normal, IncomeAmt = item.OrderAmt, PrepayAmt = 0, Status = SOIncomeStatus.Origin, PayAmount = item.OrderAmt, CompanyCode = "8601" }; var ar = client.Create("/InvoiceService/SOIncome/CreatSOIncome", so, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { string errorMsg = string.Empty; foreach (var errorItem in error.Faults) { errorMsg += errorItem.ErrorDescription; } OnShowInfo(errorMsg); } } return(orderList); }
private static List <ERPShippingInfo> CallSystemCreateService(List <ERPShippingInfo> orderList) { //获取配置参数 string baseUrl = System.Configuration.ConfigurationManager.AppSettings["RestFulBaseUrl"]; string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"]; string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"]; int? UserSysNo = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["UserSysNo"]); ECCentral.Job.Utility.RestClient client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode); ECCentral.Job.Utility.RestServiceError error; var ar = client.Create <List <ERPShippingInfo> >("/ExternalSYSService/ERP/GetERPShippingInfoByRefOrder", orderList, out orderList, out error); if (error != null && error.Faults != null && error.Faults.Count > 0) { string errorMsg = string.Empty; foreach (var errorItem in error.Faults) { errorMsg += errorItem.ErrorDescription; } OnShowInfo(errorMsg); } return(orderList); }
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 }
public static void AddShowCommentPointForCustomersFromMKT(List <CustomerInfo> customersPoint, BBSTopicMaster comment) { if (customersPoint == null || customersPoint.Count == 0) { return; } List <ECCentral.BizEntity.Customer.CustomerPointsAddRequest> request = new List <ECCentral.BizEntity.Customer.CustomerPointsAddRequest>(); customersPoint.ForEach(c => { request.Add(new ECCentral.BizEntity.Customer.CustomerPointsAddRequest() { CustomerSysNo = c.CustomerSystemNumber, Point = c.CustomerGotPoint, PointType = 16, NewEggAccount = "MKT-topic", Memo = comment.CommentSysNo.ToString(), Note = "后台设置屏蔽的评论为展示" }); }); string baseUrl = System.Configuration.ConfigurationManager.AppSettings["CustomerRestFulBaseUrl"]; 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.Create("/Point/BatchAdjustPoint", request, 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, "IPP.MKT.AutoNewsReplyIsShow"); } //IBatchAdjustPointV31 service = ServiceBroker.FindService<IBatchAdjustPointV31>(); //BatchMessageV31<AdjustPointRequestMsg> actionPara = new BatchMessageV31<AdjustPointRequestMsg>() //{ // Messages = (from item in customersPoint // select new AdjustPointRequestMsg() // { // CustomerSysNo = item.CustomerSystemNumber, // Point = item.CustomerGotPoint, // PointLogType = 16, // NewEggAccount = "MKT-topic", // Memo = comment.CommentSysNo.ToString(), // Note = "后台设置屏蔽的评论为展示" // }).ToList() //}; //actionPara.Header = new MessageHeader(); //actionPara.Header.CompanyCode = CompanyCode; //actionPara.Header.Language = "zh-CN"; //actionPara.Header.OperationUser = new OperationUser(); //actionPara.Header.OperationUser.CompanyCode = CompanyCode; //actionPara.Header.OperationUser.LogUserName = "******"; //actionPara.Header.OperationUser.UniqueUserName = "******"; //actionPara.Header.OperationUser.SourceUserName = "******"; //actionPara.Header.OperationUser.FullName = "IPPSystemAdmin"; //actionPara.Header.OperationUser.SourceDirectoryKey = "bitkoo"; //DefaultDataContract result = service.BatchAdjustPoint(actionPara); //ServiceAdapterHelper.DealServiceFault(result); }
public static void BatchAdjustPointService(List <CustomerPointsAddRequest> body) { if (body == null || body.Count == 0) { return; } string pointLog = string.Empty; //IAdjustPointV31 service = ServiceBroker.FindService<IAdjustPointV31>(); //BatchActionRequest<AdjustPointRequestMsg> actionPara = new BatchActionRequest<AdjustPointRequestMsg>(); //actionPara.Body = new List<CustomerPointsAddRequest>(); //foreach (var item in body) //{ // AdjustPointRequestMsg msg = new AdjustPointRequestMsg() // { // CustomerSysNo = item.CustomerSysNo, // Point = item.Point, // PointType = (AdjustPointType)item.PointLogType, // NewEggAccount = item.NewEggAccount, // Memo = item.Memo + "," + item.Note, // OrderSysNo = item.SOSysNo, // Source = "ECommerceMgmt", // OperationType = 0 // }; // pointLog += "CustomerSysNo=" + item.CustomerSysNo + ", Point=" + item.Point + " ,PointType=" + item.PointLogType + ",SOSysNo=" + item.SOSysNo + ";\r\n"; // actionPara.Body.Add(msg); //} //actionPara.Header = new Newegg.Oversea.Framework.Contract.MessageHeader(); //actionPara.Header.CompanyCode = AppConfigHelper.CompanyCode; //actionPara.Header.Language = "zh-CN"; //actionPara.Header.OperationUser = new Newegg.Oversea.Framework.Contract.OperationUser(); //actionPara.Header.OperationUser.CompanyCode = AppConfigHelper.CompanyCode; //actionPara.Header.OperationUser.LogUserName = "******"; //actionPara.Header.OperationUser.UniqueUserName = "******"; //actionPara.Header.OperationUser.SourceUserName = "******"; //actionPara.Header.OperationUser.FullName = "IPPSystemAdmin"; //actionPara.Header.OperationUser.SourceDirectoryKey = "bitkoo"; //BatchActionResponse<AdjustPointRequestMsg> result = service.BatchAdjustPoint(actionPara); //MessageFaultCollection faults = GetMessageFaults(result); //ServiceAdapterHelper.DealServiceFault(faults); body.ForEach(e => { pointLog += "CustomerSysNo=" + e.CustomerSysNo + ", Point=" + e.Point + " ,SOSysNo=" + e.SOSysNo + ";\r\n"; }); string baseUrl = System.Configuration.ConfigurationManager.AppSettings["CustomerRestFulBaseUrl"]; 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.Create("/Point/BatchAdjustPoint", body, out error); if (error == null && error.Faults == null && error.Faults.Count == 0) { WriteLog("新蛋大使发订单积分成功,发放记录:\r\n" + pointLog); } else { WriteLog("Error:\r\n" + error.Faults[0].ErrorDescription); } }