Example #1
0
        /// <summary>
        /// 自动审单
        /// </summary>
        /// <param name="bizLogFile">业务日志文件全名</param>
        public void AuditSO(string interOrder, string companyCode, int auditUserSysNo)
        {
            m_interOrder     = interOrder;
            m_companyCode    = companyCode;
            m_auditUserSysNo = auditUserSysNo;
            m_now            = DateTime.Now;
            m_da             = ObjectFactory <ISODA> .Instance;

            //获取自动审单检查项信息
            m_csTBOrderCheckMasterList = ExternalDomainBroker.GetCSTBOrderCheckMasterList(m_companyCode);

            //获取自动审单检查项具体的明细项信息
            m_csTBOrderCheckItemList = new List <OrderCheckItem>();
            m_csTBOrderCheckMasterList.ForEach(p => {
                m_csTBOrderCheckItemList.AddRange(p.OrderCheckItemList);
            });

            //获取非客服工作日列表
            m_csNoWorkDayList = ExternalDomainBroker.GetHolidayList("NoCSWorkTime", m_companyCode)
                                .Where(p => p >= m_now.Date).ToList();

            #region 自动审核暂停项被选中 则进行自动审核的暂停判断
            //如果存在 自动审核暂停时间项的检测  则进行自动审核暂停明细项的进一步判断(当前时间点属于自动审核暂停的时间段范围 则 立即暂停自动审核)
            if (m_csTBOrderCheckMasterList.Count > 0 && m_csTBOrderCheckMasterList.Exists(x => { return(x.CheckType == "AT" && x.Status == OrderCheckStatus.Invalid); }))
            {
                //过滤,  获取有效停止自动审核时间段 列表信息
                var itemList = m_csTBOrderCheckItemList.Where(x => { return(x.ReferenceType == "SA" && x.Status == OrderCheckStatus.Invalid && m_now < Convert.ToDateTime(x.Description)); });

                if (itemList != null && itemList.Count() > 0)
                {
                    foreach (var oci in itemList)
                    {
                        if (m_now > Convert.ToDateTime(oci.ReferenceContent))
                        {
                            //jobContext.Message = "当前时间不属于自动审单时间";
                            return;
                        }
                    }
                }
            }
            #endregion

            //从配置文件中获取自动审核一次最多提取的单数
            int topCount = GetTopCount();
            //获取本次审单的记录集
            var tmpSOList = m_da.GetSOList4Audit(topCount, m_companyCode);
            if (tmpSOList.Count == 0)
            {
                //没有符合自动审核的订单
                return;
            }
            //获取今天后的所有节假日
            m_holidays = ExternalDomainBroker.GetHolidayAfterToday(m_companyCode);

            //设置相应的审单检查项
            SetAuditSwitchStatus();

            //设置FP状态检查项明细项信息
            SetAuditFPStatus();

            //设置 客户类型检查明细项
            SetAuditCustomerType();

            //提前取得恶意用户的列表
            m_malevolenceCustomers = ExternalDomainBroker.GetMalevolenceCustomers(m_companyCode);

            //提前取得所有支付方式的列表
            m_payTypeList = ExternalDomainBroker.GetPayTypeList(m_companyCode);

            foreach (var x in tmpSOList)
            {
                try
                {
                    CheckRules(x);
                }
                catch (Exception ex)
                {
                    ExceptionHelper.HandleException(ex);
                    WriteLog(ex.Message);
                }
            }

            EndAuditAll();
        }