/// <summary> /// 根据出库单编号查询出库单 /// </summary> /// <param name="OrderNum"></param> /// <returns></returns> public OutStorageEntity GetOrderByNum(string OrderNum) { OutStorageEntity entity = new OutStorageEntity(); 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(item => new { AuditeUserName = item.UserName }); entity.Left <AdminEntity>(auditeAdmin, new Params <string, string>() { Item1 = "CreateUser", Item2 = "UserNum" }); entity.Where(a => a.OrderNum == OrderNum) .And(a => a.CompanyID == this.CompanyID) .And(a => a.IsDelete == (int)EIsDelete.NotDelete) ; entity = this.OutStorage.GetSingle(entity); return(entity); }
public ActionResult GetList() { int Status = WebUtil.GetFormValue <int>("Status", 0); string OrderNum = WebUtil.GetFormValue <string>("OrderNum", string.Empty); string CusName = WebUtil.GetFormValue <string>("CusName", string.Empty); string beginTime = WebUtil.GetFormValue <string>("beginTime", string.Empty); string endTime = WebUtil.GetFormValue <string>("endTime", string.Empty); string order = WebUtil.GetFormValue <string>("order", string.Empty); int OutType = WebUtil.GetFormValue <int>("OutType", 0); string planNum = WebUtil.GetFormValue <string>("planNum"); int pageSize = WebUtil.GetFormValue <int>("PageSize", 10); int pageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; OutStorageEntity entity = new OutStorageEntity(); if (Status > 0) { entity.Where(a => a.Status == Status); } if (!OrderNum.IsEmpty()) { entity.Where("OrderNum", ECondition.Like, "%" + OrderNum + "%"); } if (!CusName.IsEmpty()) { entity.Begin <OutStorageEntity>() .And <OutStorageEntity>("CusNum", ECondition.Like, "%" + CusName + "%") .Or <OutStorageEntity>("CusName", ECondition.Like, "%" + CusName + "%") .End <OutStorageEntity>() ; } if (!beginTime.IsEmpty() && !endTime.IsEmpty()) { entity.Where("OrderTime", ECondition.Between, ConvertHelper.ToType <DateTime>(beginTime), ConvertHelper.ToType <DateTime>(endTime)); } entity.And(a => a.StorageNum == this.DefaultStore); if (!order.IsEmpty()) { OrderProvider orderProvider = new OrderProvider(); List <string> listContractOrder = orderProvider.GetOrderPlan(order); listContractOrder = listContractOrder.IsNull() ? new List <string>() : listContractOrder; if (listContractOrder.Count == 0) { listContractOrder.Add(order); } entity.And("ContractOrder", ECondition.In, listContractOrder.ToArray()); } if (OutType > 0) { entity.And(a => a.OutType == OutType); } if (!planNum.IsEmpty()) { OutStoDetailEntity detail = new OutStoDetailEntity(); detail.Where("ContractOrder", ECondition.Like, "%" + planNum + "%"); entity.Left <OutStoDetailEntity>(detail, new Params <string, string>() { Item1 = "OrderNum", Item2 = "OrderNum" }); } Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(); List <OutStorageEntity> listResult = bill.GetList(entity, ref pageInfo); listResult = listResult == null ? new List <OutStorageEntity>() : listResult; string json = ConvertJson.ListToJson <OutStorageEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", json); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return(Content(this.ReturnJson.ToString())); }