Пример #1
0
        public static void DoWork(AutoResetEvent are)
        {
            List <POEntity> list = MonitorDA.GetPO(Settings.CompanyCode);

            OnShowInfo(string.Format("找到{0}个审核通过(待入库)的PO单.", list.Count));
            foreach (var item in list)
            {
                if (item.ETATime.HasValue)
                {
                    TimeSpan ts = DateTime.Now - item.ETATime.Value;
                    if (ts.Days > 3)
                    {
                        //当前成本/当前价/最近一次调价时间/上次采购价/上次采购时间/京东价/有效库存/上月销售总量,
                        //以上字段在“待入库”、“已作废”、“系统作废”时记录到数据表中,
                        List <POItem> poItems = MonitorDA.GetPOItemBySys(item.SysNo, Settings.CompanyCode);

                        //系统作废PO单的Job(ETA Job)排除掉待入库的礼品卡PO单
                        if (!CheckHasGiftCard(poItems))
                        {
                            item.Items = poItems;
                            AbandonPO(item);
                        }
                    }
                }
            }
            are.Set();
        }
Пример #2
0
        public static List <POEimsEntity> GetPOEimsRelevanceInfo(int poSysNo)
        {
            List <POEimsEntity> poEimsRelevanceList = new List <POEimsEntity>();

            poEimsRelevanceList = MonitorDA.GetPOEimsRelevanceInfo(poSysNo);
            return(poEimsRelevanceList);
        }
Пример #3
0
        private static bool IsSSBEnabled()
        {
            var status = MonitorDA.GetPOOfflineStatus();

            return(status == "Y");
        }
Пример #4
0
        public static int SendCloseMessage(int poSysNo, int userSysNo)
        {
            #region 模版

            string poTemplate = @"<Publish xmlns=""http://soa.newegg.com/SOA/USA/InfrastructureService/V30/PubSubService"">
	                                    <FromService>http://soa.newegg.com/SOA/USA/InventoryManagement/V30/E5DBS01/NeweggOZZOService</FromService>
	                                    <ToService>http://soa.newegg.com/SOA/USA/InfrastructureService/V30/PubSubService</ToService>
	                                    <RouteTable>
		                                    <Article xmlns=""http://soa.newegg.com/SOA/USA/InfrastructureService/V30/PubSubService"">
			                                    <ArticleCategory>WMS</ArticleCategory>
			                                    <ArticleType1>Download</ArticleType1>
			                                    <ArticleType2>Newegg</ArticleType2>
		                                    </Article>
	                                    </RouteTable>
	                                    <Node>
		                                    <MessageHead>
			                                    <!-- 确定由哪一个SP来处理当前逻辑 -->
			                                    <MessageType>POClose</MessageType>
			                                    <!-- 版本号 -->
			                                    <Version>1.0</Version>
			                                    <!-- 商家编号 -->
			                                    <CompanyCode>{CompanyCode}</CompanyCode>
			                                    <!-- Merchant PO号(PONumber) -->
			                                    <ReferenceNumber>{PONumber}</ReferenceNumber>
		                                    </MessageHead>
		                                    <Body>
			                                    <!-- PONumber 商户PO编号 -->
			                                    <PONumber>{PONumber}</PONumber>
			                                    <!-- 关闭备注 -->
			                                    <Memo>{Memo}</Memo>
		                                    </Body>
	                                    </Node>
                                    </Publish>";

            #endregion

            if (!IsSSBEnabled())
            {
                return(0);
            }

            NewPOEntity po = MonitorDA.GetPOMaster(poSysNo);

            string message = poTemplate.Replace("{PONumber}", po.SysNo.ToString())
                             .Replace("{CompanyCode}", po.CompanyCode)
                             .Replace("{Memo}", po.Memo);


            MonitorDA.CreatePOSSBLog(new POSSBLogEntity
            {
                POSysNo          = poSysNo,
                Content          = message,
                ActionType       = "C",
                InUser           = userSysNo,
                SendErrMail      = "N",
                CompanyCode      = Settings.CompanyCode,
                LanguageCode     = Settings.LanguageCode,
                StoreCompanyCode = Settings.StoreCompanyCode
            });

            return(MonitorDA.CallSSBMessageSP(message));
        }
