44673626 3 years ago
parent
commit
d8daab813c
  1. BIN
      .vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo
  2. 10990
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/20211221015126_init.Designer.cs
  3. 4640
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/20211221015126_init.cs
  4. 119
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/SettleAccountHttpApiHostMigrationsDbContextModelSnapshot.cs
  5. 1
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccount.HttpApi.Host.csproj
  6. 8
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json
  7. 8
      src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  8. 46
      src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs
  9. 168
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs
  10. 95
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/TaskList.cs
  11. 7
      src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs
  12. 28
      src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml
  13. 2
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TaskJobManager.cs
  14. 172
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  15. 45
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  16. 6
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountEntityFrameworkCoreModule.cs
  17. 126
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSDapperRepository.cs
  18. 85
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs
  19. 162
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/WMSEfCoreRepository.cs

BIN
.vs/Win.Sfs.SmartSettlementSystem.PG/v16/.suo

Binary file not shown.

10990
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/20211221015126_init.Designer.cs

File diff suppressed because it is too large

4640
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/20211221015126_init.cs

File diff suppressed because it is too large

119
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Migrations/SettleAccountHttpApiHostMigrationsDbContextModelSnapshot.cs

@ -7301,6 +7301,125 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_BT_Car_PlatformVersion");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ChassisNumber")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Extend1")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend2")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend3")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("InPut")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<string>("KennCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("MaterialCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialDesc")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("MaterialGroup")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("OutPut")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ParentMaterialCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("Qty")
.HasColumnType("decimal(18,2)");
b.Property<string>("Remark")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<string>("WmsBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Set_WmsJitOutPutDetial");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.WMS_KanBan.WMSKanBanSettle", b =>
{
b.Property<Guid>("Id")

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

@ -54,6 +54,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="wwwroot\files\host\my-file-container\" />
</ItemGroup>

8
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.Development.json

@ -7,10 +7,10 @@
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;"
//},
"ConnectionStrings": {
//"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
//"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;"
"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
"SettleAccountService": "Server=192.168.0.140;Database=SettleAccountService;user id=sa;password=Microsoft2008;"
"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService1;user id=sa;Password=1;"
//"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
//"SettleAccountService": "Server=192.168.0.140;Database=SettleAccountService;user id=sa;password=Microsoft2008;"
},
"Logging": {
"LogLevel": {

8
src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -7,10 +7,10 @@
// "SettleAccountService": "Server=LAPTOP-V3U07C2O;Database=SettleAccountService;user id=sa;Password=1q2w!@#;"
//},
"ConnectionStrings": {
//"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
//"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService;user id=sa;Password=1;"
"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
"SettleAccountService": "Server=192.168.0.140;Database=SettleAccountService;user id=sa;password=Microsoft2008;",
"Default": "Server=127.0.0.1;Database=ABP;user id=sa;Password=1",
"SettleAccountService": "Server=127.0.0.1;Database=SettleAccountService1;user id=sa;Password=1;"
//"Default": "Server=192.168.0.140;Database=ABP;User ID=sa;Password=Microsoft2008;",
//"SettleAccountService": "Server=192.168.0.140;Database=SettleAccountService;user id=sa;password=Microsoft2008;",
//"WmsService": "Server=192.168.0.140;Database=CPAT_WMS_TEST;user id=sa;password=Microsoft2008;"
},

46
src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Wms/WmsJitOutPutDetialDto.cs

@ -0,0 +1,46 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Win.Sfs.SettleAccount.Entities.Wms
{
public class WmsJitOutPutDetialDto
{
[ImporterHeader(Name = "交货单号")]
public string WmsBillNum { set; get; }
[ImporterHeader(Name = "KENN号")]
//KENN号
public string KennCode { set; get; }
[ImporterHeader(Name = "底盘号")]
//底盘号
public string ChassisNumber { set; get; }
[ImporterHeader(Name = "物料号")]
//物料号
public string MaterialCode { set; get; }
[ImporterHeader(Name = "组件组物料")]
//物料号
public string ParentMaterialCode { set; get; }
[ImporterHeader(Name = "物料描述")]
//物料描述
public string MaterialDesc { set; get; }
[ImporterHeader(Name = "物料组(车型)")]
//物料组(车型)
public string MaterialGroup { set; get; }
[ImporterHeader(Name = "结算数量")]
public decimal Qty { set; get; }
}
}

168
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs

@ -43,6 +43,9 @@ using Magicodes.ExporterAndImporter.Core.Models;
using TaskJob.Services;
using TaskJob.EventArgs;
using Win.Sfs.SettleAccount.Entities.WMS;
using Win.Sfs.SettleAccount.Entities.Wms;
using Win.Sfs.SettleAccount.Repository;
namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
{
@ -59,10 +62,14 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<Prebatches.Prebatch, Guid> _preBatchRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsJitOutPutDetial, Guid> _wmsRepository;
private readonly ISettleAccountBranchEfCoreRepository<WmsJitOutPut, Guid> _wmsVersionRepository;
private readonly ISettleAccountBranchEfCoreRepository<SettleAccount, Guid> _repository;
private readonly ISettleAccountBranchEfCoreRepository<SettleAccountVersion, Guid> _versionRepository;
private readonly ISettleAccountBranchEfCoreRepository<FIS, Guid> _fisRepository;
private readonly ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> _relrepository;
private readonly WMSEfCoreRepository<WmsJitOutPutDetial> _wmsefRespository;
private readonly TaskJobService _service;
/// <summary>
/// 构建方法
@ -81,7 +88,10 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
TaskJobService service,
ISettleAccountBranchEfCoreRepository<FIS, Guid> fisRepository,
ISettleAccountBranchEfCoreRepository<Prebatches.Prebatch, Guid> preBatchRepository,
ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> relrepository
ISettleAccountBranchEfCoreRepository<MaterialRelationship, Guid> relrepository,
ISettleAccountBranchEfCoreRepository<WmsJitOutPutDetial, Guid> wmsRepository,
ISettleAccountBranchEfCoreRepository<WmsJitOutPut, Guid> wmsVersionRepository,
WMSEfCoreRepository<WmsJitOutPutDetial> wmsefRespository
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_service = service;
@ -92,10 +102,166 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
_repository = repository;
_preBatchRepository = preBatchRepository;
_relrepository = relrepository;
_wmsRepository = wmsRepository;
_wmsVersionRepository = wmsVersionRepository;
_wmsefRespository = wmsefRespository;
}
/// <summary>
/// 汇总结算明细导记录
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpGet]
[Route("WmsJitOutPut")]
[DisableRequestSizeLimit]
public async Task<bool> WmsJitOutPut(List<string> fileList, string version)
{
List<WmsJitOutPutDetial> _lst = new List<WmsJitOutPutDetial>();
foreach (var filename in fileList)
{
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
IExcelImporter Importer = new Magicodes.ExporterAndImporter.Excel.ExcelImporter();
var _list = await Importer.ImportSameSheets<WmsJitOutPutDetialDto, WmsJitOutPutDetial>(fileSavePath);
foreach (var itm in _list)
{
var list = itm.Value.Data.ToList();
_lst.AddRange(list.ToArray());
}
}
var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList();
var outPutDetail= await _wmsRepository.Where(p => p.Version == version).ToListAsync();
var query = from itm1 in _ls1
join itm2 in outPutDetail on
new { itm1.MaterialCode, itm1.KennCode, itm1.ChassisNumber }
equals
new { itm2.MaterialCode, itm2.KennCode, itm2.ChassisNumber } into temp1
from tm1 in temp1.DefaultIfEmpty() where tm1==null
select itm1;
await _wmsRepository.GetDbContext().BulkInsertAsync(query.ToList(), new BulkConfig() { BulkCopyTimeout = 0 });
int _count= _wmsVersionRepository.Count(p => p.Version == version);
if (_count == 0)
{
var _version = new List<WmsJitOutPut>();
_version.Add(new WmsJitOutPut { Version = version, BillNum = "T" +DateTime.Now.ToString("yyyyMMddhhmmssdddd"), Creator = CurrentUser.Email });
await _wmsVersionRepository.GetDbContext().BulkInsertAsync(_version);
}
//_wmsRepository.Where(p=>p)
return true;
}
[HttpGet]
[Route("WmsJitOutPut-Pass")]
public async Task<bool> WmsJitOutPutPass( string version, List<Guid> p_list=null)
{
if (p_list != null)
{
var _ls = await _wmsRepository.Where(p => p_list.Contains(p.Id) && p.Version == version && p.State != 2).ToListAsync();
if (_ls.Count() > 0)
{
var _first = _ls.FirstOrDefault();
var _guid = GuidGenerator.Create();
foreach (var itm in _ls)
{
itm.TaskId = _guid;
}
await _wmsefRespository.GetDbContext().BulkInsertAsync(_ls);
var uniapi = new TS_UNI_API(GuidGenerator.Create(), "1", version, "WmsJitOutPutDetail", _first.BillNum, 0, _guid)
{
TaskId = _guid,
SourceBillNum = _first.BillNum,
TableName = "WmsJitOutPutDetail",
InterfaceType = "1",
Version = version,
State = 0,
};
var _l = new List<TS_UNI_API>();
_l.Add(uniapi);
await _wmsefRespository.GetDbContext().BulkInsertAsync(_l);
}
}
//_wmsDapper.GetListBySql<WmsJitOutPutDetial>("insert into WmsJitOutPutDetial", false);
//_wmsDapper.DbConnection.ConnectionTimeout = 1200;
//_wmsRepository.Where(p=>p)
return true;
}
[HttpGet]
[Route("WmsJitOutPut-Cancel")]
public async Task<bool> WmsJitOutPutCancel(List<string> fileList, string version)
{
List<WmsJitOutPutDetial> _lst = new List<WmsJitOutPutDetial>();
foreach (var filename in fileList)
{
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
IExcelImporter Importer = new Magicodes.ExporterAndImporter.Excel.ExcelImporter();
var _list = await Importer.ImportSameSheets<WmsJitOutPutDetialDto, WmsJitOutPutDetial>(fileSavePath);
foreach (var itm in _list)
{
var list = itm.Value.Data.ToList();
_lst.AddRange(list.ToArray());
}
}
var _ls1 = _lst.Where(p => p.ParentMaterialCode == p.MaterialCode).ToList();
await _wmsRepository.GetDbContext().BulkInsertAsync(_ls1, new BulkConfig() { BulkCopyTimeout = 0 });
int _count = _wmsVersionRepository.Count(p => p.Version == version);
if (_count == 0)
{
var _version = new List<WmsJitOutPut>();
_version.Add(new WmsJitOutPut { Version = version, BillNum = "T" + DateTime.Now.ToString("yyyyMMddhhmmssdddd"), Creator = CurrentUser.Email });
await _wmsVersionRepository.GetDbContext().BulkInsertAsync(_version);
}
//_wmsRepository.Where(p=>p)
return true;
}
[HttpPost]
[Route("testImport")]
[DisableRequestSizeLimit]

95
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/TaskList.cs

@ -1,95 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DomainBase;
namespace Win.Sfs.SettleAccount.Entities.WMS
{
public partial class TS_UNI_API: FullAuditedAggregateRootBase<Guid>
{
public TS_UNI_API(string interfaceType, string version, string tableName, int? billType, int? subBillType, string sourceBillNum)
{
InterfaceType = interfaceType;
Version = version;
TableName = tableName;
BillType = billType;
SubBillType = subBillType;
SourceBillNum = sourceBillNum;
}
/// <summary>
/// 接口类型
/// </summary>
public string InterfaceType { get; set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; set; }
/// <summary>
/// 表明
/// </summary>
public string TableName { get; set; }
/// <summary>
/// 单据类型
/// </summary>
public int? BillType { get; set; }
/// <summary>
/// 子单据类型
/// </summary>
public int? SubBillType { get; set; }
/// <summary>
/// 原单据类型
/// </summary>
public string SourceBillNum { get; set; }
/// <summary>
/// 状态
/// </summary>
public int State { set; get; }
/// <summary>
/// 状态
/// </summary>
//public int State { set; get; }
}
public class WmsOutPutDetial: FullAuditedAggregateRootBase<Guid>
{
public WmsOutPutDetial(string wmsBillNum, string kennCode, string chassisNumber, string parentMaterialCode, string materialDesc, string materialGroup)
{
WmsBillNum = wmsBillNum;
KennCode = kennCode;
ChassisNumber = chassisNumber;
ParentMaterialCode = parentMaterialCode;
MaterialDesc = materialDesc;
MaterialGroup = materialGroup;
}
//交货单号
public string WmsBillNum{ set; get; }
//KENN号
public string KennCode { set; get; }
//底盘号
public string ChassisNumber { set; get; }
//物料号
public string ParentMaterialCode { set; get; }
//物料描述
public string MaterialDesc { set; get; }
//物料组(车型)
public string MaterialGroup { set; get; }
}
}

7
src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@ -24,6 +25,8 @@ using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.SettleAccounts;
using Win.Sfs.SettleAccount.Entities.SettlementParts;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.Entities.Wms;
using Win.Sfs.SettleAccount.Entities.WMS;
using Win.Sfs.SettleAccount.FISes;
namespace Win.Sfs.SettleAccount.Reports.ReportServices
@ -612,5 +615,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices
}
}

