学 赵 1 year ago
parent
commit
c74592b01b
  1. 17
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Controllers/HomeController.cs
  2. 5
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs
  3. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  4. 127
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  5. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  6. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  7. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/jsconfig.json
  8. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/index.js
  9. 30
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/signalr/index.js
  10. 21
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Attributes/ExcelImporterHeadDescAttribute.cs
  11. 78
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  12. 62
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  13. 123
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
  14. 206
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  15. 56
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs
  16. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs
  17. 491
      code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs
  18. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  19. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/SettleAccount.Domain.Shared.csproj
  20. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs
  21. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/IJobService.cs
  22. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobItem.cs
  23. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobLog.cs
  24. 35
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  25. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiCategory.cs
  26. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
  27. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiOperatorType.cs
  28. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiSnapshot.cs
  29. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs
  30. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/MaterialRelationships/MaterialRelationship.cs
  31. 68
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs
  32. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs
  33. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBusinessType.cs
  34. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
  35. 12
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs
  36. 330
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  37. 4
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountEntityFrameworkCoreModule.cs
  38. 4035
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719004135_20230719-1.Designer.cs
  39. 56
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719004135_20230719-1.cs
  40. 4038
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719022720_20230719-2.Designer.cs
  41. 24
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719022720_20230719-2.cs
  42. 4259
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719032116_vmi.Designer.cs
  43. 173
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719032116_vmi.cs
  44. 4147
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719053130_20230719-3.Designer.cs
  45. 53
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719053130_20230719-3.cs
  46. 4371
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719090654_20230719-4.Designer.cs
  47. 45
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719090654_20230719-4.cs
  48. 348
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  49. 162
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs
  50. 19
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/SettleAccountDbContextFactory.cs
  51. 6
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/appsettings.json
  52. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Dispatcher/JobDispatcher.cs
  53. 288
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  54. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs
  55. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SignalR/PageHub.cs

17
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Controllers/HomeController.cs

@ -1,14 +1,29 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Job.SignalR;
using Volo.Abp.AspNetCore.Mvc;
namespace Win.Sfs.SettleAccount.Controllers
{
public class HomeController : AbpController
{
private readonly IHubContext<PageHub> _hubContext;
public HomeController(IHubContext<PageHub> hubContext)
{
this._hubContext = hubContext;
}
[ResponseCache(NoStore = true)]
public ActionResult Index()
{
return File("~/index.html", "text/html");
}
public IActionResult Test()
{
this._hubContext.Clients.All.ServerToClient("test", "hello", "");
return Json("ok");
}
}
}

5
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs

@ -1,5 +1,6 @@
using System;
using System;
using System.IO;
using Magicodes.ExporterAndImporter.Excel.Utility.TemplateExport;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
@ -39,10 +40,10 @@ namespace Win.Sfs.SettleAccount
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.WriteTo.Async(c => c.Console())
.CreateLogger();
try
{
Log.Information("Starting web host.");

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj

@ -20,6 +20,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Coravel" Version="4.2.1" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.24" />
<PackageReference Include="Hangfire.SqlServer" Version="1.7.24" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />

127
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -1,4 +1,8 @@
using Microsoft.AspNetCore.Builder;
using System;
using System.Linq;
using System.Text.RegularExpressions;
using Coravel;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Routing;
@ -6,47 +10,100 @@ using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Text.RegularExpressions;
using NUglify.Helpers;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
namespace Win.Sfs.SettleAccount;
namespace Win.Sfs.SettleAccount
public class Startup
{
public class Startup
public void ConfigureServices(IServiceCollection services)
{
public void ConfigureServices(IServiceCollection services)
services.AddSignalR(o => o.EnableDetailedErrors=true);
AppDomain.CurrentDomain.GetAssemblies().SelectMany(o => o.GetTypes())
.Where(o => o.IsClass && !o.IsAbstract && o.IsAssignableTo(typeof(IJobService)))
.ForEach(o => services.AddTransient(o));
services.AddScheduler();
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>();
services.Configure<KestrelServerOptions>(options =>
{
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>();
services.Configure<KestrelServerOptions>(options =>
{
// Set the limit to 256 MB
options.Limits.MaxRequestBodySize = 268435456;
});
//上传文件大小限制IIS设置
services.Configure<IISServerOptions>(options =>
{
options.MaxRequestBodySize = 268435456;
options.AllowSynchronousIO = true;
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
// Set the limit to 256 MB
options.Limits.MaxRequestBodySize = 268435456;
});
//上传文件大小限制IIS设置
services.Configure<IISServerOptions>(options =>
{
var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript");
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = contentTypeProvider });
app.InitializeApplication();
}
options.MaxRequestBodySize = 268435456;
options.AllowSynchronousIO = true;
});
}
public class SlugifyParameterTransformer : IOutboundParameterTransformer
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub"));
app.ApplicationServices.UseScheduler(scheduler =>
{
public string TransformOutbound(object value)
using var scope = app.ApplicationServices.CreateScope();
var jobs = scope.ServiceProvider.GetService<SettleAccountDbContext>().Set<JobItem>().ToList();
jobs?.ForEach(job =>
{
if (value == null) { return null; }
var str = value.ToString();
if (string.IsNullOrEmpty(str)) { return null; }
return Regex.Replace(str?.ToString(), "([a-z])([A-Z])", "$1-$2").ToLowerInvariant();
}
var jobId = job.Id;
using var scope = app.ApplicationServices.CreateScope();
var serviceType = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).FirstOrDefault(o => o.FullName == job.Service);
if (serviceType != null)
{
if (scope.ServiceProvider.GetService(serviceType) is IJobService jobService)
{
scheduler.Schedule(() =>
{
using var scope = app.ApplicationServices.CreateScope();
var db = scope.ServiceProvider.GetService<SettleAccountDbContext>();
var jobItemRepository = db.Set<JobItem>();
var jobLogRepository = db.Set<JobLog>();
var jobItem = jobItemRepository.FirstOrDefault(o => o.Id == jobId);
jobItem.IsRunning = true;
db.SaveChanges();
var jobLog = new JobLog { JobId = jobId, Start = DateTime.Now };
try
{
jobService.Invoke();
jobLog.Success = true;
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
jobLog.Exception = ex.ToString();
}
finally
{
jobLog.End = DateTime.Now;
jobLogRepository.Add(jobLog);
jobItem.IsRunning = false;
db.SaveChanges();
}
}).Cron(job.Cron);
}
}
});
});
var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript");
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = contentTypeProvider });
app.InitializeApplication();
}
public class SlugifyParameterTransformer : IOutboundParameterTransformer
{
public string TransformOutbound(object value)
{
if (value == null) { return null; }
var str = value.ToString();
if (string.IsNullOrEmpty(str)) { return null; }
return Regex.Replace(str?.ToString(), "([a-z])([A-Z])", "$1-$2").ToLowerInvariant();
}
}
}
}

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -1,4 +1,4 @@
{
{
"App": {
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
},

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

@ -33,7 +33,7 @@ export default {
:hideButton="true"
:isQueryForm="true"
>
<template v-for="item in filterList.filter(o=>o.readOnly)">
<template v-for="item in filterList.filter(o=>!o.hidden&&o.readOnly)">
<el-form-item :label="config.edit.schema.properties[item.column].title">
<app-form-input v-model="item" :schema="config.edit.schema.properties[item.column]" prop="value" />
</el-form-item>
@ -267,7 +267,7 @@ export default {
</template>
<template v-else-if="editFormMode==='filter'">
<el-form :model="filterList" inline class="filter">
<el-row v-for="(item,index) in filterList">
<el-row v-for="(item,index) in filterList.filter(o=>!o.hidden)">
<el-col :span="6">
<el-select clearable :disabled="item.readOnly" v-model="item.column" :placeholder="$t('字段')">
<template v-for="(value, prop) in config.edit.schema.properties">

4
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/jsconfig.json

@ -1,3 +1,7 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "ES6"
},
"exclude": ["node_modules", "files", "btsecsummary", "secsummary"]
}

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

@ -5,7 +5,7 @@ import NProgress from "../lib/nprogress/nprogress.vite-esm.js";
import { isLogin, hasPermission } from "../api/user.js";
import { useAppStore } from "../store/index.js";
import { listToTree } from "../utils/index.js";
import { connection, connect } from "../signalr/index.js";
import { connection, connect, connectionId } from "../signalr/index.js";
import remoteRoutes from "./routes.js";
NProgress.configure({ showSpinner: false });
@ -82,7 +82,7 @@ router.afterEach((to) => {
});
const refreshRouter = async () => {
//await connect();
await connect();
const appStore = useAppStore();
const permissions = appStore.user.permissions;
const serverRoutes = JSON.parse(JSON.stringify(remoteRoutes));

30
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/signalr/index.js

@ -13,20 +13,20 @@ const connection = new signalR.HubConnectionBuilder()
//.withAutomaticReconnect()
.build();
const connect = async () => {
// if (await isLogin()) {
// if (connection.state === signalR.HubConnectionState.Disconnected) {
// connection
// .start()
// .then(function () {
// console.log("signalr connected");
// })
// .catch(async function (error) {
// console.log(error);
// await isLogin();
// setTimeout(connect, 5000);
// });
// }
// }
if (await isLogin()) {
if (connection.state === signalR.HubConnectionState.Disconnected) {
connection
.start()
.then(function () {
console.log("signalr connected");
})
.catch(async function (error) {
console.log(error);
await isLogin();
setTimeout(connect, 5000);
});
}
}
};
connection.onclose(async () => {
await connect();
@ -38,4 +38,4 @@ connection.on("ServerToClient", (method, data) => {
PubSub.publish(method, data);
});
export { connection, connect };
export { connection, connect, connectionId };

21
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Attributes/ExcelImporterHeadDescAttribute.cs

@ -0,0 +1,21 @@
using System;
namespace Win.Sfs.SettleAccount.Attributes
{
/// <summary>
/// Excel导入头部描述
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class ExcelImporterHeadDescAttribute : Attribute
{
/// <summary>
/// 行数
/// </summary>
public int Row { get; set; }
/// <summary>
/// 列数
/// </summary>
public int Cell { get; set; }
}
}

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

@ -1,4 +1,4 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
@ -32,7 +32,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// <summary>
/// 导入
/// </summary>
public class ZGJ_PUB_SA_DETAIL_IMPORT_DTO
public class PUB_SA_DETAIL_IMPORT_DTO
{
///// <summary>
///// 期间
@ -103,11 +103,81 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}
/// <summary>
/// 导出
/// 结算明细导出请求
/// </summary>
public class PUB_SA_EXPORT_DTO
public class PUB_SA_DETAIL_EXPORT_REQUEST_DTO
{
/// <summary>
/// 结算单号
/// </summary>
[Display(Name = "结算单号")]
[Required(ErrorMessage = "{0}不能为空")]
public string BillNum { set; get; }
}
/// <summary>
/// 结算明细导出
/// </summary>
public class PUB_SA_DETAIL_EXPORT_DTO
{
/// <summary>
/// 结算单号
/// </summary>
[Display(Name = "结算单号")]
[ExporterHeader(DisplayName = "结算单号")]
public string BillNum { set; get; }
/// <summary>
/// 结算日期(收货日期)
/// </summary>
[Display(Name = "结算日期(收货日期)")]
[ExporterHeader(DisplayName = "Pstng Date")]
public DateTime SettleDate { set; get; }
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
[ExporterHeader(DisplayName = "Material")]
public string LU { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[ExporterHeader(DisplayName = "Quantity")]
public decimal Qty { get; set; }
/// <summary>
/// 发货单号
/// </summary>
[Display(Name = "发货单号")]
[ExporterHeader(DisplayName = "External Delivery ID")]
public string PN { get; set; }
/// <summary>
/// 结算分组
/// </summary>
[Display(Name = "结算分组")]
[ExporterHeader(DisplayName = "Delivery")]
public string GroupNum { get; set; }
}
/// <summary>
/// Pub结算与发运对比请求
/// </summary>
public class PubSaSeCompareRequestDto
{
/// <summary>
/// 期间
/// </summary>
[Display(Name = "期间")]
[Required(ErrorMessage = "{0}不能为空")]
public string Version { get; set; }
/// <summary>
/// 业务类型
/// </summary>
public EnumBusinessType BusinessType { get; set; }
}
}

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

@ -1,8 +1,10 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Win.Sfs.SettleAccount.Attributes;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.Shared.Filter;
@ -87,14 +89,43 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[Display(Name = "客户编码")]
[ExporterHeader(DisplayName = "客户编码")]
public string ClientCode { get; set; }
/// <summary>
/// 合同签订时间
/// </summary>
[Display(Name = "合同签订时间")]
[ExporterHeader(DisplayName = "合同签订时间")]
public DateTime Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[Display(Name = "合同号")]
[ExporterHeader(DisplayName = "合同号")]
public string ContractNo { get; set; }
}
/// <summary>
/// 销售价格导入
/// </summary>
[ImportProject(Name = SettleAccountModuleName.PriceList)]
[Importer(HeaderRowIndex = 22)]
public class PriceListImportDto
{
/// <summary>
/// 合同签订时间
/// </summary>
[ImporterHeader(IsIgnore = true)]
[ExcelImporterHeadDesc(Row = 1, Cell = 1)]
public string Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[ImporterHeader(IsIgnore = true)]
[ExcelImporterHeadDesc(Row = 2, Cell = 1)]
public string ContractNo { get; set; }
///// <summary>
///// ItemNo
///// </summary>
@ -265,8 +296,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
}
public class PriceListRequestDto : PagedAndSortedResultRequestDto
{
[Display(Name = "开始时间")]
public DateTime BeginDate { get; set; }
[Display(Name = "结算时间")]
@ -331,8 +360,22 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[ExporterHeader(DisplayName = "客户编码")]
public string ClientCode { get; set; }
/// <summary>
/// 合同签订时间
/// </summary>
[Display(Name = "合同签订时间")]
[ExporterHeader(DisplayName = "合同签订时间")]
public DateTime Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[Display(Name = "合同号")]
[ExporterHeader(DisplayName = "合同号")]
public string ContractNo { get; set; }
}
[Importer(HeaderRowIndex = 22)]
public class PriceListBJImportDto
{
/// <summary>
@ -353,6 +396,19 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[ImporterHeader(Name = "客户编码")]
public string ClientCode { get; set; }
/// <summary>
/// 合同签订时间
/// </summary>
[ImporterHeader(IsIgnore = true)]
[ExcelImporterHeadDesc(Row = 1, Cell = 1)]
public string Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[ImporterHeader(IsIgnore = true)]
[ExcelImporterHeadDesc(Row = 2, Cell = 1)]
public string ContractNo { get; set; }
}
public class PriceListBJRequestDto : RequestInputBase

123
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs

@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.Services;
using SettleAccount.Job.Services.Report;
using Shouldly;
using TaskJob.EventArgs;
using Volo.Abp;
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;
namespace Win.Sfs.SettleAccount.Entities.BQ;
/// <summary>
/// PUB结算明细
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
{
/// <summary>
/// PUB结算明细仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SA_DETAIL, Guid> _pubSaDetailRepository;
/// <summary>
/// PUB结算仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SA, Guid> _pubSaRepository;
/// <summary>
/// 任务服务
/// </summary>
private readonly TaskJobService _taskJobService;
/// <summary>
/// 构造
/// </summary>
public PUB_SA_DETAIL_SERVICE(INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository,
INormalEfCoreRepository<PUB_SA, Guid> pubSaRepository,
TaskJobService taskJobService,
IDistributedCache<PUB_SA_DETAIL> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_pubSaDetailRepository = pubSaDetailRepository;
_pubSaRepository = pubSaRepository;
_taskJobService = taskJobService;
}
#region 导出
/// <summary>
/// 导出
/// </summary>
[HttpPost]
public async Task<string> ExportAsync(PUB_SA_DETAIL_EXPORT_REQUEST_DTO input)
{
var pubSaEntity = await _pubSaRepository.FirstOrDefaultAsync(t => t.BillNum == input.BillNum);
if (pubSaEntity == null)
{
throw new UserFriendlyException($"导出失败,结算单号不存在!", "400");
}
var businessType = pubSaEntity.BusinessType;
var displayName = businessType.ToString();
DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
displayName = attributeOfType.Name;
}
string fileName = $"{displayName}的结算数据_{Guid.NewGuid()}.xlsx";
List<FilterCondition> filters = new List<FilterCondition>();
filters.Add(new FilterCondition("BillNum", input.BillNum, EnumFilterAction.Equal, EnumFilterLogic.And));
var entities = await _pubSaDetailRepository.GetListByFilterAsync(filters);
var dtos = ObjectMapper.Map<List<PUB_SA_DETAIL>, List<PUB_SA_DETAIL_EXPORT_DTO>>(entities);
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtos);
result.ShouldNotBeNull();
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result });
return fileName;
}
#endregion
#region 对比
/// <summary>
/// Pub结算与发运比对
/// </summary>
[HttpPost]
public async Task<string> PubSaSeCompare(PubSaSeCompareRequestDto pubSaSeCompareRequestDto)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = pubSaSeCompareRequestDto.Version });
customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = pubSaSeCompareRequestDto.BusinessType.ToString() });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与发运数据对比" });
var _taskid = await _taskJobService.ExportEnqueueAsync("Pub结算与发运核对汇总表", ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) =>
{
Console.WriteLine("TaskJob 回调了");
});
return _taskid;
}
#endregion
}

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

