merge N++ 0.1
This commit is contained in:
@@ -42,7 +42,7 @@ public partial class admin_activity_item_reg : MyWeb.config
|
||||
BuildKind();
|
||||
subject.Text = prod.subject;
|
||||
print_init.Text = prod.print_init;
|
||||
//PARTNO.Text = prod.partno;
|
||||
|
||||
//kind.SelectedValue = prod.kind.ToString();
|
||||
if (!isStrNull(prod.pageSize))
|
||||
{
|
||||
|
||||
@@ -197,7 +197,6 @@
|
||||
has_chao_limit: false,
|
||||
yang_limit_count: 0,
|
||||
chao_limit_count: 0,
|
||||
},
|
||||
defaultItem: {
|
||||
id: 0,
|
||||
num: 0,
|
||||
@@ -289,6 +288,20 @@
|
||||
items: [
|
||||
{ order_no: "D", member_name: "S", order_date:"2025-12-07"}
|
||||
],
|
||||
unfilled_list: {
|
||||
loading: false,
|
||||
search: '',
|
||||
headers: [
|
||||
{ text: '訂單編號', value: 'order_no' },
|
||||
{ text: '信眾編號', value: 'f_number' },
|
||||
{ text: '信眾姓名', value: 'u_name' },
|
||||
{ text: '聯絡電話', value: 'phone' },
|
||||
{ text: '建立日期', value: 'order_date' },
|
||||
],
|
||||
items: [
|
||||
{ order_no: "D", member_name: "S", order_date:"2025-12-07"}
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -457,9 +470,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;
|
||||
@@ -913,7 +925,7 @@
|
||||
const _date = $('#<%= startDate_solar.ClientID%>').val();
|
||||
return _subject + " " + _date;
|
||||
},
|
||||
loadUnfilledList() {
|
||||
loadUnfilledList() {
|
||||
if (!this.this_id) return;
|
||||
|
||||
this.unfilled_list.loading = true;
|
||||
@@ -1283,6 +1295,7 @@ loadUnfilledList() {
|
||||
<span v-if="item.id !== editedItem.id && item.has_chao_limit">{{item.chao_limit_count}} 人</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:item.actions="{ item }">
|
||||
<template v-if="item.id === editedItem.id">
|
||||
<v-icon color="red" class="mr-2" @click="cancel">
|
||||
|
||||
@@ -524,8 +524,85 @@ private void RunAutoEnroll(int activityNum)
|
||||
}
|
||||
}
|
||||
|
||||
private void RunAutoEnroll(int activityNum)
|
||||
{
|
||||
var activity = _db.activities.FirstOrDefault(a => a.num == activityNum);
|
||||
if (activity == null || !activity.startDate_solar.HasValue) return;
|
||||
|
||||
DateTime actDate = activity.startDate_solar.Value;
|
||||
|
||||
var validConfigs = _db.auto_enroll
|
||||
.Where(ae => actDate >= ae.start_date && actDate <= ae.end_date)
|
||||
.ToList();
|
||||
|
||||
foreach (var config in validConfigs)
|
||||
{
|
||||
if (_db.pro_order.Any(o => o.activity_num == activity.num && o.f_num == config.f_num))
|
||||
continue;
|
||||
|
||||
var follower = _db.followers.FirstOrDefault(f => f.num == config.f_num);
|
||||
if (follower == null) continue;
|
||||
|
||||
string newOrderNo = AutoOrderService.CreateAutoOrderNumber(_db);
|
||||
|
||||
Model.pro_order proOrder = new Model.pro_order
|
||||
{
|
||||
order_no = newOrderNo,
|
||||
up_time = DateTime.Now,
|
||||
reg_time = DateTime.Now,
|
||||
keyin1 = "A01",
|
||||
f_num = follower.num,
|
||||
au_num = config.num,
|
||||
phone = !string.IsNullOrEmpty(follower.cellphone) ? follower.cellphone : (follower.phone ?? ""),
|
||||
activity_num = activity.num,
|
||||
address = config.receipt_address ?? "",
|
||||
receipt_title = config.receipt_title ?? "",
|
||||
demo = "",
|
||||
customize_data = ""
|
||||
};
|
||||
|
||||
_db.pro_order.Add(proOrder);
|
||||
|
||||
CopyLatestOrderDetails(newOrderNo, config.f_num, (int)activity.kind);
|
||||
}
|
||||
|
||||
_db.SaveChanges();
|
||||
}
|
||||
|
||||
private void CopyLatestOrderDetails(string newOrderNo, int f_num, int activityKind)
|
||||
{
|
||||
var latestOrder = _db.pro_order
|
||||
.Where(o => o.f_num == f_num && o.activity.kind == activityKind && _db.pro_order_detail.Any(d => d.order_no == o.order_no))
|
||||
.OrderByDescending(o => o.order_no)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (latestOrder != null)
|
||||
{
|
||||
var prevDetails = _db.pro_order_detail.Where(d => d.order_no == latestOrder.order_no).ToList();
|
||||
foreach (var detail in prevDetails)
|
||||
{
|
||||
Model.pro_order_detail newDetail = new Model.pro_order_detail
|
||||
{
|
||||
order_no = newOrderNo,
|
||||
actItem_num = detail.actItem_num,
|
||||
parent_num = detail.parent_num,
|
||||
print_id = detail.print_id,
|
||||
f_num = detail.f_num,
|
||||
f_num_tablet = detail.f_num_tablet,
|
||||
address = detail.address,
|
||||
from_id = detail.from_id,
|
||||
from_id_tablet = detail.from_id_tablet,
|
||||
qty = detail.qty,
|
||||
price = detail.price,
|
||||
start_date = DateTime.Today,
|
||||
pay = 0,
|
||||
UpdateTime = DateTime.Now
|
||||
};
|
||||
_db.pro_order_detail.Add(newDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user