diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/IPartAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/IPartAppService.cs index f8c228b..33c3696 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/IPartAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/IPartAppService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Validation; namespace Win_in.Sfs.Scp.WebApi { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/IPurchaseOrderAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/IPurchaseOrderAppService.cs index 5477016..8a43d9f 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/IPurchaseOrderAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/IPurchaseOrderAppService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Validation; namespace Win_in.Sfs.Scp.WebApi { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/IReceiptAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/IReceiptAppService.cs index f599b4d..3eeec18 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/IReceiptAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/IReceiptAppService.cs @@ -2,6 +2,7 @@ using System; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Validation; namespace Win_in.Sfs.Scp.WebApi { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/ISupplierAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/ISupplierAppService.cs index fd5d1a3..e2bcea2 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/ISupplierAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/ISupplierAppService.cs @@ -2,6 +2,7 @@ using System; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Validation; namespace Win_in.Sfs.Scp.WebApi { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierCreateDTO.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierCreateDTO.cs index a789424..ef1b238 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierCreateDTO.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Suppliers/SupplierCreateDTO.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Xml.Serialization; using Volo.Abp.Application.Dtos; @@ -130,4 +131,5 @@ public class SupplierCreateDTO : EntityDto,ICanTrace [Display(Name = "跟踪编号")] public Guid TraceId { get; set; } + } \ No newline at end of file diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/IUnplannedReceiptAppService.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/IUnplannedReceiptAppService.cs index f8418ec..a1380c7 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/IUnplannedReceiptAppService.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/UnplannedReceipts/IUnplannedReceiptAppService.cs @@ -2,6 +2,7 @@ using System; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Validation; namespace Win_in.Sfs.Scp.WebApi { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/WebApiApplicationContractsModule.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/WebApiApplicationContractsModule.cs index ec44907..628c457 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/WebApiApplicationContractsModule.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/WebApiApplicationContractsModule.cs @@ -27,5 +27,10 @@ namespace Win_in.Sfs.Scp.WebApi { WebApiDtoExtensions.Configure(); } + + public override void ConfigureServices(ServiceConfigurationContext context) + { + + } } } 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 2e046b4..f3e53c3 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 @@ -73,6 +73,7 @@ namespace Win_in.Sfs.Scp.WebApi try { await UpsertTaPartAsync(entity); + await CurrentUnitOfWork.SaveChangesAsync(); } catch (Exception ex) { @@ -81,6 +82,8 @@ namespace Win_in.Sfs.Scp.WebApi } 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 024cef4..dba6271 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 @@ -65,7 +65,7 @@ namespace Win_in.Sfs.Scp.WebApi /// [HttpPost] [Route("")] - public async Task CreateAsync(PurchaseOrderCreateDTO poCreateDTO) + public virtual async Task CreateAsync(PurchaseOrderCreateDTO poCreateDTO) { var entity = ObjectMapper.Map(poCreateDTO); foreach (var detail in entity.Details) @@ -76,6 +76,8 @@ namespace Win_in.Sfs.Scp.WebApi try { await UpsertTbPoAndTbPoDetailAsync(entity); + await CurrentUnitOfWork.SaveChangesAsync(); + } catch (Exception ex) { 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 32d9748..9d15950 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 @@ -68,13 +68,15 @@ namespace Win_in.Sfs.Scp.WebApi [HttpPost] [Route("")] - public async Task CreateAsync(ReceiptCreateDTO receiptCreateDTO) + public virtual async Task CreateAsync(ReceiptCreateDTO receiptCreateDTO) { var entity = ObjectMapper.Map(receiptCreateDTO); try { await UpsertTbReceiptAndTbReceiptDetailAsync(entity); + await CurrentUnitOfWork.SaveChangesAsync(); + } catch (Exception ex) { 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 e54fa85..9b26f4d 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 @@ -64,13 +64,15 @@ namespace Win_in.Sfs.Scp.WebApi /// 供应商DTO(Supplier DTO) [HttpPost] [Route("")] - public async Task CreateAsync(SupplierCreateDTO supplierCreateDTO) + public virtual async Task CreateAsync(SupplierCreateDTO supplierCreateDTO) { var entity = ObjectMapper.Map(supplierCreateDTO); try { - await UpsertTaVenderAsync(entity); + UpsertTaVenderAsync(entity).Wait(); + await CurrentUnitOfWork.SaveChangesAsync(); + } catch (Exception ex) { 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 c95baf3..4c56743 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 @@ -67,13 +67,15 @@ namespace Win_in.Sfs.Scp.WebApi /// [HttpPost] [Route("")] - public async Task CreateAsync(UnplannedReceiptCreateDTO receiptCreateDTO) + public virtual async Task CreateAsync(UnplannedReceiptCreateDTO receiptCreateDTO) { var entity = ObjectMapper.Map(receiptCreateDTO); try { await UpsertTbReceiptAndTbReceiptDetailAsync(entity); + await CurrentUnitOfWork.SaveChangesAsync(); + } catch (Exception ex) { diff --git a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationModule.cs b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationModule.cs index 3ccd45f..70544e7 100644 --- a/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationModule.cs +++ b/WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationModule.cs @@ -7,7 +7,6 @@ using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; using Volo.Abp.TenantManagement; using Win_in.Sfs.Scp.v1.Domain; -using Win_in.Sfs.Scp.v1.EntityFrameworkCore; namespace Win_in.Sfs.Scp.WebApi 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 0cca128..a22238c 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 System.Threading.Tasks; +using System; +using System.Threading; +using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; @@ -18,6 +20,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore 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); @@ -42,6 +45,8 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore } return ret; + + } } } \ No newline at end of file