コード例 #1
0
        static void Main(string[] args)
        {
            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"];  //可以传入null ,表示所有

            companyCode = companyCode == null ? null : (companyCode.Trim() == String.Empty ? null : companyCode.Trim());
            string date = DateTime.Now.AddDays(-1).ToString("yyyyMMdd");

            RestServiceError error;
            bool             bResutl = false;

            client.Query("/Job/SyncTradeBillTrade/" + date, out bResutl, out error);

            Console.WriteLine("对账开始");

            if (error != null)
            {
                string errorMessage = "";
                foreach (var errItem in error.Faults)
                {
                    errorMessage = errItem.ErrorDescription;
                    Console.WriteLine("error " + errorMessage);
                }
                throw new Exception(error.StatusDescription + errorMessage);
            }
            Console.WriteLine("对账结束");
            Console.ReadLine();
        }
コード例 #2
0
        /// <summary>
        /// 调用PO的系统创建代销结算单服务
        /// </summary>
        private void CallSystemCreateService(IList <ConsignSettlementInfo> vendorSettleList)
        {
            if (vendorSettleList == null || vendorSettleList.Count == 0)
            {
                return;
            }

            //获取配置参数
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["PORestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];
            int?   UserSysNo    = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["UserSysNo"]);

            foreach (var item in vendorSettleList)
            {
                ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
                ECCentral.Job.Utility.RestServiceError error;
                var ar = client.Create("/ConsignSettlement/CreateConsignSettlementBySystem", item, 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;
                    }
                    OnDisplayMessage(errorMsg);
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="companyCode">companycode</param>
        /// <param name="isSys">true, system email; false</param>
        /// <param name="mailInfor"></param>
        public static void SendEmail(MailInfo mailInfor)
        {
            if (string.IsNullOrEmpty(mailInfor.ToName))
            {
                return;
            }
            else
            {
                mailInfor.ToName = mailInfor.ToName.Trim();
            }
            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;
            var ar = client.Create("/Message/SendMail", mailInfor, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                //Logger.WriteLog(errorMsg, "JobConsole");
                throw new Exception("发送邮件异常:" + errorMsg);
            }
        }
コード例 #4
0
ファイル: Util.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// Abandon the so by sosysno.
        /// </summary>
        /// <param name="soMaster"></param>
        public static void AbandonSO(int sysNo, JobContext context)
        {
            SOAbandonReq req = new SOAbandonReq();

            req.SOSysNoList = new System.Collections.Generic.List <int> {
                sysNo
            };

            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);
            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 errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                Logger.WriteLog(errorMsg, "JobConsole");
                throw new Exception(errorMsg);
            }
        }
コード例 #5
0
ファイル: Util.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// send the short message to notice the customer
        /// </summary>
        /// <param name="body">short message body</param>
        public static void SendTheShortMessage(SMSInfo body, JobContext context)
        {
            if (string.IsNullOrEmpty(body.CellPhoneNum))
            {
                return;
            }
            else
            {
                body.CellPhoneNum = Util.TrimNull(body.CellPhoneNum);
            }
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"];
            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.Create("/Message/SendSMS", body, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                Logger.WriteLog(errorMsg, "JobConsole");
            }
        }
コード例 #6
0
        static void Main(string[] args)
        {
            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());

            RestServiceError error;

            client.Create("/Inventory/Job/ProductRing", "", out error);

            throw new Exception(error.StatusDescription);
        }
コード例 #7
0
        public static void SendEmail(MailEntity mailEntity)
        {
            try
            {
                MailInfo mailInfor = new MailInfo();
                mailInfor.FromName   = mailEntity.From;
                mailInfor.ToName     = mailEntity.To;
                mailInfor.CCName     = mailEntity.CC;
                mailInfor.BCCName    = mailEntity.BCC;
                mailInfor.Body       = mailEntity.Body;
                mailInfor.Subject    = mailEntity.Subject;
                mailInfor.IsHtmlType = mailEntity.IsBodyHtml;
                mailInfor.IsAsync    = true;
                mailInfor.IsInternal = true;

                if (string.IsNullOrEmpty(mailInfor.ToName))
                {
                    return;
                }
                else
                {
                    mailInfor.ToName = mailInfor.ToName.Trim();
                }
                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;
                var ar = client.Create("/Message/SendMail", mailInfor, out error);
                if (error != null && error.Faults != null && error.Faults.Count > 0)
                {
                    string errorMsg = "";
                    foreach (var errorItem in error.Faults)
                    {
                        errorMsg += errorItem.ErrorDescription;
                    }
                    Logger.WriteLog(errorMsg, "JobConsole");
                }
            }
            catch (Exception ex)
            {
                Logger.WriteLog("邮件发送失败:" + ex.Message, "JobConsole");
            }
        }
