学 赵 1 year ago
parent
commit
c304a89303
  1. 14
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs
  2. 16
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs
  3. 22
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs
  4. 20
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/app.js
  5. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/index.html
  6. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/layouts/logo.js
  7. 25
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js
  8. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js
  9. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/xiao-shou.js
  10. 145
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/adjust.js
  11. 139
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/backup.js
  12. 123
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance.js
  13. 145
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/log.js
  14. 128
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js
  15. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/request/index.js
  16. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js
  17. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js
  18. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/login.js
  19. 22
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/unable.js
  20. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/usable.js
  21. 27
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/vmi.js
  22. 17
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/adjust.js
  23. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/backup.js
  24. 17
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js
  25. 33
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/log.js
  26. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs
  27. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs
  28. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  29. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  30. 36
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs
  31. 26
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  32. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  33. 145
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  34. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  35. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  36. 19
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
  37. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs
  38. 165
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOEidSeCompareReport.cs
  39. 441
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs
  40. 151
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOEdiSeCompareExportService.cs

14
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs

@ -62,10 +62,10 @@ namespace AuthServer.Host
options.Languages.Add(new LanguageInfo("en", "en", "English")); options.Languages.Add(new LanguageInfo("en", "en", "English"));
}); });
context.Services.AddStackExchangeRedisCache(options => //context.Services.AddStackExchangeRedisCache(options =>
{ //{
options.Configuration = configuration["Redis:Configuration"]; // options.Configuration = configuration["Redis:Configuration"];
}); //});
context.Services.AddCors(options => context.Services.AddCors(options =>
{ {
@ -90,9 +90,9 @@ namespace AuthServer.Host
options.ApplicationName = "AuthServer"; options.ApplicationName = "AuthServer";
}); });
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); //var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services.AddDataProtection() //context.Services.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
} }
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)

16
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/BaseServiceHostModule.cs

@ -1,4 +1,4 @@
using BaseService.EntityFrameworkCore; using BaseService.EntityFrameworkCore;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
@ -145,14 +145,14 @@ namespace BaseService
private static void ConfigureRedis(ServiceConfigurationContext context, IConfiguration configuration) private static void ConfigureRedis(ServiceConfigurationContext context, IConfiguration configuration)
{ {
context.Services.AddStackExchangeRedisCache(options => //context.Services.AddStackExchangeRedisCache(options =>
{ //{
options.Configuration = configuration["Redis:Configuration"]; // options.Configuration = configuration["Redis:Configuration"];
}); //});
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); //var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services.AddDataProtection() //context.Services.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
} }
private void ConfigureDbContext() private void ConfigureDbContext()

22
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs

@ -375,18 +375,18 @@ namespace Win.Sfs.SettleAccount
{ {
var hostingEnvironment = context.Services.GetHostingEnvironment(); var hostingEnvironment = context.Services.GetHostingEnvironment();
context.Services.AddStackExchangeRedisCache(options => //context.Services.AddStackExchangeRedisCache(options =>
{ //{
options.Configuration = configuration["Redis:Configuration"]; // options.Configuration = configuration["Redis:Configuration"];
}); //});
if (!hostingEnvironment.IsDevelopment()) //if (!hostingEnvironment.IsDevelopment())
{ //{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); // var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services // context.Services
.AddDataProtection() // .AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys"); // .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
} //}
} }
private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration) private void ConfigureHangfire(ServiceConfigurationContext context, IConfiguration configuration)

20
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/app.js

@ -2,13 +2,16 @@ import html from "html";
import { ElConfigProvider } from "element-plus"; import { ElConfigProvider } from "element-plus";
import zh from "./lib/element-plus/locale/zh-cn.min.mjs"; import zh from "./lib/element-plus/locale/zh-cn.min.mjs";
import en from "./lib/element-plus/locale/en.min.mjs"; import en from "./lib/element-plus/locale/en.min.mjs";
import { reactive, onMounted } from "vue"; import { reactive, onMounted, onUnmounted } from "vue";
import { ElNotification } from "element-plus";
import { dayjs } from "element-plus";
export default { export default {
components: { ElConfigProvider }, components: { ElConfigProvider },
template: html` template: html`
<el-config-provider :locale="localeMap.get($i18n.locale)"> <el-config-provider :locale="localeMap.get($i18n.locale)">
<router-view></router-view> <router-view></router-view>
<el-popconfirm title="服务端已更新,是否刷新?"> </el-popconfirm>
</el-config-provider> </el-config-provider>
`, `,
setup() { setup() {
@ -18,7 +21,20 @@ export default {
["en", en], ["en", en],
]) ])
); );
onMounted(() => document.querySelector("#loading.loading").classList.remove("loading")); const event = "Refresh";
onMounted(() => {
document.querySelector("#loading.loading").classList.remove("loading");
PubSub.subscribe(event, async () => {
await ElNotification.closeAll();
ElNotification({
type: "warning",
title: `${dayjs(new Date()).format("YYYY-MM-DD HH:mm:ss")}`,
dangerouslyUseHTMLString: true,
message: `<a href="javascript:location.reload(true)">站点已更新,点击刷新!</a>`,
});
});
});
onUnmounted(() => PubSub.unsubscribe(event));
return { return {
localeMap, localeMap,
}; };

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/index.html