@ -1,16 +1,15 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NPOI.Util;
using NUglify.Helpers;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Extensions;
using NUglify.Helpers;
using SettleAccount.Domain.BQ;
using Shouldly;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
@ -24,6 +23,7 @@ using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -102,34 +102,109 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
}
#region 直供件
#region 导入、导出
/// <summary>
/// 导入
/// </summary>
[HttpPost]
public async Task<string> ImportByBusinessTypeAsync([FromForm] IFormFileCollection files, EnumBusinessType businessType)
{
return await ImportAsync(files, businessType);
}
#endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
public async Task<PagedResultDto<PUB_SA_DTO>> GetListAsync(RequestDto input)
{
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<PUB_SA>, List<PUB_SA_DTO>>(entities);
return new PagedResultDto<PUB_SA_DTO>(totalCount, dtos);
}
/// <summary>
/// 删除
/// </summary>
[HttpPost]
public async Task DeleteAsync(Guid id)
{
//结算主表
PUB_SA pubSaDelEntity;
//结算明细
List<PUB_SA_DETAIL> pubSaDetailDelEntitys;
//可结算主表
List<PUB_CAN_SA> pubCanSaDelEntitys;
//可结算明细
List<PUB_CAN_SA_DETAIL> pubCanSaDetailDelEntitys;
//不可结算
List<PUB_NOT_SA_DETAIL> pubNotSaDetailDelEntitys;
pubSaDelEntity = await _repository.FindAsync(id);
if (pubSaDelEntity == null) return;
//结算单据
string pubSaBillNum = pubSaDelEntity.BillNum;
pubCanSaDelEntitys = await _pubCanSaRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum);
//验证可结算主表状态
if (pubCanSaDelEntitys.Any(t => t.State != SettleBillState.))
{
throw new UserFriendlyException($"该单据可结算单状态无法删除!", "400");
}
pubSaDetailDelEntitys = await _pubSaDetailRepository.GetListAsync(t => t.BillNum == pubSaBillNum);
pubCanSaDetailDelEntitys = await _pubCanSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum);
pubNotSaDetailDelEntitys = await _pubNotSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum);
//删除
await _repository.DeleteAsync(pubSaDelEntity);
if (pubSaDetailDelEntitys != null)
{
await _pubSaDetailRepository.DeleteManyAsync(pubSaDetailDelEntitys);
}
if (pubCanSaDelEntitys != null)
{
await _pubCanSaRepository.DeleteManyAsync(pubCanSaDelEntitys);
}
if (pubCanSaDetailDelEntitys != null)
{
await _pubCanSaDetailRepository.DeleteManyAsync(pubCanSaDetailDelEntitys);
}
if (pubNotSaDetailDelEntitys != null)
{
await _pubNotSaDetailRepository.DeleteManyAsync(pubNotSaDetailDelEntitys);
}
}
#endregion
#region 导入、导出
#region 私有方法
/// <summary>
/// 导入
/// </summary>
[HttpPost]
public async Task<string> ZGJImportAsync([FromForm] IFormFileCollection files)
private async Task<string> ImportAsync([FromForm] IFormFileCollection files, EnumBusinessType businessType)
{
//数据校验
var checkList = new List<ErrorExportDto>();
//类型(直供件)
var businessType = EnumBusinessType.ZhiGongJian;
//结算单号
var pubSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA");
//结算主表
var pubSa = new PUB_SA()
{
BillNum = pubSaBillNum,
State = "1"
State = "1",
BusinessType = businessType
};
//结算明细
var pubSaDetails = new List<PUB_SA_DETAIL>();
//可算单号
//可算单号
var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C");
//可算主表
//可算主表
var pubCanSa = new PUB_CAN_SA()
{
BillNum = pubCanSaBillNum,
@ -147,8 +222,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
#region 导入数据转换、数据校验
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<ZGJ_PUB_SA_DETAIL_IMPORT_DTO>(files, _excelImportService);
var importPubSaDetails = ObjectMapper.Map<List<ZGJ_PUB_SA_DETAIL_IMPORT_DTO>, List<PUB_SA_DETAIL>>(result);
var result = await _exportImporter.UploadExcelImport<PUB_SA_DETAIL_IMPORT_DTO>(files, _excelImportService);
var importPubSaDetails = ObjectMapper.Map<List<PUB_SA_DETAIL_IMPORT_DTO>, List<PUB_SA_DETAIL>>(result);
//结算分组号
var pubSaGroupNums = importPubSaDetails.Select(t => t.GroupNum).Distinct();
@ -178,9 +253,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
importPubSaDetails.ForEach(importPubSaDetail =>
{
List<string> luList = importPubSaDetail.LU.Split(" ").ToList();
importPubSaDetail.LU = luList[0].Replace(" ", "");
if (luList.Count > 1)
{
importPubSaDetail.LU = luList[0].Replace(" ", "");
luList.RemoveAt(0);
var luAssemble = luList.Select(t => t.Replace(" ", ""));
importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
@ -209,7 +284,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
noExistSettleMaterialCodes.ForEach(t =>
{
var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t);
var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, businessType.ToString());
materialRelationships.Add(materialRelationship);
});
#endregion
@ -263,95 +338,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 导出
/// </summary>
[HttpPost]
public async Task<string> ExportAsync(RequestDto input)
{
string fileName = $"HBPO的EDI数据_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtos = ObjectMapper.Map<List<PUB_SA>, List<PUB_SA_EXPORT_DTO>>(entities);
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtos);
result.ShouldNotBeNull();
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result });
return fileName;
}
#endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
public async Task<PagedResultDto<PUB_SA_DTO>> GetListAsync(RequestDto input)
{
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<PUB_SA>, List<PUB_SA_DTO>>(entities);
return new PagedResultDto<PUB_SA_DTO>(totalCount, dtos);
}
/// <summary>
/// 删除
/// </summary>
[HttpPost]
public async Task DeleteAsync(Guid id)
{
//结算主表
PUB_SA pubSaDelEntity;
//结算明细
List<PUB_SA_DETAIL> pubSaDetailDelEntitys;
//可结算主表
List<PUB_CAN_SA> pubCanSaDelEntitys;
//可结算明细
List<PUB_CAN_SA_DETAIL> pubCanSaDetailDelEntitys;
//不可结算
List<PUB_NOT_SA_DETAIL> pubNotSaDetailDelEntitys;
pubSaDelEntity = await _repository.FindAsync(id);
if (pubSaDelEntity == null) return;
//结算单据
string pubSaBillNum = pubSaDelEntity.BillNum;
pubCanSaDelEntitys = await _pubCanSaRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum);
//验证可结算主表状态
if (pubCanSaDelEntitys.Any(t => t.State != SettleBillState.))
{
throw new UserFriendlyException($"该单据可结算单状态无法删除!", "400");
}
pubSaDetailDelEntitys = await _pubSaDetailRepository.GetListAsync(t => t.BillNum == pubSaBillNum);
pubCanSaDetailDelEntitys = await _pubCanSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum);
pubNotSaDetailDelEntitys = await _pubNotSaDetailRepository.GetListAsync(t => t.SettleBillNum == pubSaBillNum);
//删除
await _repository.DeleteAsync(pubSaDelEntity);
if (pubSaDetailDelEntitys != null)
{
await _pubSaDetailRepository.DeleteManyAsync(pubSaDetailDelEntitys);
}
if (pubCanSaDelEntitys != null)
{
await _pubCanSaRepository.DeleteManyAsync(pubCanSaDelEntitys);
}
if (pubCanSaDetailDelEntitys != null)
{
await _pubCanSaDetailRepository.DeleteManyAsync(pubCanSaDetailDelEntitys);
}
if (pubNotSaDetailDelEntitys != null)
{
await _pubNotSaDetailRepository.DeleteManyAsync(pubNotSaDetailDelEntitys);
}
}
#endregion
}
}

