/// <summary> /// 获取数据列表(原订单明细) /// </summary> public PageModel GetOrderItemDataList(ProblemOrderRequest request) { #region 模糊搜索条件 var where = new Where <TbWorkOrderDetail>(); if (!string.IsNullOrWhiteSpace(request.keyword)) { where.And(p => p.MaterialCode.Like(request.keyword)); } if (!string.IsNullOrWhiteSpace(request.OrderCode)) { where.And(p => p.OrderCode == request.OrderCode); } #endregion try { var data = Db.Context.From <TbWorkOrderDetail>().Select( TbWorkOrderDetail._.ID.As("WorkOrderDetailId"), TbWorkOrderDetail._.SpecificationModel, TbWorkOrderDetail._.MaterialCode, TbWorkOrderDetail._.MaterialName, TbWorkOrderDetail._.ComponentName, TbWorkOrderDetail._.LargePattern, TbWorkOrderDetail._.MeasurementUnitZl.As("Weight"), TbWorkOrderDetail._.ItemUseNum.As("UseCount"), TbWorkOrderDetail._.Number.As("Count"), TbWorkOrderDetail._.WeightSmallPlan.As("WeightTotal"), TbWorkOrderDetail._.DaetailWorkStrat.As("ProcessingStateItem"), TbWorkOrderDetail._.PackNumber.As("PackCount"), TbWorkOrderDetail._.Manufactor.As("Factory"), TbWorkOrderDetail._.HeatNo.As("BatchNumber"), TbWorkOrderDetail._.TestReportNo.As("TestReportCode"), TbSysDictionaryData._.DictionaryText.As("ProcessingStateNameItem")) .AddSelect(Db.Context.From <TbSysDictionaryData>() .Select(p => p.DictionaryText) .Where(TbSysDictionaryData._.DictionaryCode == TbWorkOrderDetail._.MeasurementUnit), "MeasurementUnit") .LeftJoin <TbSysDictionaryData>((a, c) => a.DaetailWorkStrat == c.DictionaryCode) .Where(where) .ToPageList(request.rows, request.page); return(data); } catch (Exception) { throw; } }
/// <summary> /// 获取数据列表(原订单) /// </summary> public PageModel GetOrderDataList(ProblemOrderRequest request) { #region 模糊搜索条件 var where = new Where <TbWorkOrder>(); if (!string.IsNullOrWhiteSpace(request.keyword)) { where.And(p => p.OrderCode.Like(request.keyword)); } if (!string.IsNullOrEmpty(request.ProcessFactoryCode)) { where.And(p => p.ProcessFactoryCode == request.ProcessFactoryCode); } if (!request.IsCost) { where.And(p => p.Examinestatus == "审核完成" && (p.ProcessingState != "Processing" && p.ProcessingState != "Finishing")); where.And(TbWorkOrder._.OrderCode .SubQueryNotIn(Db.Context.From <TbProblemOrder>().Select(p => p.OrderCode))); } else { where.And(p => p.Examinestatus == "审核完成"); } if (!string.IsNullOrEmpty(request.ProjectId)) { where.And(p => p.ProjectId == request.ProjectId); } if (!string.IsNullOrWhiteSpace(request.ProcessFactoryCode)) { where.And(p => p.ProcessFactoryCode == request.ProcessFactoryCode); } if (!string.IsNullOrWhiteSpace(request.SiteCode)) { List <string> SiteList = _workOrderLogic.GetCompanyWorkAreaOrSiteList(request.SiteCode, 5);//站点 where.And(p => p.SiteCode.In(SiteList)); } #endregion try { var data = Db.Context.From <TbWorkOrder>().Select( TbWorkOrder._.OrderCode, TbWorkOrder._.SiteCode, TbWorkOrder._.TypeCode, TbWorkOrder._.TypeName, TbWorkOrder._.SiteCode, TbWorkOrder._.ProcessFactoryCode, TbWorkOrder._.UsePart, TbWorkOrder._.WeightTotal, TbWorkOrder._.ProcessingState, TbWorkOrder._.DistributionTime, TbWorkOrder._.DistributionAdd.As("DistributionAddress"), TbWorkOrder._.ProjectId, TbCompany._.CompanyFullName.As("SiteName"), TbSysDictionaryData._.DictionaryText.As("ProcessingStateName")) .AddSelect(Db.Context.From <TbCompany>() .Select(p => p.CompanyFullName) .Where(TbCompany._.CompanyCode == TbWorkOrder._.ProcessFactoryCode), "ProcessFactoryName") .LeftJoin <TbCompany>((a, c) => a.SiteCode == c.CompanyCode) .LeftJoin <TbSysDictionaryData>((a, c) => a.ProcessingState == c.DictionaryCode) .Where(where) .OrderByDescending(p => p.ID) .ToPageList(request.rows, request.page); return(data); } catch (Exception) { throw; } }
/// <summary> /// 获取分页列表数据 /// </summary> /// <param name="request"></param> /// <returns></returns> public ActionResult GetGridJson(ProblemOrderRequest request) { var data = _problemOrder.GetDataListForPage(request); return(Content(data.ToJson())); }
/// <summary> /// 获取数据列表(分页) /// </summary> public PageModel GetDataListForPage(ProblemOrderRequest request) { #region 模糊搜索条件 var where = new Where <TbProblemOrder>(); if (!string.IsNullOrWhiteSpace(request.OrderCode)) { where.And(d => d.OrderCode.Like(request.OrderCode)); } if (!string.IsNullOrWhiteSpace(request.TypeCode)) { where.And(d => d.TypeCode == request.TypeCode); } if (!string.IsNullOrWhiteSpace(request.SiteCode)) { List <string> SiteList = _workOrderLogic.GetCompanyWorkAreaOrSiteList(request.SiteCode, 5); where.And(p => p.SiteCode.In(SiteList)); } if (!string.IsNullOrWhiteSpace(request.ProcessFactoryCode)) { where.And(p => p.ProcessFactoryCode == request.ProcessFactoryCode); } if (!string.IsNullOrWhiteSpace(request.RevokeStatus)) { where.And(d => d.RevokeStatus == request.RevokeStatus); } if (!string.IsNullOrWhiteSpace(request.BegTime.ToString())) { where.And(d => d.DistributionTime >= request.BegTime); } if (!string.IsNullOrWhiteSpace(request.EndTiem.ToString())) { where.And(d => d.DistributionTime <= request.EndTiem); } #endregion #region 数据权限 ////数据权限 //var authorizaModel = new AuthorizeLogic().CheckAuthoriza(new AuthorizationParameterModel("ProblemOrder")); //if (authorizaModel.IsAuthorize) //{ // if (authorizaModel.Ids.Count > 0 && authorizaModel.UserCodes.Count > 0) // where.And(d => d.InsertUserCode.In(authorizaModel.UserCodes) || d.ID.In(authorizaModel.Ids)); // else if (authorizaModel.Ids.Count > 0) // where.Or(d => d.ID.In(authorizaModel.Ids)); // else if (authorizaModel.UserCodes.Count > 0) // where.And(d => d.InsertUserCode.In(authorizaModel.UserCodes)); //} if (!string.IsNullOrEmpty(request.ProjectId)) { where.And(p => p.ProjectId == request.ProjectId); } #endregion try { var sql = Db.Context.From <TbProblemOrder>() .Select( TbProblemOrder._.ID , TbProblemOrder._.Examinestatus , TbProblemOrder._.Examinestatus.As("ExaminestatusNew") , TbProblemOrder._.ProblemOrderCode , TbProblemOrder._.OrderCode , TbProblemOrder._.TypeCode , TbProblemOrder._.TypeName , TbProblemOrder._.UsePart , TbProblemOrder._.RevokeStatus , TbProblemOrder._.DistributionTime , TbProblemOrder._.DistributionAddress , TbProblemOrder._.Total , TbProblemOrder._.OldTotal , TbProblemOrder._.InsertUserCode , TbProblemOrder._.InsertTime , TbProblemOrder._.ProjectId , TbUser._.UserName , TbCompany._.CompanyFullName.As("SiteName") , TbWorkOrder._.ProcessingState.As("OldProcessingState")) .LeftJoin <TbUser>((a, c) => a.InsertUserCode == c.UserCode) .LeftJoin <TbCompany>((a, c) => a.SiteCode == c.CompanyCode) .LeftJoin <TbWorkOrder>((a, c) => a.OrderCode == c.OrderCode) .Where(where) .OrderByDescending(p => p.ID); var data = new PageModel(); if (request.IsOutPut) { data.rows = sql.ToDataTable(); } else { data = sql.ToPageList(request.rows, request.page); } return(data); } catch (Exception) { throw; } }
/// <summary> /// 获取数据列表(原订单明细) /// </summary> /// <param name="request"></param> /// <returns></returns> public ActionResult GetOrderItemGridJson(ProblemOrderRequest request) { var data = _problemOrder.GetOrderItemDataList(request); return(Content(data.ToJson())); }