/// <summary> /// 修改出库单的数量 /// </summary> /// <param name="snNum"></param> /// <param name="num"></param> /// <returns></returns> public int EditInOrderNum(string snNum, double num) { OutStoDetailEntity detail = new OutStoDetailEntity(); detail = new OutStoDetailEntity(); detail.Include(a => new { a.OrderNum, a.Num, a.OutPrice, a.Amount }); detail.Where(a => a.SnNum == snNum); detail = this.OutStoDetail.GetSingle(detail); int line = 0; if (detail != null) { string orderNum = detail.OrderNum; OutStoDetailEntity editDetail = new OutStoDetailEntity(); editDetail.Num = num; editDetail.Amount = editDetail.Num * editDetail.OutPrice; editDetail.IncludeNum(true).IncludeAmount(true); editDetail.Where(a => a.SnNum == snNum); line = this.OutStoDetail.Update(editDetail); OutStoDetailEntity orderDetail = new OutStoDetailEntity(); orderDetail.Include(a => new { a.Num, a.Amount }); orderDetail.Where(a => a.OrderNum == orderNum); List <OutStoDetailEntity> list = this.OutStoDetail.GetList(orderDetail); OutStorageEntity entity = new OutStorageEntity(); entity.Num = list.Sum(a => a.Num); entity.Amount = list.Sum(a => a.Amount); entity.IncludeNum(true).IncludeAmount(true); entity.Where(a => a.OrderNum == orderNum); line += this.OutStorage.Update(entity); } return(line); }
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())); }