Пример #1
0
        //public JsonResult GetOrder()
        //{
        //    rtn_data rtn = new rtn_data();
        //    AllocationOrder.AllocationOrderRule rule = allocationOrder.UserRule(this.UserValidator.UserID);
        //    if (rule != null)
        //    {
        //        //现有订单数量
        //        int num = allocationOrder.GetProposalOrderNumber(this.UserValidator.UserID);
        //        allocationOrder.AddLog(LogFileName, DateTime.Now.ToString("yyyy-MM-dd"), this.UserValidator.UserName + "[" + this.UserValidator.UserCode + "]" + "现有订单数量:" + num);
        //        if (num < rule.LimitNumber)
        //        {
        //            //条件
        //            string condtions = "";

        //            #region 渠道类型
        //            if (rule.ChannelType == "内网")
        //            {
        //                condtions += " and app.createdbyparentid ='28a0ba01-4f58-4097-96cb-77c2b09e8253'";
        //            }
        //            else if (rule.ChannelType == "外网")
        //            {
        //                condtions += " and app.createdbyparentid ='9b8eb0fb-31c2-4577-bea7-9e453812f863'";
        //            }
        //            #endregion

        //            #region 资产类型
        //            if (!string.IsNullOrEmpty(rule.AssetCondition))
        //            {
        //                condtions += " and vehicle.condition='" + rule.AssetCondition + "'";
        //            }
        //            #endregion

        //            #region 审核额度
        //            condtions += " and contract.amount_financed>=" + rule.LoanAmountFrom;
        //            condtions += " and contract.amount_financed<=" + rule.LoanAmountTo;
        //            #endregion

        //            #region SQL
        //            string sql = allocationOrder.GetQueryTaskSql(condtions);
        //            #endregion

        //            DataTable dt = AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sql);
        //            if (dt.Rows.Count > 0)
        //            {
        //                DataRow row = dt.Rows[0];
        //                allocationOrder.AddLog(LogFileName, DateTime.Now.ToString("yyyy-MM-dd"), string.Format("任务[{0}]分配给{1}[{2}]", row["objectid"], rule.UserName, rule.UserCode));
        //                //插入到分单历史表中;
        //                allocationOrder.SaveToOrderHis(rule, row["instanceid"] + string.Empty, row["objectid"] + string.Empty, row["application_number"] + string.Empty, row["amount_financed"] + string.Empty, row["createdbyparentid"] + string.Empty, num);
        //                //分单;
        //                rtn = allocationOrder.SendOrder(rule, row["bizobjectschemacode"] + string.Empty, row["bizobjectid"] + string.Empty, row["participant"] + string.Empty, row["objectid"] + string.Empty, row["amount_financed"] + string.Empty);
        //            }
        //            else
        //            {
        //                rtn.code = -1;
        //                rtn.message = "暂时没有可分配的申请,请稍后再试";
        //            }
        //        }
        //        else
        //        {
        //            rtn.code = -1;
        //            rtn.message = string.Format("主动获单数量上限为{0},当前为{1}", rule.LimitNumber, num);
        //        }
        //    }
        //    else
        //    {
        //        rtn.code = -1;
        //        rtn.message = "您没有配置分单规则,请联系管理员添加";
        //    }
        //    return Json(rtn);
        //}

        //public JsonResult GetAllocationAcl()
        //{
        //    bool hasacl = false;
        //    AllocationOrder.AllocationOrderRule rule = allocationOrder.UserRule(this.UserValidator.UserID);
        //    if (rule != null)
        //    {
        //        hasacl = true;
        //    }
        //    return Json(hasacl);
        //}

        public JsonResult Test(string id)
        {
            var             context = AppUtility.Engine.InstanceManager.GetInstanceContext(id);
            AllocationOrder a       = new AllocationOrder();
            var             r       = a.NeedAllocationOrder(context);

            return(Json(r, JsonRequestBehavior.AllowGet));
        }