Browse Source

[fix]忽略多租户过滤

master
贾荣国 2 years ago
parent
commit
3e1ffddd0e
  1. 12
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs
  2. 14
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  3. 14
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs
  4. 51
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs
  5. 11
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs
  6. 14
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs
  7. 3
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs
  8. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaVenderRepository.cs

12
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs

@ -16,6 +16,7 @@ using Volo.Abp.Uow;
using Win_in.Sfs.Scp.v1.Domain;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Clients;
using Volo.Abp.Data;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Validation;
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;
@ -36,18 +37,21 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly ITaPartRepository _taPartRepository;
private readonly ITenantStore _tenantStore;
private readonly ITenantRepository _tenantRepository;
private readonly IDataFilter _dataFilter;
public PartAppService(
IPartRepository repository
, ITaPartRepository taPartRepository
, ITenantStore tenantStore
, ITenantRepository tenantRepository
, IDataFilter dataFilter
) : base(repository)
{
_partRepository = repository;
_taPartRepository = taPartRepository;
_tenantStore = tenantStore;
_tenantRepository = tenantRepository;
_dataFilter = dataFilter;
}
/// <summary>
@ -96,8 +100,12 @@ namespace Win_in.Sfs.Scp.WebApi
var tenant = await _tenantStore.FindAsync(entity.Site);
using (CurrentTenant.Change(tenant.Id, tenant.Name))
{
await UpsertTaPartAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
using (_dataFilter.Disable<IMultiTenant>())
{
await UpsertTaPartAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
}
}
}
catch (Exception ex)

14
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs

@ -12,6 +12,7 @@ using Volo.Abp.TenantManagement;
using Volo.Abp.Validation;
using Win_in.Sfs.Scp.v1.Domain;
using System.Security.Policy;
using Volo.Abp.Data;
namespace Win_in.Sfs.Scp.WebApi
{
@ -29,6 +30,7 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly ITaVenderRepository _taVenderRepository;
private readonly ITenantStore _tenantStore;
private readonly ITenantRepository _tenantRepository;
private readonly IDataFilter _dataFilter;
public PurchaseOrderAppService(
IPurchaseOrderRepository repository
@ -37,6 +39,7 @@ namespace Win_in.Sfs.Scp.WebApi
, ITaVenderRepository taVenderRepository
, ITenantStore tenantStore
, ITenantRepository tenantRepository
, IDataFilter dataFilter
) : base(repository)
{
_purchaseOrderRepository = repository;
@ -45,6 +48,7 @@ namespace Win_in.Sfs.Scp.WebApi
_taVenderRepository = taVenderRepository;
_tenantStore = tenantStore;
_tenantRepository = tenantRepository;
_dataFilter = dataFilter;
}
@ -104,11 +108,15 @@ namespace Win_in.Sfs.Scp.WebApi
var tenant = await _tenantStore.FindAsync(entity.Site);
using (CurrentTenant.Change(tenant.Id, tenant.Name))
{
Validator.CheckSupplierCode(_taVenderRepository, entity.Site, entity.SupplierCode);
using (_dataFilter.Disable<IMultiTenant>())
{
Validator.CheckSupplierCode(_taVenderRepository, entity.Site, entity.SupplierCode);
await UpsertTbPoAndTbPoDetailAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
await UpsertTbPoAndTbPoDetailAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
}
}
}
catch (Exception ex)

14
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Data;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Uow;
using Volo.Abp.Validation;
@ -29,6 +30,7 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly ITaVenderRepository _taVenderRepository;
private readonly ITenantStore _tenantStore;
private readonly ITenantRepository _tenantRepository;
private readonly IDataFilter _dataFilter;
public ReceiptAppService(
IReceiptRepository repository
@ -37,6 +39,7 @@ namespace Win_in.Sfs.Scp.WebApi
, ITaVenderRepository taVenderRepository
, ITenantStore tenantStore
, ITenantRepository tenantRepository
, IDataFilter dataFilter
) : base(repository)
{
_receiptRepository = repository;
@ -45,6 +48,7 @@ namespace Win_in.Sfs.Scp.WebApi
_taVenderRepository = taVenderRepository;
_tenantStore = tenantStore;
_tenantRepository = tenantRepository;
_dataFilter = dataFilter;
}
@ -95,10 +99,14 @@ namespace Win_in.Sfs.Scp.WebApi
var tenant = await _tenantStore.FindAsync(entity.Site);
using (CurrentTenant.Change(tenant.Id, tenant.Name))
{
Validator.CheckSupplierCode(_taVenderRepository, entity.Site, entity.SupplierCode);
using (_dataFilter.Disable<IMultiTenant>())
{
await UpsertTbReceiptAndTbReceiptDetailAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
Validator.CheckSupplierCode(_taVenderRepository, entity.Site, entity.SupplierCode);
await UpsertTbReceiptAndTbReceiptDetailAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
}
}
}
catch (Exception ex)