56
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiService.cs

@ -0,0 +1,56 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
namespace Win.Sfs.SettleAccount.Entities.BQ;
public interface IVmiService : IApplicationService, ITransientDependency, IJobService
{
string Test();
void In();
void Out();
IQueryable<VmiBalance> Query();
}
[ApiExplorerSettings(IgnoreApi = true)]
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class VmiService : IVmiService
{
[NonAction]
public void Invoke()
{
Console.WriteLine($"{nameof(VmiService)}:{DateTime.Now}");
}
[NonAction]
public void In()
{
throw new System.NotImplementedException();
}
[NonAction]
public void Out()
{
throw new System.NotImplementedException();
}
[HttpPost]
public IQueryable<VmiBalance> Query()
{
throw new System.NotImplementedException();
}
[HttpGet]
public string Test()
{
return "Test";
}
}

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

@ -1,9 +1,11 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using Shouldly;
using System;
using System.Collections.Generic;
@ -55,6 +57,17 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
// return new Microsoft.AspNetCore.Mvc.OkResult();
//}
private string GetOtherSheetStringValue(IWorkbook wk, String sheetName, String location)
{
ISheet sheet = wk.GetSheet(sheetName);
var cr = new CellReference(location);
var row = sheet.GetRow(cr.Row);
var cell = row.GetCell(cr.Col);
string result = cell.StringCellValue;
return result;
}
/// <summary>
/// 导入
/// </summary>
@ -63,7 +76,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PriceListImportDto>(files, _excelImportService);
var result = await _exportImporter.UploadExcelImportByHeadDesc<PriceListImportDto>(files, _excelImportService);
List<string> _checkls = new List<string>();
_checkls.Add("1040");
@ -75,7 +88,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
var entityList = ObjectMapper.Map<List<PriceListImportDto>, List<PriceList>>(result);
var _ls = entityList.OrderByDescending(p => p.BeginTime).GroupBy(p => new { p.LU, p.ClientCode }).Select(p => p.FirstOrDefault());
foreach (var itm in _ls)
{
itm.Update(GuidGenerator.Create(), version);

491
code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs

@ -30,6 +30,12 @@ using Win.Sfs.SettleAccount.Entities.Errors;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Magicodes.ExporterAndImporter.Excel.Utility;
using Magicodes.ExporterAndImporter.Core.Models;
using Magicodes.ExporterAndImporter.Core.Filters;
using OfficeOpenXml.Attributes;
using Win.Sfs.SettleAccount.Attributes;
using Magicodes.ExporterAndImporter.Core.Extension;
namespace Win.Sfs.SettleAccount.ExcelImporter
{
@ -38,7 +44,7 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
private readonly IExporter _csvExporter= new Magicodes.ExporterAndImporter.Csv.CsvExporter();//导出CSV
private readonly IExporter _csvExporter = new Magicodes.ExporterAndImporter.Csv.CsvExporter();//导出CSV
private readonly IExcelImporter _importer = new Magicodes.ExporterAndImporter.Excel.ExcelImporter();//导入Excel
private readonly IExporter _exporter = new ExcelExporter();//导出Excel
@ -50,7 +56,7 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
ExcelImportResult returnResult = new ExcelImportResult();
List<string> _errorList = new List<string>();
var importAttrib= type.GetCustomAttribute<ImportProjectAttribute>();
var importAttrib = type.GetCustomAttribute<ImportProjectAttribute>();
if (importAttrib != null)
{
@ -69,7 +75,7 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
{
throw new BusinessException("上传附件不能为空!");
}
string FileOriginName = file.FileName;
string getFileName = Path.GetFileName(FileOriginName);//获取附件名称
using (var memoryStream = new MemoryStream())
@ -98,18 +104,153 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
{
if (import.Exception.Message.ToString() == "导入文件不存在!")
{
throw new BusinessException("8989","文件容器配置的路径错误,请检查!");
throw new BusinessException("8989", "文件容器配置的路径错误,请检查!");
}
else
{
throw new BusinessException("8989", import.Exception.Message.ToString());
}
}
else
{
if (import.TemplateErrors.Count > 0)
{
throw new BusinessException("8989", "模板错误!当前模板中字段不匹配!!请正确上传模板数据!导入不对的列名:" + import.TemplateErrors.FirstOrDefault().RequireColumnName);
}
import.ShouldNotBeNull();
if (import.Exception != null)
{
//导入的数据有异常
throw new BusinessException(import.Exception.ToString());
}
returnResult.totalSize = import.Data.Count;
if (import.RowErrors.Count > 0)
{
foreach (var itm in import.RowErrors)
{
string error = string.Empty;
foreach (var dic in itm.FieldErrors)
{
error += (dic.Key + dic.Value + "|");
}
_errorList.Add(string.Format("第{0}行{1}", itm.RowIndex.ToString(), error));
}
//自动保存“{ 目标文件名称}_.xlsx”的标注文件到目标位置
//导入的数据有错误,比如重复列,必填项为空等(不包含警告),主要看DTO的设置
import.HasError.ShouldBeTrue();//标识导入的数据有错误
returnResult.errSize = import.RowErrors.Count;
returnResult.errTemplate = Path.GetFileNameWithoutExtension(FileOriginName) + "_.xlsx";//返回错误模板名称作为参数
returnResult.errMessage = "RowErrors";
}
else
{
import.HasError.ShouldBeFalse();//标识导入的数据没有错误了
if (import.Data.Count > 0)
{
ImportList.AddRange(import.Data.ToList());
}
returnResult.errMessage = "SccessData";
}
}
}
if (_errorList.Count > 0)
{
throw new BusinessException("8989", string.Join("\r\n", _errorList));
}
return ImportList;//返回客户端
}
public virtual async Task<List<T>> UploadExcelImportByHeadDesc<T>([FromForm] IFormFileCollection files, IExcelImportAppService _excelImportService)
where T : class, new()
{
Type type = typeof(T);
var ImportList = new List<T>();
ExcelImportResult returnResult = new ExcelImportResult();
List<string> _errorList = new List<string>();
foreach (var file in files)
{
if (file == null)
{
throw new BusinessException("上传附件不能为空!");
}
string FileOriginName = file.FileName;
string getFileName = Path.GetFileName(FileOriginName);//获取附件名称
using (var memoryStream = new MemoryStream())
{
//保存成物理文件
await file.CopyToAsync(memoryStream);
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = Path.GetFileName(FileOriginName),
Content = memoryStream.ToArray()
}
);
}
//读取文件保存的根目录
string fileSaveRootDir = ConfigDirHelper.GetAppSetting("App", "FileRootPath");
//读取WMS文件保存的模块的根目录
string fileSaveDir = ConfigDirHelper.GetAppSetting("App", "WMSFiles");
//文件保存的相对文件夹(保存到wwwroot目录下)
string absoluteFileDir = fileSaveRootDir + @"\" + fileSaveDir;
//文件保存的路径(应用的工作目录+文件夹相对路径);
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container" + absoluteFileDir;
var filePath = fileSavePath + getFileName;//获取到导入的excel
//var import = await _importer.Import<T>(filePath);
var import = new ImportResult<T>();
using (var importer = new ImportHelper<T>(filePath, null))
{
import = await importer.Import(null);
Stream Stream = new FileStream(filePath, FileMode.Open);
using (Stream)
{
IWorkbook wk = new XSSFWorkbook(Stream);
//读取当前表数据
ISheet sheet = wk.GetSheetAt(0);
var excelImporterHeadDescAttributeProperties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty)
.Where(o => o.GetCustomAttribute<ExcelImporterHeadDescAttribute>(true) != null);
foreach (var item in excelImporterHeadDescAttributeProperties)
{
string propertyName = item.Name;
var excelImporterHeadDesc = item.GetCustomAttribute<ExcelImporterHeadDescAttribute>();
var row = excelImporterHeadDesc.Row;
var cell = excelImporterHeadDesc.Cell;
var value = sheet.GetRow(row).GetCell(cell).ToString();
if (import.Data != null)
{
foreach (var item2 in import.Data)
{
item2.GetType().GetProperty(propertyName).SetValue(item2, value);
}
}
}
}
}
if (import.Exception != null)
{
if (import.Exception.Message.ToString() == "导入文件不存在!")
{
throw new BusinessException("8989", "文件容器配置的路径错误,请检查!");
}
else
{
throw new BusinessException("8989",import.Exception.Message.ToString());
throw new BusinessException("8989", import.Exception.Message.ToString());
}
}
else
{
if (import.TemplateErrors.Count > 0)
{
throw new BusinessException("8989","模板错误!当前模板中字段不匹配!!请正确上传模板数据!导入不对的列名:"+import.TemplateErrors.FirstOrDefault().RequireColumnName);
throw new BusinessException("8989", "模板错误!当前模板中字段不匹配!!请正确上传模板数据!导入不对的列名:" + import.TemplateErrors.FirstOrDefault().RequireColumnName);
}
import.ShouldNotBeNull();
if (import.Exception != null)
@ -125,10 +266,10 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
string error = string.Empty;
foreach (var dic in itm.FieldErrors)
{
error += (dic.Key+ dic.Value+"|");
error += (dic.Key + dic.Value + "|");
}
_errorList.Add(string.Format("第{0}行{1}", itm.RowIndex.ToString(),error));
_errorList.Add(string.Format("第{0}行{1}", itm.RowIndex.ToString(), error));
}
//自动保存“{ 目标文件名称}_.xlsx”的标注文件到目标位置
//导入的数据有错误,比如重复列,必填项为空等(不包含警告),主要看DTO的设置
@ -150,142 +291,142 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
}
if (_errorList.Count > 0)
{
throw new BusinessException("8989",string.Join("\r\n", _errorList));
throw new BusinessException("8989", string.Join("\r\n", _errorList));
}
return ImportList;//返回客户端
}
// public virtual async Task<List<T>> UploadExcelImport<T>([FromForm] IFormFileCollection files, IExcelImportAppService _excelImportService, ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> repository=null)
//where T : class, new()
// {
// Type type = typeof(T);
// var ImportList = new List<T>();
// ExcelImportResult returnResult = new ExcelImportResult();
// List<string> _errorList = new List<string>();
// //if (repository != null)
// //{
// // var importAttrib = type.GetCustomAttribute<ImportProjectAttribute>();
// // if (importAttrib != null)
// // {
// // var _columnList = repository.Where(p => p.ProjectName == importAttrib.Name);
// // if (_columnList.Count() > 0)
// // {
// // foreach (var itm in type.GetProperties())
// // {
// // var attrib = itm.GetCustomAttribute<ImporterHeaderAttribute>();
// // if (attrib != null)
// // {
// // var newColumn = _columnList.FirstOrDefault(p => p.OldColumnName == attrib.Name);
// // if (newColumn != null && !string.IsNullOrEmpty(newColumn.NewColumnName))
// // {
// // attrib.Name = !string.IsNullOrEmpty(newColumn.NewColumnName)? newColumn.NewColumnName:attrib.Name;
// // }
// // }
// // }
// // }
// // }
// //}
// foreach (var file in files)
// {
// if (file == null)
// {
// throw new BusinessException("上传附件不能为空!");
// }
// string FileOriginName = file.FileName;
// string getFileName = Path.GetFileName(FileOriginName);//获取附件名称
// using (var memoryStream = new MemoryStream())
// {
// //保存成物理文件
// await file.CopyToAsync(memoryStream);
// await _excelImportService.SaveBlobAsync(
// new SaveExcelImportInputDto
// {
// Name = Path.GetFileName(FileOriginName),
// Content = memoryStream.ToArray()
// }
// );
// }
// //读取文件保存的根目录
// string fileSaveRootDir = ConfigDirHelper.GetAppSetting("App", "FileRootPath");
// //读取WMS文件保存的模块的根目录
// string fileSaveDir = ConfigDirHelper.GetAppSetting("App", "WMSFiles");
// //文件保存的相对文件夹(保存到wwwroot目录下)
// string absoluteFileDir = fileSaveRootDir + @"\" + fileSaveDir;
// //文件保存的路径(应用的工作目录+文件夹相对路径);
// string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container" + absoluteFileDir;
// var filePath = fileSavePath + getFileName;//获取到导入的excel
// var import = await _importer.Import<T>(filePath);
// if (import.Exception != null)
// {
// if (import.Exception.Message.ToString() == "导入文件不存在!")
// {
// throw new BusinessException("8989", "文件容器配置的路径错误,请检查!");
// }
// else
// {
// throw new BusinessException("8989", import.Exception.Message.ToString());
// }
// }
// else
// {
// if (import.TemplateErrors.Count > 0)
// {
// throw new BusinessException("8989", "模板错误!当前模板中字段不匹配!!请正确上传模板数据!");
// }
// import.ShouldNotBeNull();
// if (import.Exception != null)
// {
// //导入的数据有异常
// throw new BusinessException(import.Exception.ToString());
// }
// returnResult.totalSize = import.Data.Count;
// if (import.RowErrors.Count > 0)
// {
// foreach (var itm in import.RowErrors)
// {
// string error = string.Empty;
// foreach (var dic in itm.FieldErrors)
// {
// error += (dic.Key + dic.Value + "|");
// }
// _errorList.Add(string.Format("第{0}行{1}", itm.RowIndex.ToString(), error));
// }
// //自动保存“{ 目标文件名称}_.xlsx”的标注文件到目标位置
// //导入的数据有错误,比如重复列,必填项为空等(不包含警告),主要看DTO的设置
// import.HasError.ShouldBeTrue();//标识导入的数据有错误
// returnResult.errSize = import.RowErrors.Count;
// returnResult.errTemplate = Path.GetFileNameWithoutExtension(FileOriginName) + "_.xlsx";//返回错误模板名称作为参数
// returnResult.errMessage = "RowErrors";
// }
// else
// {
// import.HasError.ShouldBeFalse();//标识导入的数据没有错误了
// if (import.Data.Count > 0)
// {
// ImportList.AddRange(import.Data.ToList());
// }
// returnResult.errMessage = "SccessData";
// }
// }
// }
// if (_errorList.Count > 0)
// {
// throw new BusinessException("8989", string.Join("\r\n", _errorList));
// }
// return ImportList;//返回客户端
// }
// public virtual async Task<List<T>> UploadExcelImport<T>([FromForm] IFormFileCollection files, IExcelImportAppService _excelImportService, ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> repository=null)
//where T : class, new()
// {
// Type type = typeof(T);
// var ImportList = new List<T>();
// ExcelImportResult returnResult = new ExcelImportResult();
// List<string> _errorList = new List<string>();
// //if (repository != null)
// //{
// // var importAttrib = type.GetCustomAttribute<ImportProjectAttribute>();
// // if (importAttrib != null)
// // {
// // var _columnList = repository.Where(p => p.ProjectName == importAttrib.Name);
// // if (_columnList.Count() > 0)
// // {
// // foreach (var itm in type.GetProperties())
// // {
// // var attrib = itm.GetCustomAttribute<ImporterHeaderAttribute>();
// // if (attrib != null)
// // {
// // var newColumn = _columnList.FirstOrDefault(p => p.OldColumnName == attrib.Name);
// // if (newColumn != null && !string.IsNullOrEmpty(newColumn.NewColumnName))
// // {
// // attrib.Name = !string.IsNullOrEmpty(newColumn.NewColumnName)? newColumn.NewColumnName:attrib.Name;
// // }
// // }
// // }
// // }
// // }
// //}
// foreach (var file in files)
// {
// if (file == null)
// {
// throw new BusinessException("上传附件不能为空!");
// }
// string FileOriginName = file.FileName;
// string getFileName = Path.GetFileName(FileOriginName);//获取附件名称
// using (var memoryStream = new MemoryStream())
// {
// //保存成物理文件
// await file.CopyToAsync(memoryStream);
// await _excelImportService.SaveBlobAsync(
// new SaveExcelImportInputDto
// {
// Name = Path.GetFileName(FileOriginName),
// Content = memoryStream.ToArray()
// }
// );
// }
// //读取文件保存的根目录
// string fileSaveRootDir = ConfigDirHelper.GetAppSetting("App", "FileRootPath");
// //读取WMS文件保存的模块的根目录
// string fileSaveDir = ConfigDirHelper.GetAppSetting("App", "WMSFiles");
// //文件保存的相对文件夹(保存到wwwroot目录下)
// string absoluteFileDir = fileSaveRootDir + @"\" + fileSaveDir;
// //文件保存的路径(应用的工作目录+文件夹相对路径);
// string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container" + absoluteFileDir;
// var filePath = fileSavePath + getFileName;//获取到导入的excel
// var import = await _importer.Import<T>(filePath);
// if (import.Exception != null)
// {
// if (import.Exception.Message.ToString() == "导入文件不存在!")
// {
// throw new BusinessException("8989", "文件容器配置的路径错误,请检查!");
// }
// else
// {
// throw new BusinessException("8989", import.Exception.Message.ToString());
// }
// }
// else
// {
// if (import.TemplateErrors.Count > 0)
// {
// throw new BusinessException("8989", "模板错误!当前模板中字段不匹配!!请正确上传模板数据!");
// }
// import.ShouldNotBeNull();
// if (import.Exception != null)
// {
// //导入的数据有异常
// throw new BusinessException(import.Exception.ToString());
// }
// returnResult.totalSize = import.Data.Count;
// if (import.RowErrors.Count > 0)
// {
// foreach (var itm in import.RowErrors)
// {
// string error = string.Empty;
// foreach (var dic in itm.FieldErrors)
// {
// error += (dic.Key + dic.Value + "|");
// }
// _errorList.Add(string.Format("第{0}行{1}", itm.RowIndex.ToString(), error));
// }
// //自动保存“{ 目标文件名称}_.xlsx”的标注文件到目标位置
// //导入的数据有错误,比如重复列,必填项为空等(不包含警告),主要看DTO的设置
// import.HasError.ShouldBeTrue();//标识导入的数据有错误
// returnResult.errSize = import.RowErrors.Count;
// returnResult.errTemplate = Path.GetFileNameWithoutExtension(FileOriginName) + "_.xlsx";//返回错误模板名称作为参数
// returnResult.errMessage = "RowErrors";
// }
// else
// {
// import.HasError.ShouldBeFalse();//标识导入的数据没有错误了
// if (import.Data.Count > 0)
// {
// ImportList.AddRange(import.Data.ToList());
// }
// returnResult.errMessage = "SccessData";
// }
// }
// }
// if (_errorList.Count > 0)
// {
// throw new BusinessException("8989", string.Join("\r\n", _errorList));
// }
// return ImportList;//返回客户端
// }
@ -305,10 +446,10 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
public virtual async Task<List<T>> ExtendExcelImport<T>([FromForm] IFormFileCollection files, IExcelImportAppService _excelImportService, List<ImportColumnMap> p_list=null)
public virtual async Task<List<T>> ExtendExcelImport<T>([FromForm] IFormFileCollection files, IExcelImportAppService _excelImportService, List<ImportColumnMap> p_list = null)
where T : class, new()
{
Type type = typeof(T);
var ImportList = new List<T>();
ExcelImportResult returnResult = new ExcelImportResult();
@ -354,7 +495,7 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
{
ImportList = _excelHelper.ExcelToList<T>();
}
}
return ImportList;//返回客户端
}
@ -432,40 +573,40 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
/// 获取配置下面的具体属性的值
/// </summary>
public class GetSetting
{
public string option1 { get; }
public GetSetting(IConfiguration Configuration)
{
public string option1 { get; }
public GetSetting(IConfiguration Configuration)
{
this.option1 = Configuration.GetSection("option1").Value;
}
this.option1 = Configuration.GetSection("option1").Value;
}
}
public class ExcelImportResult
{
/// <summary>
/// 导入的数据总数
/// </summary>
public long totalSize { get; set; }
/// <summary>
/// 成功的个数
/// </summary>
public long succeessSize { get; set; }
/// <summary>
/// 错误数据个数
/// </summary>
public long errSize { get; set; }
/// <summary>
/// 导入错误生成的模板名称
/// </summary>
public string errTemplate { get; set; }
/// <summary>
/// 返回错误信息
/// </summary>
public string errMessage { get; set; }
}
public class ExcelImportResult
{
/// <summary>
/// 导入的数据总数
/// </summary>
public long totalSize { get; set; }
/// <summary>
/// 成功的个数
/// </summary>
public long succeessSize { get; set; }
/// <summary>
/// 错误数据个数
/// </summary>
public long errSize { get; set; }
/// <summary>
/// 导入错误生成的模板名称
/// </summary>
public string errTemplate { get; set; }
/// <summary>
/// 返回错误信息
/// </summary>
public string errMessage { get; set; }
}

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

