diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js index f1c3868f..01a11f72 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js @@ -104,8 +104,9 @@ export default { diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/commerce.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/commerce.js index 63b72cca..e3245b91 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/commerce.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/commerce.js @@ -1,4 +1,4 @@ -import businessType, { version, state2 } from "../_options.js"; +import businessType, { state2 } from "../_options.js"; const state = Object.assign({}, state2); state.input = "tabs"; @@ -65,7 +65,7 @@ export default function (businessType, type) { service = "invoice_service"; } const queryUrl = `settleaccount/${service}/main-query`; - const exportUrl = `settleaccount/invoice_service/export-detail`; + const exportUrl = `settleaccount/${service}/export-detail`; const invoiceUrl = `settleaccount/${service}/generate-invoice`; const receivedUrl = `settleaccount/${service}/received`; const rejectUrl = `settleaccount/${service}/reject`; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/finance.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/finance.js index ddb0d8f6..319a70f2 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/finance.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/finance.js @@ -1,3 +1,4 @@ +//财务审核 import version from "../version.js"; import { state2 } from "../state.js"; import businessType from "../businessType.js"; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/finance-detail.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/inventory.js similarity index 68% rename from code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/finance-detail.js rename to code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/inventory.js index 6c52f974..23b532a7 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/finance-detail.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/inventory.js @@ -1,3 +1,4 @@ +//库存扣减 import { version, state3 } from "../_options.js"; const schema = { @@ -7,8 +8,9 @@ const schema = { version, state: state3, billNum: { - title: "结算单号", + title: "发票号", type: "string", + link: true, }, settleBillNum: { title: "关联结算单号", @@ -17,6 +19,7 @@ const schema = { invGroupNum: { title: "发票分组号", type: "string", + link: true, }, site: { title: "地点", @@ -34,8 +37,17 @@ export default function (businessType) { } else { service = "p-uB_PD_SERVICE"; } - const queryUrl = `settleaccount/${service}/detail-query`; + + const queryUrl = `settleaccount/${service}/main-query`; + const detailUrl = `settleaccount/${service}/detail-query`; + const exportUrl = `settleaccount/${service}/export`; + const approvalUrl = `settleaccount/${service}/approval-passed`; + const rejectUrl = `settleaccount/${service}/reject`; const queryMethod = "POST"; + const detailMethod = "POST"; + const exportMethod = "POST"; + const approvalMethod = "POST"; + const rejectMethod = "POST"; return { query: { @@ -70,22 +82,29 @@ export default function (businessType) { default: [ { logic: "and", - action: "like", - column: "partCode", + column: "version", + action: "equal", + value: null, + readOnly: true, + }, + { + logic: "and", + column: "billNum", + action: "equal", value: null, readOnly: true, }, { logic: "and", - action: "like", - column: "pn", + column: "invGroupNum", + action: "equal", value: null, readOnly: true, }, { logic: "and", - action: "like", - column: "groupNum", + column: "invGroupNum", + action: "equal", value: null, readOnly: true, }, @@ -113,6 +132,14 @@ export default function (businessType) { schema: schema, }, edit: { + detailUrl, + detailMethod, + exportUrl, + exportMethod, + approvalUrl, + approvalMethod, + rejectUrl, + rejectMethod, schema: schema, }, }; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable.js index ea1a6079..d27d1a09 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable.js @@ -1,3 +1,4 @@ +//不可结算明细 import { version, state } from "../_options.js"; const schema = { diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/usable.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/usable.js index ea1a6079..de090448 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/usable.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/usable.js @@ -1,3 +1,4 @@ +//可计算单 import { version, state } from "../_options.js"; const schema = { diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js index 7db30121..205a5d15 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js @@ -95,7 +95,7 @@ function createCommerceCheckList(path, business, client, title = "商务审批") function createVmiOutCheckList(path, business, client, title = "寄售库库存扣减审批") { return { ...createPage(path, `title=${title}&businessType=${business}&client=${client}`), - component: "/settle/vmi", + component: "/settle/inventory", children: [ createButton("query", "title=查询&isTop=true"), createButton("compare", "title=扣减审核通过&isTop=true"), @@ -335,7 +335,7 @@ export default [ children: [ { ...createPage("finance", `title=财务审核`), - component: "/settle/vmi", + component: "/settle/finance", children: [ createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入开票文件&isTop=true"), diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/finance.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/finance.js new file mode 100644 index 00000000..52e77763 --- /dev/null +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/finance.js @@ -0,0 +1,59 @@ +import AppList from "../../components/list/index.js"; +import html from "html"; +import { useRoute } from "vue-router"; +import { ref } from "vue"; +import request, { getUrl } from "../../request/index.js"; +import useConfig from "../../models/settle/commerce.js"; +import AppCheck from "./_check.js"; + +export default { + components: { AppList, AppCheck }, + template: html` `, + setup() { + const appListRef = ref(null); + const visable = ref(false); + const data = ref(null); + const route = useRoute(); + const businessType = route.meta.businessType; + const config = useConfig(businessType, "cai-wu"); + const onCommand = async (item, rows) => { + if (item.path === "approval" || item.path === "reject" || item.path === "receive") { + if (rows.length > 0) { + const message = + item.path === "approval" + ? `确认审核通过选中的${rows.length}行数据吗?` + : item.path === "reject" + ? `确认退回选中的${rows.length}行数据吗?` + : `确认选中的${rows.length}行数据客户已收票吗?`; + const data = item.path === "approval" ? rows.map((o) => o.invbillNum) : item.path === "reject" ? rows[0]["invGroupNum"] : rows.map((o) => o.invbillNum); + const url = item.path === "approval" ? config.edit.invoiceUrl : item.path === "reject" ? config.edit.rejectUrl : config.edit.receivedUrl; + await appListRef.value.onClick(async () => await request(url, data, { method: "POST" }), message, true); + } + } else if (item.path === "export-group") { + const url = config.edit.exportUrl; + const method = config.edit.exportMethod; + const postData = { + filters: [ + { + logic: "and", + column: "invGroupNum", + action: "equal", + value: rows[0]["invGroupNum"], + }, + ], + }; + await appListRef.value.onClick(async () => { + const response = await request(url, postData, { method }, true); + if (!response.errors) { + window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); + } + }); + } else if (item.path === "invbillNum" || item.path === "invGroupNum") { + data.value = { [item.path]: rows[0][item.path] }; + visable.value = true; + } + console.log(item.path, item, rows); + }; + return { appListRef, config, onCommand, visable, data, businessType }; + }, +}; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/inventory.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/inventory.js new file mode 100644 index 00000000..85e3d300 --- /dev/null +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/inventory.js @@ -0,0 +1,60 @@ +import AppList from "../../components/list/index.js"; +import html from "html"; +import { useRoute } from "vue-router"; +import { ref } from "vue"; +import request, { getUrl } from "../../request/index.js"; +import useConfig from "../../models/settle/inventory.js"; +import AppCheck from "./_check.js"; + +export default { + components: { AppList, AppCheck }, + template: html` + `, + setup() { + const appListRef = ref(null); + const visable = ref(false); + const data = ref(null); + const route = useRoute(); + const businessType = route.meta.businessType; + const config = useConfig(businessType, "shang-wu"); + const onCommand = async (item, rows) => { + if (item.path === "approval" || item.path === "reject" || item.path === "receive") { + if (rows.length > 0) { + const message = + item.path === "approval" + ? `确认审核通过选中的${rows.length}行数据吗?` + : item.path === "reject" + ? `确认退回选中的${rows.length}行数据吗?` + : `确认选中的${rows.length}行数据客户已收票吗?`; + const data = item.path === "approval" ? rows.map((o) => o.invbillNum) : item.path === "reject" ? rows[0]["invGroupNum"] : rows.map((o) => o.invbillNum); + const url = item.path === "approval" ? config.edit.invoiceUrl : item.path === "reject" ? config.edit.rejectUrl : config.edit.receivedUrl; + await appListRef.value.onClick(async () => await request(url, data, { method: "POST" }), message, true); + } + } else if (item.path === "export-group") { + const url = config.edit.exportUrl; + const method = config.edit.exportMethod; + const postData = { + filters: [ + { + logic: "and", + column: "invGroupNum", + action: "equal", + value: rows[0]["invGroupNum"], + }, + ], + }; + await appListRef.value.onClick(async () => { + const response = await request(url, postData, { method }, true); + if (!response.errors) { + window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); + } + }); + } else if (item.path === "invbillNum" || item.path === "invGroupNum") { + data.value = { [item.path]: rows[0][item.path] }; + visable.value = true; + } + console.log(item.path, item, rows); + }; + return { appListRef, config, onCommand, visable, data, businessType }; + }, +}; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/vmi.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/vmi.js index f1d4d26b..89591b65 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/vmi.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/vmi.js @@ -2,22 +2,59 @@ import AppList from "../../components/list/index.js"; import html from "html"; import { useRoute } from "vue-router"; import { ref } from "vue"; -import useConfig from "../../models/settle/commerce.js"; +import request, { getUrl } from "../../request/index.js"; +import useConfig from "../../models/settle/inventory.js/index.js"; import AppCheck from "./_check.js"; export default { components: { AppList, AppCheck }, - template: html` `, + template: html` + `, setup() { const appListRef = ref(null); const visable = ref(false); const data = ref(null); const route = useRoute(); const businessType = route.meta.businessType; - const config = useConfig(businessType, "cai-wu"); + const config = useConfig(businessType, "shang-wu"); const onCommand = async (item, rows) => { + if (item.path === "approval" || item.path === "reject" || item.path === "receive") { + if (rows.length > 0) { + const message = + item.path === "approval" + ? `确认审核通过选中的${rows.length}行数据吗?` + : item.path === "reject" + ? `确认退回选中的${rows.length}行数据吗?` + : `确认选中的${rows.length}行数据客户已收票吗?`; + const data = item.path === "approval" ? rows.map((o) => o.invbillNum) : item.path === "reject" ? rows[0]["invGroupNum"] : rows.map((o) => o.invbillNum); + const url = item.path === "approval" ? config.edit.invoiceUrl : item.path === "reject" ? config.edit.rejectUrl : config.edit.receivedUrl; + await appListRef.value.onClick(async () => await request(url, data, { method: "POST" }), message, true); + } + } else if (item.path === "export-group") { + const url = config.edit.exportUrl; + const method = config.edit.exportMethod; + const postData = { + filters: [ + { + logic: "and", + column: "invGroupNum", + action: "equal", + value: rows[0]["invGroupNum"], + }, + ], + }; + await appListRef.value.onClick(async () => { + const response = await request(url, postData, { method }, true); + if (!response.errors) { + window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); + } + }); + } else if (item.path === "invbillNum" || item.path === "invGroupNum") { + data.value = { [item.path]: rows[0][item.path] }; + visable.value = true; + } console.log(item.path, item, rows); }; - return { appListRef, config, onCommand, visable, data }; + return { appListRef, config, onCommand, visable, data, businessType }; }, }; 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 4b90e222..0a05c2c7 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 @@ -25,6 +25,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.OpenApi.Extensions; using Omu.ValueInjecter; using Polly; +using RestSharp.Extensions; using SettleAccount.Job.SignalR; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; @@ -708,13 +709,12 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien { using var scope = _serviceProvider.CreateScope(); var db = scope.ServiceProvider.GetRequiredService(); - var query = db.Set().AsQueryable(); - using var dc = db.CreateLinqToDBConnection(); - dc.BeginTransaction(); + using var transaction = db.Database.BeginTransaction(); try { + var messages = db.Set().Where(o => !o.isConsumed).OrderBy(o => o.Number).ToList(); var repo = db.Set(); - foreach (var message in query) + foreach (var message in messages) { var log = JsonSerializer.Deserialize(message.Message); var balance = db.Set().FirstOrDefault( @@ -736,7 +736,8 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien else { var logType = log.LogType; - var qty = balance.Qty + log.Qty; + + var qty = balance.Qty;// + log.ty if (logType == VmiLogType.Type100) { //发运入库,负库存字段需要更新 @@ -773,12 +774,12 @@ public class VmiAsyncBalanceService : ApplicationService, IJobService, ITransien } message.isConsumed = true; } - dc.Transaction.Commit(); + transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); - dc.Transaction.Rollback(); + transaction.Rollback(); throw; } }