Browse Source

Merge branch 'master' of http://dev.ccwin-in.com:3000/BoXu.Zheng/BeiJinSettleAccount

master
学 赵 1 year ago
parent
commit
d2f9d09538
  1. 150
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs
  3. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  5. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs
  6. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs
  7. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_OTHER_RECORD.cs
  8. 31
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TEA_TASK_SUB.cs
  9. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SA_INV.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs
  11. 17
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountEntityFrameworkCoreModule.cs
  12. 13
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSBJBMPTDbContext.cs

150
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -1,10 +1,15 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.DirectoryServices.ActiveDirectory;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Security.Policy;
using System.Threading.Tasks; using System.Threading.Tasks;
using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Drawing;
using DocumentFormat.OpenXml.Wordprocessing;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv; using Magicodes.ExporterAndImporter.Csv;
@ -12,6 +17,7 @@ using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.Operations;
using Microsoft.OpenApi.Writers; using Microsoft.OpenApi.Writers;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using ShardingCore.Extensions; using ShardingCore.Extensions;
@ -29,12 +35,19 @@ using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices; using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Customers;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Invoices;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
using static Dm.parser.LVal;
using static LinqToDB.Sql;
using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
@ -42,6 +55,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class INVOICE_SERVICE : BASE_SERVICE public class INVOICE_SERVICE : BASE_SERVICE
{ {
/// <summary>
/// 数据上下文
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// WMS数据上下文
/// </summary>
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext;
/// <summary>
/// 数据中心S数据上下文
/// </summary>
private readonly ExChangeCenterDbContext _exChangeCenterDbContext;
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository; private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository; private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository; private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository;
@ -52,7 +78,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly HBPO_CAN_SA_MNG _hbpoMng; private readonly HBPO_CAN_SA_MNG _hbpoMng;
private readonly INV_MNG _invMng; private readonly INV_MNG _invMng;
private readonly BaseDomainService _baseservice; private readonly BaseDomainService _baseservice;
public INVOICE_SERVICE(IExcelImportAppService excelImportService, public INVOICE_SERVICE(
SettleAccountDbContext settleAccountDbContext,
WMSBJBMPTDbContext wmsBJBMPTContext,
ExChangeCenterDbContext exChangeCenterDbContext,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager, ICommonManager commonManager,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
@ -68,6 +98,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
) : base(excelImportService, snowflakeIdGenerator, commonManager) ) : base(excelImportService, snowflakeIdGenerator, commonManager)
{ {
_settleAccountDbContext = settleAccountDbContext;
_wmsBJBMPTContext = wmsBJBMPTContext;
_exChangeCenterDbContext = exChangeCenterDbContext;
_baseservice = baseservice; _baseservice = baseservice;
_repository = repository; _repository = repository;
_wRepository = wRepository; _wRepository = wRepository;
@ -80,6 +113,116 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_invMng = invMng; _invMng = invMng;
} }
/// <summary>
/// 提交到QAD
/// </summary>
/// <remarks>
/// 已扣减发票提交到QAD
/// </remarks>
[HttpPost]
public virtual async Task<IActionResult> SubmitToQad(List<string> invbillNums)
{
var invoiceGrps = _settleAccountDbContext.Set<INVOICE_GRP>()
.Where(t => invbillNums.Contains(t.InvbillNum))
.Where(t => t.State == SettleBillState.)
.ToList();
invbillNums = invoiceGrps.Select(t => t.InvbillNum).ToList();
var invoiceGrpDetails = _settleAccountDbContext.Set<INVOICE_WAIT_DETAIL>()
.Where(t => invbillNums.Contains(t.InvbillNum))
.ToList();
var taskId = GuidGenerator.Create();
var teaTaskSub = new TEA_TASK_SUB()
{
GUID = taskId,
TaskState = 0,
TaskID = taskId,
TableName = "TED_SA_INV",
Creator = "SAS",
Subscriber = "QAD",
Domain = "BJBMPT",
Site = "BJ02",
CreateTime = DateTime.Now,
UpdateTime = DateTime.Now,
};
var tedSaInvs = invoiceGrpDetails.Join(invoiceGrps, x => x.InvbillNum, y => y.InvbillNum, (x, y) =>
{
return new TED_SA_INV()
{
GUID = GuidGenerator.Create(),
TaskID = taskId,
InvoiceNumber = y.RealnvBillNum,
SASInvoiceNumber = y.InvbillNum,
Customer = y.ClientCode,
BillTo = y.ClientCode,
InvoiceDate = y.CreationTime,
Site = "BJ02",
TYPE = default,
PartNumber = x.LU,
InvoiceQuatity = x.Qty,
Price = x.PRICE,
Supplier = default,
Remark = default,
InvoiceNetAmount = x.Amt,
InvoiceTaxAmount = x.Amt * 0.13m,
TaxRate = 0.13m,
Location = $"C{y.ClientCode}",
InvoiceNet = default,
InvoiceTax = default,
begintime = x.BeginDate,
endtime = x.EndDate,
Domain = "BJBMPT"
};
}).ToList();
var invoiceGrpTedSaInvs = invoiceGrps.Select(t =>
{
return new TED_SA_INV()
{
GUID = GuidGenerator.Create(),
TaskID = taskId,
UID = default,
InvoiceNumber = t.RealnvBillNum,
SASInvoiceNumber = t.InvbillNum,
Customer = t.ClientCode,
BillTo = t.ClientCode,
InvoiceDate = t.CreationTime,
Site = "BJ02",
TYPE = default,
PartNumber = default,
InvoiceQuatity = default,
Price = default,
Supplier = default,
Remark = default,
InvoiceNetAmount = default,
InvoiceTaxAmount = default,
TaxRate = 0.13m,
Location = $"C{t.ClientCode}",
InvoiceNet = t.Amt,
InvoiceTax = default,
begintime = default,
endtime = default,
Domain = "BJBMPT"
};
});
tedSaInvs.AddRange(invoiceGrpTedSaInvs);
if (tedSaInvs.Any())
{
await _exChangeCenterDbContext.Set<TEA_TASK_SUB>().AddAsync(teaTaskSub).ConfigureAwait(false);
await _exChangeCenterDbContext.Set<TED_SA_INV>().AddRangeAsync(tedSaInvs).ConfigureAwait(false);
await _exChangeCenterDbContext.SaveChangesAsync().ConfigureAwait(false);
invoiceGrps.ForEach(t => t.State = SettleBillState.QAD);
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
}
await Task.CompletedTask.ConfigureAwait(false);
return new OkResult();
}
/// <summary> /// <summary>
/// 通过审核 /// 通过审核
/// </summary> /// </summary>
@ -395,7 +538,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO> unsettle = new List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO>(); List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO> unsettle = new List<MAIDAN_HBPO_UNSETTLED_DETAIL_DTO>();
foreach (var itm in sdtos) foreach (var itm in sdtos)
{ {
unsettle.Add(new MAIDAN_HBPO_UNSETTLED_DETAIL_DTO() { unsettle.Add(new MAIDAN_HBPO_UNSETTLED_DETAIL_DTO()
{
GroupNum = itm.SettleGroupNum, GroupNum = itm.SettleGroupNum,
LU = itm.LU, LU = itm.LU,
PN = itm.Extend1, PN = itm.Extend1,

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs

@ -98,7 +98,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition)) .Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType) .Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType)) .Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(100_000).ToList(); .OrderBy(b => b.UID).Take(10_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords); var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any()) if (jisSeDetails.Any())
{ {
@ -140,7 +140,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition)) .Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType) .Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType)) .Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(100_000).ToList(); .OrderBy(b => b.UID).Take(10_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords); var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any()) if (jisSeDetails.Any())
{ {

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs

@ -99,7 +99,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition)) .Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType) .Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType)) .Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(100_000).ToList(); .OrderBy(b => b.UID).Take(10_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(wmsSeRecords); var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(wmsSeRecords);
if (jisSeDetails.Any()) if (jisSeDetails.Any())
{ {
@ -141,7 +141,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
.Where(t => t.UID > int.Parse(syncPosition)) .Where(t => t.UID > int.Parse(syncPosition))
.Where(t => t.DeliverBillType == deliverBillType) .Where(t => t.DeliverBillType == deliverBillType)
.Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType)) .Where(t => deliverSubBillTypes.Contains(t.DeliverSubBillType))
.OrderBy(b => b.UID).Take(100_000).ToList(); .OrderBy(b => b.UID).Take(10_000).ToList();
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<HBPO_SE_DETAIL>>(wmsRecords); var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<HBPO_SE_DETAIL>>(wmsRecords);
if (jisSeDetails.Any()) if (jisSeDetails.Any())
{ {

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -83,7 +83,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
Expression<Func<TM_BJBMPT_OTHER_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && t.UID > int.Parse(syncPosition) && (!deliverSubBillTypes.Any() || deliverSubBillTypes.Contains(t.DeliverSubBillType)); Expression<Func<TM_BJBMPT_OTHER_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && t.UID > int.Parse(syncPosition) && (!deliverSubBillTypes.Any() || deliverSubBillTypes.Contains(t.DeliverSubBillType));
//WMS发运记录 //WMS发运记录
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_OTHER_RECORD.Where(predicate).Take(100_000).OrderBy(b => b.UID).ToList(); var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_OTHER_RECORD.Where(predicate).Take(10_000).OrderBy(b => b.UID).ToList();
var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(wmsSeRecords); var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(wmsSeRecords);
if (pubSeDetails.Any()) if (pubSeDetails.Any())
{ {

9
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs

@ -5,11 +5,12 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{ {
#if DEBUG //#if DEBUG
// [Table("TM_BJBMPT_JIS_RECORD")]
//#else
// [Table("EX_BJBMPT_JIS_RECORD")]
//#endif
[Table("TM_BJBMPT_JIS_RECORD")] [Table("TM_BJBMPT_JIS_RECORD")]
#else
[Table("EX_BJBMPT_JIS_RECORD")]
#endif
public class TM_BJBMPT_JIS_RECORD public class TM_BJBMPT_JIS_RECORD
{ {
[Key] [Key]

9
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs

@ -8,11 +8,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
/// <summary> /// <summary>
/// Jis小件 /// Jis小件
/// </summary> /// </summary>
#if DEBUG //#if DEBUG
// [Table("TM_BJBMPT_JIT_RECORD")]
//#else
// [Table("EX_BJBMPT_JIT_RECORD")]
//#endif
[Table("TM_BJBMPT_JIT_RECORD")] [Table("TM_BJBMPT_JIT_RECORD")]
#else
[Table("EX_BJBMPT_JIT_RECORD")]
#endif
public class TM_BJBMPT_JIT_RECORD public class TM_BJBMPT_JIT_RECORD
{ {
[Key] [Key]

9
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_OTHER_RECORD.cs

@ -8,11 +8,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
/// <summary> /// <summary>
/// Jit(非Jis) /// Jit(非Jis)
/// </summary> /// </summary>
#if DEBUG //#if DEBUG
// [Table("TM_BJBMPT_OTHER_RECORD")]
//#else
// [Table("EX_BJBMPT_OTHER_RECORD")]
//#endif
[Table("TM_BJBMPT_OTHER_RECORD")] [Table("TM_BJBMPT_OTHER_RECORD")]
#else
[Table("EX_BJBMPT_OTHER_RECORD")]
#endif
public class TM_BJBMPT_OTHER_RECORD public class TM_BJBMPT_OTHER_RECORD
{ {
[Key] [Key]

31
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TEA_TASK_SUB.cs

@ -0,0 +1,31 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
public class TEA_TASK_SUB
{
[Key]
public Guid GUID { get; set; }
public int TaskState { get; set; }
public Guid TaskID { get; set; }
public string TableName { get; set; }
public string TableName2 { get; set; }
public string TableName3 { get; set; }
public string Creator { get; set; }
public int DataCount { get; set; }
public string Subscriber { get; set; }
public int FailedCount { get; set; }
public string FailedInfo { get; set; }
public string Domain { get; set; }
public string Site { get; set; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int UID { get; set; }
public string CreateUser { get; set; }
public DateTime CreateTime { get; set; }
public string Remark { get; set; }
public string UpdateUser { get; set; }
public DateTime UpdateTime { get; set; }
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SA_INV.cs

@ -1,14 +1,16 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
public class TED_SA_INV public class TED_SA_INV
{ {
[Key]
public Guid GUID { set; get; } public Guid GUID { set; get; }
public Guid TaskID { set; get; } public Guid TaskID { set; get; }
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int UID { set; get; } public int UID { set; get; }
/// <summary> /// <summary>

5
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs

@ -9,10 +9,11 @@ namespace Win.Sfs.SettleAccount.EntityFrameworkCore
public class ExChangeCenterDbContext : DbContext public class ExChangeCenterDbContext : DbContext
{ {
public DbSet<TEA_TASK_SUB> TEA_TASK_SUB { get; set; }
public DbSet<TED_SA_INV> TED_SA_INV { set; get; } public DbSet<TED_SA_INV> TED_SA_INV { set; get; }
public ExChangeCenterDbContext(DbContextOptions<WMSBJBMPTDbContext> options) : base(options)
{
public ExChangeCenterDbContext(DbContextOptions<ExChangeCenterDbContext> options) : base(options)
{
} }

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

@ -1,4 +1,6 @@
using System.Configuration;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Dapper; using Volo.Abp.Dapper;
@ -45,6 +47,7 @@ namespace Win.Sfs.SettleAccount
private static void ConfigureRepository(ServiceConfigurationContext context) private static void ConfigureRepository(ServiceConfigurationContext context)
{ {
var configuration = context.Services.GetConfiguration();
context.Services.AddAbpDbContext<SettleAccountDbContext>(options => context.Services.AddAbpDbContext<SettleAccountDbContext>(options =>
{ {
options.AddDefaultRepositories(); options.AddDefaultRepositories();
@ -59,13 +62,13 @@ namespace Win.Sfs.SettleAccount
context.Services.AddDbContext<WMSBJBMPTDbContext>(options => context.Services.AddDbContext<WMSBJBMPTDbContext>(options =>
{ {
//IConfiguration config = new ConfigurationBuilder() options.UseSqlServer(configuration.GetConnectionString("WMSBJBMPT"));
// .SetBasePath(Directory.GetCurrentDirectory()) //options.UseSqlServer("Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;");
// .AddJsonFile("appsettings.json") });
// .Build();
//var ConnectStr = config.GetConnectionString("WMSBJBMPT"); context.Services.AddDbContext<ExChangeCenterDbContext>(options =>
//optionsBuilder.UseSqlServer(ConnectStr); {
options.UseSqlServer("Server=dev.ccwin-in.com,6208;Database=WMS_BJBMPT_2;User ID=sa;Password=ChangkeTec@2021;Trusted_Connection=False;TrustServerCertificate=True;"); options.UseSqlServer(configuration.GetConnectionString("ExChangeCenterService"));
}); });
// context.Services.AddTransient(typeof(IInventoryDetailRepository), // context.Services.AddTransient(typeof(IInventoryDetailRepository),

13
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSBJBMPTDbContext.cs

@ -19,19 +19,6 @@ namespace Win.Sfs.SettleAccount.EntityFrameworkCore
{ {
} }
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
//{
// if (!optionsBuilder.IsConfigured)
// {
// IConfiguration config = new ConfigurationBuilder()
// .SetBasePath(Directory.GetCurrentDirectory())
// .AddJsonFile("appsettings.json")
// .Build();
// var ConnectStr = config.GetConnectionString("WMSBJBMPT");
// optionsBuilder.UseSqlServer(ConnectStr);
// }
//}
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
base.OnModelCreating(modelBuilder); base.OnModelCreating(modelBuilder);

Loading…
Cancel
Save