@ -4,6 +4,9 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<base href="/" /> <base href="/" />
<style> <style>
@keyframes loading-rotate { @keyframes loading-rotate {

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/layouts/logo.js

@ -2,12 +2,12 @@ import html from "html";
import { useAppStore } from "../store/index.js"; import { useAppStore } from "../store/index.js";
export default { export default {
template: html`<router-link to="/" class="logo"> template: html`<a href="javascript:location.reload(true)" class="logo">
<div class="flex h-full items-center"> <div class="flex h-full items-center">
<img src="/assets/logo.svg" /> <img src="/assets/logo.svg" />
<h1 v-if="!appStore.isMenuCollapse">{{$t('application')}}</h1> <h1 v-if="!appStore.isMenuCollapse">{{$t('application')}}</h1>
</div> </div>
</router-link>`, </a>`,
setup() { setup() {
const appStore = useAppStore(); const appStore = useAppStore();
return { return {

25
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js

@ -129,5 +129,28 @@ const billState = {
], ],
}; };
const codeType = {
title: "生产码类型",
type: "string",
input: "select",
options: [
{ value: "01", label: "前保" },
{ value: "02", label: "后保" },
{ value: "03", label: " 左门槛" },
{ value: "04", label: "右门槛" },
{ value: "05", label: "扰流板" },
{ value: "06", label: "前左轮眉" },
{ value: "07", label: "前右轮眉 " },
{ value: "08", label: "后左轮眉" },
{ value: "09", label: "后右轮眉" },
],
clearable: true,
rules: [
{
required: true,
},
],
};
export default businessType; export default businessType;
export { version, state, state2, state3, transType, deliverBillType, deliverSubBillType, proType, billState }; export { version, state, state2, state3, transType, deliverBillType, deliverSubBillType, proType, billState, codeType };

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/bei-jian.js

@ -24,7 +24,7 @@ const schema = {
}, },
date: { date: {
title: "合同签订时间", title: "合同签订时间",
type: "DateTime", type: "string",
}, },
contractNo: { contractNo: {
title: "合同号", title: "合同号",

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/base-data/xiao-shou.js

@ -27,7 +27,7 @@ const schema = {
date: { date: {
title: "合同签订时间", title: "合同签订时间",
type: "string", type: "string",
input: "datetime", input: "string",
}, },
contractNo: { contractNo: {
title: "合同号", title: "合同号",

145
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/adjust.js

@ -0,0 +1,145 @@
import { useLogSchema } from "./vmi.js";
const schema = useLogSchema();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/log`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = "settleaccount/vmi/edit-balance";
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/import`;
const exportUrl = `${baseUrl}/export`;
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
const importMethod = "POST";
const exportMethod = "POST";
export default function () {
return {
query: {
url: queryUrl,
method: queryMethod,
hasFilter: true,
schema: {
title: "通用代码",
type: "object",
properties: {
logTypes: { type: "array", hidden: true, default: ["Type500", "Type600"] },
filters: {
title: "项目",
type: "array",
hidden: true,
items: {
type: "object",
properties: {
logic: {
type: "int",
},
column: {
type: "string",
},
action: {
type: "int",
},
value: {
type: "string",
},
},
},
default: [
{
logic: "and",
column: "erpToLoc",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billType",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "vinCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "codeType",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "partCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "orderNum",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billTime",
action: "biggerThanOrEqual",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billTime",
action: "smallThanOrEqual",
value: null,
readOnly: true,
},
],
},
skipCount: {
hidden: true,
default: 0,
},
maxResultCount: {
hidden: true,
default: 10,
},
sorting: {
hidden: true,
},
},
},
},
table: {
schema: schema,
},
edit: {
detailsUrl,
createUrl,
updateUrl,
deleteUrl,
importUrl,
exportUrl,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
importMethod,
exportMethod,
schema: schema,
},
};
}

139
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/backup.js

@ -0,0 +1,139 @@
import useSchema from "./vmi.js";
const schema = useSchema();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/backup`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = `${baseUrl}/create`;
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/code-setting-upload-excel-import`;
const exportUrl = `${baseUrl}/backup-export`;
const invokeUrl = "settleaccount/vmi/invoke";
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
const importMethod = "POST";
const exportMethod = "POST";
const invokeMethod = "POST";
export default function () {
return {
query: {
url: queryUrl,
method: queryMethod,
hasFilter: true,
autoSubmit: true,
disableQueryOnLoad: true,
schema: {
title: "时点库存余额查询",
type: "object",
properties: {
name: {
title: "时间",
type: "string",
input: "select",
url: "settleaccount/vmi/snapshot",
value: "name",
label: "name",
defaultSelected: true,
clearable: false,
},
filters: {
title: "项目",
type: "array",
hidden: true,
items: {
type: "object",
properties: {
logic: {
type: "int",
},
column: {
type: "string",
},
action: {
type: "int",
},
value: {
type: "string",
},
},
},
default: [
{
logic: "and",
column: "erpToLoc",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "partCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "vinCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "codeType",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billType",
action: "equal",
value: null,
readOnly: true,
},
],
},
skipCount: {
hidden: true,
default: 0,
},
maxResultCount: {
hidden: true,
default: 10,
},
sorting: {
hidden: true,
},
},
},
},
table: {
schema: schema,
},
edit: {
detailsUrl,
createUrl,
updateUrl,
deleteUrl,
importUrl,
exportUrl,
invokeUrl,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
importMethod,
exportMethod,
invokeMethod,
schema: schema,
},
};
}

123
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/balance.js

@ -0,0 +1,123 @@
import useSchema from "./vmi.js";
const schema = useSchema();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/balance`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = `${baseUrl}/create`;
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/code-setting-upload-excel-import`;
const exportUrl = `${baseUrl}/balance-export`;
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
const importMethod = "POST";
const exportMethod = "POST";
export default function () {
return {
query: {
url: queryUrl,
method: queryMethod,
hasFilter: true,
schema: {
title: "寄售库存",
type: "object",
properties: {
filters: {
title: "项目",
type: "array",
hidden: true,
items: {
type: "object",
properties: {
logic: {
type: "int",
},
column: {
type: "string",
},
action: {
type: "int",
},
value: {
type: "string",
},
},
},
default: [
{
logic: "and",
column: "erpToLoc",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "partCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "vinCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "codeType",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billType",
action: "equal",
value: null,
readOnly: true,
},
],
},
skipCount: {
hidden: true,
default: 0,
},
maxResultCount: {
hidden: true,
default: 10,
},
sorting: {
hidden: true,
},
},
},
},
table: {
schema: schema,
},
edit: {
detailsUrl,
createUrl,
updateUrl,
deleteUrl,
importUrl,
exportUrl,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
importMethod,
exportMethod,
schema: schema,
},
};
}

145
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/log.js

@ -0,0 +1,145 @@
import { useLogSchema } from "./vmi.js";
const schema = useLogSchema();
const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/log`;
const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = `${baseUrl}/create`;
const updateUrl = `${baseUrl}/update/%s`;
const deleteUrl = `${baseUrl}/delete-list`;
const importUrl = `${baseUrl}/log-import`;
const exportUrl = `${baseUrl}/log-export`;
const queryMethod = "POST";
const detailsMethod = "POST";
const createMethod = "POST";
const updateMethod = "POST";
const deleteMethod = "POST";
const importMethod = "POST";
const exportMethod = "POST";
export default function () {
return {
query: {
url: queryUrl,
method: queryMethod,
hasFilter: true,
schema: {
title: "通用代码",
type: "object",
properties: {
// logTypes: { type: "array", hidden: true, default: ["Type200", "Type400"] },
filters: {
title: "项目",
type: "array",
hidden: true,
items: {
type: "object",
properties: {
logic: {
type: "int",
},
column: {
type: "string",
},
action: {
type: "int",
},
value: {
type: "string",
},
},
},
default: [
{
logic: "and",
column: "erpToLoc",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billType",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "vinCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "codeType",
action: "equal",
value: null,
readOnly: true,
},
{
logic: "and",
column: "partCode",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "orderNum",
action: "like",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billTime",
action: "biggerThanOrEqual",
value: null,
readOnly: true,
},
{
logic: "and",
column: "billTime",
action: "smallThanOrEqual",
value: null,
readOnly: true,
},
],
},
skipCount: {
hidden: true,
default: 0,
},
maxResultCount: {
hidden: true,
default: 10,
},
sorting: {
hidden: true,
},
},
},
},
table: {
schema: schema,
},
edit: {
detailsUrl,
createUrl,
updateUrl,
deleteUrl,
importUrl,
exportUrl,
detailsMethod,
createMethod,
updateMethod,
deleteMethod,
importMethod,
exportMethod,
schema: schema,
},
};
}

128
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/vmi.js

@ -0,0 +1,128 @@
import { deliverBillType, deliverSubBillType, codeType } from "../_options.js";
function useSchema() {
return {
title: "寄售库存",
type: "object",
properties: {
partCode: {
title: "LU零件号",
type: "string",
},
customerPartCode: {
title: "客户零件号",
type: "string",
},
codeType,
billType: deliverBillType,
qty: {
title: "数量",
type: "string",
},
billTime: {
title: "发运日期",
type: "string",
input: "datetime",
},
deliverTime: {
title: "订单日期",
type: "string",
input: "datetime",
},
erpToLoc: {
title: "ERP库位",
type: "string",
},
seq: {
title: "EDI顺序号",
type: "string",
},
orderNum: {
title: "客户订单号",
type: "string",
},
uniqueCode: {
title: "塑件唯一码",
type: "string",
},
matchNumber: {
title: "EDI总成号",
type: "string",
},
pjsNum: {
title: "PJIS生产顺序号",
type: "string",
},
reMark: {
title: "备注",
type: "string",
},
configcode: {
title: "配置码",
type: "string",
},
factory: {
title: "工厂",
type: "string",
},
subBillType: deliverSubBillType,
realCode: {
title: "WMS实发生产码",
type: "string",
},
vinCode: {
title: "EDI订单生产码",
type: "string",
},
settlementVinCode: {
title: "结算生产码",
type: "string",
},
},
};
}
function useLogSchema() {
return Object.assign(
{
changedNumber: {
title: "变动单号",
type: "string",
},
changedTime: {
title: "变动时间",
type: "string",
input: "datetime",
},
changedType: {
title: "变动类型",
type: "string",
input: "select",
options: [
{
value: 0,
label: "入库",
value: 1,
label: "出库",
},
],
},
changedBy: {
title: "变动人",
type: "string",
},
partCode2: {
title: "结算厂内零件号",
type: "string",
},
settlementVinCode: {
title: "结算生产码",
type: "string",
},
},
useSchema()
);
}
export default useSchema;
export { useLogSchema };

6
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/request/index.js

@ -91,15 +91,15 @@ async function request(url, data, options, notify = false) {
await addToken(defaultOptions); await addToken(defaultOptions);
const response = await fetch(url, defaultOptions); const response = await fetch(url, defaultOptions);
const result = await getResult(response); const result = await getResult(response);
if (result.data?.code && result.data.code !== 200) {
result.errors = result.data.message ?? result.data.code;
}
if (!result.errors && notify && (!result.data?.code || result.data.code === 200)) { if (!result.errors && notify && (!result.data?.code || result.data.code === 200)) {
ElMessage({ ElMessage({
type: "success", type: "success",
message: "操作成功", message: "操作成功",
}); });
} }
if (result.data?.code && result.data.code !== 200) {
result.errors = result.data.message;
}
return result; return result;
} }

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js

@ -333,7 +333,7 @@ export default [
children: [ children: [
{ {
...createPage("finance", `title=财务审核`), ...createPage("finance", `title=财务审核`),
component: "/settle/finance", component: "/settle/vmi",
children: [ children: [
createButton("query", "title=查询&isTop=true"), createButton("query", "title=查询&isTop=true"),
createButton("import", "title=导入开票文件&isTop=true"), createButton("import", "title=导入开票文件&isTop=true"),

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js

@ -119,7 +119,9 @@ const refreshRouter = async () => {
}); });
}; };
setPermission(serverRoutes); setPermission(serverRoutes);
router.removeRoute("layout"); if (router.hasRoute("layout")) {
router.removeRoute("layout");
}
const layout = { const layout = {
name: "layout", name: "layout",
path: "/", path: "/",

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/login.js

@ -20,7 +20,7 @@ export default {
<layout-locale /> <layout-locale />
</div> </div>
<el-card class="box-card" style="width:400px;"> <el-card class="box-card" style="width:400px;">
<app-form :schema="schema" v-model="model" :action="action" @submit="submit"> <app-form :schema="schema" v-model="model" @submit="submit">
<template #submitText>{{$t('login')}}</template> <template #submitText>{{$t('login')}}</template>
</app-form> </app-form>
</el-card> </el-card>

22
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/unable.js

@ -2,9 +2,9 @@ import AppList from "../../components/list/index.js";
import html from "html"; import html from "html";
import { ref } from "vue"; import { ref } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { ElMessageBox } from "element-plus";
import useConfig from "../../models/settle/detail.js"; import useConfig from "../../models/settle/detail.js";
import request from "../../request/index.js"; import request, { getUrl } from "../../request/index.js";
import { ElMessage } from "element-plus";
export default { export default {
components: { AppList }, components: { AppList },
@ -18,7 +18,23 @@ export default {
const url = config.edit.addUrl; const url = config.edit.addUrl;
if (item.path === "add") { if (item.path === "add") {
const data = appListRef.value.buildQuery(); const data = appListRef.value.buildQuery();
await appListRef.value.onClick(() => request(url, data, { method: "POST" }, true), `确认是否对所有符合查询条件的数据生成可结算单?`, true); await appListRef.value.onClick(
async () => {
const result = await request(url, data, { method: "POST" }, true);
if (result.errors) {
if (result.data.code === 400 && result.data.fileName) {
ElMessage({
type: "warnning",
message: "操作失败",
});
window.open(getUrl(`settleaccount/getblobfile/download/${result.data.fileName}`));
}
console.log(result);
}
},
`确认是否对所有符合查询条件的数据生成可结算单?`,
true
);
} }
}; };
return { appListRef, config, onCommand }; return { appListRef, config, onCommand };

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/usable.js

@ -2,7 +2,6 @@ import AppList from "../../components/list/index.js";
import html from "html"; import html from "html";
import { ref } from "vue"; import { ref } from "vue";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { ElMessageBox } from "element-plus";
import useConfig from "../../models/settle/usable.js"; import useConfig from "../../models/settle/usable.js";
import request from "../../request/index.js"; import request from "../../request/index.js";

27
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/settle/vmi.js

@ -4,7 +4,6 @@ import { useRoute } from "vue-router";
import { ref } from "vue"; import { ref } from "vue";
import useConfig from "../../models/settle/commerce.js"; import useConfig from "../../models/settle/commerce.js";
import AppCheck from "./_check.js"; import AppCheck from "./_check.js";
import request, { getUrl } from "../../request/index.js";
export default { export default {
components: { AppList, AppCheck }, components: { AppList, AppCheck },
@ -17,31 +16,7 @@ export default {
const businessType = route.meta.businessType; const businessType = route.meta.businessType;
const config = useConfig(businessType, "cai-wu"); const config = useConfig(businessType, "cai-wu");
const onCommand = async (item, rows) => { const onCommand = async (item, rows) => {
// if (item.path === "export-group") { console.log(item.path, item, rows);
// const url = config.edit.exportUrl;
// const method = config.edit.exportMethod;
// const postData = {
// filters: [
// {
// logic: "and",
// column: "invGroupNum",
// action: "equal",
// value: rows[0]["invGroupNum"],
// },
// ],
// };
// const getUrl = getUrl;
// await appListRef.value.onClick(async () => {
// const response = await request(url, postData, { method });
// if (!response.errors) {
// window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`));
// }
// });
// } else if (item.path === "invbillNum" || item.path === "invGroupNum") {
// data.value = { [item.path]: rows[0][item.path] };
// visable.value = true;
// }
// console.log(item.path, item, rows);
}; };
return { appListRef, config, onCommand, visable, data }; return { appListRef, config, onCommand, visable, data };
}, },

17
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/adjust.js

@ -1,15 +1,2 @@
import AppList from "../../../components/list/index.js"; import useList from "../_list.js";
import html from "html"; export default useList("vmi/adjust");
import useConfig from "../../../models/inventory/adjust.js";
export default {
components: { AppList },
template: html`<app-list :config="config" @command="onCommand" />`,
setup() {
const config = useConfig();
const onCommand = async (item, rows) => {
console.log(item.path, item, rows);
};
return { config, onCommand };
},
};

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/backup.js

@ -1,6 +1,6 @@
import AppList from "../../../components/list/index.js"; import AppList from "../../../components/list/index.js";
import html from "html"; import html from "html";
import useConfig from "../../../models/inventory/backup.js"; import useConfig from "../../../models/vmi/backup.js";
export default { export default {
components: { AppList }, components: { AppList },

17
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/balance.js

@ -1,15 +1,2 @@
import AppList from "../../../components/list/index.js"; import useList from "../_list.js";
import html from "html"; export default useList("vmi/balance");
import useConfig from "../../../models/inventory/balance.js";
export default {
components: { AppList },
template: html`<app-list :config="config" @command="onCommand" />`,
setup() {
const config = useConfig();
const onCommand = async (item, rows) => {
console.log(item.path, item, rows);
};
return { config, onCommand };
},
};

33
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/vmi/log.js

@ -1,6 +1,6 @@
import AppList from "../../../components/list/index.js"; import AppList from "../../../components/list/index.js";
import html from "html"; import html from "html";
import useConfig from "../../../models/inventory/log.js"; import useConfig from "../../../models/vmi/log.js";
import { ref } from "vue"; import { ref } from "vue";
import { schemaToModel } from "../../utils/index.js"; import { schemaToModel } from "../../utils/index.js";
import AppForm from "../../../components/form/index.js"; import AppForm from "../../../components/form/index.js";
@ -10,16 +10,18 @@ import request, { getUrl } from "../../request/index.js";
export default { export default {
components: { AppList, AppTable, AppForm }, components: { AppList, AppTable, AppForm },
template: html` template: html`
<app-list :config="config" @command="onCommand" /> <app-list ref="appListRef" :config="config" @command="onCommand" />
<el-dialog v-model="addDialogVisible" align-center :close-on-click-modal="false" destroy-on-close style="width:380px;height:480px;"> <el-dialog v-model="addDialogVisible" align-center :close-on-click-modal="false" destroy-on-close style="width:380px;">
<template #header>补货数据导出</template> <template #header>补货数据导出</template>
<el-scrollbar> <div v-loading="loading" style="height:100%;">
<el-row> <el-scrollbar style="height:calc(100% - -120px);">
<el-col> <el-row>
<app-form ref="addAdjFormRef" v-if="addDialogVisible && adjModel" :schema="adjSchema" v-model="adjModel" :hideButton="true" inline @submit="submitAdj" /> <el-col>
</el-col> <app-form ref="addAdjFormRef" v-if="addDialogVisible && adjModel" :schema="adjSchema" v-model="adjModel" :hideButton="true" inline @submit="submitAdj" />
</el-row> </el-col>
</el-scrollbar> </el-row>
</el-scrollbar>
</div>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button type="primary" @click="submitAdj">确定</el-button> <el-button type="primary" @click="submitAdj">确定</el-button>
@ -28,18 +30,25 @@ export default {
</el-dialog> </el-dialog>
`, `,
setup() { setup() {
const appListRef = ref(false);
const loading = ref(false);
const addDialogVisible = ref(false); const addDialogVisible = ref(false);
const addAdjFormRef = ref(null); const addAdjFormRef = ref(null);
const submitAdj = async () => { const submitAdj = async () => {
try { try {
const valid = await addAdjFormRef.value.validate();
loading.value = true;
const url = "settleaccount/vmi/replenished-export"; const url = "settleaccount/vmi/replenished-export";
const method = "POST"; const method = "POST";
const response = await request(url, null, { method }); const response = await request(url, adjModel.value, { method }, true);
if (!response.errors) { if (!response.errors) {
addDialogVisible.value = false;
window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`)); window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`));
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} finally {
loading.value = false;
} }
}; };
const adjSchema = { const adjSchema = {
@ -71,6 +80,8 @@ export default {
console.log(item.path, item, rows); console.log(item.path, item, rows);
}; };
return { return {
appListRef,
loading,
config, config,
onCommand, onCommand,
submitAdj, submitAdj,

2
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs

@ -86,7 +86,7 @@ public class BBAC_SA_DETAIL_DTO : EntityDto<Guid>
/// <summary> /// <summary>
/// 结算日期 /// 结算日期
/// </summary> /// </summary>
public DateTime SettleDate { set; get; } public string SettleDate { set; get; }
/// <summary> /// <summary>
/// 单价 /// 单价
/// </summary> /// </summary>

2
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs

@ -86,7 +86,7 @@ public class HBPO_SA_DETAIL_DTO : EntityDto<Guid>
/// <summary> /// <summary>
/// 结算日期 /// 结算日期
/// </summary> /// </summary>
public DateTime SettleDate { set; get; } public string SettleDate { set; get; }
/// <summary> /// <summary>
/// 单价 /// 单价
/// </summary> /// </summary>

9
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs

@ -112,6 +112,13 @@ public class ZhiGongJianBBACImportDto
[ImporterHeader(Name = "Delivery")] [ImporterHeader(Name = "Delivery")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
public string GroupNum { get; set; } public string GroupNum { get; set; }
/// <summary>
/// 根据Vendor=15663496过滤数据
/// </summary>
[Display(Name = "Vendor")]
[ImporterHeader(Name = "Vendor")]
public string Vendor { get; set; }
} }
/// <summary> /// <summary>
@ -440,7 +447,7 @@ public class PUB_SA_DETAIL_DTO : AuditedAggregateRoot<Guid>
/// <summary> /// <summary>
/// 结算日期 /// 结算日期
/// </summary> /// </summary>
public DateTime SettleDate { set; get; } public string SettleDate { set; get; }
/// <summary> /// <summary>
/// 单价 /// 单价
/// </summary> /// </summary>

12
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -414,6 +414,18 @@ public class TB_PRICE_LISTDto : AuditedEntityDto<Guid>
/// </summary> /// </summary>
[Display(Name = "版本")] [Display(Name = "版本")]
public string Version { set; get; } public string Version { set; get; }
/// <summary>
/// 合同签订时间
/// </summary>
[Display(Name = "合同签订时间")]
public string Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[Display(Name = "合同号")]
public string ContractNo { get; set; }
} }
/// <summary> /// <summary>

36
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/JobHostdService.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Threading; using System.Threading;
@ -21,6 +22,7 @@ public class JobHostdService : BackgroundService, IApplicationService
{ {
private readonly object _lockObj = new object(); private readonly object _lockObj = new object();
private readonly IServiceProvider _serviceProvider; private readonly IServiceProvider _serviceProvider;
private FileSystemWatcher _watcher;
private CancellationToken _stoppingToken; private CancellationToken _stoppingToken;
public JobHostdService(IServiceProvider serviceProvider) public JobHostdService(IServiceProvider serviceProvider)
@ -28,6 +30,40 @@ public class JobHostdService : BackgroundService, IApplicationService
this._serviceProvider = serviceProvider; this._serviceProvider = serviceProvider;
} }
public override Task StartAsync(CancellationToken cancellationToken)
{
var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot");
var filter = "*.js";
this._watcher = new FileSystemWatcher(path, filter);
this._watcher.NotifyFilter = NotifyFilters.Attributes
| NotifyFilters.CreationTime
| NotifyFilters.DirectoryName
| NotifyFilters.FileName
| NotifyFilters.LastAccess
| NotifyFilters.LastWrite
| NotifyFilters.Security
| NotifyFilters.Size;
this._watcher.Created += _watcher_Created;
this._watcher.Deleted += _watcher_Created;
this._watcher.Changed += _watcher_Created;
this._watcher.Renamed += _watcher_Created;
this._watcher.IncludeSubdirectories = true;
this._watcher.EnableRaisingEvents = true;
return base.StartAsync(cancellationToken);
}
private void _watcher_Created(object sender, FileSystemEventArgs e)
{
using var scope = this._serviceProvider.CreateScope();
scope.ServiceProvider.GetRequiredService<IHubContext<PageHub>>().Clients.All.ServerToClient("Refresh", e.FullPath, "");
}
public override Task StopAsync(CancellationToken cancellationToken)
{
this._watcher?.Dispose();
return base.StopAsync(cancellationToken);
}
public static List<Type> ServiceTypes { get; private set; } public static List<Type> ServiceTypes { get; private set; }
public ConcurrentDictionary<JobItem, Tuple<CancellationTokenSource, Thread>> Jobs { get; } = new(); public ConcurrentDictionary<JobItem, Tuple<CancellationTokenSource, Thread>> Jobs { get; } = new();

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

@ -231,15 +231,15 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
public async Task<IActionResult> DeleteListAsync(List<Guid> ids) public async Task<IActionResult> DeleteListAsync(List<Guid> ids)
{ {
//结算主表 //结算主表
List<PUB_SA> pubSas = new List<PUB_SA>(); var pubSas = new List<PUB_SA>();
//结算明细 //结算明细
List<PUB_SA_DETAIL> pubSaDetails = new List<PUB_SA_DETAIL>(); var pubSaDetails = new List<PUB_SA_DETAIL>();
//可结算主表 //可结算主表
List<PUB_CAN_SA> pubCanSas = new List<PUB_CAN_SA>(); var pubCanSas = new List<PUB_CAN_SA>();
//可结算明细 //可结算明细
List<PUB_CAN_SA_DETAIL> pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>(); var pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>();
//不可结算 //不可结算
List<PUB_NOT_SA_DETAIL> pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>(); var pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>();
foreach (var id in ids) foreach (var id in ids)
{ {
@ -294,6 +294,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
#region 导入数据转换 #region 导入数据转换
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var importResults = await _exportImporter.UploadExcelImport<ZhiGongJianBBACImportDto>(files, _excelImportService).ConfigureAwait(false); var importResults = await _exportImporter.UploadExcelImport<ZhiGongJianBBACImportDto>(files, _excelImportService).ConfigureAwait(false);
importResults = importResults.FindAll(t => t.Vendor == "15663496");
var importPubSaDetails = ObjectMapper.Map<List<ZhiGongJianBBACImportDto>, List<PUB_SA_DETAIL>>(importResults); var importPubSaDetails = ObjectMapper.Map<List<ZhiGongJianBBACImportDto>, List<PUB_SA_DETAIL>>(importResults);
#endregion #endregion
@ -413,7 +414,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
{ {
#region 导入数据转换 #region 导入数据转换
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var importResults = await _exportImporter.UploadExcelImport<YinDuJianImportDto>(files, _excelImportService); var importResults = await _exportImporter.UploadExcelImport<YinDuJianImportDto>(files, _excelImportService).ConfigureAwait(false);
importResults = importResults.FindAll(t => t.Supplier == "15663496"); importResults = importResults.FindAll(t => t.Supplier == "15663496");
var importPubSaDetails = ObjectMapper.Map<List<YinDuJianImportDto>, List<PUB_SA_DETAIL>>(importResults); var importPubSaDetails = ObjectMapper.Map<List<YinDuJianImportDto>, List<PUB_SA_DETAIL>>(importResults);
#endregion #endregion
@ -648,18 +649,17 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
private async Task<(List<PUB_SA> pubSas, List<PUB_SA_DETAIL> pubSaDetails, List<PUB_CAN_SA> pubCanSas, List<PUB_CAN_SA_DETAIL> pubCanSaDetails, List<PUB_NOT_SA_DETAIL> pubNotSaDetails)> GetPubSaDelItemsAsync(Guid id) private async Task<(List<PUB_SA> pubSas, List<PUB_SA_DETAIL> pubSaDetails, List<PUB_CAN_SA> pubCanSas, List<PUB_CAN_SA_DETAIL> pubCanSaDetails, List<PUB_NOT_SA_DETAIL> pubNotSaDetails)> GetPubSaDelItemsAsync(Guid id)
{ {
//结算主表 //结算主表
List<PUB_SA> pubSas = new List<PUB_SA>(); var pubSas = new List<PUB_SA>();
//结算明细 //结算明细
List<PUB_SA_DETAIL> pubSaDetails = new List<PUB_SA_DETAIL>(); var pubSaDetails = new List<PUB_SA_DETAIL>();
//可结算主表 //可结算主表
List<PUB_CAN_SA> pubCanSas = new List<PUB_CAN_SA>(); var pubCanSas = new List<PUB_CAN_SA>();
//可结算明细 //可结算明细
List<PUB_CAN_SA_DETAIL> pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>(); var pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>();
//不可结算 //不可结算
List<PUB_NOT_SA_DETAIL> pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>(); var pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>();
var pubSaEntity = await _repository.FirstOrDefaultAsync(t => t.Id.Equals(id)).ConfigureAwait(false); var pubSaEntity = await _repository.FindAsync(id).ConfigureAwait(false);
//var pubSaEntity = await _repository.FindAsync(id).ConfigureAwait(false);
if (pubSaEntity != null) if (pubSaEntity != null)
{ {
//结算单据 //结算单据

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -192,13 +192,9 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
/// </summary> /// </summary>
[HttpPost("invoke")] [HttpPost("invoke")]
[DisableValidation] [DisableValidation]
public virtual Task VmiBackup() public virtual async Task VmiBackup()
{ {
Task.Run(async () => await Invoke(_serviceProvider).ConfigureAwait(false);
{
await Invoke(_serviceProvider).ConfigureAwait(false);
});
return Task.CompletedTask;
} }
/// <summary> /// <summary>

145
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs

@ -174,150 +174,5 @@ public class PriceListAppService : SettleAccountApplicationBase<PriceList>
return await _priceListManager.DeleteListAsync(ids); return await _priceListManager.DeleteListAsync(ids);
} }
#endregion #endregion
#region 原方法(废弃)
// /// <summary>
// /// 获取总数
// /// </summary>
// private async Task<long> GetCountAsync(PriceListRequestDto input)
// {
// return await _priceListManager.GetCountAsync(input.Filters, GuidGenerator.Create());
// }
// /// <summary>
// /// 结算总成和ERP总成价格对比
// /// </summary>
// /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
// /// <returns></returns>
// [HttpGet]
// [Route("BomDiffPrice-Make")]
// [DisableRequestSizeLimit]
// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// public async Task<string> SettledPartAndErpPartPriceDiffMake(string version, string customerCode)
// {
// List<CustomCondition> customConditionList = new List<CustomCondition>();
// customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "Bom定价差异明细" });
// customConditionList.Add(new CustomCondition() { Name = "Version", Value = string.IsNullOrEmpty(version) ? string.Empty : version });
// customConditionList.Add(new CustomCondition() { Name = "CustomerCode", Value = string.IsNullOrEmpty(customerCode) ? string.Empty : customerCode });
// var _taskid = await _service.ExportEnqueueAsync("Bom定价差异明细", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(SettledPartAndErpPartPriceDiffExportService), customConditionList, (rs) =>
// {
// });
// return _taskid;
// }
// [HttpPost]
// [Route("job/list")]
// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// [UnitOfWork(false)]
// virtual public async Task<List<JobDto>> GetListAsync(JobRequestDto input)
// {
// return await _service.GetListAsync(input);
// }
// /// <summary>
// /// 按ID获取唯一实体
// /// </summary>
// /// <remarks>
// /// 返回实体全部属性
// /// </remarks>
// /// <param name="id">ID</param>
// /// <returns>实体DTO</returns>
// [HttpGet]
// [Route("{id}")]
// /// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PriceListDto> GetAsync(Guid id)
// {
// var result = await _priceListManager.GetAsync(id); ;
// var dto = ObjectMapper.Map<PriceList, PriceListDto>(result);
// return dto;
// }
// /// <summary>
// /// 根据筛选条件获取实体列表
// /// </summary>
// /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
// /// </remarks>
// /// <param name="input">请求条件</param>
// /// <returns>实体DTO列表</returns>
// [HttpPost]
// [Route("versionlist")]
//// [Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<PagedResultDto<PriceListVersionDto>> GetVersionListAsync(PriceListRequestDto input)
// {
// var entities = await _priceListManager.GetVersionListAsync(input.Filters, input.Sorting, input.MaxResultCount,input.SkipCount);
// var totalCount = await GetCountAsync(input);
// var dtos = ObjectMapper.Map<List<PriceListVersion>, List<PriceListVersionDto>>(entities);
// return new PagedResultDto<PriceListVersionDto>(totalCount, dtos);
// }
// /// <summary>
// /// 获取实体总数
// /// </summary>
// /// <returns>实体总数</returns>
// [HttpGet]
// [Route("count")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<long> GetTotalCountAsync(Guid branchId)
// {
// return await _priceListManager.GetCountAsync(new List<FilterCondition>(), branchId);
// }
// /// <summary>
// /// 获取全部实体列表
// /// </summary>
// /// <returns>实体DTO列表</returns>
// [HttpGet]
// [Route("all")]
// //[Authorize(SettleAccountPermissions.PriceLists.Default)]
// virtual public async Task<ListResultDto<PriceListDto>> GetAllAsync(Guid branchId)
// {
// var entities = await _priceListManager.GetAllAsync(branchId);
// var dtos = ObjectMapper.Map<List<PriceList>, List<PriceListDto>>(entities);
// return new ListResultDto<PriceListDto>(dtos);
// }
// /// <summary>
// /// 修改实体
// /// </summary>
// /// <param name="id">ID</param>
// /// <param name="input">修改实体DTO</param>
// /// <returns>实体DTO</returns>
// [HttpPut]
// [Route("{id}")]
// [Authorize(SettleAccountPermissions.PriceLists.Update)]
// virtual public async Task<PriceListDto> UpdateAsync(Guid id, PriceListDto input)
// {
// var entity = new PriceList(
// );
// var _ent = await _priceListManager.UpdateAsync(id, entity);
// var dto = ObjectMapper.Map<PriceList, PriceListDto>(_ent);
// return dto;
// }
#endregion
} }

13
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -542,7 +542,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapPriceList() private void CreateMapPriceList()
{ {
CreateMap<PriceList, TB_PRICE_LISTDto>(); CreateMap<PriceList, TB_PRICE_LISTDto>()
.ForMember(x => x.Date, y => y.MapFrom(d => d.Date.ToString("yyyy-MM-dd")));
CreateMap<PriceListImportDto, PriceList>() CreateMap<PriceListImportDto, PriceList>()
.ForMember(x => x.LU, y => y.MapFrom(y => y.PartNo)) .ForMember(x => x.LU, y => y.MapFrom(y => y.PartNo))
.ForMember(x => x.Price, y => y.MapFrom(y => y.TotalPrice)) .ForMember(x => x.Price, y => y.MapFrom(y => y.TotalPrice))
@ -1016,7 +1017,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapBBAC_SA_DETAIL() private void CreateMapBBAC_SA_DETAIL()
{ {
CreateMap<BBAC_SA_DETAIL, BBAC_SA_DETAIL_DTO>(); CreateMap<BBAC_SA_DETAIL, BBAC_SA_DETAIL_DTO>()
.ForMember(x => x.SettleDate, y => y.MapFrom(d => d.SettleDate.ToString("yyyy-MM-dd")));
CreateMap<BBAC_SA_DETAIL, BBAC_CAN_SA_DETAIL>() CreateMap<BBAC_SA_DETAIL, BBAC_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<BBAC_SA_DETAIL, BBAC_NOT_SA_DETAIL>() CreateMap<BBAC_SA_DETAIL, BBAC_NOT_SA_DETAIL>()
@ -1057,7 +1059,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapHBPO_SA_DETAIL() private void CreateMapHBPO_SA_DETAIL()
{ {
CreateMap<HBPO_SA_DETAIL, HBPO_SA_DETAIL_DTO>(); CreateMap<HBPO_SA_DETAIL, HBPO_SA_DETAIL_DTO>()
.ForMember(x => x.SettleDate, y => y.MapFrom(d => d.SettleDate.ToString("yyyy-MM-dd")));
CreateMap<HBPO_SA_DETAIL, HBPO_CAN_SA_DETAIL>() CreateMap<HBPO_SA_DETAIL, HBPO_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<HBPO_SA_DETAIL, HBPO_NOT_SA_DETAIL>() CreateMap<HBPO_SA_DETAIL, HBPO_NOT_SA_DETAIL>()
@ -1089,8 +1092,8 @@ namespace Win.Sfs.SettleAccount
/// </summary> /// </summary>
private void CreateMapPUB_SA_DETAIL() private void CreateMapPUB_SA_DETAIL()
{ {
CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_DTO>()
CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_DTO>(); .ForMember(x => x.SettleDate, y => y.MapFrom(d => d.SettleDate.ToString("yyyy-MM-dd")));
CreateMap<PUB_SA_DETAIL, PUB_CAN_SA_DETAIL>() CreateMap<PUB_SA_DETAIL, PUB_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<PUB_SA_DETAIL, PUB_NOT_SA_DETAIL>() CreateMap<PUB_SA_DETAIL, PUB_NOT_SA_DETAIL>()

8
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs

@ -48,16 +48,16 @@ public class VmiBalance : BasicAggregateRoot<Guid>, IHasConcurrencyStamp
/// 发货类型 /// 发货类型
/// </summary> /// </summary>
[Display(Name = "发货类型")] [Display(Name = "发货类型")]
public EnumDeliverBjBmpBillType BillType { get; set; } public EnumDeliverBjBmpBillType? BillType { get; set; }
[Display(Name = "数量")] [Display(Name = "数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
[Display(Name = "发运日期")] [Display(Name = "发运日期")]
public DateTime BillTime { get; set; } public DateTime? BillTime { get; set; }
[Display(Name = "订单日期")] [Display(Name = "订单日期")]
public DateTime DeliverTime { get; set; } public DateTime? DeliverTime { get; set; }
/// <summary> /// <summary>
/// ERP库位 /// ERP库位
@ -87,7 +87,7 @@ public class VmiBalance : BasicAggregateRoot<Guid>, IHasConcurrencyStamp
public string factory { get; set; } public string factory { get; set; }
[Display(Name = "发货子类型")] [Display(Name = "发货子类型")]
public EnumDeliverSubBillType SubBillType { get; set; } public EnumDeliverSubBillType? SubBillType { get; set; }
[Display(Name = "WMS实发生产码")] [Display(Name = "WMS实发生产码")]
public string RealCode { get; set; } public string RealCode { get; set; }

19
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs

@ -99,6 +99,9 @@ public class VmiLog : BasicAggregateRoot<Guid>
[Display(Name = "LU零件号")] [Display(Name = "LU零件号")]
public string PartCode { get; set; } public string PartCode { get; set; }
/// <summary>
/// 生产码
/// </summary>
[Display(Name = "生产码")] [Display(Name = "生产码")]
public string VinCode { get; set; } public string VinCode { get; set; }
@ -108,22 +111,26 @@ public class VmiLog : BasicAggregateRoot<Guid>
[Display(Name = "客户零件号")] [Display(Name = "客户零件号")]
public string CustomerPartCode { get; set; } public string CustomerPartCode { get; set; }
/// <summary>
/// 生产码类型
/// </summary>
[Display(Name = "生产码类型")] [Display(Name = "生产码类型")]
public string CodeType { get; set; } public string CodeType { get; set; }
[Display(Name = "发货类型")]
public EnumDeliverBjBmpBillType BillType { get; set; }
/// <summary> /// <summary>
/// 数量 /// 发货类型
/// </summary> /// </summary>
[Display(Name = "发货类型")]
public EnumDeliverBjBmpBillType? BillType { get; set; }
[Display(Name = "数量")] [Display(Name = "数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
[Display(Name = "发运日期")] [Display(Name = "发运日期")]
public DateTime BillTime { get; set; } public DateTime? BillTime { get; set; }
[Display(Name = "订单日期")] [Display(Name = "订单日期")]
public DateTime DeliverTime { get; set; } public DateTime? DeliverTime { get; set; }
/// <summary> /// <summary>
/// ERP库位 /// ERP库位
@ -153,7 +160,7 @@ public class VmiLog : BasicAggregateRoot<Guid>
public string factory { get; set; } public string factory { get; set; }
[Display(Name = "发货子类型")] [Display(Name = "发货子类型")]
public EnumDeliverSubBillType SubBillType { get; set; } public EnumDeliverSubBillType? SubBillType { get; set; }
[Display(Name = "WMS实发生产码")] [Display(Name = "WMS实发生产码")]
public string RealCode { get; set; } public string RealCode { get; set; }

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs

@ -77,13 +77,13 @@ public class JisBBACEidSeCompareExport
/// </summary> /// </summary>
[Display(Name = "序列号")] [Display(Name = "序列号")]
[ExporterHeader(DisplayName = "序列号")] [ExporterHeader(DisplayName = "序列号")]
public string { get; set; } public string Seq { get; set; }
/// <summary> /// <summary>
/// PJIS日顺序号 /// PJIS日顺序号
/// </summary> /// </summary>
[Display(Name = "PJIS日顺序号")] [Display(Name = "PJIS日顺序号")]
[ExporterHeader(DisplayName = "PJIS日顺序号")] [ExporterHeader(DisplayName = "PJIS日顺序号")]
public string PJIS日顺序号 { get; set; } public string PjsNum { get; set; }
/// <summary> /// <summary>
/// 物料号 /// 物料号
/// </summary> /// </summary>
@ -113,7 +113,7 @@ public class JisBBACEidSeCompareExport
/// </summary> /// </summary>
[Display(Name = "WMS发货与EDI数量差")] [Display(Name = "WMS发货与EDI数量差")]
[ExporterHeader(DisplayName = "WMS发货与EDI数量差")] [ExporterHeader(DisplayName = "WMS发货与EDI数量差")]
public decimal DiffQty { set; get; } public decimal DiffQty => SEQty - EdiQty;
/// <summary> /// <summary>
/// 客户下线时间 /// 客户下线时间
/// </summary> /// </summary>

165
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOEidSeCompareReport.cs

@ -0,0 +1,165 @@
using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
namespace Win.Sfs.SettleAccount.Reports;
/// <summary>
/// JisHBPO Edi与发运对比
/// </summary>
public class JisHBPOEidSeCompareReport
{
}
/// <summary>
/// JisHBPO Edi与发运对比导出
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class JisHBPOEidSeCompareExport
{
/// <summary>
/// 类别
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
public string Category { get; set; }
/// <summary>
/// 交货单号
/// </summary>
[Display(Name = "交货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// CarModeCode
/// </summary>
[Display(Name = "CarModeCode")]
[ExporterHeader(DisplayName = "CarModeCode")]
public string CarModeCode { get; set; }
/// <summary>
/// LineStationcode
/// </summary>
[Display(Name = "LineStationcode")]
[ExporterHeader(DisplayName = "LineStationcode")]
public string LineStationcode { get; set; }
/// <summary>
/// SequenceNumber
/// </summary>
[Display(Name = "SequenceNumber")]
[ExporterHeader(DisplayName = "SequenceNumber")]
public string SequenceNumber { get; set; }
/// <summary>
/// ParType
/// </summary>
[Display(Name = "ParType")]
[ExporterHeader(DisplayName = "ParType")]
public string ParType { get; set; }
/// <summary>
/// 配置码
/// </summary>
[Display(Name = "配置码")]
[ExporterHeader(DisplayName = "配置码")]
public string MESConfigCode { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 实际发货生产号
/// </summary>
[Display(Name = "实际发货生产号")]
[ExporterHeader(DisplayName = "实际发货生产号")]
public string RealCode { get; set; }
/// <summary>
/// 生产码
/// </summary>
[Display(Name = "生产码")]
[ExporterHeader(DisplayName = "生产码")]
public string PN { get; set; }
/// <summary>
/// 序列号
/// </summary>
[Display(Name = "序列号")]
[ExporterHeader(DisplayName = "序列号")]
public string Seq { get; set; }
/// <summary>
/// PJIS日顺序号
/// </summary>
[Display(Name = "PJIS日顺序号")]
[ExporterHeader(DisplayName = "PJIS日顺序号")]
public string PjsNum { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
[Display(Name = "WMS目标库位")]
[ExporterHeader(DisplayName = "WMS目标库位")]
public string ToLoc { get; set; }
/// <summary>
/// ERP目标库位
/// </summary>
[Display(Name = "ERP目标库位")]
[ExporterHeader(DisplayName = "ERP目标库位")]
public string ErpToLoc { get; set; }
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号")]
[ExporterHeader(DisplayName = "物料号")]
public string MaterialNumber { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string MaterialDes { get; set; }
/// <summary>
/// WMS发货数量
/// </summary>
[Display(Name = "WMS发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// EDI数量
/// </summary>
[Display(Name = "EDI数量")]
[ExporterHeader(DisplayName = "EDI数量")]
public decimal EdiQty { get; set; }
/// <summary>
/// WMS发货与EDI数量差
/// </summary>
[Display(Name = "WMS发货与EDI数量差")]
[ExporterHeader(DisplayName = "WMS发货与EDI数量差")]
public decimal DiffQty => SEQty - EdiQty;
/// <summary>
/// 客户下线时间
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime? AssemblyDate { get; set; }
/// <summary>
/// 小总成号
/// </summary>
[Display(Name = "小总成号")]
[ExporterHeader(DisplayName = "小总成号")]
public string MatchNumber { get; set; }
/// <summary>
/// 注塑码
/// </summary>
[Display(Name = "注塑码")]
[ExporterHeader(DisplayName = "注塑码")]
public string InjectionCode { get; set; }
/// <summary>
/// 是否完全匹配
/// </summary>
[Display(Name = "是否完全匹配")]
[ExporterHeader(DisplayName = "是否完全匹配")]
public string MateType { get; set; }
/// <summary>
/// 差异说明
/// </summary>
[Display(Name = "差异说明")]
[ExporterHeader(DisplayName = "差异说明")]
public string DiffDesc { get; set; }
}

441
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs

@ -27,19 +27,12 @@ namespace SettleAccount.Job.Services.Report
/// HubContext /// HubContext
/// </summary> /// </summary>
private readonly IHubContext<PageHub> _hubContext; private readonly IHubContext<PageHub> _hubContext;
/// <summary> /// <summary>
/// 文件容器 /// 文件容器
/// </summary> /// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer; private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
private readonly IObjectMapper _objectMapper;
/// <summary> /// <summary>
/// AutoMapper /// DbContext
/// </summary> /// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext; private readonly SettleAccountDbContext _settleAccountDbContext;
@ -54,7 +47,6 @@ namespace SettleAccount.Job.Services.Report
{ {
_hubContext = hubContext; _hubContext = hubContext;
_fileContainer = fileContainer; _fileContainer = fileContainer;
_objectMapper = objectMapper;
_settleAccountDbContext = settleAccountDbContext; _settleAccountDbContext = settleAccountDbContext;
} }
@ -66,373 +58,118 @@ namespace SettleAccount.Job.Services.Report
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value;
var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value;
var seStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value; var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var seEndDateTime = property.Where(p => p.Name == "SeEndDateTime").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(); var filename = exportName.FirstOrDefault();
//有EDI无发运 //有EDI无发运
var haveEdiNotHaveSe = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false) var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.LU, t.PN }) .GroupBy(t => new { t.LU, t.PN })
.Select(t => new JisBBACEidSeCompareExport() .Select(t => new JisBBACEidSeCompareExport()
{ {
Category = "JIS", Category = "JIS",
WmsBillNum = default,
CarModeCode = default, CarModeCode = default,
LineStationcode = default, LineStationcode = default,
SequenceNumber = default, SequenceNumber = t.Max(t => t.SeqNumber),
ParType = default, ParType = "01",
MESConfigCode = default, EdiQty = t.Sum(t => t.Qty),
ShippingDate = null, AssemblyDate = default,
PN = default,
= default,
PJIS日顺序号 = default,
MaterialNumber = default,
MaterialDes = default,
SEQty = default,
EdiQty = default,
DiffQty = default,
AssemblyDate = null,
MatchNumber = default, MatchNumber = default,
InjectionCode = default, MateType = "否",
MateType = default, DiffDesc = "WMS漏发货EDI有订单"
DiffDesc = default
}).ToList(); }).ToList();
//无EDI有发运 //无EDI有发运
var notHaveEdiHaveSe = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false) var notHaveEdiHaveSeList = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false)
.GroupBy(t => new { t.LU, t.PN }) .GroupBy(t => new { t.LU, t.PN })
.Select(t => new JisBBACEidSeCompareExport() .Select(t => new JisBBACEidSeCompareExport()
{ {
Category = default, Category = "JIS",
WmsBillNum = default, WmsBillNum = t.Max(t => t.BillNum),
CarModeCode = default, MESConfigCode = t.Max(t => t.MESConfigCode),
LineStationcode = default, ShippingDate = t.Max(t => t.BillTime),
SequenceNumber = default, PN = t.Max(t => t.PN),
ParType = default, Seq = t.Max(t => t.Seq),
MESConfigCode = default, PjsNum = t.Max(t => t.PjsNum),
ShippingDate = null, MaterialNumber = t.Max(t => t.CustPartCode),
PN = default, MaterialDes = t.Max(t => t.PartDesc),
= default, SEQty = t.Sum(t => t.Qty),
PJIS日顺序号 = default, InjectionCode = t.Max(t => t.InjectionCode),
MaterialNumber = default, MateType = "否",
MaterialDes = default, DiffDesc = "WMS有发货EDI无订单"
SEQty = default,
EdiQty = default,
DiffQty = default,
AssemblyDate = null,
MatchNumber = default,
InjectionCode = default,
MateType = default,
DiffDesc = default
}).ToList(); }).ToList();
//有EDI有发运
var ediGroup = from edi in _settleAccountDbContext.Set<BBAC_SE_EDI>()
// //有EDI的发运数据 where edi.IsDeleted == false && edi.IsHaveSeData == true
// //var haveEidSesGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => group edi by new { edi.PN, edi.LU } into groupItem
// //t.First().SetQty(t.Sum(q => q.Qty))).ToList(); select new
// var seDetailGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }).ToList(); {
groupItem.Key.PN,
// // var haveEidSesGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => groupItem.Key.LU,
// //t.FirstOrDefault()).ToList(); Qty = groupItem.Sum(t => t.Qty),
SeqNumber = groupItem.Max(t => t.SeqNumber)
// var dddd = new JisBBACEidSeCompareExport() };
// { var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
// Category = default, where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime
// WmsBillNum = default, group se by new { se.PN, se.LU } into groupItem
// CarModeCode = default, select new
// LineStationcode = default, {
// SequenceNumber = default, groupItem.Key.PN,
// ParType = default, groupItem.Key.LU,
// MESConfigCode = default, Qty = groupItem.Sum(t => t.Qty),
// ShippingDate = default, BillNum = groupItem.Max(t => t.BillNum),
// PN = default, MESConfigCode = groupItem.Max(t => t.MESConfigCode),
// 序列号 = default, BillTime = groupItem.Max(t => t.BillTime),
// PJIS日顺序号 = default, Seq = groupItem.Max(t => t.Seq),
// MaterialNumber = default, PjsNum = groupItem.Max(t => t.PjsNum),
// MaterialDes = default, CustPartCode = groupItem.Max(t => t.CustPartCode),
// SEQty = default, PartDesc = groupItem.Max(t => t.PartDesc),
// EdiQty = default, InjectionCode = groupItem.Max(t => t.InjectionCode)
// DiffQty = default, };
// AssemblyDate = default, var haveEdiHaveSeList = (from edi in ediGroup
// MatchNumber = default, join se in seGroup
// InjectionCode = default, on new { edi.PN, edi.LU } equals new { se.PN, se.LU }
// MateType = default, //where edi.IsDeleted == false && edi.IsHaveSeData == true && se.IsHaveEdiData == true
// DiffDesc = default select new JisBBACEidSeCompareExport()
// }; {
Category = "JIS",
// var haveEidSesGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new JisBBACEidSeCompareExport() WmsBillNum = se.BillNum,
// { CarModeCode = default,
// Category = default, LineStationcode = default,
// WmsBillNum = default, SequenceNumber = edi.SeqNumber,
// CarModeCode = default, ParType = "01",
// LineStationcode = default, MESConfigCode = se.MESConfigCode,
// SequenceNumber = default, ShippingDate = se.BillTime,
// ParType = default, PN = se.PN,
// MESConfigCode = default, Seq = se.Seq,
// ShippingDate = default, PjsNum = se.PjsNum,
// PN = default, MaterialNumber = se.CustPartCode,
// 序列号 = default, MaterialDes = se.PartDesc,
// PJIS日顺序号 = default, SEQty = se.Qty,
// MaterialNumber = default, EdiQty = edi.Qty,
// MaterialDes = default, AssemblyDate = default,
// SEQty = default, MatchNumber = default,
// EdiQty = default, InjectionCode = se.InjectionCode,
// DiffQty = default, MateType = se.Qty == edi.Qty ? "是" : "否",
// AssemblyDate = default, DiffDesc = "WMS有发货EDI有订单"
// MatchNumber = default, }).ToList();
// InjectionCode = default,
// MateType = default, haveEdiNotHaveSeList.AddRange(haveEdiHaveSeList);
// DiffDesc = default notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
// }).ToList();
// var haveEidSesGroup22 = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true)?.GroupBy(t => new { t.PN, t.LU }).Select(t =>
//t.FirstOrDefault()).ToList();
//有发运的EDI数据
//var haveSeEidsGroup = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => t.First().SetQty(t.Sum(q => q.Qty))).ToList();
//var haveSeEidsGroup = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => t.First()).ToList();
//var haveEidHaveSes = from se in haveEidSesGroup
// join edi in haveSeEidsGroup
// on new { se.PN, se.LU } equals new { edi.PN, edi.LU }
// select new JisBBACEidSeCompareExport()
// {
// Category = default,
// WmsBillNum = default,
// CarModeCode = default,
// LineStationcode = default,
// SequenceNumber = default,
// ParType = default,
// MESConfigCode = default,
// ShippingDate = default,
// PN = default,
// 序列号 = default,
// PJIS日顺序号 = default,
// MaterialNumber = default,
// MaterialDes = default,
// SEQty = default,
// EdiQty = default,
// DiffQty = default,
// AssemblyDate = default,
// MatchNumber = default,
// InjectionCode = default,
// MateType = default,
// DiffDesc = default
// };
////无EDI的发运数据
//var notHaveEidSes = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false);
////无发运的EDI数据
//var notHaveSeEids = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false);
//var jisBBACEidSeCompareExports = new List<JisBBACEidSeCompareExport>();
////有EDI无发运
//var haveEdiNotHaveSeCompareExports = haveEidHaveSes.ToList();
////无EDI有发运
//var notHaveEdiHaveSeCompareExports = haveEidHaveSes.ToList();
ExcelExporter excelExporter = new ExcelExporter(); ExcelExporter excelExporter = new ExcelExporter();
excelExporter excelExporter
.Append(haveEdiNotHaveSe.ToList(), $"BBACEDI数据和发货对比") .Append(haveEdiNotHaveSeList, $"BBACEDI数据和发货对比")
.SeparateBySheet() .SeparateBySheet()
.Append(notHaveEdiHaveSe.ToList(), $"BBAC发货和EDI数据对比") .Append(notHaveEdiHaveSeList, $"BBAC发货和EDI数据对比");
.SeparateBySheet();
var result = excelExporter.ExportAppendDataAsByteArray(); var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true); _fileContainer.SaveAsync(filename, result.Result, true);
//Notify(); Notify();
return id.ToString();
var ids = id.ToString();
//var seDetailGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
//var ediDetailGroup = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
//var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se.PN, se.LU });
//var seDetails = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
//var ediDetails = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
////有EDI有发运
//var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
////有EDI无发运
//var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
////无EDI有发运
//var notHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
//seDetails.ForEach(t => t.IsHaveEdiData = true);
//ediDetails.ForEach(t => t.IsHaveSeData = true);
//db.Set<BBAC_SE_DETAIL>().UpdateRange(seDetails);
//db.Set<BBAC_SE_EDI>().UpdateRange(ediDetails);
//await db.SaveChangesAsync().ConfigureAwait(false);
//EnumBusinessType businessType = (EnumBusinessType)Enum.Parse(typeof(EnumBusinessType), strBusinessType);
//var businessTypeDisplayName = businessType.ToString();
//DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>();
//if (attributeOfType != null)
//{
// businessTypeDisplayName = attributeOfType.Name;
//}
//var filename = exportName.FirstOrDefault();
//var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime);
//pubSaSeCompareDiffs.ForEach(p =>
//{
// p.Category = (string.IsNullOrEmpty(p.SaLU), string.IsNullOrEmpty(p.SeLU)) switch
// {
// (false, false) => EnumPubSaSeCompareCategory.HaveSaHaveSe,
// (false, true) => EnumPubSaSeCompareCategory.HaveSaNotHaveSe,
// (true, false) => EnumPubSaSeCompareCategory.NotHaveSaHaveSe,
// _ => EnumPubSaSeCompareCategory.None,
// };
//});
////有结算有发运
//var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
////有结算无发运
//var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
////无结算有发运
//var notHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
////二次匹配上的记录
//var secondMatchHaveSaHaveSes = new List<PubSaSeCompareDiff>();
//haveSaHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SaLU);
//haveSaNotHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SaLU);
//notHaveSaHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SeLU);
//#region 二次对比
////二次对比(替换零件号)
//var repLUs = notHaveSaHaveSes.Select(t => t.SeLU).Distinct().ToList();
//var tbRePartsRelationships = _tbRePartsRelationshipRepository.GetListAsync(t => repLUs.Contains(t.RepLU) && t.BusinessType == businessType).Result;
//tbRePartsRelationships.ForEach(tbRePartsRelationship =>
//{
// notHaveSaHaveSes.FindAll(t => t.SeLU == tbRePartsRelationship.RepLU).ForEach(t =>
// {
// t.ReplaceLU = tbRePartsRelationship.LU;
// });
//});
//var haveSaNotHaveSeLUPNs = haveSaNotHaveSes.Select(t => new { t.ReplaceLU, t.PN });
//var notHaveSaHaveSeLUPNs = notHaveSaHaveSes.Select(t => new { t.ReplaceLU, t.PN });
////二次匹配 匹配上的零件号
//var secondMatchLUPNs = haveSaNotHaveSeLUPNs.Intersect(notHaveSaHaveSeLUPNs);
//if (secondMatchLUPNs.Any() == true)
//{
// pubSaSeCompareDiffs.RemoveAll<PubSaSeCompareDiff>(t => secondMatchLUPNs.Contains(new { t.ReplaceLU, t.PN }));
// foreach (var secondMatchLUPN in secondMatchLUPNs)
// {
// var haveSaNotHaveSe = haveSaNotHaveSes.FirstOrDefault(t => t.ReplaceLU == secondMatchLUPN.ReplaceLU && t.PN == secondMatchLUPN.PN);
// var notHaveSaHaveSe = notHaveSaHaveSes.FirstOrDefault(t => t.ReplaceLU == secondMatchLUPN.ReplaceLU && t.PN == secondMatchLUPN.PN);
// secondMatchHaveSaHaveSes.Add(new PubSaSeCompareDiff()
// {
// WmsBillNum = notHaveSaHaveSe.WmsBillNum,
// ShippingDate = notHaveSaHaveSe.ShippingDate,
// SeqNumber = notHaveSaHaveSe.SeqNumber,
// PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber,
// MaterialNumber = haveSaNotHaveSe.MaterialNumber,
// MaterialDes = haveSaNotHaveSe.MaterialDes,
// CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime,
// SAQty = haveSaNotHaveSe.SAQty,
// SEQty = notHaveSaHaveSe.SEQty,
// MateType = haveSaNotHaveSe.MateType,
// FixPrice = haveSaNotHaveSe.FixPrice,
// PrimitiveLU = haveSaNotHaveSe.PrimitiveLU,
// ReplaceLU = haveSaNotHaveSe.ReplaceLU,
// SeLU = notHaveSaHaveSe.SeLU,
// SaLU = haveSaNotHaveSe.SaLU,
// PN = haveSaNotHaveSe.PN,
// Category = EnumPubSaSeCompareCategory.HaveSaHaveSe,
// IsRemove = false
// });
// }
//}
////二次对比比对上的数据入库
//if (secondMatchHaveSaHaveSes.Count > 0)
//{
// pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
// var pubSeCDetailEntitys = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PUB_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
// _pubSeCDetailRepository.InsertManyAsync(pubSeCDetailEntitys);
//}
//#endregion
//if (string.IsNullOrEmpty(lu) == false)
//{
// pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.SaLU == lu || p.SeLU == lu);
//}
//if (string.IsNullOrEmpty(pn) == false)
//{
// pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
//}
//var pubSaSeCompareDetailExports = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExport>>(pubSaSeCompareDiffs);
////结算核对汇总
//var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
//{
// LU = p.Key,
// MaterialDes = p.FirstOrDefault().MaterialDes,
// 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.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
//{
// LU = p.Key,
// MaterialDes = p.FirstOrDefault().MaterialDes,
// SAQty = p.Sum(t => t.SAQty),
// SEQty = p.Sum(t => t.SEQty)
//}).ToList();
////有结算无发运
//var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
////有结算无发运
//var haveSaNotHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
//{
// LU = p.Key,
// MaterialDes = p.FirstOrDefault().MaterialDes,
// SAQty = p.Sum(t => t.SAQty),
// SEQty = p.Sum(t => t.SEQty)
//}).ToList();
////无结算有发运
//var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
////无结算有发运
//var notHaveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
//{
// LU = p.Key,
// MaterialDes = p.FirstOrDefault().MaterialDes,
// SAQty = p.Sum(t => t.SAQty),
// SEQty = p.Sum(t => t.SEQty)
//}).ToList();
//ExcelExporter excelExporter = new ExcelExporter();
//excelExporter
// .Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出")
// .SeparateBySheet()
// .Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
// .SeparateBySheet()
// .Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出")
// .SeparateBySheet()
// .Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出")
// .SeparateBySheet()
// .Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
// .SeparateBySheet()
// .Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出")
// .SeparateBySheet();
//var result = excelExporter.ExportAppendDataAsByteArray();
//result.ShouldNotBeNull();
//_fileContainer.SaveAsync(filename, result.Result, true);
//Notify();
return id.ToString(); return id.ToString();
} }

151
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOEdiSeCompareExportService.cs

@ -1,11 +1,18 @@
using System; using System;
using System.Collections.Generic; 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.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {
@ -14,25 +21,28 @@ namespace SettleAccount.Job.Services.Report
/// </summary> /// </summary>
public class JisHBPOEdiSeCompareExportService : ITransientDependency, IExportJob public class JisHBPOEdiSeCompareExportService : ITransientDependency, IExportJob
{ {
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary> /// <summary>
/// 文件容器 /// 文件容器
/// </summary> /// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer; private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary> /// <summary>
/// AutoMapper /// DbContext
/// </summary> /// </summary>
private readonly IObjectMapper _objectMapper; private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary> /// <summary>
/// 构造 /// 构造
/// </summary> /// </summary>
public JisHBPOEdiSeCompareExportService( public JisHBPOEdiSeCompareExportService(
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper) SettleAccountDbContext settleAccountDbContext)
{ {
_fileContainer = fileContainer; _fileContainer = fileContainer;
_objectMapper = objectMapper; _settleAccountDbContext = settleAccountDbContext;
} }
/// <summary> /// <summary>
@ -40,7 +50,134 @@ namespace SettleAccount.Job.Services.Report
/// </summary> /// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{ {
return ""; 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
} }
} }

Loading…
Cancel
Save