public ActionResult _AjaxList(GridCommand command, InspectMasterSearchModel searchModel) { this.GetCommand(ref command, searchModel); if (!this.CheckSearchModelIsNull(searchModel)) { return PartialView(new GridModel(new List<InspectMaster>())); } SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel, string.Empty); return PartialView(GetAjaxPageData<InspectMaster>(searchStatementModel, command)); }
public ActionResult List(GridCommand command, InspectMasterSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); if (this.CheckSearchModelIsNull(searchCacheModel.SearchObject)) { TempData["_AjaxMessage"] = ""; } else { SaveWarningMessage(Resources.SYS.ErrorMessage.Errors_NoConditions); } if (searchCacheModel.isBack == true) { ViewBag.Page = searchCacheModel.Command.Page == 0 ? 1 : searchCacheModel.Command.Page; } ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return View(); }
private SearchStatementModel PrepareSearchStatement(GridCommand command, InspectMasterSearchModel searchModel, string whereStatement) { IList<object> param = new List<object>(); SecurityHelper.AddRegionPermissionStatement(ref whereStatement, "i", "Region"); HqlStatementHelper.AddLikeStatement("InspectNo", searchModel.InspectNo, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param); HqlStatementHelper.AddLikeStatement("CreateUserName", searchModel.CreateUserName, HqlStatementHelper.LikeMatchMode.Start, "i", ref whereStatement, param); HqlStatementHelper.AddEqStatement("Status", searchModel.Status, "i", ref whereStatement, param); HqlStatementHelper.AddEqStatement("Region", searchModel.Region, "i", ref whereStatement, param); HqlStatementHelper.AddEqStatement("Type", searchModel.Type, "i", ref whereStatement, param); HqlStatementHelper.AddLikeStatement("IpNo", searchModel.IpNo, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param); HqlStatementHelper.AddLikeStatement("WMSNo", searchModel.WMSNo, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param); HqlStatementHelper.AddLikeStatement("ReceiptNo", searchModel.ReceiptNo, HqlStatementHelper.LikeMatchMode.End, "i", ref whereStatement, param); HqlStatementHelper.AddEqStatement("Type", searchModel.Type, "i", ref whereStatement, param); if (searchModel.StartDate != null & searchModel.EndDate != null) { HqlStatementHelper.AddBetweenStatement("CreateDate", searchModel.StartDate, searchModel.EndDate, "i", ref whereStatement, param); } else if (searchModel.StartDate != null & searchModel.EndDate == null) { HqlStatementHelper.AddGeStatement("CreateDate", searchModel.StartDate, "i", ref whereStatement, param); } else if (searchModel.StartDate == null & searchModel.EndDate != null) { HqlStatementHelper.AddLeStatement("CreateDate", searchModel.EndDate, "i", ref whereStatement, param); } if (command.SortDescriptors.Count > 0) { if (command.SortDescriptors[0].Member == "InspectTypeDescription") { command.SortDescriptors[0].Member = "Type"; } else if (command.SortDescriptors[0].Member == "InspectStatusDescription") { command.SortDescriptors[0].Member = "Status"; } } string sortingStatement = HqlStatementHelper.GetSortingStatement(command.SortDescriptors); if (command.SortDescriptors.Count == 0) { sortingStatement = " order by i.CreateDate desc"; } SearchStatementModel searchStatementModel = new SearchStatementModel(); searchStatementModel.SelectCountStatement = selectCountStatement; searchStatementModel.SelectStatement = selectStatement; searchStatementModel.WhereStatement = whereStatement; searchStatementModel.SortingStatement = sortingStatement; searchStatementModel.Parameters = param.ToArray<object>(); return searchStatementModel; }
private string PrepareDetailSearchStatement(GridCommand command, InspectMasterSearchModel searchModel) { StringBuilder Sb = new StringBuilder(); string whereStatement = "select detailResult.*,isnull(rest.handleQty,0) from ( select * from INP_InspectDet as id where 1=1"; if (searchModel.IpNo != null || searchModel.ReceiptNo != null || searchModel.WMSNo != null) { whereStatement += " and exists (select 1 from INP_InspectMstr as i where i.InpNo= id.InpNo "; } if (searchModel.IpNo != null && searchModel.IpNo != "") { whereStatement += " and i.IpNo='" + searchModel.IpNo + "'"; } if (searchModel.WMSNo != null && searchModel.WMSNo != "") { whereStatement += " and i.WMSNo='" + searchModel.WMSNo + "'"; } if (searchModel.ReceiptNo != null && searchModel.ReceiptNo != "") { whereStatement += " and i.RecNo='" + searchModel.ReceiptNo + "'"; } if (searchModel.IpNo != null || searchModel.ReceiptNo != null || searchModel.WMSNo != null) { whereStatement += ")"; } Sb.Append(whereStatement); if (searchModel.InspectNo != null) { Sb.Append(string.Format(" and id.InpNo = '{0}'", searchModel.InspectNo)); } if (!string.IsNullOrEmpty(searchModel.Item)) { Sb.Append(string.Format(" and id.Item ='{0}'", searchModel.Item)); } if (searchModel.CreateUserName != null) { Sb.Append(string.Format(" and id.CreateUserNm = '{0}'", searchModel.CreateUserName)); } if (searchModel.StartDate != null & searchModel.EndDate != null) { Sb.Append(string.Format(" and id.CreateDate between '{0}' and '{1}'", new object[] { searchModel.StartDate, searchModel.EndDate })); } else if (searchModel.StartDate != null & searchModel.EndDate == null) { Sb.Append(string.Format(" and id.CreateDate >= '{0}'", searchModel.StartDate)); } else if (searchModel.StartDate == null & searchModel.EndDate != null) { Sb.Append(string.Format(" and id.CreateDate <= '{0}'", searchModel.EndDate)); } Sb.Append(@" ) as detailResult left join (select ir.inpdetid,sum(ir.HandleQty) as handleQty from INP_InspectResult as ir group by inpdetid) as rest on detailResult.Id=rest.inpdetid order by detailResult.CreateDate desc"); return Sb.ToString(); }
public void ExportXLS(InspectMasterSearchModel searchModel) { int value = Convert.ToInt32(base.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.MaxRowSizeOnPage)); GridCommand command = new GridCommand(); command.Page = 1; command.PageSize = !this.CheckSearchModelIsNull(searchModel) ? 0 : value; IList<InspectDetail> InspectDetailList = new List<InspectDetail>(); InspectDetailList = GetDetailList(command, searchModel); if (InspectDetailList.Count > value) { SaveWarningMessage(string.Format(Resources.EXT.ControllerLan.Con_DataExceedRow, value)); } ExportToXLS<InspectDetail>("InspectOrderDetail.xls", InspectDetailList); }
private List<InspectDetail> GetDetailList(GridCommand command, InspectMasterSearchModel searchModel) { TempData["_AjaxMessage"] = ""; var failCodeDic = this.genericMgr.FindAll<FailCode>().ToDictionary(d => d.Code, d => d); string hql = PrepareDetailSearchStatement(command, searchModel); IList<InspectDetail> InspectDetailList = new List<InspectDetail>(); IList<object[]> objectList = this.queryMgr.FindAllWithNativeSql<object[]>(hql); InspectDetailList = (from tak in objectList select new InspectDetail { Id = (int)tak[0], InspectNo = (string)tak[1], Sequence = (int)tak[2], Item = (string)tak[3], ItemDescription = (string)tak[4], ReferenceItemCode = (string)tak[5], UnitCount = (decimal)tak[6], Uom = (string)tak[7], BaseUom = (string)tak[8], UnitQty = (decimal)tak[9], HuId = (string)tak[10], LotNo = (string)tak[11], LocationFrom = (string)tak[12], CurrentLocation = (string)tak[13], InspectQty = (decimal)tak[14], QualifyQty = (decimal)tak[15], RejectQty = (decimal)tak[16], IsJudge = (bool)tak[17], CreateUserId = (int)tak[18], CreateUserName = (string)tak[19], CreateDate = (DateTime)tak[20], LastModifyUserId = (int)tak[21], LastModifyUserName = (string)tak[22], LastModifyDate = (DateTime)tak[23], Version = (int)tak[24], ManufactureParty = (string)tak[25], WMSSeq = (string)tak[26], IpDetailSequence = (int)tak[27], ReceiptDetailSequence = (int)tak[28], Note = (string)tak[29], FailCode = (string)tak[30], FailCodeDescription = string.IsNullOrWhiteSpace((string)tak[30]) ? null : failCodeDic.ValueOrDefault((string)tak[30]).CodeDescription, HandledQty = (decimal)tak[31], }).ToList(); return (List<InspectDetail>)InspectDetailList; }
public ActionResult DetailList(GridCommand command, InspectMasterSearchModel searchModel) { if (this.CheckSearchModelIsNull(searchModel)) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); IList<InspectDetail> InspectDetailList = new List<InspectDetail>(); InspectDetailList = GetDetailList(command, searchModel); int value = Convert.ToInt32(base.systemMgr.GetEntityPreferenceValue(EntityPreference.CodeEnum.MaxRowSizeOnPage)); if (InspectDetailList.Count > value) { SaveWarningMessage(string.Format(Resources.EXT.ControllerLan.Con_DataExceedRow, value)); } return View(InspectDetailList.Take(value).ToList()); } else { SaveWarningMessage(Resources.SYS.ErrorMessage.Errors_NoConditions); return View(new List<InspectDetail>()); } //return View(list.Take(value)); }
public ActionResult _AjaxJudgeList(GridCommand command, InspectMasterSearchModel searchModel) { string replaceFrom = "_AjaxJudgeList"; string replaceTo = "JudgeList"; this.GetCommand(ref command, searchModel, replaceFrom, replaceTo); string whereStatement = " where i.Status in ( " + (int)com.Sconit.CodeMaster.InspectStatus.Submit + "," + (int)com.Sconit.CodeMaster.InspectStatus.InProcess + ")"; SearchStatementModel searchStatementModel = PrepareSearchStatement(command, searchModel, whereStatement); return PartialView(GetAjaxPageData<InspectMaster>(searchStatementModel, command)); }
public ActionResult JudgeList(GridCommand command, InspectMasterSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); if (searchCacheModel.isBack == true) { ViewBag.Page = searchCacheModel.Command.Page == 0 ? 1 : searchCacheModel.Command.Page; } ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return View(); }