Browse Source

update

master
wanggang 1 year ago
parent
commit
7e3142f07b
  1. 20
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Program.cs
  2. 19
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  3. 45
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/components/list/index.js
  4. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/vmi/log.js
  5. 333
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  6. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiBalance.cs
  7. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs
  8. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/SettleAccount.Domain.csproj
  9. 38
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/OrderVirtualTableRoute.cs

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

@ -15,16 +15,16 @@ public class Program
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json", optional: true, reloadOnChange: true)
.Build();
try
{
new InfluxHelper(configuration).Start();
}
catch (Exception ex)
{
Console.Write("时序数据库启动失败");
Console.Write(ex.ToString());
//throw;
}
//try
//{
// new InfluxHelper(configuration).Start();
//}
//catch (Exception ex)
//{
// Console.Write("时序数据库启动失败");
// Console.Write(ex.ToString());
// //throw;
//}
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)

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

@ -55,24 +55,7 @@ public class Startup
services.AddSignalR(o => o.EnableDetailedErrors = true);
JobHostdService.AddService(services);
services.AddSingleton<JobHostdService>();
//services.AddHostedService(o => o.GetRequiredService<JobHostdService>());
services.AddShardingDbContext<SettleAccountDbContext>()
.UseRouteConfig(options => options.AddShardingTableRoute<OrderVirtualTableRoute>())
.UseConfig(op =>
{
op.UseShardingQuery((connStr, builder) =>
{
builder.UseSqlServer(connStr);
});
op.UseShardingTransaction((connection, builder) =>
{
//connection is delegate input param
builder.UseSqlServer(connection);
});
//use your data base connection string
op.AddDefaultDataSource("SettleAccountService",Configuration.GetConnectionString("SettleAccountService"));
})
.AddShardingCore();
services.AddHostedService(o => o.GetRequiredService<JobHostdService>());
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>();

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

