public ActionResult ReturnTOP10Num() { int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0); int pageIndex = 1; int pageSize = 10; string storageNum = this.DefaultStore; ReturnProvider provider = new ReturnProvider(); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; List<Proc_ReturnTOP10NumEntity> listResult = provider.GetListTOP10(queryTime, storageNum); listResult = listResult.IsNull() ? new List<Proc_ReturnTOP10NumEntity>() : listResult; /*******************************************订单数量排名前十的客户饼图数据****************************************************/ StringBuilder sb = new StringBuilder(); sb.Append("<pie>"); listResult.ForEach(a => { if (a.TotalNum > 0) { sb.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.ProductName, a.TotalNum.ToString()); } }); sb.Append("</pie>"); this.ReturnJson.AddProperty("InStorageData", sb.ToString()); string json = ConvertJson.ListToJson<Proc_ReturnTOP10NumEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return Content(this.ReturnJson.ToString()); }
public ActionResult Load() { string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty); if (!OrderNum.IsEmpty()) { ReturnProvider provider = new ReturnProvider(); ReturnOrderEntity backEntity = provider.CheckOrder(OrderNum); if (backEntity != null && backEntity.Status == (int)EAudite.Wait) { this.ReturnJson.AddProperty("d", "1001"); return Content(this.ReturnJson.ToString()); } Bill<OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder(); OutStorageEntity entity = new OutStorageEntity(); entity.OrderNum = OrderNum; entity = bill.GetOrder(entity); if (entity.IsNotNull()) { if (entity.Status != (int)EAudite.Pass) { this.ReturnJson.AddProperty("d", "1002"); return Content(this.ReturnJson.ToString()); } this.ReturnJson.AddProperty("CusNum", entity.CusNum); this.ReturnJson.AddProperty("CusName", entity.CusName); this.ReturnJson.AddProperty("Address", entity.Address); this.ReturnJson.AddProperty("Contact", entity.Contact); this.ReturnJson.AddProperty("Phone", entity.Phone); //加载详细内容 OutStoDetailEntity detail = new OutStoDetailEntity(); detail.OrderNum = OrderNum; List<OutStoDetailEntity> list = bill.GetOrderDetail(detail); list = list.IsNull() ? new List<OutStoDetailEntity>() : list; //获得已经退货的数量 List<ReturnDetailEntity> listResult = provider.GetDetailByOrder(OrderNum); if (!listResult.IsNullOrEmpty()) { list.ForEach(a => { double qty = listResult.Where(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum && b.BatchNum==a.BatchNum).Sum(b => b.BackNum); a.BackNum = qty; }); } Session[CacheKey.TEMPDATE_CACHE_RETURNPRODUCTDETAIL] = list; string json = ConvertJson.ListToJson<OutStoDetailEntity>(list, "List"); this.ReturnJson.AddProperty("data", json); } } return Content(this.ReturnJson.ToString()); }
public ActionResult ReturnReportList() { int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0); int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0); int pageSize = WebUtil.GetFormValue<int>("pageSize", 0); string storageNum = this.DefaultStore; ReturnProvider provider = new ReturnProvider(); ReturnOrderEntity entity = new ReturnOrderEntity(); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; if (queryTime > 0) { entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now); } if (storageNum.IsNotNull()) { entity.Where("StorageNum", ECondition.Eth, storageNum); } List<ReturnOrderEntity> listResult = provider.GetList(entity, ref pageInfo); listResult = listResult == null ? new List<ReturnOrderEntity>() : listResult; string json = ConvertJson.ListToJson<ReturnOrderEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return Content(this.ReturnJson.ToString()); }
public ActionResult Edit() { //退货单号 string OrderNum = WebUtil.GetFormValue<string>("OrderNum", string.Empty); if (!OrderNum.IsEmpty()) { //退货单部分 Bill<ReturnOrderEntity, ReturnDetailEntity> bill = new ReturnOrder(); ReturnOrderEntity entity = new ReturnOrderEntity(); entity.OrderNum = OrderNum; entity = bill.GetOrder(entity); if (entity.Status != (int)EAudite.Wait) { this.ReturnJson.AddProperty("d", "1001"); return Content(this.ReturnJson.ToString()); } ReturnDetailEntity detail = new ReturnDetailEntity(); detail.OrderNum = OrderNum; List<ReturnDetailEntity> listDetails = bill.GetOrderDetail(detail); //出货单部分 Bill<OutStorageEntity, OutStoDetailEntity> provider = new OutStorageOrder(); OutStoDetailEntity items = new OutStoDetailEntity(); items.OrderNum = entity.ContractOrder; List<OutStoDetailEntity> list = provider.GetOrderDetail(items); //已经退货部分 ReturnProvider returnProvider = new ReturnProvider(); List<ReturnDetailEntity> listResult = returnProvider.GetDetailByOrder(entity.ContractOrder); if (!list.IsNullOrEmpty()) { list.ForEach(a => { ReturnDetailEntity item = listDetails.FirstOrDefault(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum); if (item != null) { a.Qty = item.BackNum; } a.BackNum = listResult.Where(b => b.BarCode == a.BarCode && b.ProductNum == a.ProductNum && b.LocalNum == a.LocalNum && b.StorageNum == a.StorageNum).Sum(b => b.BackNum); }); } Session[CacheKey.TEMPDATE_CACHE_RETURNPRODUCTDETAIL] = list; string json = ConvertJson.ListToJson<OutStoDetailEntity>(list, "List"); this.ReturnJson.AddProperty("data", json); } return Content(this.ReturnJson.ToString()); }