@ -1,4 +1,4 @@
using AutoMapper;
using AutoMapper;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.Entities.Boms;
@ -145,6 +145,7 @@ namespace Win.Sfs.SettleAccount
CreateMapPUB_SE_DETAIL();
CreateMapPUB_SA();
CreateMapPUB_SA_DETAIL();
CreateMapBBAC_CAN_SA();
@ -488,7 +489,8 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.Price, y => y.MapFrom(y => y.TotalPrice))
.ForMember(x => x.BeginTime, y => y.MapFrom(y => y.ValidFrom))
.ForMember(x => x.EndTime, y => y.MapFrom(y => y.ValidTo))
.ForMember(x => x.ClientCode, y => y.MapFrom(y => y.Plant));
.ForMember(x => x.ClientCode, y => y.MapFrom(y => y.Plant))
.ForMember(x => x.Date, y => y.MapFrom(y => DateTime.ParseExact(y.Date, "dd.MM.yyyy", System.Globalization.CultureInfo.CurrentCulture)));
CreateMap<PriceList, PriceListExportDto>();
@ -972,13 +974,20 @@ namespace Win.Sfs.SettleAccount
private void CreateMapPUB_SA()
{
CreateMap<PUB_SA, PUB_SA_DTO>();
}
/// <summary>
/// PUB结算明细
/// </summary>
private void CreateMapPUB_SA_DETAIL()
{
CreateMap<PUB_SA_DETAIL, PUB_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<PUB_SA_DETAIL, PUB_NOT_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_EXPORT_DTO>();
CreateMap<ZGJ_PUB_SA_DETAIL_IMPORT_DTO, PUB_SA_DETAIL>();
CreateMap<PUB_SA_DETAIL_IMPORT_DTO, PUB_SA_DETAIL>();
}
}

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/SettleAccount.Domain.Shared.csproj

