From d15481638e21ccc610f5e36577497cb6279839b9 Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期二, 30 四月 2024 09:51:58 +0800 Subject: [PATCH] 修改计划订单 --- CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs | 90 ++++++++++++++++++++++++++++++++++++--------- 1 files changed, 72 insertions(+), 18 deletions(-) diff --git a/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs b/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs index e4aa7f1..a6f48b9 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Com/ToolsController.cs @@ -39,6 +39,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; @@ -433,70 +434,105 @@ IRow row = sheet.GetRow(i); if (row == null) continue; // 璺宠繃绌鸿 + + ICell cell0 = row.GetCell(0); + if (cell0 == null) + { + jm.msg = "绗�" + (i + 1) + "甯備笉鑳戒负绌�"; + return jm; + } + hang.shi = getcellvalue(cell0); + ICell cell1 = row.GetCell(1); if (cell1 == null) { - jm.msg ="绗�" +(i+1) + "瀛︽牎涓嶈兘涓虹┖"; + jm.msg = "绗�" + (i + 1) + "鍖哄幙涓嶈兘涓虹┖"; return jm; } - hang.shipAddress = getcellvalue(cell1); + hang.quxian = getcellvalue(cell1); ICell cell2 = row.GetCell(2); if (cell2 == null) { - jm.msg = "绗�" + (i + 1) + "鑱旂郴浜轰笉鑳戒负绌�"; + jm.msg ="绗�" +(i+1) + "鐗囧尯涓嶈兘涓虹┖"; return jm; } - hang.shipName = getcellvalue(cell2); + hang.pianqu = getcellvalue(cell2); ICell cell3 = row.GetCell(3); if (cell3 == null) { - jm.msg = "绗�" + (i + 1) + "鑱旂郴鐢佃瘽涓嶈兘涓虹┖"; + jm.msg = "绗�" + (i + 1) + "瀛︽牎涓嶈兘涓虹┖"; return jm; } - hang.shipMobile = getcellvalue(cell3); + hang.shipAddress = getcellvalue(cell3); ICell cell4 = row.GetCell(4); if (cell4 == null) { - jm.msg = "绗�" + (i + 1) + "鍟嗗搧鍚嶇О涓嶈兘涓虹┖"; + jm.msg = "绗�" + (i + 1) + "鑱旂郴浜轰笉鑳戒负绌�"; return jm; } - hang.name = getcellvalue(cell4); + hang.shipName = getcellvalue(cell4); ICell cell5 = row.GetCell(5); if (cell5 == null) { - jm.msg = "绗�" + (i + 1) + "瑙勬牸涓嶈兘涓虹┖"; + jm.msg = "绗�" + (i + 1) + "鑱旂郴鐢佃瘽涓嶈兘涓虹┖"; return jm; } - hang.specification = getcellvalue(cell5); + hang.shipMobile = getcellvalue(cell5); ICell cell6 = row.GetCell(6); if (cell6 == null) { - jm.msg = "绗�" + (i + 1) + "鍗曚环锛堝厓锛変笉鑳戒负绌�"; + jm.msg = "绗�" + (i + 1) + "鏀惰揣鍦板潃涓嶈兘涓虹┖"; return jm; } - hang.price = decimal.Parse(getcellvalue(cell6)); + hang.shouhuoAddress = getcellvalue(cell6); ICell cell7 = row.GetCell(7); if (cell7 == null) { + jm.msg = "绗�" + (i + 1) + "鍟嗗搧鍚嶇О涓嶈兘涓虹┖"; + return jm; + } + hang.name = getcellvalue(cell7); + + ICell cell8 = row.GetCell(8); + if (cell8 == null) + { + jm.msg = "绗�" + (i + 1) + "瑙勬牸涓嶈兘涓虹┖"; + return jm; + } + hang.specification = getcellvalue(cell8); + + + ICell cell9 = row.GetCell(9); + if (cell9 == null) + { + jm.msg = "绗�" + (i + 1) + "鍗曚环锛堝厓锛変笉鑳戒负绌�"; + return jm; + } + hang.price = decimal.Parse(getcellvalue(cell9)); + + + ICell cell10 = row.GetCell(10); + if (cell10 == null) + { jm.msg = "绗�" + (i + 1) + "鏁伴噺涓嶈兘涓虹┖"; return jm; } - hang.nums = int.Parse(getcellvalue(cell7)); ; + hang.nums = int.Parse(getcellvalue(cell10)); lie.Add(hang); } } - lie = lie.OrderBy(x => x.shipAddress).ThenBy(x => x.specification).ToList(); + // lie = lie.OrderBy(x => x.shipAddress).ThenBy(x => x.specification).ToList(); string url = string.Empty; url = "121212"; - + string pianqu = ""; if (lie!=null && lie.Count > 0) { var order = new List<JiHuaOrder>(); @@ -504,7 +540,9 @@ { if (i == 0 ) { + order.Add(lie[i]); + pianqu = lie[i].pianqu; //if(lie.Count == 1) //{ // //淇濆瓨璁㈠崟 @@ -517,19 +555,35 @@ } else { - if(lie[i].shipAddress == lie[i - 1].shipAddress) + if(string.IsNullOrEmpty(lie[i].shipAddress)) { order.Add(lie[i]); } else { //淇濆瓨璁㈠崟 - jm = await _coreCmsPlanOrderServices.ToAddJiHua(lie, _user.ID, _user.Name); + jm = await _coreCmsPlanOrderServices.ToAddJiHua(order, _user.ID, _user.Name); if (jm.code == 1) { return jm; } order = new List<JiHuaOrder>(); + if (string.IsNullOrEmpty(lie[i].shi)) + { + lie[i].shi = lie[0].shi; + } + if (string.IsNullOrEmpty(lie[i].quxian)) + { + lie[i].quxian = lie[0].quxian; + } + if (string.IsNullOrEmpty(lie[i].pianqu)) + { + lie[i].pianqu = pianqu; + } + else + { + pianqu = lie[i].pianqu; + } order.Add(lie[i]); } } @@ -537,7 +591,7 @@ if (i == lie.Count - 1) { //淇濆瓨璁㈠崟 - jm = await _coreCmsPlanOrderServices.ToAddJiHua(lie, _user.ID, _user.Name); + jm = await _coreCmsPlanOrderServices.ToAddJiHua(order, _user.ID, _user.Name); if (jm.code == 1) { return jm; -- Gitblit v1.9.1