Browse Source

[update]接收接口数据后, 对接到SCP数据库

master
贾荣国 3 years ago
parent
commit
f97e839677
  1. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs
  2. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  3. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs
  4. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs
  5. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs
  6. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Parts/Part.cs
  7. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrder.cs
  8. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrderDetail.cs
  9. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Receipts/Receipt.cs
  10. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Suppliers/Supplier.cs
  11. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/UnplannedReceipts/UnplannedReceipt.cs
  12. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json
  13. 32
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Parts/TA_PART.cs
  14. 12
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoDetailRepository.cs
  15. 4
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/ITbPoRepository.cs
  16. 28
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO.cs
  17. 46
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/PurchaseOrders/TB_PO_DETAIL.cs
  18. 12
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptDetailRepository.cs
  19. 4
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/ITbReceiptRepository.cs
  20. 33
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_DETAIL_QAD.cs
  21. 24
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Receipts/TB_RECEIVE_QAD.cs
  22. 10
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/ITbRejectRepository.cs
  23. 40
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT.cs
  24. 31
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT_DETAIL.cs
  25. 5
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/ITaVenderRepository.cs
  26. 32
      WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Suppliers/TA_VENDER.cs
  27. 3
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/IV1ScpDbContext.cs
  28. 4
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs
  29. 235
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContextModelCreatingExtensions.cs
  30. 4
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpModelBuilderConfigurationOptions.cs
  31. 651
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.Designer.cs
  32. 278
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.cs
  33. 649
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/V1ScpDbContextModelSnapshot.cs
  34. 17
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaPartRepository.cs
  35. 36
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TaVenderRepository.cs
  36. 46
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoDetailRepository.cs
  37. 34
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbPoRepository.cs
  38. 51
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptDetailRepository.cs
  39. 32
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbReceiptRepository.cs
  40. 13
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbRejectRepository.cs
  41. 3
      WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/V1ScpEntityFrameworkCoreModule.cs
  42. 11
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/PartEventHandler.cs
  43. 34
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/PurchaseOrderEventHandler.cs
  44. 32
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/ReceiptEventHandler.cs
  45. 22
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/SupplierEventHandler.cs
  46. 30
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/UnplannedReceiptEventHandler.cs
  47. 226
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs

1
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, Part>(partCreateDTO);
entity.SetId(GuidGenerator.Create());
var ret= await _partRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Part, PartDTO>(ret);
return dto;

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

@ -59,11 +59,6 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task<PurchaseOrderDTO> CreateAsync(PurchaseOrderCreateDTO poCreateDTO)
{
var entity = ObjectMapper.Map<PurchaseOrderCreateDTO, PurchaseOrder>(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<PurchaseOrder, PurchaseOrderDTO>(ret);
return dto;

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

@ -62,7 +62,6 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task<ReceiptDTO> CreateAsync(ReceiptCreateDTO receiptCreateDTO)
{
var entity = ObjectMapper.Map<ReceiptCreateDTO, Receipt>(receiptCreateDTO);
entity.SetId(GuidGenerator.Create());
var ret = await _receiptRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Receipt, ReceiptDTO>(ret);
return dto;

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

@ -62,7 +62,6 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task<SupplierDTO> CreateAsync(SupplierCreateDTO supplierCreateDTO)
{
var entity = ObjectMapper.Map<SupplierCreateDTO, Supplier>(supplierCreateDTO);
entity.SetId(GuidGenerator.Create());
var ret = await _supplierRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Supplier, SupplierDTO>(ret);
return dto;

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

@ -61,7 +61,6 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task<UnplannedReceiptDTO> CreateAsync(UnplannedReceiptCreateDTO receiptCreateDTO)
{
var entity = ObjectMapper.Map<UnplannedReceiptCreateDTO, UnplannedReceipt>(receiptCreateDTO);
entity.SetId(GuidGenerator.Create());
var ret = await _unplannedReceiptRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<UnplannedReceipt, UnplannedReceiptDTO>(ret);
return dto;

4
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;
}
}
}

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrder.cs

@ -101,11 +101,6 @@ namespace Win_in.Sfs.Scp.WebApi
public virtual List<PurchaseOrderDetail> Details { get; set; }
public void SetId(Guid id)
{
Id = id;
}
#region details handler
public virtual void AddDetail(IGuidGenerator guidGenerator, PurchaseOrderDetail detail)

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrderDetail.cs

@ -96,10 +96,5 @@ namespace Win_in.Sfs.Scp.WebApi
Remark = remark;
}
public void SetId(Guid id)
{
Id = id;
}
}
}

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Receipts/Receipt.cs