@ -34,4 +34,8 @@
<Content Remove="Localization\SettleAccount\*.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="Enums\" />
</ItemGroup>
</Project>

13
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs

@ -2,6 +2,7 @@ using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
[Display(Name = "公用结算导入主表")]
@ -19,6 +20,12 @@ public class PUB_SA : FullAuditedAggregateRoot<Guid>
[Display(Name = "状态")]
public string State { get; set; } = null!;
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
public PUB_SA(Guid guid, int version, string billNum, string state)
{
Version = version;
@ -104,6 +111,12 @@ public class PUB_SA_DETAIL:SA_BASE
//[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!;
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
public PUB_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, string extend1, string extend2, string extend3, string groupNum)
{
Id=guid;

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/IJobService.cs

@ -0,0 +1,6 @@
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public interface IJobService
{
void Invoke();
}

20
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobItem.cs

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public class JobItem : Entity<Guid>, IHasConcurrencyStamp
{
public JobItem()
{
this.Id = Guid.NewGuid();
}
public string Name { get; set; }
public string Cron { get; set; }
public string Service { get; set; }
public bool IsRunning { get; set; }
public List<JobLog> Logs { get; set; } = new List<JobLog>();
public string ConcurrencyStamp { get; set; }
}

14
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobLog.cs

@ -0,0 +1,14 @@
using System;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public class JobLog : Entity<Guid>
{
public JobItem Job { get; set; }
public Guid? JobId { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public bool Success { get; set; }
public string Exception { get; set; }
}

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

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public class VmiBalance : Entity<Guid>
{
/// <summary>
/// LU零件号:BBAC发运单BBAC_SE_DETAIL.LU
/// </summary>
public string LU { get; set; }
/// <summary>
/// 生产码:BBAC发运单BBAC_SE_DETAIL.PN
/// </summary>
public string PN { get; set; }
/// <summary>
/// 生产码类型(01前保、02后保、03门槛等)
/// </summary>
public int PNType { get; set; }
/// <summary>
/// 发货类型???
/// </summary>
public string Type { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal Qty { get; set; }
public List<VmiLog> Logs { get; set; } = new List<VmiLog>();
}

16
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiCategory.cs

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// 寄售库存操作分类
/// </summary>
public class VmiCategory : Entity<Guid>
{
public VmiType Type { get; set; }
public string Number { get; set; }
public string Name { get; set; }
public List<VmiLog> Logs { get; set; } = new List<VmiLog>();
}

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

@ -0,0 +1,22 @@
using System;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// 寄售库存操作记录
/// </summary>
public class VmiLog : Entity<Guid>
{
public Guid CategoryId { get; set; }
public Guid BalanceId { get; set; }
/// <summary>
/// 操作范围
/// </summary>
public string SessionId { get; set; }
public VmiOperatorType Type { get; set; }
public VmiCategory Category { get; set; }
public VmiBalance Balance { get; set; }
}

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

@ -0,0 +1,8 @@
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public enum VmiOperatorType
{
Do,
UnDo,
ReDo
}

17
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiSnapshot.cs

@ -0,0 +1,17 @@
using System;
using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// 库存快照,每月26日8.00,取库存按照时间存储到sqlite文件中
/// </summary>
public class VmiSnapshot : Entity<Guid>
{
/// <summary>
/// YYYY-MM-DD hh
/// </summary>
public string Name { get; set; }
public string Path { get; set; }
}

10
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs

@ -0,0 +1,10 @@
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// 寄售库存操作类型
/// </summary>
public enum VmiType
{
In,
Out
}

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/MaterialRelationships/MaterialRelationship.cs

@ -97,11 +97,12 @@ namespace Win.Sfs.SettleAccount.MaterialRelationships
AppraisalCategory = appraisalCategory;
}
public MaterialRelationship(Guid id, string erpMaterialCode, string materialDesc, string settlMaterialCode) : base(id)
public MaterialRelationship(Guid id, string erpMaterialCode, string materialDesc, string settlMaterialCode, string appraisalCategory) : base(id)
{
ErpMaterialCode = erpMaterialCode;
MaterialDesc = materialDesc;
SettleMaterialCode = settlMaterialCode;
AppraisalCategory = appraisalCategory;
}
}
}

