Browse Source

[fix]调用方式从本地消息修改未直接调用

master
贾荣国 3 years ago
parent
commit
6b38ba6000
  1. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderCreateDTO.cs
  2. 30
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs
  3. 46
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  4. 35
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs
  5. 99
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs
  6. 26
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs
  7. 35
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs
  8. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationModule.cs
  9. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Win_in.Sfs.Scp.WebApi.Application.csproj
  10. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.DbMigrator/appsettings.json
  11. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EntityBase/EntityBase.cs
  12. 10
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EntityBase/EntityDtoBase.cs
  13. 14
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/IHasErrorMessage.cs
  14. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/IPartRepository.cs
  15. 2875
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126092735_AddErrorCodeAndErrorMessageToPart.Designer.cs
  16. 34
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126092735_AddErrorCodeAndErrorMessageToPart.cs
  17. 2899
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220127010533_AddErrorCodeAndErrorMessageToAll.Designer.cs
  18. 97
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220127010533_AddErrorCodeAndErrorMessageToAll.cs
  19. 30
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs
  20. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/WebApiEntityFrameworkCoreModule.cs
  21. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.csproj
  22. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Program.cs
  23. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs
  24. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.Production.json
  25. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json
  26. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Program.cs
  27. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/TA_VENDER.cs
  28. 12
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs
  29. 3
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs
  30. 5
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoDetailRepository.cs
  31. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs
  32. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/PurchaseOrderEventHandler.cs

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderCreateDTO.cs

@ -114,7 +114,7 @@ public class PurchaseOrderCreateDTO : EntityDto,ICanTrace
public string Company { set; get; }
[XmlArray(elementName: "details")]
[XmlArrayItem(elementName: "PurchaseOrderDetailDTO")]
[XmlArrayItem(elementName: nameof(PurchaseOrderDetailCreateDTO))]
public virtual List<PurchaseOrderDetailCreateDTO> Details { get; set; }

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