コード例 #8
0
        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);
            string companyCode = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];  //可以传入null ,表示所有

            companyCode = companyCode == null ? null : (companyCode.Trim() == String.Empty ? null : companyCode.Trim());

            RestServiceError error;

            client.Create("/Invoice/BatchAbortedPriceChangeByJob", "", out error);

            if (error != null)
            {
                throw new Exception(error.StatusDescription);
            }
        }
コード例 #9
0
ファイル: Util.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// send the email notice custmer leave the comment for product.
        /// </summary>
        /// <param name="sysNo">order sysno</param>
        public static void SendTheAddPointEmail(int soSysNo, 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);
            ECCentral.Job.Utility.RestServiceError error;
            var ar = client.Create("/SO/Job/SendCommentNotifyMail", soSysNo, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                Logger.WriteLog(errorMsg, "JobConsole");
            }
        }
コード例 #10
0
        private static bool CreateNewItemPay(PoSysNoItem item, decimal noUseReturnPoint)
        {
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["InvoiceRestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];

            PayableInfo   payableInfo = new PayableInfo();
            List <POItem> items       = AutoCloseDA.QueryPOItemsForPrint(item.PoSysNo);
            decimal?      totalAmt    = GettoTalAmt(items);
            decimal?      trueAmt     = GettrueAmt(items);

            payableInfo.OrderSysNo            = item.PoSysNo;
            payableInfo.BatchNumber           = 1;
            payableInfo.OrderStatus           = 6;
            payableInfo.OrderType             = PayableOrderType.POAdjust;
            payableInfo.OperationUserFullName = "Job User";
            payableInfo.InStockAmt            = totalAmt - trueAmt - noUseReturnPoint;
            payableInfo.CompanyCode           = companyCode;

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            var ar = client.Update("/Payable/CreateByPO", payableInfo, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                Logger.WriteLog(errorMsg, "JobConsole");

                OnShowInfo(errorMsg);
                OnShowInfo("PO单编号为:" + item.PoSysNo.ToString() + "财务收款单调整失败");
                return(false);
            }
            else
            {
                OnShowInfo("PO单编号为:" + item.PoSysNo.ToString() + "财务收款单调整成功");
                return(true);
            }
        }
コード例 #11
0
        public static bool SendEmail2MailDb(string mailFrom, string mailTo, string ccAddress, string bccAddress, string mailSubject, string mailBody, string companyCode)
        {
            MailInfo mailInfo = new MailInfo();

            mailInfo.FromName = mailFrom;
            mailInfo.ToName   = mailTo;
            mailInfo.CCName   = ccAddress;
            mailInfo.BCCName  = bccAddress;
            mailInfo.Subject  = mailSubject;
            mailInfo.Body     = mailBody;

            if (string.IsNullOrEmpty(mailInfo.ToName))
            {
                return(false);
            }
            else
            {
                mailInfo.ToName = Util.TrimNull(mailInfo.ToName);
            }
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["CommonRestFulBaseUrl"];
            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.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;
                }
                Logger.WriteLog(errorMsg, "JobConsole");
            }
            return(true);
        }
コード例 #12
0
ファイル: Processor.cs プロジェクト: sanlonezhang/ql
        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"];  //可以传入null ,表示所有

            companyCode = companyCode == null ? null : (companyCode.Trim() == String.Empty ? null : companyCode.Trim());

            ECCentral.Job.Utility.RestServiceError error;
            List <int> sysNoList = new List <int>();

            client.Query <List <int> >("/Job/GetSysNoListByRefund", out sysNoList, out error);
            if (sysNoList != null && sysNoList.Count > 0)
            {
                foreach (int sysNo in sysNoList)
                {
                    object obj = new object();
                    client.Query("/Job/QueryRefund/" + sysNo.ToString(), out obj, out error);
                }
            }
        }
