예제 #1
0
        public static void AuditNetPay(int soSysNo)
        {
            NetPayV31 message = new NetPayV31
            {
                Header = ServiceAdapterHelper.ApplyMessageHeader(),
                Body   = new NetPayMessage {
                    SOSysNo = soSysNo
                }
            };


            IMaintainNetPayV31 service = ServiceBroker.FindService <IMaintainNetPayV31>();


            try
            {
                //SimpleTypeDataContract<bool> BatchApproveGroupBuy(NetPayV31 msg);
                SimpleTypeDataContract <bool> ResultMsg = service.BatchApproveGroupBuy(message);

                ServiceAdapterHelper.DealServiceFault(ResultMsg.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IMaintainNetPayV31>(service);
            }
        }
예제 #2
0
        /// <summary>
        /// 作废订单
        /// </summary>
        /// <param name="soNumber"></param>
        public static void AbandonSO(int soNumber)
        {
            SOV31 msg = new SOV31()
            {
                Body = new SOMsg()
                {
                    SOMaster = new SOMasterMsg()
                    {
                        SystemNumber = soNumber
                    }
                },
                Header = ServiceAdapterHelper.ApplyMessageHeader()
            };


            IMaintainSOV31 service = ServiceBroker.FindService <IMaintainSOV31>();

            try
            {
                msg = service.SystemAbandonSO(msg);
                ServiceAdapterHelper.DealServiceFault(msg.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IMaintainSOV31>(service);
            }
        }
예제 #3
0
        private static TaobaoResponse Query(string method, Dictionary <string, string> param)
        {
            ITaoBaoMaintain service = ServiceBroker.FindService <ITaoBaoMaintain>();

            try
            {
                TaoBaoRequest taobaoRequest = new TaoBaoRequest();
                taobaoRequest.param  = param;
                taobaoRequest.method = method;
                taobaoRequest.Header = Util.CreateServiceHeader();
                TaoBaoResponse taoBaoResponse = service.GetTaoBaoInventoryQtyByMethod(taobaoRequest);
                string         response       = taoBaoResponse.CommonReturnStringValue;
                //string response = TaoBaoUtil.Post(param);
                response = response.Replace("items_onsale_get_response>", "items_inventory_get_response>");
                if (string.IsNullOrEmpty(response))
                {
                    throw new Exception("淘宝未返回任何信息。");
                }
                if (response.IndexOf("error_response") > -1)
                {
                    throw new Exception(response);
                }
                TaobaoResponse taobaoResponse = XmlSerializerHelper.Deserializer <TaobaoResponse>(response, CommonConst.taobao_response_encoding);
                return(taobaoResponse);
            }
            finally
            {
                ServiceBroker.DisposeService <ITaoBaoMaintain>(service);
            }
        }
예제 #4
0
        private void SynInvnetoryQty(List <TaoBaoSKUMsg> TaoBaoSKUList)
        {
            TaoBaoRequest request = new TaoBaoRequest();

            request.TaoBaoSKUList = TaoBaoSKUList;
            request.Header        = Util.CreateServiceHeader(Common);
            ITaoBaoMaintain service = ServiceBroker.FindService <ITaoBaoMaintain>();

            try
            {
                TaoBaoResponse response = service.TaoBaoItemQantityUpdate(request);

                if (response != null && response.Faults != null && response.Faults.Count > 0)
                {
                    MessageFault      msg = response.Faults[0];
                    BusinessException ex  = new BusinessException(msg.ErrorCode, string.Format("{0}\r\n{1}", msg.ErrorDescription, msg.ErrorDetail), true);

                    throw ex;
                }
            }
            finally
            {
                ServiceBroker.DisposeService <ITaoBaoMaintain>(service);
            }
        }
예제 #5
0
        public static void WriteLog(List <LogInfo> logInfos)
        {
            ICreateLogV31 service = ServiceBroker.FindService <ICreateLogV31>();

            LogV31 log = new LogV31();

            try
            {
                log.Body = ToMessageList(logInfos);
                if (logInfos != null && logInfos.Count > 0)
                {
                    log.Header = new Newegg.Oversea.Framework.Contract.MessageHeader
                    {
                        CompanyCode = Settings.CompanyCode
                    };
                }
                else
                {
                    log.Header = new Newegg.Oversea.Framework.Contract.MessageHeader();
                }
                service.CreateLog(log);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ServiceBroker.DisposeService <ICreateLogV31>(service);
            }
        }
예제 #6
0
        public static void SendMessage(JobContext jobContext)
        {
            BizLogFile = jobContext.Properties["BizLog"];
            //从配置文件中获取自动审核一次最多提取的单数
            TopCount = GetAutoAuditSendMessageTopCount();
            //从配置文件获取为邮件发送JOB中调用WCF服务时所使用到的信息
            GetAutoAuditSendMessageLoginInfo();
            //自动审单时审单人编号
            AuditUserSysNo = GetAutoAuditUserSysNo();

            List <int> sendMailSysNoList = SOAutoAuditSendMessageDA.GetSOList4Audit2SendMessage(TopCount, SendMailCompanyCode);

            if (sendMailSysNoList.Count > 0)
            {
                jobContext.Message += string.Format("共获取到{0}条附合条件的记录\r\n", sendMailSysNoList.Count);
                WriteLog(string.Format("共获取到{0}条附合条件的记录\r\n", sendMailSysNoList.Count));

                IMaintainSOV31 service      = ServiceBroker.FindService <IMaintainSOV31>();
                int            successCount = 0;
                try
                {
                    foreach (int x in sendMailSysNoList)
                    {
                        try
                        {
                            SendMessage4SO(x, service);
                            successCount++;
                            jobContext.Message += string.Format("已为审单通过成功发送邮件,单号:{0}\r\n", x);
                            WriteLog(string.Format("已为审单通过成功发送邮件,单号:{0}", x));
                        }
                        catch (Exception ex)
                        {
                            jobContext.Message += string.Format("发送邮件异常,单号:{0},异常:\r\n", x, ex.Message);
                            WriteLog(string.Format("发送邮件异常,单号:{0},异常:", x, ex.Message));
                        }
                    }
                }
                finally
                {
                    ServiceBroker.DisposeService <IMaintainSOV31>(service);
                }

                jobContext.Message += string.Format("执行结束,成功{0}条,失败{1}条\r\n",
                                                    successCount, sendMailSysNoList.Count - successCount);
                WriteLog(string.Format("执行结束,成功{0}条,失败{1}条\r\n",
                                       successCount, sendMailSysNoList.Count - successCount));
            }
            else
            {
                jobContext.Message += string.Format("没有附合条件的记录\r\n");
                WriteLog("没有附合条件的记录\r\n");
            }
        }
예제 #7
0
        public static void InStock(POEntity po)
        {
            WMSRequest request = new WMSRequest()
            {
                Header      = ServiceAdapterHelper.ApplyMessageHeader()
                , OrderInfo = new WMSOrderInfo()
                {
                    OrderSysNo        = po.SysNo.Value
                    , OrderType       = "PO"
                    , WarehouseNumber = po.StockSysNo.ToString()
                }
            };

            List <WMSRequestProduct> products = new List <WMSRequestProduct>();

            foreach (var item in po.POItems)
            {
                products.Add(
                    new WMSRequestProduct()
                {
                    Code      = item.ProductID
                    , UnitQty = item.PurchaseQty
                });
            }

            WMSRequestWaitInStock req = new WMSRequestWaitInStock()
            {
                Action          = "ImportAsn"
                , OrderCode     = po.SysNo.ToString()
                , WarehouseCode = po.StockSysNo.ToString()
                , ProductList   = products
            };

            request.WaitInStock = req;

            IWMSMaintain service = ServiceBroker.FindService <IWMSMaintain>();

            try
            {
                WMSResponse response = service.WaitInStock(request);
                ServiceAdapterHelper.DealServiceFault(response.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IWMSMaintain>(service);
            }
        }
예제 #8
0
        /// <summary>
        /// 发送带附件的邮件
        /// </summary>
        /// <returns></returns>
        public static void SendMailWithAccessories(MailContract mailContract)
        {
            ISendEmail service = ServiceBroker.FindService <ISendEmail>();

            try
            {
                bool isSuccess = service.SendMail(mailContract, false);
                mailContract.Attachments.Clear();           //清空附件列表

                if (!isSuccess)
                {
                    throw (new BusinessException("Invoice job(SendMailARAmtOfVIPCustomer) Send mail failed!"));
                }
            }
            finally
            {
                ServiceBroker.DisposeService <ISendEmail>(service);
            }
        }
예제 #9
0
        /// <summary>
        /// 更新订单
        /// </summary>
        /// <param name="soSysNo"></param>
        public static void UpdateSO4GroupBuying(int soSysNo)
        {
            SimpleTypeDataContract <int> SysNo = new SimpleTypeDataContract <int>
            {
                Value  = soSysNo,
                Header = ServiceAdapterHelper.ApplyMessageHeader()
            };


            IMaintainSOV31 service = ServiceBroker.FindService <IMaintainSOV31>();

            try
            {
                DefaultDataContract msg = service.UpdateSO4GroupBuying(SysNo);
                ServiceAdapterHelper.DealServiceFault(msg.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IMaintainSOV31>(service);
            }
        }
예제 #10
0
        private void SynInvnetoryQty(List <InventoryQtyEntity> inventoryQtyList)
        {
            TaoBaoRequest request = new TaoBaoRequest();

            request.TaoBaoSKUList = new List <TaoBaoSKUMsg>();

            foreach (InventoryQtyEntity entity in inventoryQtyList)
            {
                TaoBaoSKUMsg skuMsg = new TaoBaoSKUMsg();
                skuMsg.Quantity = entity.SynInventoryQty.ToString();
                skuMsg.Type     = "2";
                skuMsg.SKU      = entity.SKU;
                request.TaoBaoSKUList.Add(skuMsg);
            }
            request.Header = Util.CreateServiceHeader();
            ITaoBaoMaintain service = ServiceBroker.FindService <ITaoBaoMaintain>();

            try
            {
                TaoBaoResponse response = service.TaoBaoItemQantityUpdate(request);

                if (response != null && response.Faults != null && response.Faults.Count > 0)
                {
                    MessageFault      msg = response.Faults[0];
                    BusinessException ex  = new BusinessException(msg.ErrorCode, string.Format("{0}\r\n{1}", msg.ErrorDescription, msg.ErrorDetail), true);

                    throw ex;
                }
            }
            catch (Exception ex)
            {
                ExceptionHelper.HandleException(ex);
                throw ex;
            }
            finally
            {
                ServiceBroker.DisposeService <ITaoBaoMaintain>(service);
            }
        }
예제 #11
0
        public static void UpdateSO4GroupBuyingV2(int soSysNo, int gourpBuySysNo, int productSysNo)
        {
            SOGroupBuyAjustV31 message = new SOGroupBuyAjustV31()
            {
                Body = new SOGroupBuyAjustMsg(), Header = ServiceAdapterHelper.ApplyMessageHeader()
            };

            message.Body.SOSysNo       = soSysNo;
            message.Body.GroupBuySysNo = gourpBuySysNo;
            message.Body.ProductSysNo  = productSysNo;

            IMaintainSOV31 service = ServiceBroker.FindService <IMaintainSOV31>();

            try
            {
                DefaultDataContract msg = service.UpdateSO4GroupBuyingV2(message);
                ServiceAdapterHelper.DealServiceFault(msg.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <IMaintainSOV31>(service);
            }
        }
예제 #12
0
        public static void CreateAO(int soSysNo)
        {
            FinanceIncomeV31 message = new FinanceIncomeV31
            {
                Header = ServiceAdapterHelper.ApplyMessageHeader(),
                Body   = new FinanceIncomeMessage()
            };

            message.Body.SOIncome = new SOIncomeMessage
            {
                OrderSysNo = soSysNo
            };

            message.Body.SOIncomeRefund = new SOIncomeRefundMessage
            {
                Note          = "团购订单作废",
                RefundReason  = null,
                RefundPayType = SOIncomeRefundPayType.PrepayRefund
            };

            message.Body.Type = FinanceIncomeType.AO;


            ICreateSOIncomeRefundV31 service = ServiceBroker.FindService <ICreateSOIncomeRefundV31>();


            try
            {
                SimpleTypeDataContract <bool> ResultMsg = service.CreateNegativeFinanceIncome(message);

                ServiceAdapterHelper.DealServiceFault(ResultMsg.Faults);
            }
            finally
            {
                ServiceBroker.DisposeService <ICreateSOIncomeRefundV31>(service);
            }
        }