Пример #1
0
        public ActionResult DetailList(GridCommand command, RejectDetailSearchModel searchModel)
        {
            SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
            if (this.CheckSearchModelIsNull(searchCacheModel.SearchObject))
            {
                TempData["_AjaxMessage"] = "";
            }
            else
            {
                SaveWarningMessage(Resources.ErrorMessage.Errors_NoConditions);
            }



            ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
            return View();
        }
Пример #2
0
        public ActionResult _AjaxRejectDetailList(GridCommand command, RejectDetailSearchModel searchModel)
        {
            if (!this.CheckSearchModelIsNull(searchModel))
            {
                return PartialView(new GridModel(new List<RejectDetail>()));
            }
           

            SearchStatementModel searchStatementModel = RejectDetailPrepareSearchStatement(command, searchModel);
           GridModel<RejectDetail> list=   GetAjaxPageData<RejectDetail>(searchStatementModel, command);

            IList<FailCode> failCodeList = base.genericMgr.FindAll<FailCode>();

            foreach (RejectDetail rejectDetail in list.Data)
            {
                foreach (FailCode failCode in failCodeList)
                {
                    if (rejectDetail.FailCode == failCode.Code)
                    {
                        rejectDetail.FailCode = failCode.CodeDescription;
                    }
                }
            }
            return PartialView(list);
        }
Пример #3
0
        private SearchStatementModel RejectDetailPrepareSearchStatement(GridCommand command, RejectDetailSearchModel searchModel)
        {
            string whereStatement = " where 1=1 ";
            if (searchModel.Status != null || searchModel.HandleResult != null)
            {
                whereStatement += " and exists (select 1 from RejectMaster as rm where  rm.RejectNo= r.RejectNo ";
            }

            if (searchModel.Status != null)
            {
                whereStatement += " and rm.Status='" + searchModel.Status + "'";
            }
            if (searchModel.HandleResult != null)
            {
                whereStatement += " and rm.HandleResult='" + searchModel.HandleResult + "'";
            }

            if (searchModel.Status != null || searchModel.HandleResult != null)
            {
                whereStatement += ")";
            }

            IList<object> param = new List<object>();

            HqlStatementHelper.AddLikeStatement("RejectNo", searchModel.RejectNo, HqlStatementHelper.LikeMatchMode.Start, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("Item", searchModel.Item, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("CurrentLocation", searchModel.CurrentLocation, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("InspectNo", searchModel.InspectNo, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("IpNo", searchModel.IpNo, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("ReceiptNo", searchModel.ReceiptNo, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("WMSNo", searchModel.WMSNo, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("JudgeUserName", searchModel.JudgeUserName, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("CreateUserName", searchModel.CreateUserName, "r", ref whereStatement, param);
            HqlStatementHelper.AddEqStatement("WMSNo", searchModel.WMSNo, "r", ref whereStatement, param);
            if (searchModel.IsContainHu != null && searchModel.IsContainHu.Value)
            {
                whereStatement += " and r.HuId is not null";
            }
            else
            {
                whereStatement += " and r.HuId is  null";
            }

            if (searchModel.StartDate != null && searchModel.EndDate != null)
            {
                HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.StartDate, searchModel.EndDate, "r", ref whereStatement, param);

            }
            else if (searchModel.StartDate != null && searchModel.EndDate == null)
            {
                HqlStatementHelper.AddGeStatement("CreateDate", searchModel.StartDate, "r", ref whereStatement, param);
            }
            else if (searchModel.StartDate == null && searchModel.EndDate != null)
            {
                HqlStatementHelper.AddLeStatement("CreateDate", searchModel.EndDate, "r", ref whereStatement, param);
            }

            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

            SearchStatementModel searchStatementModel = new SearchStatementModel();
            searchStatementModel.SelectCountStatement = "select count(*) from RejectDetail as r";
            searchStatementModel.SelectStatement = "select r from RejectDetail as r";
            searchStatementModel.WhereStatement = whereStatement;
            searchStatementModel.SortingStatement = sortingStatement;
            searchStatementModel.Parameters = param.ToArray<object>();

            return searchStatementModel;
        }