28
src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.xml

@ -1410,6 +1410,13 @@
<param name="repository">仓储接口</param>
<param name="cache">缓存</param>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccountAppService.WmsJitOutPut(System.String,System.String)">
<summary>
结算总成和ERP总成价格对比
</summary>
<param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
<returns></returns>
</member>
<member name="M:Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccountAppService.SettleAccountUploadExcelImport(Microsoft.AspNetCore.Http.IFormFileCollection,System.Guid,System.String,System.String,System.String,System.String,System.String)">
<summary>
导入功能
@ -2154,24 +2161,29 @@
表明
</summary>
</member>
<member name="P:Win.Sfs.SettleAccount.Entities.WMS.TS_UNI_API.BillType">
<member name="P:Win.Sfs.SettleAccount.Entities.WMS.TS_UNI_API.SourceBillNum">
<summary>
原单据号
</summary>
</member>
<member name="P:Win.Sfs.SettleAccount.Entities.WMS.TS_UNI_API.State">
<summary>
单据类型
状态
</summary>
</member>
<member name="P:Win.Sfs.SettleAccount.Entities.WMS.TS_UNI_API.SubBillType">
<member name="T:Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial">
<summary>
子单据类型
</summary>
</member>
<member name="P:Win.Sfs.SettleAccount.Entities.WMS.TS_UNI_API.SourceBillNum">
<member name="P:Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial.Extend2">
<summary>
原单据类型
扩展字段2
</summary>
</member>
<member name="P:Win.Sfs.SettleAccount.Entities.WMS.TS_UNI_API.State">
<member name="P:Win.Sfs.SettleAccount.Entities.WMS.WmsJitOutPutDetial.Extend3">
<summary>
状态
扩展字段3
</summary>
</member>
<member name="T:Win.Sfs.SettleAccount.FISes.FISAppService">