コード例 #13
0
ファイル: MonitorBP.cs プロジェクト: sanlonezhang/ql
        //private static void EIMSOper(POEntity PO)
        //{
        //    IEIMSInterfaceService service = null;
        //    try
        //    {
        //        service = ServiceBroker.FindService<IEIMSInterfaceService>(Settings.ConsumerName, Settings.EIMSLocationName);
        //        EIMSMessage<POAttachInfo> entity = new EIMSMessage<POAttachInfo>()
        //        {
        //            Header = new EIMSMessageHeader()
        //            {
        //                UserID = "493",
        //                CompanyCode = Settings.CompanyCode
        //            },
        //            Body = new POAttachInfo()
        //            {
        //                PONumber = PO.SysNo,
        //                InvoiceNumber = PO.PM_ReturnPointSysNo,
        //                UseInvoiceAmount = PO.UsingReturnPoint * -1,
        //                PostTime = System.DateTime.Now,
        //                UseTime = System.DateTime.Now,
        //                C3SysNo = PO.ReturnPointC3SysNo
        //            }
        //        };
        //        var result = service.PostPOCancel(entity);
        //        if (!result.IsSucceed)
        //        {
        //            throw new Exception(result.Error);
        //        }
        //        OnShowInfo(string.Format("采购单{0}需要调整返点成功", PO.SysNo));
        //    }
        //    catch (Exception e)
        //    {
        //        throw e;
        //    }
        //    finally
        //    {
        //        ServiceBroker.DisposeService<IEIMSInterfaceService>(service);
        //    }
        //}
        //public static void EIMSOper(List<POAttachInfo> poAttachEntitys, string userSysNo, int poSysNo)
        //{
        //    EIMSMessageResult returnValue = null;
        //    IEIMSInterfaceService service = null;
        //    try
        //    {
        //        EIMSMessage<List<POAttachInfo>> entity = new EIMSMessage<List<POAttachInfo>>
        //        {
        //            Header = new EIMSMessageHeader()
        //            {
        //                UserID = userSysNo,
        //                CompanyCode = Settings.CompanyCode
        //            },
        //            Body = poAttachEntitys
        //        };

        //        service = ServiceBroker.FindService<IEIMSInterfaceService>(Settings.ConsumerName, Settings.EIMSLocationName);
        //        returnValue = service.PostPOCancel(entity);
        //        if (!returnValue.IsSucceed)
        //        {
        //            throw new Exception(returnValue.Error);
        //        }
        //        OnShowInfo(string.Format("采购单{0}需要调整返点成功", poSysNo));
        //    }
        //    finally
        //    {
        //        ServiceBroker.DisposeService<IEIMSInterfaceService>(service);
        //    }
        //}

        private static void InventoryOper(POEntity poInfo)
        {
            InventoryAdjustContractInfo info = new InventoryAdjustContractInfo();

            info.SourceActionName      = InventoryAdjustSourceAction.AbandonForPO;
            info.SourceBizFunctionName = InventoryAdjustSourceBizFunction.PO_Order;
            info.AdjustItemList        = new List <InventoryAdjustItemInfo>();
            info.ReferenceSysNo        = poInfo.SysNo.ToString();
            foreach (var item in poInfo.Items)
            {
                info.AdjustItemList.Add(new InventoryAdjustItemInfo
                {
                    AdjustQuantity = -1 * item.PurchaseQty,
                    ProductSysNo   = item.ProductSysNo,
                    StockSysNo     = poInfo.StockSysNo
                });
            }

            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["PORestFulBaseUrl"];
            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("/PurchaseOrder/AdjustPurchaseOrderQtyInventory", info, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                Logger.WriteLog(errorMsg, "JobConsole");
            }
        }