@ -8,6 +8,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Win_in.Sfs.Scp.v1.Domain;
namespace Win_in.Sfs.Scp.WebApi
{
@ -21,10 +22,15 @@ namespace Win_in.Sfs.Scp.WebApi
public class PartAppService :ReadOnlyAppService<Part,PartDTO,Guid, RequestDTO>, IPartAppService
{
private readonly IPartRepository _partRepository;
private readonly ITaPartRepository _taPartRepository;
public PartAppService(IPartRepository repository) : base(repository)
public PartAppService(
IPartRepository repository
,ITaPartRepository taPartRepository
) : base(repository)
{
_partRepository = repository;
_taPartRepository = taPartRepository;
}
/// <summary>
@ -63,12 +69,28 @@ namespace Win_in.Sfs.Scp.WebApi
{
var entity = ObjectMapper.Map<PartCreateDto, Part>(partCreateDTO);
var ret= await _partRepository.InsertAsync(entity);
try
{
await UpsertTaPartAsync(entity);
}
catch (Exception ex)
{
entity.ErrorCode = 1;
entity.ErrorMessage = ex.Message;
}
var ret = await _partRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Part, PartDTO>(ret);
return dto;
}
private async Task UpsertTaPartAsync(Part entity)
{
//使用AutoMapper执行类型转换
var taPart = ObjectMapper.Map<Part, TA_PART>(entity);
//根据传入数据新增或修改SCP数据
await _taPartRepository.UpsertAsync(taPart);
}
}
}

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

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Win_in.Sfs.Scp.v1.Domain;
namespace Win_in.Sfs.Scp.WebApi
{
@ -14,13 +15,21 @@ namespace Win_in.Sfs.Scp.WebApi
[Authorize]
[Route(RouteConsts.PurchaseOrder)]
[ApiExplorerSettings(GroupName = SwaggerGroupConsts.ScpWebApi)]
public class PurchaseOrderAppService : ReadOnlyAppService<PurchaseOrder, PurchaseOrderDTO, Guid,RequestDTO>, IPurchaseOrderAppService
public class PurchaseOrderAppService : ReadOnlyAppService<PurchaseOrder, PurchaseOrderDTO, Guid, RequestDTO>, IPurchaseOrderAppService
{
private readonly IPurchaseOrderRepository _purchaseOrderRepository;
private readonly ITbPoRepository _tbPoRepository;
private readonly ITbPoDetailRepository _tbPoDetailRepository;
public PurchaseOrderAppService(IPurchaseOrderRepository repository) : base(repository)
public PurchaseOrderAppService(
IPurchaseOrderRepository repository
, ITbPoRepository tbPoRepository
, ITbPoDetailRepository tbPoDetailRepository
) : base(repository)
{
_purchaseOrderRepository = repository;
_tbPoRepository = tbPoRepository;
_tbPoDetailRepository = tbPoDetailRepository;
}
@ -63,10 +72,41 @@ namespace Win_in.Sfs.Scp.WebApi
{
detail.SetId(GuidGenerator);
}
try
{
await UpsertTbPoAndTbPoDetailAsync(entity);
}
catch (Exception ex)
{
entity.ErrorCode = 1;
entity.ErrorMessage = ex.Message;
}
var ret = await _purchaseOrderRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(ret);
return dto;
}
private async Task UpsertTbPoAndTbPoDetailAsync(PurchaseOrder entity)
{
//使用AutoMapper执行类型转换
var tbPo = ObjectMapper.Map<PurchaseOrder, TB_PO>(entity);
//根据传入数据新增或修改SCP数据
await _tbPoRepository.UpsertAsync(tbPo);
var poDetails = entity.Details;
foreach (var poDetail in poDetails)
{
//使用AutoMapper执行类型转换
var tbPoDetail = ObjectMapper.Map<PurchaseOrderDetail, TB_PO_DETAIL>(poDetail);
//接口数据中没有Site,从主表中获取
tbPoDetail.Site = tbPo.Site;
tbPoDetail.BeginTime = tbPo.BeginTime;
tbPoDetail.EndTime = tbPo.EndTime;
//根据传入数据新增或修改SCP数据
await _tbPoDetailRepository.UpsertAsync(tbPoDetail);
}
}
}
}

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

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win_in.Sfs.Scp.v1.Domain;
namespace Win_in.Sfs.Scp.WebApi
{
@ -18,10 +19,18 @@ namespace Win_in.Sfs.Scp.WebApi
public class ReceiptAppService : ReadOnlyAppService<Receipt, ReceiptDTO, Guid,RequestDTO>, IReceiptAppService
{
private readonly IReceiptRepository _receiptRepository;
private readonly ITbReceiptRepository _tbReceiptRepository;
private readonly ITbReceiptDetailRepository _tbReceiptDetailRepository;
public ReceiptAppService(IReceiptRepository repository) : base(repository)
public ReceiptAppService(
IReceiptRepository repository
,ITbReceiptRepository tbReceiptRepository
,ITbReceiptDetailRepository tbReceiptDetailRepository
) : base(repository)
{
_receiptRepository = repository;
_tbReceiptRepository = tbReceiptRepository;
_tbReceiptDetailRepository = tbReceiptDetailRepository;
}
@ -62,12 +71,32 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task<ReceiptDTO> CreateAsync(ReceiptCreateDTO receiptCreateDTO)
{
var entity = ObjectMapper.Map<ReceiptCreateDTO, Receipt>(receiptCreateDTO);
try
{
await UpsertTbReceiptAndTbReceiptDetailAsync(entity);
}
catch (Exception ex)
{
entity.ErrorCode = 1;
entity.ErrorMessage = ex.Message;
}
var ret = await _receiptRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Receipt, ReceiptDTO>(ret);
return dto;
}
private async Task UpsertTbReceiptAndTbReceiptDetailAsync(Receipt entity)
{
var tbReceipt = ObjectMapper.Map<Receipt, TB_RECEIVE_QAD>(entity);
//根据传入数据新增或修改SCP数据
await _tbReceiptRepository.UpsertAsync(tbReceipt);
//使用AutoMapper执行类型转换
var tbReceiveDetail = ObjectMapper.Map<Receipt, TB_RECEIVE_DETAIL_QAD>(entity);
//根据传入数据新增或修改SCP数据
await _tbReceiptDetailRepository.UpsertAsync(tbReceiveDetail);
}
}
}