2
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/TaskJobs/TaskJobManager.cs

@ -67,7 +67,7 @@ namespace Win.Sfs.SettleAccount.Entities
public virtual async Task<List<string>> GetVersionListAsync()
{
var entities = await _repository.Select(p => p.Type).Distinct().ToListAsync();
var entities = await _repository.Where(p=> !string.IsNullOrEmpty(p.Type)).Select(p => p.Type ).Distinct().ToListAsync();
return entities;
}

172
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs

@ -0,0 +1,172 @@
using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Win.Sfs.Shared.DomainBase;
namespace Win.Sfs.SettleAccount.Entities.WMS
{
public partial class TS_UNI_API: FullAuditedAggregateRootBase<Guid>
{
public TS_UNI_API(Guid id,string interfaceType, string version, string tableName, string sourceBillNum,int state,Guid taskId)
{
Id = id;
InterfaceType = interfaceType;
Version = version;
TableName = tableName;
SourceBillNum = sourceBillNum;
State = state;
TaskId = taskId;
}
/// <summary>
/// 接口类型
/// </summary>
public string InterfaceType { get; set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; set; }
/// <summary>
/// 表明
/// </summary>
public string TableName { get; set; }
/// <summary>
/// 原单据号
/// </summary>
public string SourceBillNum { get; set; }
/// <summary>
/// 状态
/// </summary>
public int State { set; get; }
/// <summary>
/// 状态
/// </summary>
public Guid TaskId { set; get; }
}
public class WmsJitOutPut : FullAuditedAggregateRootBase<Guid>
{
public WmsJitOutPut()
{
}
public WmsJitOutPut(Guid id,string version, string billNum, string creator):base(id)
{
Id = id;
Version = version;
BillNum = billNum;
Creator = creator;
}
public string Version { set; get; }
public string BillNum { set; get; }
public string Creator { set; get; }
}
/// <summary>
///
/// </summary>
public class WmsJitOutPutDetial : FullAuditedAggregateRootBase<Guid>
{
public WmsJitOutPutDetial()
{
}
public WmsJitOutPutDetial(Guid id, string wmsBillNum, string kennCode, string chassisNumber, string materialCode, string materialDesc, string materialGroup, string outPut, string inPut, int state, string extend1, string extend2, string extend3, string parentMaterialCode,string billNum,Guid taskId)
{
Id = id;
WmsBillNum = wmsBillNum;
KennCode = kennCode;
ChassisNumber = chassisNumber;
MaterialCode = materialCode;
MaterialDesc = materialDesc;
MaterialGroup = materialGroup;
OutPut = outPut;
InPut = inPut;
State = state;
Extend1 = extend1;
Extend2 = extend2;
Version = extend3;
ParentMaterialCode = parentMaterialCode;
BillNum = billNum;
TaskId = taskId;
}
// 交货单号 实际发货日期 KENN号 底盘号 物料号 物料描述 客户物料 组件组物料 组件组物料描述 物料组(车型) 定价 金额 结算平台未结数量 大众R3未结数量 差异金额 差异数量 漏结标识 漏结期间 说明
//交货单号
[ImporterHeader(Name = "组件组物料")]
public string ParentMaterialCode { set; get; }
[ImporterHeader(Name = "交货单号")]
public string WmsBillNum { set; get; }
[ImporterHeader(Name = "KENN号")]
//KENN号
public string KennCode { set; get; }
[ImporterHeader(Name = "底盘号")]
//底盘号
public string ChassisNumber { set; get; }
[ImporterHeader(Name = "物料号")]
//物料号
public string MaterialCode { set; get; }
[ImporterHeader(Name = "物料描述")]
//物料描述
public string MaterialDesc { set; get; }
[ImporterHeader(Name = "物料组(车型)")]
//物料组(车型)
public string MaterialGroup { set; get; }
[ImporterHeader(Name = "出库库位")]
//出库库位
public string OutPut { set; get; }
[ImporterHeader(Name = "入库库位")]
//入库库位
public string InPut { set; get; }
[ImporterHeader(Name = "状态")]
public int State { get; set; }
[ImporterHeader(Name = "扩展字段1")]
/// <summary>
/// 扩展字段1
/// </summary>
public string Extend1 { set; get; }
/// <summary>
/// 扩展字段2
/// </summary>
[ImporterHeader(Name = "扩展字段2")]
public string Extend2 { set; get; }
/// <summary>
/// 扩展字段3
/// </summary>
[ImporterHeader(Name = "版本号")]
public string Version { set; get; }
[ImporterHeader(Name = "数量")]
public string Qty { set; get; }
[ImporterHeader(Name = "数量",IsIgnore =true)]
public string BillNum { set; get; }
public Guid TaskId { set; get; }
}
}

