/// <summary> /// 根据报损单单号查询报损单 /// </summary> /// <param name="OrderNum"></param> /// <returns></returns> public BadReportEntity GetOrderByNum(string OrderNum) { BadReportEntity entity = new BadReportEntity(); entity.IncludeAll(); AdminEntity admin = new AdminEntity(); admin.Include(a => new { CreateUserName = a.UserName }); entity.Left <AdminEntity>(admin, new Params <string, string>() { Item1 = "CreateUser", Item2 = "UserNum" }); AdminEntity auditeAdmin = new AdminEntity(); auditeAdmin.Include(a => new { AuditUserName = a.UserName }); entity.Left <AdminEntity>(auditeAdmin, new Params <string, string>() { Item1 = "CreateUser", Item2 = "UserNum" }); entity.Where(a => a.OrderNum == entity.OrderNum) .And(a => a.CompanyID == this.CompanyID) ; entity = this.BadReport.GetSingle(entity); return(entity); }
/// <summary> /// 查询单据分页 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <param name="storageNum"></param> /// <returns></returns> public List <BadReportEntity> GetList(BadReportEntity entity, ref PageInfo pageInfo, string storageNum) { entity.IncludeAll(); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); entity.And("Status", ECondition.Eth, (int)EAudite.Pass); entity.OrderBy(a => a.ID, EOrderBy.DESC); BadReportDetailEntity badDetail = new BadReportDetailEntity(); badDetail.Include(a => new { ProductName = a.ProductName, BarCode = a.BarCode, ProductNum = a.ProductNum }); badDetail.Where(a => a.StorageNum == storageNum); entity.Left <BadReportDetailEntity>(badDetail, new Params <string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" }); int rowCount = 0; List <BadReportEntity> listResult = this.BadReport.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); int allNum = GetAllNum(); if (!listResult.IsNullOrEmpty()) { foreach (BadReportEntity item in listResult) { item.NumPCT = (item.Num * 100.00f) / allNum; } } pageInfo.RowCount = rowCount; return(listResult); }