@ -24,7 +24,7 @@ export default {
<app-form inline mode="query" label-position="left" :schema="config.query.schema" v-model="queryModel" @submit="load" :hideButton="true" :isQueryForm="true">
<template v-for="item in filterList.filter(o=>!o.hidden&&o.readOnly)">
<template v-if="config.edit.schema.properties[item.column]?.title">
<el-form-item :label="config.edit.schema.properties[item.column].title">
<el-form-item :label="item.title??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>
</template>
@ -211,33 +211,6 @@ export default {
style="height:100%;"
/>
</template>
<template v-else-if="editFormMode==='compare'">
<el-form :model="exportModel" style="height:100%;">
<el-form-item label="选择期间" label-width="100px">
<el-select v-model="exportModel.version">
<el-option v-for="item in versions" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<template v-if="isNotJit">
<el-form-item label="发运日期" label-width="100px">
<el-date-picker v-model="exportModel.seStartDateTime" value-format="YYYY-MM-DD" />
<span style="margin:0 .5em;">-</span>
<el-date-picker v-model="exportModel.seEndDateTime" value-format="YYYY-MM-DD" />
</el-form-item>
<el-form-item label="下线日期" label-width="100px">
<el-date-picker v-model="exportModel.downLineStartDateTime" value-format="YYYY-MM-DD" />
<span style="margin:0 .5em;">-</span>
<el-date-picker v-model="exportModel.downLineEndDateTime" value-format="YYYY-MM-DD" />
</el-form-item>
</template>
<el-form-item label="通用码" label-width="100px">
<el-input type="textarea" v-model="exportModel.pn" />
</el-form-item>
<el-form-item label="客户零件号" label-width="100px">
<el-input type="textarea" v-model="exportModel.lu" />
</el-form-item>
</el-form>
</template>
<template v-else-if="editFormMode==='import'">
<app-form
ref="importFormRef"
@ -374,17 +347,6 @@ export default {
const editFormTitle = ref("");
const editFormSchema = ref(null);
const editFormModel = ref(null);
const defaultExportModel = {
version: "",
seStartDateTime: "",
seEndDateTime: "",
downLineStartDateTime: "",
downLineEndDateTime: "",
ln: "",
pn: "",
businessType: route.meta.businessType,
};
const exportModel = ref(defaultExportModel);
//
config.import ??= { schema: { type: "object", properties: {} } };
config.import.schema.properties.files ??= {
@ -658,10 +620,6 @@ export default {
} else if (editFormMode.value === "details") {
dialogVisible.value = false;
editFormMode.value = null;
} else if (editFormMode.value === "compare") {
const url = config.edit.compareUrl;
await request(url, exportModel.value, { method: config.edit.compareMethod });
dialogVisible.value = false;
} else if (editFormMode.value === "import") {
try {
const valid = await importFormRef.value.validate();
@ -886,7 +844,6 @@ export default {
editFormTitle,
editFormSchema,
editFormModel,
exportModel,
importModel,
onPageSizeChange,
onPageIndexChange,

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

@ -99,6 +99,7 @@ export default function () {
action: "biggerThanOrEqual",
value: null,
readOnly: true,
title: "发运开始",
},
{
logic: "and",
@ -106,6 +107,7 @@ export default function () {
action: "smallThanOrEqual",
value: null,
readOnly: true,
title: "发运结束",
},
],
},

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

@ -121,36 +121,6 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
return this.ImportInternal<PUB_ADJ_DETAIL_IMP_DTO>(ms.ToArray());
}
private List<T> ImportInternal<T>(byte[] data)
{
var list = new List<T>();
using var workbook = new XLWorkbook(new MemoryStream(data));
var properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty)
.Where(o => o.GetAttributes<ImporterHeaderAttribute>().Any())
.ToDictionary(o => o.GetAttribute<ImporterHeaderAttribute>().Name, o => o);
var ws = workbook.Worksheets.FirstOrDefault();
for (int rowIndex = 2; rowIndex <= ws.RowsUsed().Count(); rowIndex++)
{
var row = ws.Row(rowIndex);
var model = Activator.CreateInstance<T>();
list.Add(model);
for (var columnIndex = 1; columnIndex < ws.ColumnsUsed().Count(); columnIndex++)
{
var cell = row.Cell(columnIndex);
var headerName = ws.Cell(1, columnIndex).Value.ToString().Trim();
if (properties.TryGetValue(headerName, out var property))
{
var value = cell.Value.ToString();
if (!string.IsNullOrEmpty(value))
{
property.SetValue(model, Convert.ChangeType(value, property.PropertyType));
}
}
}
}
return list;
}
/// <summary>
/// 定时备份:0 0 8 26 * ?
/// </summary>
@ -212,165 +182,6 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
}
}
/// <summary>
/// 发运入库\反结入库\调整入库
/// </summary>
/// <param name="logType">库存事务类型</param>
/// <param name="changedNumber">关联单号</param>
/// <param name="data">入库数据</param>
/// <returns></returns>
[HttpPost]
public async Task In(VmiLogType logType, string changedNumber, VmiBalance data)
{
await Policy.Handle<Exception>().WaitAndRetryAsync(5, o => TimeSpan.FromSeconds(o), (e, i) =>
{
Console.WriteLine($"入库类型:{logType.GetDisplayName()},重试次数:{i},异常信息:{e.Message}");
}).ExecuteAsync(async () =>
{
using var scope = _serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var balance = db.Set<VmiBalance>().FirstOrDefault(
o => o.DeliverBillType == data.DeliverBillType &&
o.CodeType == data.CodeType &&
o.DeliverBillType == data.DeliverBillType &&
o.VinCode == data.VinCode &&
o.ErpToLoc == data.ErpToLoc &&
o.OrderNum == data.OrderNum &&
o.factory == data.factory &&
o.Configcode == data.Configcode);
var log = new VmiLog(GuidGenerator.Create())
{
LogType = logType,
ChangedType = VmiType.In,
ChangedNumber = changedNumber,
ChangedTime = DateTime.Now,
ChangedBy = _currentUser.UserName,
ChangedQty = data.Qty,
};
if (balance == null)
{
balance = new VmiBalance(GuidGenerator.Create());
balance.InjectFrom(data);
await db.Set<VmiBalance>().AddAsync(balance).ConfigureAwait(false);
//新建库存,库存事务种库存备份的初始库存为0
log.InjectFrom(balance);
log.Qty = 0;
}
else
{
//已有库存,直接备份
log.InjectFrom(balance);
var qty = balance.Qty + data.Qty;
if (logType == VmiLogType.Type100)
{
//发运入库,只更新库存
}
else if (logType == VmiLogType.Type300)
{
//反结入库,只更新库存
}
else if (logType == VmiLogType.Type500)
{
//调整入库,更新库存和其他字段
balance.InjectFrom(data);
}
// 加库存
balance.Qty = qty;
if (balance.Qty == decimal.Zero)
{
db.Set<VmiBalance>().Remove(balance);
}
if (logType == VmiLogType.Type100 && balance.Qty < decimal.Zero && data.Qty > 0)
{
log.IsReplenished = true;
}
}
await db.Set<VmiLog>().AddAsync(log).ConfigureAwait(false);
await db.SaveChangesAsync().ConfigureAwait(false);
}).ConfigureAwait(false);
}
/// <summary>
/// 结算出库\退货出库\调整出库
/// </summary>
/// <param name="logType"></param>
/// <param name="changedNumber"></param>
/// <param name="data"></param>
/// <returns></returns>
[HttpPost]
public async Task Out(VmiLogType logType, string changedNumber, VmiLog data)
{
await Policy.Handle<Exception>().WaitAndRetryAsync(5, o => TimeSpan.FromSeconds(o), (e, i) =>
{
Console.WriteLine($"出库类型:{logType.GetDisplayName()},重试次数:{i},异常信息:{e.Message}");
}).ExecuteAsync(async () =>
{
using var scope = _serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var balance = db.Set<VmiBalance>().FirstOrDefault(
o => o.DeliverBillType == data.DeliverBillType &&
o.CodeType == data.CodeType &&
o.DeliverBillType == data.DeliverBillType &&
o.VinCode == data.VinCode &&
o.ErpToLoc == data.ErpToLoc &&
o.OrderNum == data.OrderNum &&
o.factory == data.factory &&
o.Configcode == data.Configcode);
var log = new VmiLog(GuidGenerator.Create())
{
LogType = logType,
ChangedType = VmiType.Out,
ChangedNumber = changedNumber,
ChangedTime = DateTime.Now,
ChangedBy = _currentUser.UserName,
ChangedQty = data.Qty,
};
if (balance == null)
{
//负库存出库
balance = new VmiBalance(GuidGenerator.Create());
balance.InjectFrom(data);
//新建库存,库存事务种库存备份的初始库存为0
log.InjectFrom(data);
log.Qty = 0;
// 负库存
balance.Qty = -data.Qty;
await db.Set<VmiBalance>().AddAsync(balance).ConfigureAwait(false);
}
else
{
//已有库存,直接备份
log.InjectFrom(data);//更新附加字段
log.InjectFrom(balance);//备份库存
// 减库存
balance.Qty -= data.Qty; ;
if (logType == VmiLogType.Type200)
{
//结算出库,只更新库存
}
else if (logType == VmiLogType.Type400)
{
//退货出库,只更新库存
}
else if (logType == VmiLogType.Type600)
{
//调整出库,更新库存和其他字段
balance.InjectFrom(data);
}
if (balance.Qty == decimal.Zero)
{
db.Set<VmiBalance>().Remove(balance);
}
}
await db.Set<VmiLog>().AddAsync(log).ConfigureAwait(false);
await db.SaveChangesAsync().ConfigureAwait(false);
}).ConfigureAwait(false);
}
/// <summary>
/// 1.库存余额查询
/// </summary>
@ -379,33 +190,9 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
[HttpPost]
public async Task<PagedResultDto<VmiBalance>> Balance(RequestDto input)
{
var db = GetSqlSugarDbClient();
var query = db.Queryable<VmiBalance>().AS("Set_VmiBalance").Where(input.Filters.ToLambda<VmiBalance>());
var totalCount = query.Count();
query = string.IsNullOrEmpty(input.Sorting) ? query : query.OrderBy(input.Sorting);
var entities = await query.Skip(input.SkipCount).Take(input.MaxResultCount).ToListAsync().ConfigureAwait(false);
var entities = await _balanceRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _balanceRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
return new PagedResultDto<VmiBalance>(totalCount, entities);
//var entities = await _balanceRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
//var totalCount = await _balanceRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
//return new PagedResultDto<VmiBalance>(totalCount, entities);
}
private SqlSugarClient GetSqlSugarDbClient()
{
return new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = this._cfg.GetConnectionString("SettleAccountService"),
DbType = DbType.SqlServer,
IsAutoCloseConnection = true,
MoreSettings = new ConnMoreSettings
{
IsWithNoLockQuery = true
},
}, db => {
db.Aop.OnLogExecuted = (sql,args)=> {
Debug.WriteLine(sql);
};
});
}
/// <summary>
@ -429,18 +216,9 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
[HttpPost]
public async Task<PagedResultDto<VmiLog>> Log(LogRequestDto input)
{
var db = GetSqlSugarDbClient();
var query = db.Queryable<VmiLog>().AS("Set_VmiLog").Where(input.Filters.ToLambda<VmiLog>());
var totalCount = query.Count();
query = string.IsNullOrEmpty(input.Sorting) ? query : query.OrderBy(input.Sorting);
var entities = await query.Skip(input.SkipCount).Take(input.MaxResultCount).ToListAsync().ConfigureAwait(false);
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);
return new PagedResultDto<VmiLog>(totalCount, entities);
//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);
//return new PagedResultDto<VmiLog>(totalCount, entities);
// GetSqlSugarDbClient().Queryable<VmiLog>().SplitTable()
}
/// <summary>
@ -462,7 +240,6 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
[HttpPost]
public async Task<string> ReplenishedExportAsync(RequestDto input)
{
//input.Filters.Add(new FilterCondition { Logic = EnumFilterLogic.And, Action = EnumFilterAction.NotEqual, Column = "IsReplenished", Value = "null" });
var entities = await _logRepository.GetListByFilterAsync(input.Filters).ConfigureAwait(false);
//IQueryable<VmiLog> query = _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>());
var fileName = $"补货数据_{DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss")}.xlsx";
@ -471,33 +248,6 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
return fileName;
}
private PagedResultDto<VmiLog> QueryLogFromTSDb(RequestDto input)
{
var query = new InfluxHelper(_cfg).Query<VmiLog>().Where(input.Filters.ToLambda<VmiLog>());
var count = query.Count();
input.Sorting?.Split(',').Select(o => o.Trim()).Where(o => !string.IsNullOrEmpty(o)).ForEach(o =>
{
var values = o.Split(' ').Select(o => o.Trim()).Where(o => !string.IsNullOrEmpty(o)).ToArray();
if (values.Length == 1)
{
query = query.OrderBy(values[0]);
}
else if (values.Length == 2)
{
if (values[1].ToLowerInvariant() == "desc")
{
query = query.OrderByPropertyName(values[0], SqlSugar.OrderByType.Desc);
}
else
{
query = query.OrderBy(values[0]);
}
}
});
var entities = query.Skip(input.SkipCount).Take(input.MaxResultCount).ToList();
return new PagedResultDto<VmiLog>(count, entities);
}
/// <summary>
/// 4.寄售库存调整
/// </summary>
@ -506,21 +256,20 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
[HttpPost]
public async Task EditBalance(VmiLog log)
{
if (log.Qty >= decimal.Zero)
log.SetId(GuidGenerator.Create());
if (log.ChangedQty >= decimal.Zero)
{
log.Qty = log.ChangedQty;
log.LogType = VmiLogType.Type500;
log.ChangedType = VmiType.In;
var data = new VmiBalance();
data.InjectFrom(log);
await In(VmiLogType.Type500, null, data).ConfigureAwait(false);
}
else
{
log.Qty = -log.Qty;
log.LogType = VmiLogType.Type600;
log.ChangedType = VmiType.Out;
log.Qty = -log.Qty;
await this.Out(VmiLogType.Type600, null, log).ConfigureAwait(false);
}
log.ChangedBy = this._currentUser.UserName;
}
/// <summary>
@ -555,26 +304,20 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
[HttpPost]
public async Task<PagedResultDto<VmiBalance>> Backup(BackupListRequest input)
{
var db = GetSqlSugarDbClient();
var query = db.Queryable<VmiBalance>().AS(input.Name).Where(input.Filters.ToLambda<VmiBalance>());
using var scope = this._serviceProvider.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
var name = input.Name;
var sql = $"select * from {name}";
var query = db.Set<VmiBalance>().FromSqlRaw(sql);
var filters = input.Filters.ToLambda<VmiBalance>();
if (input.Filters.Count > 0)
{
query = query.Where(input.Filters.ToLambda<VmiBalance>());
}
var totalCount = query.Count();
query = string.IsNullOrEmpty(input.Sorting) ? query : query.OrderBy(input.Sorting);
var entities = await query.Skip(input.SkipCount).Take(input.MaxResultCount).ToListAsync().ConfigureAwait(false);
query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false);
return new PagedResultDto<VmiBalance>(totalCount, entities);
//using var scope = this._serviceProvider.CreateScope();
//var db = scope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
//var name = input.Name;
//var sql = $"select * from {name}";
//var query = db.Set<VmiBalance>().FromSqlRaw(sql);
//var filters = input.Filters.ToLambda<VmiBalance>();
//if (input.Filters.Count > 0)
//{
// query = query.Where(input.Filters.ToLambda<VmiBalance>());
//}
//var totalCount = query.Count();
//query = string.IsNullOrEmpty(input.Sorting) ? query : DynamicQueryableExtensions.OrderBy(query, input.Sorting);
//var entities = await query.PageBy(input.SkipCount, input.MaxResultCount).ToListAsync().ConfigureAwait(false);
//return new PagedResultDto<VmiBalance>(totalCount, entities);
}
/// <summary>
@ -601,6 +344,35 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
return fileName;
}
private List<T> ImportInternal<T>(byte[] data)
{
var list = new List<T>();
using var workbook = new XLWorkbook(new MemoryStream(data));
var properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty)
.Where(o => o.GetAttributes<ImporterHeaderAttribute>().Any())
.ToDictionary(o => o.GetAttribute<ImporterHeaderAttribute>().Name, o => o);
var ws = workbook.Worksheets.FirstOrDefault();
for (int rowIndex = 2; rowIndex <= ws.RowsUsed().Count(); rowIndex++)
{
var row = ws.Row(rowIndex);
var model = Activator.CreateInstance<T>();
list.Add(model);
for (var columnIndex = 1; columnIndex < ws.ColumnsUsed().Count(); columnIndex++)
{
var cell = row.Cell(columnIndex);
var headerName = ws.Cell(1, columnIndex).Value.ToString().Trim();
if (properties.TryGetValue(headerName, out var property))
{
var value = cell.Value.ToString();
if (!string.IsNullOrEmpty(value))
{
property.SetValue(model, Convert.ChangeType(value, property.PropertyType));
}
}
}
}
return list;
}
private byte[] GetContent<TExport>(List<TExport> entities, string name = "sheet1")
{
@ -672,6 +444,11 @@ public class VmiAppService : ApplicationService, IJobService, ITransientDependen
}
}
internal Task Out(VmiLogType type200, string v, VmiLog vmiLog)
{
throw new NotImplementedException();
}
//private void SetPropertyValue(PropertyInfo property, VmiLog entity, string value)
//{
// try

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

