学 赵 1 year ago
parent
commit
d05be655f1
  1. 2
      code/src/Modules/BaseService/BaseService.Application/UserManagement/RoleAppService.cs
  2. 2
      code/src/Modules/BaseService/BaseService.Application/UserManagement/UserAppService.cs
  3. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  4. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/start.cmd
  5. 14
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  6. 10
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/compare/compare.js
  7. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/commerce.js
  8. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/detail.js
  9. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable-bk.js
  10. 8
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/base-data.js
  11. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js
  12. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js
  13. 38
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/styles/site.css
  14. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/compare/_compare.js
  15. 78
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js
  16. 37
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js
  17. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/EdiSeCompareRequestDto.cs
  18. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/SaSeCompareRequestDto.cs
  19. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs
  20. 111
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs
  21. 78
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs
  22. 36
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs
  23. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  24. 34
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
  25. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  26. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs
  27. 280
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
  28. 2
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs
  29. 183
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaEdiSeCompareExportService.cs
  30. 183
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs
  31. 180
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
  32. 181
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
  33. 66
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  34. 136
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs
  35. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs
  36. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

2
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; }

2
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; }

2
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*"
},

2
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

14
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();

10
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];
}

4
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,
},
};

2
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";

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/unable.js → 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";

8
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")],

6
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 寄售库库存扣减审批"),
],
},
],

4
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

38
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;
}

6
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);

78
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/_check.js

@ -43,7 +43,7 @@ export default {
<span class="dialog-footer">
<el-button type="primary" @click="show=false"> 返回 </el-button>
<el-button type="primary" @click="showSetupDialog" v-if="isBusiness&&data.invbillNum&&model.adJ_DETAIL.length===0&&row.invoiceState===1&&(row.state===3||row.state===4)">
重开发票号
报废重开
</el-button>
</span>
</template>
@ -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;

37
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`<app-list v-if="config" :config="config" @command="onCommand" />`,
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 };
},
};

14
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs → 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;
/// <summary>
/// Jis结算与发运对比请求Dto
/// Edi与发运对比请求Dto
/// </summary>
public class JisEdiSeCompareRequestDto
public class EdiSeCompareRequestDto
{
/// <summary>
/// 期间
@ -35,13 +35,7 @@ public class JisEdiSeCompareRequestDto
[Display(Name = "发运结束时间")]
public DateTime? SeEndDateTime { get; set; }
/// <summary>
/// 下线开始时间
/// 业务类型
/// </summary>
[Display(Name = "下线开始时间")]
public DateTime? DownLineStartDateTime { get; set; }
/// <summary>
/// 下线结束时间
/// </summary>
[Display(Name = "下线结束时间")]
public DateTime? DownLineEndDateTime { get; set; }
public EnumBusinessType BusinessType { get; set; }
}

8
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisSaSeCompareRequestDto.cs → 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;
/// <summary>
/// Jis结算与发运对比请求Dto
/// 结算与发运对比请求Dto
/// </summary>
public class JisSaSeCompareRequestDto
public class SaSeCompareRequestDto
{
/// <summary>
/// 期间
@ -44,4 +44,8 @@ public class JisSaSeCompareRequestDto
/// </summary>
[Display(Name = "下线结束时间")]
public DateTime? DownLineEndDateTime { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public EnumBusinessType BusinessType { get; set; }
}

20
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<BBAC_SA_DETAI
/// </summary>
private readonly INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> _bbacSaDetailRepository;
/// <summary>
/// 任务服务
/// </summary>
private readonly TaskJobService _taskJobService;
/// <summary>
/// 构造
/// </summary>
public BBAC_SA_DETAIL_SERVICE(INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> bbacSaDetailRepository,
TaskJobService taskJobService,
IDistributedCache<BBAC_SA_DETAIL> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@ -47,7 +40,6 @@ public class BBAC_SA_DETAIL_SERVICE : SettleAccountApplicationBase<BBAC_SA_DETAI
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_bbacSaDetailRepository = bbacSaDetailRepository;
_taskJobService = taskJobService;
}
#region 导出
@ -86,16 +78,4 @@ public class BBAC_SA_DETAIL_SERVICE : SettleAccountApplicationBase<BBAC_SA_DETAI
return new PagedResultDto<BBAC_SA_DETAIL_DTO>(totalCount, dtos);
}
#endregion
#region 对比
/// <summary>
/// BBAC结算与发运比对
/// </summary>
[HttpPost]
public async Task<string> BBACSaSeCompare(JisSaSeCompareRequestDto jisSaSeCompareRequestDto)
{
await Task.CompletedTask;
throw new NotImplementedException();
}
#endregion
}