45
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -70,6 +70,7 @@ using Win.Sfs.SettleAccount.Entities.WMS_SparePart;
using Win.Sfs.SettleAccount.Entities.HQ_H;
using Win.Sfs.SettleAccount.Entities.HQ_M;
using Win.Sfs.SettleAccount.Entities.BT_Car;
using Win.Sfs.SettleAccount.Entities.WMS;
namespace Win.Sfs.SettleAccount
{
@ -267,6 +268,7 @@ namespace Win.Sfs.SettleAccount
builder.ConfigureSettlementPakAndSparePartsVersion(options);
builder.ConfigureSecMatchBase(options);
builder.ConfigureWmsJitOutPutDetial(options);
#endregion
@ -354,18 +356,47 @@ namespace Win.Sfs.SettleAccount
});
}
/// <summary>
/// 准时化出库明细
/// </summary>
/// <param name="builder"></param>
/// <param name="options"></param>
private static void ConfigureWmsJitOutPutDetial(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<WmsJitOutPutDetial>(b =>
{
b.ToTable($"{options.TablePrefix}_WmsJitOutPutDetial", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.WmsBillNum).HasMaxLength(50).IsRequired();
b.Property(x => x.Remark).HasMaxLength(200).IsRequired();
b.Property(x => x.ParentMaterialCode).HasMaxLength(50).IsRequired();
b.Property(x => x.MaterialCode).HasMaxLength(50).IsRequired();
b.Property(x => x.MaterialGroup).HasMaxLength(200);
b.Property(x => x.OutPut).HasMaxLength(50);
b.Property(x => x.InPut).HasMaxLength(50);
b.Property(x => x.Extend1).HasMaxLength(50);
b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.ChassisNumber).HasMaxLength(50);
b.Property(x => x.KennCode).HasMaxLength(50);
b.Property(x => x.MaterialDesc).HasMaxLength(50);
});
}
private static void ConfigureBTCarVersion(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<SparePartVersion>(b =>
{
b.ToTable($"{options.TablePrefix}_BT_Car_PlatformVersion", options.Schema);
b.ConfigureByConvention();
b.Property(x => x.Year).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Period).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength);
b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter);
//b.ToTable($"{options.TablePrefix}_BT_Car_PlatformVersion", options.Schema);
//b.ConfigureByConvention();
//b.Property(x => x.Year).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
//b.Property(x => x.Period).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
//b.Property(x => x.Version).IsRequired().HasMaxLength(CommonConsts.MaxCodeLength);
//b.Property(x => x.CustomerCode).HasMaxLength(CommonConsts.MaxCodeLength);
//b.HasIndex(x => new { x.Version }).IsUnique().HasFilter(IsDeletedFilter);
});
}

