private SearchNativeSqlStatementModel PrepareSearchStatement(GridCommand command, CabProductionViewSearchModel searchModel)
        {
            string statement = selectStatement;
            if (!string.IsNullOrWhiteSpace(searchModel.Flow))
            {
                statement += string.Format(" and m.Flow = '{0}'", searchModel.Flow);
            }

            if (searchModel.Type != null)
            {
                statement += string.Format(" and m.Type = {0}", searchModel.Type);
            }

            if (searchModel.IsOut)
            {
                statement += " and exists(select 1 from ORD_OrderMstr_2 m2 where m2.OrderNo = m.ExtOrderNo)";
            }

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

            if (string.IsNullOrEmpty(sortingStatement))
            {
                sortingStatement = " order by ExtSeq asc";
            }
            SearchNativeSqlStatementModel searchStatementModel = new SearchNativeSqlStatementModel();
            searchStatementModel.SelectSql = statement;
            searchStatementModel.SortingStatement = sortingStatement;
            return searchStatementModel;
        }
 public ActionResult _AjaxOutSoureViewList(GridCommand command, CabProductionViewSearchModel searchModel)
 {
     SearchNativeSqlStatementModel searchStatementModel = this.PrepareSearchStatement(command, searchModel);
     var list = GetPageDataEntityWithNativeSql<CabProductionView>(searchStatementModel, command);
     ViewBag.Total1 = list.Total;
     return PartialView(list);
 }
 public ActionResult _OutSoureSubView(GridCommand command, CabProductionViewSearchModel searchModel)
 {
     SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel);
     ViewBag.PageSize = base.ProcessPageSize(command.PageSize);
     return View();
 }
 public ActionResult OutSoureList(GridCommand command, CabProductionViewSearchModel searchModel)
 {
     this.ProcessSearchModel(command, searchModel);
     return View();
 }
        private SearchNativeSqlStatementModel PrepareSearchStatement(GridCommand command, CabProductionViewSearchModel searchModel)
        {
            string statement = selectStatement;
            if (!string.IsNullOrWhiteSpace(searchModel.Flow))
            {
                statement += string.Format(" and mstr.Flow = '{0}'", searchModel.Flow);
            }

            //驾驶室已出库记录覆盖时长
            int coveredDays = int.Parse(systemMgr.GetEntityPreferenceValue(com.Sconit.Entity.SYS.EntityPreference.CodeEnum.CoveredDaysOfCabOut));
            statement += string.Format(" and co.CabType = {0} and co.Status in ({1})", (int)searchModel.Type, searchModel.IsOut ? "1,2" : "0");

            if (searchModel.IsOut)
                statement += string.Format(" and co.OutDate Between '" + DateTime.Today.AddDays(1 - coveredDays) + "' and '" + DateTime.Today.AddDays(1) + "'");

            if (command.SortDescriptors != null && command.SortDescriptors.Count > 0)
            {
                if (command.SortDescriptors[0].Member == "CabOutStatusDescription")
                {
                    command.SortDescriptors[0].Member = "CabOutStatus";
                }
            }
            string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors);

            if (string.IsNullOrEmpty(sortingStatement))
            {
                sortingStatement = " order by StartTime asc";
            }
            SearchNativeSqlStatementModel searchStatementModel = new SearchNativeSqlStatementModel();
            searchStatementModel.SelectSql = statement;
            searchStatementModel.SortingStatement = sortingStatement;
            return searchStatementModel;
        }