111
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;
/// <summary>
/// 对比服务
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class CompareService : ApplicationService
{
/// <summary>
/// 任务服务
/// </summary>
private readonly TaskJobService _taskJobService;
public CompareService(TaskJobService taskJobService)
{
_taskJobService = taskJobService;
}
#region Edi与发运比对
/// <summary>
/// Edi与发运比对
/// </summary>
[HttpPost]
public async Task<string> EdiSeCompare(EdiSeCompareRequestDto ediSeCompareRequestDto)
{
var businessTypeDisplayName = ediSeCompareRequestDto.BusinessType.ToString();
var attributeOfType = ediSeCompareRequestDto.BusinessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
businessTypeDisplayName = attributeOfType.Name;
}
var projectName = $"{businessTypeDisplayName}EDI与发运数据对比";
var customConditionList = new List<CustomCondition>();
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 结算与发运比对
/// <summary>
/// 结算与发运比对
/// </summary>
[HttpPost]
public async Task<string> SaSeCompare(SaSeCompareRequestDto saSeCompareRequestDto)
{
var businessTypeDisplayName = saSeCompareRequestDto.BusinessType.ToString();
var attributeOfType = saSeCompareRequestDto.BusinessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
businessTypeDisplayName = attributeOfType.Name;
}
var projectName = $"{businessTypeDisplayName}结算与发运数据对比";
var customConditionList = new List<CustomCondition>();
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
}

78
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs

@ -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;
/// <summary>
/// Edi与发运对比服务
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class EdiSeCompareService : ApplicationService
{
/// <summary>
/// 任务服务
/// </summary>
private readonly TaskJobService _taskJobService;
public EdiSeCompareService(TaskJobService taskJobService)
{
_taskJobService = taskJobService;
}
#region 对比
/// <summary>
/// BBACEdi与发运比对
/// </summary>
[HttpPost]
public async Task<string> BBACEdiSeCompare(JisEdiSeCompareRequestDto jisEdiSeCompareRequestDto)
{
var projectName = $"JisBBACEDI与发运数据对比";
List<CustomCondition> customConditionList = new List<CustomCondition>();
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;
}
/// <summary>
/// HBPOEdi与发运比对
/// </summary>
[HttpPost]
public async Task<string> HBPOEdiSeCompare(JisEdiSeCompareRequestDto jisEdiSeCompareRequestDto)
{
var projectName = $"JisHBPOEDI与发运数据对比结算与发运数据对比";
List<CustomCondition> customConditionList = new List<CustomCondition>();
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
}

36
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<HBPO_SA_DETAI
/// </summary>
private readonly INormalEfCoreRepository<HBPO_SA_DETAIL, Guid> _hbpoSaDetailRepository;
/// <summary>
/// 任务服务
/// </summary>
private readonly TaskJobService _taskJobService;
/// <summary>
/// 构造
/// </summary>
public HBPO_SA_DETAIL_SERVICE(INormalEfCoreRepository<HBPO_SA_DETAIL, Guid> hbpoSaDetailRepository,
TaskJobService taskJobService,
IDistributedCache<HBPO_SA_DETAIL> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@ -50,7 +40,6 @@ public class HBPO_SA_DETAIL_SERVICE : SettleAccountApplicationBase<HBPO_SA_DETAI
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_hbpoSaDetailRepository = hbpoSaDetailRepository;
_taskJobService = taskJobService;
}
#region 导出
@ -89,29 +78,4 @@ public class HBPO_SA_DETAIL_SERVICE : SettleAccountApplicationBase<HBPO_SA_DETAI
return new PagedResultDto<HBPO_SA_DETAIL_DTO>(totalCount, dtos);
}
#endregion
#region 对比
/// <summary>
/// HBPO结算与发运比对
/// </summary>
[HttpPost]
public async Task<string> HBPOSaSeCompare(JisSaSeCompareRequestDto jisSaSeCompareRequestDto)
{
var projectName = $"JisHBPO结算与发运数据对比";
List<CustomCondition> customConditionList = new List<CustomCondition>();
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
}