68
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceList.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@ -36,6 +36,17 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
CustomerCode = customerCode;
}
public PriceList(Guid Id, string lu, decimal price, DateTime beginDate, DateTime endDate, string clientCode, DateTime date, string contractNo) : base(Id)
{
LU = lu;
Price = price;
BeginTime = beginDate;
EndTime = endDate;
ClientCode = clientCode;
Date = date;
ContractNo = contractNo;
}
public void Set(DateTime beginDate, DateTime endDate, decimal price, string materialCode, int type, string customerCode)
{
BeginTime = beginDate;
@ -82,14 +93,28 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
public string ClientCode { get; set; }
/// <summary>
/// 业务类别
/// 合同签订时间
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
[Display(Name = "合同签订时间")]
public DateTime Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[Display(Name = "合同号")]
public string ContractNo { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
/// <summary>
///版本
/// </summary>
@ -166,12 +191,34 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[Display(Name = "价格")]
public Decimal Price { set; get; }
/// <summary>
/// 开始时间
/// </summary>
[Display(Name = "开始时间")]
public DateTime BeginDate { set; get; }
/// <summary>
/// 结束时间
/// </summary>
[Display(Name = "结算时间")]
public DateTime EndDate { set; get; }
/// <summary>
/// 客户编码
/// </summary>
[Display(Name = "客户编码")]
public string ClientCode { get; set; }
/// <summary>
/// 合同签订时间
/// </summary>
[Display(Name = "合同签订时间")]
public DateTime Date { get; set; }
/// <summary>
/// 合同号
/// </summary>
[Display(Name = "合同号")]
public string ContractNo { get; set; }
@ -187,19 +234,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
[Display(Name = "版本")]
public string Version { set; get; }
/// <summary>
/// 开始时间
/// </summary>
[Display(Name = "开始时间")]
public DateTime BeginDate { set; get; }
/// <summary>
/// 结束时间
/// </summary>
[Display(Name = "结算时间")]
public DateTime EndDate { set; get; }
/// <summary>
/// 物料编号
/// </summary>

10
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs

@ -1,4 +1,4 @@
using EFCore.BulkExtensions;
using EFCore.BulkExtensions;
using System;
using System.Collections.Generic;
using System.Linq;
@ -85,9 +85,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
var update = from itm1 in entities
join itm2 in pricelist
on new { itm1.Type, itm1.MaterialCode,itm1.CustomerCode } equals new { itm2.Type, itm2.MaterialCode, itm2.CustomerCode }
on new { itm1.ClientCode, itm1.LU, itm1.BeginTime, itm1.EndTime } equals new { itm2.ClientCode, itm2.LU, itm2.BeginTime, itm2.EndTime }
where itm1.Price != itm2.Price
select new PriceList(itm2.Id, itm2.BeginTime, itm2.EndTime, itm1.Price, itm2.MaterialCode, itm2.Type, itm2.ParentId, itm2.Version, itm1.CustomerCode);
select new PriceList(itm2.Id, itm2.LU, itm1.Price, itm2.BeginTime, itm2.EndTime, itm2.ClientCode, itm2.Date, itm2.ContractNo);
if (update.Count() > 0)
{
@ -99,8 +99,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
{
var add = from itm1 in entities
join itm2 in pricelist
on new { itm1.Type, itm1.MaterialCode }
equals new { itm2.Type, itm2.MaterialCode }
on new { itm1.ClientCode, itm1.LU, itm1.BeginTime, itm1.EndTime }
equals new { itm2.ClientCode, itm2.LU, itm2.BeginTime, itm2.EndTime }
into temp
from itm3 in temp.DefaultIfEmpty()
where itm3 == null

17
code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBusinessType.cs

@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Win.Sfs.SettleAccount
{
@ -8,31 +8,31 @@ namespace Win.Sfs.SettleAccount
public enum EnumBusinessType
{
/// <summary>
///未定义
/// 未定义
/// </summary>
[Display(Name = "未定义")]
None = 0,
/// <summary>
///直供件
/// 直供件
/// </summary>
[Display(Name = "直供件")]
ZhiGongJian = 1,
/// <summary>
///买单件
/// 买单件
/// </summary>
[Display(Name = "买单件")]
MaiDanJian = 2,
/// <summary>
///备件
/// 备件
/// </summary>
[Display(Name = "备件")]
BeiJian = 3,
/// <summary>
///印度件
/// 印度件
/// </summary>
[Display(Name = "印度件")]
YingDuJian = 4,
@ -44,12 +44,9 @@ namespace Win.Sfs.SettleAccount
HBPO = 5,
/// <summary>
///印度件
/// 印度件
/// </summary>
[Display(Name = "BBAC-JIS")]
BBAC = 6
}
}

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

@ -0,0 +1,50 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
namespace Win.Sfs.SettleAccount.Reports;
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class PubSaSeCompareDiff
{
/// <summary>
/// 零件号
/// </summary>
[ExporterHeader(DisplayName = "零件号")]
public string SeLU { set; get; }
/// <summary>
/// 生产号
/// </summary>
[ExporterHeader(DisplayName = "生产号")]
public string SePN { set; get; }
/// <summary>
/// 零件号
/// </summary>
[ExporterHeader(DisplayName = "零件号")]
public string SaLU { set; get; }
/// <summary>
/// 生产号
/// </summary>
[ExporterHeader(DisplayName = "生产号")]
public string SaPN { set; get; }
/// <summary>
/// 结算数量
/// </summary>
[ExporterHeader(DisplayName = "结算数量")]
public decimal SaQty { set; get; }
/// <summary>
/// 发运数量
/// </summary>
[ExporterHeader(DisplayName = "发运数量")]
public decimal SeQty { set; get; }
/// <summary>
/// 差异数量
/// </summary>
[ExporterHeader(DisplayName = "差异数量")]
public decimal DiffQty { set; get; }
}

12
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContext.cs

@ -1,10 +1,6 @@
using Microsoft.EntityFrameworkCore;
using SettleAccount;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.StockUnsettledDiffReports;
namespace Win.Sfs.SettleAccount
{
@ -15,7 +11,7 @@ namespace Win.Sfs.SettleAccount
* public DbSet<Question> Questions { get; set; }
*/
public SettleAccountDbContext(DbContextOptions<SettleAccountDbContext> options)
public SettleAccountDbContext(DbContextOptions<SettleAccountDbContext> options)
: base(options)
{
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(30));
@ -28,6 +24,4 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureSettleAccount();
}
}
}
}

330
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -1,51 +1,20 @@
using System;
using System;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Domain.BQ;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.Customers;
using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Controls;
using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.SettleAccount.Entities.Inventories;
using Win.Sfs.SettleAccount.Entities.Invoices;
using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Prebatches;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.SettleAccounts;
using Win.Sfs.SettleAccount.Entities.StorageLocations;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.Inventories;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.SettleAccount.SendUnsettledDiffReports;
using Win.Sfs.SettleAccount.StockUnsettledDiffReports;
using Win.Sfs.Shared.Constant;
using Win.Sfs.SettleAccount.Entities.Factories;
using Win.Sfs.SettleAccount.StockFisDiffReports;
using Win.Sfs.SettleAccount.StockSettledDiffReports;
using Win.Sfs.SettleAccount.SecondaryActuralAdjustmentReports;
using Win.Sfs.SettleAccount.SecondaryActuralDiffReports;
using Win.Sfs.SettleAccount.SupplierItemSetUps;
using Win.Sfs.SettleAccount.BTSeqKBDiffReports;
using Win.Sfs.SettleAccount.BTNotConsignReports;
using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Invoices;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.FISes;
using Win.Sfs.SettleAccount.Entities.MaterialRelationships;
using Win.Sfs.SettleAccount.Entities.SettlementParts;
using Win.Sfs.SettleAccount.Entities.ItemInvoicePrices;
using Win.Sfs.SettleAccount.Entities.SecMatch;
using Win.Sfs.SettleAccount.Entities.UnHQSettleAccounts;
using Win.Sfs.SettleAccount.Errors;
using SettleAccount.Domain.BQ;
using System.DirectoryServices.ActiveDirectory;
namespace Win.Sfs.SettleAccount
{
@ -65,6 +34,7 @@ namespace Win.Sfs.SettleAccount
);
#region 基础数据
builder.ConfigureCodeSetting(options);
//价格
builder.ConfigurePriceListVersion(options);
@ -85,14 +55,11 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePURCHASE_PRICE(options);
//客户替换件关系
builder.ConfigureTB_RePartsRelationship(options);
#endregion
#endregion 基础数据
#region 北汽结算
builder.ConfigureTaskJob(options);
builder.ConfigureBBAC_CAN_SA(options);
builder.ConfigureBBAC_CAN_SA_DETAIL(options);
builder.ConfigureBBAC_NOT_SA_DETAIL(options);
@ -126,12 +93,7 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePUB_SA(options);
builder.ConfigurePUB_SA_DETAIL(options);
builder.ConfigurePUB_SE_DETAIL(options);
builder.ConfigureVmi(options);
//大众发票导入
//builder.ConfigureInvoice(options);
@ -141,50 +103,40 @@ namespace Win.Sfs.SettleAccount
//builder.ConfigureSettleAccount(options);
//builder.ConfigureSettleAccountVersion(options);
////红旗主机场-未结明细-导入
//builder.ConfigureUnHQSettleAccount(options);
//builder.ConfigureUnHQSettleAccountVersion(options);
//builder.ConfigureWmsDetailReport(options);
//builder.ConfigureWmsDetailDiffReport(options);
//builder.ConfigureWmsDetailCancelReport(options);
//有条码
//builder.ConfigureWmsDetailWithCodeReport(options);
//builder.ConfigureErrorBill(options);
#endregion
#endregion 北汽结算
}
#region 基础数据
private static void ConfigurePriceListBJ(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PriceListBJ>(b =>
{
b.ToTable($"{options.TablePrefix}_PriceListBJ", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.MaterialCode).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50);
});
}
private static void ConfigurePriceListVersionBJ(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PriceListVersionBJ>(b =>
{
b.ToTable($"{options.TablePrefix}_PriceListVersionBJ", options.Schema);
b.ConfigureByConvention();
@ -192,13 +144,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Period).HasMaxLength(50);
b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.Factory).HasMaxLength(50);
});
}
private static void ConfigureCentralizedControl(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<CentralizedControl>(b =>
{
b.ToTable($"{options.TablePrefix}_control", options.Schema);
@ -209,10 +159,8 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureBomVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BomVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_bom_version", options.Schema);
@ -224,12 +172,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureBom(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<Bom>(b =>
{
b.ToTable($"{options.TablePrefix}_bom", options.Schema);
b.ConfigureByConvention();
@ -261,19 +207,14 @@ namespace Win.Sfs.SettleAccount
b.ToTable($"{options.TablePrefix}_material", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.EstimateType).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.MaterialCode).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Unit).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.MaterialCode }).IsUnique().HasFilter(IsDeletedFilter);
});
}
private static void ConfigureMaterialRelationship(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<MaterialRelationship>(b =>
@ -301,24 +242,20 @@ namespace Win.Sfs.SettleAccount
private static void ConfigurePriceList(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PriceList>(b =>
{
b.ToTable($"{options.TablePrefix}_PriceList", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.MaterialCode).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50);
});
}
private static void ConfigurePriceListVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PriceListVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_PriceListVersion", options.Schema);
b.ConfigureByConvention();
@ -326,7 +263,6 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Period).HasMaxLength(50);
b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.Factory).HasMaxLength(50);
});
}
@ -342,7 +278,6 @@ namespace Win.Sfs.SettleAccount
});
}
/// <summary>
/// 客户替换件关系
/// </summary>
@ -354,22 +289,11 @@ namespace Win.Sfs.SettleAccount
b.ConfigureByConvention();
});
}
#endregion
#endregion 基础数据
#region 北汽
/// <summary>
/// 一汽轿车平台验收结算明细-导入
/// </summary>
@ -377,10 +301,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
//private static void ConfigureHQCar(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<HQ_Car_Platform>(b =>
// {
// b.ToTable($"{options.TablePrefix}_HQ_Car_Platform", options.Schema);
// b.ConfigureByConvention();
@ -404,7 +326,6 @@ namespace Win.Sfs.SettleAccount
//private static void ConfigureHQCarVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<HQ_Car_PlatformVersion>(b =>
// {
// b.ToTable($"{options.TablePrefix}_HQ_Car_PlatformVersion", options.Schema);
@ -424,10 +345,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
//private static void ConfigureUnHQSettleAccount(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<UnHQSettleAccount>(b =>
// {
// b.ToTable($"{options.TablePrefix}_UnHQSettleAccount", options.Schema);
// b.ConfigureByConvention();
@ -459,7 +378,6 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
//private static void ConfigureUnHQSettleAccountVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<UnHQSettleAccountVersion>(b =>
// {
// b.ToTable($"{options.TablePrefix}_UnHQSettleAccountVersion", options.Schema);
@ -480,10 +398,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
//private static void ConfigureInvoice(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
//{
// builder.Entity<Invoice>(b =>
// {
// b.ToTable($"{options.TablePrefix}_Invoice", options.Schema);
// b.ConfigureByConvention();
@ -504,10 +420,8 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
private static void ConfigureInvoiceVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<InvoiceVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_InvoiceVersion", options.Schema);
b.ConfigureByConvention();
@ -516,7 +430,6 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Version).HasMaxLength(50);
b.Property(x => x.CustomerCode).HasMaxLength(50);
// b.Property(x => x.Factory).HasMaxLength(50);
});
}
@ -557,7 +470,6 @@ namespace Win.Sfs.SettleAccount
/// <param name="options"></param>
private static void ConfigureSettleAccountVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<SettleAccountVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_Settle_Version", options.Schema);
@ -568,15 +480,21 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter);
});
}
private static void ConfigureTaskJob(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<TaskJob>(b =>
{
b.ToTable($"{options.TablePrefix}_TaskJob", options.Schema);
b.ConfigureByConvention();
});
}
private static void ConfigureBBAC_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_CAN_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_CAN_SA", options.Schema);
b.ConfigureByConvention();
@ -586,15 +504,12 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.InvGroupNum).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_CAN_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -611,12 +526,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_PD_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_PD_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -633,13 +547,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureBBAC_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_NOT_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -655,12 +566,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SA", options.Schema);
b.ConfigureByConvention();
@ -670,12 +580,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -690,12 +599,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SE_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SE_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -712,10 +620,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureBBAC_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SE_EDI>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SE_EDI", options.Schema);
b.ConfigureByConvention();
@ -730,16 +636,13 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SE_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SE_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SE_REPORT", options.Schema);
b.ConfigureByConvention();
@ -753,12 +656,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureBBAC_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_SE_SA_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_BBAC_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention();
@ -777,12 +679,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_CAN_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_CAN_SA", options.Schema);
b.ConfigureByConvention();
@ -796,10 +697,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_CAN_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -817,10 +716,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_NOT_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -834,12 +731,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_PD_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_PD_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -855,12 +751,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SA", options.Schema);
b.ConfigureByConvention();
@ -874,10 +769,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureHBPO_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -891,12 +784,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SE_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SE_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -910,12 +802,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureHBPO_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SE_EDI>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SE_EDI", options.Schema);
b.ConfigureByConvention();
@ -930,17 +821,13 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50);
});
}
private static void ConfigureHBPO_SE_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SE_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SE_REPORT", options.Schema);
b.ConfigureByConvention();
@ -955,13 +842,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureHBPO_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<HBPO_SE_SA_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_HBPO_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention();
@ -981,13 +865,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureINVOICE_GRP(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<INVOICE_GRP>(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_GRP", options.Schema);
b.ConfigureByConvention();
@ -999,12 +880,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureINVOICE_MAP_GROUP(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<INVOICE_MAP_GROUP>(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_MAP_GROUP", options.Schema);
b.ConfigureByConvention();
@ -1016,12 +896,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigureINVOICE_NOT_SETTLE(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<INVOICE_NOT_SETTLE>(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_NOT_SETTLE", options.Schema);
b.ConfigureByConvention();
@ -1037,10 +916,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureINVOICE_WAIT_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<INVOICE_WAIT_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_WAIT_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1058,10 +935,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureJIT_SE_SA_REPORT(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<JIT_SE_SA_REPORT>(b =>
{
b.ToTable($"{options.TablePrefix}_JIT_SE_SA_REPORT", options.Schema);
b.ConfigureByConvention();
@ -1083,10 +958,8 @@ namespace Win.Sfs.SettleAccount
private static void ConfigurePUB_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_CAN_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_CAN_SA", options.Schema);
b.ConfigureByConvention();
@ -1098,13 +971,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigurePUB_CAN_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_CAN_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_CAN_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1121,13 +991,10 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigurePUB_NOT_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_NOT_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_NOT_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1145,12 +1012,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_PD_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_PD_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_PD_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1167,12 +1033,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_SA>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_SA", options.Schema);
b.ConfigureByConvention();
@ -1181,12 +1046,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_SA_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_SA_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_SA_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1202,12 +1066,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
}
private static void ConfigurePUB_SE_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<PUB_SE_DETAIL>(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_SE_DETAIL", options.Schema);
b.ConfigureByConvention();
@ -1223,85 +1086,52 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureVmi(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<JobItem>().HasData(new JobItem { Name = "库存快照", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
builder.Entity<JobItem>(b =>
{
b.ToTable($"{options.TablePrefix}_JobItem", options.Schema);
b.ConfigureByConvention();
b.Property(o => o.Name).HasMaxLength(50).IsRequired();
b.HasIndex(o => o.Name).IsUnique();
b.Property(o => o.Service).HasMaxLength(100).IsRequired();
b.Property(o => o.Cron).HasMaxLength(50).IsRequired();
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
});
builder.Entity<JobLog>().HasOne(o => o.Job).WithMany(o => o.Logs).HasForeignKey(o => o.JobId).OnDelete(DeleteBehavior.SetNull);
builder.Entity<VmiCategory>(b =>
{
b.ToTable($"{options.TablePrefix}_VmiCategory", options.Schema);
b.ConfigureByConvention();
b.Property(o => o.Number).HasMaxLength(50).IsRequired();
b.HasIndex(o => o.Number).IsUnique();
b.Property(o => o.Name).HasMaxLength(50).IsRequired();
});
builder.Entity<VmiBalance>(b =>
{
b.ToTable($"{options.TablePrefix}_VmiBalance", options.Schema);
b.ConfigureByConvention();
b.HasAlternateKey(o => new { o.PN, o.LU });
});
builder.Entity<VmiLog>(b =>
{
b.ToTable($"{options.TablePrefix}_VmiLog", options.Schema);
b.ConfigureByConvention();
});
builder.Entity<VmiLog>().HasOne(o => o.Category).WithMany(o => o.Logs).HasForeignKey(o => o.CategoryId).OnDelete(DeleteBehavior.Cascade);
builder.Entity<VmiLog>().HasOne(o => o.Balance).WithMany(o => o.Logs).HasForeignKey(o => o.BalanceId).OnDelete(DeleteBehavior.Cascade);
builder.Entity<VmiSnapshot>(b =>
{
b.ToTable($"{options.TablePrefix}_VmiSnapshot", options.Schema);
b.ConfigureByConvention();
});
}
}
#endregion
#endregion 北汽
}

4
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountEntityFrameworkCoreModule.cs

@ -1,4 +1,4 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Dapper;
@ -153,4 +153,4 @@ namespace Win.Sfs.SettleAccount
});
}
}
}
}

4035
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719004135_20230719-1.Designer.cs

File diff suppressed because it is too large

56
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719004135_20230719-1.cs

@ -0,0 +1,56 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307191 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ContractNo",
table: "Set_PriceListBJ",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "Date",
table: "Set_PriceListBJ",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "ContractNo",
table: "Set_PriceList",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "Date",
table: "Set_PriceList",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ContractNo",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "Date",
table: "Set_PriceListBJ");
migrationBuilder.DropColumn(
name: "ContractNo",
table: "Set_PriceList");
migrationBuilder.DropColumn(
name: "Date",
table: "Set_PriceList");
}
}
}