51
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs

@ -31,8 +31,8 @@ namespace Win_in.Sfs.Scp.WebApi
.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 =>string.IsNullOrEmpty(q.Desc2)?"":q.Desc2))
.ForMember(p => p.PartDesc2, p => p.MapFrom(q =>string.IsNullOrEmpty(q.Desc1)?"":q.Desc1))
// .ForMember(p => p.PartDesc1, p => p.MapFrom(q => ""))//中文描述不要覆盖
.ForMember(p => p.PartDesc2, p => p.MapFrom(q => string.IsNullOrEmpty(q.Desc1) ? "" : q.Desc1))
.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))
@ -40,7 +40,7 @@ namespace Win_in.Sfs.Scp.WebApi
.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 => q.Desc2))//默认值
.ForMember(p=>p.Qlevel,p=>p.MapFrom(q=>q.QLevel))
.ForMember(p => p.Qlevel, p => p.MapFrom(q => q.QLevel))
// .ForMember(p => p.PalletSize, p => p.MapFrom(q => ""))//默认值
.ForMember(p => p.Remark, p => p.MapFrom(q => q.Version))
// .ForMember(p => p.Ischeck, p => p.MapFrom(q => false))//默认值
@ -55,16 +55,15 @@ namespace Win_in.Sfs.Scp.WebApi
{
CreateMap<Supplier, TA_VENDER>()
.Ignore(p => p.Id)
.ForMember(p => p.Site, p => p.MapFrom(q => q.Company))//TODO 接口没有传入Site
.ForMember(p => p.Site, p => p.MapFrom(q => q.Company))//接口没有传入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=>"0"))//未使用
.ForMember(p => p.ZipCode, p => p.MapFrom(q => q.Desc)) //英文描述放到ZipCode中
.ForMember(p => p.VendAbbCode, p => p.MapFrom(q => "0"))//未使用
.ForMember(p => p.VendType, p => p.MapFrom(q => ""))//默认值未空
.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))
@ -72,8 +71,8 @@ namespace Win_in.Sfs.Scp.WebApi
.ForMember(p => p.State, p => p.MapFrom(q => q.IsActive ? 1 : 0))//1:有效,2:无效
.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))//默认值
// .ForMember(p => p.ReceiveTimeScope, p => p.MapFrom(q =>0))//默认值
// .ForMember(p => p.Quota, p => p.MapFrom(q =>0))//默认值
;
}
@ -90,7 +89,7 @@ namespace Win_in.Sfs.Scp.WebApi
.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 => string.IsNullOrEmpty(q.AsnNumber)?"":q.AsnNumber))
.ForMember(p => p.AsnBillNum, p => p.MapFrom(q => string.IsNullOrEmpty(q.AsnNumber) ? "" : 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 => 0))//0:未处理
@ -117,7 +116,7 @@ namespace Win_in.Sfs.Scp.WebApi
.ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber))
.ForMember(p => p.PoLine, p => p.MapFrom(q => int.TryParse(q.PoLine, out poLine) ? poLine : 0))
.ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode))
.ForMember(p => p.Batch, p => p.MapFrom(q => string.IsNullOrEmpty(q.Lot)?"":q.Lot))
.ForMember(p => p.Batch, p => p.MapFrom(q => string.IsNullOrEmpty(q.Lot) ? "" : 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 => 0))//0:未处理
@ -128,7 +127,7 @@ namespace Win_in.Sfs.Scp.WebApi
// .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 => string.IsNullOrWhiteSpace(q.RcType) ? 0 : 1))//0:收货 1:退货
.ForMember(p => p.VendBatch, p => p.MapFrom(q => string.IsNullOrEmpty(q.SupplierLot)?"":q.SupplierLot))
.ForMember(p => p.VendBatch, p => p.MapFrom(q => string.IsNullOrEmpty(q.SupplierLot) ? "" : 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))//默认值
@ -136,10 +135,10 @@ namespace Win_in.Sfs.Scp.WebApi
.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 => ""))//默认值
// .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 => ""))//默认值
;
}
@ -164,8 +163,8 @@ namespace Win_in.Sfs.Scp.WebApi
.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 =>q.OrderDate))
.ForMember(p => p.EndTime, p => p.MapFrom(q =>q.DueDate))
.ForMember(p => p.BeginTime, p => p.MapFrom(q => q.OrderDate))
.ForMember(p => p.EndTime, p => p.MapFrom(q => q.DueDate))
// .ForMember(p => p.Extend1, p => p.MapFrom(q => ""))//默认值
// .ForMember(p => p.Extend2, p => p.MapFrom(q => ""))//默认值
// .ForMember(p => p.Extend3, p => p.MapFrom(q => ""))//默认值
@ -231,7 +230,7 @@ namespace Win_in.Sfs.Scp.WebApi
.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 => q.Address))//默认值
// .ForMember(p => p.ShipTime, p => p.MapFrom(q => DateTime.MinValue))//默认值
// .ForMember(p => p.ShipTime, p => p.MapFrom(q => DateTime.MinValue))//默认值
.ForMember(p => p.State, p => p.MapFrom(q => 0))//0:未处理
.ForMember(p => p.Remark, p => p.MapFrom(q => q.Remark))
.ForMember(p => p.CreateTime, p => p.MapFrom(q => q.EffectiveDate))
@ -243,7 +242,7 @@ namespace Win_in.Sfs.Scp.WebApi
// .ForMember(p => p.OperName, p => p.MapFrom(q => ""))//默认值
//.ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.TrType) ? 0 : 1))//0:收货 1:退货
.ForMember(p => p.BillType, p => p.MapFrom(q=>0))
.ForMember(p => p.BillType, p => p.MapFrom(q => 0))
// .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值
;
@ -275,13 +274,13 @@ namespace Win_in.Sfs.Scp.WebApi
.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.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 => ""))//默认值
// .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 => ""))//默认值
;
}
}