6
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountEntityFrameworkCoreModule.cs

@ -56,10 +56,10 @@ namespace Win.Sfs.SettleAccount
});
// context.Services.AddTransient(typeof(IInventoryDetailRepository),
//typeof(InventoryDetailRepository));
// context.Services.AddTransient(typeof(IInventoryDetailRepository),
//typeof(InventoryDetailRepository));
context.Services.AddTransient(typeof(WMSEfCoreRepository<>)),
context.Services.AddTransient(typeof(INormalEfCoreRepository<,>),
typeof(SettleAccountNormalEfCoreRepository<,>));
context.Services.AddTransient(typeof(IBranchEfCoreRepository<,>),

126
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSDapperRepository.cs

@ -0,0 +1,126 @@
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
namespace Win.Sfs.SettleAccount
{
public class WMSDapperRepository : DapperRepository<WMSDbContext>, ITransientDependency
{
public WMSDapperRepository(IDbContextProvider<WMSDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public virtual async Task<List<T>> GetListBySqlAsync<T>(string sql, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = await GetDbConnectionAsync();
IDbTransaction trans = await GetDbTransactionAsync();
return (await conn.QueryAsync<T>(sql, null, trans))
.ToList();
}
else
{
IDbConnection conn = await GetDbConnectionAsync();
return (await conn.QueryAsync<T>(sql))
.ToList();
}
}
public virtual async Task<T> GetSingleBySqlAsync<T>(string sql, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = await GetDbConnectionAsync();
IDbTransaction trans = await GetDbTransactionAsync();
return await conn.QuerySingleOrDefaultAsync<T>(sql, null, trans);
}
else
{
IDbConnection conn = await GetDbConnectionAsync();
return await conn.QuerySingleOrDefaultAsync<T>(sql);
}
}
public virtual async Task<int> ExecuteSqlAsync(string sql, object obj = null, bool isTrans = false)
{
if (isTrans)
{
//return await DbConnection.ExecuteAsync("update People set Name = @NewName", new { NewName = name }, DbTransaction);
IDbConnection conn = await GetDbConnectionAsync();
IDbTransaction trans = await GetDbTransactionAsync();
return await conn.ExecuteAsync(sql, obj, trans);
}
else
{
//return await DbConnection.ExecuteAsync("update People set Name = @NewName", new { NewName = name }, DbTransaction);
IDbConnection conn = await GetDbConnectionAsync();
return await conn.ExecuteAsync(sql, obj);
}
}
#region 同步方法
public virtual List<T> GetListBySql<T>(string sql, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = GetDbConnectionAsync().GetAwaiter().GetResult();
IDbTransaction trans = GetDbTransactionAsync().GetAwaiter().GetResult();
return (conn.Query<T>(sql, null, trans))
.ToList();
}
else
{
IDbConnection conn = (IDbConnection)GetDbConnectionAsync().GetAwaiter().GetResult();
return (conn.Query<T>(sql))
.ToList();
}
}
public virtual T GetSingleBySql<T>(string sql, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = GetDbConnectionAsync().GetAwaiter().GetResult();
IDbTransaction trans = GetDbTransactionAsync().GetAwaiter().GetResult();
return conn.QuerySingleOrDefault<T>(sql, null, trans);
}
else
{
IDbConnection conn = (IDbConnection)GetDbConnectionAsync().GetAwaiter().GetResult();
return conn.QuerySingleOrDefault<T>(sql);
}
}
public virtual int ExecuteSql(string sql, object obj = null, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = GetDbConnectionAsync().GetAwaiter().GetResult();
IDbTransaction trans = GetDbTransactionAsync().GetAwaiter().GetResult();
return conn.Execute(sql, obj, trans);
}
else
{
IDbConnection conn = (IDbConnection)GetDbConnectionAsync().GetAwaiter().GetResult();
return conn.Execute(sql, obj);
}
}
#endregion
}
}

