diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/vmi-job.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/vmi-job.js new file mode 100644 index 00000000..5ca87a4a --- /dev/null +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/vmi-job.js @@ -0,0 +1,182 @@ +import { version } from "../_options.js"; + +const version2 = Object.assign({}, version); + +const year = { + title: "期间", + type: "string", + input: "select", + url: "settleaccount/centralized-control/get-all-year", + value: "year", + label: "year", + clearable: true, +}; + + +const defaultCompareSchema = { + title: "数据比对", + properties: { + version: Object.assign(year, { rules: [{ required: true }] }), + + + }, +}; + +const stateName = { + title: "状态", + type: "string", + input: "select", + clearable: true, + options: [ + { label: "执行完成(任务成功)", value: "Succeeded" }, + { label: "执行完成(任务失败)", value: "Failed" }, + { label: "执行中", value: "Processing" }, + { label: "等待执行", value: "Enqueued" }, + ], +}; + +const schema = { + title: "数据对比", + type: "object", + properties: { + type: { + title: "版本号", + type: "string", + }, + taskId: { + title: "单据流水号", + type: "string", + }, + email: { + title: "创建人", + type: "string", + }, + createdAt: { + title: "创建时间", + type: "DateTime", + }, + remark: { + title: "说明", + type: "string", + }, + stateName, + }, +}; + +const nameList = { + JisBBAC: "JisBBAC结算与发运数据对比", + JisHBPO: "JisHBPO结算与发运数据对比", + ZhiGongJianBBAC: "直供件BBAC结算与发运数据对比", + ZhiGongJianHBPO: "直供件HBPO结算与发运数据对比", + MaiDanJianBBAC: "买单件BBAC结算与发运数据对比", + MaiDanJianHBPO: "买单件HBPO结算与发运数据对比", + BeiJian: "备件结算与发运数据对比", + YinDuJian: "印度件结算与发运数据对比", +}; + +export default function (businessType, type) { + let compareService = "report/get-balance-sum"; + let title = null; + let name = "生成库存余额"; + const compareSchema = Object.assign({}, defaultCompareSchema); + if (type === "fa-yun") { + delete compareSchema.properties["downLineDateTime"]; + if (businessType === "JisBBAC") { + compareService = "compare/edi-se-compare"; + name = "JisBBACEDI与发运数据对比"; + } else if (businessType === "JisHBPO") { + compareService = "compare/edi-se-compare"; + name = "JisHBPOEDI与发运数据对比"; + } + } else { + // if (businessType === "JisBBAC") { + // compareService = "compare/sa-se-compare"; + // } else if (businessType === "JisHBPO") { + // compareService = "compare/sa-se-compare"; + // } else { + // compareService = "compare/sa-se-compare"; + // } + // name = nameList[businessType]; + } + + const queryUrl = "settleaccount/Job/list"; + const deleteUrl = "settleaccount/Job/delete"; + const compareUrl = `settleaccount/${compareService}`; + const queryMethod = "POST"; + const deleteMethod = "POST"; + const compareMethod = "POST"; + + return { + title, + name, + query: { + url: queryUrl, + method: queryMethod, + autoSubmit: true, + disableQueryOnLoad: false, + schema: { + title: "数据对比", + type: "object", + properties: { + type: Object.assign({ defaultSelected: false }, year), + name: { + type: "string", + hidden: true, + default: name, + }, + businessType: { + type: "string", + hidden: true, + }, + filters: { + type: "array", + hidden: true, + items: { + type: "object", + properties: { + logic: { + type: "int", + }, + column: { + type: "string", + }, + action: { + type: "int", + }, + value: { + type: "string", + }, + }, + }, + default: [], + }, + skipCount: { + hidden: true, + default: 0, + }, + maxResultCount: { + hidden: true, + default: 10, + }, + sorting: { + hidden: true, + default: "createdAt", + }, + }, + }, + }, + table: { + schema: schema, + }, + edit: { + deleteUrl, + compareUrl, + deleteMethod, + compareMethod, + schema: schema, + }, + compare: { + schema: compareSchema, + }, + }; +} diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance-sum.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance-sum.js new file mode 100644 index 00000000..af9d4eeb --- /dev/null +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance-sum.js @@ -0,0 +1,109 @@ +import useVmi from "./vmi.js"; + +const schema = useVmi(); + +const baseUrl = "settleaccount/vmi"; +const queryUrl = `${baseUrl}/balance`; +const detailsUrl = `${baseUrl}/get/%s`; +const createUrl = `${baseUrl}/create`; +const updateUrl = `${baseUrl}/update/%s`; +const deleteUrl = `${baseUrl}/delete-list`; +const importUrl = `${baseUrl}/code-setting-upload-excel-import`; +const exportUrl = `${baseUrl}/balance-export`; +const queryMethod = "POST"; +const detailsMethod = "POST"; +const createMethod = "POST"; +const updateMethod = "POST"; +const deleteMethod = "POST"; +const importMethod = "POST"; +const exportMethod = "POST"; + +export default function () { + return { + query: { + url: queryUrl, + method: queryMethod, + hasFilter: true, + schema: { + title: "寄售库存", + type: "object", + properties: { + filters: { + title: "项目", + type: "array", + hidden: true, + items: { + type: "object", + properties: { + logic: { + type: "int", + }, + column: { + type: "string", + }, + action: { + type: "int", + }, + value: { + type: "string", + }, + }, + }, + default: [ + { + logic: "and", + column: "erpToLoc", + action: "like", + value: null, + readOnly: true, + }, + { + logic: "and", + column: "realPartCode", + action: "like", + value: null, + readOnly: true, + }, + { + logic: "and", + column: "vinCode", + action: "like", + value: null, + readOnly: true, + }, + ], + }, + skipCount: { + hidden: true, + default: 0, + }, + maxResultCount: { + hidden: true, + default: 10, + }, + sorting: { + hidden: true, + }, + }, + }, + }, + table: { + schema: schema, + }, + edit: { + detailsUrl, + createUrl, + updateUrl, + deleteUrl, + importUrl, + exportUrl, + detailsMethod, + createMethod, + updateMethod, + deleteMethod, + importMethod, + exportMethod, + schema: 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 86c4c0ee..be9e0b7f 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 @@ -50,6 +50,19 @@ function createCompareFaYun(path, business, client, title = "EDI与发运对比" }; } +function createCompareVmi(path, business, client, title = "库存余额任务") { + return { + ...createPage(path, `title=${title}&businessType=${business}&client=${client}`), + component: "/compare/vmi", + children: [ + createButton("query", "title=查询&isTop=true"), + createButton("compare", "title=生成数据&isTop=true"), + createButton("delete", "title=删除&isTop=true"), + createButton("export", "title=下载&pattern=file&disabled=o=>o.stateName!='Succeeded'"), + ], + }; +} + function createCompareJieSuan(path, business, client, title = "EDI、发运与结算比对") { return { ...createPage(path, `title=${title}&businessType=${business}&client=${client}`), @@ -414,6 +427,25 @@ export default [ ...createPage("balance", "title=库存余额查询"), children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], }, + // { + // ...createPage("balance-sum", "title=库存余额报表查询"), + // children: + // [ + // createButton("query", "title=查询&isTop=true"), + // createButton("compare", "title=生成比对&isTop=true"), + // createButton("delete", "title=删除&isTop=true"), + // createButton("export", "title=下载&pattern=file&disabled=o=>o.stateName!='Succeeded'"), + + + // ], + // }, + { + ...createRoute("contrast", "title=库存任务"), + children: [ + createCompareVmi("bbac_sa_detail_jobservice", "Vmi", "bbac", "库存余额任务"), + + ], + }, { ...createPage("sum", "title=库存余额汇总"), children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/vmi-job.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/vmi-job.js new file mode 100644 index 00000000..d0f95b2f --- /dev/null +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/vmi-job.js @@ -0,0 +1,75 @@ +import AppList from "../../components/list/index.js"; +import AppForm from "../../components/form/index.js"; +import html from "html"; +import { useRoute } from "vue-router"; +import useConfig from "../../models/compare/vmi-job.js"; +import { ref, onMounted, onUnmounted } from "vue"; +import { schemaToModel } from "../../utils/index.js"; +import request from "../../request/index.js"; + +export default function (type) { + return { + components: { AppList, AppForm }, + template: html` + + + + + + + `, + styles: html``, + setup() { + const route = useRoute(); + const businessType = route.meta.businessType; + const dialogVisable = ref(false); + const loading = ref(false); + const config = useConfig(businessType, type); + const schema = config.compare.schema; + const defaultModel = schemaToModel(schema); + const model = ref(null); + const formRef = ref(null); + const onCommand = async (item, rows) => { + console.log(item.path, item, rows); + if (item.path === "compare") { + model.value = Object.assign({}, defaultModel); + dialogVisable.value = true; + } + }; + const submit = async () => { + try { + const valid = await formRef.value.validate(); + if (valid) { + loading.value = true; + } + const url = config.edit.compareUrl; + const data = Object.assign(model.value); + + const result = await request(url, data, { method: "POST" }, true); + if (!result.errors) { + dialogVisable.value = false; + await load(); + } + } catch (error) { + console.log(error); + } finally { + loading.value = false; + } + }; + // + const appListRef = ref(null); + const event = "SaSeCompare"; + onMounted(() => PubSub.subscribe(event, async () => await appListRef.value.load())); + onUnmounted(() => PubSub.unsubscribe(event)); + return { config, onCommand, appListRef, dialogVisable, loading, schema, model, formRef, submit }; + }, + }; +} diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/vmi.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/vmi.js new file mode 100644 index 00000000..dba74e10 --- /dev/null +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/vmi.js @@ -0,0 +1,2 @@ +import useCompare from "./vmi-job.js"; +export default useCompare("fa-yun"); diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance-sum.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance-sum.js new file mode 100644 index 00000000..1b177f51 --- /dev/null +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance-sum.js @@ -0,0 +1,44 @@ +import AppList from "../../components/list/index.js"; +import html from "html"; +import { ref, onMounted, onUnmounted } from "vue"; +import { useRoute } from "vue-router"; +import { ElNotification } from "element-plus"; +import request from "../../request/index.js"; + +export default { + components: { AppList }, + template: html``, + setup() { + const config = ref(null); + const route = useRoute(); + const onCommand = async (item, rows) => { + console.log(item.path, item, rows); + }; + const showMessage = async (data) => { + await ElNotification.closeAll(); + ElNotification({ + position: "bottom-right", + title: "提示", + message: `待同步库存数量: ${data}`, + duration: 0, + }); + }; + const event = "VmiBalance"; + onMounted(async () => { + const model = "vmi/balance"; + const useConfig = (await import(`../../models/${model}.js`)).default; + config.value = useConfig(route.meta?.businessType, route.meta); + const result = await request("settleaccount/vmi-async-message/get-message-count", null, { method: "POST" }); + if (!result.errors) { + // showMessage(result.data); + } + PubSub.subscribe(event, async (_, data) => { + if (route.path === "/vmi/balance") { + // showMessage(data); + } + }); + }); + onUnmounted(() => PubSub.unsubscribe(event)); + return { config, onCommand }; + }, +}; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs index 5fa9fbe5..75eefd61 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Controls/CentralizedControlAppService.cs @@ -75,6 +75,22 @@ namespace Win.Sfs.SettleAccount.Entities.Controls return new ListResultDto(dtos); } + [HttpPost] + public async Task> GetAllYearAsync() + { + var entities = await _repository.GetAllAsync(true).ConfigureAwait(false); + var year_entities = entities.OrderBy(t => t.Year).ToList().Select(t=>t.Year).Distinct().ToList(); + List year_list=new List(); + foreach (var item in year_entities) + { + CentralizedControl year = new CentralizedControl(); + year.Year = item; + year_list.Add(year); + } + var dtos = ObjectMapper.Map, List>(year_list); + return new ListResultDto(dtos); + } + /// /// 获取列表 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Controls/CentralizedControl.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Controls/CentralizedControl.cs index 4a74b1e5..bc97e13e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Controls/CentralizedControl.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Controls/CentralizedControl.cs @@ -11,7 +11,7 @@ namespace Win.Sfs.SettleAccount.Entities.Controls /// ///年度 /// - public string Year { get; protected set; } + public string Year { get; set; } /// /// 期间