コード例 #14
0
ファイル: CommissionBP.cs プロジェクト: sanlonezhang/ql
        public void CreatePayItem(CommissionMaster master)
        {
            //获取配置参数
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["InvoiceRestFulBaseUrl"];
            string languageCode = System.Configuration.ConfigurationManager.AppSettings["LanguageCode"];
            string companyCode  = System.Configuration.ConfigurationManager.AppSettings["CompanyCode"];
            int?   UserSysNo    = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["UserSysNo"]);


            #region 转化数据
            PayItemInfo payItem = new PayItemInfo();

            payItem = new PayItemInfo()
            {
                OrderSysNo    = master.SysNo,
                Note          = "自动结算佣金",
                PayAmt        = -Math.Round(master.TotalAmt, 2),
                OrderType     = PayableOrderType.Commission,
                EditUserSysNo = UserSysNo,
                PayStyle      = PayItemStyle.Normal,
                BatchNumber   = 1,
                CompanyCode   = GlobalSettings.CompanyCode
            };
            #endregion

            ECCentral.Job.Utility.RestClient       client = new ECCentral.Job.Utility.RestClient(baseUrl, languageCode);
            ECCentral.Job.Utility.RestServiceError error;
            var ar = client.Create("/PayItem/Create", payItem, 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;
                }
                Logger.WriteLog(errorMsg, "JobConsole");
            }

            #region FINISH 服务调用 //??
            //ICreatePayItemV31 service = null;

            //try
            //{
            //    service = ServiceBroker.FindService<ICreatePayItemV31>();

            //    if (service == null)
            //    {
            //        throw new InvalidOperationException("未找到ICreatePayItemV31服务");
            //    }

            //    PayItemV31 payItem = new PayItemV31();

            //    payItem.Header = new Newegg.Oversea.Framework.Contract.MessageHeader
            //    {
            //        CompanyCode = GlobalSettings.CompanyCode,
            //        OperationUser = new Newegg.Oversea.Framework.Contract.OperationUser
            //        {
            //            CompanyCode = GlobalSettings.CompanyCode,
            //            FullName = GlobalSettings.UserName,
            //            LogUserName = GlobalSettings.UserName,
            //            SourceDirectoryKey = GlobalSettings.SourceDirectoryKey,
            //            SourceUserName = GlobalSettings.UserName,
            //            UniqueUserName = GlobalSettings.UserName
            //        },
            //        StoreCompanyCode = GlobalSettings.StoreCompanyCode,
            //        FromSystem = GlobalSettings.FromIP
            //    };

            //    payItem.Body = new PayItemMessage
            //    {
            //        OrderSysNo = master.SysNo,
            //        Note = "自动结算佣金",
            //        PayAmt = -Math.Round(master.TotalAmt,2),
            //        OrderType = PayableOrderType.Commission,
            //        OperUserName = GlobalSettings.UserName,
            //        PayStyle = PayItemStyle.Normal,
            //        BatchNumber = 1
            //    };

            //    var result = service.Create(payItem);

            //    if (result.Faults != null && result.Faults.Count > 0)
            //    {
            //        SendMailForWCFFailure(result);
            //    }
            //}
            //catch(Exception ex)
            //{}
            //finally
            //{
            //    ServiceBroker.DisposeService<ICreatePayItemV31>(service);
            //}
            #endregion
        }