@ -135,10 +135,7 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary>
[Display(Name = "公司(Company)")]
public string Company { set; get; }
public void SetId(Guid id)
{
Id = id;
}
}
}

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/Suppliers/Supplier.cs

@ -106,10 +106,6 @@ namespace Win_in.Sfs.Scp.WebApi
[Display(Name = "备注(Remark)")]
public string Remark { set; get; }
public void SetId(Guid id)
{
Id = id;
}
}
}

4
WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/UnplannedReceipts/UnplannedReceipt.cs

@ -96,10 +96,6 @@ namespace Win_in.Sfs.Scp.WebApi
[Display(Name = "公司(Company)")]
public string Company { set; get; }
public void SetId(Guid id)
{
Id = id;
}
}
}

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

@ -33,5 +33,5 @@
}
}
},
"AlwaysAllowAuthorization": false
"AlwaysAllowAuthorization": true
}

32
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<long>
{
[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};
}
}
}

12
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<TB_PO_DETAIL>, ITransientDependency
{
Task<TB_PO_DETAIL> UpsertAsync(TB_PO_DETAIL tbPoDetail);
}
}

4
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<TB_PO>, ITransientDependency
{
Task<TB_PO> UpsertAsync(TB_PO tbPo);
}
}

28
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<long>
{
[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 };
}
}
}

46
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<long>
{
[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 };
}
}
}

12
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<TB_RECEIVE_DETAIL_QAD>, ITransientDependency
{
Task<TB_RECEIVE_DETAIL_QAD> UpsertAsync(TB_RECEIVE_DETAIL_QAD taPart);
}
}

4
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<TB_RECEIVE_QAD>, ITransientDependency
{
Task<TB_RECEIVE_QAD> UpsertAsync(TB_RECEIVE_QAD taPart);
}
}

33
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<long>
{
[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; }
/// <summary>
@ -56,20 +34,13 @@ namespace Win_in.Sfs.Scp.v1.Domain
/// 成本价
/// </summary>
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; }
}
}

24
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<long>
{
[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 };
}
}
}

10
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/ITbRejectRepository.cs

@ -1,10 +0,0 @@
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace Win_in.Sfs.Scp.v1.Domain
{
public interface ITbRejectRepository : IRepository<TB_REJECT>, ITransientDependency
{
}
}

40
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT.cs

@ -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 };
}
}
}

31
WebApiService/src/Win_in.Sfs.Scp.v1.Domain/Rejects/TB_REJECT_DETAIL.cs

@ -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; }
}
}

5
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<TA_VENDER>, ITransientDependency
{
Task<TA_VENDER> UpsertAsync(TA_VENDER taVender);
}
}

32
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<long>
{
[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 };
}
}
}

3
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/IV1ScpDbContext.cs

@ -8,7 +8,8 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
DbSet<TA_PART> Parts { get; set; }
DbSet<TA_VENDER> Suppliers { get; set; }
DbSet<TB_PO> PurchaseOrders { get; set; }
DbSet<TB_PO_DETAIL> PurchaseOrderDetails { get; set; }
DbSet<TB_RECEIVE_QAD> Receipts { get; set; }
DbSet<TB_REJECT> Rejects { get; set; }
DbSet<TB_RECEIVE_DETAIL_QAD> ReceiptDetails { get; set; }
}
}

4
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/DbContext/V1ScpDbContext.cs

@ -15,9 +15,9 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
public virtual DbSet<TA_PART> Parts { get; set; }
public virtual DbSet<TA_VENDER> Suppliers { get; set; }
public virtual DbSet<TB_PO> PurchaseOrders { get; set; }
public virtual DbSet<TB_PO_DETAIL> PurchaseOrderDetails { get; set; }
public virtual DbSet<TB_RECEIVE_QAD> Receipts { get; set; }
public virtual DbSet<TB_REJECT> Rejects { get; set; }
public virtual DbSet<TB_RECEIVE_DETAIL_QAD> ReceiptDetails { get; set; }

235
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<V1ScpModelBuilderConfigurationOptions> 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<TA_PART>(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<TA_VENDER>(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<TB_PO>(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<TB_PO_DETAIL>(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<TB_RECEIVE_QAD>(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<TB_RECEIVE_DETAIL_QAD>(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();
});
}
}
}

4
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)
{
}

