From 3fc58aef2f6f47c4a356df23479e3becca630177 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期四, 27 六月 2024 17:11:47 +0800 Subject: [PATCH] 铺货和计划订单的修改。计划订单增加批量查看 --- CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs | 541 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 400 insertions(+), 141 deletions(-) diff --git a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs index 46617dc..ba42d3f 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Order/CoreCmsPlanOrderController.cs @@ -44,6 +44,8 @@ using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinExpressDeliveryOpenMessageGetDeliveryListResponse.Types; using System.Threading.Channels; using System.Collections.Generic; +using EnumsNET; +using NPOI.SS.Formula.Functions; namespace CoreCms.Net.Web.Admin.Controllers { @@ -645,6 +647,70 @@ } #endregion + + + + #region 閫夋嫨瀵煎嚭============================================================ + // POST: Api/CoreCmsPlanOrder/SelectExportExcel/10 + /// <summary> + /// 閫夋嫨瀵煎嚭 + /// </summary> + /// <param name="entity"></param> + /// <returns></returns> + [HttpPost] + [Description("閫夋嫨瀵煎嚭")] + public async Task<AdminUiCallBack> Selectselectchakan([FromBody] FMArrayStringIds entity) + { + var jm = new AdminUiCallBack(); + + //鍒涘缓Excel鏂囦欢鐨勫璞� + var book = new HSSFWorkbook(); + //娣诲姞涓�涓猻heet + var mySheet = book.CreateSheet("Sheet1"); + //鑾峰彇list鏁版嵁 + var listModel = await _CoreCmsPlanOrderServices.QueryListByClauseAsync(p => entity.id.Contains(p.orderId), p => p.orderId, OrderByType.Asc, true); + + var coreCmsPlanOrderItems = new List<CoreCmsPlanOrderItem>(); + //灏嗘暟鎹�愭鍐欏叆sheet1鍚勪釜琛� + for (var i = 0; i < listModel.Count; i++) + { + var modelItem1 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == listModel[i].orderId && p.isOld == true, p => p.specification, OrderByType.Asc); + + var modelItem2 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == listModel[i].orderId && 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; + } + coreCmsPlanOrderItems.Add(coreCmsPlanOrderItem); + } + } + + var groupedByMultipleFields = coreCmsPlanOrderItems.GroupBy(p => new { p.name, p.specification }) + .Select(p=>new CoreCmsPlanOrderItem + { + name = p.Key.name, + specification = p.Key.specification, + nums = p.Sum(c => c.nums), + numsnew = p.Sum(c => c.numsnew), + + }).ToList(); + + + + jm.data = groupedByMultipleFields; + jm.code = 0; + + return jm; + } + #endregion + #region 閫夋嫨瀵煎嚭============================================================ // POST: Api/CoreCmsPlanOrder/SelectExportExcel/10 /// <summary> @@ -676,19 +742,19 @@ cellNum++; var cell1 = headerRow.CreateCell(cellNum); - cell1.SetCellValue("璋冩暣璁㈠崟閲戦"); + cell1.SetCellValue("甯�"); cell1.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell2 = headerRow.CreateCell(cellNum); - cell2.SetCellValue("璁㈠崟鐘舵��"); + cell2.SetCellValue("鍖哄幙"); cell2.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell3 = headerRow.CreateCell(cellNum); - cell3.SetCellValue("鐢ㄦ埛ID 鍏宠仈user.id"); + cell3.SetCellValue("鐗囧尯"); cell3.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; @@ -706,131 +772,219 @@ cellNum++; var cell6 = headerRow.CreateCell(cellNum); - cell6.SetCellValue("鏀惰揣鐢佃瘽"); + cell6.SetCellValue("鑱旂郴鐢佃瘽"); cell6.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell7 = headerRow.CreateCell(cellNum); - cell7.SetCellValue("璁″垝璁㈠崟閲戦"); + cell7.SetCellValue("鏀惰揣鍦板潃"); cell7.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell8 = headerRow.CreateCell(cellNum); - cell8.SetCellValue("鍙敤浣欓"); + cell8.SetCellValue("璁″垝閲戦"); cell8.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell9 = headerRow.CreateCell(cellNum); - cell9.SetCellValue("寤虹珛鏃堕棿"); + cell9.SetCellValue("璋冩暣閲戦"); cell9.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell10 = headerRow.CreateCell(cellNum); - cell10.SetCellValue("淇敼鏃堕棿"); + cell10.SetCellValue("鍙敤浣欓"); cell10.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell11 = headerRow.CreateCell(cellNum); - cell11.SetCellValue("鍒涘缓浜�"); + cell11.SetCellValue("鍟嗗搧鍚嶇О"); cell11.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell12 = headerRow.CreateCell(cellNum); - cell12.SetCellValue("淇敼浜�"); + cell12.SetCellValue("鍗曚环锛堝厓锛�"); cell12.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; var cell13 = headerRow.CreateCell(cellNum); - cell13.SetCellValue("鍒犻櫎鏍囧織"); + cell13.SetCellValue("璁″垝鏁伴噺"); cell13.CellStyle = headerStyle; + mySheet.SetColumnWidth(cellNum, 10 * 256); + cellNum++; + + var cell14 = headerRow.CreateCell(cellNum); + cell14.SetCellValue("璁″垝閲戦锛堝厓锛�"); + cell14.CellStyle = headerStyle; + mySheet.SetColumnWidth(cellNum, 10 * 256); + cellNum++; + + var cell15 = headerRow.CreateCell(cellNum); + cell15.SetCellValue("璋冩暣鏁伴噺"); + cell15.CellStyle = headerStyle; + mySheet.SetColumnWidth(cellNum, 10 * 256); + cellNum++; + + var cell16 = headerRow.CreateCell(cellNum); + cell16.SetCellValue("璋冩暣閲戦锛堝厓锛�"); + cell16.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; headerRow.Height = 30 * 20; var commonCellStyle = ExcelHelper.GetCommonStyle(book); + + var rows = 1; //灏嗘暟鎹�愭鍐欏叆sheet1鍚勪釜琛� for (var i = 0; i < listModel.Count; i++) { - var rowTemp = mySheet.CreateRow(i + 1); - var cellNumTemp = 0; + var modelItem1 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == listModel[i].orderId && p.isOld == true, p => p.specification, OrderByType.Asc); + var modelItem2 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == listModel[i].orderId && 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 == listModel[i].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)); + + } + foreach (var coreCmsOrder1 in coreCmsOrderItems) + { + var coreCmsPlanOrderItem = new CoreCmsPlanOrderItem(); + coreCmsPlanOrderItem.name = coreCmsOrder1.name; + coreCmsPlanOrderItem.specification = coreCmsOrder1.addon; + coreCmsPlanOrderItem.price = coreCmsOrder1.price; + coreCmsPlanOrderItem.nums = 0; + coreCmsPlanOrderItem.amount = 0; + coreCmsPlanOrderItem.numsnew = coreCmsOrder1.nums; + coreCmsPlanOrderItem.amountnew = coreCmsOrder1.amount; + + modelItem1.Add(coreCmsPlanOrderItem); + } + for (var j = 0; j < modelItem1.Count; j++) + { + var rowTemp = mySheet.CreateRow(rows);//i + 1 + var cellNumTemp = 0; var rowTemp0 = rowTemp.CreateCell(cellNumTemp); - rowTemp0.SetCellValue(listModel[i].orderId.ToString()); - rowTemp0.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp0.SetCellValue(listModel[i].orderId.ToString()); + rowTemp0.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp1 = rowTemp.CreateCell(cellNumTemp); - rowTemp1.SetCellValue(listModel[i].orderAmount.ToString()); - rowTemp1.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp1.SetCellValue(listModel[i].shi.ToString()); + rowTemp1.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp2 = rowTemp.CreateCell(cellNumTemp); - rowTemp2.SetCellValue(listModel[i].status.ToString()); - rowTemp2.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp2.SetCellValue(listModel[i].quxian.ToString()); + rowTemp2.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp3 = rowTemp.CreateCell(cellNumTemp); - rowTemp3.SetCellValue(listModel[i].userId.ToString()); - rowTemp3.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp3.SetCellValue(listModel[i].pianqu.ToString()); + rowTemp3.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp4 = rowTemp.CreateCell(cellNumTemp); - rowTemp4.SetCellValue(listModel[i].shipAddress.ToString()); - rowTemp4.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp4.SetCellValue(listModel[i].shipAddress.ToString()); + rowTemp4.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp5 = rowTemp.CreateCell(cellNumTemp); - rowTemp5.SetCellValue(listModel[i].shipName.ToString()); - rowTemp5.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp5.SetCellValue(listModel[i].shipName.ToString()); + rowTemp5.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp6 = rowTemp.CreateCell(cellNumTemp); - rowTemp6.SetCellValue(listModel[i].shipMobile.ToString()); - rowTemp6.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp6.SetCellValue(listModel[i].shipMobile.ToString()); + rowTemp6.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp7 = rowTemp.CreateCell(cellNumTemp); - rowTemp7.SetCellValue(listModel[i].oldOrderAmount.ToString()); - rowTemp7.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp7.SetCellValue(listModel[i].shouhuoAddress.ToString()); + rowTemp7.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp8 = rowTemp.CreateCell(cellNumTemp); - rowTemp8.SetCellValue(listModel[i].keYongAmount.ToString()); - rowTemp8.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp8.SetCellValue(listModel[i].oldOrderAmount.ToString()); + rowTemp8.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp9 = rowTemp.CreateCell(cellNumTemp); - rowTemp9.SetCellValue(listModel[i].createTime.ToString()); - rowTemp9.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp9.SetCellValue(listModel[i].orderAmount.ToString()); + rowTemp9.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp10 = rowTemp.CreateCell(cellNumTemp); - rowTemp10.SetCellValue(listModel[i].upDataTime.ToString()); - rowTemp10.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp10.SetCellValue(listModel[i].keYongAmount.ToString()); + rowTemp10.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp11 = rowTemp.CreateCell(cellNumTemp); - rowTemp11.SetCellValue(listModel[i].createBy.ToString()); - rowTemp11.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp11.SetCellValue(modelItem1[j].name.ToString() + modelItem1[j].specification.ToString()); + rowTemp11.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp12 = rowTemp.CreateCell(cellNumTemp); - rowTemp12.SetCellValue(listModel[i].upDataBy.ToString()); - rowTemp12.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp12.SetCellValue(modelItem1[j].price.ToString()); + rowTemp12.CellStyle = commonCellStyle; + cellNumTemp++; var rowTemp13 = rowTemp.CreateCell(cellNumTemp); - rowTemp13.SetCellValue(listModel[i].isdelete.ToString()); - rowTemp13.CellStyle = commonCellStyle; - cellNumTemp++; + rowTemp13.SetCellValue(modelItem1[j].nums.ToString()); + rowTemp13.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp14 = rowTemp.CreateCell(cellNumTemp); + rowTemp14.SetCellValue(modelItem1[j].amount.ToString()); + rowTemp14.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp15 = rowTemp.CreateCell(cellNumTemp); + rowTemp15.SetCellValue(modelItem1[j].numsnew.ToString()); + rowTemp15.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp16 = rowTemp.CreateCell(cellNumTemp); + rowTemp16.SetCellValue(modelItem1[j].amountnew.ToString()); + rowTemp16.CellStyle = commonCellStyle; + cellNumTemp++; + + + + rows++; + } + + + + + + } // 瀵煎嚭excel @@ -876,8 +1030,26 @@ { where = where.And(p => p.orderId.Contains(orderId)); } - //璋冩暣璁㈠崟閲戦 decimal - var orderAmount = Request.Form["orderAmount"].FirstOrDefault().ObjectToDecimal(0); + //甯� varchar + var shi = Request.Form["shi"].FirstOrDefault().ObjectToInt(0); + if (shi > 0) + { + where = where.And(p => p.shiId == shi); + } + //鍖哄幙 varchar + var quxian = Request.Form["quxian"].FirstOrDefault().ObjectToInt(0); ; + if (quxian > 0) + { + where = where.And(p => p.quxianId == quxian); + } + //鏀惰揣鍦板潃 varchar + var shouhuoAddress = Request.Form["shouhuoAddress"].FirstOrDefault(); + if (!string.IsNullOrEmpty(shouhuoAddress)) + { + where = where.And(p => p.shouhuoAddress.Contains(shouhuoAddress)); + } + //璋冩暣璁㈠崟閲戦 decimal + var orderAmount = Request.Form["orderAmount"].FirstOrDefault().ObjectToDecimal(0); if (orderAmount > 0) { where = where.And(p => p.orderAmount == orderAmount); @@ -993,170 +1165,257 @@ var headerRow = mySheet.CreateRow(0); var headerStyle = ExcelHelper.GetHeaderStyle(book); var cellNum = 0; - + var cell0 = headerRow.CreateCell(cellNum); cell0.SetCellValue("璁㈠崟鍙�"); cell0.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell1 = headerRow.CreateCell(cellNum); - cell1.SetCellValue("璋冩暣璁㈠崟閲戦"); + cell1.SetCellValue("甯�"); cell1.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell2 = headerRow.CreateCell(cellNum); - cell2.SetCellValue("璁㈠崟鐘舵��"); + cell2.SetCellValue("鍖哄幙"); cell2.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell3 = headerRow.CreateCell(cellNum); - cell3.SetCellValue("鐢ㄦ埛ID 鍏宠仈user.id"); + cell3.SetCellValue("鐗囧尯"); cell3.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell4 = headerRow.CreateCell(cellNum); cell4.SetCellValue("瀛︽牎"); cell4.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell5 = headerRow.CreateCell(cellNum); cell5.SetCellValue("鑱旂郴浜�"); cell5.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell6 = headerRow.CreateCell(cellNum); - cell6.SetCellValue("鏀惰揣鐢佃瘽"); + cell6.SetCellValue("鑱旂郴鐢佃瘽"); cell6.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell7 = headerRow.CreateCell(cellNum); - cell7.SetCellValue("璁″垝璁㈠崟閲戦"); + cell7.SetCellValue("鏀惰揣鍦板潃"); cell7.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell8 = headerRow.CreateCell(cellNum); - cell8.SetCellValue("鍙敤浣欓"); + cell8.SetCellValue("璁″垝閲戦"); cell8.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell9 = headerRow.CreateCell(cellNum); - cell9.SetCellValue("寤虹珛鏃堕棿"); + cell9.SetCellValue("璋冩暣閲戦"); cell9.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell10 = headerRow.CreateCell(cellNum); - cell10.SetCellValue("淇敼鏃堕棿"); + cell10.SetCellValue("鍙敤浣欓"); cell10.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell11 = headerRow.CreateCell(cellNum); - cell11.SetCellValue("鍒涘缓浜�"); + cell11.SetCellValue("鍟嗗搧鍚嶇О"); cell11.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell12 = headerRow.CreateCell(cellNum); - cell12.SetCellValue("淇敼浜�"); + cell12.SetCellValue("鍗曚环锛堝厓锛�"); cell12.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + var cell13 = headerRow.CreateCell(cellNum); - cell13.SetCellValue("鍒犻櫎鏍囧織"); + cell13.SetCellValue("璁″垝鏁伴噺"); cell13.CellStyle = headerStyle; mySheet.SetColumnWidth(cellNum, 10 * 256); cellNum++; - + + var cell14 = headerRow.CreateCell(cellNum); + cell14.SetCellValue("璁″垝閲戦锛堝厓锛�"); + cell14.CellStyle = headerStyle; + mySheet.SetColumnWidth(cellNum, 10 * 256); + cellNum++; + + var cell15 = headerRow.CreateCell(cellNum); + cell15.SetCellValue("璋冩暣鏁伴噺"); + cell15.CellStyle = headerStyle; + mySheet.SetColumnWidth(cellNum, 10 * 256); + cellNum++; + + var cell16 = headerRow.CreateCell(cellNum); + cell16.SetCellValue("璋冩暣閲戦锛堝厓锛�"); + cell16.CellStyle = headerStyle; + mySheet.SetColumnWidth(cellNum, 10 * 256); + cellNum++; + headerRow.Height = 30 * 20; var commonCellStyle = ExcelHelper.GetCommonStyle(book); + var rows = 1; //灏嗘暟鎹�愭鍐欏叆sheet1鍚勪釜琛� for (var i = 0; i < listModel.Count; i++) { - var rowTemp = mySheet.CreateRow(i + 1); - var cellNumTemp = 0; + var modelItem1 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == listModel[i].orderId && p.isOld == true, p => p.specification, OrderByType.Asc); - var rowTemp0 = rowTemp.CreateCell(cellNumTemp); - rowTemp0.SetCellValue(listModel[i].orderId.ToString()); - rowTemp0.CellStyle = commonCellStyle; - cellNumTemp++; + var modelItem2 = await _planOrderItemServices.QueryListByClauseAsync(p => p.orderId == listModel[i].orderId && p.isOld == false, p => p.specification, OrderByType.Asc); - var rowTemp1 = rowTemp.CreateCell(cellNumTemp); - rowTemp1.SetCellValue(listModel[i].orderAmount.ToString()); - rowTemp1.CellStyle = commonCellStyle; - cellNumTemp++; - var rowTemp2 = rowTemp.CreateCell(cellNumTemp); - rowTemp2.SetCellValue(listModel[i].status.ToString()); - rowTemp2.CellStyle = commonCellStyle; - cellNumTemp++; + 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 == listModel[i].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)); - var rowTemp3 = rowTemp.CreateCell(cellNumTemp); - rowTemp3.SetCellValue(listModel[i].userId.ToString()); - rowTemp3.CellStyle = commonCellStyle; - cellNumTemp++; + } + foreach (var coreCmsOrder1 in coreCmsOrderItems) + { + var coreCmsPlanOrderItem = new CoreCmsPlanOrderItem(); + coreCmsPlanOrderItem.name = coreCmsOrder1.name; + coreCmsPlanOrderItem.specification = coreCmsOrder1.addon; + coreCmsPlanOrderItem.price = coreCmsOrder1.price; + coreCmsPlanOrderItem.nums = 0; + coreCmsPlanOrderItem.amount = 0; + coreCmsPlanOrderItem.numsnew = coreCmsOrder1.nums; + coreCmsPlanOrderItem.amountnew = coreCmsOrder1.amount; - var rowTemp4 = rowTemp.CreateCell(cellNumTemp); - rowTemp4.SetCellValue(listModel[i].shipAddress.ToString()); - rowTemp4.CellStyle = commonCellStyle; - cellNumTemp++; + modelItem1.Add(coreCmsPlanOrderItem); + } + for (var j = 0; j < modelItem1.Count; j++) + { + var rowTemp = mySheet.CreateRow(rows);//i + 1 + var cellNumTemp = 0; + var rowTemp0 = rowTemp.CreateCell(cellNumTemp); + rowTemp0.SetCellValue(listModel[i].orderId.ToString()); + rowTemp0.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp5 = rowTemp.CreateCell(cellNumTemp); - rowTemp5.SetCellValue(listModel[i].shipName.ToString()); - rowTemp5.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp1 = rowTemp.CreateCell(cellNumTemp); + rowTemp1.SetCellValue(listModel[i].shi.ToString()); + rowTemp1.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp6 = rowTemp.CreateCell(cellNumTemp); - rowTemp6.SetCellValue(listModel[i].shipMobile.ToString()); - rowTemp6.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp2 = rowTemp.CreateCell(cellNumTemp); + rowTemp2.SetCellValue(listModel[i].quxian.ToString()); + rowTemp2.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp7 = rowTemp.CreateCell(cellNumTemp); - rowTemp7.SetCellValue(listModel[i].oldOrderAmount.ToString()); - rowTemp7.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp3 = rowTemp.CreateCell(cellNumTemp); + rowTemp3.SetCellValue(listModel[i].pianqu.ToString()); + rowTemp3.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp8 = rowTemp.CreateCell(cellNumTemp); - rowTemp8.SetCellValue(listModel[i].keYongAmount.ToString()); - rowTemp8.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp4 = rowTemp.CreateCell(cellNumTemp); + rowTemp4.SetCellValue(listModel[i].shipAddress.ToString()); + rowTemp4.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp9 = rowTemp.CreateCell(cellNumTemp); - rowTemp9.SetCellValue(listModel[i].createTime.ToString()); - rowTemp9.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp5 = rowTemp.CreateCell(cellNumTemp); + rowTemp5.SetCellValue(listModel[i].shipName.ToString()); + rowTemp5.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp10 = rowTemp.CreateCell(cellNumTemp); - rowTemp10.SetCellValue(listModel[i].upDataTime.ToString()); - rowTemp10.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp6 = rowTemp.CreateCell(cellNumTemp); + rowTemp6.SetCellValue(listModel[i].shipMobile.ToString()); + rowTemp6.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp11 = rowTemp.CreateCell(cellNumTemp); - rowTemp11.SetCellValue(listModel[i].createBy.ToString()); - rowTemp11.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp7 = rowTemp.CreateCell(cellNumTemp); + rowTemp7.SetCellValue(listModel[i].shouhuoAddress.ToString()); + rowTemp7.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp12 = rowTemp.CreateCell(cellNumTemp); - rowTemp12.SetCellValue(listModel[i].upDataBy.ToString()); - rowTemp12.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp8 = rowTemp.CreateCell(cellNumTemp); + rowTemp8.SetCellValue(listModel[i].oldOrderAmount.ToString()); + rowTemp8.CellStyle = commonCellStyle; + cellNumTemp++; - var rowTemp13 = rowTemp.CreateCell(cellNumTemp); - rowTemp13.SetCellValue(listModel[i].isdelete.ToString()); - rowTemp13.CellStyle = commonCellStyle; - cellNumTemp++; + var rowTemp9 = rowTemp.CreateCell(cellNumTemp); + rowTemp9.SetCellValue(listModel[i].orderAmount.ToString()); + rowTemp9.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp10 = rowTemp.CreateCell(cellNumTemp); + rowTemp10.SetCellValue(listModel[i].keYongAmount.ToString()); + rowTemp10.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp11 = rowTemp.CreateCell(cellNumTemp); + rowTemp11.SetCellValue(modelItem1[j].name.ToString() + modelItem1[j].specification.ToString()); + rowTemp11.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp12 = rowTemp.CreateCell(cellNumTemp); + rowTemp12.SetCellValue(modelItem1[j].price.ToString()); + rowTemp12.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp13 = rowTemp.CreateCell(cellNumTemp); + rowTemp13.SetCellValue(modelItem1[j].nums.ToString()); + rowTemp13.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp14 = rowTemp.CreateCell(cellNumTemp); + rowTemp14.SetCellValue(modelItem1[j].amount.ToString()); + rowTemp14.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp15 = rowTemp.CreateCell(cellNumTemp); + rowTemp15.SetCellValue(modelItem1[j].numsnew.ToString()); + rowTemp15.CellStyle = commonCellStyle; + cellNumTemp++; + + var rowTemp16 = rowTemp.CreateCell(cellNumTemp); + rowTemp16.SetCellValue(modelItem1[j].amountnew.ToString()); + rowTemp16.CellStyle = commonCellStyle; + cellNumTemp++; + + + + rows++; + } + + + + + + } // 鍐欏叆鍒癳xcel -- Gitblit v1.9.1