99
WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs → WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs

@ -5,9 +5,9 @@ using Win_in.Sfs.Scp.v1.Domain;
namespace Win_in.Sfs.Scp.WebApi
{
public class EventAutoMapperProfile : Profile
public class ScpV1AutoMapperProfile : Profile
{
public EventAutoMapperProfile()
public ScpV1AutoMapperProfile()
{
/* You can configure your AutoMapper mapping configuration here.
* Alternatively, you can split your mapping configurations
@ -38,6 +38,7 @@ namespace Win_in.Sfs.Scp.WebApi
.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 => ""))//默认值
@ -58,8 +59,8 @@ namespace Win_in.Sfs.Scp.WebApi
.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.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))
@ -68,8 +69,8 @@ namespace Win_in.Sfs.Scp.WebApi
.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.Email, p => p.MapFrom(q => ""))//接口没有传入Email
.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))//默认值
@ -96,11 +97,14 @@ namespace Win_in.Sfs.Scp.WebApi
.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.CreateUser, p => p.MapFrom(q => "WebApi"))//固定值
// .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 => string.IsNullOrWhiteSpace(q.RcType) ? 1 : 0))//TODO SCP的BllType含义
.ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 0 : 1))//0:收货 1:退货
// .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值
;
@ -112,7 +116,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.PoLine, p => p.MapFrom(q =>int.TryParse(q.PoLine,out poLine)?poLine:0))
.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 => q.Lot))
.ForMember(p => p.Qty, p => p.MapFrom(q => q.ReceiveQty))
@ -120,10 +124,11 @@ namespace Win_in.Sfs.Scp.WebApi
.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.CreateUser, p => p.MapFrom(q => "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) ? 1 : 0))//TODO SCP的BllType含义
.ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 0 : 1))//0:收货 1:退货
.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))
@ -154,24 +159,25 @@ namespace Win_in.Sfs.Scp.WebApi
.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.TryParse(q.PoType,out poType)?poType:0))
.ForMember(p => p.ModType, p => p.MapFrom(q => int.TryParse(q.PoType, out poType) ? poType : 1))//1:日程订单,2:离散订单
.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.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 => ""))//默认值
// .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.CreateUser, p => p.MapFrom(q => "WebApi"))
.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.UpdateUser, p => p.MapFrom(q => "WebApi"))
// .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()))//默认值
;
@ -196,18 +202,19 @@ namespace Win_in.Sfs.Scp.WebApi
.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.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.CreateUser, p => p.MapFrom(q => "WebApi"))
.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.UpdateUser, p => p.MapFrom(q => "WebApi"))
// .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()))//默认值
@ -229,12 +236,15 @@ namespace Win_in.Sfs.Scp.WebApi
.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.CreateUser, p => p.MapFrom(q => "WebApi"))
// .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 => string.IsNullOrWhiteSpace(q.TrType) ? 1 : 0))//TODO SCP的BllType含义
// .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值
// .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.Tax, p => p.MapFrom(q => 0))//默认值
;
CreateMap<UnplannedReceipt, TB_RECEIVE_DETAIL_QAD>()
@ -251,22 +261,25 @@ namespace Win_in.Sfs.Scp.WebApi
.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.CreateUser, p => p.MapFrom(q => "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.TrType) ? 1 : 0))//TODO SCP的BllType含义
// .ForMember(p => p.VendBatch, p => p.MapFrom(q => ""))//默认值
.ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.TrType) ? 0 : 1))//0:收货 1:退货
// .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 => ""))//默认值
// .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 => ""))//默认值
;
}
}

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

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win_in.Sfs.Scp.v1.Domain;
namespace Win_in.Sfs.Scp.WebApi
@ -19,10 +20,14 @@ namespace Win_in.Sfs.Scp.WebApi
public class SuppliersAppService : ReadOnlyAppService<Supplier, SupplierDTO, Guid,RequestDTO>, ISupplierAppService
{
private readonly ISupplierRepository _supplierRepository;
private readonly ITaVenderRepository _taVenderRepository;
public SuppliersAppService(ISupplierRepository repository) : base(repository)
public SuppliersAppService(
ISupplierRepository repository
,ITaVenderRepository taVenderRepository) : base(repository)
{
_supplierRepository = repository;
_taVenderRepository = taVenderRepository;
}
@ -62,11 +67,28 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task<SupplierDTO> CreateAsync(SupplierCreateDTO supplierCreateDTO)
{
var entity = ObjectMapper.Map<SupplierCreateDTO, Supplier>(supplierCreateDTO);
try
{
await UpsertTaVenderAsync(entity);
}
catch (Exception ex)
{
entity.ErrorCode = 1;
entity.ErrorMessage = ex.Message;
}
var ret = await _supplierRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Supplier, SupplierDTO>(ret);
return dto;
}
private async Task UpsertTaVenderAsync(Supplier entity)
{
//使用AutoMapper执行类型转换
var taVender = ObjectMapper.Map<Supplier, TA_VENDER>(entity);
//根据传入数据新增或修改SCP数据
await _taVenderRepository.UpsertAsync(taVender);
}
}
}

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

@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win_in.Sfs.Scp.v1.Domain;
namespace Win_in.Sfs.Scp.WebApi
{
@ -18,10 +19,18 @@ namespace Win_in.Sfs.Scp.WebApi
public class UnplannedReceiptAppService : ReadOnlyAppService<UnplannedReceipt, UnplannedReceiptDTO, Guid,RequestDTO>, IUnplannedReceiptAppService
{
private readonly IUnplannedReceiptRepository _unplannedReceiptRepository;
private readonly ITbReceiptRepository _tbReceiptRepository;
private readonly ITbReceiptDetailRepository _tbReceiptDetailRepository;
public UnplannedReceiptAppService(IUnplannedReceiptRepository repository) : base(repository)
public UnplannedReceiptAppService(
IUnplannedReceiptRepository repository
, ITbReceiptRepository tbReceiptRepository
, ITbReceiptDetailRepository tbReceiptDetailRepository
) : base(repository)
{
_unplannedReceiptRepository = repository;
_tbReceiptRepository = tbReceiptRepository;
_tbReceiptDetailRepository = tbReceiptDetailRepository;
}
@ -61,11 +70,33 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task<UnplannedReceiptDTO> CreateAsync(UnplannedReceiptCreateDTO receiptCreateDTO)
{
var entity = ObjectMapper.Map<UnplannedReceiptCreateDTO, UnplannedReceipt>(receiptCreateDTO);
try
{
await UpsertTbReceiptAndTbReceiptDetailAsync(entity);
}
catch (Exception ex)
{
entity.ErrorCode = 1;
entity.ErrorMessage = ex.Message;
}
var ret = await _unplannedReceiptRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<UnplannedReceipt, UnplannedReceiptDTO>(ret);
return dto;
}
private async Task UpsertTbReceiptAndTbReceiptDetailAsync(UnplannedReceipt entity)
{
var tbReceipt = ObjectMapper.Map<UnplannedReceipt, TB_RECEIVE_QAD>(entity);
//根据传入数据新增或修改SCP数据
await _tbReceiptRepository.UpsertAsync(tbReceipt);
//使用AutoMapper执行类型转换
var tbReceiveDetail = ObjectMapper.Map<UnplannedReceipt, TB_RECEIVE_DETAIL_QAD>(entity);
//根据传入数据新增或修改SCP数据
await _tbReceiptDetailRepository.UpsertAsync(tbReceiveDetail);
}
}
}

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationModule.cs

@ -6,6 +6,8 @@ using Volo.Abp.Modularity;
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
@ -20,6 +22,9 @@ namespace Win_in.Sfs.Scp.WebApi
typeof(AbpFeatureManagementApplicationModule),
typeof(AbpSettingManagementApplicationModule)
)]
[DependsOn(
typeof(V1ScpDomainModule)
)]
public class WebApiApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Win_in.Sfs.Scp.WebApi.Application.csproj

@ -14,6 +14,8 @@
<ItemGroup>
<ProjectReference Include="..\Win_in.Sfs.Scp.v1.Domain\Win_in.Sfs.Scp.v1.Domain.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Scp.v1.EntityFrameworkCore\Win_in.Sfs.Scp.v1.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Domain\Win_in.Sfs.Scp.WebApi.Domain.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Application.Contracts\Win_in.Sfs.Scp.WebApi.Application.Contracts.csproj" />
</ItemGroup>

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.DbMigrator/appsettings.json

@ -1,7 +1,6 @@
{
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;",
"WebApi": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;"
},
"IdentityServer": {
"Clients": {

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EntityBase/EntityBase.cs

@ -4,9 +4,11 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Win_in.Sfs.Scp.WebApi.Domain.Shared
{
public class EntityBase<TKey> : CreationAuditedAggregateRoot<TKey>,ICanTrace
public class EntityBase<TKey> : CreationAuditedAggregateRoot<TKey>,ICanTrace, IHasErrorMessage
{
public Guid TraceId { get; set; }
public int ErrorCode { get; set; }
public string ErrorMessage { get; set; }
}
public interface ICanTrace

10
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/EntityBase/EntityDtoBase.cs

@ -8,7 +8,7 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace Win_in.Sfs.Scp.WebApi.Domain.Shared
{
[Serializable,DataContract]
public class EntityDtoBase<TKey> :IEntityDto<TKey>, ICanTrace
public class EntityDtoBase<TKey> :IEntityDto<TKey>, ICanTrace, IHasErrorMessage
{
[DataMember]
public TKey Id { get; set; }
@ -19,13 +19,17 @@ namespace Win_in.Sfs.Scp.WebApi.Domain.Shared
[DataMember]
public Guid? CreatorId { get; set; }
/// <summary>
/// 跟踪编号(Trace ID)
/// </summary>
[DataMember]
[Display(Name = "跟踪编号")]
public Guid TraceId { get; set; }
[DataMember]
public int ErrorCode { get; set; }
[DataMember]
public string ErrorMessage { get; set; }
}
}

14
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain.Shared/IHasErrorMessage.cs

@ -0,0 +1,14 @@
namespace Win_in.Sfs.Scp.WebApi;
public interface IHasErrorMessage
{
/// <summary>
/// 错误代码
/// </summary>
int ErrorCode { get; set; }
/// <summary>
/// 错误信息
/// </summary>
string ErrorMessage { get; set; }
}

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/IPartRepository.cs

@ -1,5 +1,7 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
namespace Win_in.Sfs.Scp.WebApi
{
@ -7,4 +9,5 @@ namespace Win_in.Sfs.Scp.WebApi
{
}
}

2875
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126092735_AddErrorCodeAndErrorMessageToPart.Designer.cs

File diff suppressed because it is too large

34
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126092735_AddErrorCodeAndErrorMessageToPart.cs

@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class AddErrorCodeAndErrorMessageToPart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ErrorCode",
table: "WebApi_Part",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "ErrorMessage",
table: "WebApi_Part",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ErrorCode",
table: "WebApi_Part");
migrationBuilder.DropColumn(
name: "ErrorMessage",
table: "WebApi_Part");
}
}
}

2899
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220127010533_AddErrorCodeAndErrorMessageToAll.Designer.cs

File diff suppressed because it is too large

97
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220127010533_AddErrorCodeAndErrorMessageToAll.cs

@ -0,0 +1,97 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class AddErrorCodeAndErrorMessageToAll : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "ErrorCode",
table: "WebApi_UnplannedReceipt",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "ErrorMessage",
table: "WebApi_UnplannedReceipt",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ErrorCode",
table: "WebApi_Suppliers",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "ErrorMessage",
table: "WebApi_Suppliers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ErrorCode",
table: "WebApi_Receipt",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "ErrorMessage",
table: "WebApi_Receipt",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ErrorCode",
table: "WebApi_PO",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "ErrorMessage",
table: "WebApi_PO",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ErrorCode",
table: "WebApi_UnplannedReceipt");
migrationBuilder.DropColumn(
name: "ErrorMessage",
table: "WebApi_UnplannedReceipt");
migrationBuilder.DropColumn(
name: "ErrorCode",
table: "WebApi_Suppliers");
migrationBuilder.DropColumn(
name: "ErrorMessage",
table: "WebApi_Suppliers");
migrationBuilder.DropColumn(
name: "ErrorCode",
table: "WebApi_Receipt");
migrationBuilder.DropColumn(
name: "ErrorMessage",
table: "WebApi_Receipt");
migrationBuilder.DropColumn(
name: "ErrorCode",
table: "WebApi_PO");
migrationBuilder.DropColumn(
name: "ErrorMessage",
table: "WebApi_PO");
}
}
}

30
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs

@ -1974,6 +1974,12 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<int>("ErrorCode")
.HasColumnType("int");
b.Property<string>("ErrorMessage")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -2063,6 +2069,12 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.Property<DateTime>("DueDate")
.HasColumnType("datetime2");
b.Property<int>("ErrorCode")
.HasColumnType("int");
b.Property<string>("ErrorMessage")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -2217,6 +2229,12 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("ErrorCode")
.HasColumnType("int");
b.Property<string>("ErrorMessage")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -2354,6 +2372,12 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<int>("ErrorCode")
.HasColumnType("int");
b.Property<string>("ErrorMessage")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
@ -2421,6 +2445,12 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.Property<DateTime>("EffectiveDate")
.HasColumnType("datetime2");
b.Property<int>("ErrorCode")
.HasColumnType("int");
b.Property<string>("ErrorMessage")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/WebApiEntityFrameworkCoreModule.cs

@ -30,8 +30,7 @@ namespace Win_in.Sfs.Scp.WebApi
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpFeatureManagementEntityFrameworkCoreModule)
)]
[DependsOn(typeof(WebApiEventModule))]
public class WebApiEntityFrameworkCoreModule : AbpModule
public class WebApiEntityFrameworkCoreModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore.csproj

@ -8,7 +8,6 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Win_in.Sfs.Scp.v1.Event\Win_in.Sfs.Scp.WebApi.Event.csproj" />
<ProjectReference Include="..\Win_in.Sfs.Scp.WebApi.Domain\Win_in.Sfs.Scp.WebApi.Domain.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="4.4.2" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="4.4.2" />

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/Program.cs

@ -21,9 +21,7 @@ namespace Win_in.Sfs.Scp.WebApi
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt",rollingInterval:RollingInterval.Day))
#if DEBUG
.WriteTo.Async(c => c.Console())
#endif
.CreateLogger();
try

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/WebApiHttpApiHostModule.cs

@ -34,6 +34,7 @@ using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.VirtualFileSystem;
using Win_in.Sfs.Scp.v1.EntityFrameworkCore;
namespace Win_in.Sfs.Scp.WebApi
{
@ -49,6 +50,8 @@ namespace Win_in.Sfs.Scp.WebApi
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule)
)]
[DependsOn(
typeof(V1ScpEntityFrameworkCoreModule))]
public class WebApiHttpApiHostModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.Production.json

@ -5,8 +5,9 @@
"RedirectAllowedUrls": "https://scp.iacchina.net:9977,https://scp.iacchina.net:9988"
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;",
"V1Scp": "Server=127.0.0.1;Database=Scp_V1;User ID=sa;Password=Microsoft2008;connection timeout=600;"
"Default": "Server=127.0.0.1,13314;Database=Scp_WebApi;User ID=superadmin;Password=Microsoft@2021;connection timeout=600;",
"WebApi": "Server=127.0.0.1,13314;Database=Scp_WebApi;User ID=superadmin;Password=Microsoft@2021;connection timeout=600;",
"V1Scp": "Server=127.0.0.1£º13314;Database=Scp_AC;User ID=sa;Password=Microsoft2008;connection timeout=600;"
},
"AuthServer": {
"Authority": "https://scp.iacchina.net:9988",

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

@ -6,7 +6,8 @@
},
"ConnectionStrings": {
"Default": "Server=127.0.0.1;Database=Scp_WebApi;User ID=sa;Password=Microsoft2008;connection timeout=600;",
"V1Scp": "Server=127.0.0.1;Database=Scp_V1;User ID=sa;Password=Microsoft2008;connection timeout=600;"
//"V1Scp": "Server=127.0.0.1;Database=Scp_V1;User ID=sa;Password=Microsoft2008;connection timeout=600;",
"V1Scp": "Server=121.36.30.37,13317;Database=SCP_JZJH;User ID=sa;Password=Microsoft2008;connection timeout=600;"
},
"AuthServer": {
"Authority": "https://localhost:9988",

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Xml.Host/Program.cs

@ -42,9 +42,7 @@ namespace Win_in.Sfs.Scp.WebApi.XmlHost
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Async(c => c.File("Logs/logs.txt",rollingInterval:RollingInterval.Day))
#if DEBUG
.WriteTo.Async(c => c.Console())
#endif
.CreateLogger();
}

2
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/TA_VENDER.cs

@ -4,7 +4,7 @@ using Volo.Abp.Domain.Entities;
namespace Win_in.Sfs.Scp.v1.Domain
{
public class TA_VENDER:Entity<long>
public class TA_VENDER:Entity<int>
{
public string VendId { get; set; }

12
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs

@ -75,7 +75,7 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
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.VendAbbCode).HasMaxLength(2).IsRequired();
b.Property(q => q.VendType).HasMaxLength(50);
b.Property(q => q.Country).HasMaxLength(50);
b.Property(q => q.City).HasMaxLength(50);
@ -116,8 +116,8 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
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.BeginTime).IsRequired();
b.Property(q => q.EndTime).IsRequired();
b.Property(q => q.Extend1);
b.Property(q => q.Extend2);
b.Property(q => q.Extend3);
@ -148,14 +148,14 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
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.BeginTime).IsRequired();
b.Property(q => q.EndTime).IsRequired();
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.LocUnit).HasMaxLength(50);
b.Property(q => q.Price).HasPrecision(18, 6);
b.Property(q => q.Currency).HasMaxLength(50);
b.Property(q => q.PlanQty).HasPrecision(18, 6);

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

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;

5
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoDetailRepository.cs

@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
@ -16,6 +17,8 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
{
TB_PO_DETAIL ret;
var dbSet = await GetDbSetAsync();
if(dbSet==null)
Console.WriteLine("11");
var current = await dbSet.FirstOrDefaultAsync(p => p.Site == tbPoDetail.Site
&& p.PoBillNum == tbPoDetail.PoBillNum
&& p.PoLine ==tbPoDetail.PoLine);

2
WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs

@ -34,5 +34,7 @@ namespace Win_in.Sfs.Scp.WebApi
}
}
}

2
WebApiService/src/Win_in.Sfs.Scp.v1.Event/PurchaseOrderEventHandler.cs

@ -40,6 +40,8 @@ namespace Win_in.Sfs.Scp.WebApi
var tbPoDetail = _objectMapper.Map<PurchaseOrderDetail, TB_PO_DETAIL>(poDetail);
//接口数据中没有Site,从主表中获取
tbPoDetail.Site = tbPo.Site;
tbPoDetail.BeginTime = tbPo.BeginTime;
tbPoDetail.EndTime = tbPo.EndTime;
//根据传入数据新增或修改SCP数据
await _tbPoDetailRepository.UpsertAsync(tbPoDetail);
}

Loading…
Cancel
Save