651
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/20220126072541_Init.Designer.cs

@ -0,0 +1,651 @@
// <auto-generated />
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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Configuration")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("ErpPartCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool?>("Ischeck")
.HasColumnType("bit");
b.Property<string>("PalletSize")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PartCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PartDesc1")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("PartDesc2")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("PartGroup")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ProjectId")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Qlevel")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ReceivePort")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("State")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Unit")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Address")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("City")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Contacter")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Country")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Currency")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Email")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Fax")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Phone")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal?>("Quota")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<int?>("ReceiveTimeScope")
.HasColumnType("int");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<decimal?>("Tax")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("VendAbbCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VendId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VendName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VendType")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("BeginTime")
.HasColumnType("datetime2");
b.Property<string>("Buyer")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("BuyerPhone")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Contacter")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("CreateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("EndTime")
.HasColumnType("datetime2");
b.Property<string>("ErpBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend3")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GUID")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<int?>("ModType")
.HasColumnType("int");
b.Property<string>("PoBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<string>("SubSite")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("UpdateInfo")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("datetime2");
b.Property<string>("UpdateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("BeginTime")
.HasColumnType("datetime2");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("CreateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Currency")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("DockCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("EndTime")
.HasColumnType("datetime2");
b.Property<string>("Extend1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend3")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GUID")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("LocUnit")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("PackQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("PartCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("PlanQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("PoBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("PoLine")
.HasColumnType("int");
b.Property<string>("PoUnit")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("Price")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<decimal>("ReceivedQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("RejectQty")
.HasPrecision(18, 6)
.HasColumnType("nvarchar(max)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<decimal>("ShippedQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<string>("SubSite")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal?>("TempQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<decimal>("UnConv")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("UpdateInfo")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("datetime2");
b.Property<string>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Batch")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("BillType")
.HasColumnType("int");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("CreateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal?>("CurAmt")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("DockCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ErpRecvBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend3")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GUID")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("LocUnit")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PartCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PoBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("PoLine")
.HasColumnType("int");
b.Property<string>("PoUnit")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal?>("PurCost")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<decimal>("Qty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<decimal?>("Rate")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("RecvBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<decimal?>("StdCost")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("SubSite")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Tax")
.HasPrecision(18, 6)
.HasColumnType("nvarchar(max)");
b.Property<string>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AsnBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("BillType")
.HasColumnType("int");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("CreateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ErpRecvBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend3")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GUID")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("OperName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PoBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RecvBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("ShipTime")
.HasColumnType("datetime2");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<string>("SubSite")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Tax")
.HasPrecision(18, 6)
.HasColumnType("nvarchar(max)");
b.Property<string>("VendId")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.HasIndex("Site", "ErpRecvBillNum")
.IsUnique();
b.ToTable("TB_RECEIVE_QAD");
});
#pragma warning restore 612, 618
}
}
}

278
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<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PartCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ErpPartCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
PartDesc1 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
PartDesc2 = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
ProjectId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Unit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
PartGroup = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
State = table.Column<string>(type: "nvarchar(10)", maxLength: 10, nullable: false),
Configuration = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
ValidityDays = table.Column<int>(type: "int", nullable: false),
ReceivePort = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
PalletSize = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Qlevel = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Ischeck = table.Column<bool>(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<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
VendId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
VendName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
VendAbbCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
VendType = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Country = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
City = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Currency = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Address = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ZipCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Contacter = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Phone = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Fax = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
State = table.Column<int>(type: "int", nullable: false),
Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
Tax = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ReceiveTimeScope = table.Column<int>(type: "int", nullable: true),
Quota = table.Column<decimal>(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<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PoBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ErpBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
VendId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ModType = table.Column<int>(type: "int", nullable: true),
Contacter = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Buyer = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
BuyerPhone = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
State = table.Column<int>(type: "int", nullable: false),
Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
BeginTime = table.Column<DateTime>(type: "datetime2", nullable: true),
EndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
Extend1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Extend2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Extend3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
SubSite = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreateUser = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateUser = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateInfo = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
GUID = table.Column<Guid>(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<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PoBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
PoLine = table.Column<int>(type: "int", nullable: false),
BeginTime = table.Column<DateTime>(type: "datetime2", nullable: true),
EndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
PartCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ShippedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
ReceivedQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
RejectQty = table.Column<string>(type: "nvarchar(max)", precision: 18, scale: 6, nullable: true),
PoUnit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
LocUnit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Price = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
Currency = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
PlanQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
PackQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
TempQty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true),
State = table.Column<int>(type: "int", nullable: false),
Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
UnConv = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
DockCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Extend1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Extend2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Extend3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
SubSite = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreateUser = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateUser = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateInfo = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
GUID = table.Column<Guid>(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<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RecvBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
PoBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
PoLine = table.Column<int>(type: "int", nullable: false),
PartCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Batch = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Qty = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
DockCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
State = table.Column<int>(type: "int", nullable: false),
Remark = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreateUser = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
GUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
BillType = table.Column<int>(type: "int", nullable: false),
VendBatch = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
PoUnit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
LocUnit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ErpRecvBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
PurCost = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true),
StdCost = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Rate = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true),
CurAmt = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true),
Tax = table.Column<string>(type: "nvarchar(max)", precision: 18, scale: 6, nullable: true),
Extend1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Extend2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Extend3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
SubSite = table.Column<string>(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<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RecvBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
PoBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
AsnBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Site = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
VendId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ShipTime = table.Column<DateTime>(type: "datetime2", nullable: false),
State = table.Column<int>(type: "int", nullable: false),
Remark = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreateUser = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
GUID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OperName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
BillType = table.Column<int>(type: "int", nullable: false),
ErpRecvBillNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Tax = table.Column<string>(type: "nvarchar(max)", precision: 18, scale: 6, nullable: true),
Extend1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Extend2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Extend3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
SubSite = table.Column<string>(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");
}
}
}

649
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Migrations/V1ScpDbContextModelSnapshot.cs

@ -0,0 +1,649 @@
// <auto-generated />
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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Configuration")
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("ErpPartCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool?>("Ischeck")
.HasColumnType("bit");
b.Property<string>("PalletSize")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PartCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PartDesc1")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("PartDesc2")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("PartGroup")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ProjectId")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Qlevel")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ReceivePort")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("State")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("Unit")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Address")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("City")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Contacter")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Country")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Currency")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Email")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Fax")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Phone")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal?>("Quota")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<int?>("ReceiveTimeScope")
.HasColumnType("int");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<decimal?>("Tax")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("VendAbbCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VendId")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VendName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("VendType")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("BeginTime")
.HasColumnType("datetime2");
b.Property<string>("Buyer")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("BuyerPhone")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Contacter")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("CreateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("EndTime")
.HasColumnType("datetime2");
b.Property<string>("ErpBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend3")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GUID")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<int?>("ModType")
.HasColumnType("int");
b.Property<string>("PoBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<string>("SubSite")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("UpdateInfo")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("datetime2");
b.Property<string>("UpdateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime?>("BeginTime")
.HasColumnType("datetime2");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("CreateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Currency")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("DockCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("EndTime")
.HasColumnType("datetime2");
b.Property<string>("Extend1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend3")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GUID")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("LocUnit")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("PackQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("PartCode")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("PlanQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("PoBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("PoLine")
.HasColumnType("int");
b.Property<string>("PoUnit")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal>("Price")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<decimal>("ReceivedQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("RejectQty")
.HasPrecision(18, 6)
.HasColumnType("nvarchar(max)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<decimal>("ShippedQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<string>("SubSite")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal?>("TempQty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<decimal>("UnConv")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("UpdateInfo")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime?>("UpdateTime")
.HasColumnType("datetime2");
b.Property<string>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("Batch")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("BillType")
.HasColumnType("int");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("CreateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal?>("CurAmt")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("DockCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ErpRecvBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend3")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GUID")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("LocUnit")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PartCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PoBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("PoLine")
.HasColumnType("int");
b.Property<string>("PoUnit")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<decimal?>("PurCost")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<decimal>("Qty")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<decimal?>("Rate")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("RecvBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<decimal?>("StdCost")
.HasPrecision(18, 6)
.HasColumnType("decimal(18,6)");
b.Property<string>("SubSite")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Tax")
.HasPrecision(18, 6)
.HasColumnType("nvarchar(max)");
b.Property<string>("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<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("UID")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("AsnBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("BillType")
.HasColumnType("int");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<string>("CreateUser")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ErpRecvBillNum")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Extend3")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("GUID")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("OperName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PoBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RecvBillNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Remark")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("ShipTime")
.HasColumnType("datetime2");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<string>("SubSite")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Tax")
.HasPrecision(18, 6)
.HasColumnType("nvarchar(max)");
b.Property<string>("VendId")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.HasIndex("Site", "ErpRecvBillNum")
.IsUnique();
b.ToTable("TB_RECEIVE_QAD");
});
#pragma warning restore 612, 618
}
}
}

17
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,14 +13,15 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
{
}
public async Task<TA_PART> UpsertAsync( TA_PART taPart)
public async Task<TA_PART> 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
{
@ -27,9 +29,14 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
//使用直接赋值
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;

36
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<V1ScpDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<TA_VENDER> 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;
}
}
}

46
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<V1ScpDbContext, TB_PO_DETAIL>, ITbPoDetailRepository
{
public TbPoDetailRepository(IDbContextProvider<V1ScpDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<TB_PO_DETAIL> 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;
}
}
}