85
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/WMSDbContext.cs

@ -0,0 +1,85 @@

using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Entities.WMS;
namespace Win.Sfs.SettleAccount
{
[ConnectionStringName("WMS")]
public class WMSDbContext : AbpDbContext<WMSDbContext>
{
#region DbSet
//public virtual DbSet<TB_BILL> TB_BILL { get; set; }
//public virtual DbSet<TS_SORT_DETAIL> TS_SORT_DETAIL { get; set; }
#endregion
/* Add DbSet properties for your Aggregate Roots / Entities here.
* Also map them inside NewJitDbContextModelCreatingExtensions.ConfigureNewJit
*/
public WMSDbContext(DbContextOptions<WMSDbContext> options)
: base(options)
{
}
//protected override void OnModelCreating(ModelBuilder builder)
//{
// base.OnModelCreating(builder);
// builder.Entity<WmsJitOutPutDetial>(b =>
// {
// b.ToTable("WmsJitOutPutDetial");
// b.HasKey(x => x.Id);
// b.Property(x => x.WmsBillNum).HasMaxLength(50).IsRequired();
// b.Property(x => x.Remark).HasMaxLength(200).IsRequired();
// b.Property(x => x.ParentMaterialCode).HasMaxLength(50).IsRequired();
// b.Property(x => x.MaterialCode).HasMaxLength(50).IsRequired();
// b.Property(x => x.MaterialGroup).HasMaxLength(200);
// b.Property(x => x.OutPut).HasMaxLength(50);
// b.Property(x => x.Extend1).HasMaxLength(50);
// b.Property(x => x.Extend2).HasMaxLength(50);
// b.Property(x => x.Extend3).HasMaxLength(50);
// b.Property(x => x.ChassisNumber).HasMaxLength(50);
// b.Property(x => x.KennCode).HasMaxLength(50);
// b.Property(x => x.MaterialDesc).HasMaxLength(50);
// });
// builder.Entity<TS_UNI_API>(b =>
// {
// b.ToTable("TS_UNI_API");
// b.HasKey(x => x.Id);
// b.Property(x => x.Remark).HasMaxLength(200).IsRequired();
// b.Property(x => x.SourceBillNum).HasMaxLength(50).IsRequired();
// b.Property(x => x.TableName).HasMaxLength(50).IsRequired();
// b.Property(x => x.Version).HasMaxLength(50).IsRequired();
// b.Property(x => x.TableName).HasMaxLength(50).IsRequired();
// b.Property(x => x.TableName).HasMaxLength(50).IsRequired();
// });
// //在这里配置共享表
// //builder.Entity<TS_SORT_DETAIL>(b =>
// //{
// // b.HasIndex(x => new { x.BillNum, x.VinCode, x.PartCode }).IsUnique();
// //});
//}
}
}