11
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs

@ -13,6 +13,7 @@ using Volo.Abp.TenantManagement;
using Volo.Abp.Uow;
using Volo.Abp.Validation;
using Win_in.Sfs.Scp.v1.Domain;
using Volo.Abp.Data;
namespace Win_in.Sfs.Scp.WebApi
@ -29,18 +30,21 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly ITaVenderRepository _taVenderRepository;
private readonly ITenantStore _tenantStore;
private readonly ITenantRepository _tenantRepository;
private readonly IDataFilter _dataFilter;
public SuppliersAppService(
ISupplierRepository repository
, ITaVenderRepository taVenderRepository
, ITenantStore tenantStore
, ITenantRepository tenantRepository
, IDataFilter dataFilter
) : base(repository)
{
_supplierRepository = repository;
_taVenderRepository = taVenderRepository;
_tenantStore = tenantStore;
_tenantRepository = tenantRepository;
_dataFilter = dataFilter;
}
@ -89,8 +93,11 @@ namespace Win_in.Sfs.Scp.WebApi
var tenant = await _tenantStore.FindAsync(entity.Company);
using (CurrentTenant.Change(tenant.Id, tenant.Name))
{
await UpsertTaVenderAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
using (_dataFilter.Disable<IMultiTenant>())
{
await UpsertTaVenderAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
}
}
}
catch (Exception ex)

14
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs

@ -8,6 +8,7 @@ using FluentValidation;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Data;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Uow;
using Volo.Abp.Validation;
@ -31,6 +32,7 @@ namespace Win_in.Sfs.Scp.WebApi
private readonly ITaVenderRepository _taVenderRepository;
private readonly ITenantStore _tenantStore;
private readonly ITenantRepository _tenantRepository;
private readonly IDataFilter _dataFilter;
public UnplannedReceiptAppService(
IUnplannedReceiptRepository repository
@ -39,6 +41,7 @@ namespace Win_in.Sfs.Scp.WebApi
, ITaVenderRepository taVenderRepository
, ITenantStore tenantStore
, ITenantRepository tenantRepository
, IDataFilter dataFilter
) : base(repository)
{
_unplannedReceiptRepository = repository;
@ -47,6 +50,7 @@ namespace Win_in.Sfs.Scp.WebApi
_taVenderRepository = taVenderRepository;
_tenantStore = tenantStore;
_tenantRepository = tenantRepository;
_dataFilter = dataFilter;
}
@ -97,10 +101,14 @@ namespace Win_in.Sfs.Scp.WebApi
var tenant = await _tenantStore.FindAsync(entity.Site);
using (CurrentTenant.Change(tenant.Id, tenant.Name))
{
Validator.CheckSupplierCode(_taVenderRepository, entity.Site, entity.Address);
using (_dataFilter.Disable<IMultiTenant>())
{
await UpsertTbReceiptAndTbReceiptDetailAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
Validator.CheckSupplierCode(_taVenderRepository, entity.Site, entity.Address);
await UpsertTbReceiptAndTbReceiptDetailAsync(entity, tenant.Id);
await CurrentUnitOfWork.SaveChangesAsync();
}
}
}
catch (Exception ex)

3
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs

@ -28,13 +28,14 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
{
//使用直接赋值
current.PartDesc1 = taPart.PartDesc1;
// 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.Qlevel = taPart.Qlevel;
current.Remark = taPart.Remark;
ret = await UpdateAsync(current);

2
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaVenderRepository.cs

@ -29,7 +29,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
{
//使用直接赋值
current.VendName = taVender.VendName;
// current.VendName = taVender.VendName;//不要覆盖中文名称
current.VendAbbCode = taVender.VendAbbCode;
current.Country = taVender.Country;
current.City = taVender.City;

Loading…
Cancel
Save