From 6e165656033d3b519cb8e1da5859337ce18f7468 Mon Sep 17 00:00:00 2001
From: wanggang <76527413@qq.com>
Date: Fri, 11 Aug 2023 10:57:01 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AF=84=E5=94=AE=E5=BA=93?=
=?UTF-8?q?=E5=AD=98=E5=AF=BC=E5=87=BA=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../wwwroot/components/form/form-input.js | 6 +-
.../wwwroot/components/table/index.js | 60 ++-
.../views/invoice/invoice_map_group.js | 397 +++++++++++-------
.../Entities/BQ/VmiAppService.cs | 68 ++-
4 files changed, 349 insertions(+), 182 deletions(-)
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
index 969aef8e..9e9df487 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/form/form-input.js
@@ -31,7 +31,11 @@ export default {
-
+
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js
index e03d66d6..07222ad5 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/table/index.js
@@ -1,16 +1,29 @@
import html from "html";
+import { reactive, ref } from "vue";
export default {
- template: html`
+ template: html`
-
{{item.title}}
+
+
+
+
{{item.title}}
-
+
-
-
{{val}}
+
+
+
+
+
{{row[item.dataKey]}}
@@ -19,12 +32,12 @@ export default {
.app-table {
display: table;
content-visibility: visible;
+ border-top: var(--el-table-border);
+ border-left: var(--el-table-border);
}
.app-table .row {
display: table-row;
background-color: var(--el-table-tr-bg-color);
- border-top: var(--el-table-border);
- border-left: var(--el-table-border);
}
.app-table .cell.el-table__cell {
display: table-cell;
@@ -34,6 +47,35 @@ export default {
}
`,
props: ["modelValue", "columns", "data"],
- emit: ["update:modelValue"],
- setup(props, context) {},
+ setup(props) {
+ const model = reactive(props.data);
+ const tableRef = ref(null);
+ const getSelection = () => {
+ return Array.from(tableRef.value.querySelectorAll("input.row:checked")).map((o) => parseInt(o.value));
+ };
+ const clearSelection = () => {
+ Array.from(tableRef.value.querySelectorAll("input:checked")).forEach((o) => (o.checked = false));
+ };
+ const checkAll = ref(false);
+ const checkAllIndeterminate = ref(false);
+ const checkAllClick = (e) => {
+ checkAll.value = !checkAll.value;
+ if (checkAll.value) {
+ Array.from(tableRef.value.querySelectorAll("input.row:not(:checked)")).forEach((o) => (o.checked = true));
+ } else {
+ Array.from(tableRef.value.querySelectorAll("input.row:checked)")).forEach((o) => (o.checked = false));
+ }
+ const checkdCount = Array.from(tableRef.value.querySelectorAll("input.row:checked")).length;
+ checkAllIndeterminate.value = checkdCount > 0 && checkdCount < props.data.length;
+ };
+ return {
+ model,
+ tableRef,
+ checkAll,
+ checkAllIndeterminate,
+ checkAllClick,
+ getSelection,
+ clearSelection,
+ };
+ },
};
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/invoice/invoice_map_group.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/invoice/invoice_map_group.js
index ba203786..c132813a 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/invoice/invoice_map_group.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/invoice/invoice_map_group.js
@@ -1,4 +1,5 @@
import AppList from "../../../components/list/index.js";
+import AppForm from "../../../components/form/index.js";
import html from "html";
import { reactive, ref } from "vue";
import useConfig from "../../../models/invoice/invoice_map_group.js";
@@ -6,124 +7,121 @@ import request from "../../../request/index.js";
import AppTable from "../../components/table/index.js";
import { ElMessageBox } from "element-plus";
import { post } from "../../../request/index.js";
+import { schemaToModel } from "html";
export default {
- components: { AppList, AppTable },
+ components: { AppList, AppForm, AppTable },
template: html`
结算明细
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
- `,
+
+
+ 发票重开
+
+
+
+
+
+
+
+ 新建
+ 导入
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 添加调整明细
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确定
+
+ `,
styles: html` `,
setup() {
const fileList = ref([]);
@@ -154,45 +163,11 @@ export default {
}
await post(url, formData, method);
};
- const formInline = reactive({
- oldInvBillNum: "",
- invBillNum: "",
- settleDate: "",
- invGroupNum: "",
- lu: "",
- pn: "",
- qty: null,
- groupNum: "",
- });
//create
const invoiceValue = ref([]);
- const submitForm = () => {
- const newFormInline = { ...formInline };
- invoiceValue.value.push(newFormInline);
- Object.keys(formInline).forEach((key) => {
- delete formInline[key];
- });
- innerVisible.value = false;
- };
- //delete
- const selectedRows = ref([]);
- const deleteRow = async () => {
- const indexes = selectedRows.value.map((row) => invoiceValue.value.indexOf(row));
- indexes.forEach((index) => {
- invoiceValue.value.splice(index, 10000000000);
- });
- selectedRows.value = [];
- };
- const innerVisible = ref(false);
- const openImport = ref(false);
+ const addDialogVisible = ref(false);
+ const importDialogVisible = ref(false);
const dialogVisible = ref(false);
- const handleClose = (done) => {
- ElMessageBox.confirm("确认关闭")
- .then(() => {
- done();
- })
- .catch(() => {});
- };
const config = useConfig();
const drawer = ref(false);
const loading = ref(false);
@@ -213,6 +188,28 @@ export default {
loading.value = false;
};
const columns1 = [
+ {
+ dataKey: "version",
+ title: "期间",
+ },
+ {
+ dataKey: "invbillNum",
+ title: "发票号",
+ },
+ {
+ dataKey: "invGroupNum",
+ title: "发票分组号",
+ },
+ {
+ dataKey: "settleGroupNum",
+ title: "结算分组号",
+ },
+ {
+ dataKey: "amt",
+ title: "金额",
+ },
+ ];
+ const columns2 = [
{
key: "version",
dataKey: "version",
@@ -247,15 +244,11 @@ export default {
title: "业务分类",
},
];
- const columns2 = [
+ const columns3 = [
{
dataKey: "version",
title: "期间",
},
- {
- dataKey: "invbillNum",
- title: "发票号",
- },
{
dataKey: "invGroupNum",
title: "发票分组号",
@@ -265,32 +258,127 @@ export default {
title: "结算分组号",
},
{
- dataKey: "amt",
- title: "金额",
+ dataKey: "lu",
+ title: "可结算分组号",
+ },
+ {
+ dataKey: "lu1",
+ title: "不可结算分组号",
},
];
- const columns3 = [
+ const columns4 = [
{
- dataKey: "version",
- title: "期间",
+ dataKey: "oldInvBillNum",
+ title: "作废发票号",
+ },
+ {
+ dataKey: "invBillNum",
+ title: "发票号",
+ },
+ {
+ dataKey: "settleDate",
+ title: "下线日期",
},
{
dataKey: "invGroupNum",
title: "发票分组号",
},
{
- dataKey: "settleGroupNum",
- title: "结算分组号",
+ dataKey: "lu",
+ title: "零件号",
},
{
- dataKey: "lu",
- title: "可结算分组号",
+ dataKey: "pn",
+ title: "标识号",
},
{
- dataKey: "lu1",
- title: "不可结算分组号",
+ dataKey: "qty",
+ title: "数量",
+ },
+ {
+ dataKey: "groupNum",
+ title: "结算分组",
},
];
+ const columns5 = columns4.filter((o) => o.dataKey !== "oldInvBillNum" && o.dataKey !== "invGroupNum");
+ columns5.unshift({
+ input: "selection",
+ });
+ //
+ const setupRef = ref(1);
+ const adjListRef = ref(null);
+ const adjList = ref([]);
+ const showSetupDialog = () => {
+ adjList.value = [];
+ for (let i = 0; i < 100; i++) {
+ adjList.value.push({ invBillNum: i });
+ }
+ setupRef.value = 1;
+ dialogVisible.value = true;
+ };
+ const deleteAdj = () => {
+ const list = adjListRef.value.getSelection();
+ list.forEach((o) => adjList.value.splice(o, 1));
+ adjListRef.value.clearSelection();
+ };
+ const adjSchema = {
+ type: "object",
+ properties: {
+ invBillNum: {
+ type: "string",
+ title: "发票号",
+ rules: [{ required: true }],
+ },
+ settleDate: {
+ type: "string",
+ title: "下线日期",
+ input: "datetime",
+ rules: [{ required: true }],
+ },
+ lu: {
+ type: "string",
+ title: "零件号",
+ rules: [{ required: true }],
+ },
+ pn: {
+ type: "string",
+ title: "标识号",
+ rules: [{ required: true }],
+ },
+ qty: {
+ type: "string",
+ title: "数量",
+ input: "number",
+ rules: [{ required: true }],
+ },
+ groupNum: {
+ type: "string",
+ title: "结算分组",
+ rules: [{ required: true }],
+ },
+ },
+ };
+ const defaultAdjModel = schemaToModel(adjSchema);
+ const adjModel = ref(Object.assign({}, defaultAdjModel));
+ const addAdjFormRef = ref(null);
+ const addAdj = () => {
+ adjModel.value = Object.assign({}, defaultAdjModel);
+ addDialogVisible.value = true;
+ };
+ const submitAdj = async () => {
+ try {
+ const valid = await addAdjFormRef.value.validate();
+ if (valid) {
+ adjList.value.unshift(JSON.parse(JSON.stringify(adjModel.value)));
+ addDialogVisible.value = false;
+ }
+ } catch (error) {
+ console.log(error);
+ }
+ };
+ const importAdj = async () => {
+ importDialogVisible.value = true;
+ };
return {
config,
onCommand,
@@ -300,17 +388,26 @@ export default {
columns1,
columns2,
columns3,
- innerVisible,
+ columns4,
+ columns4,
+ columns5,
+ addDialogVisible,
dialogVisible,
- handleClose,
prop,
- formInline,
- submitForm,
invoiceValue,
- deleteRow,
- selectedRows,
- openImport,
+ importDialogVisible,
openImportHandler,
+ setupRef,
+ showSetupDialog,
+ adjList,
+ adjListRef,
+ deleteAdj,
+ addAdj,
+ submitAdj,
+ addAdjFormRef,
+ adjSchema,
+ adjModel,
+ importAdj,
};
},
};
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
index 1fbedb52..3b7c8ad9 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
@@ -229,7 +229,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
o.factory == data.factory &&
o.Configcode == data.Configcode);
- var log = new VmiLog
+ var log = new VmiLog(GuidGenerator.Create())
{
LogType = logType,
ChangedType = VmiType.In,
@@ -308,7 +308,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
o.OrderNum == data.OrderNum &&
o.factory == data.factory &&
o.Configcode == data.Configcode);
- var log = new VmiLog
+ var log = new VmiLog(GuidGenerator.Create())
{
LogType = logType,
ChangedType = VmiType.Out,
@@ -415,8 +415,12 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
[HttpPost]
public async Task BalanceExport(RequestDto input)
{
- var entities = await _balanceRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda())
- .ToListAsync().ConfigureAwait(false);
+ IQueryable query = _balanceRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda());
+ if (!string.IsNullOrEmpty(input.Sorting))
+ {
+ query = DynamicQueryableExtensions.OrderBy(query, input.Sorting);
+ }
+ var entities = await query.ToListAsync().ConfigureAwait(false);
var fileName = $"库存余额_{DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss")}.xlsx";
var content = this.GetContent(entities, "库存备份");
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
@@ -424,34 +428,54 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
}
///
- /// 补货数据导出
+ /// 库存事务查询
///
+ ///
+ ///
[HttpPost]
- public async Task ReplenishedExportAsync(RequestDto input)
+ public async Task> Log(LogRequestDto input)
{
- var entities = await _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda())
- .ToListAsync().ConfigureAwait(false);
- var fileName = $"补货数据_{DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss")}.xlsx";
- var content = this.GetContent(entities, "补货数据_");
+ var entities = await _logRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
+ var totalCount = await _logRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
+ return new PagedResultDto(totalCount, entities);
+ //return QueryLogFromTSDb(input);
+ }
+
+ ///
+ /// 库存事务导出
+ ///
+ [HttpPost]
+ public async Task LogExport(RequestDto input)
+ {
+ IQueryable query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda());
+ if (!string.IsNullOrEmpty(input.Sorting))
+ {
+ query = DynamicQueryableExtensions.OrderBy(query, input.Sorting);
+ }
+ var entities = await query.ToListAsync().ConfigureAwait(false);
+ var fileName = $"库存事务_{DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss")}.xlsx";
+ var content = this.GetContent(entities, "库存事务_");
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
return fileName;
}
///
- /// 库存事务查询
+ /// 补货数据导出
///
- ///
- ///
[HttpPost]
- public async Task> Log(LogRequestDto input)
+ public async Task ReplenishedExportAsync(RequestDto input)
{
- var query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda())
- .WhereIf(input.LogTypes?.Count != 0, o => input.LogTypes.Contains(o.LogType));
- var totalCount = await query.CountAsync().ConfigureAwait(false);
- query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
- var entities = query.Skip(input.SkipCount).Take(input.MaxResultCount).ToList();
- return new PagedResultDto(totalCount, entities);
- //return QueryLogFromTSDb(input);
+ IQueryable query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda());
+ query = query.Where(o => o.IsReplenished.HasValue && o.IsReplenished.Value == true);
+ if (!string.IsNullOrEmpty(input.Sorting))
+ {
+ query = DynamicQueryableExtensions.OrderBy(query, input.Sorting);
+ }
+ var entities = await query.ToListAsync().ConfigureAwait(false);
+ var fileName = $"补货数据_{DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss")}.xlsx";
+ var content = this.GetContent(entities, "补货数据_");
+ await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
+ return fileName;
}
private PagedResultDto QueryLogFromTSDb(RequestDto input)
@@ -547,7 +571,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
{
log.LogType = VmiLogType.Type600;
log.ChangedType = VmiType.Out;
- log.Qty=-log.Qty;
+ log.Qty = -log.Qty;
await this.Out(VmiLogType.Type600, null, log).ConfigureAwait(false);
}
}