34
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<V1ScpDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<TB_PO> 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;
}
}
}

51
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<V1ScpDbContext, TB_RECEIVE_DETAIL_QAD>, ITbReceiptDetailRepository
{
public TbReceiptDetailRepository(IDbContextProvider<V1ScpDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<TB_RECEIVE_DETAIL_QAD> 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;
}
}
}

32
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<V1ScpDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<TB_RECEIVE_QAD> 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;
}
}
}

13
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/Repositories/TbRejectRepository.cs

@ -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<V1ScpDbContext, TB_REJECT>, ITbRejectRepository
{
public TbRejectRepository(IDbContextProvider<V1ScpDbContext> dbContextProvider) : base(dbContextProvider)
{
}
}
}

3
WebApiService/src/Win_in.Sfs.Scp.v1.EntityFrameworkCore/V1ScpEntityFrameworkCoreModule.cs

@ -26,8 +26,9 @@ namespace Win_in.Sfs.Scp.v1.EntityFrameworkCore
options.AddRepository<TA_PART, TaPartRepository>();
options.AddRepository<TA_VENDER, TaVenderRepository>();
options.AddRepository<TB_RECEIVE_QAD, TbReceiptRepository>();
options.AddRepository<TB_RECEIVE_DETAIL_QAD, TbReceiptDetailRepository>();
options.AddRepository<TB_PO, TbPoRepository>();
options.AddRepository<TB_REJECT, TbRejectRepository>();
options.AddRepository<TB_PO_DETAIL, TbPoDetailRepository>();
// Configure<AbpEntityOptions>(o =>
// {