4038
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719022720_20230719-2.Designer.cs

File diff suppressed because it is too large

24
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719022720_20230719-2.cs

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307192 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "BusinessType",
table: "Set_PUB_SA",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BusinessType",
table: "Set_PUB_SA");
}
}
}

4259
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719032116_vmi.Designer.cs

File diff suppressed because it is too large

173
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719032116_vmi.cs

@ -0,0 +1,173 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class vmi : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Set_JobItem",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Cron = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Service = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
IsRunning = table.Column<bool>(type: "bit", nullable: false),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_JobItem", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Set_VmiBalance",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LU = table.Column<string>(type: "nvarchar(450)", nullable: false),
PN = table.Column<string>(type: "nvarchar(450)", nullable: false),
PNType = table.Column<int>(type: "int", nullable: false),
Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
Qty = table.Column<decimal>(type: "decimal(18,2)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_VmiBalance", x => x.Id);
table.UniqueConstraint("AK_Set_VmiBalance_PN_LU", x => new { x.PN, x.LU });
});
migrationBuilder.CreateTable(
name: "Set_VmiCategory",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<int>(type: "int", nullable: false),
Number = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_VmiCategory", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Set_VmiSnapshot",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
Path = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_VmiSnapshot", x => x.Id);
});
migrationBuilder.CreateTable(
name: "JobLog",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
JobId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
Start = table.Column<DateTime>(type: "datetime2", nullable: false),
End = table.Column<DateTime>(type: "datetime2", nullable: false),
Success = table.Column<bool>(type: "bit", nullable: false),
Exception = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_JobLog", x => x.Id);
table.ForeignKey(
name: "FK_JobLog_Set_JobItem_JobId",
column: x => x.JobId,
principalTable: "Set_JobItem",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
});
migrationBuilder.CreateTable(
name: "Set_VmiLog",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BalanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SessionId = table.Column<string>(type: "nvarchar(max)", nullable: true),
Type = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_VmiLog", x => x.Id);
table.ForeignKey(
name: "FK_Set_VmiLog_Set_VmiBalance_BalanceId",
column: x => x.BalanceId,
principalTable: "Set_VmiBalance",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Set_VmiLog_Set_VmiCategory_CategoryId",
column: x => x.CategoryId,
principalTable: "Set_VmiCategory",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" },
values: new object[] { new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
migrationBuilder.CreateIndex(
name: "IX_JobLog_JobId",
table: "JobLog",
column: "JobId");
migrationBuilder.CreateIndex(
name: "IX_Set_JobItem_Name",
table: "Set_JobItem",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Set_VmiCategory_Number",
table: "Set_VmiCategory",
column: "Number",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Set_VmiLog_BalanceId",
table: "Set_VmiLog",
column: "BalanceId");
migrationBuilder.CreateIndex(
name: "IX_Set_VmiLog_CategoryId",
table: "Set_VmiLog",
column: "CategoryId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "JobLog");
migrationBuilder.DropTable(
name: "Set_VmiLog");
migrationBuilder.DropTable(
name: "Set_VmiSnapshot");
migrationBuilder.DropTable(
name: "Set_JobItem");
migrationBuilder.DropTable(
name: "Set_VmiBalance");
migrationBuilder.DropTable(
name: "Set_VmiCategory");
}
}
}

4147
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719053130_20230719-3.Designer.cs

File diff suppressed because it is too large

53
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719053130_20230719-3.cs

@ -0,0 +1,53 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307193 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Set_TaskJob",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
State = table.Column<string>(type: "nvarchar(max)", nullable: true),
TaskId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ActionName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Error = table.Column<string>(type: "nvarchar(max)", nullable: true),
Creator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
FileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
RealFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
RealDownFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
DownFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ServiceName = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false),
Remark = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_TaskJob", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Set_TaskJob");
}
}
}

4371
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719090654_20230719-4.Designer.cs

File diff suppressed because it is too large

45
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719090654_20230719-4.cs

@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307194 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80"));
migrationBuilder.AddColumn<int>(
name: "BusinessType",
table: "Set_PUB_SA_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" },
values: new object[] { new Guid("6efe1947-a242-4d20-b633-20b0f716a782"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6efe1947-a242-4d20-b633-20b0f716a782"));
migrationBuilder.DropColumn(
name: "BusinessType",
table: "Set_PUB_SA_DETAIL");
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" },
values: new object[] { new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
}
}
}

348
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -2778,6 +2778,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("BusinessType")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(50)
@ -2840,6 +2843,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("BusinessType")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(50)
@ -3273,6 +3279,183 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_bom");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobItem", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("Cron")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("IsRunning")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Service")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Set_JobItem");
b.HasData(
new
{
Id = new Guid("6efe1947-a242-4d20-b633-20b0f716a782"),
Cron = "0 0 8 26 *",
IsRunning = false,
Name = "库存快照",
Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiService"
});
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("End")
.HasColumnType("datetime2");
b.Property<string>("Exception")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("JobId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("Start")
.HasColumnType("datetime2");
b.Property<bool>("Success")
.HasColumnType("bit");
b.HasKey("Id");
b.HasIndex("JobId");
b.ToTable("JobLog");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiBalance", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("LU")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("PN")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("PNType")
.HasColumnType("int");
b.Property<decimal>("Qty")
.HasColumnType("decimal(18,2)");
b.Property<string>("Type")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasAlternateKey("PN", "LU");
b.ToTable("Set_VmiBalance");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiCategory", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Number")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("Number")
.IsUnique();
b.ToTable("Set_VmiCategory");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiLog", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BalanceId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CategoryId")
.HasColumnType("uniqueidentifier");
b.Property<string>("SessionId")
.HasColumnType("nvarchar(max)");
b.Property<int>("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BalanceId");
b.HasIndex("CategoryId");
b.ToTable("Set_VmiLog");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiSnapshot", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("Path")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Set_VmiSnapshot");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Boms.BomVersion", b =>
{
b.Property<Guid>("Id")
@ -3617,6 +3800,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ContractNo")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -3629,6 +3815,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
@ -3709,6 +3898,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ContractNo")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -3721,6 +3913,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
@ -3932,6 +4127,115 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_PriceListVersionBJ");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.TaskJob", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ActionName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<string>("Creator")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("DownFileName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Email")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Error")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("FileName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Name")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RealDownFileName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("RealFileName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Remark")
.HasColumnType("nvarchar(max)");
b.Property<string>("ServiceName")
.HasMaxLength(300)
.HasColumnType("nvarchar(300)");
b.Property<string>("State")
.HasColumnType("nvarchar(max)");
b.Property<string>("TaskId")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Type")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Set_TaskJob");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.MaterialRelationships.MaterialRelationship", b =>
{
b.Property<Guid>("Id")
@ -4015,6 +4319,50 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_relationship");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobLog", b =>
{
b.HasOne("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobItem", "Job")
.WithMany("Logs")
.HasForeignKey("JobId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("Job");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiLog", b =>
{
b.HasOne("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiBalance", "Balance")
.WithMany("Logs")
.HasForeignKey("BalanceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiCategory", "Category")
.WithMany("Logs")
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Balance");
b.Navigation("Category");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobItem", b =>
{
b.Navigation("Logs");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiBalance", b =>
{
b.Navigation("Logs");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiCategory", b =>
{
b.Navigation("Logs");
});
#pragma warning restore 612, 618
}
}

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

@ -0,0 +1,162 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Dapper;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
/// <summary>
/// Pub结算与发运对比Dapper仓储
/// </summary>
public class PubSaSeCompareDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public PubSaSeCompareDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider)
{
}
/// <summary>
/// 获取差异
/// </summary>
public virtual List<PubSaSeCompareDiff> GetDetailDiffReportList(string version, string businessType)
{
string strSqlText = @$"
SELECT
A.LU SeLU,
A.PN SePN,
SeQty,
B.LU SaLU,
B.PN SaPN,
SaQty,
(SaQty - SeQty) DiffQty
FROM
(SELECT SUM(QTY) SeQty, LU, PN FROM Set_PUB_SE_DETAIL WHERE GROUP BY LU, PN) A
FULL JOIN (SELECT SUM(QTY) SaQty, LU, PN FROM Set_PUB_SA_DETAIL GROUP BY LU, PN) B ON A.LU= B.LU AND A.PN= B.PN
";
return DbConnection.Query<PubSaSeCompareDiff>(strSqlText, null, null, true, 1200, null).ToList();
}
public virtual List<InvoiceSettledDetailDiff> GetInvoiceSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string cp7begin, string cp7end, string kennCode, string chassisNumber, string materialGroup)
{
List<InvoiceSettledDetailDiff> _list = new List<InvoiceSettledDetailDiff>();
if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0)
{
_list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList();
_list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
}
else
{
//string isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle_RAM] WITH(SNAPSHOT) where Version = '{0}'", version);
//int _count = DbConnection.ExecuteScalar<int>(isExistSql);
int _count = 0;
string condition = " where 1=1 ";
if (!string.IsNullOrEmpty(begin))
{
condition += string.Format(" and a.BeginTime>='{0}' ", begin);
}
if (!string.IsNullOrEmpty(end))
{
condition += string.Format(" and a.BeginTime<='{0}' ", end);
}
if (!string.IsNullOrEmpty(cp7begin))
{
condition += string.Format(" and B.cp7>='{0}' ", cp7begin);
}
if (!string.IsNullOrEmpty(cp7end))
{
condition += string.Format(" and B.cp7<='{0}' ", cp7end);
}
string tablestr = (_count == 0) ?
" ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" :
" (SELECT * FROM [Set_Settle_RAM] WITH(SNAPSHOT) where Version = '{0}') b \n";
string str =
"SELECT\n" +
string.Format(" '{0}' version ,\n", version) +
" temp1.*,\n" +
" TEMP2.Price,(\n" +
" Isnull( temp2.Price, 0 ) * isnull( temp1.Qty, 0 )) Amt \n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" b.YEAR,\n" +
" a.OrderBillNum Kenncode,\n" +
" b.MaterialCode,\n" +
" b.Model,\n" +
" a.ChassisNumber,\n" +
" a.Qty,\n" +
" a.BeginTime CP5Time,\n" +
" a.ChassisNumber2,\n" +
" B.CP7 CP7Time,\n" +
" a.QTY SettledQty,\n" +
" a.ErpMaterialCode ParentSapMaterialCode,\n" +
" a.WMSState,\n" +
" a.WMSBillNum,\n" +
" d.MaterialCode SapMaterialCode,\n" +
" d.MaterialDesc MaterialDesc,\n" +
" d.EstimateTypeDesc MaterialGroup,\n" +
" e.MaterialDesc ParentMaterialDesc,\n" +
" c.InvoicePrice,\n" +
" Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" +
" Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" +
" 0 DiffSettleFisQty,\n" +
" 0 DiffSettleInvQty, \n" +
" a.Qty InvoiceQty ,\n" +
" IsNull( B.Qty, 0 ) SettleReadyQty, \n" +
" a.UnSettleVersion \n" +
" FROM\n" +
tablestr +
" INNER JOIN Set_fis a ON b.ChassisNumber = a.ChassisNumber2 \n" +
" AND b.KENNCode = a.KENNCode \n" +
" AND b.MaterialCode = a.ItemCode\n" +
" LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) c ON a.ItemCode = c.MaterialCode\n" +
" LEFT JOIN set_material d ON a.ItemCode = d.CustomerPartCode\n" +
" LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) e ON a.ErpMaterialCode = e.MaterialCode {1} \n" +
" ) TEMP1\n" +
" LEFT JOIN (\n" +
" SELECT\n" +
" Price,\n" +
" MaterialCode \n" +
" FROM\n" +
" Set_PriceList \n" +
" WHERE\n" +
" version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode";
var _sql = string.Format(str, version, condition);
var _query = DbConnection.Query<InvoiceSettledDetailDiff>(_sql, null, null, true, 1200, null);
_list = _query.ToList();
if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0)
{
_list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList();
_list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
}
else
{
if (CacheManager.CacheInvoiceSettledDetailDiff == null)
{
CacheManager.CacheInvoiceSettledDetailDiff = new List<InvoiceSettledDetailDiff>();
}
CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list);
}
}
return _list;
}
}

