From 11a8c3e932f8468fee064d49d2ff4819738f59aa Mon Sep 17 00:00:00 2001 From: enchiaaa Date: Mon, 4 May 2026 11:43:57 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9E=E6=B3=95=E6=9C=83?= =?UTF-8?q?=E6=B4=BB=E5=8B=95=E5=93=81=E9=A0=85=EF=BC=9A=E7=89=8C=E4=BD=8D?= =?UTF-8?q?=E9=99=BD=E4=B8=8A=E8=88=87=E8=B6=85=E5=BA=A6=E4=BA=BA=E6=95=B8?= =?UTF-8?q?=E9=99=90=E5=88=B6=E5=8A=9F=E8=83=BD=202.=20=E4=BF=A1=E7=9C=BE?= =?UTF-8?q?=E8=B3=87=E6=96=99=E6=96=B0=E5=A2=9E=E5=85=A8=E5=B9=B4=E6=80=A7?= =?UTF-8?q?=E9=81=B8=E9=A0=85=E4=BB=A5=E5=8F=8A=E9=96=8B=E5=A7=8B=E5=8F=83?= =?UTF-8?q?=E5=8A=A0=E6=B4=BB=E5=8B=95=E6=97=A5=E6=9C=9F=EF=BC=8C=E8=87=AA?= =?UTF-8?q?=E5=8B=95=E5=A0=B1=E5=90=8D=E4=B8=A6=E4=BB=A3=E5=85=A5=E5=89=8D?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E7=9A=84=E5=A0=B1=E5=90=8D=E8=B3=87=E6=96=99?= =?UTF-8?q?=EF=BC=88=E5=93=81=E9=A0=85=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/App_Code/Model/Model.cs | 9 + web/App_Code/Model/Model.edmx | 27 ++ web/App_Code/api/FollowerController.cs | 26 ++ web/App_Code/api/activityController.cs | 13 + web/App_Code/api/orderController.cs | 161 ++++----- web/admin/activity/reg.aspx | 65 +++- web/admin/activity/reg.aspx.cs | 84 +++++ web/admin/follower/reg.aspx | 246 ++++++++++++-- web/admin/follower/reg.aspx.cs | 427 +++++++++++++++++++++++- web/admin/order/reg.aspx | 1 + web/admin/print/tablet_edit/editor.html | 25 ++ web/web.config | 4 +- 資料庫修改紀錄.txt | 11 +- 13 files changed, 995 insertions(+), 104 deletions(-) diff --git a/web/App_Code/Model/Model.cs b/web/App_Code/Model/Model.cs index 7e96c16..4f167f0 100644 --- a/web/App_Code/Model/Model.cs +++ b/web/App_Code/Model/Model.cs @@ -406,6 +406,10 @@ namespace Model public Nullable price { get; set; } public Nullable qty { get; set; } public Nullable reg_time { get; set; } + public Nullable has_yang_limit { get; set; } + public Nullable has_chao_limit { get; set; } + public Nullable yang_limit_count { get; set; } + public Nullable chao_limit_count { get; set; } public virtual actItem actItem { get; set; } public virtual activity activity { get; set; } @@ -938,6 +942,11 @@ namespace Model public Nullable appellation_id { get; set; } public string follower_hash { get; set; } public string search_keywords { get; set; } + public Nullable is_auto_enroll { get; set; } + public Nullable auto_enroll_start_date { get; set; } + public string auto_enroll_receipt_title { get; set; } + public string auto_enroll_receipt_address { get; set; } + public Nullable auto_enroll_is_receipt { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection activity_check { get; set; } diff --git a/web/App_Code/Model/Model.edmx b/web/App_Code/Model/Model.edmx index 737f647..a14642c 100644 --- a/web/App_Code/Model/Model.edmx +++ b/web/App_Code/Model/Model.edmx @@ -190,6 +190,10 @@ + + + + @@ -482,6 +486,11 @@ + + + + + @@ -2729,6 +2738,10 @@ + + + + @@ -2970,6 +2983,11 @@ + + + + + @@ -5445,6 +5463,10 @@ + + + + @@ -5635,6 +5657,11 @@ + + + + + diff --git a/web/App_Code/api/FollowerController.cs b/web/App_Code/api/FollowerController.cs index 88b228e..4aff8f4 100644 --- a/web/App_Code/api/FollowerController.cs +++ b/web/App_Code/api/FollowerController.cs @@ -10,6 +10,7 @@ using System.Collections; using DocumentFormat.OpenXml.Office2010.Excel; using MyWeb; using System.Data.Entity; +using System.Diagnostics; // api/Follower //[ezAuthorize(Roles = "admin")]//群組:* @@ -672,6 +673,31 @@ public class FollowerController : ApiController return Ok(data); } [HttpPost] + [Route("api/follower/pending_orders")] + public IHttpActionResult GetPendingOrders(int id, string targetDate) + { + + DateTime today = DateTime.Today; + if (!DateTime.TryParse(targetDate, out DateTime limitDate)) + { + limitDate = new DateTime(2099, 12, 31); + } + var orderrecord = _db.pro_order + .Where(x => x.f_num == id && x.activity.startDate_solar >= today && x.activity.startDate_solar < limitDate) + .Include(x => x.activity) + .ToList(); + var data = new + { + list = orderrecord.Select(x => new + { + orderno = x.order_no, + activitydate = x.activity.startDate_solar.Value.ToString("yyyy/MM/dd"), + activityname = x.activity.subject, + }) + }; + return Ok(data); + } + [HttpPost] [Route("api/follower/totalorderamount")] public IHttpActionResult GetTotalOrderCount(int id) { diff --git a/web/App_Code/api/activityController.cs b/web/App_Code/api/activityController.cs index 039a444..cbe8d40 100644 --- a/web/App_Code/api/activityController.cs +++ b/web/App_Code/api/activityController.cs @@ -7,6 +7,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Data.Entity; +using System.Diagnostics; using System.Linq; using System.Net; using System.Net.Http; @@ -958,6 +959,10 @@ public class activityController : ApiController }, price = x.price ?? 0, qty = x.qty ?? 0, + has_yang_limit = x.has_yang_limit?? false, + has_chao_limit = x.has_yang_limit?? false, + yang_limit_count = x.yang_limit_count?? 0, + chao_limit_count = x.chao_limit_count?? 0, files = x.actItem?.actItem_files.Select(f => new { num = f.file.num, @@ -1175,6 +1180,10 @@ public class activityController : ApiController if (item.qty.HasValue) { _data.qty = item.qty.Value; } else { _data.qty = null; } _data.reg_time = DateTime.Now; + if (item.has_yang_limit.HasValue) { _data.has_yang_limit = item.has_yang_limit; } + if (item.yang_limit_count >= 0) { _data.yang_limit_count = item.yang_limit_count.Value; } + if (item.has_chao_limit.HasValue) { _data.has_chao_limit = item.has_chao_limit; } + if (item.chao_limit_count >= 0) { _data.chao_limit_count = item.chao_limit_count.Value; } _db.SaveChanges(); var ret = _data.num; @@ -1195,6 +1204,10 @@ public class activityController : ApiController if (item.qty.HasValue) { _data.qty = item.qty.Value; } else { _data.qty = null; } _data.reg_time = DateTime.Now; + if (item.has_yang_limit.HasValue) { _data.has_yang_limit = item.has_yang_limit; } + if (item.yang_limit_count >= 0) { _data.yang_limit_count = item.yang_limit_count.Value; } + if (item.has_chao_limit.HasValue) { _data.has_chao_limit = item.has_chao_limit; } + if (item.chao_limit_count >= 0) { _data.chao_limit_count = item.chao_limit_count.Value; } _db.activity_relating.Add(_data); _db.SaveChanges(); diff --git a/web/App_Code/api/orderController.cs b/web/App_Code/api/orderController.cs index 64b65c7..9c3d833 100644 --- a/web/App_Code/api/orderController.cs +++ b/web/App_Code/api/orderController.cs @@ -7,6 +7,8 @@ using System; using System.Activities.Expressions; using System.Collections; using System.Collections.Generic; +using System.Data.Entity; +using System.Data.Entity.Core.Objects; using System.Diagnostics; using System.IdentityModel.Metadata; using System.Linq; @@ -351,7 +353,7 @@ public class orderController : ApiController //var qry1 = _db.pro_order_detail.AsEnumerable(); //qry1 = qry1.Where(o => o.order_no == order_no); //var qry1 = prod.pro_order_detail.AsEnumerable(); - var qry1 = prod.pro_order_detail.AsQueryable(); + var qry1 = prod.pro_order_detail.AsQueryable().Include(o => o.pro_order.activity.activity_relating); //if (!string.IsNullOrEmpty(q.subject)) // qry = qry.Where(o => o.subject.Contains(q.subject)); @@ -380,8 +382,8 @@ public class orderController : ApiController qry1 = qry1.OrderByDescending(o => o.num); } - - var tdesc = publicFun.enum_desc(); + + var tdesc = publicFun.enum_desc();; int i = 1; //已有值 @@ -390,82 +392,91 @@ public class orderController : ApiController (List)qry1_list.ToPagedList(page, pageSize); var count = qry1_list.Count(); + + var ret = new { - list = qry1_list.Select(x => new - { - id = i++, - num = x.num, - order_no = x.order_no, - actitem_num_selected = new + list = qry1_list.Select(x => { + var tmpActivityRelating = x.pro_order?.activity?.activity_relating?.Where(a => a.actItem_num == x.actItem_num).FirstOrDefault(); + return new { - text = x.actItem_num.HasValue ? x.actItem.subject : "", - val = x.actItem_num.HasValue ? x.actItem_num.Value : 0, - }, - parent_num = x.parent_num, - f_num_selected = new - { - text = x.f_num.HasValue ? x.follower.u_name : "", - val = x.f_num.HasValue ? x.f_num.Value : 0, - }, - f_num_tablet = x.f_num_tablet, - print_id = x.print_id, - address = x.address, - due_date = x.due_date, - start_date = x.start_date, - extend_date = x.extend_date, - from_id_selected = new - { - text = x.from_id.HasValue ? x.follower1.u_name : "", - val = x.from_id.HasValue ? x.from_id : 0, - }, - from_id_tablet = x.from_id_tablet, - price = x.price ?? 0, - qty = x.qty ?? 0, - writeBedQty = bedDt.Where(b => b.bed_order.o_detail_id.Value == x.num && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(), //已劃數量 - notBedQty = bedDt.Where(b => b.bed_order.o_detail_id.Value == x.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(), //未劃數量 - //total = x.total.HasValue ? x.total.Value : 0, - category = x.actItem?.category, - //pay = x.pay ?? 0, - pay = x.pro_order_record.Select(c => c.price).Sum(), - pay_date = x.pay_date, - keyin1_selected = new - { - text = tdesc[x.keyin1.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1], - val = x.keyin1, - }, - demo = x.demo, - files = x.actItem?.actItem_files.Select(f => new - { - num = f.file.num, - subject = f.file.subject, - word = f.file.word, - cuz_column = f.file.customize_data ?? "", //?? - paperset = f.file.paperset ?? "", - }), - customize_data = x.customize_data ?? "", - customize_data_comb = new - { - from_id_cuz_data = "", - activity_cuz_data = "", - actitem_cuz_data = "", - order_cuz_data = "", - }, - printed_files = x.printed_files ?? "", - isPackage = (x.actItem.act_bom - .Any(ab => ab.package_num == null && ab.item_num != null) - ? 1 : 0), - bom_order = (x.actItem.act_bom - .Any(ab => ab.package_num == null && ab.item_num != null) - ? x.num.ToString() - : (x.parent_num.ToString() + x.num.ToString()) - ), - //cash_record = x.pro_order_record.Select( c => new { - // c, - // //pay_kind = tdesc2[c.payment.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1], - //}), + has_yang_limit = tmpActivityRelating?.has_yang_limit ?? false, + has_chao_limit = tmpActivityRelating?.has_chao_limit ?? false, + yang_limit_count = tmpActivityRelating?.yang_limit_count ?? 0, + chao_limit_count = tmpActivityRelating?.chao_limit_count ?? 0, + id = i++, + num = x.num, + order_no = x.order_no, + actitem_num_selected = new + { + text = x.actItem_num.HasValue ? x.actItem.subject : "", + val = x.actItem_num.HasValue ? x.actItem_num.Value : 0, + }, + parent_num = x.parent_num, + f_num_selected = new + { + text = x.f_num.HasValue ? x.follower.u_name : "", + val = x.f_num.HasValue ? x.f_num.Value : 0, + }, + f_num_tablet = x.f_num_tablet, + print_id = x.print_id, + address = x.address, + due_date = x.due_date, + start_date = x.start_date, + extend_date = x.extend_date, + from_id_selected = new + { + text = x.from_id.HasValue ? x.follower1.u_name : "", + val = x.from_id.HasValue ? x.from_id : 0, + }, + from_id_tablet = x.from_id_tablet, + price = x.price ?? 0, + qty = x.qty ?? 0, + writeBedQty = bedDt.Where(b => b.bed_order.o_detail_id.Value == x.num && b.checkIn_date.HasValue && b.bed_kind_detail_id.HasValue).Count(), //已劃數量 + notBedQty = bedDt.Where(b => b.bed_order.o_detail_id.Value == x.num && (!b.checkIn_date.HasValue || !b.bed_kind_detail_id.HasValue)).Count(), //未劃數量 + //total = x.total.HasValue ? x.total.Value : 0, + category = x.actItem?.category, + //pay = x.pay ?? 0, + pay = x.pro_order_record.Select(c => c.price).Sum(), + pay_date = x.pay_date, + keyin1_selected = new + { + text = tdesc[x.keyin1.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1], + val = x.keyin1, + }, + demo = x.demo, + files = x.actItem?.actItem_files.Select(f => new + { + num = f.file.num, + subject = f.file.subject, + word = f.file.word, + cuz_column = f.file.customize_data ?? "", //?? + paperset = f.file.paperset ?? "", + }), + customize_data = x.customize_data ?? "", + customize_data_comb = new + { + from_id_cuz_data = "", + activity_cuz_data = "", + actitem_cuz_data = "", + order_cuz_data = "", + }, + printed_files = x.printed_files ?? "", + isPackage = (x.actItem.act_bom + .Any(ab => ab.package_num == null && ab.item_num != null) + ? 1 : 0), + bom_order = (x.actItem.act_bom + .Any(ab => ab.package_num == null && ab.item_num != null) + ? x.num.ToString() + : (x.parent_num.ToString() + x.num.ToString()) + ), + //cash_record = x.pro_order_record.Select( c => new { + // c, + // //pay_kind = tdesc2[c.payment.HasValue && x.keyin1.Value > 0 ? x.keyin1.Value : 1], + //}), - }) + }; + }) .ToList() .OrderByDescending(x => (x.isPackage + (x.parent_num == null ? 0 : 1))) //.ThenBy(x => (x.parent_num == null ? 1 : 2)) // Top-level items first diff --git a/web/admin/activity/reg.aspx b/web/admin/activity/reg.aspx index cfbc59b..503c3f5 100644 --- a/web/admin/activity/reg.aspx +++ b/web/admin/activity/reg.aspx @@ -165,6 +165,8 @@ { text: '* 品項名稱', value: 'act_item_selected.text', sortable: false }, { text: '預設金額', value: 'price', sortable: false }, { text: '數量', value: 'qty', sortable: false }, + { text: '陽上/祈福人數限制', value: 'limit_yang', sortable: false }, + { text: '超渡人數限制', value: 'limit_chao', sortable: false }, { text: '', value: 'actions', sortable: false, width: "200px" }, ], footersDetail: { @@ -191,6 +193,10 @@ price: 0, qty: 0, files: [], + has_yang_limit: false, + has_chao_limit: false, + yang_limit_count: 0, + chao_limit_count: 0, }, defaultItem: { id: 0, @@ -203,6 +209,10 @@ price: 0, qty: 0, files: [], + has_yang_limit: false, + has_chao_limit: false, + yang_limit_count: 0, + chao_limit_count: 0, }, //列印 data_table: { @@ -434,9 +444,8 @@ this.close(); }, spliceNullData() { - //if new data ,then splice it - if (this.editedItem.num == 0) { + if (this.editedItem.num == 0) { for (var i = 0; i < this.desserts.map(x => x.id).length; i++) { if (this.desserts[i].id == this.editedItem.id) { this.desserts.splice(i, 1); break; @@ -482,6 +491,10 @@ actItem_num: this.editedItem.act_item_selected.val, price: this.editedItem.price, qty: this.editedItem.qty, + has_yang_limit: this.editedItem.has_yang_limit, + has_chao_limit: this.editedItem.has_chao_limit, + yang_limit_count: this.editedItem.yang_limit_count, + chao_limit_count: this.editedItem.chao_limit_count, } axios .post(HTTP_HOST + 'api/activity/SaveRelatingData', pro_order_detail) @@ -1019,6 +1032,54 @@ {{item.qty}} + + + +