11
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<EntityCreatedEventData<Part>>,
ITransientDependency
: ILocalEventHandler<EntityCreatedEventData<Part>>
, ITransientDependency
{
private readonly ITaPartRepository _taPartRepository;
private readonly IObjectMapper _objectMapper;
@ -26,12 +27,10 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task HandleEventAsync(EntityCreatedEventData<Part> eventData)
{
var part = eventData.Entity;
Console.WriteLine("Local Event:" + part.Code);
//使用AutoMapper执行类型转换
var taPart = _objectMapper.Map<Part, TA_PART>(part);
//根据传入数据新增或修改TA_PART
var ret = await _taPartRepository.UpsertAsync(taPart);
//根据传入数据新增或修改SCP数据
await _taPartRepository.UpsertAsync(taPart);
}

34
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<EntityCreatedEventData<PurchaseOrder>>,ITransientDependency
{
public Task HandleEventAsync(EntityCreatedEventData<PurchaseOrder> eventData)
private readonly ITbPoRepository _tbPoRepository;
private readonly ITbPoDetailRepository _tbPoDetailRepository;
private readonly IObjectMapper _objectMapper;
public PurchaseOrderEventHandler(
ITbPoRepository tbPoRepository,
ITbPoDetailRepository tbPoDetailRepository,
IObjectMapper objectMapper)
{
_tbPoRepository = tbPoRepository;
_tbPoDetailRepository = tbPoDetailRepository;
_objectMapper = objectMapper;
}
public async Task HandleEventAsync(EntityCreatedEventData<PurchaseOrder> eventData)
{
Console.WriteLine("Local Event:" + eventData.Entity.Id);
var po = eventData.Entity;
//使用AutoMapper执行类型转换
var tbPo = _objectMapper.Map<PurchaseOrder, TB_PO>(po);
//根据传入数据新增或修改SCP数据
await _tbPoRepository.UpsertAsync(tbPo);
var poDetails = po.Details;
return Task.CompletedTask;
foreach (var poDetail in poDetails)
{
//使用AutoMapper执行类型转换
var tbPoDetail = _objectMapper.Map<PurchaseOrderDetail, TB_PO_DETAIL>(poDetail);
//根据传入数据新增或修改SCP数据
await _tbPoDetailRepository.UpsertAsync(tbPoDetail);
}
//TODO 新增或修改TB_PO,TB_PO_DETAIL
}
}
}