19
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/SettleAccountDbContextFactory.cs

@ -0,0 +1,19 @@
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace Win.Sfs.SettleAccount;
public class SettleAccountDbContextFactory : IDesignTimeDbContextFactory<SettleAccountDbContext>
{
public SettleAccountDbContext CreateDbContext(string[] args)
{
var config = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build();
var connectionString = config.GetConnectionString("SettleAccountService");
var optionsBuilder = new DbContextOptionsBuilder<SettleAccountDbContext>();
optionsBuilder.UseSqlServer(connectionString);
return new SettleAccountDbContext(optionsBuilder.Options);
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/appsettings.json

@ -9,8 +9,10 @@
"CorsOrigins": "http://localhost:9527,http://dev.ccwin-in.com:10588,http://localhost:44307"
},
"ConnectionStrings": {
"SettleAccountService": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True",
"Default": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True"
"Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;"
//"SettleAccountService": "Server=localhost;Database=BQ_SA;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True",
//"Default": "Server=localhost;Database=BJABP;User ID=sa;Password=aA123456!;Trusted_Connection=False;TrustServerCertificate=True"
},
"ElasticSearch": {
"Url": "http://localhost:9200"

2
code/src/Modules/SettleAccount/src/SettleAccount.Job/Dispatcher/JobDispatcher.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

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

@ -0,0 +1,288 @@
using System;
using System.Collections.Generic;
using Magicodes.ExporterAndImporter.Excel;
using System.Linq;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.Shared.RepositoryBase;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
using Shouldly;
using Volo.Abp.BlobStoring;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// Pub结算发运对比导出服务
/// </summary>
public class PubSaSeCompareExportService: ITransientDependency, IExportJob
{
/// <summary>
/// Pub结算明细仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SA_DETAIL, Guid> _pubSaDetailRepository;
/// <summary>
/// Pub发运数据仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository;
private readonly PubSaSeCompareDapperRepository _pubSaSeCompareDapperRepository;
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// 构造
/// </summary>
public PubSaSeCompareExportService(INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
PubSaSeCompareDapperRepository pubSaSeCompareDapperRepository,
IBlobContainer<MyFileContainer> fileContainer)
{
_pubSaDetailRepository = pubSaDetailRepository;
_pubSeDetailRepository = pubSeDetailRepository;
_pubSaSeCompareDapperRepository = pubSaSeCompareDapperRepository;
_fileContainer = fileContainer;
}
/// <summary>
/// 导出
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var businessType = property.Where(t => t.Name == "BusinessType").FirstOrDefault().Value;
var filename = exportName.FirstOrDefault();
var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(version, businessType);
ExcelExporter excelExporter = new ExcelExporter();
var result = excelExporter
.Append(pubSaSeCompareDiffs, "差异明细表")
.SeparateBySheet()
.Append(pubSaSeCompareDiffs, "数量差异汇总表")
.SeparateBySheet()
.Append(pubSaSeCompareDiffs, "按物料价格差异明细表")
.SeparateBySheet()
.Append(pubSaSeCompareDiffs, "差异汇总验证表")
.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
return id.ToString();
//结算
//var _lsSum = _ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup, p.InvoicePrice }).Select(p => new UnInvoiceSettledDetailSum
//{
// MaterialCode = p.Key.MaterialCode,
// SapMaterailCode = p.Key.SapMaterialCode,
// MaterialGroup = p.Key.MaterialGroup,
// SettleQty = p.Sum(itm => itm.SettledQty),
// FisQty = 0,
// DiffQty = -p.Sum(itm => itm.SettledQty),
// Price = p.Key.InvoicePrice,
// DiffAmt = p.Sum(itm => itm.SettledQty) * p.Key.InvoicePrice
//}).ToList();
//var _sumTotal = new UnInvoiceSettledDetailSum()
//{
// SettleQty = _lsSum.Sum(p => p.SettleQty),
// DiffQty = _lsSum.Sum(p => p.DiffQty),
// Price = _lsSum.Sum(p => p.Price),
// DiffAmt = _lsSum.Sum(p => p.DiffAmt)
//};
//_lsSum.Add(_sumTotal);
//var _ls1 = DiffPrice(id, exportName, p_list);
//var report1List = _ls1.Where(p => p.DiffPrice != 0).GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
// .Select(t => new SettleDoorPanelExport { MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode }).ToList();
//var report2List = _ls1.Where(p => p.DiffPrice != 0).Select(p => new { p.MaterialGroup, DiffAmt = p.DiffPrice * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version });
//var list1 = LSettleSum(id, exportName, p_list);
//var report1 = report2List.ToList();
//foreach (var itm in list1)
//{
// itm.MaterialGroup = itm.MaterialGroup + "(漏结)";
//}
//report1.AddRange(list1);
//ExcelExporter _exporter = new ExcelExporter();//导出Excel
//var result = _exporter
//.Append(_ls, "差异明细表")
//.SeparateBySheet()
//.Append(_lsSum, "数量差异汇总表")
//.SeparateBySheet()
//.Append(report1List, "按物料价格差异明细表")
//.SeparateBySheet()
//.Append(report1, "差异汇总验证表")
//.ExportAppendDataAsByteArray();
//result.ShouldNotBeNull();
//_fileContainer.SaveAsync(_filename, result.Result, true);
////_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众结算未发运核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
//return id.ToString();
return this.GetType().FullName;
}
/// <summary>
/// 导出
/// </summary>
public string ExportFile333(Guid id, List<string> exportName, List<CustomCondition> property)
{
return "";
// var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
// var _filename = exportName.FirstOrDefault();
// var _ls = _dapperRepository.GetDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
// var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
// foreach (var itm in _ls)
// {
// itm.InvoiceAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice, 2);
// itm.DiffPrice = itm.Price - itm.InvoicePrice;
// itm.DiffSettleFisQty = itm.SettledQty;
// }
// _ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList();
// if (!string.IsNullOrEmpty(materialGroup))
// {
// var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(kenncode))
// {
// var _groupList = kenncode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.KENNCode)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(chassisNumber))
// {
// var _groupList = chassisNumber.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.ChassisNumber)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(sapCode))
// {
// var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
// }
// }
// if (!string.IsNullOrEmpty(materialCode))
// {
// var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
// if (_groupList.Count() > 0)
// {
// _ls = _ls.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
// }
// }
// var _checkList = _erpdapperRepository.GetErrorBillList();
// var query = from itm in _ls
// join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
//equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
// from tm1 in temp1.DefaultIfEmpty()
// where tm1 == null
// select itm;
// _ls = query.ToList();
// var _lsSum = _ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup, p.InvoicePrice }).Select(p => new UnInvoiceSettledDetailSum
// {
// MaterialCode = p.Key.MaterialCode,
// SapMaterailCode = p.Key.SapMaterialCode,
// MaterialGroup = p.Key.MaterialGroup,
// SettleQty = p.Sum(itm => itm.SettledQty),
// FisQty = 0,
// DiffQty = -p.Sum(itm => itm.SettledQty),
// Price = p.Key.InvoicePrice,
// DiffAmt = p.Sum(itm => itm.SettledQty) * p.Key.InvoicePrice
// }).ToList();
// var _sumTotal = new UnInvoiceSettledDetailSum()
// {
// SettleQty = _lsSum.Sum(p => p.SettleQty),
// DiffQty = _lsSum.Sum(p => p.DiffQty),
// Price = _lsSum.Sum(p => p.Price),
// DiffAmt = _lsSum.Sum(p => p.DiffAmt)
// };
// _lsSum.Add(_sumTotal);
// var _ls1 = DiffPrice(id, exportName, p_list);
// var report1List = _ls1.Where(p => p.DiffPrice != 0).GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
// .Select(t => new SettleDoorPanelExport { MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode }).ToList();
// var report2List = _ls1.Where(p => p.DiffPrice != 0).Select(p => new { p.MaterialGroup, DiffAmt = p.DiffPrice * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version });
// var list1 = LSettleSum(id, exportName, p_list);
// var report1 = report2List.ToList();
// foreach (var itm in list1)
// {
// itm.MaterialGroup = itm.MaterialGroup + "(漏结)";
// }
// report1.AddRange(list1);
// ExcelExporter _exporter = new ExcelExporter();//导出Excel
// var result = _exporter
// .Append(_ls, "差异明细表")
// .SeparateBySheet()
// .Append(_lsSum, "数量差异汇总表")
// .SeparateBySheet()
// .Append(report1List, "按物料价格差异明细表")
// .SeparateBySheet()
// .Append(report1, "差异汇总验证表")
// .ExportAppendDataAsByteArray();
// result.ShouldNotBeNull();
// _fileContainer.SaveAsync(_filename, result.Result, true);
// //_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众结算未发运核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
// return id.ToString();
}
}
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -1,4 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
using Volo.Abp.Application;
@ -37,7 +37,9 @@ namespace Win.Sfs.SettleAccount
public override void ConfigureServices(ServiceConfigurationContext context)
{
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute{ Attempts = 0});
context.Services.AddTransient<PubSaSeCompareExportService>();
context.Services.AddTransient<SettleAccountImportService>();
context.Services.AddTransient<InvoiceImportService>();
context.Services.AddTransient<InvoiceSettledDiffExportService>();
@ -79,6 +81,11 @@ namespace Win.Sfs.SettleAccount
{
Func<string, IExportJob> accesor = key =>
{
if (key.Equals(typeof(PubSaSeCompareExportService).FullName))
{
return implementationFactory.GetService<PubSaSeCompareExportService>();
}
if (key.Equals(typeof(InvoiceSettledDiffExportService).FullName))
{
return implementationFactory.GetService<InvoiceSettledDiffExportService>();

22
code/src/Modules/SettleAccount/src/SettleAccount.Job/SignalR/PageHub.cs

@ -0,0 +1,22 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
namespace SettleAccount.Job.SignalR
{
public class PageHub : Hub
{
public override async Task OnConnectedAsync()
{
await this.Groups.AddToGroupAsync(this.Context.ConnectionId, this.Context.ConnectionId).ConfigureAwait(false);
await Clients.Group(Context.ConnectionId).SendAsync("Connected", Context.ConnectionId).ConfigureAwait(false);
}
}
public static class HubExtensions
{
public static void ServerToClient(this IClientProxy clientProxy, string method, string message, string toClient, string? fromClient = null)
{
clientProxy.SendAsync(nameof(ServerToClient), method, message, toClient, fromClient);
}
}
}
Loading…
Cancel
Save