From f97e839677bfb8c0cf4b3d203399026bf42667bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=BE=E8=8D=A3=E5=9B=BD?= Date: Wed, 26 Jan 2022 15:43:53 +0800 Subject: [PATCH] =?UTF-8?q?[update]=E6=8E=A5=E6=94=B6=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=8E,=20=E5=AF=B9=E6=8E=A5=E5=88=B0SCP?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Parts/PartAppService.cs | 1 - .../PurchaseOrders/PurchaseOrderAppService.cs | 5 - .../Receipts/ReceiptAppService.cs | 1 - .../Suppliers/SuppliersAppService.cs | 1 - .../UnplannedReceiptAppService.cs | 1 - .../Parts/Part.cs | 4 - .../PurchaseOrders/PurchaseOrder.cs | 5 - .../PurchaseOrders/PurchaseOrderDetail.cs | 7 +- .../Receipts/Receipt.cs | 5 +- .../Suppliers/Supplier.cs | 6 +- .../UnplannedReceipts/UnplannedReceipt.cs | 6 +- .../appsettings.json | 2 +- .../Win_in.Sfs.Scp.v1.Domain/Parts/TA_PART.cs | 36 +- .../PurchaseOrders/ITbPoDetailRepository.cs | 12 + .../PurchaseOrders/ITbPoRepository.cs | 4 +- .../PurchaseOrders/TB_PO.cs | 28 +- .../PurchaseOrders/TB_PO_DETAIL.cs | 50 +- .../Receipts/ITbReceiptDetailRepository.cs | 12 + .../Receipts/ITbReceiptRepository.cs | 4 +- .../Receipts/TB_RECEIVE_DETAIL_QAD.cs | 33 +- .../Receipts/TB_RECEIVE_QAD.cs | 26 +- .../Rejects/ITbRejectRepository.cs | 10 - .../Rejects/TB_REJECT.cs | 40 -- .../Rejects/TB_REJECT_DETAIL.cs | 31 - .../Suppliers/ITaVenderRepository.cs | 5 +- .../Suppliers/TA_VENDER.cs | 32 +- .../DbContext/IV1ScpDbContext.cs | 3 +- .../DbContext/V1ScpDbContext.cs | 4 +- .../V1ScpDbContextModelCreatingExtensions.cs | 243 ++++++- .../V1ScpModelBuilderConfigurationOptions.cs | 4 +- .../20220126072541_Init.Designer.cs | 651 ++++++++++++++++++ .../Migrations/20220126072541_Init.cs | 278 ++++++++ .../Migrations/V1ScpDbContextModelSnapshot.cs | 649 +++++++++++++++++ .../Repositories/TaPartRepository.cs | 21 +- .../Repositories/TaVenderRepository.cs | 36 +- .../Repositories/TbPoDetailRepository.cs | 46 ++ .../Repositories/TbPoRepository.cs | 34 +- .../Repositories/TbReceiptDetailRepository.cs | 51 ++ .../Repositories/TbReceiptRepository.cs | 32 +- .../Repositories/TbRejectRepository.cs | 13 - .../V1ScpEntityFrameworkCoreModule.cs | 3 +- .../PartEventHandler.cs | 11 +- .../PurchaseOrderEventHandler.cs | 36 +- .../ReceiptEventHandler.cs | 32 +- .../SupplierEventHandler.cs | 22 +- .../UnplannedReceiptEventHandler.cs | 30 +- .../WebApiApplicationAutoMapperProfile.cs | 226 +++++- 47 files changed, 2397 insertions(+), 395 deletions(-) create mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoDetailRepository.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptDetailRepository.cs delete mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/ITbRejectRepository.cs delete mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT.cs delete mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT_DETAIL.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.Designer.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/V1ScpDbContextModelSnapshot.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoDetailRepository.cs create mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs delete mode 100644 WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbRejectRepository.cs diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs index 955e47e..81c2d09 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs @@ -63,7 +63,6 @@ namespace Win_in.Sfs.Scp.WebApi { var entity = ObjectMapper.Map(partCreateDTO); - entity.SetId(GuidGenerator.Create()); var ret= await _partRepository.InsertAsync(entity); var dto = ObjectMapper.Map(ret); return dto; diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs index 392b9a5..c7e4be2 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs @@ -59,11 +59,6 @@ namespace Win_in.Sfs.Scp.WebApi public async Task CreateAsync(PurchaseOrderCreateDTO poCreateDTO) { var entity = ObjectMapper.Map(poCreateDTO); - entity.SetId(GuidGenerator.Create()); - foreach (var detail in entity.Details) - { - detail.SetId(GuidGenerator.Create()); - } var ret = await _purchaseOrderRepository.InsertAsync(entity); var dto = ObjectMapper.Map(ret); return dto; diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs index 67fa268..7495f35 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs @@ -62,7 +62,6 @@ namespace Win_in.Sfs.Scp.WebApi public async Task CreateAsync(ReceiptCreateDTO receiptCreateDTO) { var entity = ObjectMapper.Map(receiptCreateDTO); - entity.SetId(GuidGenerator.Create()); var ret = await _receiptRepository.InsertAsync(entity); var dto = ObjectMapper.Map(ret); return dto; diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs index a417c1b..584fd97 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs @@ -62,7 +62,6 @@ namespace Win_in.Sfs.Scp.WebApi public async Task CreateAsync(SupplierCreateDTO supplierCreateDTO) { var entity = ObjectMapper.Map(supplierCreateDTO); - entity.SetId(GuidGenerator.Create()); var ret = await _supplierRepository.InsertAsync(entity); var dto = ObjectMapper.Map(ret); return dto; diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs index 2bcede4..598b3e0 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs @@ -61,7 +61,6 @@ namespace Win_in.Sfs.Scp.WebApi public async Task CreateAsync(UnplannedReceiptCreateDTO receiptCreateDTO) { var entity = ObjectMapper.Map(receiptCreateDTO); - entity.SetId(GuidGenerator.Create()); var ret = await _unplannedReceiptRepository.InsertAsync(entity); var dto = ObjectMapper.Map(ret); return dto; diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/Part.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/Part.cs index 204a89f..7f5936e 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/Part.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/Part.cs @@ -160,9 +160,5 @@ namespace Win_in.Sfs.Scp.WebApi public string Company {get;set;} - public void SetId(Guid id) - { - Id = id; - } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrder.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrder.cs index 33de613..74fcea8 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrder.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrder.cs @@ -101,11 +101,6 @@ namespace Win_in.Sfs.Scp.WebApi public virtual List Details { get; set; } - public void SetId(Guid id) - { - Id = id; - } - #region details handler public virtual void AddDetail(IGuidGenerator guidGenerator, PurchaseOrderDetail detail) diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrderDetail.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrderDetail.cs index 115add3..1ef1d45 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrderDetail.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrderDetail.cs @@ -95,11 +95,6 @@ namespace Win_in.Sfs.Scp.WebApi LineStatus = lineStatus; Remark = remark; } - - public void SetId(Guid id) - { - Id = id; - } - + } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Receipts/Receipt.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Receipts/Receipt.cs index 6955ed9..70e6a25 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Receipts/Receipt.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Receipts/Receipt.cs @@ -135,10 +135,7 @@ namespace Win_in.Sfs.Scp.WebApi /// [Display(Name = "公司(Company)")] public string Company { set; get; } - public void SetId(Guid id) - { - Id = id; - } + } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Suppliers/Supplier.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Suppliers/Supplier.cs index b7491e0..974f0c1 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Suppliers/Supplier.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Suppliers/Supplier.cs @@ -105,11 +105,7 @@ namespace Win_in.Sfs.Scp.WebApi /// [Display(Name = "备注(Remark)")] public string Remark { set; get; } - - public void SetId(Guid id) - { - Id = id; - } + } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/UnplannedReceipts/UnplannedReceipt.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/UnplannedReceipts/UnplannedReceipt.cs index 602c41e..cd2fbb8 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/UnplannedReceipts/UnplannedReceipt.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/UnplannedReceipts/UnplannedReceipt.cs @@ -95,11 +95,7 @@ namespace Win_in.Sfs.Scp.WebApi /// [Display(Name = "公司(Company)")] public string Company { set; get; } - - public void SetId(Guid id) - { - Id = id; - } + } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json index f7d92ee..0c4ffc3 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json @@ -33,5 +33,5 @@ } } }, - "AlwaysAllowAuthorization": false + "AlwaysAllowAuthorization": true } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Parts/TA_PART.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Parts/TA_PART.cs index 22e1020..e065bfc 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Parts/TA_PART.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Parts/TA_PART.cs @@ -4,71 +4,41 @@ using Volo.Abp.Domain.Entities; namespace Win_in.Sfs.Scp.v1.Domain { - public class TA_PART:Entity + public class TA_PART:Entity { - - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long UID { get; set; } - - [Key] - [Column(Order = 0)] - [StringLength(50)] + public string PartCode { get; set; } - [Required] - [StringLength(50)] public string ErpPartCode { get; set; } - // [Required] public string PartDesc1 { get; set; } - // [Required] public string PartDesc2 { get; set; } - // [Required] - [StringLength(50)] public string ProjectId { get; set; } - [Required] - [StringLength(50)] public string Unit { get; set; } - // [Required] - [StringLength(50)] public string PartGroup { get; set; } - [Required] - [StringLength(10)] public string State { get; set; } - [StringLength(100)] public string Configuration { get; set; } public int ValidityDays { get; set; } - [StringLength(50)] public string ReceivePort { get; set; } - [StringLength(50)] public string PalletSize { get; set; } - [StringLength(500)] public string Remark { get; set; } - [Key] - [Column(Order = 1)] - [StringLength(50)] public string Site { get; set; } - public string Qlevel { get; set; } public bool? Ischeck { get; set; } - - public override object[] GetKeys() - { - return new object[]{Site,PartCode}; - } + } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoDetailRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoDetailRepository.cs new file mode 100644 index 0000000..5d77e07 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoDetailRepository.cs @@ -0,0 +1,12 @@ +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Scp.v1.Domain +{ + public interface ITbPoDetailRepository : IRepository, ITransientDependency + { + Task UpsertAsync(TB_PO_DETAIL tbPoDetail); + + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoRepository.cs index 617cab3..d67fa48 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoRepository.cs @@ -1,10 +1,12 @@ -using Volo.Abp.DependencyInjection; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; namespace Win_in.Sfs.Scp.v1.Domain { public interface ITbPoRepository : IRepository, ITransientDependency { + Task UpsertAsync(TB_PO tbPo); } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO.cs index ea95fc8..dc66fa1 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO.cs @@ -5,57 +5,31 @@ using Volo.Abp.Domain.Entities; namespace Win_in.Sfs.Scp.v1.Domain { - public class TB_PO : Entity + public class TB_PO : Entity { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long UID { get; set; } - [Key] - [Column(Order = 0)] - [StringLength(50)] public string PoBillNum { get; set; } - [StringLength(50)] public string ErpBillNum { get; set; } - [StringLength(50)] public string VendId { get; set; } public int? ModType { get; set; } - [StringLength(50)] public string Contacter { get; set; } - [Key] - [Column(Order = 1)] - [StringLength(50)] public string Site { get; set; } - [StringLength(50)] public string Buyer { get; set; } - [StringLength(50)] public string BuyerPhone { get; set; } public int State { get; set; } - [StringLength(200)] public string Remark { get; set; } - public DateTime? BeginTime { get; set; } - public DateTime? EndTime { get; set; } - - public string Extend1 { get; set; } public string Extend2 { get; set; } public string Extend3 { get; set; } public string SubSite { get; set; } - public DateTime CreateTime { get; set; } - [StringLength(50)] public string CreateUser { get; set; } public DateTime? UpdateTime { get; set; } - [StringLength(50)] public string UpdateUser { get; set; } - [StringLength(50)] public string UpdateInfo { get; set; } public bool IsDeleted { get; set; } public Guid GUID { get; set; } - public override object[] GetKeys() - { - return new object[] { Site, PoBillNum }; - } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO_DETAIL.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO_DETAIL.cs index d10561f..4d5049e 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO_DETAIL.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO_DETAIL.cs @@ -5,85 +5,41 @@ using Volo.Abp.Domain.Entities; namespace Win_in.Sfs.Scp.v1.Domain { - public class TB_PO_DETAIL : Entity + public class TB_PO_DETAIL : Entity { - - - - - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long UID { get; set; } - - - - [StringLength(50)] + public string PoBillNum { get; set; } public int PoLine { get; set; } - public DateTime? BeginTime { get; set; } public DateTime? EndTime { get; set; } - - [Required] - [StringLength(50)] public string PartCode { get; set; } - - [Column(TypeName = "money")] public decimal ShippedQty { get; set; } - - [Column(TypeName = "money")] public decimal ReceivedQty { get; set; } - public string RejectQty { get; set; } - - [StringLength(50)] public string PoUnit { get; set; } - - [StringLength(50)] public string LocUnit { get; set; } - - [Column(TypeName = "money")] public decimal Price { get; set; } - - [StringLength(50)] public string Currency { get; set; } - public decimal PlanQty { get; set; } - [Column(TypeName = "money")] public decimal PackQty { get; set; } - [Column(TypeName = "money")] public decimal? TempQty { get; set; } - public int State { get; set; } - - [StringLength(200)] public string Remark { get; set; } public decimal UnConv { get; set; } - [StringLength(50)] public string DockCode { get; set; } - public string Extend1 { get; set; } public string Extend2 { get; set; } public string Extend3 { get; set; } public string SubSite { get; set; } - public string Site { get; set; } - public DateTime CreateTime { get; set; } - [StringLength(50)] public string CreateUser { get; set; } public DateTime? UpdateTime { get; set; } - [StringLength(50)] public string UpdateUser { get; set; } - [StringLength(50)] public string UpdateInfo { get; set; } public bool IsDeleted { get; set; } public Guid GUID { get; set; } - - public override object[] GetKeys() - { - return new object[] { UID }; - } + } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptDetailRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptDetailRepository.cs new file mode 100644 index 0000000..a4c9ff7 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptDetailRepository.cs @@ -0,0 +1,12 @@ +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; + +namespace Win_in.Sfs.Scp.v1.Domain +{ + public interface ITbReceiptDetailRepository : IRepository, ITransientDependency + { + Task UpsertAsync(TB_RECEIVE_DETAIL_QAD taPart); + + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptRepository.cs index 029741d..7179c7a 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptRepository.cs @@ -1,10 +1,12 @@ -using Volo.Abp.DependencyInjection; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; namespace Win_in.Sfs.Scp.v1.Domain { public interface ITbReceiptRepository : IRepository, ITransientDependency { + Task UpsertAsync(TB_RECEIVE_QAD taPart); } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_DETAIL_QAD.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_DETAIL_QAD.cs index 6c5b707..4d2ef81 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_DETAIL_QAD.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_DETAIL_QAD.cs @@ -1,51 +1,29 @@ using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; +using Volo.Abp.Domain.Entities; namespace Win_in.Sfs.Scp.v1.Domain { - public class TB_RECEIVE_DETAIL_QAD + public class TB_RECEIVE_DETAIL_QAD:Entity { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long UID { get; set; } - [StringLength(50)] - public string RecvBillNum { get; set; } - //[Key] - //[Column(Order = 1)] - //[StringLength(50)] public string PoBillNum { get; set; } - //[Key] - //[Column(Order = 2)] public int PoLine { get; set; } - [Key] - [Column(Order = 3)] - [StringLength(50)] public string PartCode { get; set; } - [StringLength(50)] public string Batch { get; set; } public decimal Qty { get; set; } - [StringLength(50)] public string DockCode { get; set; } public int State { get; set; } - [StringLength(500)] public string Remark { get; set; } public DateTime CreateTime { get; set; } - [StringLength(50)] public string CreateUser { get; set; } public bool IsDeleted { get; set; } - public Guid GUID { get; set; } - public int BillType { get; set; } - [StringLength(50)] public string VendBatch { get; set; } - [StringLength(50)] public string PoUnit { get; set; } - [StringLength(50)] public string LocUnit { get; set; } - [Key] - [Column(Order = 0)] public string ErpRecvBillNum { get; set; } /// @@ -56,20 +34,13 @@ namespace Win_in.Sfs.Scp.v1.Domain /// 成本价 /// public decimal? StdCost { get; set; } - [Key] - [Column(Order = 4)] public string Site { get; set; } - public decimal? Rate { get; set; } - - public decimal? CurAmt { get; set; } - public string Tax { get; set; } public string Extend1 { get; set; } public string Extend2 { get; set; } public string Extend3 { get; set; } - public string SubSite { get; set; } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_QAD.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_QAD.cs index 1bebdff..91b08ee 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_QAD.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_QAD.cs @@ -5,52 +5,30 @@ using Volo.Abp.Domain.Entities; namespace Win_in.Sfs.Scp.v1.Domain { - public class TB_RECEIVE_QAD:Entity + public class TB_RECEIVE_QAD:Entity { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public long UID { get; set; } - [StringLength(50)] public string RecvBillNum { get; set; } - [StringLength(50)] public string PoBillNum { get; set; } - [StringLength(50)] public string AsnBillNum { get; set; } - - [Key] - [Column(Order = 1)] - [StringLength(50)] public string Site { get; set; } - [StringLength(50)] public string VendId { get; set; } public DateTime ShipTime { get; set; } public int State { get; set; } - [StringLength(50)] public string Remark { get; set; } public DateTime CreateTime { get; set; } - [StringLength(50)] public string CreateUser { get; set; } public bool IsDeleted { get; set; } public Guid GUID { get; set; } - [StringLength(50)] public string OperName { get; set; } public int BillType { get; set; } - [Key] - [Column(Order = 0)] public string ErpRecvBillNum { get; set; } - - public string Tax { get; set; } public string Extend1 { get; set; } public string Extend2 { get; set; } public string Extend3 { get; set; } - public string SubSite { get; set; } - - public override object[] GetKeys() - { - return new object[] { Site,ErpRecvBillNum }; - } + } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/ITbRejectRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/ITbRejectRepository.cs deleted file mode 100644 index 53b7768..0000000 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/ITbRejectRepository.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; - -namespace Win_in.Sfs.Scp.v1.Domain -{ - public interface ITbRejectRepository : IRepository, ITransientDependency - { - - } -} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT.cs deleted file mode 100644 index 9d85e93..0000000 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Volo.Abp.Domain.Entities; - -namespace Win_in.Sfs.Scp.v1.Domain -{ - public class TB_REJECT:Entity - { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [Key] - public long UID { get; set; } - [StringLength(50)] - public string RjctBillNum { get; set; } - [StringLength(50)] - public string PoBillNum { get; set; } - [StringLength(50)] - public string AsnBillNum { get; set; } - [StringLength(50)] - public string Site { get; set; } - [StringLength(50)] - public string VendId { get; set; } - public DateTime ShipTime { get; set; } - public int State { get; set; } - [StringLength(50)] - public string Remark { get; set; } - public DateTime CreateTime { get; set; } - [StringLength(50)] - public string CreateUser { get; set; } - public bool IsDeleted { get; set; } - public Guid GUID { get; set; } - [StringLength(50)] - public string OperName { get; set; } - - public override object[] GetKeys() - { - return new object[] { UID }; - } - } -} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT_DETAIL.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT_DETAIL.cs deleted file mode 100644 index db51655..0000000 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT_DETAIL.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; - -namespace Win_in.Sfs.Scp.v1.Domain -{ - public class TB_REJECT_DETAIL - { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [Key] - public long UID { get; set; } - [StringLength(50)] - public string RjctBillNum { get; set; } - [StringLength(50)] - public string PoBillNum { get; set; } - public int PoLine { get; set; } - [StringLength(50)] - public string PartCode { get; set; } - [StringLength(50)] - public string Batch { get; set; } - public decimal Qty { get; set; } - public int State { get; set; } - [StringLength(50)] - public string Remark { get; set; } - public DateTime CreateTime { get; set; } - [StringLength(50)] - public string CreateUser { get; set; } - public bool IsDeleted { get; set; } - public Guid GUID { get; set; } - } -} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/ITaVenderRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/ITaVenderRepository.cs index eb4a723..25e1b08 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/ITaVenderRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/ITaVenderRepository.cs @@ -1,10 +1,11 @@ -using Volo.Abp.DependencyInjection; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; namespace Win_in.Sfs.Scp.v1.Domain { public interface ITaVenderRepository : IRepository, ITransientDependency { - + Task UpsertAsync(TA_VENDER taVender); } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/TA_VENDER.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/TA_VENDER.cs index 8a1d1bb..60468ea 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/TA_VENDER.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/TA_VENDER.cs @@ -4,72 +4,46 @@ using Volo.Abp.Domain.Entities; namespace Win_in.Sfs.Scp.v1.Domain { - public class TA_VENDER:Entity + public class TA_VENDER:Entity { - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int UID { get; set; } - [Key] - [Column(Order = 0)] - [StringLength(50)] public string VendId { get; set; } - [Required] - [StringLength(50)] public string VendName { get; set; } - [Required] - [StringLength(50)] public string VendAbbCode { get; set; } - [StringLength(50)] public string VendType { get; set; } - [StringLength(50)] public string Country { get; set; } - [StringLength(50)] public string City { get; set; } - [StringLength(50)] public string Currency { get; set; } - [StringLength(200)] public string Address { get; set; } - [StringLength(50)] public string ZipCode { get; set; } - [StringLength(50)] public string Contacter { get; set; } - [StringLength(50)] public string Phone { get; set; } - [StringLength(50)] public string Fax { get; set; } - [StringLength(50)] public string Email { get; set; } public int State { get; set; } - [StringLength(500)] public string Remark { get; set; } - public decimal? Tax { get; set; } - [Key] - [Column(Order = 1)] - [StringLength(50)] + public string Site { get; set; } public int? ReceiveTimeScope { set; get; } + public decimal? Quota { set; get; } - public override object[] GetKeys() - { - return new object[] { Site, VendId }; - } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/IV1ScpDbContext.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/IV1ScpDbContext.cs index 85d3a5c..6429f2a 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/IV1ScpDbContext.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/IV1ScpDbContext.cs @@ -8,7 +8,8 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore DbSet Parts { get; set; } DbSet Suppliers { get; set; } DbSet PurchaseOrders { get; set; } + DbSet PurchaseOrderDetails { get; set; } DbSet Receipts { get; set; } - DbSet Rejects { get; set; } + DbSet ReceiptDetails { get; set; } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs index 03f63d1..5c8d45d 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs @@ -15,10 +15,10 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore public virtual DbSet Parts { get; set; } public virtual DbSet Suppliers { get; set; } public virtual DbSet PurchaseOrders { get; set; } + public virtual DbSet PurchaseOrderDetails { get; set; } public virtual DbSet Receipts { get; set; } - public virtual DbSet Rejects { get; set; } + public virtual DbSet ReceiptDetails { get; set; } - public V1ScpDbContext(DbContextOptions options) diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs index 38fb988..126c9e9 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs @@ -2,13 +2,14 @@ using System; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.EntityFrameworkCore.Modeling; +using Win_in.Sfs.Scp.v1.Domain; using Win_in.Sfs.Scp.WebApi; namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore { public static class V1ScpDbContextModelCreatingExtensions { - public const string IsDeletedFilter = "IsDeleted=0"; + public static void ConfigureV1Scp( this ModelBuilder builder, Action optionsAction = null) @@ -22,11 +23,243 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore optionsAction?.Invoke(options); - + builder.ConfigurePart(options); + builder.ConfigSuppliers(options); + builder.ConfigPurchaseOrder(options); + builder.ConfigPurchaseOrderDetail(options); + builder.ConfigReceipt(options); + builder.ConfigReceiptDetail(options); + } + private static void ConfigurePart(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Table + b.ToTable($"{nameof(TA_PART)}", options.Schema); + //Convention + b.ConfigureByConvention(); + //Properties + b.Property(q => q.Id).HasColumnName("UID").ValueGeneratedOnAdd(); + b.Property(q => q.Site).HasMaxLength(50).IsRequired(); + b.Property(q => q.PartCode).HasMaxLength(50).IsRequired(); + b.Property(q => q.ErpPartCode).HasMaxLength(50).IsRequired(); + b.Property(q => q.PartDesc1).HasMaxLength(500); + b.Property(q => q.PartDesc2).HasMaxLength(500); + b.Property(q => q.ProjectId).HasMaxLength(50); + b.Property(q => q.Unit).HasMaxLength(50).IsRequired(); + b.Property(q => q.PartGroup).HasMaxLength(50); + b.Property(q => q.State).HasMaxLength(10).IsRequired(); + b.Property(q => q.Configuration).HasMaxLength(100); + b.Property(q => q.ValidityDays); + b.Property(q => q.ReceivePort).HasMaxLength(50); + b.Property(q => q.PalletSize).HasMaxLength(50); + b.Property(q => q.Remark).HasMaxLength(500); + b.Property(q => q.Qlevel).HasMaxLength(50); + b.Property(q => q.Ischeck); - + //Indexes + b.HasIndex(q => new { q.Site, q.PartCode }).IsUnique(); + }); } - - + private static void ConfigSuppliers(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Table + b.ToTable($"{nameof(TA_VENDER)}", options.Schema); + //Convention + b.ConfigureByConvention(); + //Properties + b.Property(q => q.Id).HasColumnName("UID").ValueGeneratedOnAdd(); + b.Property(q => q.Site).HasMaxLength(50).IsRequired(); + b.Property(q => q.VendId).HasMaxLength(50).IsRequired(); + b.Property(q => q.VendName).HasMaxLength(50).IsRequired(); + b.Property(q => q.VendAbbCode).HasMaxLength(50).IsRequired(); + b.Property(q => q.VendType).HasMaxLength(50); + b.Property(q => q.Country).HasMaxLength(50); + b.Property(q => q.City).HasMaxLength(50); + b.Property(q => q.Currency).HasMaxLength(50); + b.Property(q => q.Address).HasMaxLength(200); + b.Property(q => q.ZipCode).HasMaxLength(50); + b.Property(q => q.Contacter).HasMaxLength(50); + b.Property(q => q.Phone).HasMaxLength(50); + b.Property(q => q.Fax).HasMaxLength(50); + b.Property(q => q.Email).HasMaxLength(50); + b.Property(q => q.State); + b.Property(q => q.Remark).HasMaxLength(500); + b.Property(q => q.Tax).HasPrecision(18,6); + b.Property(q => q.ReceiveTimeScope); + b.Property(q => q.Quota).HasPrecision(18, 6); + + //Indexes + b.HasIndex(q => new { q.Site, q.VendId }).IsUnique(); + + }); + } + private static void ConfigPurchaseOrder(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Table + b.ToTable($"{nameof(TB_PO)}", options.Schema); + //Convention + b.ConfigureByConvention(); + //Properties + b.Property(q => q.Id).HasColumnName("UID").ValueGeneratedOnAdd(); + b.Property(q => q.Site).HasMaxLength(50).IsRequired(); + b.Property(q => q.PoBillNum).HasMaxLength(50).IsRequired(); + b.Property(q => q.ErpBillNum).HasMaxLength(50).IsRequired(); + b.Property(q => q.VendId).HasMaxLength(50).IsRequired(); + b.Property(q => q.ModType); + b.Property(q => q.Contacter).HasMaxLength(50); + b.Property(q => q.Buyer).HasMaxLength(50); + b.Property(q => q.BuyerPhone).HasMaxLength(50); + b.Property(q => q.Remark).HasMaxLength(500); + b.Property(q => q.BeginTime); + b.Property(q => q.EndTime); + b.Property(q => q.Extend1); + b.Property(q => q.Extend2); + b.Property(q => q.Extend3); + b.Property(q => q.SubSite).HasMaxLength(50); + b.Property(q => q.CreateTime); + b.Property(q => q.CreateUser).HasMaxLength(50); + b.Property(q => q.UpdateTime); + b.Property(q => q.UpdateUser).HasMaxLength(50); + b.Property(q => q.UpdateInfo).HasMaxLength(50); + b.Property(q => q.IsDeleted); + b.Property(q => q.GUID); + + //Indexes + b.HasIndex(q => new { q.Site, q.PoBillNum }).IsUnique(); + + }); + } + private static void ConfigPurchaseOrderDetail(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Table + b.ToTable($"{nameof(TB_PO_DETAIL)}", options.Schema); + //Convention + b.ConfigureByConvention(); + //Properties + b.Property(q => q.Id).HasColumnName("UID").ValueGeneratedOnAdd(); + b.Property(q => q.Site).HasMaxLength(50).IsRequired(); + b.Property(q => q.PoBillNum).HasMaxLength(50).IsRequired(); + b.Property(q => q.PoLine); + b.Property(q => q.BeginTime); + b.Property(q => q.EndTime); + b.Property(q => q.PartCode).HasMaxLength(50).IsRequired(); + b.Property(q => q.ShippedQty).HasPrecision(18,6); + b.Property(q => q.ReceivedQty).HasPrecision(18, 6); + b.Property(q => q.RejectQty).HasPrecision(18, 6); + b.Property(q => q.PoUnit).HasMaxLength(50).IsRequired(); + b.Property(q => q.LocUnit).HasMaxLength(50).IsRequired(); ; + b.Property(q => q.Price).HasPrecision(18, 6); + b.Property(q => q.Currency).HasMaxLength(50); + b.Property(q => q.PlanQty).HasPrecision(18, 6); + b.Property(q => q.PackQty).HasPrecision(18, 6); + b.Property(q => q.TempQty).HasPrecision(18, 6); + b.Property(q => q.State); + b.Property(q => q.Remark).HasMaxLength(500); + b.Property(q => q.UnConv).HasPrecision(18, 6); + b.Property(q => q.DockCode).HasMaxLength(50); + b.Property(q => q.Extend1); + b.Property(q => q.Extend2); + b.Property(q => q.Extend3); + b.Property(q => q.SubSite).HasMaxLength(50); + b.Property(q => q.CreateTime); + b.Property(q => q.CreateUser).HasMaxLength(50); + b.Property(q => q.UpdateTime); + b.Property(q => q.UpdateUser).HasMaxLength(50); + b.Property(q => q.UpdateInfo).HasMaxLength(50); + b.Property(q => q.IsDeleted); + b.Property(q => q.GUID); + //Indexes + b.HasIndex(q => new { q.Site, q.PoBillNum,q.PoLine }).IsUnique(); + + }); + } + private static void ConfigReceipt(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Table + b.ToTable($"{nameof(TB_RECEIVE_QAD)}", options.Schema); + //Convention + b.ConfigureByConvention(); + //Properties + b.Property(q => q.Id).HasColumnName("UID").ValueGeneratedOnAdd(); + b.Property(q => q.Site).HasMaxLength(50).IsRequired(); + b.Property(q => q.ErpRecvBillNum).HasMaxLength(50).IsRequired(); + b.Property(q => q.RecvBillNum).HasMaxLength(50); + b.Property(q => q.PoBillNum).HasMaxLength(50); + b.Property(q => q.AsnBillNum).HasMaxLength(50); + b.Property(q => q.VendId).HasMaxLength(50); + b.Property(q => q.ShipTime); + b.Property(q => q.State); + b.Property(q => q.Remark).HasMaxLength(50); + b.Property(q => q.CreateTime); + b.Property(q => q.CreateUser).HasMaxLength(50); + b.Property(q => q.IsDeleted); + b.Property(q => q.GUID); + b.Property(q => q.OperName).HasMaxLength(50); + b.Property(q => q.BillType); + b.Property(q => q.Tax).HasPrecision(18, 6); + b.Property(q => q.Extend1); + b.Property(q => q.Extend2); + b.Property(q => q.Extend3); + b.Property(q => q.SubSite).HasMaxLength(50); + + //Indexes + b.HasIndex(q => new { q.Site, q.ErpRecvBillNum }).IsUnique(); + + }); + } + private static void ConfigReceiptDetail(this ModelBuilder builder, V1ScpModelBuilderConfigurationOptions options) + { + builder.Entity(b => + { + //Table + b.ToTable($"{nameof(TB_RECEIVE_DETAIL_QAD)}", options.Schema); + //Convention + b.ConfigureByConvention(); + //Properties + b.Property(q => q.Id).HasColumnName("UID").ValueGeneratedOnAdd(); + b.Property(q => q.Site).HasMaxLength(50).IsRequired(); + b.Property(q => q.ErpRecvBillNum).HasMaxLength(50).IsRequired(); + b.Property(q => q.RecvBillNum).HasMaxLength(50); + b.Property(q => q.PoBillNum).HasMaxLength(50); + b.Property(q => q.PoLine); + b.Property(q => q.PartCode).HasMaxLength(50); + b.Property(q => q.Batch).HasMaxLength(50); + b.Property(q => q.Qty).HasPrecision(18,6); + b.Property(q => q.DockCode).HasMaxLength(50); + b.Property(q => q.State); + b.Property(q => q.Remark).HasMaxLength(500); + b.Property(q => q.CreateTime); + b.Property(q => q.CreateUser).HasMaxLength(50); + b.Property(q => q.IsDeleted); + b.Property(q => q.GUID); + b.Property(q => q.BillType); + b.Property(q => q.VendBatch).HasMaxLength(50); + b.Property(q => q.PoUnit).HasMaxLength(50); + b.Property(q => q.LocUnit).HasMaxLength(50); + b.Property(q => q.PurCost).HasPrecision(18, 6); + b.Property(q => q.StdCost).HasPrecision(18, 6); + b.Property(q => q.Rate).HasPrecision(18, 6); + b.Property(q => q.CurAmt).HasPrecision(18, 6); + b.Property(q => q.Tax).HasPrecision(18, 6); + b.Property(q => q.Extend1); + b.Property(q => q.Extend2); + b.Property(q => q.Extend3); + b.Property(q => q.SubSite).HasMaxLength(50); + //Indexes + b.HasIndex(q => new { q.Site, q.ErpRecvBillNum,q.PartCode }).IsUnique(); + + }); + } + + } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpModelBuilderConfigurationOptions.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpModelBuilderConfigurationOptions.cs index ddedcbe..1a4a294 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpModelBuilderConfigurationOptions.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpModelBuilderConfigurationOptions.cs @@ -8,9 +8,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore public V1ScpModelBuilderConfigurationOptions( [NotNull] string tablePrefix = "", [CanBeNull] string schema = null) - : base( - tablePrefix, - schema) + : base(tablePrefix, schema) { } diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.Designer.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.Designer.cs new file mode 100644 index 0000000..f09ea5c --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.Designer.cs @@ -0,0 +1,651 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.v1.EntityFrameworkCore; + +namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(V1ScpDbContext))] + [Migration("20220126072541_Init")] + partial class Init + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.13") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TA_PART", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Configuration") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ErpPartCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Ischeck") + .HasColumnType("bit"); + + b.Property("PalletSize") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartDesc1") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("PartDesc2") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("PartGroup") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Qlevel") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ReceivePort") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Unit") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ValidityDays") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Site", "PartCode") + .IsUnique(); + + b.ToTable("TA_PART"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TA_VENDER", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Address") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("City") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Contacter") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Country") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Currency") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Email") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Fax") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Quota") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReceiveTimeScope") + .HasColumnType("int"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("Tax") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("VendAbbCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VendId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VendName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VendType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ZipCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "VendId") + .IsUnique(); + + b.ToTable("TA_VENDER"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TB_PO", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BeginTime") + .HasColumnType("datetime2"); + + b.Property("Buyer") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BuyerPhone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Contacter") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("ErpBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("GUID") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModType") + .HasColumnType("int"); + + b.Property("PoBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubSite") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UpdateInfo") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VendId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "PoBillNum") + .IsUnique(); + + b.ToTable("TB_PO"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TB_PO_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BeginTime") + .HasColumnType("datetime2"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Currency") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("DockCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("GUID") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LocUnit") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PackQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PartCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PlanQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PoBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PoLine") + .HasColumnType("int"); + + b.Property("PoUnit") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Price") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReceivedQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("RejectQty") + .HasPrecision(18, 6) + .HasColumnType("nvarchar(max)"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("ShippedQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubSite") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TempQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("UnConv") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("UpdateInfo") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "PoBillNum", "PoLine") + .IsUnique(); + + b.ToTable("TB_PO_DETAIL"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TB_RECEIVE_DETAIL_QAD", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Batch") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CurAmt") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("DockCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ErpRecvBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("GUID") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LocUnit") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PoBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PoLine") + .HasColumnType("int"); + + b.Property("PoUnit") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PurCost") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("Qty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("Rate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("RecvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("StdCost") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SubSite") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Tax") + .HasPrecision(18, 6) + .HasColumnType("nvarchar(max)"); + + b.Property("VendBatch") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "ErpRecvBillNum", "PartCode") + .IsUnique() + .HasFilter("[PartCode] IS NOT NULL"); + + b.ToTable("TB_RECEIVE_DETAIL_QAD"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TB_RECEIVE_QAD", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AsnBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ErpRecvBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("GUID") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("OperName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PoBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RecvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShipTime") + .HasColumnType("datetime2"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubSite") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Tax") + .HasPrecision(18, 6) + .HasColumnType("nvarchar(max)"); + + b.Property("VendId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "ErpRecvBillNum") + .IsUnique(); + + b.ToTable("TB_RECEIVE_QAD"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.cs new file mode 100644 index 0000000..157a684 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.cs @@ -0,0 +1,278 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore.Migrations +{ + public partial class Init : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "TA_PART", + columns: table => new + { + UID = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PartCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + ErpPartCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + PartDesc1 = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + PartDesc2 = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + ProjectId = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Unit = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + PartGroup = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + State = table.Column(type: "nvarchar(10)", maxLength: 10, nullable: false), + Configuration = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + ValidityDays = table.Column(type: "int", nullable: false), + ReceivePort = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + PalletSize = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Remark = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + Site = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Qlevel = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Ischeck = table.Column(type: "bit", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TA_PART", x => x.UID); + }); + + migrationBuilder.CreateTable( + name: "TA_VENDER", + columns: table => new + { + UID = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + VendId = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + VendName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + VendAbbCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + VendType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Country = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + City = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Currency = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Address = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + ZipCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Contacter = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Phone = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Fax = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Email = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + State = table.Column(type: "int", nullable: false), + Remark = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + Tax = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true), + Site = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + ReceiveTimeScope = table.Column(type: "int", nullable: true), + Quota = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TA_VENDER", x => x.UID); + }); + + migrationBuilder.CreateTable( + name: "TB_PO", + columns: table => new + { + UID = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PoBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + ErpBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + VendId = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + ModType = table.Column(type: "int", nullable: true), + Contacter = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Site = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Buyer = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + BuyerPhone = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + State = table.Column(type: "int", nullable: false), + Remark = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + BeginTime = table.Column(type: "datetime2", nullable: true), + EndTime = table.Column(type: "datetime2", nullable: true), + Extend1 = table.Column(type: "nvarchar(max)", nullable: true), + Extend2 = table.Column(type: "nvarchar(max)", nullable: true), + Extend3 = table.Column(type: "nvarchar(max)", nullable: true), + SubSite = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + CreateTime = table.Column(type: "datetime2", nullable: false), + CreateUser = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + UpdateTime = table.Column(type: "datetime2", nullable: true), + UpdateUser = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + UpdateInfo = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + GUID = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TB_PO", x => x.UID); + }); + + migrationBuilder.CreateTable( + name: "TB_PO_DETAIL", + columns: table => new + { + UID = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PoBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + PoLine = table.Column(type: "int", nullable: false), + BeginTime = table.Column(type: "datetime2", nullable: true), + EndTime = table.Column(type: "datetime2", nullable: true), + PartCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + ShippedQty = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + ReceivedQty = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + RejectQty = table.Column(type: "nvarchar(max)", precision: 18, scale: 6, nullable: true), + PoUnit = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + LocUnit = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Price = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + Currency = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + PlanQty = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + PackQty = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + TempQty = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true), + State = table.Column(type: "int", nullable: false), + Remark = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + UnConv = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + DockCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Extend1 = table.Column(type: "nvarchar(max)", nullable: true), + Extend2 = table.Column(type: "nvarchar(max)", nullable: true), + Extend3 = table.Column(type: "nvarchar(max)", nullable: true), + SubSite = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Site = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + CreateTime = table.Column(type: "datetime2", nullable: false), + CreateUser = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + UpdateTime = table.Column(type: "datetime2", nullable: true), + UpdateUser = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + UpdateInfo = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + GUID = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_TB_PO_DETAIL", x => x.UID); + }); + + migrationBuilder.CreateTable( + name: "TB_RECEIVE_DETAIL_QAD", + columns: table => new + { + UID = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RecvBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + PoBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + PoLine = table.Column(type: "int", nullable: false), + PartCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Batch = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Qty = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false), + DockCode = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + State = table.Column(type: "int", nullable: false), + Remark = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + CreateTime = table.Column(type: "datetime2", nullable: false), + CreateUser = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + GUID = table.Column(type: "uniqueidentifier", nullable: false), + BillType = table.Column(type: "int", nullable: false), + VendBatch = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + PoUnit = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + LocUnit = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + ErpRecvBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + PurCost = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true), + StdCost = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true), + Site = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Rate = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true), + CurAmt = table.Column(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true), + Tax = table.Column(type: "nvarchar(max)", precision: 18, scale: 6, nullable: true), + Extend1 = table.Column(type: "nvarchar(max)", nullable: true), + Extend2 = table.Column(type: "nvarchar(max)", nullable: true), + Extend3 = table.Column(type: "nvarchar(max)", nullable: true), + SubSite = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TB_RECEIVE_DETAIL_QAD", x => x.UID); + }); + + migrationBuilder.CreateTable( + name: "TB_RECEIVE_QAD", + columns: table => new + { + UID = table.Column(type: "bigint", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + RecvBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + PoBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + AsnBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + Site = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + VendId = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + ShipTime = table.Column(type: "datetime2", nullable: false), + State = table.Column(type: "int", nullable: false), + Remark = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + CreateTime = table.Column(type: "datetime2", nullable: false), + CreateUser = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false), + GUID = table.Column(type: "uniqueidentifier", nullable: false), + OperName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + BillType = table.Column(type: "int", nullable: false), + ErpRecvBillNum = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Tax = table.Column(type: "nvarchar(max)", precision: 18, scale: 6, nullable: true), + Extend1 = table.Column(type: "nvarchar(max)", nullable: true), + Extend2 = table.Column(type: "nvarchar(max)", nullable: true), + Extend3 = table.Column(type: "nvarchar(max)", nullable: true), + SubSite = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_TB_RECEIVE_QAD", x => x.UID); + }); + + migrationBuilder.CreateIndex( + name: "IX_TA_PART_Site_PartCode", + table: "TA_PART", + columns: new[] { "Site", "PartCode" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TA_VENDER_Site_VendId", + table: "TA_VENDER", + columns: new[] { "Site", "VendId" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TB_PO_Site_PoBillNum", + table: "TB_PO", + columns: new[] { "Site", "PoBillNum" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TB_PO_DETAIL_Site_PoBillNum_PoLine", + table: "TB_PO_DETAIL", + columns: new[] { "Site", "PoBillNum", "PoLine" }, + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_TB_RECEIVE_DETAIL_QAD_Site_ErpRecvBillNum_PartCode", + table: "TB_RECEIVE_DETAIL_QAD", + columns: new[] { "Site", "ErpRecvBillNum", "PartCode" }, + unique: true, + filter: "[PartCode] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_TB_RECEIVE_QAD_Site_ErpRecvBillNum", + table: "TB_RECEIVE_QAD", + columns: new[] { "Site", "ErpRecvBillNum" }, + unique: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "TA_PART"); + + migrationBuilder.DropTable( + name: "TA_VENDER"); + + migrationBuilder.DropTable( + name: "TB_PO"); + + migrationBuilder.DropTable( + name: "TB_PO_DETAIL"); + + migrationBuilder.DropTable( + name: "TB_RECEIVE_DETAIL_QAD"); + + migrationBuilder.DropTable( + name: "TB_RECEIVE_QAD"); + } + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/V1ScpDbContextModelSnapshot.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/V1ScpDbContextModelSnapshot.cs new file mode 100644 index 0000000..f385de7 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/V1ScpDbContextModelSnapshot.cs @@ -0,0 +1,649 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.v1.EntityFrameworkCore; + +namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore.Migrations +{ + [DbContext(typeof(V1ScpDbContext))] + partial class V1ScpDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.13") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TA_PART", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Configuration") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ErpPartCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Ischeck") + .HasColumnType("bit"); + + b.Property("PalletSize") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartDesc1") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("PartDesc2") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("PartGroup") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ProjectId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Qlevel") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ReceivePort") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Unit") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ValidityDays") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Site", "PartCode") + .IsUnique(); + + b.ToTable("TA_PART"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TA_VENDER", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Address") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("City") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Contacter") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Country") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Currency") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Email") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Fax") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Phone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Quota") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReceiveTimeScope") + .HasColumnType("int"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("Tax") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("VendAbbCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VendId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VendName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VendType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ZipCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "VendId") + .IsUnique(); + + b.ToTable("TA_VENDER"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TB_PO", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BeginTime") + .HasColumnType("datetime2"); + + b.Property("Buyer") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BuyerPhone") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Contacter") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("ErpBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("GUID") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("ModType") + .HasColumnType("int"); + + b.Property("PoBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubSite") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UpdateInfo") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("VendId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "PoBillNum") + .IsUnique(); + + b.ToTable("TB_PO"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TB_PO_DETAIL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("BeginTime") + .HasColumnType("datetime2"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Currency") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("DockCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("EndTime") + .HasColumnType("datetime2"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("GUID") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LocUnit") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PackQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PartCode") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PlanQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("PoBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PoLine") + .HasColumnType("int"); + + b.Property("PoUnit") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Price") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("ReceivedQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("RejectQty") + .HasPrecision(18, 6) + .HasColumnType("nvarchar(max)"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("ShippedQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubSite") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TempQty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("UnConv") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("UpdateInfo") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "PoBillNum", "PoLine") + .IsUnique(); + + b.ToTable("TB_PO_DETAIL"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TB_RECEIVE_DETAIL_QAD", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Batch") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("CurAmt") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("DockCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ErpRecvBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("GUID") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LocUnit") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PartCode") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PoBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PoLine") + .HasColumnType("int"); + + b.Property("PoUnit") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PurCost") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("Qty") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("Rate") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("RecvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("StdCost") + .HasPrecision(18, 6) + .HasColumnType("decimal(18,6)"); + + b.Property("SubSite") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Tax") + .HasPrecision(18, 6) + .HasColumnType("nvarchar(max)"); + + b.Property("VendBatch") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "ErpRecvBillNum", "PartCode") + .IsUnique() + .HasFilter("[PartCode] IS NOT NULL"); + + b.ToTable("TB_RECEIVE_DETAIL_QAD"); + }); + + modelBuilder.Entity("Win_in.Sfs.Scp.v1.Domain.TB_RECEIVE_QAD", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasColumnName("UID") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AsnBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("BillType") + .HasColumnType("int"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUser") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ErpRecvBillNum") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Extend1") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend2") + .HasColumnType("nvarchar(max)"); + + b.Property("Extend3") + .HasColumnType("nvarchar(max)"); + + b.Property("GUID") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("OperName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("PoBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RecvBillNum") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Remark") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ShipTime") + .HasColumnType("datetime2"); + + b.Property("Site") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("SubSite") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Tax") + .HasPrecision(18, 6) + .HasColumnType("nvarchar(max)"); + + b.Property("VendId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("Site", "ErpRecvBillNum") + .IsUnique(); + + b.ToTable("TB_RECEIVE_QAD"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs index 96ef239..24b57c9 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs @@ -1,4 +1,5 @@ using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Win_in.Sfs.Scp.v1.Domain; @@ -12,24 +13,30 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore { } - public async Task UpsertAsync( TA_PART taPart) + public async Task UpsertAsync(TA_PART taPart) { TA_PART ret; - var current = await GetAsync(p =>p.Site==taPart.Site + var dbSet =await GetDbSetAsync(); + var current = await dbSet.FirstOrDefaultAsync(p => p.Site == taPart.Site && p.PartCode == taPart.PartCode); if (current == null) { - ret =await InsertAsync(taPart); + ret = await InsertAsync(taPart); } else { //使用直接赋值 - current.PartDesc1 = taPart.PartDesc1; - current.PartDesc2 = taPart.PartDesc2; - //... + current.PartDesc1 = taPart.PartDesc1; + current.PartDesc2 = taPart.PartDesc2; + current.ProjectId = taPart.ProjectId; + current.Unit = taPart.Unit; + current.PartGroup = taPart.PartGroup; + current.State = taPart.State; + current.Configuration = taPart.Configuration; + current.Remark = taPart.Remark; - ret =await UpdateAsync(current); + ret = await UpdateAsync(current); } return ret; diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaVenderRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaVenderRepository.cs index b9ece56..0cca128 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaVenderRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaVenderRepository.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Win_in.Sfs.Scp.v1.Domain; @@ -9,5 +11,37 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore public TaVenderRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public async Task UpsertAsync(TA_VENDER taVender) + { + TA_VENDER ret; + var dbSet = await GetDbSetAsync(); + var current = await dbSet.FirstOrDefaultAsync(p => p.Site == taVender.Site + && p.VendId == taVender.VendId); + if (current == null) + { + ret = await InsertAsync(taVender); + } + else + { + + //使用直接赋值 + current.VendName = taVender.VendName; + current.VendAbbCode = taVender.VendAbbCode; + current.Country = taVender.Country; + current.City = taVender.City; + current.Currency = taVender.Currency; + current.Address = taVender.Address; + current.ZipCode = taVender.ZipCode; + current.Contacter = taVender.Contacter; + current.Phone = taVender.Phone; + current.State = taVender.State; + current.Remark = taVender.Remark; + + ret = await UpdateAsync(current); + } + + return ret; + } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoDetailRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoDetailRepository.cs new file mode 100644 index 0000000..80bf6c8 --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoDetailRepository.cs @@ -0,0 +1,46 @@ +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.v1.Domain; + +namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore +{ + public class TbPoDetailRepository : EfCoreRepository, ITbPoDetailRepository + { + public TbPoDetailRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public async Task UpsertAsync(TB_PO_DETAIL tbPoDetail) + { + TB_PO_DETAIL ret; + var dbSet = await GetDbSetAsync(); + var current = await dbSet.FirstOrDefaultAsync(p => p.Site == tbPoDetail.Site + && p.PoBillNum == tbPoDetail.PoBillNum + && p.PoLine ==tbPoDetail.PoLine); + if (current == null) + { + ret = await InsertAsync(tbPoDetail); + } + else + { + + //使用直接赋值 + current.PoUnit = tbPoDetail.PoUnit; + current.LocUnit = tbPoDetail.LocUnit; + current.PlanQty = tbPoDetail.PlanQty; + current.PackQty = tbPoDetail.PackQty; + current.UnConv = tbPoDetail.UnConv; + current.State = tbPoDetail.State; + current.Remark = tbPoDetail.Remark; + current.UpdateTime = tbPoDetail.UpdateTime; + current.UpdateUser = tbPoDetail.UpdateUser; + + ret = await UpdateAsync(current); + } + + return ret; + } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoRepository.cs index a8bb647..65bf400 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoRepository.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Win_in.Sfs.Scp.v1.Domain; @@ -9,5 +11,35 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore public TbPoRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public async Task UpsertAsync(TB_PO tbPo) + { + TB_PO ret; + var dbSet = await GetDbSetAsync(); + var current = await dbSet.FirstOrDefaultAsync(p => p.Site == tbPo.Site + && p.ErpBillNum == tbPo.ErpBillNum); + if (current == null) + { + ret = await InsertAsync(tbPo); + } + else + { + + //使用直接赋值 + current.VendId = tbPo.VendId; + current.ModType = tbPo.ModType; + current.Contacter = tbPo.Contacter; + current.Buyer = tbPo.Buyer; + current.BuyerPhone = tbPo.BuyerPhone; + current.State = tbPo.State; + current.Remark = tbPo.Remark; + current.UpdateTime = tbPo.UpdateTime; + current.UpdateUser = tbPo.UpdateUser; + + ret = await UpdateAsync(current); + } + + return ret; + } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs new file mode 100644 index 0000000..8bf1b0e --- /dev/null +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs @@ -0,0 +1,51 @@ +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Win_in.Sfs.Scp.v1.Domain; + +namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore +{ + public class TbReceiptDetailRepository : EfCoreRepository, ITbReceiptDetailRepository + { + public TbReceiptDetailRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + { + } + + public async Task UpsertAsync(TB_RECEIVE_DETAIL_QAD tbReceiptDetail) + { + TB_RECEIVE_DETAIL_QAD ret; + var dbSet = await GetDbSetAsync(); + var current = await dbSet.FirstOrDefaultAsync(p => p.Site == tbReceiptDetail.Site + && p.ErpRecvBillNum == tbReceiptDetail.ErpRecvBillNum + && p.PartCode == tbReceiptDetail.PartCode); + if (current == null) + { + ret = await InsertAsync(tbReceiptDetail); + } + else + { + + //使用直接赋值 + current.PoBillNum = tbReceiptDetail.PoBillNum; + current.PoLine = tbReceiptDetail.PoLine; + current.Batch = tbReceiptDetail.Batch; + current.Remark = tbReceiptDetail.Remark; + current.State = tbReceiptDetail.State; + current.BillType = tbReceiptDetail.BillType; + current.Qty = tbReceiptDetail.Qty; + current.DockCode = tbReceiptDetail.DockCode; + current.Remark = tbReceiptDetail.Remark; + current.BillType = tbReceiptDetail.BillType; + current.VendBatch = tbReceiptDetail.VendBatch; + current.PoUnit = tbReceiptDetail.PoUnit; + current.LocUnit = tbReceiptDetail.LocUnit; + current.Rate = tbReceiptDetail.Rate; + + ret = await UpdateAsync(current); + } + + return ret; + } + } +} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs index 50518ab..7840747 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Win_in.Sfs.Scp.v1.Domain; @@ -9,5 +11,33 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore public TbReceiptRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } + + public async Task UpsertAsync(TB_RECEIVE_QAD tbReceipt) + { + TB_RECEIVE_QAD ret; + var dbSet = await GetDbSetAsync(); + var current = await dbSet.FirstOrDefaultAsync(p => p.Site == tbReceipt.Site + && p.ErpRecvBillNum == tbReceipt.ErpRecvBillNum); + if (current == null) + { + ret = await InsertAsync(tbReceipt); + } + else + { + + //使用直接赋值 + current.VendId = tbReceipt.VendId; + current.PoBillNum = tbReceipt.PoBillNum; + current.AsnBillNum = tbReceipt.AsnBillNum; + current.VendId = tbReceipt.VendId; + current.Remark = tbReceipt.Remark; + current.State = tbReceipt.State; + current.BillType = tbReceipt.BillType; + + ret = await UpdateAsync(current); + } + + return ret; + } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbRejectRepository.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbRejectRepository.cs deleted file mode 100644 index 36e78f9..0000000 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbRejectRepository.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; -using Win_in.Sfs.Scp.v1.Domain; - -namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore -{ - public class TbRejectRepository : EfCoreRepository, ITbRejectRepository - { - public TbRejectRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) - { - } - } -} \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/V1ScpEntityFrameworkCoreModule.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/V1ScpEntityFrameworkCoreModule.cs index 1e66bcf..3468e0c 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/V1ScpEntityFrameworkCoreModule.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/V1ScpEntityFrameworkCoreModule.cs @@ -26,8 +26,9 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); options.AddRepository(); - options.AddRepository(); + options.AddRepository(); // Configure(o => // { diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs index e7413f6..b1fc753 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.Domain.Services; using Volo.Abp.EventBus; using Volo.Abp.ObjectMapping; using Win_in.Sfs.Scp.v1.Domain; @@ -10,8 +11,8 @@ using Win_in.Sfs.Scp.v1.Domain; namespace Win_in.Sfs.Scp.WebApi { public class PartEventHandler - : ILocalEventHandler>, - ITransientDependency + : ILocalEventHandler> + , ITransientDependency { private readonly ITaPartRepository _taPartRepository; private readonly IObjectMapper _objectMapper; @@ -26,12 +27,10 @@ namespace Win_in.Sfs.Scp.WebApi public async Task HandleEventAsync(EntityCreatedEventData eventData) { var part = eventData.Entity; - Console.WriteLine("Local Event:" + part.Code); - //使用AutoMapper执行类型转换 var taPart = _objectMapper.Map(part); - //根据传入数据新增或修改TA_PART - var ret = await _taPartRepository.UpsertAsync(taPart); + //根据传入数据新增或修改SCP数据 + await _taPartRepository.UpsertAsync(taPart); } diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/PurchaseOrderEventHandler.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/PurchaseOrderEventHandler.cs index a922230..09b3035 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/PurchaseOrderEventHandler.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/PurchaseOrderEventHandler.cs @@ -3,19 +3,45 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events; using Volo.Abp.EventBus; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Scp.v1.Domain; namespace Win_in.Sfs.Scp.WebApi { public class PurchaseOrderEventHandler:ILocalEventHandler>,ITransientDependency { - public Task HandleEventAsync(EntityCreatedEventData eventData) + private readonly ITbPoRepository _tbPoRepository; + private readonly ITbPoDetailRepository _tbPoDetailRepository; + private readonly IObjectMapper _objectMapper; + + public PurchaseOrderEventHandler( + ITbPoRepository tbPoRepository, + ITbPoDetailRepository tbPoDetailRepository, + IObjectMapper objectMapper) { - Console.WriteLine("Local Event:" + eventData.Entity.Id); + _tbPoRepository = tbPoRepository; + _tbPoDetailRepository = tbPoDetailRepository; + _objectMapper = objectMapper; + } + + public async Task HandleEventAsync(EntityCreatedEventData eventData) + { + var po = eventData.Entity; + //使用AutoMapper执行类型转换 + var tbPo = _objectMapper.Map(po); + //根据传入数据新增或修改SCP数据 + await _tbPoRepository.UpsertAsync(tbPo); + + var poDetails = po.Details; + foreach (var poDetail in poDetails) + { + //使用AutoMapper执行类型转换 + var tbPoDetail = _objectMapper.Map(poDetail); + //根据传入数据新增或修改SCP数据 + await _tbPoDetailRepository.UpsertAsync(tbPoDetail); + } - return Task.CompletedTask; - - //TODO 新增或修改TB_PO,TB_PO_DETAIL } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/ReceiptEventHandler.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/ReceiptEventHandler.cs index 385edd3..16c4b8e 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/ReceiptEventHandler.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/ReceiptEventHandler.cs @@ -3,20 +3,40 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events; using Volo.Abp.EventBus; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Scp.v1.Domain; namespace Win_in.Sfs.Scp.WebApi { - public class ReceiptEventHandler:ILocalEventHandler>, ITransientDependency + public class ReceiptEventHandler : ILocalEventHandler>, ITransientDependency { - public Task HandleEventAsync(EntityCreatedEventData eventData) - { - Console.WriteLine("Local Event:" + eventData.Entity.Id); + private readonly ITbReceiptRepository _tbReceiptRepository; + private readonly ITbReceiptDetailRepository _tbReceiptDetailRepository; + private readonly IObjectMapper _objectMapper; + public ReceiptEventHandler( + ITbReceiptRepository tbReceiptRepository, + ITbReceiptDetailRepository tbReceiptDetailRepository, + IObjectMapper objectMapper) + { + _tbReceiptRepository = tbReceiptRepository; + _tbReceiptDetailRepository = tbReceiptDetailRepository; + _objectMapper = objectMapper; + } - return Task.CompletedTask; + public async Task HandleEventAsync(EntityCreatedEventData eventData) + { + var receipt = eventData.Entity; + //使用AutoMapper执行类型转换 + var tbReceipt = _objectMapper.Map(receipt); + //根据传入数据新增或修改SCP数据 + await _tbReceiptRepository.UpsertAsync(tbReceipt); - //TODO 根据单据类型,新增 TB_RECEIPT 或 TB_REJECT + //使用AutoMapper执行类型转换 + var tbReceiveDetail = _objectMapper.Map(receipt); + //根据传入数据新增或修改SCP数据 + await _tbReceiptDetailRepository.UpsertAsync(tbReceiveDetail); } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/SupplierEventHandler.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/SupplierEventHandler.cs index 8c07c7e..00760ef 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/SupplierEventHandler.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/SupplierEventHandler.cs @@ -3,19 +3,31 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events; using Volo.Abp.EventBus; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Scp.v1.Domain; namespace Win_in.Sfs.Scp.WebApi { public class SupplierEventHandler:ILocalEventHandler>, ITransientDependency { - public Task HandleEventAsync(EntityCreatedEventData eventData) - { - Console.WriteLine("Local Event:" + eventData.Entity.Id); + private readonly ITaVenderRepository _taVenderRepository; + private readonly IObjectMapper _objectMapper; + public SupplierEventHandler(ITaVenderRepository taVenderRepository, + IObjectMapper objectMapper) + { + _taVenderRepository = taVenderRepository; + _objectMapper = objectMapper; + } - return Task.CompletedTask; + public async Task HandleEventAsync(EntityCreatedEventData eventData) + { + var supplier = eventData.Entity; + //使用AutoMapper执行类型转换 + var taVender = _objectMapper.Map(supplier); + //根据传入数据新增或修改SCP数据 + await _taVenderRepository.UpsertAsync(taVender); - //TODO 新增或修改TA_VENDER } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/UnplannedReceiptEventHandler.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/UnplannedReceiptEventHandler.cs index e76fdb4..f873363 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/UnplannedReceiptEventHandler.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/UnplannedReceiptEventHandler.cs @@ -3,20 +3,40 @@ using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events; using Volo.Abp.EventBus; +using Volo.Abp.ObjectMapping; +using Win_in.Sfs.Scp.v1.Domain; namespace Win_in.Sfs.Scp.WebApi { public class UnplannedReceiptEventHandler:ILocalEventHandler>, ITransientDependency { - public Task HandleEventAsync(EntityCreatedEventData eventData) - { - Console.WriteLine("Local Event:" + eventData.Entity.Id); + private readonly ITbReceiptRepository _tbReceiptRepository; + private readonly ITbReceiptDetailRepository _tbReceiptDetailRepository; + private readonly IObjectMapper _objectMapper; + public UnplannedReceiptEventHandler( + ITbReceiptRepository tbReceiptRepository, + ITbReceiptDetailRepository tbReceiptDetailRepository, + IObjectMapper objectMapper) + { + _tbReceiptRepository = tbReceiptRepository; + _tbReceiptDetailRepository = tbReceiptDetailRepository; + _objectMapper = objectMapper; + } - return Task.CompletedTask; + public async Task HandleEventAsync(EntityCreatedEventData eventData) + { + var unplannedReceipt = eventData.Entity; + //使用AutoMapper执行类型转换 + var tbReceipt = _objectMapper.Map(unplannedReceipt); + //根据传入数据新增或修改SCP数据 + await _tbReceiptRepository.UpsertAsync(tbReceipt); - //TODO 新增或修改无订单的TB_RECEIPT + //使用AutoMapper执行类型转换 + var tbReceiveDetail = _objectMapper.Map(unplannedReceipt); + //根据传入数据新增或修改SCP数据 + await _tbReceiptDetailRepository.UpsertAsync(tbReceiveDetail); } } } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs index 9de44db..a5262a1 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs @@ -1,4 +1,6 @@ -using AutoMapper; +using System; +using AutoMapper; +using Volo.Abp.AutoMapper; using Win_in.Sfs.Scp.v1.Domain; namespace Win_in.Sfs.Scp.WebApi @@ -15,7 +17,6 @@ namespace Win_in.Sfs.Scp.WebApi CreateMapSupplier(); CreateMapReceipt(); CreateMapPurchaseOrder(); - CreateMapPurchaseOrderDetail(); CreateMapUnplannedReceipt(); } @@ -25,7 +26,25 @@ namespace Win_in.Sfs.Scp.WebApi private void CreateMapPart() { - CreateMap(); + CreateMap() + .Ignore(p => p.Id) + .ForMember(p => p.Site, p => p.MapFrom(q => q.Site)) + .ForMember(p => p.PartCode, p => p.MapFrom(q => q.Code)) + .ForMember(p => p.ErpPartCode, p => p.MapFrom(q => q.Code)) + .ForMember(p => p.PartDesc1, p => p.MapFrom(q => q.Desc1)) + .ForMember(p => p.PartDesc2, p => p.MapFrom(q => q.Desc2)) + .ForMember(p => p.ProjectId, p => p.MapFrom(q => q.ProductLine)) + .ForMember(p => p.Unit, p => p.MapFrom(q => q.Uom)) + .ForMember(p => p.PartGroup, p => p.MapFrom(q => q.Group)) + .ForMember(p => p.State, p => p.MapFrom(q => q.Status)) + .ForMember(p => p.Configuration, p => p.MapFrom(q => q.Type))//TODO + // .ForMember(p => p.ValidityDays, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.ReceivePort, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.PalletSize, p => p.MapFrom(q => ""))//默认值 + .ForMember(p => p.Remark, p => p.MapFrom(q => q.Version)) + // .ForMember(p => p.Qlevel, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Ischeck, p => p.MapFrom(q => false))//默认值 + ; } /// @@ -34,7 +53,28 @@ namespace Win_in.Sfs.Scp.WebApi private void CreateMapSupplier() { - CreateMap(); + CreateMap() + .Ignore(p => p.Id) + .ForMember(p => p.Site, p => p.MapFrom(q => q.Company))//TODO 接口没有传入Site + .ForMember(p => p.VendId, p => p.MapFrom(q => q.Code)) + .ForMember(p => p.VendName, p => p.MapFrom(q => q.Desc)) + .ForMember(p => p.VendAbbCode, p => p.MapFrom(q => q.Name)) + .ForMember(p => p.VendType, p => p.MapFrom(q => ""))//TODO 默认值应该是什么? + .ForMember(p => p.Country, p => p.MapFrom(q => q.Country)) + .ForMember(p => p.City, p => p.MapFrom(q => q.City)) + .ForMember(p => p.Currency, p => p.MapFrom(q => q.Currency)) + .ForMember(p => p.Address, p => p.MapFrom(q => q.Address)) + .ForMember(p => p.ZipCode, p => p.MapFrom(q => q.PostId)) + .ForMember(p => p.Contacter, p => p.MapFrom(q => q.ContactName)) + .ForMember(p => p.Phone, p => p.MapFrom(q => q.Phone)) + .ForMember(p => p.Fax, p => p.MapFrom(q => q.Fax)) + // .ForMember(p => p.Email, p => p.MapFrom(q => ""))//TODO 接口没有传入Email + .ForMember(p => p.State, p => p.MapFrom(q => q.IsActive ? 1 : 0))//TODO State 值应该是什么 + .ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark)) + // .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.ReceiveTimeScope, p => p.MapFrom(q =>0))//默认值 + // .ForMember(p => p.Quota, p => p.MapFrom(q =>0))//默认值 + ; } @@ -44,10 +84,57 @@ namespace Win_in.Sfs.Scp.WebApi private void CreateMapReceipt() { - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); + CreateMap() + .Ignore(p => p.Id) + .ForMember(p => p.Site, p => p.MapFrom(q => q.Site)) + .ForMember(p => p.ErpRecvBillNum, p => p.MapFrom(q => q.RcNumber)) + .ForMember(p => p.RecvBillNum, p => p.MapFrom(q => q.RcNumber)) + .ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber)) + .ForMember(p => p.AsnBillNum, p => p.MapFrom(q => q.AsnNumber)) + .ForMember(p => p.VendId, p => p.MapFrom(q => q.SupplierCode)) + // .ForMember(p => p.ShipTime, p => p.MapFrom(q => DateTime.MinValue))//默认值 + .ForMember(p => p.State, p => p.MapFrom(q => 1))//默认值 + .ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark)) + .ForMember(p => p.CreateTime, p => p.MapFrom(q => q.ReceiveTime)) + .ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO + // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 + .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 + // .ForMember(p => p.OperName, p => p.MapFrom(q => ""))//默认值 + .ForMember(p => p.BillType, p => p.MapFrom(q => q.RcType == "" ? 1 : 0))//TODO SCP的BllType含义 + // .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 + ; + + CreateMap() + .Ignore(p => p.Id) + .ForMember(p => p.Site, p => p.MapFrom(q => q.Site)) + .ForMember(p => p.ErpRecvBillNum, p => p.MapFrom(q => q.RcNumber)) + .ForMember(p => p.RecvBillNum, p => p.MapFrom(q => q.RcNumber)) + .ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber)) + .ForMember(p => p.PoLine, p => p.MapFrom(q => q.PoLine)) + .ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode)) + .ForMember(p => p.Batch, p => p.MapFrom(q => q.Lot)) + .ForMember(p => p.Qty, p => p.MapFrom(q => q.ReceiveQty)) + .ForMember(p => p.DockCode, p => p.MapFrom(q => q.Dock)) + .ForMember(p => p.State, p => p.MapFrom(q => 1))//默认值 + .ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark)) + .ForMember(p => p.CreateTime, p => p.MapFrom(q => q.ReceiveTime)) + .ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO + // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 + .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 + .ForMember(p => p.BillType, p => p.MapFrom(q => q.RcType == "" ? 1 : 0))//TODO SCP的BllType含义 + .ForMember(p => p.VendBatch, p => p.MapFrom(q => q.SupplierLot)) + .ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom)) + .ForMember(p => p.LocUnit, p => p.MapFrom(q => q.Uom)) + // .ForMember(p => p.PurCost, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.StdCost, p => p.MapFrom(q => 0))//默认值 + .ForMember(p => p.Rate, p => p.MapFrom(q => q.SupplierPackConvertRate)) + // .ForMember(p => p.CurAmt, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.Extend1, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Extend2, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Extend3, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.SubSite, p => p.MapFrom(q => ""))//默认值 + ; } @@ -57,23 +144,126 @@ namespace Win_in.Sfs.Scp.WebApi private void CreateMapPurchaseOrder() { - CreateMap(); - } + CreateMap() + .Ignore(p => p.Id) + .ForMember(p => p.Site, p => p.MapFrom(q => q.Site)) + .ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber)) + .ForMember(p => p.ErpBillNum, p => p.MapFrom(q => q.PoNumber)) + .ForMember(p => p.VendId, p => p.MapFrom(q => q.SupplierCode)) + .ForMember(p => p.ModType, p => p.MapFrom(q => int.Parse(q.PoType))) + .ForMember(p => p.Contacter, p => p.MapFrom(q => q.ContactName))//TODO Contacter 和 Buyer 如何赋值 + .ForMember(p => p.Buyer, p => p.MapFrom(q => q.ContactName)) + .ForMember(p => p.BuyerPhone, p => p.MapFrom(q => q.ContactPhone)) + .ForMember(p => p.State, p => p.MapFrom(q => q.Status)) + .ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark)) + // .ForMember(p => p.BeginTime, p => p.MapFrom(q => new DateTime()))//默认值 + // .ForMember(p => p.EndTime, p => p.MapFrom(q => new DateTime()))//默认值 + // .ForMember(p => p.Extend1, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Extend2, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Extend3, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.SubSite, p => p.MapFrom(q => ""))//默认值 + .ForMember(p => p.CreateTime, p => p.MapFrom(q => q.CreationTime)) + .ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO + .ForMember(p => p.UpdateTime, p => p.MapFrom(q => DateTime.Now)) + .ForMember(p => p.UpdateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO + // .ForMember(p => p.UpdateInfo, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 + .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 - /// - /// 采购订单明细表映射 - /// - private void CreateMapPurchaseOrderDetail() - { - CreateMap(); + ; + + CreateMap() + .Ignore(p => p.Id) + .ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber)) + .ForMember(p => p.PoLine, p => p.MapFrom(q => int.Parse(q.PoLine))) + .ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode)) + // .ForMember(p => p.ShippedQty, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.ReceivedQty, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.RejectQty, p => p.MapFrom(q => 0))//默认值 + .ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom)) + .ForMember(p => p.LocUnit, p => p.MapFrom(q => q.StdPackUom)) + // .ForMember(p => p.Price, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.Currency, p => p.MapFrom(q => "CNY"))//默认值 + .ForMember(p => p.PlanQty, p => p.MapFrom(q => q.OrderQty)) + .ForMember(p => p.PackQty, p => p.MapFrom(q => q.StdPackQty)) + // .ForMember(p => p.TempQty, p => p.MapFrom(q => 0))//默认值 + .ForMember(p => p.State, p => p.MapFrom(q => q.LineStatus)) + .ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark)) + .ForMember(p => p.UnConv, p => p.MapFrom(q => q.SupplierPackConvertRate)) + // .ForMember(p => p.DockCode, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.BeginTime, p => p.MapFrom(q => DateTime.Now))//默认值 + // .ForMember(p => p.EndTime, p => p.MapFrom(q => DateTime.Now))//默认值 + // .ForMember(p => p.Extend1, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Extend2, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Extend3, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.SubSite, p => p.MapFrom(q => ""))//默认值 + .ForMember(p => p.CreateTime, p => p.MapFrom(q => q.CreationTime)) + .ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO + .ForMember(p => p.UpdateTime, p => p.MapFrom(q => DateTime.Now)) + .ForMember(p => p.UpdateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO + // .ForMember(p => p.UpdateInfo, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 + .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 + + + ; + } private void CreateMapUnplannedReceipt() { - CreateMap(); + CreateMap() + .Ignore(p => p.Id) + .ForMember(p => p.Site, p => p.MapFrom(q => q.Site)) + .ForMember(p => p.ErpRecvBillNum, p => p.MapFrom(q => q.TrNbr)) + .ForMember(p => p.RecvBillNum, p => p.MapFrom(q => q.TrNbr)) + .ForMember(p => p.PoBillNum, p => p.MapFrom(q => "")) + .ForMember(p => p.AsnBillNum, p => p.MapFrom(q => q.Order)) + // .ForMember(p => p.VendId, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.ShipTime, p => p.MapFrom(q => DateTime.MinValue))//默认值 + .ForMember(p => p.State, p => p.MapFrom(q => 1))//TODO + .ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark)) + .ForMember(p => p.CreateTime, p => p.MapFrom(q => q.EffectiveDate)) + .ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO + // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 + .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 + // .ForMember(p => p.OperName, p => p.MapFrom(q => ""))//默认值 + .ForMember(p => p.BillType, p => p.MapFrom(q => q.TrType == "" ? 1 : 0))//TODO SCP的BllType含义 + // .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 + ; - CreateMap(); + CreateMap() + .Ignore(p => p.Id) + .ForMember(p => p.Site, p => p.MapFrom(q => q.Site)) + .ForMember(p => p.ErpRecvBillNum, p => p.MapFrom(q => q.TrNbr)) + .ForMember(p => p.RecvBillNum, p => p.MapFrom(q => q.TrNbr)) + .ForMember(p => p.PoBillNum, p => p.MapFrom(q => "")) + .ForMember(p => p.PoLine, p => p.MapFrom(q => 0)) + .ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode)) + .ForMember(p => p.Batch, p => p.MapFrom(q => q.Lot)) + .ForMember(p => p.Qty, p => p.MapFrom(q => q.Qty)) + .ForMember(p => p.DockCode, p => p.MapFrom(q => q.Location)) + .ForMember(p => p.State, p => p.MapFrom(q => 1))//默认值 + .ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark)) + .ForMember(p => p.CreateTime, p => p.MapFrom(q => q.EffectiveDate)) + .ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO + // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 + .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 + .ForMember(p => p.BillType, p => p.MapFrom(q => q.TrType == "" ? 1 : 0))//TODO SCP的BllType含义 + // .ForMember(p => p.VendBatch, p => p.MapFrom(q => ""))//默认值 + .ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom)) + .ForMember(p => p.LocUnit, p => p.MapFrom(q => q.Uom))//TODO 计划外入库单没有LocUnit + // .ForMember(p => p.PurCost, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.StdCost, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.Rate, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.CurAmt, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 + // .ForMember(p => p.Extend1, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Extend2, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.Extend3, p => p.MapFrom(q => ""))//默认值 + // .ForMember(p => p.SubSite, p => p.MapFrom(q => ""))//默认值 + ; } } }