32
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<EntityCreatedEventData<Receipt>>, ITransientDependency
public class ReceiptEventHandler : ILocalEventHandler<EntityCreatedEventData<Receipt>>, ITransientDependency
{
public Task HandleEventAsync(EntityCreatedEventData<Receipt> 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<Receipt> eventData)
{
var receipt = eventData.Entity;
//使用AutoMapper执行类型转换
var tbReceipt = _objectMapper.Map<Receipt, TB_RECEIVE_QAD>(receipt);
//根据传入数据新增或修改SCP数据
await _tbReceiptRepository.UpsertAsync(tbReceipt);
//TODO 根据单据类型,新增 TB_RECEIPT 或 TB_REJECT
//使用AutoMapper执行类型转换
var tbReceiveDetail = _objectMapper.Map<Receipt, TB_RECEIVE_DETAIL_QAD>(receipt);
//根据传入数据新增或修改SCP数据
await _tbReceiptDetailRepository.UpsertAsync(tbReceiveDetail);
}
}
}

22
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<EntityCreatedEventData<Supplier>>, ITransientDependency
{
public Task HandleEventAsync(EntityCreatedEventData<Supplier> 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<Supplier> eventData)
{
var supplier = eventData.Entity;
//使用AutoMapper执行类型转换
var taVender = _objectMapper.Map<Supplier, TA_VENDER>(supplier);
//根据传入数据新增或修改SCP数据
await _taVenderRepository.UpsertAsync(taVender);
//TODO 新增或修改TA_VENDER
}
}
}

30
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<EntityCreatedEventData<UnplannedReceipt>>, ITransientDependency
{
public Task HandleEventAsync(EntityCreatedEventData<UnplannedReceipt> 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<UnplannedReceipt> eventData)
{
var unplannedReceipt = eventData.Entity;
//使用AutoMapper执行类型转换
var tbReceipt = _objectMapper.Map<UnplannedReceipt, TB_RECEIVE_QAD>(unplannedReceipt);
//根据传入数据新增或修改SCP数据
await _tbReceiptRepository.UpsertAsync(tbReceipt);
//TODO 新增或修改无订单的TB_RECEIPT
//使用AutoMapper执行类型转换
var tbReceiveDetail = _objectMapper.Map<UnplannedReceipt, TB_RECEIVE_DETAIL_QAD>(unplannedReceipt);
//根据传入数据新增或修改SCP数据
await _tbReceiptDetailRepository.UpsertAsync(tbReceiveDetail);
}
}
}

226
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<Part, TA_PART>();
CreateMap<Part, TA_PART>()
.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))//默认值
;
}
/// <summary>
@ -34,7 +53,28 @@ namespace Win_in.Sfs.Scp.WebApi
private void CreateMapSupplier()
{
CreateMap<Supplier, TA_VENDER>();
CreateMap<Supplier, TA_VENDER>()
.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<Receipt, TB_RECEIVE_QAD>();
CreateMap<Receipt, TB_RECEIVE_DETAIL_QAD>();
CreateMap<Receipt, TB_REJECT>();
CreateMap<Receipt, TB_REJECT_DETAIL>();
CreateMap<Receipt, TB_RECEIVE_QAD>()
.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<Receipt, TB_RECEIVE_DETAIL_QAD>()
.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<PurchaseOrder, TB_PO>();
}
CreateMap<PurchaseOrder, TB_PO>()
.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()))//默认值
/// <summary>
/// 采购订单明细表映射
/// </summary>
private void CreateMapPurchaseOrderDetail()
{
CreateMap<PurchaseOrderDetail, TB_PO_DETAIL>();
;
CreateMap<PurchaseOrderDetail, TB_PO_DETAIL>()
.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<UnplannedReceipt, TB_RECEIVE_QAD>();
CreateMap<UnplannedReceipt, TB_RECEIVE_QAD>()
.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<UnplannedReceipt, TB_RECEIVE_DETAIL_QAD>();
CreateMap<UnplannedReceipt, TB_RECEIVE_DETAIL_QAD>()
.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 => ""))//默认值
;
}
}
}

Loading…
Cancel
Save