/// <summary> /// Get paths of all images (only with valid extension). /// </summary> /// <param name="topic">The topic</param> /// <returns>Paths to all images of topic</returns> private IEnumerable <string> GetImagePaths(Topic topic) { // get image path string[] imageFolderPath = GetImageFolder(topic); return(ImagePathUtil.GetValidImagePaths(FileContainer.GetFiles(imageFolderPath))); }
protected override GetSalesReturnDetailRD ProcessRequest(DTO.Base.APIRequest <GetSalesReturnDetailRP> pRequest) { var rd = new GetSalesReturnDetailRD(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var salesReturnBLL = new T_SalesReturnBLL(loggingSessionInfo); var historyBLL = new T_SalesReturnHistoryBLL(loggingSessionInfo); var inoutService = new InoutService(loggingSessionInfo); var tInoutDetailBll = new TInoutDetailBLL(loggingSessionInfo); var inoutBLL = new T_InoutBLL(CurrentUserInfo); var salesReturnEntity = salesReturnBLL.GetByID(para.SalesReturnID); var PaymentTtpeBLL = new T_Payment_TypeBLL(loggingSessionInfo); if (salesReturnEntity != null) { var orderInfo = inoutBLL.GetByID(salesReturnEntity.OrderID); rd.SalesReturnID = salesReturnEntity.SalesReturnID.ToString(); rd.SalesReturnNo = salesReturnEntity.SalesReturnNo; rd.OrderID = salesReturnEntity.OrderID; rd.OrderNo = orderInfo.order_no; rd.Status = salesReturnEntity.Status; rd.DeliveryType = salesReturnEntity.DeliveryType; rd.Reason = salesReturnEntity.Reason; rd.Qty = salesReturnEntity.Qty; rd.ActualQty = salesReturnEntity.ActualQty; rd.Contacts = salesReturnEntity.Contacts; rd.Phone = salesReturnEntity.Phone; rd.Address = string.Empty; if (orderInfo != null) { rd.Address = orderInfo.Field4; } rd.ServicesType = salesReturnEntity.ServicesType; //根据订单ID获取订单明细[复用] DataRow drItem = inoutService.GetOrderDetailByOrderId(salesReturnEntity.OrderID).Tables[0].Select(" item_id= '" + salesReturnEntity.ItemID + "'").FirstOrDefault(); //获取商品的图片[复用] //string itemImage = tInoutDetailBll.GetOrderDetailImageList("'" + salesReturnEntity.ItemID + "'").Tables[0].Rows[0]["imageUrl"].ToString(); string itemImage = string.Empty; DataSet ds = tInoutDetailBll.GetOrderDetailImageList("'" + salesReturnEntity.ItemID + "'"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { itemImage = ds.Tables[0].Rows[0]["imageUrl"].ToString(); } //获取订单详细列表中的商品规格[复用] DataRow[] drSku = inoutService.GetInoutDetailGgByOrderId(salesReturnEntity.OrderID).Tables[0].Select(" sku_id='" + salesReturnEntity.SkuID + "'"); //订单的商品信息 var orderDetail = new OrderInfoDetail(); orderDetail.ItemName = drItem["item_name"].ToString(); orderDetail.SalesPrice = Convert.ToDecimal(drItem["enter_price"]); orderDetail.Qty = Convert.ToInt32(drItem["enter_qty"]); if (!string.IsNullOrEmpty(itemImage)) { orderDetail.ImageUrl = ImagePathUtil.GetImagePathStr(itemImage, "240"); } orderDetail.PayTypeName = salesReturnEntity.PayTypeName; //支付方式名称 var OrderData = inoutBLL.GetByID(salesReturnEntity.OrderID); string m_PayTypeName = ""; if (OrderData != null) { var PayTypeData = PaymentTtpeBLL.GetByID(OrderData.pay_id); if (PayTypeData != null) { m_PayTypeName = PayTypeData.Payment_Type_Name; } } orderDetail.PayTypeName = m_PayTypeName; orderDetail.RefundAmount = salesReturnEntity.RefundAmount == null ? 0 : salesReturnEntity.RefundAmount.Value; orderDetail.ConfirmAmount = salesReturnEntity.ConfirmAmount == null ? 0 : salesReturnEntity.ConfirmAmount.Value; rd.OrderDetail = orderDetail; //订单的商品规格 if (drSku.Count() > 0) { SkuDetailInfo skuDetail = new SkuDetailInfo(); skuDetail.PropName1 = drSku[0]["prop_1_name"].ToString(); skuDetail.PropDetailName1 = drSku[0]["prop_1_detail_name"].ToString(); skuDetail.PropName2 = drSku[0]["prop_2_name"].ToString(); skuDetail.PropDetailName2 = drSku[0]["prop_2_detail_name"].ToString(); skuDetail.PropName3 = drSku[0]["prop_3_name"].ToString(); skuDetail.PropDetailName3 = drSku[0]["prop_3_detail_name"].ToString(); rd.OrderDetail.SkuDetail = skuDetail; } var history = historyBLL.QueryByEntity(new T_SalesReturnHistoryEntity() { SalesReturnID = salesReturnEntity.SalesReturnID }, new[] { new OrderBy { FieldName = "CreateTime", Direction = OrderByDirections.Desc } }); rd.HistoryList = history.Select(t => new HistoryInfo() { HistoryID = t.HistoryID.ToString(), OperationDesc = t.OperationDesc, HisRemark = t.HisRemark, OperatorName = t.OperatorName, CreateTime = t.CreateTime.Value.ToString("yyyy-MM-dd HH:mm") }).ToArray(); } return(rd); }
/// <summary> /// 获取订单状态 Add by Alex Tian 2014-04-16 /// </summary> /// <returns></returns> public GetOrdersRD GetOrder(string vipno, int PageIndex, int PageSize, string customer_id, int GroupingType, string ChannelId, string UserId, bool isShowUnitName = false) { var loggingSessionInfo = this.CurrentUserInfo as LoggingSessionInfo; var unitbll = new UnitBLL(loggingSessionInfo); GetOrdersRD rdata = new GetOrdersRD(); DataSet ds = null; //switch (GroupingType) //{ // case 1: // ds = this._currentDAO.GetOrderByObligation(vipno, PageIndex, PageSize, customer_id); //查询订单状态为待付款 // break; // case 2: // ds = this._currentDAO.GetOrderByNodelivery(vipno, PageIndex, PageSize, customer_id); //查询订单状态为待收货/提货 // break; // case 3: // ds = this._currentDAO.GetOrderBydonedeal(vipno, PageIndex, PageSize, customer_id); //订单状态为已完成 // break; // default: // break; //} //如果是人人销售渠道取新的存储过程 add by donal 2014-9-26 17:41:10 if (ChannelId == "6") { ds = this._currentDAO.GetOrderByGroupingTypeEvery(UserId, PageIndex, PageSize, customer_id, GroupingType); } else { ds = this._currentDAO.GetOrderByGroupingType(vipno, PageIndex, PageSize, customer_id, GroupingType); } if (ds != null && ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0) { List <T_InoutEntity> list = new List <T_InoutEntity> { }; int count = Convert.ToInt32(ds.Tables[1].Rows[0][0]); if (count <= 0) { return(rdata); } using (var rd = ds.Tables[1].CreateDataReader()) { while (rd.Read()) { T_InoutEntity m; this._currentDAO.NewLoad(rd, out m); list.Add(m); } } var ids = list.Select(t => t.order_id).ToArray(); var detailBLL = new T_Inout_DetailBLL(this.CurrentUserInfo as LoggingSessionInfo); var detailEntitys = detailBLL.GetByIDS(ids); var Orderlist = new List <JIT.CPOS.DTO.Module.VIP.Order.Response.OrderInfo> { }; #region [ 组织orderInfo ] foreach (var item in list) { JIT.CPOS.DTO.Module.VIP.Order.Response.OrderInfo orderinfo = new DTO.Module.VIP.Order.Response.OrderInfo(); orderinfo.OrderID = item.order_id; //订单ID orderinfo.OrderNO = item.order_no; //订单编码 orderinfo.DeliveryTypeID = Convert.ToInt32(string.IsNullOrEmpty(item.Field8) ? "0" : item.Field8); //配送方式类别ID,1.送货上门。2.到店自取 orderinfo.purchase_unit_id = item.purchase_unit_id; //提货门店 orderinfo.OrderDate = item.create_time; //在订单表中的下单时间没有时分秒。所以取create_time orderinfo.OrderStatusDesc = item.status_desc; //订单状态描述 orderinfo.OrderStatus = Convert.ToInt32(item.status); //订单状态 orderinfo.TotalQty = Convert.ToInt32(item.total_qty); //商品购买数量 if (string.IsNullOrEmpty(item.Field3)) { item.Field3 = "0"; } orderinfo.TotalAmount = Convert.ToDecimal(item.actual_amount) - Convert.ToDecimal(item.Field3); //总金额 orderinfo.PaymentTypeCode = item.Payment_Type_Code; //支付方式 orderinfo.ReturnCash = item.ReturnCash == null ? 0.00m : Convert.ToDecimal(item.ReturnCash); //佣金 orderinfo.IsEvaluation = item.IsEvaluation == null ? 0 : item.IsEvaluation.Value; //是否评论 orderinfo.IsPayed = item.Field1 == null ? "0" : item.Field1; #region 根据OrderInfo组织detail var templist = detailEntitys.Where(t => t.order_id == item.order_id).ToArray(); var tempDetailInfos = new List <JIT.CPOS.DTO.Module.VIP.Order.Response.OrderDetailInfo> { }; foreach (var it in templist) { var detailInfo = new JIT.CPOS.DTO.Module.VIP.Order.Response.OrderDetailInfo(); detailInfo.ItemID = it.ItemID; //商品ID detailInfo.ItemName = it.ItemName; //商品名称 detailInfo.SKUID = it.SKUID; //SKUID detailInfo.Qty = it.Qty; //购买数量 detailInfo.SpecificationDesc = it.SpecificationDesc; //规格描述 detailInfo.SalesPrice = it.SalesPrice; //实际单价 detailInfo.ImageUrl = ImagePathUtil.GetImagePathStr(it.ImageUrl, "240"); //Url图片 update by Henry 2014-12-8 detailInfo.ReturnCash = it.ReturnCash; detailInfo.isGB = it.isGB; if (it.isGB == 0) { orderinfo.IsIncludeGB = 1; } #region 新增规格 var GGds = _currentDAO.GetInoutDetailGgByOrderId(orderinfo.OrderID); if (GGds != null && GGds.Tables.Count > 0) { detailInfo.GG = GGds.Tables[0].AsEnumerable() .Where(t => t["sku_id"].ToString() == it.SKUID.ToString()) .Select(t => new JIT.CPOS.DTO.Module.VIP.Order.Response.GuiGeInfo { PropName1 = t["prop_1_name"].ToString(), PropDetailName1 = t["prop_1_detail_name"].ToString(), PropName2 = t["prop_2_name"].ToString(), PropDetailName2 = t["prop_2_detail_name"].ToString(), PropName3 = t["prop_3_name"].ToString(), PropDetailName3 = t["prop_3_detail_name"].ToString(), PropName4 = t["prop_4_name"].ToString(), PropDetailName4 = t["prop_4_detail_name"].ToString(), PropName5 = t["prop_5_name"].ToString(), PropDetailName5 = t["prop_5_detail_name"].ToString() }).FirstOrDefault(); } #endregion tempDetailInfos.Add(detailInfo); } #endregion if (isShowUnitName) { var unit = unitbll.GetUnitDetail(item.sales_unit_id); orderinfo.Unit = unit.unit_name; } orderinfo.OrderDetails = tempDetailInfos.ToArray(); Orderlist.Add(orderinfo); } #endregion rdata.PageIndex = PageIndex; rdata.TotalPageCount = count; rdata.Orders = Orderlist.ToArray(); } //获得不同分组下的订单数量 if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { var Grouplist = new List <JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount> { }; if (ds.Tables[0].Rows.Count > 0) { //待付款 var grouporder1 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder1.GroupingType = 1; grouporder1.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt1"].ToString()); Grouplist.Add(grouporder1); if (ChannelId != "6") { //待服务 var grouporder10 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder10.GroupingType = 10; grouporder10.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt10"].ToString()); Grouplist.Add(grouporder10); //待提货 var grouporder11 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder11.GroupingType = 11; grouporder11.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt11"].ToString()); Grouplist.Add(grouporder11); //待发货 var grouporder12 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder12.GroupingType = 12; grouporder12.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt12"].ToString()); Grouplist.Add(grouporder12); //已服务 var grouporder13 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder13.GroupingType = 13; grouporder13.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt13"].ToString()); Grouplist.Add(grouporder13); //已提货 var grouporder14 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder14.GroupingType = 14; grouporder14.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt14"].ToString()); Grouplist.Add(grouporder14); //退换货 var grouporder5 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder5.GroupingType = 5; grouporder5.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt5"].ToString()); Grouplist.Add(grouporder5); } //已发货 var grouporder2 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder2.GroupingType = 2; grouporder2.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt2"].ToString()); Grouplist.Add(grouporder2); //已完成 var grouporder3 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder3.GroupingType = 3; grouporder3.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt3"].ToString()); Grouplist.Add(grouporder3); //已付款且门店自提 Add by Henry 2014-12-18 if (ChannelId == "6") { var grouporder4 = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); grouporder4.GroupingType = 4; grouporder4.OrderCount = int.Parse(ds.Tables[0].Rows[0]["RowRnt4"].ToString()); Grouplist.Add(grouporder4); } else { //未评论订单个数 var noEvaluationCount = new JIT.CPOS.DTO.Module.VIP.Order.Response.GroupingOrderCount(); noEvaluationCount.GroupingType = 6; noEvaluationCount.OrderCount = int.Parse(ds.Tables[0].Rows[0]["NoEvaluationCount"].ToString()); Grouplist.Add(noEvaluationCount); } } rdata.GroupingOrderCounts = Grouplist.ToArray(); } return(rdata); }
protected override GetSalesReturnListRD ProcessRequest(DTO.Base.APIRequest <GetSalesReturnListRP> pRequest) { var rd = new GetSalesReturnListRD(); var para = pRequest.Parameters; var salesReturnBLL = new T_SalesReturnBLL(CurrentUserInfo); var inoutService = new InoutService(CurrentUserInfo); var tInoutDetailBll = new TInoutDetailBLL(CurrentUserInfo); //查询参数 List <IWhereCondition> complexCondition = new List <IWhereCondition> { }; complexCondition.Add(new EqualsCondition() { FieldName = "r.VipID", Value = CurrentUserInfo.UserID }); //排序参数 List <OrderBy> lstOrder = new List <OrderBy> { }; lstOrder.Add(new OrderBy() { FieldName = "r.CreateTime", Direction = OrderByDirections.Desc }); var tempList = salesReturnBLL.PagedQuery(complexCondition.ToArray(), lstOrder.ToArray(), para.PageSize, para.PageIndex + 1);//没有当前用户,就传空 rd.TotalPageCount = tempList.PageCount; rd.TotalCount = tempList.RowCount; List <SalesReturnInfo> salesReturnList = new List <SalesReturnInfo> { }; SalesReturnInfo salesReturnInfo = null; SkuDetailInfo skuDetail = null; foreach (var item in tempList.Entities) { salesReturnInfo = new SalesReturnInfo(); //根据订单ID获取订单明细[复用] DataRow drItem = inoutService.GetOrderDetailByOrderId(item.OrderID).Tables[0].Select(" item_id= '" + item.ItemID + "'").FirstOrDefault(); //获取商品的图片[复用] string itemImage = tInoutDetailBll.GetOrderDetailImageList("'" + item.ItemID + "'").Tables[0].Rows[0]["imageUrl"].ToString(); //获取订单详细列表中的商品规格[复用] DataRow[] drSku = inoutService.GetInoutDetailGgByOrderId(item.OrderID).Tables[0].Select(" sku_id='" + item.SkuID + "'"); salesReturnInfo.SalesReturnID = item.SalesReturnID.ToString(); salesReturnInfo.SalesReturnNo = item.SalesReturnNo; salesReturnInfo.ItemName = drItem["item_name"].ToString(); salesReturnInfo.SalesPrice = Convert.ToDecimal(drItem["enter_price"]); salesReturnInfo.Qty = item.Qty; salesReturnInfo.Status = item.Status; salesReturnInfo.ImageUrl = ImagePathUtil.GetImagePathStr(itemImage, "240"); salesReturnInfo.ServicesType = item.ServicesType; if (drSku.Count() > 0) { skuDetail = new SkuDetailInfo(); skuDetail.PropName1 = drSku[0]["prop_1_name"].ToString(); skuDetail.PropDetailName1 = drSku[0]["prop_1_detail_name"].ToString(); skuDetail.PropName2 = drSku[0]["prop_2_name"].ToString(); skuDetail.PropDetailName2 = drSku[0]["prop_2_detail_name"].ToString(); skuDetail.PropName3 = drSku[0]["prop_3_name"].ToString(); skuDetail.PropDetailName3 = drSku[0]["prop_3_detail_name"].ToString(); salesReturnInfo.SkuDetail = skuDetail; } salesReturnList.Add(salesReturnInfo); } rd.SalesReturnList = salesReturnList.ToArray(); rd.TotalCount = tempList.RowCount; rd.TotalPageCount = tempList.PageCount; return(rd); }
protected override GetRefundOrderDetailRD ProcessRequest(DTO.Base.APIRequest <GetRefundOrderDetailRP> pRequest) { var rd = new GetRefundOrderDetailRD(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var refundOrderBLL = new T_RefundOrderBLL(loggingSessionInfo); var inoutService = new InoutService(loggingSessionInfo); var tInoutDetailBll = new TInoutDetailBLL(loggingSessionInfo); var t_InoutBLL = new T_InoutBLL(loggingSessionInfo); var PaymentTtpeBLL = new T_Payment_TypeBLL(loggingSessionInfo); var refundEntity = refundOrderBLL.GetByID(para.RefundID); if (refundEntity != null) { rd.RefundID = refundEntity.RefundID; rd.RefundNo = refundEntity.RefundNo; rd.Status = refundEntity.Status; rd.OrderNo = refundEntity.OrderNo; rd.Contacts = refundEntity.Contacts; rd.Phone = refundEntity.Phone; rd.ConfirmAmount = refundEntity.ConfirmAmount; rd.ActualRefundAmount = refundEntity.ActualRefundAmount; rd.Points = refundEntity.Points == null ? 0 : refundEntity.Points; rd.PointsAmount = refundEntity.PointsAmount == null ? 0 : refundEntity.PointsAmount; rd.ReturnAmount = refundEntity.ReturnAmount == null ? 0 : refundEntity.RefundAmount; rd.Amount = refundEntity.Amount == null ? 0 : refundEntity.Amount; //支付方式名称 var OrderData = t_InoutBLL.GetByID(refundEntity.OrderID); string m_PayTypeName = ""; if (OrderData != null) { var PayTypeData = PaymentTtpeBLL.GetByID(OrderData.pay_id); if (PayTypeData != null) { m_PayTypeName = PayTypeData.Payment_Type_Name; } } rd.PayTypeName = m_PayTypeName; rd.PayOrderID = refundEntity.PayOrderID; rd.OrderID = refundEntity.OrderID; rd.ItemID = refundEntity.ItemID; if (!string.IsNullOrEmpty(refundEntity.ItemID)) //取消订单时,直接跳转到订单详情 { //根据订单ID获取订单明细[复用] DataRow drItem = inoutService.GetOrderDetailByOrderId(refundEntity.OrderID).Tables[0].Select(" item_id= '" + refundEntity.ItemID + "'").FirstOrDefault(); //获取商品的图片[复用] string itemImage = string.Empty; DataSet ds = tInoutDetailBll.GetOrderDetailImageList("'" + refundEntity.ItemID + "'"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { itemImage = ds.Tables[0].Rows[0]["imageUrl"].ToString(); } //获取订单详细列表中的商品规格[复用] DataRow[] drSku = inoutService.GetInoutDetailGgByOrderId(refundEntity.OrderID).Tables[0].Select(" sku_id='" + refundEntity.SkuID + "'"); //订单的商品信息 var orderDetail = new OrderInfoDetail(); orderDetail.ItemName = drItem["item_name"].ToString(); orderDetail.SalesPrice = Convert.ToDecimal(drItem["enter_price"]); orderDetail.Qty = Convert.ToInt32(drItem["enter_qty"]); if (!string.IsNullOrEmpty(itemImage)) { orderDetail.ImageUrl = ImagePathUtil.GetImagePathStr(itemImage, "240"); } rd.OrderDetail = orderDetail; //订单的商品规格 if (drSku.Count() > 0) { SkuDetailInfo skuDetail = new SkuDetailInfo(); skuDetail.PropName1 = drSku[0]["prop_1_name"].ToString(); skuDetail.PropDetailName1 = drSku[0]["prop_1_detail_name"].ToString(); skuDetail.PropName2 = drSku[0]["prop_2_name"].ToString(); skuDetail.PropDetailName2 = drSku[0]["prop_2_detail_name"].ToString(); skuDetail.PropName3 = drSku[0]["prop_3_name"].ToString(); skuDetail.PropDetailName3 = drSku[0]["prop_3_detail_name"].ToString(); rd.OrderDetail.SkuDetail = skuDetail; } } } return(rd); }
protected override GetSalesReturnListRD ProcessRequest(DTO.Base.APIRequest <GetSalesReturnListRP> pRequest) { var rd = new GetSalesReturnListRD(); var para = pRequest.Parameters; var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo; var salesReturnBLL = new T_SalesReturnBLL(loggingSessionInfo); var T_InoutBLL = new T_InoutBLL(loggingSessionInfo); var inoutService = new InoutService(loggingSessionInfo); var tInoutDetailBll = new TInoutDetailBLL(loggingSessionInfo); //查询参数 List <IWhereCondition> complexCondition = new List <IWhereCondition> { }; complexCondition.Add(new EqualsCondition() { FieldName = "r.CustomerID", Value = loggingSessionInfo.ClientID }); if (!string.IsNullOrEmpty(para.SalesReturnNo)) { complexCondition.Add(new LikeCondition() { FieldName = "r.SalesReturnNo", Value = "%" + para.SalesReturnNo + "%" }); } if (para.DeliveryType > 0) { complexCondition.Add(new EqualsCondition() { FieldName = "r.DeliveryType", Value = para.DeliveryType }); } if (para.Status > 0 && para.Status < 8) { complexCondition.Add(new EqualsCondition() { FieldName = "r.Status", Value = para.Status }); } else if (para.Status == 8)//包含待退款和已退款 { string[] statusArr = new string[] { "6", "7" }; complexCondition.Add(new InCondition <string>() { FieldName = "r.Status", Values = statusArr }); } if (!string.IsNullOrEmpty(para.paymentcenterId)) { complexCondition.Add(new EqualsCondition() { FieldName = "t.paymentcenter_id", Value = para.paymentcenterId }); } if (!string.IsNullOrEmpty(para.payId)) { complexCondition.Add(new EqualsCondition() { FieldName = "p.Payment_Type_Id", Value = para.payId }); } //门店过滤处理 //排序参数 List <OrderBy> lstOrder = new List <OrderBy> { }; lstOrder.Add(new OrderBy() { FieldName = "r.CreateTime", Direction = OrderByDirections.Desc }); var tempList = salesReturnBLL.PagedQuery(complexCondition.ToArray(), lstOrder.ToArray(), para.PageSize, para.PageIndex); rd.TotalPageCount = tempList.PageCount; rd.TotalCount = tempList.RowCount; List <SalesReturnInfo> salesReturnList = new List <SalesReturnInfo> { }; SalesReturnInfo salesReturnInfo = null; //SkuDetailInfo skuDetail = null; foreach (var item in tempList.Entities) { salesReturnInfo = new SalesReturnInfo(); //根据订单ID获取订单明细[复用] DataRow drItem = inoutService.GetOrderDetailByOrderId(item.OrderID).Tables[0].Select(" item_id= '" + item.ItemID + "'").FirstOrDefault(); if (drItem != null) { //获取商品的图片[复用] string itemImage = string.Empty; DataSet ds = tInoutDetailBll.GetOrderDetailImageList("'" + item.ItemID + "'"); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { itemImage = ds.Tables[0].Rows[0]["imageUrl"].ToString(); } //获取订单详细列表中的商品规格[复用] //DataRow[] drSku = inoutService.GetInoutDetailGgByOrderId(item.OrderID).Tables[0].Select(" sku_id='" + item.SkuID + "'"); salesReturnInfo.SalesReturnID = item.SalesReturnID.ToString(); salesReturnInfo.SalesReturnNo = item.SalesReturnNo; salesReturnInfo.ItemName = drItem["item_name"].ToString(); salesReturnInfo.SalesPrice = Convert.ToDecimal(drItem["enter_price"]); salesReturnInfo.Qty = item.Qty; salesReturnInfo.Status = item.Status; if (!string.IsNullOrEmpty(itemImage)) { salesReturnInfo.ImageUrl = ImagePathUtil.GetImagePathStr(itemImage, "240"); } salesReturnInfo.VipName = item.VipName; salesReturnInfo.DeliveryType = item.DeliveryType; salesReturnInfo.CreateTime = item.CreateTime.Value.ToString("yyyy-MM-dd HH:mm"); //商户单号,支付方式 salesReturnInfo.paymentcenterId = item.paymentcenterId; salesReturnInfo.paymentName = item.PayTypeName; salesReturnInfo.ServicesType = item.ServicesType; //if (drSku.Count() > 0) //{ // skuDetail = new SkuDetailInfo(); // skuDetail.PropName1 = drSku[0]["prop_1_name"].ToString(); // skuDetail.PropDetailName1 = drSku[0]["prop_1_detail_name"].ToString(); // skuDetail.PropName2 = drSku[0]["prop_2_name"].ToString(); // skuDetail.PropDetailName2 = drSku[0]["prop_2_detail_name"].ToString(); // skuDetail.PropName3 = drSku[0]["prop_3_name"].ToString(); // skuDetail.PropDetailName3 = drSku[0]["prop_3_detail_name"].ToString(); // salesReturnInfo.SkuDetail = skuDetail; // //} salesReturnList.Add(salesReturnInfo); } } rd.SalesReturnList = salesReturnList.ToArray(); rd.TotalCount = tempList.RowCount; rd.TotalPageCount = tempList.PageCount; return(rd); }
protected override GetOrderDetailRD ProcessRequest(DTO.Base.APIRequest <GetOrderDetailRP> pRequest) { GetOrderDetailRD rd = new GetOrderDetailRD(); string orderId = pRequest.Parameters.OrderId; rd.OrderListInfo = new OrderListInfo(); #region 获取订单列表 T_InoutBLL orderBll = new T_InoutBLL(this.CurrentUserInfo); var orderList = orderBll.QueryByEntity(new T_InoutEntity() { order_id = orderId }, null); #endregion #region 获取会员信息 string vipNo = orderList[0].vip_no; VipBLL vipBll = new VipBLL(this.CurrentUserInfo); var vipList = vipBll.QueryByEntity(new VipEntity() { VIPID = vipNo }, null); #endregion #region 获取配方式 //Bear 20160928 注释 更具商品信息获取对应配送 string deliveryId = orderList[0].Field8; DeliveryBLL deliverBll = new DeliveryBLL(this.CurrentUserInfo); var deliverList = deliverBll.QueryByEntity(new DeliveryEntity() { DeliveryId = deliveryId }, null); #endregion #region 获取门店信息 string storeId = orderList[0].sales_unit_id; if (!string.IsNullOrEmpty(orderList[0].purchase_unit_id))//如果有发货门店,则显示发货门店信息 { storeId = orderList[0].purchase_unit_id; } TInoutBLL tInoutBll = new TInoutBLL(this.CurrentUserInfo); //string storeName = tInoutBll.GetStoreName(storeId); DataSet storeDs = tInoutBll.GetStoreInfo(storeId); rd.OrderListInfo.StoreID = storeId; #endregion //配送商 string carrierId = orderList[0].carrier_id; //DataSet carrierDs = tInoutBll.GetStoreInfo(carrierId); //if (carrierDs.Tables[0].Rows.Count > 0) //{ // rd.OrderListInfo.CarrierID = carrierId; // rd.OrderListInfo.CarrierName = carrierDs.Tables[0].Rows[0]["unit_name"].ToString(); //} if (!string.IsNullOrEmpty(carrierId)) { //配送方式 1.送货到家;2.到店提货 if (deliveryId == "1") { var logisticsCompanyBLL = new T_LogisticsCompanyBLL(this.CurrentUserInfo); Guid m_carrierId = Guid.Parse(carrierId); var logCompInfo = logisticsCompanyBLL.GetByID(m_carrierId); if (logCompInfo != null) { rd.OrderListInfo.CarrierID = carrierId; rd.OrderListInfo.CarrierName = logCompInfo.LogisticsName; } } else if (deliveryId == "2") { var unitBLL = new t_unitBLL(this.CurrentUserInfo); var unitInfo = unitBLL.GetByID(carrierId); if (unitInfo != null) { rd.OrderListInfo.CarrierID = carrierId; rd.OrderListInfo.CarrierName = unitInfo.unit_name; } } else if (deliveryId == "4") { var unitBLL = new t_unitBLL(this.CurrentUserInfo); var unitInfo = unitBLL.GetByID(carrierId); if (unitInfo != null) { rd.OrderListInfo.CarrierID = carrierId; rd.OrderListInfo.CarrierName = unitInfo.unit_name; } } } rd.OrderListInfo.CourierNumber = orderList[0].Field2; //配送单号 rd.OrderListInfo.Invoice = orderList[0].Field19 == null ? "" : orderList[0].Field19; //发票信息 if (vipList.Count() > 0) { rd.OrderListInfo.VipID = vipList[0].VIPID; rd.OrderListInfo.Phone = vipList[0].Phone; rd.OrderListInfo.UserName = vipList[0].VipName; rd.OrderListInfo.VipRealName = vipList[0].VipRealName; rd.OrderListInfo.VipLevelDesc = vipList[0].VipLevelDesc; rd.OrderListInfo.VipCode = vipList[0].VipCode; rd.OrderListInfo.Email = vipList[0].Email; rd.OrderListInfo.VipLevel = Convert.ToInt32(vipList[0].VipLevel); } if (storeDs.Tables[0].Rows.Count > 0) { rd.OrderListInfo.StoreName = storeDs.Tables[0].Rows[0]["unit_name"].ToString(); rd.OrderListInfo.StoreAddress = storeDs.Tables[0].Rows[0]["unit_address"].ToString(); rd.OrderListInfo.StoreTel = storeDs.Tables[0].Rows[0]["unit_tel"].ToString(); } if (orderList.Count() > 0) { rd.OrderListInfo.discount_rate = orderList[0].discount_rate ?? 100;//订单折扣 rd.OrderListInfo.OrderID = orderList[0].order_id; rd.OrderListInfo.OrderCode = orderList[0].order_no; rd.OrderListInfo.OrderDate = orderList[0].order_date; rd.OrderListInfo.ReceiverName = orderList[0].Field14; //收件人 rd.OrderListInfo.TotalQty = Convert.ToDecimal(orderList[0].total_qty); string TotalAmount = String.Format("{0:F}", orderList[0].total_amount ?? 0); rd.OrderListInfo.TotalAmount = TotalAmount; rd.OrderListInfo.Total_Retail = Convert.ToDecimal(orderList[0].total_retail); rd.OrderListInfo.Remark = orderList[0].remark; rd.OrderListInfo.Status = orderList[0].status; rd.OrderListInfo.OrderStatus = int.Parse(orderList[0].Field7); rd.OrderListInfo.StatusDesc = orderList[0].status_desc; rd.OrderListInfo.DeliveryAddress = orderList[0].Field4; rd.OrderListInfo.DeliveryTime = orderList[0].Field9; rd.OrderListInfo.ClinchTime = orderList[0].create_time; rd.OrderListInfo.ReceiptTime = orderList[0].accpect_time; rd.OrderListInfo.CouponsPrompt = orderList[0].Field16; rd.OrderListInfo.DeliveryID = orderList[0].Field8; rd.OrderListInfo.IsPayment = orderList[0].Field1; rd.OrderListInfo.ReceivePoints = orderList[0].receive_points; rd.OrderListInfo.PaymentTime = orderList[0].Field1 == "1" ? orderList[0].complete_date : null; rd.OrderListInfo.OrderReasonTypeId = orderList[0].order_reason_id; rd.OrderListInfo.ActualDecimal = orderList[0].actual_amount ?? 0; rd.OrderListInfo.PaymentTypeCode = orderList[0].Payment_Type_Code; rd.OrderListInfo.PaymentTypeName = orderList[0].Payment_Type_Name; rd.OrderListInfo.ReserveTime = orderList[0].reserveDay + " " + orderList[0].reserveQuantum; var deliveryBll = new TOrderCustomerDeliveryStrategyMappingBLL(this.CurrentUserInfo); rd.OrderListInfo.DeliveryAmount = deliveryBll.GetDeliverAmount(orderId); //配送费 add by henry*** if (!string.IsNullOrEmpty(orderList[0].Field15) && orderList[0].Field15 != "0") //是否是团购商品 add by Henry 2014-12-22 { rd.OrderListInfo.IsEvent = 1; //团购商品 } else { rd.OrderListInfo.IsEvent = 0; //普通商品 } #region update by changjian.tian rd.OrderListInfo.Mobile = orderList[0].Field6; //配送联系电话 rd.OrderListInfo.DeliveryRemark = orderList[0].remark; rd.OrderListInfo.IsEvaluation = orderList[0].IsEvaluation == null ? 0 : orderList[0].IsEvaluation.Value;//评论 #endregion } if (deliverList.Count() > 0) { rd.OrderListInfo.DeliveryName = deliverList[0].DeliveryName; } T_Inout_DetailBLL orderDetailBll = new T_Inout_DetailBLL(this.CurrentUserInfo); //退换货Bll实例化 T_SalesReturnBLL salesReturnBll = new T_SalesReturnBLL(this.CurrentUserInfo); var orderDetailList = orderDetailBll.QueryByEntity(new T_Inout_DetailEntity() { order_id = orderId }, null); var inoutService = new InoutService(this.CurrentUserInfo); #region 根据订单ID获取订单明细 var ds = inoutService.GetOrderDetailByOrderId(orderId); #endregion #region 获取订单详细列表中的商品规格 var ggDs = inoutService.GetInoutDetailGgByOrderId(orderId); #endregion if (ds.Tables[0].Rows.Count > 0) { string ItemIdList = ds.Tables[0].AsEnumerable().Aggregate("", (x, j) => { x += string.Format("'{0}',", j["item_id"].ToString()); return(x); }).Trim(','); TInoutDetailBLL tInoutDetailBll = new TInoutDetailBLL(this.CurrentUserInfo); //获取商品的图片 DataSet imageDs = tInoutDetailBll.GetOrderDetailImageList(ItemIdList); var tmp = ds.Tables[0].AsEnumerable().Select(t => new OrderDetailEntity() { ItemID = t["item_id"].ToString(), ItemName = t["item_name"].ToString(), SkuID = t["sku_id"].ToString(), SalesReturnFlag = salesReturnBll.CheckSalesReturn(orderId, t["sku_id"].ToString()),//是否可申请退换货 //GG = t["prop_1_detail_name"].ToString()+t["prop_2_detail_name"].ToString()+t["prop_3_detail_name"].ToString() //+t["prop_4_detail_name"].ToString()+t["prop_5_detail_name"].ToString(), Field9 = t["Field9"].ToString(), isGB = Convert.ToInt32(t["isGB"]), GG = ggDs.Tables[0].AsEnumerable() .Where(tt => tt["sku_id"].ToString() == t["sku_id"].ToString()) .Select(tt => new GuiGeInfo { PropName1 = tt["prop_1_name"].ToString(), PropDetailName1 = tt["prop_1_detail_name"].ToString(), PropName2 = tt["prop_2_name"].ToString(), PropDetailName2 = tt["prop_2_detail_name"].ToString(), PropName3 = tt["prop_3_name"].ToString(), PropDetailName3 = tt["prop_3_detail_name"].ToString(), PropName4 = tt["prop_4_name"].ToString(), PropDetailName4 = tt["prop_4_detail_name"].ToString(), PropName5 = tt["prop_5_name"].ToString(), PropDetailName5 = tt["prop_5_detail_name"].ToString() }).FirstOrDefault(), SalesPrice = Convert.ToDecimal(t["enter_price"]), //DiscountRate = Convert.ToDecimal(t["discount_rate"]), DiscountRate = Convert.ToDecimal(t["order_discount_rate"]), ItemCategoryName = t["itemCategoryName"].ToString(), BeginDate = t["Field1"].ToString(), EndDate = t["Field2"].ToString(), DayCount = Convert.ToInt32(t["DayCount"]), Qty = Convert.ToDecimal(t["enter_qty"]), ImageInfo = imageDs.Tables[0].AsEnumerable() .Where(c => c["ObjectId"].ToString() == t["item_id"].ToString()) .OrderBy(c => c["displayIndex"]) .Select(c => new OrderDetailImage { ImageID = c["imageId"].ToString(), ImageUrl = ImagePathUtil.GetImagePathStr(c["imageUrl"].ToString(), "240") }).ToArray(), IfService = Convert.ToInt32(t["IfService"]) }); int tempCount = 0; foreach (var i in tmp) { if (i.IfService == 0) { tempCount++; } } if (tempCount == 0) { rd.OrderListInfo.IsAllService = 3; // 3-全部为虚拟商品 } else if (tempCount == tmp.Count()) { rd.OrderListInfo.IsAllService = 1; // 1-全部为实物商品 } else { rd.OrderListInfo.IsAllService = 2; // 2-包含实物商品和虚拟商品 } #region 根据商品获取配送方式 var deliveryIds = new List <int?>(); if (rd.OrderListInfo.IsAllService == 3) { deliveryIds.Add(1); deliveryIds.Add(2); deliveryIds.Add(4); rd.OrderListInfo.CanUseDeliveryIDs = deliveryIds; } else { T_Item_Delivery_MappingBLL mappingBll = new T_Item_Delivery_MappingBLL(this.CurrentUserInfo); var complexCondition = new List <IWhereCondition> { }; var itemIdArray = ItemIdList.Replace("'", "").Split(','); complexCondition.Add(new InCondition <string>() { FieldName = "Item_Id", Values = itemIdArray }); var itemDeliveryList = mappingBll.Query(complexCondition.ToArray(), null); bool needAddDelivery4 = false; bool needAddDelivery2 = false; if (itemDeliveryList.ToList().Find(d => d.DeliveryId == 4) != null) { needAddDelivery4 = true; } else { if (itemDeliveryList.ToList().Find(d => d.DeliveryId == 2) != null) { needAddDelivery2 = true; } } var itemDeliveryGroupList = itemDeliveryList.GroupBy(d => d.Item_Id); var index = 0; foreach (var info in itemDeliveryGroupList) { var tmpList = info.ToList <T_Item_Delivery_MappingEntity>(); //分组后的集合 if (index == 0) { deliveryIds.AddRange(tmpList.Select(d => d.DeliveryId)); index++; continue; } deliveryIds = deliveryIds.Intersect(tmpList.Select(d => d.DeliveryId)).ToList(); if (deliveryIds.Count <= 0) { break; // 后面的不用求了 } index++; } if (!deliveryIds.Contains(4) && needAddDelivery4) { deliveryIds.Add(4); } if (!deliveryIds.Contains(2) && needAddDelivery2) { deliveryIds.Add(2); } rd.OrderListInfo.CanUseDeliveryIDs = deliveryIds.OrderBy(t => t.Value).ToList(); } #endregion rd.OrderListInfo.OrderDetailInfo = tmp.ToArray(); } var vipIntegralDetailBll = new VipIntegralDetailBLL(this.CurrentUserInfo); // var integral = vipIntegralDetailBll.GetVipIntegralByOrder(orderId, pRequest.UserID); //使用积分 rd.OrderListInfo.OrderIntegral = Math.Abs(vipIntegralDetailBll.GetVipIntegralByOrder(orderId, vipNo)); //积分抵扣金额 add by Henry 2014-10-8 //decimal integralAmountPre = vipBll.GetIntegralAmountPre(this.CurrentUserInfo.ClientID);//获取积分金额比例 //rd.OrderListInfo.UseIntegralToAmount =rd.OrderListInfo.OrderIntegral*(integralAmountPre>0?integralAmountPre:0.01M); rd.OrderListInfo.UseIntegralToAmount = vipBll.GetAmountByIntegralPer(CurrentUserInfo.ClientID, rd.OrderListInfo.OrderIntegral); var couponUseBll = new CouponUseBLL(this.CurrentUserInfo); var couponParValue = couponUseBll.GetCouponParValue(orderId); rd.OrderListInfo.CouponAmount = couponParValue; var vipAmountDetailBll = new VipAmountDetailBLL(this.CurrentUserInfo); //使用的账户余额 rd.OrderListInfo.VipEndAmount = Math.Abs(vipAmountDetailBll.GetVipAmountByOrderId(orderId, vipNo, 1)); //使用余额,将余额从实付款中分开 if (rd.OrderListInfo.VipEndAmount != 0) { rd.OrderListInfo.ActualDecimal = rd.OrderListInfo.ActualDecimal - rd.OrderListInfo.VipEndAmount; } //使用的返现金额 rd.OrderListInfo.ReturnAmount = Math.Abs(vipAmountDetailBll.GetVipAmountByOrderId(orderId, vipNo, 13)); //使用阿拉币和阿拉币抵扣 add by Henry 2014-10-13 if (pRequest.ChannelId == "4")//阿拉丁APP调用 { decimal aldAmount = Math.Abs(vipAmountDetailBll.GetVipAmountByOrderId(orderId, vipNo, 11)); rd.OrderListInfo.ALDAmount = aldAmount; rd.OrderListInfo.ALDAmountMoney = aldAmount * 0.01M; } #region 获取订单积分,优惠券金额,使用余额 //var vipIntegralDetailBll = new VipIntegralDetailBLL(this.CurrentUserInfo); //var vipIntegralList = vipIntegralDetailBll.QueryByEntity(new VipIntegralDetailEntity() //{ // VIPID = pRequest.UserID, // ObjectId = orderId //}, null); //if (vipIntegralList != null && vipIntegralList.Length > 0) //{ // rd.OrderListInfo.OrderIntegral = Math.Abs(vipIntegralList[0].Integral??0); //} //var tOrderCouponMappingBll = new TOrderCouponMappingBLL(this.CurrentUserInfo); //var tOrderCouponMappingList = tOrderCouponMappingBll.QueryByEntity(new TOrderCouponMappingEntity() //{ // OrderId = orderId //}, null); //if (tOrderCouponMappingList != null && tOrderCouponMappingList.Length > 0) //{ // var couponId = tOrderCouponMappingList[0].CouponId; // var couponBll = new CouponBLL(this.CurrentUserInfo); // var couponEntity = couponBll.GetByID(couponId); // if (couponEntity != null) // { // var couponTypeId = couponEntity.CouponTypeID; // var couponTypeBll = new CouponTypeBLL(this.CurrentUserInfo); // var couponTypeEntity = couponTypeBll.GetByID(couponTypeId); // if (couponTypeEntity != null) // { // rd.OrderListInfo.CouponAmount = couponTypeEntity.ParValue ?? 0; // } // } //} //var vipAmountDetailBll = new VipAmountDetailBLL(this.CurrentUserInfo); //var vipAmountDetailList = vipAmountDetailBll.QueryByEntity(new VipAmountDetailEntity() //{ // VipId = pRequest.UserID, // ObjectId = orderId //}, null); //if (vipAmountDetailList != null && vipAmountDetailList.Length > 0) //{ // rd.OrderListInfo.VipEndAmount = Math.Abs(vipAmountDetailList[0].Amount ?? 0); //} #endregion return(rd); }