public string IWantToSupply_List(QueryCommon <IWantToBuyQuery> query) { Result_List_Pager <Result_IWantToSupply> res = new Result_List_Pager <Result_IWantToSupply>() { Msg = new Result_Msg() { IsSuccess = true }, List = new List <Result_IWantToSupply>(), PageInfo = new PageInfo() }; Result_List_Pager <IWantToSupply> list = iWantToBuyService.GetObjectById_Web_SupplyList_Pager(query); if (list.Msg.IsSuccess) { var listHash = hashSet.Get_DictionariesList(); res.PageInfo = list.PageInfo; res.List = list.List.Select(x => new Result_IWantToSupply() { Id = x.Id, PurchaseNum = x.PurchaseNum.ToString(), IWantToBuyID = x.IWantToBuyID, UnitPrice = x.UnitPrice, Quantity = x.Quantity, Unit = x.Unit, TotalPrice = x.TotalPrice, SupplierID = x.SupplierID, TypeOfCurrency = listHash.Where(y => y.DictionaryTypeId == 1 && y.DValue == x.TypeOfCurrency.ToString()).FirstOrDefault().Remarks, ShopName = iWantToBuyService.GetCompanyInfo_ByUserIdAndUserType(x.SupplierID).Model.CompanyName, ShopId = iWantToBuyService.GetCompanyInfo_ByUserIdAndUserType(x.SupplierID).Model.Id, CreateDate = x.CreateDate.ToString("yyyy-MM-dd hh:mm"), BidDate = x.BidDate.ToString("yyyy-MM-dd hh:mm"), LatestDeliveryTime = x.LatestDeliveryTime.ToString("yyyy-MM-dd hh:mm"), UpdateDate = x.UpdateDate.ToString("yyyy-MM-dd hh:mm"), Status = x.Status, StatusStr = listHash.Where(y => y.DictionaryTypeId == 108 && y.DKey == x.Status.ToString()).FirstOrDefault().DValue }).ToList(); } return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); }
/// <summary> /// 获取“我要采购——中标商家信息” /// </summary> /// <param name="userId"></param> /// <returns></returns> public Result_Model <Result_IWantToSupply> Get_SupplyModel_ByIWantToBuyID(long userId) { Result_Model <Result_IWantToSupply> res = new Result_Model <Result_IWantToSupply>() { Msg = new Result_Msg() { IsSuccess = false } }; Result_Model <IWantToSupply> res1 = supplyService.Get_SupplyModel_ByIWantToBuyID(userId); var listHash = hashSet.Get_DictionariesList(); if (res1.Msg.IsSuccess) { res.Msg = res1.Msg; res.Model = new Result_IWantToSupply() { Id = res1.Model.Id, PurchaseNum = res1.Model.PurchaseNum.ToString(), IWantToBuyID = res1.Model.IWantToBuyID, UnitPrice = res1.Model.UnitPrice, Quantity = res1.Model.Quantity, Unit = res1.Model.Unit, TotalPrice = res1.Model.TotalPrice, SupplierID = res1.Model.SupplierID, TypeOfCurrency = listHash.Where(y => y.DictionaryTypeId == 1 && y.DValue == res1.Model.TypeOfCurrency.ToString()).FirstOrDefault().Remarks, ShopName = supplyService.GetCompanyInfo_ByUserIdAndUserType(res1.Model.SupplierID).Model.CompanyName, IsMine = res1.Model.SupplierID == base.CurrentUser.Id ? 1 : 0, CreateDate = res1.Model.CreateDate.ToString("yyyy-MM-dd hh:mm"), BidDate = res1.Model.BidDate.ToString("yyyy-MM-dd hh:mm"), LatestDeliveryTime = res1.Model.LatestDeliveryTime.ToString("yyyy-MM-dd hh:mm"), UpdateDate = res1.Model.UpdateDate.ToString("yyyy-MM-dd hh:mm"), Status = res1.Model.Status, StatusStr = listHash.Where(y => y.DictionaryTypeId == 108 && y.DKey == res1.Model.Status.ToString()).FirstOrDefault().DValue }; } return(res); }
public string SupplyList(QueryCommon <IWantToBuyQuery> query) { query.ParamInfo.PurchaseID = base.CurrentUser.Id; Result_List_Pager <Result_IWantToBuy> res = new Result_List_Pager <Result_IWantToBuy>(); IIWantToBuyService jobsService = ServiceHelper.Create <IIWantToBuyService>(); Result_List_Pager <IWantToBuy> resList = jobsService.GetIWantToBuyList_SupplyUser_Pager(query); var listHash = hashSet.Get_DictionariesList(); if (resList.Msg.IsSuccess) { res.PageInfo = resList.PageInfo; res.Msg = resList.Msg; res.List = resList.List.Select(x => new Result_IWantToBuy() { Id = x.Id, SupplyModel = Get_SupplyModel_ByIWantToBuyID(x.Id), //SupplierID = Get_SupplierID_ByIWantToBuyID(x.Id), //IsMine = Get_SupplierID_ByIWantToBuyID(x.Id) > 0 ? 1 : 0, //ShopName = jobsService.GetCompanyInfo_ByUserIdAndUserType(Get_SupplierID_ByIWantToBuyID(x.Id)).Model.ShopName, PurchaseID = x.PurchaseID, ProductName = x.ProductName, PurchaseNum = x.PurchaseNum, Quantity = x.Quantity, Remarks = x.Remarks, TotalPrice = x.TotalPrice, Unit = x.Unit, UnitPrice = x.UnitPrice, Address = x.Address, Status = x.Status, StatusStr = listHash.Where(y => y.DictionaryTypeId == 107 && y.DKey == x.Status.ToString()).FirstOrDefault().DValue, DeliveryDate = x.DeliveryDate.ToString("yyyy-MM-dd hh:mm"), CreateDate = x.CreateDate.ToString("yyyy-MM-dd hh:mm"), StartDate = x.StartDate.ToString("yyyy-MM-dd hh:mm"), EndDate = x.EndDate.ToString("yyyy-MM-dd hh:mm"), UpdateDate = x.UpdateDate.ToString("yyyy-MM-dd hh:mm"), TypeOfCurrency = listHash.Where(y => y.DictionaryTypeId == 1 && y.DValue == x.TypeOfCurrency.ToString()).FirstOrDefault().Remarks }).ToList(); foreach (var item in res.List) { if (item.SupplyModel.Msg.IsSuccess) { item.SupplierID = item.SupplyModel.Model.SupplierID; if (item.SupplyModel.Model.SupplierID == base.CurrentUser.Id) { item.IsMine = 1;//0:竞价中;1:我已中标;2:他人中标 Result_Model <ShopInfo> res1 = jobsService.GetCompanyInfo_ByUserIdAndUserType(item.SupplyModel.Model.SupplierID); item.ShopName = res1.Model.CompanyName; } else { item.IsMine = 2;//0:竞价中;1:我已中标;2:他人中标 Result_Model <ShopInfo> res1 = jobsService.GetCompanyInfo_ByUserIdAndUserType(item.SupplyModel.Model.SupplierID); item.ShopName = res1.Model.CompanyName; } } else if (item.SupplierID == 0) { item.IsMine = 0;//0:竞价中;1:我已中标;2:他人中标 } var suppy = Get_SupplyModel_ByUserIdAndIWantToBuyId(Convert.ToInt64(item.Id), base.CurrentUser.Id); if (suppy.Msg.IsSuccess) { item.WhetherParticipation = 1; } else { item.WhetherParticipation = 0; } } } else { res.Msg = resList.Msg; } return(Newtonsoft.Json.JsonConvert.SerializeObject(res)); }