Пример #5
0
        public static void AbandonPO(POEntity PO)
        {
            string logInfo = string.Empty;
            string halfday = string.Empty;

            if (PO.ETAHalfDay == "AM")
            {
                halfday = "上午";
            }
            else if (PO.ETAHalfDay == "PM")
            {
                halfday = "下午";
            }
            logInfo = string.Format("POSysNo:{0},StockSysNo:{1} ,ETATime:{2}{3}", PO.SysNo, PO.StockSysNo, PO.ETATime.Value.ToShortDateString(), halfday);
            try
            {
                //if (PO.PM_ReturnPointSysNo > 0)
                //{
                //    EIMSOper(PO);
                //}
                int userSysNo = 493;
                #region 返还返点信息
                //List<POAttachInfo> poAttachEntitys = new List<POAttachInfo>();
                //List<POEimsEntity> poEimsEntitys = GetPOEimsRelevanceInfo(PO.SysNo);
                //if (poEimsEntitys != null && poEimsEntitys.Count > 0)
                //{
                //    foreach (POEimsEntity poEims in poEimsEntitys)
                //    {
                //        POAttachInfo poAttachInfo = new POAttachInfo()
                //        {
                //            PONumber = PO.SysNo,
                //            InvoiceNumber = poEims.EIMSNo,
                //            UseInvoiceAmount = poEims.EIMSAmt * -1,
                //            PostTime = System.DateTime.Now,
                //            UseTime = System.DateTime.Now,
                //            C3SysNo = -1
                //        };
                //        poAttachEntitys.Add(poAttachInfo);
                //    }
                //    EIMSOper(poAttachEntitys, userSysNo.ToString(), PO.SysNo);
                //}
                #endregion

                InventoryOper(PO);

                //但放到前面则会报:等待入库和等待分配的采购单只能添加预付款单!
                //为已付款的PO产生POAjust时需在作废PO单之前,否则报业务异常:已作废、关闭、初始状态的采购单不能添加付款单!
                var fpItem = MonitorDA.GetFinacePayItemByPOSysNo(PO.SysNo);
                if (fpItem != null && fpItem.AvailableAmt > 0) //如果找到已付款的则调用财务接品生成POAjust单
                {
                    MonitorDA.InsertFinancePayAndItem(fpItem, userSysNo);
                }

                MonitorDA.AbandonPO(PO.SysNo, Settings.CompanyCode);
                MonitorDA.AbandonETA(PO.SysNo);
                foreach (var poItem in PO.Items)
                {
                    MonitorDA.UpdateExtendPOInfo(poItem.SysNo, Settings.CompanyCode, poItem.ProductSysNo);
                }

                //CRL17821 发送关闭消息
                SendCloseMessage(PO.SysNo, userSysNo);

                Logger.WriteLog("JOB自动作废PO单Success" + logInfo, "JobConsole", PO.SysNo.ToString());
                OnShowInfo(string.Format("采购单{0}作废成功.", PO.SysNo));
            }
            catch (Exception ex)
            {
                Logger.WriteLog(DateTime.Now + "JOB自动作废PO单Failed。" + logInfo + "\r\n" + ex.Message.ToString(),
                                "JobConsole",
                                PO.SysNo.ToString()
                                );
                OnShowInfo(string.Format("采购单{0}作废失败:\r\n{1}.", PO.SysNo, ex.Message));
            }
        }
Пример #6
0
        // private static int AllOK = 0;
        #endregion

        public static void DoWork(AutoResetEvent are)
        {
            try
            {
                int             count     = 0;
                decimal         diffmoney = 0.10m;
                decimal         soTotal   = 0;
                decimal         ar        = 0;
                decimal         invocie   = 0;
                string          status    = "A";
                DateTime        begindate = DateTime.Parse(Settings.SOBeginDate);
                List <SOEntity> SOList    = MonitorDA.GetSO(begindate, Settings.CompanyCode);
                ShowInfo(string.Format("找到{0}个订单", SOList.Count));
                string[] PayByJF = Settings.PayByJiFen;
                string   simcard = MonitorDA.GetSIMCard();
                foreach (var item in SOList)
                {
                    soTotal = item.CashPay
                              + item.DiscountAmt
                              + item.PayPrice
                              + item.PremiumAmt
                              + item.ShipPrice
                              - item.GiftCardPay;
                    ar = MonitorDA.GetAR(item.SysNo);
                    if (item.SOType == 6)
                    {
                        invocie = MonitorDA.GetInvoice(item.SysNo) + MonitorDA.GetSIMCardPrice(item.SysNo, simcard);
                    }
                    else
                    {
                        invocie = MonitorDA.GetInvoice(item.SysNo);
                    }
                    status = "A";

                    //Modified by Nolan.Q.Chen in 2012.1.30 修改了模式六的Invoice金额校验
                    if (PayByJF.Contains(item.PayType.ToString()))
                    {
                        if ((item.StockType == "NEG" || item.InvoiceType == "NEG") && ar != invocie)
                        {
                            count++;
                            MailBP.SendMail("积分支付", item.SysNo, soTotal, ar, invocie);
                            ShowInfo(string.Format("订单[{0}]为【积分支付】,不符合要求,已发送邮件", item.SysNo));
                            status = "D";
                        }
                    }
                    else
                    {
                        if (item.StockType != "NEG" && item.InvoiceType != "NEG")
                        {
                            if (Math.Abs((soTotal - ar)) >= diffmoney || Math.Abs(invocie) >= diffmoney)
                            {
                                count++;
                                MailBP.SendMail("模式六非积分支付", item.SysNo, soTotal, ar, invocie);
                                ShowInfo(string.Format("订单[{0}]为【非积分支付】,不符合要求,已发送邮件", item.SysNo));
                                status = "D";
                            }
                        }
                        else if (Math.Abs((soTotal - ar)) >= diffmoney ||
                                 Math.Abs((soTotal - invocie)) >= diffmoney ||
                                 Math.Abs(ar - invocie) >= diffmoney)
                        {
                            count++;
                            MailBP.SendMail("非积分支付", item.SysNo, soTotal, ar, invocie);
                            ShowInfo(string.Format("订单[{0}]为【非积分支付】,不符合要求,已发送邮件", item.SysNo));
                            status = "D";
                        }
                    }
                    MonitorDA.CreateMonitorLog(item.SysNo, soTotal, ar, invocie, status);
                }
                ShowInfo(string.Format("共有{0}个订单不符合要求", count));
                are.Set();
            }
            catch (Exception ex)
            {
                are.Set();
                throw ex;
            }
        }