From 08d8e27bc970429128a5456f745609f5788196ea Mon Sep 17 00:00:00 2001 From: minom Date: Wed, 3 Jun 2026 16:36:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E6=AC=A1=E5=A0=B1=E5=90=8D=20=20?= =?UTF-8?q?=E7=B5=B1=E8=A8=88=E5=A0=B1=E8=A1=A8=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/App_Code/Model/ViewModel/activity.cs | 1 + web/App_Code/Model/ViewModel/order.cs | 3 + web/App_Code/api/StatisticController.cs | 33 ----- web/App_Code/api/activityController.cs | 35 +++++ web/App_Code/api/orderController.cs | 92 ++++++++++++ web/App_Code/api/statisticsController.cs | 28 +++- web/admin/activity/index.aspx | 123 +++++++++++++++- web/admin/order/fastSignUp.vue | 6 +- web/admin/order/fastSignUp5.vue | 180 +++++++++++++++++++++-- web/admin/order/index4.aspx | 4 + 10 files changed, 449 insertions(+), 56 deletions(-) delete mode 100644 web/App_Code/api/StatisticController.cs diff --git a/web/App_Code/Model/ViewModel/activity.cs b/web/App_Code/Model/ViewModel/activity.cs index 8fe28a1..4189b0f 100644 --- a/web/App_Code/Model/ViewModel/activity.cs +++ b/web/App_Code/Model/ViewModel/activity.cs @@ -34,6 +34,7 @@ namespace Model.ViewModel public string is_reconcile { get; set; } public string up_time1 { get; set; } public string up_time2 { get; set; } + public string deadline { get; set; } } diff --git a/web/App_Code/Model/ViewModel/order.cs b/web/App_Code/Model/ViewModel/order.cs index 3cb6868..472f6c1 100644 --- a/web/App_Code/Model/ViewModel/order.cs +++ b/web/App_Code/Model/ViewModel/order.cs @@ -45,6 +45,9 @@ namespace Model.ViewModel public follower f_user { get; set; } + public List orders { get; set; } + public Nullable old_activity_num { get; set; } + } public class pro_order_detail diff --git a/web/App_Code/api/StatisticController.cs b/web/App_Code/api/StatisticController.cs deleted file mode 100644 index 6914e20..0000000 --- a/web/App_Code/api/StatisticController.cs +++ /dev/null @@ -1,33 +0,0 @@ -using DocumentFormat.OpenXml.Spreadsheet; -using Model.ViewModel; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using NPOI.SS.UserModel; -using NPOI.XSSF.UserModel; -using System; -using System.Collections.Generic; -using System.Data.SqlClient; -using System.IO; -using System.Linq; -using System.Text; -using System.Web; -using System.Web.Http; -using System.Web.Http.Results; - -/// -/// StatisticController 的摘要描述 -/// -public class StatisticController : BaseApiController -{ - - - public StatisticController() - { - // - // TODO: 在這裡新增建構函式邏輯 - // - } - - - -} \ No newline at end of file diff --git a/web/App_Code/api/activityController.cs b/web/App_Code/api/activityController.cs index 4d31baa..7ad54fd 100644 --- a/web/App_Code/api/activityController.cs +++ b/web/App_Code/api/activityController.cs @@ -236,6 +236,41 @@ public class activityController : ApiController return count; } + [HttpPost] + [Route("api/activity/CopyActivity")] + public IHttpActionResult CopyActivity([FromBody] Model.ViewModel.activity act) + { + try + { + var activity = _db.activities.Where(x => x.num == act.num).AsNoTracking().FirstOrDefault(); + var relations = _db.activity_relating.AsNoTracking().Where(x => x.activity_num == act.num).AsNoTracking().ToList(); + + activity.num = 0; + activity.subject = act.subject; + activity.startDate_solar = DateTime.Parse(act.up_time1); + activity.endDate_solar = DateTime.Parse(act.up_time2); + activity.dueDate = DateTime.Parse(act.deadline); + _db.activities.Add(activity); + _db.SaveChanges(); + foreach (var item in relations) + { + item.num = 0; + item.activity_num = activity.num; + item.reg_time = DateTime.Now; + _db.activity_relating.Add(item); + } + + _db.SaveChanges(); + + return Ok(new { result = "Y", message =$"完成 {activity.num} " }); + } + catch (Exception ex) + { + return Ok(new {result="N",message=ex.Message}); + // throw; + } + } + [HttpPost] [Route("api/activity/GetListNew")] public IHttpActionResult GetListNew([FromBody] Model.ViewModel.activity q, int page, int pageSize = 10, diff --git a/web/App_Code/api/orderController.cs b/web/App_Code/api/orderController.cs index 7691475..66a8872 100644 --- a/web/App_Code/api/orderController.cs +++ b/web/App_Code/api/orderController.cs @@ -9,11 +9,13 @@ using System; using System.Activities.Expressions; using System.Collections; using System.Collections.Generic; +using System.Data.Entity; using System.Diagnostics; using System.IdentityModel.Metadata; using System.Linq; using System.Net; using System.Net.Http; +using System.Text; using System.Web.Helpers; using System.Web.Http; using static TreeView; @@ -206,6 +208,90 @@ public class orderController : ApiController return count; } + [HttpPost] + [Route("api/order/BatchSave")] + public IHttpActionResult BatchSave([FromBody] Model.ViewModel.pro_order po) + { + try + { + var query = _db.pro_order.AsNoTracking().Where(x => x.activity_num == po.old_activity_num).AsQueryable(); + query = query.Include(x => x.pro_order_detail).AsNoTracking(); + query = query.Where(x => po.orders.Contains(x.order_no)); + var list = query.ToList(); + List orders = new List(); + List order_details = new List(); + + var act=_db.activities.Where(x=>x.num==po.activity_num).FirstOrDefault(); + var hasList = _db.pro_order.AsNoTracking().Where(x => x.activity_num == po.activity_num).AsNoTracking().ToList(); + List rp=new List(); + //要檢查是否已經報名 + foreach (var item in list) + { + var already=hasList.Where(x => x.f_num == item.f_num).FirstOrDefault(); + if (already != null&&!string.IsNullOrEmpty(already.order_no)) + { + rp.Add((int)already.f_num); + continue; + } + //Model.pro_order order = new Model.pro_order(); + //order.phone = item.phone; + //order.follower1 = item.follower1; + //order.address = item.address; + //order.activity_num = po.activity_num; + //order.up_time = DateTime.Now; + //order.reg_time = DateTime.Now; + ////order.follower = item.follower;//加了會去寫followers + //order.f_num = item.f_num; + //order.keyin1 = item.keyin1; + //order.introducer = item.introducer; + //order.send_receipt = item.send_receipt; + //order.receipt_title = item.receipt_title; + //order.order_no = createOrderNumber(); + item.reg_time= DateTime.Now; + item.up_time= DateTime.Now; + item.order_no= createOrderNumber(); + item.activity_num= po.activity_num; + + _db.pro_order.Add(item); + orders.Add(item); + foreach (var detail in item.pro_order_detail) + { + //Model.pro_order_detail order_detail = new Model.pro_order_detail(); + //order_detail.order_no = order.order_no; + //order_detail.actItem_num = detail.actItem_num; + //order_detail.parent_num = detail.parent_num; + //order_detail.print_id = detail.print_id; + //order_detail.f_num = detail.f_num; + //order_detail.f_num_tablet = detail.f_num_tablet; + //order_detail.from_id = detail.from_id; + //order_detail.from_id_tablet = detail.from_id_tablet; + //order_detail.price = detail.price; + //order_detail.qty = detail.qty; + //order_detail.printed_files = detail.printed_files; + //order_detail.style = detail.style; + //order_detail.UpdateTime=DateTime.Now; + //order_details.Add(order_detail); + detail.order_no=item.order_no; + detail.UpdateTime= DateTime.Now; + detail.start_date= act.startDate_solar; + detail.due_date= act.endDate_solar; + _db.pro_order_detail.Add(detail); + } + + } + + //_db.pro_order.AddRange(orders); + //_db.SaveChanges(); + //_db.pro_order_detail.AddRange(order_details); + _db.SaveChanges(); + return Ok(new {result="Y",message="完成",data=rp}); + } + catch (Exception ex) + { + return Ok(new { result = "Y",message=ex.Message+ex.StackTrace }); + } + } + [HttpPost] [Route("api/order/AddOrderWithDetail")] public IHttpActionResult AddOrderWithDetail([FromBody] Model.ViewModel.pro_order q) @@ -461,6 +547,12 @@ public class orderController : ApiController qry = qry.OrderByDescending(o => o.reg_time); var count = qry.Count(); //pageSize = count;//一次取回?? + if (pageSize==-1) + { + pageSize = count; + } + if(pageSize==0) + pageSize = 10; var ret = new { list = qry.ToPagedList(page, pageSize).Select(x => new diff --git a/web/App_Code/api/statisticsController.cs b/web/App_Code/api/statisticsController.cs index 40393cd..655ab47 100644 --- a/web/App_Code/api/statisticsController.cs +++ b/web/App_Code/api/statisticsController.cs @@ -225,17 +225,31 @@ public class statisticsController: ApiController { if (items.draft != null) { - var jj = JsonConvert.DeserializeObject(items.draft); - log.writeLogPath(jj.ToString()); - foreach (var j in jj) + if (items.draft .StartsWith("[")) { - if (item.subject == j["activity_name"].ToString() && - item.item_subject == j["actitem_name"].ToString()) + var jj = JsonConvert.DeserializeObject(items.draft); + log.writeLogPath(jj.ToString()); + foreach (var j in jj) { - payed = payed + decimal.Parse(j["reconcile"].ToString()); + if (item.subject == j["activity_name"].ToString() && + item.item_subject == j["actitem_name"].ToString()) + { + payed = payed + decimal.Parse(j["reconcile"].ToString()); + } + } + } + else + { + var jj = JsonConvert.DeserializeObject(items.draft); + foreach (var j in jj["pro_order_detail_items"]) + { + if (item.subject == j["activity_name"].ToString() && + item.item_subject == j["actitem_name"].ToString()) + { + payed = payed + decimal.Parse(j["reconcile"].ToString()); + } } } - } } ws.Cells[i, 7].Value = payed; diff --git a/web/admin/activity/index.aspx b/web/admin/activity/index.aspx index 6688627..2b1e0e3 100644 --- a/web/admin/activity/index.aspx +++ b/web/admin/activity/index.aspx @@ -2,6 +2,11 @@ <%@ Register Src="~/admin/_uc/alert.ascx" TagPrefix="uc1" TagName="alert" %> +
@@ -53,7 +58,19 @@ search: { kind: 0, subject: '', - } + }, + signData: { + subject: "", + up_time1: "", + up_time2: "", + deadline: "", + num:null + }, + startmenu: false, + endmenu: false, + deadmenu: false, + copy_dialog: { show: false, show_confirm: false, message: "" }, + message_dialog: { show: false, show_confirm: false, message: "" }, } }, watch: { @@ -84,6 +101,30 @@ editItem(item) { console.log("edit", item); }, + copyItem(item) { + + this.signData.num=item.num + this.copy_dialog.show = true + }, + gotoCopy() { + if (this.signData.subject == "" || this.signData.up_time1 == "" || this.signData.up_time2 == "" || this.signData.deadline == "") { + + this.message_dialog.show = true + this.message_dialog.message = "所有欄位都必須填寫" + return false; + } + axios + .post(HTTP_HOST + "api/activity/CopyActivity", this.signData) + .then(response => { + this.message_dialog.show = true + this.message_dialog.message = response.data.message + if (response.data.result === "Y") { + this.copy_dialog.show = false; + } + }) + .catch(error => console.log(error)) + + }, deleteItem(item) { if (confirm('是否確定刪除此筆資料?')) { const index = this.data_table.list.indexOf(item) @@ -166,6 +207,7 @@ @@ -194,6 +236,85 @@
+ + + + + +
diff --git a/web/admin/order/fastSignUp.vue b/web/admin/order/fastSignUp.vue index 8008d26..bbdaff2 100644 --- a/web/admin/order/fastSignUp.vue +++ b/web/admin/order/fastSignUp.vue @@ -69,8 +69,9 @@ @@ -206,6 +207,9 @@ this.search.subject = "" this.search.up_time1="" }, + gotoBatchSignup(item) { + this.$emit('custom-event', { action: 'batchSign', item: item }); + }, gotoSignup(item) { this.$emit('custom-event', { action: 'add', item: item }); }, diff --git a/web/admin/order/fastSignUp5.vue b/web/admin/order/fastSignUp5.vue index 8450593..e54eea2 100644 --- a/web/admin/order/fastSignUp5.vue +++ b/web/admin/order/fastSignUp5.vue @@ -1,13 +1,49 @@  \ No newline at end of file diff --git a/web/admin/order/index4.aspx b/web/admin/order/index4.aspx index b3e6890..43f11bd 100644 --- a/web/admin/order/index4.aspx +++ b/web/admin/order/index4.aspx @@ -95,6 +95,7 @@ 'fastSignUp2-component': httpVueLoader('./fastSignUp2.vue'), 'fastSignUp3-component': httpVueLoader('./fastSignUp3.vue'), 'fastSignUp4-component': httpVueLoader('./fastSignUp4.vue'), + 'fastSignUp5-component': httpVueLoader('./fastSignUp5.vue'), }, watch: { options: { @@ -121,6 +122,9 @@ this.currentView = "fastSignUp-component" } else if (item.action === "oldSign") { location.href="/admin/order/index.aspx" + } else if (item.action === "batchSign") { + this.twoData = item.item.num + this.currentView = "fastSignUp5-component" } //console.log("item.action:",this.twoData) },