コード例 #15
0
        //(PO中该商品采购数量 –实际入库数量) 进行扣减采购在途库存(inventory .purQty);
        //负po不需要进行采购在途库存设置。关闭时,需要把占用库存剩下的还给可用库存
        public static void InventoryPurQtyChange(PoSysNoItem poInfo)
        {
            List <PoPurQtyInfo> listPurQty = AutoCloseDA.GetPoPurQtyInfoList(poInfo.PoSysNo);
            //var data = listPurQty.GroupBy(p => p.poSysno);
            //int storySyno = 0;
            //foreach (var d in data)
            //{
            //    List<KeyValuePair<int, int>> kv = new List<KeyValuePair<int, int>>();
            //    foreach (var f in d)
            //    {
            //        storySyno = f.StockSysNo;
            //        kv.Add(new KeyValuePair<int, int>(f.productSysno, f.pruCount));
            //    }
            //    if (storySyno != 0)
            //    {
            //        InventoryPurQty(storySyno, kv, d.Key, 2);//0 审核; 1 撤销审核;2 中止入库
            //        storySyno = 0;
            //    }
            //}
            InventoryAdjustContractInfo info = new InventoryAdjustContractInfo();

            info.SourceActionName      = InventoryAdjustSourceAction.StopInStock;
            info.SourceBizFunctionName = InventoryAdjustSourceBizFunction.PO_Order;
            info.AdjustItemList        = new List <InventoryAdjustItemInfo>();
            info.ReferenceSysNo        = poInfo.PoSysNo.ToString();
            foreach (var item in listPurQty)
            {
                info.AdjustItemList.Add(new InventoryAdjustItemInfo
                {
                    AdjustQuantity = -1 * item.pruCount,
                    ProductSysNo   = item.productSysno,
                    StockSysNo     = item.StockSysNo
                });
            }

            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["PORestFulBaseUrl"];
            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("/PurchaseOrder/AdjustPurchaseOrderQtyInventory", info, out error);

            if (error != null && error.Faults != null && error.Faults.Count > 0)
            {
                string errorMsg = "";
                foreach (var errorItem in error.Faults)
                {
                    errorMsg += errorItem.ErrorDescription;
                }
                Logger.WriteLog(errorMsg, "JobConsole");

                OnShowInfo(errorMsg);
                OnShowInfo("PO单编号为:" + poInfo.PoSysNo.ToString() + "在途数量修改失败");
                AutoCloseDA.SendEmail(poInfo.PoSysNo, Settings.ExceptionMeil, "PO单编号为:" + poInfo.PoSysNo.ToString() + "在途数量修改失败", errorMsg);
            }
            else
            {
                OnShowInfo("PO单编号为:" + poInfo.PoSysNo.ToString() + "在途数量修改成功");
            }
        }
コード例 #16
0
ファイル: VendorSettleBP.cs プロジェクト: sanlonezhang/ql
        /// <summary>
        /// 调用PO的系统创建代销结算单服务
        /// </summary>
        private void CallSystemCreateService(IList <CollectionPaymentInfo> vendorSettleList)
        {
            if (vendorSettleList == null || vendorSettleList.Count == 0)
            {
                return;
            }

            //获取配置参数
            string baseUrl      = System.Configuration.ConfigurationManager.AppSettings["PORestFulBaseUrl"];
            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 (var item in vendorSettleList)
            {
                var ar = client.Create("/CollectionPayment/Create", item, 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;
                    }
                    SendMailForWCFFailure(errorMsg);
                    Logger.WriteLog(errorMsg, "JobConsole");
                }
            }
            #region  务调用 //?
            //IMaintainCollectionPaymentV31 service = null;

            //try
            //{
            //    service = ServiceBroker.FindService<IMaintainCollectionPaymentV31>();

            //    if (service == null)
            //    {
            //        throw new InvalidOperationException("未找到IMaintainCollectionPaymentV31服务");
            //    }

            //    foreach (var item in vendorSettleList)
            //    {
            //        CollectionPaymentV31 settle = new CollectionPaymentV31();
            //        settle.Header = new Newegg.Oversea.Framework.Contract.MessageHeader
            //        {
            //            CompanyCode = GlobalSettings.CompanyCode,
            //            OperationUser = new Newegg.Oversea.Framework.Contract.OperationUser
            //            {
            //                CompanyCode = GlobalSettings.CompanyCode,
            //                FullName = GlobalSettings.UserName,
            //                LogUserName = GlobalSettings.UserName,
            //                SourceDirectoryKey = GlobalSettings.SourceDirectoryKey,
            //                SourceUserName = GlobalSettings.UserName,
            //                UniqueUserName = GlobalSettings.UserName
            //            },
            //            StoreCompanyCode = GlobalSettings.StoreCompanyCode,
            //            FromSystem = GlobalSettings.FromIP
            //        };

            //        settle.Body = item;

            //        var result = service.SystemCreate(settle);

            //        if (result.Faults != null && result.Faults.Count > 0)
            //        {
            //            SendMailForWCFFailure(result);
            //        }
            //    }
            //}
            //finally
            //{
            //    ServiceBroker.DisposeService<IMaintainCollectionPaymentV31>(service);
            //}
            #endregion
        }