diff --git a/code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs b/code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs index 7259ac48..1a7e110a 100644 --- a/code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs +++ b/code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs @@ -11,7 +11,7 @@ using Volo.Abp.Identity; namespace BaseService.UserManagement { [Route("api/[controller]/[action]")] - [Authorize(IdentityPermissions.Roles.Default)] + //[Authorize(IdentityPermissions.Roles.Default)] public class RoleAppService : ApplicationService { private IdentityRoleManager _roleManager { get; } diff --git a/code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs b/code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs index 80cae7fb..30621f88 100644 --- a/code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs +++ b/code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs @@ -25,7 +25,7 @@ using IdentityUser = Volo.Abp.Identity.IdentityUser; namespace BaseService.Systems.UserManagement { [Route("api/base/user")] - [Authorize(IdentityPermissions.Users.Default)] + //[Authorize(IdentityPermissions.Users.Default)] public class UserAppService : ApplicationService, IUserAppService { protected IdentityUserManager UserManager { get; } diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json index 28279f84..b3fef962 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json @@ -70,7 +70,7 @@ "AuthServer": { - "Authority": "http://dev.ccwin-in.com:10582", + "Authority": "http://dev.ccwin-in.com:16082", "ClientId": "basic-web", "ClientSecret": "1q2w3e*" }, diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/start.cmd b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/start.cmd index 4171afe4..7ad8f0f8 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/start.cmd +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/start.cmd @@ -8,4 +8,4 @@ if %errorlevel% == 0 ( %1 start mshta vbscript:createobject("wscript.shell").run("""%~0"" ::",0)(window.close)&&exit -start /b SettleAccount.HttpApi.Host.exe --urls http://*:10582 +start /b SettleAccount.HttpApi.Host.exe --urls http://*:16082 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 edad5ec0..a22d2345 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 @@ -419,13 +419,9 @@ export default { } else { result = method(); } - if (!result.errors) { - if (!result.data?.code || result.data.code === 200) { - if (reload) { - pageModel.pageIndex = 1; - await load(); - } - } + if (!result.errors && reload) { + pageModel.pageIndex = 1; + await load(); } } catch (error) { if (error === "cancel") { @@ -552,7 +548,7 @@ export default { { method: config.edit.deleteMethod }, true ); - if (!result.data?.code || result.data.code === 200) { + if (!result.errors) { pageModel.pageIndex = 1; await reload(); } @@ -690,7 +686,7 @@ export default { } }); const result = await request(url, formData); - if (result.data?.code === 200) { + if (!result.errors) { editFormloading.value = false; dialogVisible.value = false; await load(); diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/compare.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/compare.js index b1f5b46c..a5bfe2ef 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/compare.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/compare.js @@ -92,19 +92,19 @@ export default function (businessType, type) { if (type === "fa-yun") { delete compareSchema.properties["downLineDateTime"]; if (businessType === "JisBBAC") { - compareService = "edi-se-compare/bbacedi-se-compare"; + compareService = "compare/edi-se-compare"; name = "JisBBACEDI与发运数据对比"; } else if (businessType === "JisHBPO") { - compareService = "edi-se-compare/hbpoedi-se-compare"; + compareService = "compare/edi-se-compare"; name = "JisHBPOEDI与发运数据对比"; } } else { if (businessType === "JisBBAC") { - compareService = "edi-se-compare/bbacedi-se-compare"; + compareService = "compare/sa-se-compare"; } else if (businessType === "JisHBPO") { - compareService = "edi-se-compare/hbpoedi-se-compare"; + compareService = "compare/sa-se-compare"; } else { - compareService = "pub_sa_detail_service/pub-sa-se-compare"; + compareService = "compare/sa-se-compare"; } name = nameList[businessType]; } 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 3da777b9..aabcded8 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 @@ -71,6 +71,7 @@ export default function (businessType, type) { const rejectUrl = `settleaccount/${service}/reject`; const reissueUrl = `settleaccount/${service}/reissue-invoice`; const approvalUrl = `settleaccount/${service}/approval-passed`; + const importUrl = `settleaccount/${service}/excel-import`; const queryMethod = "POST"; const exportMethod = "POST"; const invoiceMethod = "POST"; @@ -78,6 +79,7 @@ export default function (businessType, type) { const rejectMethod = "POST"; const reissueMethod = "POST"; const approvalMethod = "POST"; + const importMethod = "POST"; return { query: { url: queryUrl, @@ -153,12 +155,14 @@ export default function (businessType, type) { rejectUrl, reissueUrl, approvalUrl, + importUrl, exportMethod, invoiceMethod, receivedMethod, rejectMethod, reissueMethod, approvalMethod, + importMethod, schema: schema, }, }; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js index 5f926fe2..b57c8145 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js @@ -72,7 +72,7 @@ export default function (businessType, type) { if (type === "unable") { if (businessType === "JisBBAC") { service = "bbac_not_sa_service"; - } else if (businessType === "JisHBPO") { + } else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") { service = "hbpo_not_sa_service"; } else { service = "pub_not_sa_service"; 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-bk.js similarity index 96% rename from code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable.js rename to code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable-bk.js index d27d1a09..ee817361 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-bk.js @@ -28,7 +28,7 @@ export default function (businessType) { let service; if (businessType === "JisBBAC") { service = "bbac_can_sa_service"; - } else if (businessType === "JisHBPO") { + } else if (businessType === "JisHBPO" || businessType === "MaiDanJianHBPO") { service = "hbpo_can_sa_service"; } else { service = "pub_can_sa_service"; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js index 66603861..659cd3a5 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js @@ -58,10 +58,10 @@ export default [ ...createPage("bei-jian", "title=备件价格单"), children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], }, - { - ...createPage("cai-gou", "title=采购价格单"), - children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], - }, + // { + // ...createPage("cai-gou", "title=采购价格单"), + // children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], + // }, { ...createPage("xiao-shou", "title=销售价格单"), children: [createButton("query", "title=查询&isTop=true"), createButton("import", "title=导入&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")], 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 b6b0be71..eb518a93 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 @@ -12,7 +12,7 @@ function createInputJieSuanShuju(path, business, client, title = "结算数据") //createButton("delete", "title=删除&isTop=true"), ], }; - if (business !== "MaiDanJianBBAC" && business !== "MaiDanJianHBPO") { + if (business !== "MaiDanJianBBAC") { routes.children.push(createButton("import", "title=导入&isTop=true")); routes.children.push(createButton("delete", "title=删除&isTop=true")); } @@ -194,8 +194,8 @@ export default [ children: [ createUsableSettleList("hbpo_can_sa_service", "JisHBPO", "hbpo", "JIS-HBPO 可结算单"), createUnableSettleList("hbpo_not_sa_service", "JisHBPO", "hbpo", "JIS-HBPO 不可结算明细"), - createCommerceCheckList("hbpo_ba_service", "JisBBAC", "bbac", "JIS-HBPO 商务审批"), - createVmiOutCheckList("hbpo_pd_service", "JisBBAC", "bbac", "JIS-HBPO 寄售库库存扣减审批"), + createCommerceCheckList("hbpo_ba_service", "JisHBPO", "hbpo", "JIS-HBPO 商务审批"), + createVmiOutCheckList("hbpo_pd_service", "JisHBPO", "hbpo", "JIS-HBPO 寄售库库存扣减审批"), ], }, ], diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js index 44cbc3d3..01f071f4 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js @@ -86,6 +86,10 @@ const refreshRouter = async () => { const appStore = useAppStore(); const permissions = appStore.user.permissions; const serverRoutes = Object.assign([], remoteRoutes); + if (appStore.user.roles.some((o) => o === "物流")) { + const baseDataRoutes = serverRoutes.find((o) => o.path === "base-data"); + baseDataRoutes.children = baseDataRoutes.children.filter((o) => o.path !== "bei-jian" && o.path !== "xiao-shou"); + } const setPermission = (list, parent = null) => { list.forEach((o) => { // full path diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/styles/site.css b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/styles/site.css index cd348c82..9f4fb1bc 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/styles/site.css +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/styles/site.css @@ -133,3 +133,41 @@ a.logo { box-sizing: border-box; margin: 0 auto; } + +/*RongGuo Jia*/ + +.el-main { + height: calc(100% - 40px); + overflow: auto; +} +.el-footer { + display: none; +} +.el-aside *, +.el-header { + background-color: #141414; + color: #e5eaf3; +} +.el-aside *:hover, +.el-header *:hover { + background-color: #292218; +} + +.el-aside .el-menu-item.is-active * { + color: #409eff; +} + +.el-aside .el-scrollbar__thumb { + background-color: #e5eaf3 !important; + opacity: 0.5 !important; +} +.el-aside el-scrollbar__thumb:hover { + background-color: #e5eaf3 !important; +} + +.el-header { + border-bottom-color: #4c4d4f; +} +.el-header .el-icon { + color: #e5eaf3 !important; +} diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/_compare.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/_compare.js index d1038544..117e6928 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/_compare.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/_compare.js @@ -64,10 +64,8 @@ export default function (type) { delete data["downLineDateTime"]; const result = await request(url, data, { method: "POST" }, true); if (!result.errors) { - if (!result.data?.code || result.data.code === 200) { - dialogVisable.value = false; - await load(); - } + dialogVisable.value = false; + await load(); } } catch (error) { console.log(error); diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js index d2a3c757..f1a10dd8 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js @@ -43,7 +43,7 @@ export default { 返回 - 重开发票号 + 报废重开 @@ -530,29 +530,27 @@ export default { //发到服务的校验 const result = await request(`settleaccount/adj_service/check-import`, adjList.value, { method: "POST" }); if (!result.errors) { - if (result.data?.code === 200) { - adjList.value = result.data.data; - setupRef.value += 1; - //处理高亮 - nextTick(() => { - const list1 = setup2table1Ref.value.tableRef.querySelectorAll(".row.data"); - const list2 = setup2table2Ref.value.tableRef.querySelectorAll(".row.data"); - list1.forEach((o) => { - addDiff(o, list2, ".qty"); - addDiff(o, list2, ".amt"); - }); - list2.forEach((o) => { - addDiff(o, list1, ".qty"); - addDiff(o, list1, ".amt"); - }); + adjList.value = result.data.data; + setupRef.value += 1; + //处理高亮 + nextTick(() => { + const list1 = setup2table1Ref.value.tableRef.querySelectorAll(".row.data"); + const list2 = setup2table2Ref.value.tableRef.querySelectorAll(".row.data"); + list1.forEach((o) => { + addDiff(o, list2, ".qty"); + addDiff(o, list2, ".amt"); }); - } else if (result.data?.code === 400) { - ElMessage({ - type: "error", - message: "操作失败", + list2.forEach((o) => { + addDiff(o, list1, ".qty"); + addDiff(o, list1, ".amt"); }); - window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); - } + }); + } else if (result.data?.code === 400) { + ElMessage({ + type: "error", + message: "操作失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); } } catch (e) { console.log(e); @@ -569,31 +567,27 @@ export default { const url = `settleaccount/${service}}/reissue-invoice-list`; const result = await request(url, adjList.value, { method: "POST" }); if (!result.errors) { - if (result.data?.code === 200) { - //setup3的数据来源 - setup3Model.value = result.data.data; - setupRef.value += 1; - } else if (result.data?.code === 400 && result.data.fileName) { - ElMessage({ - type: "error", - message: "操作失败", - }); - window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); - } + //setup3的数据来源 + setup3Model.value = result.data.data; + setupRef.value += 1; + } else if (result.data?.code === 400 && result.data.fileName) { + ElMessage({ + type: "error", + message: "操作失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); } } else if (setupRef.value === 3) { const url = `settleaccount/${service}}/reissue-invoice-extend`; const result = await request(url, adjList.value, { method: "POST" }); if (!result.errors) { - if (result.data?.code === 200) { - setupRef.value += 1; - } else if (result.data?.code === 400 && result.data.fileName) { - ElMessage({ - type: "error", - message: "操作失败", - }); - window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); - } + setupRef.value += 1; + } else if (result.data?.code === 400 && result.data.fileName) { + ElMessage({ + type: "error", + message: "操作失败", + }); + window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`)); } } else { setupDialogVisable.value = false; diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js index 837f4b34..f078dddf 100644 --- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js +++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js @@ -1,2 +1,35 @@ -import useList from "../_list.js"; -export default useList("vmi/balance"); +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"; + +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 event = "VmiBalance"; + onMounted(async () => { + const model = "vmi/balance"; + const useConfig = (await import(`../../models/${model}.js`)).default; + config.value = useConfig(route.meta?.businessType, route.meta); + let notify = null; + PubSub.subscribe(event, async (_, data) => { + notify?.close(); + notify = ElNotification({ + position: "bottom-right", + title: "待同步库存数量", + message: data, + duration: 0, + }); + }); + }); + onUnmounted(() => PubSub.unsubscribe(event)); + return { config, onCommand }; + }, +}; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/EdiSeCompareRequestDto.cs similarity index 71% rename from code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs rename to code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/EdiSeCompareRequestDto.cs index 1cb05b5a..dd93d5f1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/EdiSeCompareRequestDto.cs @@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos; /// -/// Jis结算与发运对比请求Dto +/// Edi与发运对比请求Dto /// -public class JisEdiSeCompareRequestDto +public class EdiSeCompareRequestDto { /// /// 期间 @@ -35,13 +35,7 @@ public class JisEdiSeCompareRequestDto [Display(Name = "发运结束时间")] public DateTime? SeEndDateTime { get; set; } /// - /// 下线开始时间 + /// 业务类型 /// - [Display(Name = "下线开始时间")] - public DateTime? DownLineStartDateTime { get; set; } - /// - /// 下线结束时间 - /// - [Display(Name = "下线结束时间")] - public DateTime? DownLineEndDateTime { get; set; } + public EnumBusinessType BusinessType { get; set; } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisSaSeCompareRequestDto.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/SaSeCompareRequestDto.cs similarity index 86% rename from code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisSaSeCompareRequestDto.cs rename to code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/SaSeCompareRequestDto.cs index a569d3f8..0636012c 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisSaSeCompareRequestDto.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/SaSeCompareRequestDto.cs @@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations; namespace Win.Sfs.SettleAccount.Entities.BQ; /// -/// Jis结算与发运对比请求Dto +/// 结算与发运对比请求Dto /// -public class JisSaSeCompareRequestDto +public class SaSeCompareRequestDto { /// /// 期间 @@ -44,4 +44,8 @@ public class JisSaSeCompareRequestDto /// [Display(Name = "下线结束时间")] public DateTime? DownLineEndDateTime { get; set; } + /// + /// 业务类型 + /// + public EnumBusinessType BusinessType { get; set; } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs index b6a0bb3e..af0c9647 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs @@ -11,7 +11,6 @@ using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; -using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.RepositoryBase; @@ -30,16 +29,10 @@ public class BBAC_SA_DETAIL_SERVICE : SettleAccountApplicationBase private readonly INormalEfCoreRepository _bbacSaDetailRepository; - /// - /// 任务服务 - /// - private readonly TaskJobService _taskJobService; - /// /// 构造 /// public BBAC_SA_DETAIL_SERVICE(INormalEfCoreRepository bbacSaDetailRepository, - TaskJobService taskJobService, IDistributedCache cache, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, @@ -47,7 +40,6 @@ public class BBAC_SA_DETAIL_SERVICE : SettleAccountApplicationBase(totalCount, dtos); } #endregion - - #region 对比 - /// - /// BBAC结算与发运比对 - /// - [HttpPost] - public async Task BBACSaSeCompare(JisSaSeCompareRequestDto jisSaSeCompareRequestDto) - { - await Task.CompletedTask; - throw new NotImplementedException(); - } - #endregion } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs new file mode 100644 index 00000000..c0b887a3 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.OpenApi.Extensions; +using SettleAccount.Job.Services.Report; +using TaskJob.EventArgs; +using Volo.Abp; +using Volo.Abp.Application.Services; +using Win.Sfs.SettleAccount.Entities.BQ.Dtos; +using Win.Sfs.SettleAccount.Entities.TaskJobs; + +namespace Win.Sfs.SettleAccount.Entities.BQ; + +/// +/// 对比服务 +/// +[AllowAnonymous] +[Route("api/settleaccount/[controller]/[action]")] +public class CompareService : ApplicationService +{ + /// + /// 任务服务 + /// + private readonly TaskJobService _taskJobService; + + public CompareService(TaskJobService taskJobService) + { + _taskJobService = taskJobService; + } + + #region Edi与发运比对 + /// + /// Edi与发运比对 + /// + [HttpPost] + public async Task EdiSeCompare(EdiSeCompareRequestDto ediSeCompareRequestDto) + { + var businessTypeDisplayName = ediSeCompareRequestDto.BusinessType.ToString(); + var attributeOfType = ediSeCompareRequestDto.BusinessType.GetAttributeOfType(); + if (attributeOfType != null) + { + businessTypeDisplayName = attributeOfType.Name; + } + var projectName = $"{businessTypeDisplayName}EDI与发运数据对比"; + + var customConditionList = new List(); + customConditionList.Add(new CustomCondition() { Name = "Version", Value = ediSeCompareRequestDto.Version }); + customConditionList.Add(new CustomCondition() { Name = "LU", Value = ediSeCompareRequestDto.LU }); + customConditionList.Add(new CustomCondition() { Name = "PN", Value = ediSeCompareRequestDto.PN }); + customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); + customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = ediSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") }); + customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = ediSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") }); + + var jobMoudle = ediSeCompareRequestDto.BusinessType switch + { + EnumBusinessType.JisBBAC => typeof(JisBBACEdiSeCompareExportService), + EnumBusinessType.JisHBPO => typeof(JisHBPOEdiSeCompareExportService), + _ => throw new UserFriendlyException($"{nameof(ediSeCompareRequestDto.BusinessType)}参数值无效", "403") + }; + + var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, ediSeCompareRequestDto.Version, string.Empty, CurrentUser, jobMoudle, customConditionList, (rs) => + { + }).ConfigureAwait(false); + return _taskid; + } + #endregion + + #region 结算与发运比对 + /// + /// 结算与发运比对 + /// + [HttpPost] + public async Task SaSeCompare(SaSeCompareRequestDto saSeCompareRequestDto) + { + var businessTypeDisplayName = saSeCompareRequestDto.BusinessType.ToString(); + var attributeOfType = saSeCompareRequestDto.BusinessType.GetAttributeOfType(); + if (attributeOfType != null) + { + businessTypeDisplayName = attributeOfType.Name; + } + var projectName = $"{businessTypeDisplayName}结算与发运数据对比"; + + var customConditionList = new List(); + customConditionList.Add(new CustomCondition() { Name = "Version", Value = saSeCompareRequestDto.Version }); + customConditionList.Add(new CustomCondition() { Name = "LU", Value = saSeCompareRequestDto.LU }); + customConditionList.Add(new CustomCondition() { Name = "PN", Value = saSeCompareRequestDto.PN }); + customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); + customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = saSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") }); + customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = saSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") }); + + var jobMoudle = saSeCompareRequestDto.BusinessType switch + { + EnumBusinessType.ZhiGongJianBBAC => typeof(PubSaSeCompareExportService), + EnumBusinessType.ZhiGongJianHBPO => typeof(PubSaSeCompareExportService), + EnumBusinessType.MaiDanJianBBAC => typeof(MaiDanBBACSaSeCompareExportService), + EnumBusinessType.MaiDanJianHBPO => typeof(MaiDanHBPOSaSeCompareExportService), + EnumBusinessType.BeiJian => typeof(PubSaSeCompareExportService), + EnumBusinessType.YinDuJian => typeof(PubSaSeCompareExportService), + _ => throw new UserFriendlyException($"{nameof(saSeCompareRequestDto.BusinessType)}参数值无效", "403") + }; + + var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, saSeCompareRequestDto.Version, string.Empty, CurrentUser, jobMoudle, customConditionList, (rs) => + { + }).ConfigureAwait(false); + return _taskid; + } + #endregion +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs deleted file mode 100644 index 56bd21bb..00000000 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.OpenApi.Extensions; -using SettleAccount.Job.Services.Report; -using TaskJob.EventArgs; -using Volo.Abp.Application.Services; -using Win.Sfs.SettleAccount.Entities.BQ.Dtos; -using Win.Sfs.SettleAccount.Entities.TaskJobs; - -namespace Win.Sfs.SettleAccount.Entities.BQ; - -/// -/// Edi与发运对比服务 -/// -[AllowAnonymous] -[Route("api/settleaccount/[controller]/[action]")] -public class EdiSeCompareService : ApplicationService -{ - /// - /// 任务服务 - /// - private readonly TaskJobService _taskJobService; - - public EdiSeCompareService(TaskJobService taskJobService) - { - _taskJobService = taskJobService; - } - - #region 对比 - /// - /// BBACEdi与发运比对 - /// - [HttpPost] - public async Task BBACEdiSeCompare(JisEdiSeCompareRequestDto jisEdiSeCompareRequestDto) - { - var projectName = $"JisBBACEDI与发运数据对比"; - - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = jisEdiSeCompareRequestDto.Version }); - customConditionList.Add(new CustomCondition() { Name = "LU", Value = jisEdiSeCompareRequestDto.LU }); - customConditionList.Add(new CustomCondition() { Name = "PN", Value = jisEdiSeCompareRequestDto.PN }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); - customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = jisEdiSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") }); - customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = jisEdiSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") }); - - var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, jisEdiSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(JisBBACEdiSeCompareExportService), customConditionList, (rs) => - { - }).ConfigureAwait(false); - return _taskid; - } - - /// - /// HBPOEdi与发运比对 - /// - [HttpPost] - public async Task HBPOEdiSeCompare(JisEdiSeCompareRequestDto jisEdiSeCompareRequestDto) - { - var projectName = $"JisHBPOEDI与发运数据对比结算与发运数据对比"; - - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = jisEdiSeCompareRequestDto.Version }); - customConditionList.Add(new CustomCondition() { Name = "LU", Value = jisEdiSeCompareRequestDto.LU }); - customConditionList.Add(new CustomCondition() { Name = "PN", Value = jisEdiSeCompareRequestDto.PN }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); - customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = jisEdiSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") }); - customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = jisEdiSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") }); - - var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, jisEdiSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(JisHBPOEdiSeCompareExportService), customConditionList, (rs) => - { - }).ConfigureAwait(false); - return _taskid; - } - #endregion - -} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs index db0f01f7..4ae7f4d4 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs @@ -1,20 +1,16 @@ using System; using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; -using SettleAccount.Job.Services.Report; using Shouldly; -using TaskJob.EventArgs; using Volo.Abp.Application.Dtos; using Volo.Abp.Caching; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; -using Win.Sfs.SettleAccount.Entities.TaskJobs; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.RepositoryBase; @@ -33,16 +29,10 @@ public class HBPO_SA_DETAIL_SERVICE : SettleAccountApplicationBase private readonly INormalEfCoreRepository _hbpoSaDetailRepository; - /// - /// 任务服务 - /// - private readonly TaskJobService _taskJobService; - /// /// 构造 /// public HBPO_SA_DETAIL_SERVICE(INormalEfCoreRepository hbpoSaDetailRepository, - TaskJobService taskJobService, IDistributedCache cache, IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, @@ -50,7 +40,6 @@ public class HBPO_SA_DETAIL_SERVICE : SettleAccountApplicationBase(totalCount, dtos); } #endregion - - #region 对比 - /// - /// HBPO结算与发运比对 - /// - [HttpPost] - public async Task HBPOSaSeCompare(JisSaSeCompareRequestDto jisSaSeCompareRequestDto) - { - var projectName = $"JisHBPO结算与发运数据对比"; - - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = jisSaSeCompareRequestDto.Version }); - customConditionList.Add(new CustomCondition() { Name = "LU", Value = jisSaSeCompareRequestDto.LU }); - customConditionList.Add(new CustomCondition() { Name = "PN", Value = jisSaSeCompareRequestDto.PN }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); - customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = jisSaSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") }); - customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = jisSaSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") }); - - var _taskid = ""; - //var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, jisSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(JisHBPOSaSeCompareExportService), customConditionList, (rs) => - //{ - //}).ConfigureAwait(false); - return _taskid; - } - #endregion } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs index ede465f8..59ba3ea9 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs @@ -74,11 +74,6 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase /// private readonly INormalEfCoreRepository _tbRePartsRelationshipRepository; - /// - /// 业务类型 - /// - private readonly EnumBusinessType _businessType = EnumBusinessType.JisHBPO; - /// /// 构造 /// @@ -106,6 +101,10 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase _tbRePartsRelationshipRepository = tbRePartsRelationshipRepository; } + /// + /// 业务类型 + /// + public EnumBusinessType BusinessType { get; set; } /// /// 期间 /// @@ -123,9 +122,11 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase switch (hbpoSaImportRequestDto.BusinessType) { case EnumBusinessType.JisHBPO: + BusinessType = EnumBusinessType.JisHBPO; result = await ImportJisHBPOAsync(hbpoSaImportRequestDto.Files).ConfigureAwait(false); break; case EnumBusinessType.MaiDanJianHBPO: + BusinessType = EnumBusinessType.MaiDanJianHBPO; result = await ImportMaiDanJianHBPOAsync(hbpoSaImportRequestDto.Files).ConfigureAwait(false); break; default: @@ -142,8 +143,9 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase [HttpPost] public async Task> GetListAsync(RequestDto input) { - var entities = await _hbpoSaRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); - var totalCount = await _hbpoSaRepository.GetCountByFilterAsync(input.Filters); + input.Filters.RemoveAll(t => t.Column.ToLower() == "site"); + var entities = await _hbpoSaRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); + var totalCount = await _hbpoSaRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entities); return new PagedResultDto(totalCount, dtos); } @@ -288,7 +290,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase { BillNum = hbpoSaBillNum, State = "0", - BusinessType = _businessType, + BusinessType = BusinessType, Site = site, Version = Version }; @@ -301,7 +303,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase InvGroupNum = hbpoCanSaBillNum, SettleBillNum = hbpoSaBillNum, State = SettleBillState.未结状态, - BusinessType = _businessType, + BusinessType = BusinessType, Site = site, Version = Version }; @@ -327,7 +329,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase hbpoSaDetail.BillNum = hbpoSaBillNum; hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU; - hbpoSaDetail.BusinessType = _businessType; + hbpoSaDetail.BusinessType = BusinessType; }); //导入的零件号集合 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs index e73fa369..665a8644 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs @@ -7,9 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.OpenApi.Extensions; using SettleAccount.Domain.BQ; -using SettleAccount.Job.Services.Report; using Shouldly; -using TaskJob.EventArgs; using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Caching; @@ -113,36 +111,4 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase return new PagedResultDto(totalCount, dtos); } #endregion - - #region 对比 - /// - /// Pub结算与发运比对 - /// - [HttpPost] - public async Task PubSaSeCompare(PubSaSeCompareRequestDto pubSaSeCompareRequestDto) - { - var businessTypeDisplayName = pubSaSeCompareRequestDto.BusinessType.ToString(); - DisplayAttribute attributeOfType = pubSaSeCompareRequestDto.BusinessType.GetAttributeOfType(); - if (attributeOfType != null) - { - businessTypeDisplayName = attributeOfType.Name; - } - var projectName = $"{businessTypeDisplayName}结算与发运数据对比"; - - List customConditionList = new List(); - customConditionList.Add(new CustomCondition() { Name = "Version", Value = pubSaSeCompareRequestDto.Version }); - customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = ((int)pubSaSeCompareRequestDto.BusinessType).ToString() }); - customConditionList.Add(new CustomCondition() { Name = "LU", Value = pubSaSeCompareRequestDto.LU }); - customConditionList.Add(new CustomCondition() { Name = "PN", Value = pubSaSeCompareRequestDto.PN }); - customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); - customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = pubSaSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") }); - customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = pubSaSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") }); - - var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) => - { - Console.WriteLine("TaskJob 回调了"); - }); - return _taskid; - } - #endregion } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs index 5097acda..33eea91f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs @@ -153,8 +153,9 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase [HttpPost] public async Task> GetListAsync(PUB_SARequestDto input) { - var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); - var totalCount = await _repository.GetCountByFilterAsync(input.Filters); + input.Filters.RemoveAll(t => t.Column.ToLower() == "site"); + var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); + var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var dtos = ObjectMapper.Map, List>(entities); return new PagedResultDto(totalCount, dtos); } @@ -419,7 +420,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU; importPubSaDetail.Version = _version; importPubSaDetail.BusinessType = businessType; - importPubSaDetail.Site = "XX工厂"; + importPubSaDetail.Site = "工厂"; }); var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList(); if (businessType == EnumBusinessType.BeiJian) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs index 31cb3d8d..8fbaa835 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs @@ -63,10 +63,6 @@ namespace Win.Sfs.SettleAccount { Func accesor = key => { - if (key.Equals(typeof(PubSaSeCompareExportService).FullName)) - { - return implementationFactory.GetService(); - } if (key.Equals(typeof(JisBBACEdiSeCompareExportService).FullName)) { return implementationFactory.GetService(); @@ -75,6 +71,18 @@ namespace Win.Sfs.SettleAccount { return implementationFactory.GetService(); } + if (key.Equals(typeof(MaiDanBBACSaSeCompareExportService).FullName)) + { + return implementationFactory.GetService(); + } + if (key.Equals(typeof(MaiDanHBPOSaSeCompareExportService).FullName)) + { + return implementationFactory.GetService(); + } + if (key.Equals(typeof(PubSaSeCompareExportService).FullName)) + { + return implementationFactory.GetService(); + } if (key.Equals(typeof(PendingDeductionService).FullName)) { return implementationFactory.GetService(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs index d2d7e08b..535125ae 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs @@ -20,7 +20,7 @@ public class PubSaSeCompareDiff /// 发货日期 /// [Display(Name = "发货日期")] - public DateTime ShippingDate { get; set; } + public DateTime? ShippingDate { get; set; } /// /// 日顺序号 /// @@ -35,22 +35,22 @@ public class PubSaSeCompareDiff /// 结算数据中的过账日期 /// [Display(Name = "客户下线时间")] - public DateTime CustomerOfflineTime { get; set; } + public DateTime? CustomerOfflineTime { get; set; } /// /// 结算数量 /// [Display(Name = "结算数量")] - public decimal SAQty { get; set; } + public decimal? SAQty { get; set; } /// /// 发货数量 /// [Display(Name = "发货数量")] - public decimal SEQty { get; set; } + public decimal? SEQty { get; set; } /// /// 定价 /// [Display(Name = "定价")] - public decimal FixPrice { get; set; } + public decimal? FixPrice { get; set; } /// /// 生产号 /// @@ -128,14 +128,10 @@ public class PubSaSeCompareDetailExport /// /// PUB结算与发运对比明细 /// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExport2 +public interface IPubSaSeCompareDetailExport { /// /// 类别 - /// 有结算有发运 - /// 有结算无发运 - /// 无结算有发运 /// [Display(Name = "类别")] [ExporterHeader(DisplayName = "类别")] @@ -143,21 +139,101 @@ public class PubSaSeCompareDetailExport2 [ValueMapping("有结算无发运", 2)] [ValueMapping("无结算有发运", 3)] public EnumPubSaSeCompareCategory Category { get; set; } + /// + /// 零件描述 + /// + [Display(Name = "零件描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string PartCodeDesc { get; set; } + /// + /// 替换厂内零件号 + /// + [Display(Name = "替换厂内零件号")] + [ExporterHeader(DisplayName = "替换厂内零件号")] + public string ReplaceFactoryPartCode { get; set; } + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal SAQty { get; set; } + + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + [ExporterHeader(DisplayName = "WMS发货数量")] + public decimal SEQty { get; set; } +} + +/// +/// PUB结算与发运对比汇总 +/// +[ExcelExporter(MaxRowNumberOnASheet = 900000)] +public class PubSaSeCompareSumExport +{ + /// + /// 厂内物料号 + /// + [Display(Name = "厂内物料号")] + [ExporterHeader(DisplayName = "LU")] + public string FactoryPartCode { get; set; } + + /// + /// 物料描述 + /// + [Display(Name = "物料描述")] + [ExporterHeader(DisplayName = "物料描述")] + public string PartCodeDesc { get; set; } + + /// + /// 结算数量 + /// + [Display(Name = "结算数量")] + [ExporterHeader(DisplayName = "结算数量")] + public decimal SAQty { get; set; } + + /// + /// 发货数量 + /// + [Display(Name = "发货数量")] + [ExporterHeader(DisplayName = "WMS发货数量")] + public decimal SEQty { get; set; } + + /// + /// 差异数量 + /// + [ExporterHeader(DisplayName = "差异数量")] + public decimal DiffQty => SAQty - SEQty; +} +/// +/// 直供件BBAC结算与发运对比明细 +/// +[ExcelExporter(MaxRowNumberOnASheet = 900000)] +public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport +{ + /// + /// 类别 + /// + [Display(Name = "类别")] + [ExporterHeader(DisplayName = "类别")] + [ValueMapping("有结算有发运", 1)] + [ValueMapping("有结算无发运", 2)] + [ValueMapping("无结算有发运", 3)] + public EnumPubSaSeCompareCategory Category { get; set; } /// /// Wms发货单号 /// [Display(Name = "Wms发货单号")] [ExporterHeader(DisplayName = "交货单号")] public string WmsBillNum { get; set; } - /// /// 发货日期 /// [Display(Name = "发货日期")] [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime ShippingDate { get; set; } - + public DateTime? ShippingDate { get; set; } /// /// 生产码 /// @@ -193,7 +269,7 @@ public class PubSaSeCompareDetailExport2 /// [Display(Name = "客户下线时间")] [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime CustomerOfflineTime { get; set; } + public DateTime? CustomerOfflineTime { get; set; } /// /// 结算数量 @@ -201,6 +277,7 @@ public class PubSaSeCompareDetailExport2 [Display(Name = "结算数量")] [ExporterHeader(DisplayName = "结算数量")] public decimal SAQty { get; set; } + /// /// 发货数量 /// @@ -211,7 +288,7 @@ public class PubSaSeCompareDetailExport2 /// 差异数量 /// [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty { set; get; } + public decimal DiffQty => SAQty - SEQty; /// /// 匹配类型 /// @@ -225,19 +302,7 @@ public class PubSaSeCompareDetailExport2 /// [Display(Name = "定价")] [ExporterHeader(DisplayName = "定价")] - public decimal FixPrice { get; set; } - /// - /// 日顺序号 - /// - [Display(Name = "日顺序号")] - [ExporterHeader(DisplayName = "日顺序号")] - public string SeqNumber { get; set; } - /// - /// PJIS日顺序号 - /// - [Display(Name = "PJIS日顺序号")] - [ExporterHeader(DisplayName = "PJIS日顺序号")] - public string PJISSeqNumber { get; set; } + public decimal? FixPrice { get; set; } /// /// WMS目标库位 /// @@ -253,101 +318,13 @@ public class PubSaSeCompareDetailExport2 } /// -/// PUB结算与发运对比明细 -/// -public interface IPubSaSeCompareDetailExport -{ - /// - /// 类别 - /// 有结算有发运 - /// 有结算无发运 - /// 无结算有发运 - /// - [Display(Name = "类别")] - [ExporterHeader(DisplayName = "类别")] - [ValueMapping("有结算有发运", 1)] - [ValueMapping("有结算无发运", 2)] - [ValueMapping("无结算有发运", 3)] - public EnumPubSaSeCompareCategory Category { get; set; } - /// - /// 零件描述 - /// - [Display(Name = "零件描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - /// - /// 替换厂内零件号 - /// - [Display(Name = "替换厂内零件号")] - [ExporterHeader(DisplayName = "替换厂内零件号")] - public string ReplaceFactoryPartCode { get; set; } - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } -} - -/// -/// PUB结算与发运对比汇总 -/// -[ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareSumExport -{ - /// - /// 厂内物料号 - /// - [Display(Name = "厂内物料号")] - [ExporterHeader(DisplayName = "LU")] - public string FactoryPartCode { get; set; } - - /// - /// 物料描述 - /// - [Display(Name = "物料描述")] - [ExporterHeader(DisplayName = "物料描述")] - public string PartCodeDesc { get; set; } - - /// - /// 结算数量 - /// - [Display(Name = "结算数量")] - [ExporterHeader(DisplayName = "结算数量")] - public decimal SAQty { get; set; } - - /// - /// 发货数量 - /// - [Display(Name = "发货数量")] - [ExporterHeader(DisplayName = "WMS发货数量")] - public decimal SEQty { get; set; } - - /// - /// 差异数量 - /// - [ExporterHeader(DisplayName = "差异数量")] - public decimal DiffQty => SAQty - SEQty; -} - -/// -/// 直供件BBAC结算与发运对比明细 +/// 直供件HBPO结算与发运对比明细 /// [ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport +public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport { /// /// 类别 - /// 有结算有发运 - /// 有结算无发运 - /// 无结算有发运 /// [Display(Name = "类别")] [ExporterHeader(DisplayName = "类别")] @@ -355,21 +332,18 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp [ValueMapping("有结算无发运", 2)] [ValueMapping("无结算有发运", 3)] public EnumPubSaSeCompareCategory Category { get; set; } - /// /// Wms发货单号 /// [Display(Name = "Wms发货单号")] [ExporterHeader(DisplayName = "交货单号")] public string WmsBillNum { get; set; } - /// /// 发货日期 /// [Display(Name = "发货日期")] [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime ShippingDate { get; set; } - + public DateTime? ShippingDate { get; set; } /// /// 生产码 /// @@ -405,15 +379,13 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp /// [Display(Name = "客户下线时间")] [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime CustomerOfflineTime { get; set; } - + public DateTime? CustomerOfflineTime { get; set; } /// /// 结算数量 /// [Display(Name = "结算数量")] [ExporterHeader(DisplayName = "结算数量")] public decimal SAQty { get; set; } - /// /// 发货数量 /// @@ -438,7 +410,7 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp /// [Display(Name = "定价")] [ExporterHeader(DisplayName = "定价")] - public decimal FixPrice { get; set; } + public decimal? FixPrice { get; set; } /// /// WMS目标库位 /// @@ -454,16 +426,13 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp } /// -/// 直供件HBPO结算与发运对比明细 +/// 买单件BBAC结算与发运对比明细 /// [ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport +public class PubSaSeCompareDetailExportMaiDanJianBBAC : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport { /// /// 类别 - /// 有结算有发运 - /// 有结算无发运 - /// 无结算有发运 /// [Display(Name = "类别")] [ExporterHeader(DisplayName = "类别")] @@ -482,13 +451,12 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp /// [Display(Name = "发货日期")] [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime ShippingDate { get; set; } - + public DateTime? ShippingDate { get; set; } /// /// 生产码 /// [Display(Name = "生产码")] - [ExporterHeader(DisplayName = "ASN发货单号")] + [ExporterHeader(DisplayName = "索引号")] public string PN { get; set; } /// /// 客户零件号 @@ -519,13 +487,15 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp /// [Display(Name = "客户下线时间")] [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime CustomerOfflineTime { get; set; } + public DateTime? CustomerOfflineTime { get; set; } + /// /// 结算数量 /// [Display(Name = "结算数量")] [ExporterHeader(DisplayName = "结算数量")] public decimal SAQty { get; set; } + /// /// 发货数量 /// @@ -550,7 +520,7 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp /// [Display(Name = "定价")] [ExporterHeader(DisplayName = "定价")] - public decimal FixPrice { get; set; } + public decimal? FixPrice { get; set; } /// /// WMS目标库位 /// @@ -569,13 +539,10 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp /// 买单件HBPO结算与发运对比明细 /// [ExcelExporter(MaxRowNumberOnASheet = 900000)] -public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExport +public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport { /// /// 类别 - /// 有结算有发运 - /// 有结算无发运 - /// 无结算有发运 /// [Display(Name = "类别")] [ExporterHeader(DisplayName = "类别")] @@ -583,21 +550,18 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo [ValueMapping("有结算无发运", 2)] [ValueMapping("无结算有发运", 3)] public EnumPubSaSeCompareCategory Category { get; set; } - /// /// Wms发货单号 /// [Display(Name = "Wms发货单号")] [ExporterHeader(DisplayName = "交货单号")] public string WmsBillNum { get; set; } - /// /// 发货日期 /// [Display(Name = "发货日期")] [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime ShippingDate { get; set; } - + public DateTime? ShippingDate { get; set; } /// /// 生产码 /// @@ -633,7 +597,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo /// [Display(Name = "客户下线时间")] [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime CustomerOfflineTime { get; set; } + public DateTime? CustomerOfflineTime { get; set; } /// /// 结算数量 @@ -666,7 +630,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo /// [Display(Name = "定价")] [ExporterHeader(DisplayName = "定价")] - public decimal FixPrice { get; set; } + public decimal? FixPrice { get; set; } /// /// WMS目标库位 /// @@ -689,9 +653,6 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu { /// /// 类别 - /// 有结算有发运 - /// 有结算无发运 - /// 无结算有发运 /// [Display(Name = "类别")] [ExporterHeader(DisplayName = "类别")] @@ -699,21 +660,18 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu [ValueMapping("有结算无发运", 2)] [ValueMapping("无结算有发运", 3)] public EnumPubSaSeCompareCategory Category { get; set; } - /// /// Wms发货单号 /// [Display(Name = "Wms发货单号")] [ExporterHeader(DisplayName = "交货单号")] public string WmsBillNum { get; set; } - /// /// 发货日期 /// [Display(Name = "发货日期")] [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime ShippingDate { get; set; } - + public DateTime? ShippingDate { get; set; } /// /// 生产码 /// @@ -749,7 +707,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu /// [Display(Name = "客户下线时间")] [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime CustomerOfflineTime { get; set; } + public DateTime? CustomerOfflineTime { get; set; } /// /// 结算数量 @@ -781,7 +739,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu /// [Display(Name = "定价")] [ExporterHeader(DisplayName = "定价")] - public decimal FixPrice { get; set; } + public decimal? FixPrice { get; set; } /// /// WMS目标库位 /// @@ -804,9 +762,6 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I { /// /// 类别 - /// 有结算有发运 - /// 有结算无发运 - /// 无结算有发运 /// [Display(Name = "类别")] [ExporterHeader(DisplayName = "类别")] @@ -814,21 +769,18 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I [ValueMapping("有结算无发运", 2)] [ValueMapping("无结算有发运", 3)] public EnumPubSaSeCompareCategory Category { get; set; } - /// /// Wms发货单号 /// [Display(Name = "Wms发货单号")] [ExporterHeader(DisplayName = "交货单号")] public string WmsBillNum { get; set; } - /// /// 发货日期 /// [Display(Name = "发货日期")] [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime ShippingDate { get; set; } - + public DateTime? ShippingDate { get; set; } /// /// 生产码 /// @@ -864,7 +816,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I /// [Display(Name = "客户下线时间")] [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime CustomerOfflineTime { get; set; } + public DateTime? CustomerOfflineTime { get; set; } /// /// 结算数量 /// @@ -895,7 +847,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I /// [Display(Name = "定价")] [ExporterHeader(DisplayName = "定价")] - public decimal FixPrice { get; set; } + public decimal? FixPrice { get; set; } /// /// WMS目标库位 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs index 245c375a..67910449 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs @@ -42,7 +42,7 @@ public class PubSaSeCompareDapperRepository : DapperRepository + /// BBAC结算、Edi、发运对比导出服务 + /// + public class JisBBACSaEdiSeCompareExportService : ITransientDependency, IExportJob + { + /// + /// HubContext + /// + private readonly IHubContext _hubContext; + /// + /// 文件容器 + /// + private readonly IBlobContainer _fileContainer; + /// + /// DbContext + /// + private readonly SettleAccountDbContext _settleAccountDbContext; + + /// + /// 构造 + /// + public JisBBACSaEdiSeCompareExportService( + IHubContext hubContext, + IBlobContainer fileContainer, + IObjectMapper objectMapper, + SettleAccountDbContext settleAccountDbContext) + { + _hubContext = hubContext; + _fileContainer = fileContainer; + _settleAccountDbContext = settleAccountDbContext; + } + + /// + /// 导出 + /// + public string ExportFile(Guid id, List exportName, List property) + { + var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; + var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; + var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; + var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value; + var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value; + + var seStartDateTime = DateTime.Parse(strSeStartDateTime); + var seEndDateTime = DateTime.Parse(strSeEndDateTime); + var filename = exportName.FirstOrDefault(); + + //有EDI无发运 + var haveEdiNotHaveSeList = _settleAccountDbContext.Set().Where(t => t.IsHaveSeData == false) + .GroupBy(t => new { t.LU, t.PN }) + .Select(t => new JisBBACEidSeCompareExport() + { + Category = "JIS", + CarModeCode = default, + LineStationcode = default, + SequenceNumber = t.Max(t => t.SeqNumber), + ParType = "01", + EdiQty = t.Sum(t => t.Qty), + AssemblyDate = default, + MatchNumber = default, + MateType = "否", + DiffDesc = "WMS漏发货EDI有订单" + }).ToList(); + //无EDI有发运 + var notHaveEdiHaveSeList = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == false) + .GroupBy(t => new { t.LU, t.PN }) + .Select(t => new JisBBACEidSeCompareExport() + { + Category = "JIS", + WmsBillNum = t.Max(t => t.BillNum), + MESConfigCode = t.Max(t => t.MESConfigCode), + ShippingDate = t.Max(t => t.BillTime), + PN = t.Max(t => t.PN), + Seq = t.Max(t => t.Seq), + PjsNum = t.Max(t => t.PjsNum), + MaterialNumber = t.Max(t => t.CustPartCode), + MaterialDes = t.Max(t => t.PartDesc), + SEQty = t.Sum(t => t.Qty), + InjectionCode = t.Max(t => t.InjectionCode), + MateType = "否", + DiffDesc = "WMS有发货EDI无订单" + }).ToList(); + //有EDI有发运 + var ediGroup = from edi in _settleAccountDbContext.Set() + where edi.IsDeleted == false && edi.IsHaveSeData == true + group edi by new { edi.PN, edi.LU } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.LU, + Qty = groupItem.Sum(t => t.Qty), + SeqNumber = groupItem.Max(t => t.SeqNumber) + }; + var seGroup = from se in _settleAccountDbContext.Set() + where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime + group se by new { se.PN, se.LU } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.LU, + Qty = groupItem.Sum(t => t.Qty), + BillNum = groupItem.Max(t => t.BillNum), + MESConfigCode = groupItem.Max(t => t.MESConfigCode), + BillTime = groupItem.Max(t => t.BillTime), + Seq = groupItem.Max(t => t.Seq), + PjsNum = groupItem.Max(t => t.PjsNum), + CustPartCode = groupItem.Max(t => t.CustPartCode), + PartDesc = groupItem.Max(t => t.PartDesc), + InjectionCode = groupItem.Max(t => t.InjectionCode) + }; + var haveEdiHaveSeList = (from edi in ediGroup + join se in seGroup + on new { edi.PN, edi.LU } equals new { se.PN, se.LU } + //where edi.IsDeleted == false && edi.IsHaveSeData == true && se.IsHaveEdiData == true + select new JisBBACEidSeCompareExport() + { + Category = "JIS", + WmsBillNum = se.BillNum, + CarModeCode = default, + LineStationcode = default, + SequenceNumber = edi.SeqNumber, + ParType = "01", + MESConfigCode = se.MESConfigCode, + ShippingDate = se.BillTime, + PN = se.PN, + Seq = se.Seq, + PjsNum = se.PjsNum, + MaterialNumber = se.CustPartCode, + MaterialDes = se.PartDesc, + SEQty = se.Qty, + EdiQty = edi.Qty, + AssemblyDate = default, + MatchNumber = default, + InjectionCode = se.InjectionCode, + MateType = se.Qty == edi.Qty ? "是" : "否", + DiffDesc = "WMS有发货EDI有订单" + }).ToList(); + + haveEdiNotHaveSeList.AddRange(haveEdiHaveSeList); + notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList); + + ExcelExporter excelExporter = new ExcelExporter(); + excelExporter + .Append(haveEdiNotHaveSeList, $"BBACEDI数据和发货对比") + .SeparateBySheet() + .Append(notHaveEdiHaveSeList, $"BBAC发货和EDI数据对比"); + + var result = excelExporter.ExportAppendDataAsByteArray(); + result.ShouldNotBeNull(); + _fileContainer.SaveAsync(filename, result.Result, true); + + Notify(); + return id.ToString(); + } + + #region 私有方法 + private void Notify() + { + this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", ""); + } + #endregion + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs new file mode 100644 index 00000000..7c04c042 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs @@ -0,0 +1,183 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Magicodes.ExporterAndImporter.Excel; +using Microsoft.AspNetCore.SignalR; +using SettleAccount.Domain.BQ; +using SettleAccount.Job.SignalR; +using Shouldly; +using TaskJob.EventArgs; +using TaskJob.Interfaces; +using Volo.Abp.BlobStoring; +using Volo.Abp.DependencyInjection; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount; +using Win.Sfs.SettleAccount.Reports; + +namespace SettleAccount.Job.Services.Report +{ + /// + /// HBPO结算、Edi、发运对比导出服务 + /// + public class JisHBPOSaEdiSeCompareExportService : ITransientDependency, IExportJob + { + /// + /// HubContext + /// + private readonly IHubContext _hubContext; + /// + /// 文件容器 + /// + private readonly IBlobContainer _fileContainer; + /// + /// DbContext + /// + private readonly SettleAccountDbContext _settleAccountDbContext; + + /// + /// 构造 + /// + public JisHBPOSaEdiSeCompareExportService( + IBlobContainer fileContainer, + SettleAccountDbContext settleAccountDbContext) + { + _fileContainer = fileContainer; + _settleAccountDbContext = settleAccountDbContext; + } + + /// + /// 导出 + /// + public string ExportFile(Guid id, List exportName, List property) + { + var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; + var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; + var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; + var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value; + var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value; + + var seStartDateTime = DateTime.Parse(strSeStartDateTime); + var seEndDateTime = DateTime.Parse(strSeEndDateTime); + var filename = exportName.FirstOrDefault(); + + //有EDI无发运 + var haveEdiNotHaveSeList = _settleAccountDbContext.Set().Where(t => t.IsHaveSeData == false) + .GroupBy(t => new { t.LU, t.PN }) + .Select(t => new JisHBPOEidSeCompareExport() + { + Category = "JIS", + CarModeCode = default, + LineStationcode = default, + SequenceNumber = t.Max(t => t.SeqNumber), + ParType = "01", + EdiQty = t.Sum(t => t.Qty), + AssemblyDate = default, + MatchNumber = default, + MateType = "否", + DiffDesc = "WMS漏发货EDI有订单" + }).ToList(); + //无EDI有发运 + var notHaveEdiHaveSeList = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == false) + .GroupBy(t => new { t.LU, t.PN }) + .Select(t => new JisHBPOEidSeCompareExport() + { + Category = "JIS", + WmsBillNum = t.Max(t => t.BillNum), + MESConfigCode = t.Max(t => t.MESConfigCode), + ShippingDate = t.Max(t => t.BillTime), + PN = t.Max(t => t.PN), + Seq = t.Max(t => t.Seq), + PjsNum = t.Max(t => t.PjsNum), + ToLoc = t.Max(t => t.ToLoc), + ErpToLoc = t.Max(t => t.ErpToLoc), + MaterialNumber = t.Max(t => t.CustPartCode), + MaterialDes = t.Max(t => t.PartDesc), + SEQty = t.Sum(t => t.Qty), + InjectionCode = t.Max(t => t.InjectionCode), + MateType = "否", + DiffDesc = "WMS有发货EDI无订单" + }).ToList(); + //有EDI有发运 + var ediGroup = from edi in _settleAccountDbContext.Set() + where edi.IsDeleted == false && edi.IsHaveSeData == true + group edi by new { edi.PN, edi.LU } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.LU, + Qty = groupItem.Sum(t => t.Qty), + SeqNumber = groupItem.Max(t => t.SeqNumber) + }; + var seGroup = from se in _settleAccountDbContext.Set() + where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime + group se by new { se.PN, se.LU } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.LU, + Qty = groupItem.Sum(t => t.Qty), + BillNum = groupItem.Max(t => t.BillNum), + MESConfigCode = groupItem.Max(t => t.MESConfigCode), + BillTime = groupItem.Max(t => t.BillTime), + Seq = groupItem.Max(t => t.Seq), + PjsNum = groupItem.Max(t => t.PjsNum), + ToLoc = groupItem.Max(t => t.ToLoc), + ErpToLoc = groupItem.Max(t => t.ErpToLoc), + CustPartCode = groupItem.Max(t => t.CustPartCode), + PartDesc = groupItem.Max(t => t.PartDesc), + InjectionCode = groupItem.Max(t => t.InjectionCode) + }; + var haveEdiHaveSeList = (from edi in ediGroup + join se in seGroup + on new { edi.PN, edi.LU } equals new { se.PN, se.LU } + select new JisHBPOEidSeCompareExport() + { + Category = "JIS", + WmsBillNum = se.BillNum, + CarModeCode = default, + LineStationcode = default, + SequenceNumber = edi.SeqNumber, + ParType = "01", + MESConfigCode = se.MESConfigCode, + ShippingDate = se.BillTime, + PN = se.PN, + Seq = se.Seq, + PjsNum = se.PjsNum, + ToLoc = se.ToLoc, + ErpToLoc = se.ErpToLoc, + MaterialNumber = se.CustPartCode, + MaterialDes = se.PartDesc, + SEQty = se.Qty, + EdiQty = edi.Qty, + AssemblyDate = default, + MatchNumber = default, + InjectionCode = se.InjectionCode, + MateType = se.Qty == edi.Qty ? "是" : "否", + DiffDesc = "WMS有发货EDI有订单" + }).ToList(); + + haveEdiNotHaveSeList.AddRange(haveEdiHaveSeList); + notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList); + + ExcelExporter excelExporter = new ExcelExporter(); + excelExporter + .Append(haveEdiNotHaveSeList, $"HBPOEDI数据和发货对比") + .SeparateBySheet() + .Append(notHaveEdiHaveSeList, $"HBPO发货和EDI数据对比"); + + var result = excelExporter.ExportAppendDataAsByteArray(); + result.ShouldNotBeNull(); + _fileContainer.SaveAsync(filename, result.Result, true); + + Notify(); + return id.ToString(); + } + + #region 私有方法 + private void Notify() + { + this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", ""); + } + #endregion + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs new file mode 100644 index 00000000..e6576c67 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Linq.Dynamic.Core; +using Microsoft.AspNetCore.SignalR; +using Microsoft.OpenApi.Extensions; +using SettleAccount.Domain.BQ; +using SettleAccount.Job.SignalR; +using Shouldly; +using TaskJob.EventArgs; +using TaskJob.Interfaces; +using Volo.Abp.BlobStoring; +using Volo.Abp.DependencyInjection; +using Volo.Abp.ObjectMapping; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount; +using Win.Sfs.SettleAccount.Reports; + +namespace SettleAccount.Job.Services.Report +{ + /// + /// 买单件BBAC结算、发运对比导出服务 + /// + public class MaiDanBBACSaSeCompareExportService : SaSeCompareExportBaseService, ITransientDependency, IExportJob + { + /// + /// 业务类型 + /// + private readonly EnumBusinessType businessType = EnumBusinessType.MaiDanJianBBAC; + /// + /// 文件容器 + /// + private readonly IBlobContainer _fileContainer; + /// + /// AutoMapper + /// + private readonly IObjectMapper _objectMapper; + /// + /// DbContext + /// + private readonly SettleAccountDbContext _settleAccountDbContext; + + /// + /// 构造 + /// + public MaiDanBBACSaSeCompareExportService( + IHubContext hubContext, + IBlobContainer fileContainer, + IObjectMapper objectMapper, + SettleAccountDbContext settleAccountDbContext) : base(hubContext) + { + _fileContainer = fileContainer; + _objectMapper = objectMapper; + _settleAccountDbContext = settleAccountDbContext; + } + + /// + /// 导出 + /// + public string ExportFile(Guid id, List exportName, List property) + { + var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; + var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; + var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; + var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value; + var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value; + + var businessTypeDisplayName = businessType.GetAttributeOfType()?.Name ?? businessType.ToString(); + var seStartDateTime = DateTime.Parse(strSeStartDateTime); + var seEndDateTime = DateTime.Parse(strSeEndDateTime); + var filename = exportName.FirstOrDefault(); + + var pubSaSeCompareDiffs = GetSaSeCompareData(int.Parse(version), seStartDateTime, seEndDateTime); + + HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs); + + if (string.IsNullOrEmpty(lu) == false) + { + pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.CustomerPartCode == lu); + } + if (string.IsNullOrEmpty(pn) == false) + { + pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn); + } + pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList(); + + var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); + var excelExporter = BindExcelExporter(items, businessTypeDisplayName); + + var result = excelExporter.ExportAppendDataAsByteArray(); + result.ShouldNotBeNull(); + _fileContainer.SaveAsync(filename, result.Result, true); + + Notify(); + return id.ToString(); + } + + #region 私有方法 + /// + /// 获取结算与发运比对数据 + /// + public List GetSaSeCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) + { + //结算 + var saGroup = from sa in _settleAccountDbContext.Set() + where sa.BusinessType == businessType && sa.Version == version + group sa by new { sa.PN, sa.LU } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.LU, + Qty = groupItem.Sum(t => t.Qty), + Price = groupItem.Max(t => t.Price), + SettleDate = groupItem.Max(t => t.SettleDate), + PartCode = groupItem.Max(t => t.PartCode), + }; + //发运 + var seGroup = from se in _settleAccountDbContext.Set() + where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime + group se by new { se.PN, se.LU } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.LU, + Qty = groupItem.Sum(t => t.Qty), + WmsBillNum = groupItem.Max(t => t.WmsBillNum), + ShippingDate = groupItem.Max(t => t.ShippingDate), + FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), + ToLoc = groupItem.Max(t => t.ToLoc), + ErpToLoc = groupItem.Max(t => t.ErpToLoc) + }; + var saSeCompareLeft = (from sa in saGroup + join se in seGroup + on new { sa.PN, sa.LU } equals new { se.PN, se.LU } + into temp + from se in temp.DefaultIfEmpty() + select new PubSaSeCompareDiff() + { + WmsBillNum = se.WmsBillNum, + ShippingDate = se.ShippingDate, + CustomerOfflineTime = sa.SettleDate, + PN = sa.PN, + SAQty = sa.Qty, + SEQty = se.Qty, + FixPrice = sa.Price, + ToLocCode = se.ToLoc, + ToErpLocCode = se.ErpToLoc, + SeCustomerPartCode = se.LU, + SeFactoryPartCode = se.FactoryPartCode, + SaCustomerPartCode = sa.LU, + SaFactoryPartCode = sa.PartCode + }); + var saSeCompareRight = (from se in seGroup + join sa in saGroup + on new { se.PN, se.LU } equals new { sa.PN, sa.LU } + into temp + from sa in temp.DefaultIfEmpty() + select new PubSaSeCompareDiff() + { + WmsBillNum = se.WmsBillNum, + ShippingDate = se.ShippingDate, + CustomerOfflineTime = sa.SettleDate, + PN = se.PN, + SAQty = sa.Qty, + SEQty = se.Qty, + FixPrice = sa.Price, + ToLocCode = se.ToLoc, + ToErpLocCode = se.ErpToLoc, + SeCustomerPartCode = se.LU, + SeFactoryPartCode = se.FactoryPartCode, + SaCustomerPartCode = sa.LU, + SaFactoryPartCode = sa.PartCode + }); + var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList(); + return saSeCompareFullJoin; + } + #endregion + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs new file mode 100644 index 00000000..0fa9c1f5 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Linq.Dynamic.Core; +using Microsoft.AspNetCore.SignalR; +using Microsoft.OpenApi.Extensions; +using SettleAccount.Domain.BQ; +using SettleAccount.Job.SignalR; +using Shouldly; +using TaskJob.EventArgs; +using TaskJob.Interfaces; +using Volo.Abp.BlobStoring; +using Volo.Abp.DependencyInjection; +using Volo.Abp.ObjectMapping; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount; +using Win.Sfs.SettleAccount.Reports; +using static NPOI.HSSF.Util.HSSFColor; + +namespace SettleAccount.Job.Services.Report +{ + /// + /// 买单件HBPO结算、发运对比导出服务 + /// + public class MaiDanHBPOSaSeCompareExportService : SaSeCompareExportBaseService, ITransientDependency, IExportJob + { + /// + /// 业务类型 + /// + private readonly EnumBusinessType businessType = EnumBusinessType.MaiDanJianHBPO; + /// + /// 文件容器 + /// + private readonly IBlobContainer _fileContainer; + /// + /// AutoMapper + /// + private readonly IObjectMapper _objectMapper; + /// + /// DbContext + /// + private readonly SettleAccountDbContext _settleAccountDbContext; + + /// + /// 构造 + /// + public MaiDanHBPOSaSeCompareExportService( + IHubContext hubContext, + IBlobContainer fileContainer, + IObjectMapper objectMapper, + SettleAccountDbContext settleAccountDbContext) : base(hubContext) + { + _fileContainer = fileContainer; + _objectMapper = objectMapper; + _settleAccountDbContext = settleAccountDbContext; + } + + /// + /// 导出 + /// + public string ExportFile(Guid id, List exportName, List property) + { + var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; + var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; + var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; + var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value; + var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value; + + var businessTypeDisplayName = businessType.GetAttributeOfType()?.Name ?? businessType.ToString(); + var seStartDateTime = DateTime.Parse(strSeStartDateTime); + var seEndDateTime = DateTime.Parse(strSeEndDateTime); + var filename = exportName.FirstOrDefault(); + + var pubSaSeCompareDiffs = GetSaSeCompareData(int.Parse(version), seStartDateTime, seEndDateTime); + + HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs); + + if (string.IsNullOrEmpty(lu) == false) + { + pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.CustomerPartCode == lu); + } + if (string.IsNullOrEmpty(pn) == false) + { + pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn); + } + pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList(); + + var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); + var excelExporter = BindExcelExporter(items, businessTypeDisplayName); + + var result = excelExporter.ExportAppendDataAsByteArray(); + result.ShouldNotBeNull(); + _fileContainer.SaveAsync(filename, result.Result, true); + + Notify(); + return id.ToString(); + } + + #region 私有方法 + /// + /// 获取结算与发运比对数据 + /// + public List GetSaSeCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime) + { + //结算 + var saGroup = from sa in _settleAccountDbContext.Set() + where sa.BusinessType == businessType && sa.Version == version + group sa by new { sa.PN, sa.LU } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.LU, + Qty = groupItem.Sum(t => t.Qty), + Price = groupItem.Max(t => t.Price), + SettleDate = groupItem.Max(t => t.SettleDate), + PartCode = groupItem.Max(t => t.PartCode), + }; + //发运 + var seGroup = from se in _settleAccountDbContext.Set() + where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime + group se by new { se.PN, se.LU } into groupItem + select new + { + groupItem.Key.PN, + groupItem.Key.LU, + Qty = groupItem.Sum(t => t.Qty), + WmsBillNum = groupItem.Max(t => t.WmsBillNum), + ShippingDate = groupItem.Max(t => t.ShippingDate), + FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), + ToLoc = groupItem.Max(t => t.ToLoc), + ErpToLoc = groupItem.Max(t => t.ErpToLoc) + }; + var saSeCompareLeft = (from sa in saGroup + join se in seGroup + on new { sa.PN, sa.LU } equals new { se.PN, se.LU } + into temp + from se in temp.DefaultIfEmpty() + select new PubSaSeCompareDiff() + { + WmsBillNum = se.WmsBillNum, + ShippingDate = se.ShippingDate, + CustomerOfflineTime = sa.SettleDate, + PN = sa.PN, + SAQty = sa.Qty, + SEQty = se.Qty, + FixPrice = sa.Price, + ToLocCode = se.ToLoc, + ToErpLocCode = se.ErpToLoc, + SeCustomerPartCode = se.LU, + SeFactoryPartCode = se.FactoryPartCode, + SaCustomerPartCode = sa.LU, + SaFactoryPartCode = sa.PartCode + }); + var saSeCompareRight = (from se in seGroup + join sa in saGroup + on new { se.PN, se.LU } equals new { sa.PN, sa.LU } + into temp + from sa in temp.DefaultIfEmpty() + select new PubSaSeCompareDiff() + { + WmsBillNum = se.WmsBillNum, + ShippingDate = se.ShippingDate, + CustomerOfflineTime = sa.SettleDate, + PN = se.PN, + SAQty = sa.Qty, + SEQty = se.Qty, + FixPrice = sa.Price, + ToLocCode = se.ToLoc, + ToErpLocCode = se.ErpToLoc, + SeCustomerPartCode = se.LU, + SeFactoryPartCode = se.FactoryPartCode, + SaCustomerPartCode = sa.LU, + SaFactoryPartCode = sa.PartCode + }); + var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList(); + return saSeCompareFullJoin; + } + #endregion + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs index bbc9ac09..eecc0b30 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs @@ -283,14 +283,6 @@ namespace SettleAccount.Job.Services.Report excelExporter = BindExcelExporter(items, businessTypeDisplayName); } break; - case EnumBusinessType.MaiDanJianBBAC: - break; - case EnumBusinessType.MaiDanJianHBPO: - //{ - // var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); - // excelExporter = BindExcelExporter(items, businessTypeDisplayName); - //} - break; case EnumBusinessType.BeiJian: { var items = _objectMapper.Map, List>(pubSaSeCompareDiffs); @@ -381,14 +373,35 @@ namespace SettleAccount.Job.Services.Report }; } - var saSeCompareList = (from sa in saGroup + //var saSeCompareList = (from sa in saGroup + // join se in seGroup + // on new { sa.PN, sa.LU } equals new { se.PN, se.LU } + // select new PubSaSeCompareDiff() + // { + // WmsBillNum = se.WmsBillNum, + // ShippingDate = se.ShippingDate, + // CustomerOfflineTime = sa.SettleDate, + // SAQty = sa.Qty, + // SEQty = se.Qty, + // FixPrice = sa.Price, + // ToLocCode = se.ToLocCode, + // ToErpLocCode = se.ToErpLocCode, + // SeCustomerPartCode = se.LU, + // SeFactoryPartCode = se.FactoryPartCode, + // SaCustomerPartCode = sa.LU, + // SaFactoryPartCode = sa.PartCode + // }); + var saSeCompareLeft = (from sa in saGroup join se in seGroup on new { sa.PN, sa.LU } equals new { se.PN, se.LU } + into temp + from se in temp.DefaultIfEmpty() select new PubSaSeCompareDiff() { WmsBillNum = se.WmsBillNum, ShippingDate = se.ShippingDate, CustomerOfflineTime = sa.SettleDate, + PN = sa.PN, SAQty = sa.Qty, SEQty = se.Qty, FixPrice = sa.Price, @@ -398,9 +411,30 @@ namespace SettleAccount.Job.Services.Report SeFactoryPartCode = se.FactoryPartCode, SaCustomerPartCode = sa.LU, SaFactoryPartCode = sa.PartCode - }).ToList(); - - return saSeCompareList; + }); + var saSeCompareRight = (from se in seGroup + join sa in saGroup + on new { se.PN, se.LU } equals new { sa.PN, sa.LU } + into temp + from sa in temp.DefaultIfEmpty() + select new PubSaSeCompareDiff() + { + WmsBillNum = se.WmsBillNum, + ShippingDate = se.ShippingDate, + CustomerOfflineTime = sa.SettleDate, + PN = se.PN, + SAQty = sa.Qty, + SEQty = se.Qty, + FixPrice = sa.Price, + ToLocCode = se.ToLocCode, + ToErpLocCode = se.ToErpLocCode, + SeCustomerPartCode = se.LU, + SeFactoryPartCode = se.FactoryPartCode, + SaCustomerPartCode = sa.LU, + SaFactoryPartCode = sa.PartCode + }); + var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList(); + return saSeCompareFullJoin; } /// /// 创建导出文件结构 @@ -429,7 +463,7 @@ namespace SettleAccount.Job.Services.Report //有结算无发运 var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe); //有结算无发运 - var haveSaNotHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -439,7 +473,7 @@ namespace SettleAccount.Job.Services.Report //无结算有发运 var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe); //无结算有发运 - var notHaveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() { FactoryPartCode = p.Key, PartCodeDesc = p.FirstOrDefault().PartCodeDesc, @@ -463,7 +497,9 @@ namespace SettleAccount.Job.Services.Report .SeparateBySheet() .Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出"); } - + /// + /// 通知 + /// private void Notify() { this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", ""); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs new file mode 100644 index 00000000..36519306 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs @@ -0,0 +1,136 @@ +using System.Collections.Generic; +using System.Linq; +using Magicodes.ExporterAndImporter.Excel; +using Microsoft.AspNetCore.SignalR; +using SettleAccount.Job.SignalR; +using Win.Sfs.SettleAccount.Enums; +using Win.Sfs.SettleAccount.Reports; + +namespace SettleAccount.Job.Services.Report +{ + public class SaSeCompareExportBaseService + { + /// + /// HubContext + /// + private readonly IHubContext _hubContext; + + public SaSeCompareExportBaseService(IHubContext hubContext) + { + _hubContext = hubContext; + } + + public virtual void HandlePubSaSeCompareDiffList(List pubSaSeCompareDiffs) + { + pubSaSeCompareDiffs.ForEach(p => + { + p.Category = (string.IsNullOrEmpty(p.SaCustomerPartCode), string.IsNullOrEmpty(p.SeCustomerPartCode)) switch + { + (false, false) => EnumPubSaSeCompareCategory.HaveSaHaveSe, + (false, true) => EnumPubSaSeCompareCategory.HaveSaNotHaveSe, + (true, false) => EnumPubSaSeCompareCategory.NotHaveSaHaveSe, + _ => EnumPubSaSeCompareCategory.None, + }; + switch (p.Category) + { + case EnumPubSaSeCompareCategory.None: + break; + case EnumPubSaSeCompareCategory.HaveSaHaveSe: + { + p.CustomerPartCode = p.SaCustomerPartCode; + p.FactoryPartCode = p.SaFactoryPartCode; + p.ReplaceFactoryPartCode = p.SaFactoryPartCode; + } + break; + case EnumPubSaSeCompareCategory.HaveSaNotHaveSe: + { + p.CustomerPartCode = p.SaCustomerPartCode; + p.FactoryPartCode = p.SaFactoryPartCode; + p.ReplaceFactoryPartCode = p.SaFactoryPartCode; + } + break; + case EnumPubSaSeCompareCategory.NotHaveSaHaveSe: + { + p.CustomerPartCode = p.SeCustomerPartCode; + p.FactoryPartCode = p.SeFactoryPartCode; + p.ReplaceFactoryPartCode = p.SeFactoryPartCode; + } + break; + default: + break; + } + }); + } + + /// + /// 创建导出文件结构 + /// + public ExcelExporter BindExcelExporter(List pubSaSeCompareDetailExports, string businessTypeDisplayName) where T : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport, new() + { + //结算核对汇总 + var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + { + FactoryPartCode = p.Key, + PartCodeDesc = p.FirstOrDefault().PartCodeDesc, + SAQty = p.Sum(t => t.SAQty), + SEQty = p.Sum(t => t.SEQty) + }).ToList(); + + //有结算有发运 + var haveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe); + //有结算有发运汇总 + var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + { + FactoryPartCode = p.Key, + PartCodeDesc = p.FirstOrDefault().PartCodeDesc, + SAQty = p.Sum(t => t.SAQty), + SEQty = p.Sum(t => t.SEQty) + }).ToList(); + //有结算无发运 + var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe); + //有结算无发运 + var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + { + FactoryPartCode = p.Key, + PartCodeDesc = p.FirstOrDefault().PartCodeDesc, + SAQty = p.Sum(t => t.SAQty), + SEQty = p.Sum(t => t.SEQty) + }).ToList(); + //无结算有发运 + var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe); + //无结算有发运 + var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() + { + FactoryPartCode = p.Key, + PartCodeDesc = p.FirstOrDefault().PartCodeDesc, + SAQty = p.Sum(t => t.SAQty), + SEQty = p.Sum(t => t.SEQty) + }).ToList(); + + ExcelExporter excelExporter = new ExcelExporter(); + return excelExporter + .Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出") + .SeparateBySheet() + .Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出") + .SeparateBySheet() + + .Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出") + .SeparateBySheet() + .Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出") + .SeparateBySheet() + + .Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出") + .SeparateBySheet() + .Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出"); + } + + /// + /// 通知 + /// + public virtual void Notify() + { + _hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", ""); + } + + } +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs index 3ca3cbeb..e7ec5e0d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs @@ -29,6 +29,7 @@ namespace SettleAccount.Job { CreateMap(); CreateMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap(); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs index c1bc1e3e..652c5aa1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs @@ -39,11 +39,12 @@ namespace Win.Sfs.SettleAccount ConfigureAutoMapper(); GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute{ Attempts = 0}); - context.Services.AddTransient(); context.Services.AddTransient(); - context.Services.AddTransient(); + context.Services.AddTransient();; + context.Services.AddTransient(); + context.Services.AddTransient(); + context.Services.AddTransient(); - context.Services.AddTransient(); context.Services.AddTransient(); context.Services.AddTransient();