162
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/WMSEfCoreRepository.cs

@ -0,0 +1,162 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Storage;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Win.Sfs.Shared;
using Win.Sfs.Shared.DomainBase;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Repository
{
public class WMSEfCoreRepository<TEntity> :
EfCoreRepository<WMSDbContext,TEntity>,
ITransientDependency
where TEntity : class,IEntity
{
private readonly IDbContextProvider<WMSDbContext> _dbContextProvider;
public WMSEfCoreRepository(IDbContextProvider<WMSDbContext> dbContextProvider) :
base(dbContextProvider)
{
_dbContextProvider = dbContextProvider;
}
public WMSEfCoreRepository() : base(null)
{
}
public DbCommand CreateCommand(string commandText, CommandType commandType, params DbParameter[] parameters)
{
var command = DbContext.Database.GetDbConnection().CreateCommand();
command.CommandText = commandText;
command.CommandType = commandType;
command.Transaction = DbContext.Database.CurrentTransaction?.GetDbTransaction();
foreach (var parameter in parameters)
{
command.Parameters.Add(parameter);
}
return command;
}
public async Task EnsureConnectionOpenAsync(CancellationToken cancellationToken = default)
{
var connection = DbContext.Database.GetDbConnection();
if (connection.State != ConnectionState.Open)
{
await connection.OpenAsync(cancellationToken);
}
}
public virtual async Task<List<TEntity>> GetAllAsync( bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var query = includeDetails ? this.WithDetails() : this.GetQueryable();
//query = query.Where(p => p.BranchId.Equals(branchId));
return await query.ToListAsync(cancellationToken: cancellationToken);
}
public virtual async Task<long> GetCountAsync( CancellationToken cancellationToken = default)
{
return await this.GetQueryable()
//.Where(p => p.BranchId.Equals(branchId))
.LongCountAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<long> GetCountByFilterAsync( List<FilterCondition> filters,
CancellationToken cancellationToken = default)
{
return await this.GetQueryable()
//.Where(p => p.BranchId.Equals(branchId))
.WhereIf(filters?.Count != 0, filters.ToLambda<TEntity>())
.LongCountAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<TEntity>> GetListByFilterAsync(List<FilterCondition> filters,
string sorting = null,
int maxResultCount = int.MaxValue, int skipCount = 0, bool includeDetails = false,
CancellationToken cancellationToken = default)
{
var query = includeDetails ? this.WithDetails() : this.GetQueryable();
// query = query.Where(p => p.BranchId.Equals(branchId));
var entities = query.WhereIf(filters?.Count != 0, filters.ToLambda<TEntity>());
//2021-07-02 设置sorting首字母大小,因设置了驼峰规则,不匹配“ var memberProp = typeof(T).GetProperty(propertyName);”反射
if(!string.IsNullOrEmpty(sorting))
{
sorting = sorting.Substring(0, 1).ToUpper() + sorting.Substring(1);
}
entities = GetSortingQueryable(entities, sorting);
return await entities.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
protected static IQueryable<TEntity> GetSortingQueryable(IQueryable<TEntity> entities, string sorting)
{
if (string.IsNullOrEmpty(sorting))
{
entities = entities.OrderByDescending("Id");
}
else
{
var sortParams = sorting?.Split(' ');
var sortName = sortParams[0];
Type t = typeof(TEntity);
var _first = t.GetProperties().Where(p => p.Name.ToUpper() == sortName.ToUpper()).FirstOrDefault();
if (_first != null)
{
sortName = _first.Name;
}
bool isDesc;
if (sortParams.Length > 1)
{
var sortDirection = sortParams[1];
isDesc = sortDirection.ToUpper().Contains("DESC") ? true : false;
}
else
{
isDesc = true;
}
entities = isDesc ? entities.OrderByDescending(sortName) : entities.OrderBy(sortName);
}
return entities;
}
}
}
Loading…
Cancel
Save