調整牌位排版,增加疏文列印

This commit is contained in:
2026-07-13 17:49:11 +08:00
parent d71cc605dc
commit fbfa8dd361
7 changed files with 413 additions and 3 deletions
+1
View File
@@ -159,6 +159,7 @@ public class designerController : ApiController
tsd.Height = item.height == null ? "" : (string)item.height;
tsd.TextWidth = item.textWidth == null ? "" : (string)item.textWidth;
tsd.TextHeight = item.textHeight == null ? "" : (string)item.textHeight;
tsd.TextSpan = item.textSpan == null ? "" : (string)item.textSpan;
tsd.TwoOffset = item.twoOffset == null ? "" : (string)item.twoOffset;
tsd.ThreeOffset = item.threeOffset == null ? "" : (string)item.threeOffset;
tsd.FourOffset = item.fourOffset == null ? "" : (string)item.fourOffset;
+52
View File
@@ -2,6 +2,7 @@
using Model;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.Util.Optional;
using PagedList;
using System;
using System.Collections;
@@ -98,4 +99,55 @@ public class orderdetailController:ApiController
throw new HttpResponseException(HttpStatusCode.NotFound);
}
}
[HttpPost]
[Route("api/orderdetail/GetShuwenData")]
public IHttpActionResult GetShuwenData([FromBody] dynamic data)
{
var json = data;
var num = (json.activity_num == null ? 0 : (int)json.activity_num);
var query = _db.pro_order_detail.AsQueryable();
query=query.Where(x => (_db.act_bom.AsQueryable().Where(y => y.package_num == null).Select(y => y.item_num).ToList()).
Contains(x.actItem_num));
query = query.Where(x => (_db.pro_order.AsQueryable().
Where(w => w.activity_num ==num ).Select(w => w.order_no)).ToList().Contains(x.order_no));
//這些是功德主
var list = query.OrderByDescending(x=>x.price).Select(x => new
{
x.num,x.order_no,x.actItem_num,x.parent_num,x.print_id,x.f_num_tablet,x.price,
childs=_db.pro_order_detail.Where(z=>z.order_no==x.order_no&&x.parent_num==x.actItem_num).Select(z=>new
{
x.num,
x.order_no,
x.actItem_num,
x.parent_num,
x.print_id,
x.f_num_tablet,
x.price
}).ToList()
}).ToList();
var query1 = _db.pro_order_detail.AsQueryable();
query1 = query1.Where(x => !(_db.act_bom.AsQueryable().Where(y => y.package_num == null).Select(y => y.item_num).ToList()).
Contains(x.actItem_num));
query1 = query1.Where(x => x.parent_num == null);
query1 = query1.Where(x => (_db.pro_order.AsQueryable().
Where(w => w.activity_num == num).Select(w => w.order_no)).ToList().Contains(x.order_no));
//這些是非功德主
var list1 = query1.OrderByDescending(x => x.price).Select(x => new
{
x.num,
x.order_no,
x.actItem_num,
x.parent_num,
x.print_id,
x.f_num_tablet,
x.price
}).ToList();
return Ok(new {result="Y",data=new { list=list,list1=list1 } });
}
}
+6 -1
View File
@@ -276,7 +276,9 @@
{ name: "超薦1", path: "../../admin/print/html/tablet-1_new.svg" },
{ name: "超薦2", path: "../../admin/print/html/tablet-1B_new.svg" },
{ name: "消災1", path: "../../admin/print/html/tablet-2.svg" },
{ name: "消災2", path: "../../admin/print/html/tablet-2B.svg" }
{ name: "消災2", path: "../../admin/print/html/tablet-2B.svg" },
{ name: "消災3", path: "../../admin/print/html/tablet-2C.svg" },
{ name: "消災4", path: "../../admin/print/html/tablet-2D.svg" }
],
allStyle: [
],
@@ -503,9 +505,11 @@
await axios
.post(HTTP_HOST + 'api/tablet/GetTabletElement', {})
.then(response => {
console.log(response)
//if (response.result=="Y") {
if (response.status == "200") {
let data = response.data;
console.log("data:",data)
if (data.result == "Y") {
data.data.forEach(x => {
self.tabletElements.push(x);
@@ -1085,6 +1089,7 @@
//this.render();
},
displayItem(id) {
console.log("displayItem:", this.elements, id);
let el = this.elements.find(x => x.id === id);
el.style.visibility = el.style.visibility === "hidden" ? "" : "hidden";
//要判斷如果所在位置超出範圍,要拉回來放
+3 -1
View File
@@ -133,7 +133,9 @@
{ name: "超薦1", path: "../../../admin/print/html/tablet-1_new.svg" },
{ name: "超薦2", path: "../../../admin/print/html/tablet-1B_new.svg" },
{ name: "消災1", path: "../../../admin/print/html/tablet-2.svg" },
{ name: "消災2", path: "../../../admin/print/html/tablet-2B.svg" }
{ name: "消災2", path: "../../../admin/print/html/tablet-2B.svg" },
{ name: "消災3", path: "../../admin/print/html/tablet-2C.svg" },
{ name: "消災4", path: "../../admin/print/html/tablet-2D.svg" }
],
async init() {
this.toast = new bootstrap.Toast($('#liveToast'));
+334
View File
@@ -0,0 +1,334 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Templates/TBS5ADM001/MasterPage.master" AutoEventWireup="true" CodeFile="shuwen.aspx.cs" Inherits="admin_print_shuwen" %>
<asp:Content ID="Content1" ContentPlaceHolderID="page_header" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="page_nav" Runat="Server">
<div class="mb-2 mb-sm-0">
<label>請選擇需要列印的活動(法會)</label>
<div class="input-group mb-3" data-search-control="search2" @click="search_show(search_dialog.controls.search2)">
<input class="form-control search-text" type="text" readonly
id="activity_txt" runat="server" placeholder="活動(法會)" value="">
<asp:HiddenField ID="activity" runat="server" Value="" />
<button class="btn btn-outline-secondary" type="button">
<i class="mdi mdi-view-list-outline"></i>
</button>
</div>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="content" class="container-md">
<button type="button" @click.prevent="getShuwen()">消災疏文</button>
<button type="button">超薦疏文</button>
<button type="button">齋條</button>
<button type="button">燈條</button>
<button type="button">供僧</button>
<button type="button">供果</button>
<button type="button">供佛</button>
<%--<v-data-table
v-model="order_data.selected"
:items="order_data.list"
item-key="order_no"
:headers="order_data.header"
:loading="order_data.loading"
class="elevation-1">
<template #item.files ="{item}">
{{getItemCount(item.files)}}
</template>
<template #item.print="{item}">
</template>
</v-data-table>--%>
</div>
<v-dialog v-model="search_dialog.show" max-width="700px">
<v-card>
<v-card-title class="justify-space-between grey lighten-2">
查詢:{{search_dialog.current.title}}
<v-btn icon @click="search_dialog.show=false; search_dialog.page = 1;"><v-icon>mdi-close</v-icon></v-btn>
</v-card-title>
<v-card-text >
<v-row>
<v-col v-for="item in search_dialog.current.keys"
:cols="search_dialog.current.keys.length>1?6:12" >
<v-text-field v-model="item.value" :label="item.title" v-if="item.visible===undefined || item.visible==true "></v-text-field>
</v-col>
<v-col cols="12" class="text-end">
<v-btn color="primary" elevation="0" @click="search_get()">查詢</v-btn>
<v-btn elevation="0" @click="search_clear()">清除條件</v-btn>
</v-col>
</v-row>
<v-data-table
:headers="search_headers()"
:items="search_dialog.list"
:footer-props="search_dialog.footer"
:items-per-page="10"
:server-items-length="search_dialog.count"
:page.sync="search_dialog.page"
:options.sync="options"
@click:row="search_select"
:loading="search_dialog.loading"
></v-data-table>
</v-card-text>
<v-card-actions>
</v-card-actions>
</v-card>
</v-dialog>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="offCanvasRight" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer_script" Runat="Server">
<script>
let VueApp = new Vue({
el: '#app',
vuetify: new Vuetify(vuetify_options),
data() {
return {
canPrint: false,
options: {},
activity_list: [],
order_data: {
loading: false,
list: [],
selected: [],
count: 0,
header: [
{ text: '功德項目', value: 'act_item_selected.text' },
{ text: '數量', value: 'files' },
{ text: '列印', value: 'print' }
],
},
print_data: {
item: [],
loading: false,
list: [],
selected: [],
count: 0,
header: [
{ text: '報名單號', value: 'order_no' },
{ text: '列印編號', value: 'print_id' },
{ text: '已列印', value: 'isPrinted' }
],
print_dialog: { show: false }
},
search_dialog: {
controls: {
search2: {
id: 'search2',
title: '活動(法會)',
text_prop: 'subject',
value_prop: 'num',
keys: [
{ id: 'num', title: '編號', value: '' },
{ id: 'subject', title: '活動(法會)名稱', value: '' },
],
api_url: HTTP_HOST + 'api/activity/GetList',
columns: [
{ id: 'num', title: '編號' },
{ id: 'subject', title: '活動(法會)名稱' },
],
selected: {},
select(item, t) {
}
},
},
show: false,
current: {},
list: [],
count: 0,
page: 1,
loading: false,
footer: {
showFirstLastPage: true,
disableItemsPerPage: true,
itemsPerPageAllText: '',
itemsPerPageText: '',
//'items-per-page-options': [10, 20, 30, 40, 50, 100]
},
},
selected_activity: '-1',
search: {
kind: 0,
subject: '',
},
snackbar: {
show: false,
text: "",
},
}
},
computed: {
processedItems() {
return this.print_data.list.map(item => ({
...item,
compositeKey: `${item.order_no}_${item.num.toString()}_${item.print_id}`
}))
}
},
methods: {
getShuwen() {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`)
let searchData = { activity_num: target.children("input:hidden").val() }
axios
.post(HTTP_HOST + 'api/orderdetail/GetShuwenData', searchData)
.then(response => {
console.log(response)
})
},
getItemCount(item) {
//console.log("getItemCount:",item[0]?.list.length)
return item[0]?.list.length
},
search_show(curr) {
this.search_dialog.current = curr;
this.search_clear()
//this.search_get()//清除完自動會重抓, 故取消
this.search_dialog.show = true;
},
search_clear() {
if (!this.search_dialog.current.keys) return;
this.search_dialog.current.keys.forEach((t, i) => { t.value = '' })
this.search_get()
},
search_get() {
if (!this.search_dialog.current.keys) return;
let api_url = this.search_dialog.current.api_url;
let keys = this.search_dialog.current.keys;
//const { page, itemsPerPage } = this.options
//const { sortBy, sortDesc, page, itemsPerPage } = this.options
this.search_dialog.page = this.options.page ?? 1
let params = { page: this.search_dialog.page, pageSize: 10 };//url params
var search = {};//post body
keys.forEach((t, i) => {
search[t.id] = t.value;
});
if (this.search_dialog.current.id == 'search5') {
search['num'] = this.activity_id;
}
if (this.search_dialog.current.id == 'search4') {
search['num'] = this.follower_id;
}
if (this.search_dialog.current.id == 'search6') {
search['num'] = this.follower_id;
}
if (this.search_dialog.current.id == 'search7' || this.search_dialog.current.id == 'search8') {
search['num'] = this.follower_id;
}
//console.log("search_get", api_url, search, params, this.options);
this.search_dialog.loading = true
axios.post(api_url, search, { params: params })
.then(response => {
this.search_dialog.list = response.data.list
this.search_dialog.count = response.data.count
this.search_dialog.loading = false
})
.catch(error => {
console.log(error)
this.search_dialog.list = []
this.search_dialog.count = 0
this.search_dialog.loading = false
this.snackbar.text = "錯誤:" + error
this.snackbar.show = true
})
},
search_headers() {
if (!this.search_dialog.current.columns) return;
r = [];
this.search_dialog.current.columns.forEach((t, i) => {
//console.log("search_headers:", t, i);
r.push({
text: t.title,
width: t.width,
align: 'start',
sortable: false,
value: t.id,
})
})
return r
},
search_select(row) {
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`);
curr.selected = row;
//牌位
if (curr.id == 'search7') {
this.editedItem.f_num_tablet = curr.selected[curr.text_prop];
} else if (curr.id == 'search8') {
this.editedItem.from_id_tablet = curr.selected[curr.text_prop];
} else {
target.children("input.search-text").val(curr.selected[curr.text_prop])//text
target.children("input:hidden").val(curr.selected[curr.value_prop])//value
}
if (curr.select instanceof Function) {
curr.select(this.editedItem, row);
}
this.search_dialog.show = false;
this.search_dialog.page = 1;
this.get_activity()
//console.log(row, row["u_name"], row["f_number"], curr.id, target);
},
get_activity() {
const params = {
page: 1, pageSize: 1000
};
let curr = this.search_dialog.current;
let target = $(`[data-search-control=${curr.id}]`)
this.search = { num: target.children("input:hidden").val() }
this.order_data.loading = true
axios
.post(HTTP_HOST + 'api/activity/GetActRelaList', this.search, { params: params })
.then(response => {
//console.log("GetActRelaList:", response);
this.order_data.list = response.data.list
this.order_data.list.forEach(val => {
val.files.forEach(y => {
y.list.forEach(z => {
if (z.printed_files.includes(y.num.toString())) {
z.isPrinted = true
}
}
)
})
//if(val.files.list) val.files.num
});
this.order_data.count = response.data.count;
this.order_data.loading = false
})
.catch(error => console.log(error))
},
},
mounted() {
//this.get_activity()
},
watch: {
selected_activity(newValue, oldValue) {
const params = {
page: 1, pageSize: 100
};
console.log("selected_activity:", newValue)
if (newValue !== oldValue) {
axios
.post(HTTP_HOST + 'api/orderdetail/GetList', { activity_num: this.selected_activity }, { params: params })
.then(response => {
this.order_data.list = response.data.list
})
.catch(error => console.log(error))
}
},
'order_data.selected'(newValue, oldValue) {
console.log(newValue)
}
}
})
</script>
</asp:Content>
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class admin_print_shuwen : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
@@ -215,7 +215,9 @@
{ name: "超薦1", path: "../../../admin/print/html/tablet-1_new.svg" },
{ name: "超薦2", path: "../../../admin/print/html/tablet-1B_new.svg" },
{ name: "消災1", path: "../../../admin/print/html/tablet-2.svg" },
{ name: "消災2", path: "../../../admin/print/html/tablet-2B.svg" }
{ name: "消災2", path: "../../../admin/print/html/tablet-2B.svg" },
{ name: "消災3", path: "../../admin/print/html/tablet-2C.svg" },
{ name: "消災4", path: "../../admin/print/html/tablet-2D.svg" }
],
async init() {
// 載入常用片語