Browse Source

更新代码

master
zhaoxinyu 10 months ago
parent
commit
4391420933
  1. 4
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  2. 99
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  3. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs
  4. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  5. 117
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Vmi/VmiLog.cs

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

@ -3,9 +3,9 @@
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
},
"ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
//"SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"SettleAccountService": "Server=dev.ccwin-in.com,13326;Database=BQ_SA;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"ExChangeCenterService": "Server=dev.ccwin-in.com,13326;Database=ExChangeCenter;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;",
"WMSBJBMPT": "Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;",
"questdb": "host=dev.ccwin-in.com;port=10580;username=admin;password=quest;database=vmi;ServerCompatibilityMode=NoTypeLoading;"

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

@ -97,9 +97,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INormalEfCoreRepository<CodeSetting, Guid> codeRepository,
INormalEfCoreRepository<VmiBalanceSumDetail, Guid> vmiBalanceSumDetailRepository,
INormalEfCoreRepository<BalanceSum, Guid> balanceSumRepository,
IBlobContainer<MyFileContainer> fileContainer,
Volo.Abp.ObjectMapping.IObjectMapper maper,
IHubContext<PageHub> hubContext,
@ -178,7 +175,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
/// <summary>
/// 定时备份:0 0 8 26 * ?
/// 定时备份:0 0 8 26 * ?(作废)
/// </summary>
[HttpPost("invoke")]
[DisableValidation]
@ -188,7 +185,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
try
{
Invoke(_serviceProvider).Wait();
// Invoke(_serviceProvider).Wait();
return new JsonResult(new { Code = 200, Message = "备份成功" });
}
catch (Exception ex)
@ -330,7 +327,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
/// <summary>
/// 快照列表
/// 快照列表(作废)
/// </summary>
[HttpPost]
public ListResultDto<VmiSnapshot> Snapshot()
@ -343,26 +340,28 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
/// <summary>
/// 2.时点库存查询
/// 2.时点库存查询(作废)
/// </summary>
[HttpPost]
public async Task<PagedResultDto<VmiBalance>> Backup(BackupListRequest input)
{
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var db = new SettleAccountDbContext(options);
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);
var entities=new List<VmiBalance>();
//var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
//var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
//using var db = new SettleAccountDbContext(options);
//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>(1, entities);
}
/// <summary>
@ -770,36 +769,40 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// </summary>
/// <param name="files"></param>
[HttpPost]
public async Task<IActionResult> ImportSE(List<IFormFile> files, EnumBusinessType businessType)
public async Task<IActionResult> ImportSE(IFormFileCollection files , EnumBusinessType businessType)
{
try
{
ExportImporter _exportImporter = new ExportImporter();
var dtos = await _exportImporter.UploadExcelImport<VimLogImportDTO>(files, _excelImportService).ConfigureAwait(false);
var logList = _maper.Map<List<VimLogImportDTO>, List<VmiLog>>(dtos);
using var ms = new MemoryStream();
var file = files.FirstOrDefault();
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false);
var data = ms.ToArray();
var tupleList = this.ImportInternal<VmiLog>(data);
if (tupleList.Any(o => o.Item2.Count > 0))
{
using var workbook = new XLWorkbook(new MemoryStream(data));
var ws = workbook.Worksheets.FirstOrDefault();
var header = ws.Row(1);
var errorIndex = ws.ColumnsUsed().Count() + 1;
header.Cell(errorIndex).Value = "提示信息";
for (int i = 0; i < ws.RowsUsed().Count() - 1; i++)
{
ws.Row(i + 2).Cell(errorIndex).Value = string.Join(',', tupleList[i].Item2.Select(o => o.ErrorMessage));
}
SetStyle(ws);
using var stream = new MemoryStream();
workbook.SaveAs(stream);
stream.Seek(0, SeekOrigin.Begin);
var fileName = $"{file.Name}_错误信息.xlsx";
await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false);
return new JsonResult(new { code = 400, message = "输入异常", fileName });
}
var logList = tupleList.Select(o => o.Item1).ToList();
logList.AsParallel().ForEach(Update);
//var file = files.FirstOrDefault();
//await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false);
//var data = ms.ToArray();
//var tupleList = this.ImportInternal<VmiLog>(data);
//if (tupleList.Any(o => o.Item2.Count > 0))
//{
// using var workbook = new XLWorkbook(new MemoryStream(data));
// var ws = workbook.Worksheets.FirstOrDefault();
// var header = ws.Row(1);
// var errorIndex = ws.ColumnsUsed().Count() + 1;
// header.Cell(errorIndex).Value = "提示信息";
// for (int i = 0; i < ws.RowsUsed().Count() - 1; i++)
// {
// ws.Row(i + 2).Cell(errorIndex).Value = string.Join(',', tupleList[i].Item2.Select(o => o.ErrorMessage));
// }
// SetStyle(ws);
// using var stream = new MemoryStream();
// workbook.SaveAs(stream);
// stream.Seek(0, SeekOrigin.Begin);
// var fileName = $"{file.Name}_错误信息.xlsx";
// await this._fileContainer.SaveAsync(fileName, stream, true).ConfigureAwait(false);
// return new JsonResult(new { code = 400, message = "输入异常", fileName });
//}
//var logList = tupleList.Select(o => o.Item1).ToList();
// logList.AsParallel().ForEach(Update);
if (businessType == EnumBusinessType.JisBBAC)
{

9
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs

@ -58,15 +58,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
return (DateTime.Now - now).TotalMinutes;
}
/// <summary>
/// 作废
/// </summary>
/// <param name="serviceProvider"></param>
/// <returns></returns>
[NonAction]
[DisableValidation]
public async Task Invoke(IServiceProvider serviceProvider)
{
await semaphoreSlim.WaitAsync().ConfigureAwait(false);
try
{
await InvokeInternal(serviceProvider).ConfigureAwait(false);
//await InvokeInternal(serviceProvider).ConfigureAwait(false);
}
finally
{

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

@ -173,7 +173,7 @@ namespace Win.Sfs.SettleAccount
CreateMapHBPO_PD();
CreateMapHBPO_PD_DETAIL();
CreateMapVimLog();
CreateMapPUB_PD();
CreateMapPUB_PD_DETAIL();
CreateMapINVOICE_WAIT_DETAIL_EXTEND();
@ -1008,6 +1008,15 @@ namespace Win.Sfs.SettleAccount
}
private void CreateMapVimLog()
{
CreateMap<VmiLog, VimLogImportDTO>().ReverseMap();
}
/// <summary>
/// PUB发运单

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

@ -171,4 +171,121 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi
public string ReMark { get; set; }
}
public class VimLogImportDTO
{
[ImporterHeader(Name = "厂内零件号")]
[Required(ErrorMessage = "{0}是必填项")]
public string RealPartCode { get; set; }//原始
[ImporterHeader(Name = "客户零件号")]
[Required(ErrorMessage = "{0}是必填项")]
public string CustPartCode { get; set; }
[ImporterHeader(Name = "生产码类型")]
public string CodeType { get; set; }
[ImporterHeader(Name = "发货类型")]
public EnumDeliverBjBmpBillType? DeliverBillType { get; set; }
[ImporterHeader(Name = "数量")]
[Required(ErrorMessage = "{0}是必填项")]
public decimal Qty { get; set; }
[ImporterHeader(Name = "发运日期")]
[Required(ErrorMessage = "{0}是必填项")]
public DateTime? BillTime { get; set; }
[ImporterHeader(Name = "订单日期")]
[Required(ErrorMessage = "{0}是必填项")]
public DateTime? AssembleData { get; set; }
[ImporterHeader(Name = "ERP库位")]
[Required(ErrorMessage = "{0}是必填项")]
public string ErpToLoc { get; set; }
[ImporterHeader(Name = "EDI顺序号")]
public string Seq { get; set; }
[ImporterHeader(Name = "客户订单号")]
public string OrderNum { get; set; }
[ImporterHeader(Name = "塑件唯一码")]
public string UniqueCode { get; set; }
[ImporterHeader(Name = "EDI总成号")]
public string MatchNumber { get; set; }
[ImporterHeader(Name = "PJIS生产顺序号")]
public string PjsNum { get; set; }
[ImporterHeader(Name = "实际生产码")]
public string RealCode { get; set; }
[ImporterHeader(Name = "配置码")]
public string Configcode { get; set; }
[ImporterHeader(Name = "工厂")]
public string factory { get; set; }
[ImporterHeader(Name = "发货子类型")]
[Required(ErrorMessage = "{0}是必填项")]
public EnumDeliverSubBillType? DeliverSubBillType { get; set; }
[ImporterHeader(Name = "EDI订单生产码")]
public string VinCode { get; set; }
[ImporterHeader(Name = "结算生产码")]
public string SettlementVinCode { get; set; }
[ImporterHeader(Name = "结算厂内生产码")]
public string SettlementPartCode { get; set; }
[ImporterHeader(Name = "是否补货")]
public bool? IsReplenished { get; set; }
[ImporterHeader(Name = "备注")]
public string ReMark { get; set; }
[ImporterHeader(Name = "库存事务分类")]
[Required(ErrorMessage = "{0}是必填项")]
public VmiLogType LogType { get; set; }
[ImporterHeader(Name = "变动单号")]
public string ChangedNumber { get; set; }
[ImporterHeader(Name = "变动时间")]
public DateTime ChangedTime { get; set; }
[ImporterHeader(Name = "变动类型")]
[Required(ErrorMessage = "{0}是必填项")]
public VmiType ChangedType { get; set; }
//[ImporterHeader(Name = "变动人")]
//public string ChangedBy { get; set; }
[ImporterHeader(Name = "库存变动")]
public decimal ChangedQty { get; set; }
//[ImporterHeader(Name = "版本")]
//public int Version { get; set; }
//public string ConcurrencyStamp { get; set; }
//[ImporterHeader(Name = "创建时间")]
//public DateTime CreatedTime { get; set; }
//[ImporterHeader(Name = "更新时间")]
//public DateTime UpdatedTime { get; set; } = DateTime.Now;
}
}

Loading…
Cancel
Save