Browse Source

update

master
wanggang 1 year ago
parent
commit
fe4d4211a9
  1. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  2. 100
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/balance.js
  3. 103
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  4. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobItem.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/JobLog.cs
  6. 68
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  7. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiCategory.cs
  8. 151
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
  9. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiOperatorType.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiSnapshot.cs
  11. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiType.cs
  12. 40
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  13. 26
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/VmiSqliteContext.cs
  14. 4896
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230724063308_vmi3.Designer.cs
  15. 435
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230724063308_vmi3.cs
  16. 166
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  17. 2
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountNormalEfCoreRepository.cs
  18. 5
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/SettleAccount.EntityFrameworkCore.csproj
  19. 15
      code/src/Shared/Win.Sfs.Shared/SharedExtensions.cs

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

@ -88,6 +88,7 @@
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\" /> <Folder Include="wwwroot\" />
<Folder Include="wwwroot\files\vmi\" />
</ItemGroup> </ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions> <ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>

100
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/inventory/balance.js

@ -1,46 +1,78 @@
const schema = { const schema = {
title: "通用代码", title: "寄售库存",
type: "object", type: "object",
properties: { properties: {
project: { id: {
title: "项目", type: "string",
type: "string", hidden: true,
readOnly: true,
showForList: true,
rules: [
{
required: true,
},
],
}, },
value: { erpToLoc: {
title: "", title: "ERP库位",
type: "string", type: "string",
readOnly: true,
showForList: true,
rules: [
{
required: true,
},
],
}, },
description: { lu: {
title: "描述", title: "LU零件号",
type: "string",
},
partCode: {
title: "客户零件号",
type: "string",
},
vinCode: {
title: "生产码",
type: "string",
},
codeType: {
title: "生产码类型",
type: "string",
},
proType: {
title: "发货类型",
type: "string",
},
qty: {
title: "数量",
type: "string",
},
shippingDate: {
title: "发运日期",
type: "string",
input: "date",
},
creationTime: {
title: "订单日期",
type: "string",
input: "date",
},
seqNumber: {
title: "EDI顺序号",
type: "string",
},
tmpe4: {
title: "客户订单号",
type: "string",
},
uniqueCode: {
title: "塑件唯一码",
type: "string",
},
matchNumber: {
title: "EDI总成号",
type: "string",
},
pjsNum: {
title: "PJIS生产顺序号",
type: "string",
},
desc: {
title: "备注",
type: "string", type: "string",
input: "textarea",
showForList: true,
rules: [
{
required: true,
},
{ max: 60 },
],
}, },
}, },
}; };
const baseUrl = "settleaccount/code-setting"; const baseUrl = "settleaccount/vmi";
const queryUrl = `${baseUrl}/get-list`; const queryUrl = `${baseUrl}/balance`;
const detailsUrl = `${baseUrl}/get/%s`; const detailsUrl = `${baseUrl}/get/%s`;
const createUrl = `${baseUrl}/create`; const createUrl = `${baseUrl}/create`;
const updateUrl = `${baseUrl}/update/%s`; const updateUrl = `${baseUrl}/update/%s`;
@ -62,7 +94,7 @@ export default function () {
method: queryMethod, method: queryMethod,
hasFilter: true, hasFilter: true,
schema: { schema: {
title: "通用代码", title: "寄售库存",
type: "object", type: "object",
properties: { properties: {
filters: { filters: {
@ -89,7 +121,7 @@ export default function () {
default: [ default: [
{ {
logic: "and", logic: "and",
column: "project", column: "erpToLoc",
action: "like", action: "like",
value: null, value: null,
readOnly: true, readOnly: true,

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

@ -1,66 +1,145 @@
using System; using System;
using System.IO;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.AspNetCore.Uow;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
namespace Win.Sfs.SettleAccount.Entities.BQ; namespace Win.Sfs.SettleAccount.Entities.BQ;
public interface IVmiService : IApplicationService, ITransientDependency, IJobService public interface IVmiService : IApplicationService, ITransientDependency, IJobService
{ {
string Test();
void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message); void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message);
void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message); void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message);
Task<PagedResultDto<VmiBalance>> Query(RequestDto request); void Run(string logGroupId, VmiType type);
} }
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class VmiAppService : ApplicationService, IVmiService, IJobService, ITransientDependency public class VmiAppService : ApplicationService, IVmiService, IJobService, ITransientDependency
{ {
private readonly INormalEfCoreRepository<VmiBalance, Guid> _repository; private readonly INormalEfCoreRepository<VmiBalance, Guid> _balanceRepository;
private readonly INormalEfCoreRepository<VmiLog, Guid> _logRepository;
private readonly INormalEfCoreRepository<VmiSnapshot, Guid> _snapshotRepository;
public VmiAppService(INormalEfCoreRepository<VmiBalance, Guid> repository) public VmiAppService(INormalEfCoreRepository<VmiBalance, Guid> balanceRepository,
INormalEfCoreRepository<VmiLog, Guid> logRepository,
INormalEfCoreRepository<VmiSnapshot, Guid> snapshotRepository)
{ {
this._repository = repository; this._balanceRepository = balanceRepository;
this._logRepository = logRepository;
this._snapshotRepository = snapshotRepository;
} }
/// <summary>
/// 定时备份
/// </summary>
[HttpPost] [HttpPost]
public void Invoke() public void Invoke()
{ {
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/files/vmi"));
var date = DateTime.Now.ToString("yyyyMMddHH");
var connectionString = $"Data Source=wwwroot/files/vmi/{date}.db";
using var dbContext = new VmiSqliteContext(connectionString);
if (!dbContext.GetService<IRelationalDatabaseCreator>().Exists() && dbContext.Database.EnsureCreated())
{
this._balanceRepository.AsNoTracking().ForEachAsync(o =>
{
dbContext.Set<VmiBalance>().Add(o);
});
dbContext.SaveChanges();
var snapshot = new VmiSnapshot { Name = date, Path = connectionString };
this._snapshotRepository.InsertAsync(snapshot).Wait();
}
Console.WriteLine($"{nameof(VmiAppService)}:{DateTime.Now}"); Console.WriteLine($"{nameof(VmiAppService)}:{DateTime.Now}");
} }
/// <summary>
/// 入库
/// </summary>
[HttpPost] [HttpPost]
public void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message) public void In(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message)
{ {
} }
/// <summary>
/// 出库
/// </summary>
[HttpPost] [HttpPost]
public void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message) public void Out(VmiCategory category, string erpToLoc, string partCode, string lu, decimal count, object message)
{ {
} }
/// <summary>
/// 库存事务重放
/// </summary>
/// <param name="logGroupId"></param>
/// <param name="type"></param>
[NonAction]
public void Run(string logGroupId, VmiType type)
{
}
/// <summary>
/// 库存余额查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost] [HttpPost]
public async Task<PagedResultDto<VmiBalance>> Query(RequestDto input) public async Task<PagedResultDto<VmiBalance>> Balance(RequestDto input)
{ {
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); var entities = await _balanceRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); var totalCount = await _balanceRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
//var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities); //var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities);
return new PagedResultDto<VmiBalance>(totalCount, entities); return new PagedResultDto<VmiBalance>(totalCount, entities);
} }
[HttpGet] /// <summary>
public string Test() /// 库存事务查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<PagedResultDto<VmiLog>> Log(RequestDto input)
{
var entities = await _logRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _logRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
//var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities);
return new PagedResultDto<VmiLog>(totalCount, entities);
}
/// <summary>
/// 时点库存查询
/// </summary>
/// <param name="name">备份名称</param>
/// <returns></returns>
[HttpPost("{name}")]
public async Task<PagedResultDto<VmiBalance>> Backup(string name, RequestDto input)
{ {
return "Test"; var connectionString = $"Data Source=wwwroot/files/vmi/{name}.db";
using var dbContext = new VmiSqliteContext(connectionString);
var repo = dbContext.Set<VmiBalance>();
var filters = input.Filters.ToLambda<VmiBalance>();
var query = (input.Filters.Count > 0 ? repo.Where(input.Filters.ToLambda<VmiBalance>()) : repo);
var totalCount = query.Count();
var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync();
return new PagedResultDto<VmiBalance>(totalCount, entities);
} }
} }

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

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

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

@ -6,7 +6,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public class JobLog : Entity<Guid> public class JobLog : Entity<Guid>
{ {
public JobItem Job { get; set; } public JobItem Job { get; set; }
public Guid? JobId { get; set; } public Guid JobId { get; set; }
public DateTime Start { get; set; } public DateTime Start { get; set; }
public DateTime End { get; set; } public DateTime End { get; set; }
public bool Success { get; set; } public bool Success { get; set; }

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

@ -1,56 +1,90 @@
using System; using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// ERP库位+零件号+生产码
/// </summary>
public class VmiBalance : Entity<Guid> public class VmiBalance : Entity<Guid>
{ {
[Display(Name = "Erp目标库位", Description = "Key")] public VmiBalance(Guid id)
{
this.Id = id;
}
/// <summary>
/// Erp目标库位
/// </summary>
public string ErpToLoc { get; set; } public string ErpToLoc { get; set; }
[Display(Name = "LU零件号", Description = "Key")] /// <summary>
/// LU零件号
/// </summary>
public string LU { get; set; } public string LU { get; set; }
[Display(Name = "客户零件号")] /// <summary>
/// 客户零件号
/// </summary>
public string PartCode { get; set; } public string PartCode { get; set; }
[Display(Name = "生产码", Description = "Key")] /// <summary>
/// 生产码
/// </summary>
[Display(Name = "", Description = "Key")]
public string VinCode { get; set; } public string VinCode { get; set; }
[Display(Name = "生产码类型")] /// <summary>
/// 生产码类型
/// </summary>
public string CodeType { get; set; } public string CodeType { get; set; }
[Display(Name = "发货类型")] /// <summary>
/// 发货类型
/// </summary>
public string ProType { get; set; } public string ProType { get; set; }
[Display(Name = "数量")] /// <summary>
/// 数量
/// </summary>
public decimal Qty { get; set; } public decimal Qty { get; set; }
[Display(Name = "发运日期")] /// <summary>
/// 发运日期
/// </summary>
public DateTime ShippingDate { get; set; } public DateTime ShippingDate { get; set; }
[Display(Name = "订单日期")] /// <summary>
/// 订单日期
/// </summary>
public DateTime CreationTime { get; set; } public DateTime CreationTime { get; set; }
[Display(Name = "EDI顺序号")] /// <summary>
/// EDI顺序号
/// </summary>
public string SeqNumber { get; set; } public string SeqNumber { get; set; }
[Display(Name = "客户订单号")] /// <summary>
/// 客户订单号
/// </summary>
public string Tmpe4 { get; set; } public string Tmpe4 { get; set; }
[Display(Name = "塑件唯一码")] /// <summary>
/// 塑件唯一码
/// </summary>
public string UniqueCode { get; set; } public string UniqueCode { get; set; }
[Display(Name = "EDI总成号")] /// <summary>
/// EDI总成号
/// </summary>
public string MatchNumber { get; set; } public string MatchNumber { get; set; }
[Display(Name = "PJIS生产顺序号")] /// <summary>
/// PJIS生产顺序号
/// </summary>
public string PjsNum { get; set; } public string PjsNum { get; set; }
[Display(Name = "备注")] [Display(Name = "备注")]
public string Desc { get; set; } public string Desc { get; set; }
public List<VmiLog> Logs { get; set; } = new List<VmiLog>();
} }

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

@ -9,6 +9,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// </summary> /// </summary>
public class VmiCategory : Entity<Guid> public class VmiCategory : Entity<Guid>
{ {
public VmiCategory(Guid id)
{
this.Id = id;
}
public VmiType Type { get; set; } public VmiType Type { get; set; }
public string Number { get; set; } public string Number { get; set; }
public string Name { get; set; } public string Name { get; set; }

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

@ -1,4 +1,5 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
@ -8,18 +9,162 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// </summary> /// </summary>
public class VmiLog : Entity<Guid> public class VmiLog : Entity<Guid>
{ {
/// <summary>
/// 批量操作Id
/// </summary>
public string GroupId { get; set; }
/// <summary>
/// 库存事务执行类型
/// </summary>
public VmiLogType VmiType { get; set; }
/// <summary>
/// 库存事务分类
/// </summary>
public Guid CategoryId { get; set; } public Guid CategoryId { get; set; }
/// <summary>
/// 库存Id
/// </summary>
public Guid BalanceId { get; set; } public Guid BalanceId { get; set; }
#region 库存备份
/// <summary>
/// Erp目标库位
/// </summary>
public string ErpToLoc { get; set; }
/// <summary>
/// LU零件号
/// </summary>
public string LU { get; set; }
/// <summary>
/// 客户零件号
/// </summary>
public string PartCode { get; set; }
/// <summary>
/// 生产码
/// </summary>
[Display(Name = "", Description = "Key")]
public string VinCode { get; set; }
/// <summary>
/// 生产码类型
/// </summary>
public string CodeType { get; set; }
/// <summary>
/// 发货类型
/// </summary>
public string ProType { get; set; }
/// <summary>
/// 数量
/// </summary>
public decimal Qty { get; set; }
/// <summary>
/// 发运日期
/// </summary>
public DateTime ShippingDate { get; set; }
/// <summary>
/// 订单日期
/// </summary>
public DateTime CreationTime { get; set; }
/// <summary>
/// EDI顺序号
/// </summary>
public string SeqNumber { get; set; }
/// <summary>
/// 客户订单号
/// </summary>
public string Tmpe4 { get; set; }
/// <summary>
/// 塑件唯一码
/// </summary>
public string UniqueCode { get; set; }
/// <summary> /// <summary>
/// 操作范围 /// EDI总成号
/// </summary> /// </summary>
public string SessionId { get; set; } public string MatchNumber { get; set; }
/// <summary>
/// PJIS生产顺序号
/// </summary>
public string PjsNum { get; set; }
/// <summary>
/// 备注
/// </summary>
public string BalanceDesc { get; set; }
#endregion 库存备份
/// <summary>
/// 变动单号
/// </summary>
public string OrderNumber { get; set; } public string OrderNumber { get; set; }
/// <summary>
/// 变动时间
/// </summary>
public DateTime CreatedDate { get; set; } = DateTime.Now; public DateTime CreatedDate { get; set; } = DateTime.Now;
/// <summary>
/// 变动类型
/// </summary>
public string D2 { get; set; }
/// <summary>
/// 便动人
/// </summary>
public string CreatedBy { get; set; } public string CreatedBy { get; set; }
public VmiOperatorType Type { get; set; }
/// <summary>
/// 实扣LU零件号
/// </summary>
public string F2 { get; set; }
/// <summary>
/// 实扣客户零件号
/// </summary>
public string G2 { get; set; }
/// <summary>
/// 结算LU零件号
/// </summary>
public string H2 { get; set; }
/// <summary>
/// 结算客户零件号
/// </summary>
public string I2 { get; set; }
/// <summary>
/// 实扣生产码
/// </summary>
public string J2 { get; set; }
/// <summary>
/// 结算生产码
/// </summary>
public string K2 { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Desc { get; set; }
public VmiType Type { get; set; }
public VmiCategory Category { get; set; } public VmiCategory Category { get; set; }
public VmiBalance Balance { get; set; } public VmiBalance Balance { get; set; }
} }

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

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

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

@ -9,9 +9,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
public class VmiSnapshot : Entity<Guid> public class VmiSnapshot : Entity<Guid>
{ {
/// <summary> /// <summary>
/// YYYY-MM-DD hh /// 备份名称
/// </summary> /// </summary>
public string Name { get; set; } public string Name { get; set; }
/// <summary>
/// 数据库文件路径
/// </summary>
public string Path { get; set; } public string Path { get; set; }
} }

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

@ -5,6 +5,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// </summary> /// </summary>
public enum VmiType public enum VmiType
{ {
/// <summary>
/// 入库
/// </summary>
In, In,
/// <summary>
/// 出库
/// </summary>
Out Out
} }
public enum VmiLogType
{
/// <summary>
/// 初次执行
/// </summary>
Do,
/// <summary>
/// 撤销
/// </summary>
UnDo,
/// <summary>
/// 重做
/// </summary>
ReDo
}

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

@ -15,6 +15,7 @@ using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.SettleAccounts; using Win.Sfs.SettleAccount.Entities.SettleAccounts;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared;
using Win.Sfs.Shared.Constant; using Win.Sfs.Shared.Constant;
namespace Win.Sfs.SettleAccount namespace Win.Sfs.SettleAccount
@ -807,13 +808,10 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigurePUB_SEC_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePUB_SEC_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<PUB_SEC_DETAIL>(b => builder.Entity<PUB_SEC_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_PUB_SEC_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_PUB_SEC_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -829,12 +827,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureHBPO_SEC_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_SEC_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_SEC_DETAIL>(b => builder.Entity<HBPO_SEC_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_HBPO_SEC_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_HBPO_SEC_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -850,12 +847,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
}); });
} }
private static void ConfigureBBAC_SEC_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureBBAC_SEC_DETAIL(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<BBAC_SEC_DETAIL>(b => builder.Entity<BBAC_SEC_DETAIL>(b =>
{ {
b.ToTable($"{options.TablePrefix}_BBAC_SEC_DETAIL", options.Schema); b.ToTable($"{options.TablePrefix}_BBAC_SEC_DETAIL", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
@ -872,14 +868,6 @@ namespace Win.Sfs.SettleAccount
}); });
} }
private static void ConfigureHBPO_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigureHBPO_SE_EDI(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {
builder.Entity<HBPO_SE_EDI>(b => builder.Entity<HBPO_SE_EDI>(b =>
@ -1165,7 +1153,6 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureVmi(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) 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 => builder.Entity<JobItem>(b =>
{ {
b.ToTable($"{options.TablePrefix}_JobItem", options.Schema); b.ToTable($"{options.TablePrefix}_JobItem", options.Schema);
@ -1176,7 +1163,12 @@ namespace Win.Sfs.SettleAccount
b.Property(o => o.Cron).HasMaxLength(50).IsRequired(); b.Property(o => o.Cron).HasMaxLength(50).IsRequired();
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50); 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<JobLog>(b =>
{
b.ToTable($"{options.TablePrefix}_JobLog", options.Schema);
b.ConfigureByConvention();
});
builder.Entity<VmiCategory>(b => builder.Entity<VmiCategory>(b =>
{ {
@ -1185,6 +1177,7 @@ namespace Win.Sfs.SettleAccount
b.Property(o => o.Number).HasMaxLength(50).IsRequired(); b.Property(o => o.Number).HasMaxLength(50).IsRequired();
b.HasIndex(o => o.Number).IsUnique(); b.HasIndex(o => o.Number).IsUnique();
b.Property(o => o.Name).HasMaxLength(50).IsRequired(); b.Property(o => o.Name).HasMaxLength(50).IsRequired();
b.HasIndex(o => o.Name).IsUnique();
}); });
builder.Entity<VmiBalance>(b => builder.Entity<VmiBalance>(b =>
@ -1193,20 +1186,29 @@ namespace Win.Sfs.SettleAccount
b.ConfigureByConvention(); b.ConfigureByConvention();
b.HasAlternateKey(o => new { o.ErpToLoc, o.PartCode, o.LU }); b.HasAlternateKey(o => new { o.ErpToLoc, o.PartCode, o.LU });
}); });
builder.Entity<VmiBalance>().HasData(new VmiBalance("test".ToGuid()) { ErpToLoc = "key1", PartCode = "key2", LU = "key3", Desc = "test" });
builder.Entity<VmiLog>(b => builder.Entity<VmiLog>(b =>
{ {
b.ToTable($"{options.TablePrefix}_VmiLog", options.Schema); b.ToTable($"{options.TablePrefix}_VmiLog", options.Schema);
b.ConfigureByConvention(); 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 => builder.Entity<VmiSnapshot>(b =>
{ {
b.ToTable($"{options.TablePrefix}_VmiSnapshot", options.Schema); b.ToTable($"{options.TablePrefix}_VmiSnapshot", options.Schema);
b.ConfigureByConvention(); b.ConfigureByConvention();
}); });
//seed
builder.Entity<JobItem>().HasData(new JobItem("vmi".ToGuid()) { Name = "库存快照", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
builder.Entity<VmiCategory>().HasData(new VmiCategory("发运".ToGuid()) { Type = VmiType.In, Name = "发运", Number = "100" });
builder.Entity<VmiCategory>().HasData(new VmiCategory("结算".ToGuid()) { Type = VmiType.Out, Name = "结算", Number = "200" });
builder.Entity<VmiCategory>().HasData(new VmiCategory("客户退货".ToGuid()) { Type = VmiType.Out, Name = "客户退货", Number = "300" });
builder.Entity<VmiCategory>().HasData(new VmiCategory("调整入库".ToGuid()) { Type = VmiType.In, Name = "调整入库", Number = "400" });
builder.Entity<VmiCategory>().HasData(new VmiCategory("调整出库".ToGuid()) { Type = VmiType.Out, Name = "调整出库", Number = "500" });
builder.Entity<VmiCategory>().HasData(new VmiCategory("漏发补货".ToGuid()) { Type = VmiType.In, Name = "漏发补货", Number = "600" });
builder.Entity<VmiCategory>().HasData(new VmiCategory("负库存补货".ToGuid()) { Type = VmiType.In, Name = "负库存补货", Number = "700" });
} }
} }

26
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/VmiSqliteContext.cs

@ -0,0 +1,26 @@
using System;
using Microsoft.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
namespace Win.Sfs.SettleAccount.EntityFrameworkCore;
public class VmiSqliteContext : DbContext
{
private readonly string _connectionString;
public VmiSqliteContext(string connectionString)
{
this._connectionString = connectionString;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite(this._connectionString);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<VmiBalance>().HasKey(o => o.Id);
modelBuilder.Entity<VmiBalance>().Property<DateTime>("BackupDate");
}
}

4896
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230724063308_vmi3.Designer.cs

File diff suppressed because it is too large

435
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230724063308_vmi3.cs

@ -0,0 +1,435 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class vmi3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_JobLog_Set_JobItem_JobId",
table: "JobLog");
migrationBuilder.DropPrimaryKey(
name: "PK_JobLog",
table: "JobLog");
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c318a2b7-df89-4c68-aa3a-0e9c470d584f"));
migrationBuilder.RenameTable(
name: "JobLog",
newName: "Set_JobLog");
migrationBuilder.RenameColumn(
name: "SessionId",
table: "Set_VmiLog",
newName: "VinCode");
migrationBuilder.RenameIndex(
name: "IX_JobLog_JobId",
table: "Set_JobLog",
newName: "IX_Set_JobLog_JobId");
migrationBuilder.AddColumn<string>(
name: "BalanceDesc",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "CodeType",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "CreationTime",
table: "Set_VmiLog",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "D2",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Desc",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ErpToLoc",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "F2",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "G2",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "GroupId",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "H2",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "I2",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "J2",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "K2",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "LU",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "MatchNumber",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PartCode",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PjsNum",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ProType",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<decimal>(
name: "Qty",
table: "Set_VmiLog",
type: "decimal(18,2)",
nullable: false,
defaultValue: 0m);
migrationBuilder.AddColumn<string>(
name: "SeqNumber",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "ShippingDate",
table: "Set_VmiLog",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "Tmpe4",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "UniqueCode",
table: "Set_VmiLog",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "VmiType",
table: "Set_VmiLog",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<Guid>(
name: "JobId",
table: "Set_JobLog",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_Set_JobLog",
table: "Set_JobLog",
column: "Id");
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" },
values: new object[] { new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "CodeType", "CreationTime", "Desc", "ErpToLoc", "LU", "MatchNumber", "PartCode", "PjsNum", "ProType", "Qty", "SeqNumber", "ShippingDate", "Tmpe4", "UniqueCode", "VinCode" },
values: new object[] { new Guid("cd6b8f09-2146-73d3-cade-4e832627b4f6"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "test", "key1", "key3", null, "key2", null, null, 0m, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, null });
migrationBuilder.InsertData(
table: "Set_VmiCategory",
columns: new[] { "Id", "Name", "Number", "Type" },
values: new object[,]
{
{ new Guid("a6462ee4-6e2c-bc8b-b1cb-5203c8dcaea8"), "发运", "100", 0 },
{ new Guid("869f1589-9063-a545-719e-a83b6dca03c3"), "结算", "200", 1 },
{ new Guid("c9199f7f-7cc8-7423-d608-f206167ae0b6"), "客户退货", "300", 1 },
{ new Guid("5fda8ad4-f424-a9e1-8174-72c0f29fc225"), "调整入库", "400", 0 },
{ new Guid("42230472-9f26-7484-ff2a-451878e9955f"), "调整出库", "500", 1 },
{ new Guid("3e0655a6-2532-a861-344f-b9c53c809c64"), "漏发补货", "600", 0 },
{ new Guid("27b1609e-05af-cef7-f5f4-dd598c31b4de"), "负库存补货", "700", 0 }
});
migrationBuilder.CreateIndex(
name: "IX_Set_VmiCategory_Name",
table: "Set_VmiCategory",
column: "Name",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_Set_JobLog_Set_JobItem_JobId",
table: "Set_JobLog",
column: "JobId",
principalTable: "Set_JobItem",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Set_JobLog_Set_JobItem_JobId",
table: "Set_JobLog");
migrationBuilder.DropIndex(
name: "IX_Set_VmiCategory_Name",
table: "Set_VmiCategory");
migrationBuilder.DropPrimaryKey(
name: "PK_Set_JobLog",
table: "Set_JobLog");
migrationBuilder.DeleteData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"));
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("cd6b8f09-2146-73d3-cade-4e832627b4f6"));
migrationBuilder.DeleteData(
table: "Set_VmiCategory",
keyColumn: "Id",
keyValue: new Guid("27b1609e-05af-cef7-f5f4-dd598c31b4de"));
migrationBuilder.DeleteData(
table: "Set_VmiCategory",
keyColumn: "Id",
keyValue: new Guid("3e0655a6-2532-a861-344f-b9c53c809c64"));
migrationBuilder.DeleteData(
table: "Set_VmiCategory",
keyColumn: "Id",
keyValue: new Guid("42230472-9f26-7484-ff2a-451878e9955f"));
migrationBuilder.DeleteData(
table: "Set_VmiCategory",
keyColumn: "Id",
keyValue: new Guid("5fda8ad4-f424-a9e1-8174-72c0f29fc225"));
migrationBuilder.DeleteData(
table: "Set_VmiCategory",
keyColumn: "Id",
keyValue: new Guid("869f1589-9063-a545-719e-a83b6dca03c3"));
migrationBuilder.DeleteData(
table: "Set_VmiCategory",
keyColumn: "Id",
keyValue: new Guid("a6462ee4-6e2c-bc8b-b1cb-5203c8dcaea8"));
migrationBuilder.DeleteData(
table: "Set_VmiCategory",
keyColumn: "Id",
keyValue: new Guid("c9199f7f-7cc8-7423-d608-f206167ae0b6"));
migrationBuilder.DropColumn(
name: "BalanceDesc",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "CodeType",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "CreationTime",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "D2",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "Desc",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "ErpToLoc",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "F2",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "G2",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "GroupId",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "H2",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "I2",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "J2",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "K2",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "LU",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "MatchNumber",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "PartCode",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "PjsNum",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "ProType",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "Qty",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "SeqNumber",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "ShippingDate",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "Tmpe4",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "UniqueCode",
table: "Set_VmiLog");
migrationBuilder.DropColumn(
name: "VmiType",
table: "Set_VmiLog");
migrationBuilder.RenameTable(
name: "Set_JobLog",
newName: "JobLog");
migrationBuilder.RenameColumn(
name: "VinCode",
table: "Set_VmiLog",
newName: "SessionId");
migrationBuilder.RenameIndex(
name: "IX_Set_JobLog_JobId",
table: "JobLog",
newName: "IX_JobLog_JobId");
migrationBuilder.AlterColumn<Guid>(
name: "JobId",
table: "JobLog",
type: "uniqueidentifier",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uniqueidentifier");
migrationBuilder.AddPrimaryKey(
name: "PK_JobLog",
table: "JobLog",
column: "Id");
migrationBuilder.InsertData(
table: "Set_JobItem",
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" },
values: new object[] { new Guid("c318a2b7-df89-4c68-aa3a-0e9c470d584f"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" });
migrationBuilder.AddForeignKey(
name: "FK_JobLog_Set_JobItem_JobId",
table: "JobLog",
column: "JobId",
principalTable: "Set_JobItem",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
}
}
}

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

@ -18,7 +18,7 @@ namespace Win.Sfs.SettleAccount.Migrations
modelBuilder modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer)
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.8") .HasAnnotation("ProductVersion", "5.0.17")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_CAN_SA", b => modelBuilder.Entity("SettleAccount.Domain.BQ.BBAC_CAN_SA", b =>
@ -3674,7 +3674,7 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData( b.HasData(
new new
{ {
Id = new Guid("c318a2b7-df89-4c68-aa3a-0e9c470d584f"), Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
Cron = "0 0 8 26 *", Cron = "0 0 8 26 *",
IsRunning = false, IsRunning = false,
Name = "库存快照", Name = "库存快照",
@ -3694,7 +3694,7 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("Exception") b.Property<string>("Exception")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<Guid?>("JobId") b.Property<Guid>("JobId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<DateTime>("Start") b.Property<DateTime>("Start")
@ -3707,7 +3707,7 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasIndex("JobId"); b.HasIndex("JobId");
b.ToTable("JobLog"); b.ToTable("Set_JobLog");
}); });
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiBalance", b => modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiBalance", b =>
@ -3769,6 +3769,19 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasAlternateKey("ErpToLoc", "PartCode", "LU"); b.HasAlternateKey("ErpToLoc", "PartCode", "LU");
b.ToTable("Set_VmiBalance"); b.ToTable("Set_VmiBalance");
b.HasData(
new
{
Id = new Guid("cd6b8f09-2146-73d3-cade-4e832627b4f6"),
CreationTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Desc = "test",
ErpToLoc = "key1",
LU = "key3",
PartCode = "key2",
Qty = 0m,
ShippingDate = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)
});
}); });
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiCategory", b => modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiCategory", b =>
@ -3792,10 +3805,64 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.HasIndex("Number") b.HasIndex("Number")
.IsUnique(); .IsUnique();
b.ToTable("Set_VmiCategory"); b.ToTable("Set_VmiCategory");
b.HasData(
new
{
Id = new Guid("a6462ee4-6e2c-bc8b-b1cb-5203c8dcaea8"),
Name = "发运",
Number = "100",
Type = 0
},
new
{
Id = new Guid("869f1589-9063-a545-719e-a83b6dca03c3"),
Name = "结算",
Number = "200",
Type = 1
},
new
{
Id = new Guid("c9199f7f-7cc8-7423-d608-f206167ae0b6"),
Name = "客户退货",
Number = "300",
Type = 1
},
new
{
Id = new Guid("5fda8ad4-f424-a9e1-8174-72c0f29fc225"),
Name = "调整入库",
Number = "400",
Type = 0
},
new
{
Id = new Guid("42230472-9f26-7484-ff2a-451878e9955f"),
Name = "调整出库",
Number = "500",
Type = 1
},
new
{
Id = new Guid("3e0655a6-2532-a861-344f-b9c53c809c64"),
Name = "漏发补货",
Number = "600",
Type = 0
},
new
{
Id = new Guid("27b1609e-05af-cef7-f5f4-dd598c31b4de"),
Name = "负库存补货",
Number = "700",
Type = 0
});
}); });
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiLog", b => modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiLog", b =>
@ -3804,27 +3871,99 @@ namespace Win.Sfs.SettleAccount.Migrations
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("BalanceDesc")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("BalanceId") b.Property<Guid>("BalanceId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<Guid>("CategoryId") b.Property<Guid>("CategoryId")
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<string>("CodeType")
.HasColumnType("nvarchar(max)");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedDate") b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2");
b.Property<string>("D2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc")
.HasColumnType("nvarchar(max)");
b.Property<string>("ErpToLoc")
.HasColumnType("nvarchar(max)");
b.Property<string>("F2")
.HasColumnType("nvarchar(max)");
b.Property<string>("G2")
.HasColumnType("nvarchar(max)");
b.Property<string>("GroupId")
.HasColumnType("nvarchar(max)");
b.Property<string>("H2")
.HasColumnType("nvarchar(max)");
b.Property<string>("I2")
.HasColumnType("nvarchar(max)");
b.Property<string>("J2")
.HasColumnType("nvarchar(max)");
b.Property<string>("K2")
.HasColumnType("nvarchar(max)");
b.Property<string>("LU")
.HasColumnType("nvarchar(max)");
b.Property<string>("MatchNumber")
.HasColumnType("nvarchar(max)");
b.Property<string>("OrderNumber") b.Property<string>("OrderNumber")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("SessionId") b.Property<string>("PartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("PjsNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("ProType")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Qty")
.HasColumnType("decimal(18,2)");
b.Property<string>("SeqNumber")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ShippingDate")
.HasColumnType("datetime2");
b.Property<string>("Tmpe4")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int>("Type") b.Property<int>("Type")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("UniqueCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("VinCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("VmiType")
.HasColumnType("int");
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("BalanceId"); b.HasIndex("BalanceId");
@ -4718,9 +4857,10 @@ namespace Win.Sfs.SettleAccount.Migrations
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobLog", b => modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobLog", b =>
{ {
b.HasOne("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobItem", "Job") b.HasOne("Win.Sfs.SettleAccount.Entities.BQ.Vmi.JobItem", "Job")
.WithMany("Logs") .WithMany()
.HasForeignKey("JobId") .HasForeignKey("JobId")
.OnDelete(DeleteBehavior.SetNull); .OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Job"); b.Navigation("Job");
}); });
@ -4728,7 +4868,7 @@ namespace Win.Sfs.SettleAccount.Migrations
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiLog", b => modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiLog", b =>
{ {
b.HasOne("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiBalance", "Balance") b.HasOne("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiBalance", "Balance")
.WithMany("Logs") .WithMany()
.HasForeignKey("BalanceId") .HasForeignKey("BalanceId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.Cascade)
.IsRequired(); .IsRequired();
@ -4744,16 +4884,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Navigation("Category"); 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 => modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.BQ.Vmi.VmiCategory", b =>
{ {
b.Navigation("Logs"); b.Navigation("Logs");

2
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountNormalEfCoreRepository.cs

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

5
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/SettleAccount.EntityFrameworkCore.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\common.props" /> <Import Project="..\..\common.props" />
@ -26,10 +26,11 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" Version="5.0.0" /> <PackageReference Include="FlexLabs.EntityFrameworkCore.Upsert" Version="5.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.8"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.17">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.17" />
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="4.3.3" /> <PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="4.3.3" />
<PackageReference Include="Volo.Abp.Dapper" Version="4.3.3" /> <PackageReference Include="Volo.Abp.Dapper" Version="4.3.3" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="4.3.3" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="4.3.3" />

15
code/src/Shared/Win.Sfs.Shared/SharedExtensions.cs

@ -0,0 +1,15 @@
using System;
using System.Security.Cryptography;
using System.Text;
namespace Win.Sfs.Shared
{
public static class SharedExtensions
{
public static Guid ToGuid(this string input)
{
var hash = MD5.HashData(Encoding.UTF8.GetBytes(input));
return new Guid(hash);
}
}
}
Loading…
Cancel
Save