From 5591c18dc3500bd3e0719bb6b28b26f7f9e7cb58 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期三, 15 五月 2024 09:46:19 +0800 Subject: [PATCH] 计划订单 --- CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs | 67 ++++++++++++++++++++++++++++----- 1 files changed, 57 insertions(+), 10 deletions(-) diff --git a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs index 31daf60..af80319 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs @@ -43,6 +43,7 @@ using static SKIT.FlurlHttpClient.Wechat.Api.Models.CardCreateRequest.Types.MembershipCard.Types.Base.Types; using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinExpressDeliveryOpenMessageGetDeliveryListResponse.Types; using System.Threading.Channels; +using System.Collections.Generic; namespace CoreCms.Net.Web.Admin.Controllers { @@ -64,6 +65,8 @@ private readonly IHttpContextUser _user; private readonly ICoreCmsPlanOrderServices _planOrderServices; private readonly ICoreCmsAreaServices _areaServices; + private readonly ICoreCmsOrderServices _orderServices; + private readonly ICoreCmsOrderItemServices _orderItemServices; /// <summary> @@ -76,6 +79,8 @@ , IHttpContextUser user , ICoreCmsPlanOrderServices planOrderServices , ICoreCmsAreaServices areaServices + , ICoreCmsOrderServices orderServices + , ICoreCmsOrderItemServices orderItemServices ) { _webHostEnvironment = webHostEnvironment; @@ -85,6 +90,9 @@ _user = user; _planOrderServices = planOrderServices; _areaServices = areaServices; + _orderServices = orderServices; + _orderItemServices = orderItemServices; + } #region 鑾峰彇鍒楄〃============================================================ @@ -259,7 +267,7 @@ { //鑾峰彇鐩稿叧鐘舵�佹弿杩拌鏄庤浆鎹� order.statusText = EnumHelper.GetEnumDescriptionByValue<GlobalEnumVars.PlanOrderTiJiao>(order.status); - + order.keYongAmount = order.keYongAmount - order.huaFeiAmount; } } @@ -368,17 +376,27 @@ } //鑾峰彇鐩稿叧鐘舵�佹弿杩拌鏄庤浆鎹� model.statusText = EnumHelper.GetEnumDescriptionByValue<GlobalEnumVars.PlanOrderTiJiao>(model.status); - + model.keYongAmount = model.keYongAmount - model.huaFeiAmount; var modelItem1 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == true, p => p.specification, OrderByType.Asc); var modelItem2 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == false, p => p.specification, OrderByType.Asc); + foreach (var coreCmsPlanOrderItem in modelItem1) + { + var coreCmsPlanOrderItem1 = modelItem2.Where(p => p.name == coreCmsPlanOrderItem.name && p.specification == coreCmsPlanOrderItem.specification).FirstOrDefault(); + if (coreCmsPlanOrderItem1 != null) + { + coreCmsPlanOrderItem.idnew = coreCmsPlanOrderItem1.id; + coreCmsPlanOrderItem.numsnew = coreCmsPlanOrderItem1.nums; + coreCmsPlanOrderItem.amountnew = coreCmsPlanOrderItem1.amount; + } + } + jm.data = new { model, - modelItem1, - modelItem2 + modelItem1 }; jm.code = 0; // jm.data = model; @@ -471,7 +489,7 @@ jm.msg = GlobalConstVars.DataisNo; return jm; } - jm = await _CoreCmsPlanOrderServices.DeleteByIdAsync(entity.id); + jm = await _CoreCmsPlanOrderServices.DeleteByIdAsync(entity.id , _user.Name); return jm; } @@ -486,9 +504,9 @@ /// <returns></returns> [HttpPost] [Description("鎵归噺鍒犻櫎")] - public async Task<AdminUiCallBack> DoBatchDelete([FromBody]FMArrayIntIds entity) + public async Task<AdminUiCallBack> DoBatchDelete([FromBody]FMArrayStringIds entity) { - var jm = await _CoreCmsPlanOrderServices.DeleteByIdsAsync(entity.id); + var jm = await _CoreCmsPlanOrderServices.DeleteByIdsAsync(entity.id, _user.Name); return jm; } @@ -515,17 +533,46 @@ } //鑾峰彇鐩稿叧鐘舵�佹弿杩拌鏄庤浆鎹� model.statusText = EnumHelper.GetEnumDescriptionByValue<GlobalEnumVars.PlanOrderTiJiao>(model.status); + model.keYongAmount = model.keYongAmount - model.huaFeiAmount; var modelItem1 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == true, p => p.specification, OrderByType.Asc); var modelItem2 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == entity.id && p.isOld == false, p => p.specification, OrderByType.Asc); - + + + foreach(var coreCmsPlanOrderItem in modelItem1) + { + var coreCmsPlanOrderItem1 = modelItem2.Where(p => p.name == coreCmsPlanOrderItem.name && p.specification == coreCmsPlanOrderItem.specification).FirstOrDefault(); + if (coreCmsPlanOrderItem1 != null) + { + coreCmsPlanOrderItem.idnew = coreCmsPlanOrderItem1.id; + coreCmsPlanOrderItem.numsnew = coreCmsPlanOrderItem1.nums; + coreCmsPlanOrderItem.amountnew = coreCmsPlanOrderItem1.amount; + } + } + var coreCmsOrderItems = new List<CoreCmsOrderItem>(); + //鏌ヨ鐢ㄨ鍒掕鍗曠Н鍒嗚喘涔扮殑璁㈠崟 + var coreCmsOrders = await _orderServices.QueryListByClauseAsync(p => p.planorderId == model.orderId && p.isdel == false); + if(coreCmsOrders!=null && coreCmsOrders.Count > 0) + { + var orderids = new List<string>(); + foreach(var coreCmsOrder in coreCmsOrders) + { + orderids.Add(coreCmsOrder.orderId); + } + coreCmsOrderItems = await _orderItemServices.QueryListByClauseAsync(p => orderids.Contains(p.orderId)); + + } + + + + jm.data = new { model, - modelItem1, - modelItem2 + modelItem1 , + coreCmsOrderItems }; jm.code = 0; //jm.data = model; -- Gitblit v1.9.1