22
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs

@ -74,11 +74,6 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
/// </summary>
private readonly INormalEfCoreRepository<TB_RePartsRelationship, Guid> _tbRePartsRelationshipRepository;
/// <summary>
/// 业务类型
/// </summary>
private readonly EnumBusinessType _businessType = EnumBusinessType.JisHBPO;
/// <summary>
/// 构造
/// </summary>
@ -106,6 +101,10 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
}
/// <summary>
/// 业务类型
/// </summary>
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 期间
/// </summary>
@ -123,9 +122,11 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
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<HBPO_SA>
[HttpPost]
public async Task<PagedResultDto<HBPO_SA_DTO>> 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<HBPO_SA>, List<HBPO_SA_DTO>>(entities);
return new PagedResultDto<HBPO_SA_DTO>(totalCount, dtos);
}
@ -288,7 +290,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
{
BillNum = hbpoSaBillNum,
State = "0",
BusinessType = _businessType,
BusinessType = BusinessType,
Site = site,
Version = Version
};
@ -301,7 +303,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
InvGroupNum = hbpoCanSaBillNum,
SettleBillNum = hbpoSaBillNum,
State = SettleBillState.,
BusinessType = _businessType,
BusinessType = BusinessType,
Site = site,
Version = Version
};
@ -327,7 +329,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoSaDetail.BillNum = hbpoSaBillNum;
hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU;
hbpoSaDetail.BusinessType = _businessType;
hbpoSaDetail.BusinessType = BusinessType;
});
//导入的零件号集合

34
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<PUB_SA_DETAIL>
return new PagedResultDto<PUB_SA_DETAIL_DTO>(totalCount, dtos);
}
#endregion
#region 对比
/// <summary>
/// Pub结算与发运比对
/// </summary>
[HttpPost]
public async Task<string> PubSaSeCompare(PubSaSeCompareRequestDto pubSaSeCompareRequestDto)
{
var businessTypeDisplayName = pubSaSeCompareRequestDto.BusinessType.ToString();
DisplayAttribute attributeOfType = pubSaSeCompareRequestDto.BusinessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
businessTypeDisplayName = attributeOfType.Name;
}
var projectName = $"{businessTypeDisplayName}结算与发运数据对比";
List<CustomCondition> customConditionList = new List<CustomCondition>();
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
}

7
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -153,8 +153,9 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
[HttpPost]
public async Task<PagedResultDto<PUB_SA_DTO>> 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<PUB_SA>, List<PUB_SA_DTO>>(entities);
return new PagedResultDto<PUB_SA_DTO>(totalCount, dtos);
}
@ -419,7 +420,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
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)

16
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs

@ -63,10 +63,6 @@ namespace Win.Sfs.SettleAccount
{
Func<string, IExportJob> accesor = key =>
{
if (key.Equals(typeof(PubSaSeCompareExportService).FullName))
{
return implementationFactory.GetService<PubSaSeCompareExportService>();
}
if (key.Equals(typeof(JisBBACEdiSeCompareExportService).FullName))
{
return implementationFactory.GetService<JisBBACEdiSeCompareExportService>();
@ -75,6 +71,18 @@ namespace Win.Sfs.SettleAccount
{
return implementationFactory.GetService<JisHBPOEdiSeCompareExportService>();
}
if (key.Equals(typeof(MaiDanBBACSaSeCompareExportService).FullName))
{
return implementationFactory.GetService<MaiDanBBACSaSeCompareExportService>();
}
if (key.Equals(typeof(MaiDanHBPOSaSeCompareExportService).FullName))
{
return implementationFactory.GetService<MaiDanHBPOSaSeCompareExportService>();
}
if (key.Equals(typeof(PubSaSeCompareExportService).FullName))
{
return implementationFactory.GetService<PubSaSeCompareExportService>();
}
if (key.Equals(typeof(PendingDeductionService).FullName))
{
return implementationFactory.GetService<PendingDeductionService>();

280
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs

@ -20,7 +20,7 @@ public class PubSaSeCompareDiff
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
public DateTime ShippingDate { get; set; }
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 日顺序号
/// </summary>
@ -35,22 +35,22 @@ public class PubSaSeCompareDiff
/// 结算数据中的过账日期
/// </summary>
[Display(Name = "客户下线时间")]
public DateTime CustomerOfflineTime { get; set; }
public DateTime? CustomerOfflineTime { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
public decimal SAQty { get; set; }
public decimal? SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
public decimal SEQty { get; set; }
public decimal? SEQty { get; set; }
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
public decimal FixPrice { get; set; }
public decimal? FixPrice { get; set; }
/// <summary>
/// 生产号
/// </summary>
@ -128,14 +128,10 @@ public class PubSaSeCompareDetailExport
/// <summary>
/// PUB结算与发运对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDetailExport2
public interface IPubSaSeCompareDetailExport
{
/// <summary>
/// 类别
/// 有结算有发运
/// 有结算无发运
/// 无结算有发运
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
@ -143,21 +139,101 @@ public class PubSaSeCompareDetailExport2
[ValueMapping("有结算无发运", 2)]
[ValueMapping("无结算有发运", 3)]
public EnumPubSaSeCompareCategory Category { get; set; }
/// <summary>
/// 零件描述
/// </summary>
[Display(Name = "零件描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 替换厂内零件号
/// </summary>
[Display(Name = "替换厂内零件号")]
[ExporterHeader(DisplayName = "替换厂内零件号")]
public string ReplaceFactoryPartCode { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
}
/// <summary>
/// PUB结算与发运对比汇总
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareSumExport
{
/// <summary>
/// 厂内物料号
/// </summary>
[Display(Name = "厂内物料号")]
[ExporterHeader(DisplayName = "LU")]
public string FactoryPartCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// 差异数量
/// </summary>
[ExporterHeader(DisplayName = "差异数量")]
public decimal DiffQty => SAQty - SEQty;
}
/// <summary>
/// 直供件BBAC结算与发运对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport
{
/// <summary>
/// 类别
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
[ValueMapping("有结算有发运", 1)]
[ValueMapping("有结算无发运", 2)]
[ValueMapping("无结算有发运", 3)]
public EnumPubSaSeCompareCategory Category { get; set; }
/// <summary>
/// Wms发货单号
/// </summary>
[Display(Name = "Wms发货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime ShippingDate { get; set; }
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 生产码
/// </summary>
@ -193,7 +269,7 @@ public class PubSaSeCompareDetailExport2
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime CustomerOfflineTime { get; set; }
public DateTime? CustomerOfflineTime { get; set; }
/// <summary>
/// 结算数量
@ -201,6 +277,7 @@ public class PubSaSeCompareDetailExport2
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
@ -211,7 +288,7 @@ public class PubSaSeCompareDetailExport2
/// 差异数量
/// </summary>
[ExporterHeader(DisplayName = "差异数量")]
public decimal DiffQty { set; get; }
public decimal DiffQty => SAQty - SEQty;
/// <summary>
/// 匹配类型
/// </summary>
@ -225,19 +302,7 @@ public class PubSaSeCompareDetailExport2
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal FixPrice { get; set; }
/// <summary>
/// 日顺序号
/// </summary>
[Display(Name = "日顺序号")]
[ExporterHeader(DisplayName = "日顺序号")]
public string SeqNumber { get; set; }
/// <summary>
/// PJIS日顺序号
/// </summary>
[Display(Name = "PJIS日顺序号")]
[ExporterHeader(DisplayName = "PJIS日顺序号")]
public string PJISSeqNumber { get; set; }
public decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -253,101 +318,13 @@ public class PubSaSeCompareDetailExport2
}
/// <summary>
/// PUB结算与发运对比明细
/// </summary>
public interface IPubSaSeCompareDetailExport
{
/// <summary>
/// 类别
/// 有结算有发运
/// 有结算无发运
/// 无结算有发运
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
[ValueMapping("有结算有发运", 1)]
[ValueMapping("有结算无发运", 2)]
[ValueMapping("无结算有发运", 3)]
public EnumPubSaSeCompareCategory Category { get; set; }
/// <summary>
/// 零件描述
/// </summary>
[Display(Name = "零件描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 替换厂内零件号
/// </summary>
[Display(Name = "替换厂内零件号")]
[ExporterHeader(DisplayName = "替换厂内零件号")]
public string ReplaceFactoryPartCode { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
}
/// <summary>
/// PUB结算与发运对比汇总
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareSumExport
{
/// <summary>
/// 厂内物料号
/// </summary>
[Display(Name = "厂内物料号")]
[ExporterHeader(DisplayName = "LU")]
public string FactoryPartCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// 差异数量
/// </summary>
[ExporterHeader(DisplayName = "差异数量")]
public decimal DiffQty => SAQty - SEQty;
}
/// <summary>
/// 直供件BBAC结算与发运对比明细
/// 直供件HBPO结算与发运对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport
public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport
{
/// <summary>
/// 类别
/// 有结算有发运
/// 有结算无发运
/// 无结算有发运
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
@ -355,21 +332,18 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
[ValueMapping("有结算无发运", 2)]
[ValueMapping("无结算有发运", 3)]
public EnumPubSaSeCompareCategory Category { get; set; }
/// <summary>
/// Wms发货单号
/// </summary>
[Display(Name = "Wms发货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime ShippingDate { get; set; }
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 生产码
/// </summary>
@ -405,15 +379,13 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime CustomerOfflineTime { get; set; }
public DateTime? CustomerOfflineTime { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
@ -438,7 +410,7 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal FixPrice { get; set; }
public decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -454,16 +426,13 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
}
/// <summary>
/// 直供件HBPO结算与发运对比明细
/// 买单件BBAC结算与发运对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport
public class PubSaSeCompareDetailExportMaiDanJianBBAC : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport
{
/// <summary>
/// 类别
/// 有结算有发运
/// 有结算无发运
/// 无结算有发运
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
@ -482,13 +451,12 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime ShippingDate { get; set; }
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 生产码
/// </summary>
[Display(Name = "生产码")]
[ExporterHeader(DisplayName = "ASN发货单号")]
[ExporterHeader(DisplayName = "索引号")]
public string PN { get; set; }
/// <summary>
/// 客户零件号
@ -519,13 +487,15 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime CustomerOfflineTime { get; set; }
public DateTime? CustomerOfflineTime { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
@ -550,7 +520,7 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal FixPrice { get; set; }
public decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -569,13 +539,10 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
/// 买单件HBPO结算与发运对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExport
public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport
{
/// <summary>
/// 类别
/// 有结算有发运
/// 有结算无发运
/// 无结算有发运
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
@ -583,21 +550,18 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
[ValueMapping("有结算无发运", 2)]
[ValueMapping("无结算有发运", 3)]
public EnumPubSaSeCompareCategory Category { get; set; }
/// <summary>
/// Wms发货单号
/// </summary>
[Display(Name = "Wms发货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime ShippingDate { get; set; }
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 生产码
/// </summary>
@ -633,7 +597,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime CustomerOfflineTime { get; set; }
public DateTime? CustomerOfflineTime { get; set; }
/// <summary>
/// 结算数量
@ -666,7 +630,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal FixPrice { get; set; }
public decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -689,9 +653,6 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
{
/// <summary>
/// 类别
/// 有结算有发运
/// 有结算无发运
/// 无结算有发运
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
@ -699,21 +660,18 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
[ValueMapping("有结算无发运", 2)]
[ValueMapping("无结算有发运", 3)]
public EnumPubSaSeCompareCategory Category { get; set; }
/// <summary>
/// Wms发货单号
/// </summary>
[Display(Name = "Wms发货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime ShippingDate { get; set; }
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 生产码
/// </summary>
@ -749,7 +707,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime CustomerOfflineTime { get; set; }
public DateTime? CustomerOfflineTime { get; set; }
/// <summary>
/// 结算数量
@ -781,7 +739,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal FixPrice { get; set; }
public decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -804,9 +762,6 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
{
/// <summary>
/// 类别
/// 有结算有发运
/// 有结算无发运
/// 无结算有发运
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
@ -814,21 +769,18 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
[ValueMapping("有结算无发运", 2)]
[ValueMapping("无结算有发运", 3)]
public EnumPubSaSeCompareCategory Category { get; set; }
/// <summary>
/// Wms发货单号
/// </summary>
[Display(Name = "Wms发货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime ShippingDate { get; set; }
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 生产码
/// </summary>
@ -864,7 +816,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime CustomerOfflineTime { get; set; }
public DateTime? CustomerOfflineTime { get; set; }
/// <summary>
/// 结算数量
/// </summary>
@ -895,7 +847,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal FixPrice { get; set; }
public decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>

2
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs

@ -42,7 +42,7 @@ public class PubSaSeCompareDapperRepository : DapperRepository<SettleAccountDbCo
A.WmsBillNum,
A.ShippingDate,
B.SettleDate CustomerOfflineTime,
ISNULL(A.PN,B.PN) PN,
ISNULL(A.PN,B.PN) PN,
A.SEQty,
B.SAQty,
B.Price FixPrice,

183
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaEdiSeCompareExportService.cs

@ -0,0 +1,183 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
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 Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// BBAC结算、Edi、发运对比导出服务
/// </summary>
public class JisBBACSaEdiSeCompareExportService : ITransientDependency, IExportJob
{
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
/// </summary>
public JisBBACSaEdiSeCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext)
{
_hubContext = hubContext;
_fileContainer = fileContainer;
_settleAccountDbContext = settleAccountDbContext;
}
/// <summary>
/// 导出
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> 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<BBAC_SE_EDI>().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<BBAC_SE_DETAIL>().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<BBAC_SE_EDI>()
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<BBAC_SE_DETAIL>()
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
}
}

183
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
{
/// <summary>
/// HBPO结算、Edi、发运对比导出服务
/// </summary>
public class JisHBPOSaEdiSeCompareExportService : ITransientDependency, IExportJob
{
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
/// </summary>
public JisHBPOSaEdiSeCompareExportService(
IBlobContainer<MyFileContainer> fileContainer,
SettleAccountDbContext settleAccountDbContext)
{
_fileContainer = fileContainer;
_settleAccountDbContext = settleAccountDbContext;
}
/// <summary>
/// 导出
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> 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<BBAC_SE_EDI>().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<BBAC_SE_DETAIL>().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<BBAC_SE_EDI>()
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<BBAC_SE_DETAIL>()
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
}
}

180
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
{
/// <summary>
/// 买单件BBAC结算、发运对比导出服务
/// </summary>
public class MaiDanBBACSaSeCompareExportService : SaSeCompareExportBaseService, ITransientDependency, IExportJob
{
/// <summary>
/// 业务类型
/// </summary>
private readonly EnumBusinessType businessType = EnumBusinessType.MaiDanJianBBAC;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
private readonly IObjectMapper _objectMapper;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
/// </summary>
public MaiDanBBACSaSeCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext) : base(hubContext)
{
_fileContainer = fileContainer;
_objectMapper = objectMapper;
_settleAccountDbContext = settleAccountDbContext;
}
/// <summary>
/// 导出
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> 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<DisplayAttribute>()?.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<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianBBAC>>(pubSaSeCompareDiffs);
var excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianBBAC>(items, businessTypeDisplayName);
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
Notify();
return id.ToString();
}
#region 私有方法
/// <summary>
/// 获取结算与发运比对数据
/// </summary>
public List<PubSaSeCompareDiff> GetSaSeCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{
//结算
var saGroup = from sa in _settleAccountDbContext.Set<BBAC_SA_DETAIL>()
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<BBAC_SE_DETAIL>()
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
}
}

181
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
{
/// <summary>
/// 买单件HBPO结算、发运对比导出服务
/// </summary>
public class MaiDanHBPOSaSeCompareExportService : SaSeCompareExportBaseService, ITransientDependency, IExportJob
{
/// <summary>
/// 业务类型
/// </summary>
private readonly EnumBusinessType businessType = EnumBusinessType.MaiDanJianHBPO;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
private readonly IObjectMapper _objectMapper;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
/// </summary>
public MaiDanHBPOSaSeCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext) : base(hubContext)
{
_fileContainer = fileContainer;
_objectMapper = objectMapper;
_settleAccountDbContext = settleAccountDbContext;
}
/// <summary>
/// 导出
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> 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<DisplayAttribute>()?.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<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianHBPO>>(pubSaSeCompareDiffs);
var excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPO>(items, businessTypeDisplayName);
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
Notify();
return id.ToString();
}
#region 私有方法
/// <summary>
/// 获取结算与发运比对数据
/// </summary>
public List<PubSaSeCompareDiff> GetSaSeCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{
//结算
var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>()
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<HBPO_SE_DETAIL>()
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
}
}

66
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

@ -283,14 +283,6 @@ namespace SettleAccount.Job.Services.Report
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianHBPO>(items, businessTypeDisplayName);
}
break;
case EnumBusinessType.MaiDanJianBBAC:
break;
case EnumBusinessType.MaiDanJianHBPO:
//{
// var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianHBPO>>(pubSaSeCompareDiffs);
// excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPO>(items, businessTypeDisplayName);
//}
break;
case EnumBusinessType.BeiJian:
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportBeiJian>>(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;
}
/// <summary>
/// 创建导出文件结构
@ -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}有结算无发货汇总输出");
}
/// <summary>
/// 通知
/// </summary>
private void Notify()
{
this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");

136
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
{
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
public SaSeCompareExportBaseService(IHubContext<PageHub> hubContext)
{
_hubContext = hubContext;
}
public virtual void HandlePubSaSeCompareDiffList(List<PubSaSeCompareDiff> 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;
}
});
}
/// <summary>
/// 创建导出文件结构
/// </summary>
public ExcelExporter BindExcelExporter<T>(List<T> 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}有结算无发货汇总输出");
}
/// <summary>
/// 通知
/// </summary>
public virtual void Notify()
{
_hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
}
}
}

1
code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs

@ -29,6 +29,7 @@ namespace SettleAccount.Job
{
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianBBAC>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianHBPO>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianBBAC>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianHBPO>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportBeiJian>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportYinDuJian>();

7
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<PubSaSeCompareExportService>();
context.Services.AddTransient<JisBBACEdiSeCompareExportService>();
context.Services.AddTransient<JisHBPOEdiSeCompareExportService>();
context.Services.AddTransient<JisHBPOEdiSeCompareExportService>();;
context.Services.AddTransient<MaiDanBBACSaSeCompareExportService>();
context.Services.AddTransient<MaiDanHBPOSaSeCompareExportService>();
context.Services.AddTransient<PubSaSeCompareExportService>();
context.Services.AddTransient<SettleAccountImportService>();
context.Services.AddTransient<InvoiceImportService>();
context.Services.AddTransient<InvoiceSettledDiffExportService>();

Loading…
Cancel
Save