@ -2,10 +2,6 @@ using System;
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi;
/// <summary>
/// ERP库位+零件号+生产码
/// </summary>
//[SugarTable("Set_VmiBalance")]
public class VmiBalance : VmiBalanceBase
{
public VmiBalance()

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

@ -18,6 +18,11 @@ public class VmiLog : VmiBalanceBase
ConcurrencyStamp = Guid.NewGuid().ToString("N");
}
public void SetId(Guid id)
{
this.Id = id;
}
[Display(Name = "库存事务分类", Order = 0)]
public VmiLogType LogType { get; set; }
@ -25,7 +30,7 @@ public class VmiLog : VmiBalanceBase
public string ChangedNumber { get; set; }
[Display(Name = "变动时间", Order = 2)]
public DateTime ChangedTime { get; set; }
public DateTime ChangedTime { get; set; }=DateTime.Now;
[Display(Name = "变动类型", Order = 3)]
public VmiType ChangedType { get; set; }

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/SettleAccount.Domain.csproj

@ -42,7 +42,6 @@
<PackageReference Include="EFCore.BulkExtensions" Version="5.2.8" />
<PackageReference Include="Magicodes.IE.Csv" Version="2.5.4.6" />
<PackageReference Include="Magicodes.IE.Excel" Version="2.5.4.6" />
<PackageReference Include="SqlSugar" Version="5.1.4.102" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="4.3.3" />
<PackageReference Include="Volo.Abp.BackgroundJobs.HangFire" Version="4.3.3" />
<PackageReference Include="Volo.Abp.BlobStoring" Version="4.3.3" />

38
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/OrderVirtualTableRoute.cs

@ -1,38 +0,0 @@
using System;
using ShardingCore.Core.EntityMetadatas;
using ShardingCore.VirtualRoutes.Months;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
namespace Win.Sfs.SettleAccount.EntityFrameworkCore;
public class OrderVirtualTableRoute : AbstractSimpleShardingMonthKeyDateTimeVirtualTableRoute<VmiLog>
{
/// <summary>
/// fixed value don't use DateTime.Now because if if application restart this value where change
/// </summary>
/// <returns></returns>
public override DateTime GetBeginTime()
{
return new DateTime(2023, 1, 1);
}
/// <summary>
/// configure sharding property
/// </summary>
/// <param name="builder"></param>
public override void Configure(EntityMetadataTableBuilder<VmiLog> builder)
{
builder.ShardingProperty(o => o.CreatedTime);
}
/// <summary>
/// enable auto create table job
/// </summary>
/// <returns></returns>
public override bool AutoCreateTableByTime()
{
return true;
}
}
Loading…
Cancel
Save