Browse Source

[fix]BUG 修复

master
贾荣国 3 years ago
parent
commit
5c9296ef55
  1. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderCreateDTO.cs
  2. 103
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderDetailCreateDTO.cs
  3. 6
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderDetailDTO.cs
  4. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  5. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs
  6. 4
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrder.cs
  7. 14
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Domain/PurchaseOrders/PurchaseOrderDetail.cs
  8. 3
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs
  9. 2869
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126082355_ModifyPoDetail.Designer.cs
  10. 56
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126082355_ModifyPoDetail.cs
  11. 7
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs
  12. 2
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/PurchaseOrderEventHandler.cs
  13. 22
      WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs

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

@ -116,7 +116,7 @@ public class PurchaseOrderCreateDTO : EntityDto,ICanTrace
[XmlArray(elementName: "details")] [XmlArray(elementName: "details")]
[XmlArrayItem(elementName: "PurchaseOrderDetailDTO")] [XmlArrayItem(elementName: "PurchaseOrderDetailDTO")]
public virtual List<PurchaseOrderDetailDTO> Details { get; set; } public virtual List<PurchaseOrderDetailCreateDTO> Details { get; set; }
/// <summary> /// <summary>
/// 跟踪编号(Trace ID) /// 跟踪编号(Trace ID)

103
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderDetailCreateDTO.cs

@ -0,0 +1,103 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using Volo.Abp.Application.Dtos;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi
{
/// <summary>
/// 采购订单明细DTO(Purchase order detail DTO)
/// </summary>
[Serializable, DataContract]
public class PurchaseOrderDetailCreateDTO : EntityDto
{
/// <summary>
/// 订单号(PoNumber)
/// </summary>
[DataMember]
[XmlElement("poNumber")]
[Display(Name = "订单号(PoNumber)")]
public string PoNumber { set; get; }
/// <summary>
/// 订单行(PoLine)
/// </summary>
[DataMember]
[XmlElement("poLine")]
[Display(Name = "订单行(PoLine)")]
public string PoLine { set; get; }
/// <summary>
/// 零件号(PartCode)
/// </summary>
[DataMember]
[XmlElement("partCode")]
[Display(Name = "零件号(PartCode)")]
public string PartCode { set; get; }
/// <summary>
/// 计量单位(Uom)
/// </summary>
[DataMember]
[XmlElement("uom")]
[Display(Name = "计量单位(Uom)")]
public string Uom { set; get; }
/// <summary>
/// 订单数量(Order Qty)
/// </summary>
[DataMember]
[XmlElement("orderQty")]
[Display(Name = "订单数量(OrderQty)")]
public decimal OrderQty { set; get; }
/// <summary>
/// 标包计量单位(Standard Pack Uom)
/// </summary>
[Display(Name = "标包计量单位(Standard Pack Uom)")]
public string StdPackUom { set; get; }
/// <summary>
/// 标包数量(Standard Pack Qty)
/// </summary>
[DataMember]
[XmlElement("stdPackQty")]
[Display(Name = "标包数量(Standard Pack Qty)")]
public decimal StdPackQty { set; get; }
/// <summary>
/// 供应商包装转换率(SupplierPackConvertRate)
/// </summary>
[DataMember]
[XmlElement("supplierPackConvertRate")]
[Display(Name = "供应商包装转换率(SupplierPackConvertRate)")]
public decimal SupplierPackConvertRate { set; get; }
/// <summary>
/// 是否寄存订单(IsConsignment)
/// </summary>
[DataMember]
[XmlElement("isConsignment")]
[Display(Name = "是否寄存订单(IsConsignment)")]
public bool IsConsignment { set; get; }
/// <summary>
/// 订单行状态(LineStatus)
/// </summary>
[DataMember]
[XmlElement("lineStatus")]
[Display(Name = "订单行状态(LineStatus)")]
public int LineStatus { set; get; }
/// <summary>
/// 备注(Remark)
/// </summary>
[DataMember]
[XmlElement("remark")]
[Display(Name = "备注(Remark)")]
public string Remark { set; get; }
}
}

6
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/PurchaseOrders/PurchaseOrderDetailDTO.cs

@ -54,6 +54,12 @@ namespace Win_in.Sfs.Scp.WebApi
[Display(Name = "订单数量(OrderQty)")] [Display(Name = "订单数量(OrderQty)")]
public decimal OrderQty { set; get; } public decimal OrderQty { set; get; }
/// <summary>
/// 标包计量单位(Standard Pack Uom)
/// </summary>
[Display(Name = "标包计量单位(Standard Pack Uom)")]
public string StdPackUom { set; get; }
/// <summary> /// <summary>
/// 标包数量(Standard Pack Qty) /// 标包数量(Standard Pack Qty)
/// </summary> /// </summary>

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

@ -59,6 +59,10 @@ namespace Win_in.Sfs.Scp.WebApi
public async Task<PurchaseOrderDTO> CreateAsync(PurchaseOrderCreateDTO poCreateDTO) public async Task<PurchaseOrderDTO> CreateAsync(PurchaseOrderCreateDTO poCreateDTO)
{ {
var entity = ObjectMapper.Map<PurchaseOrderCreateDTO, PurchaseOrder>(poCreateDTO); var entity = ObjectMapper.Map<PurchaseOrderCreateDTO, PurchaseOrder>(poCreateDTO);
foreach (var detail in entity.Details)
{
detail.SetId(GuidGenerator);
}
var ret = await _purchaseOrderRepository.InsertAsync(entity); var ret = await _purchaseOrderRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(ret); var dto = ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(ret);
return dto; return dto;

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs

@ -80,7 +80,7 @@ namespace Win_in.Sfs.Scp.WebApi
{ {
CreateMap<PurchaseOrderDetail, PurchaseOrderDetailDTO>(); CreateMap<PurchaseOrderDetail, PurchaseOrderDetailDTO>();
CreateMap<PurchaseOrderDetailDTO,PurchaseOrderDetail>() CreateMap<PurchaseOrderDetailCreateDTO,PurchaseOrderDetail>()
.Ignore(p => p.Id) .Ignore(p => p.Id)
.Ignore(p => p.CreatorId) .Ignore(p => p.CreatorId)
.Ignore(p => p.CreationTime); .Ignore(p => p.CreationTime);

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

@ -99,7 +99,7 @@ namespace Win_in.Sfs.Scp.WebApi
[Display(Name = "公司(Company)")] [Display(Name = "公司(Company)")]
public string Company { set; get; } public string Company { set; get; }
public virtual List<PurchaseOrderDetail> Details { get; set; } public virtual ICollection<PurchaseOrderDetail> Details { get; set; }
#region details handler #region details handler
@ -112,7 +112,7 @@ namespace Win_in.Sfs.Scp.WebApi
throw new Exception(detail.PoNumber+ detail.PoLine + "已经在明细中存在!"); throw new Exception(detail.PoNumber+ detail.PoLine + "已经在明细中存在!");
} }
Details.Add(new PurchaseOrderDetail(guidGenerator.Create(),detail.PoNumber, detail.PoLine, detail.PartCode, detail.Uom, detail.OrderQty, detail.StdPackQty, Details.Add(new PurchaseOrderDetail(guidGenerator.Create(),detail.PoNumber, detail.PoLine, detail.PartCode, detail.Uom, detail.OrderQty,detail.StdPackUom, detail.StdPackQty,
detail.SupplierPackConvertRate, detail.IsConsignment, detail.LineStatus, detail.Remark)); detail.SupplierPackConvertRate, detail.IsConsignment, detail.LineStatus, detail.Remark));
} }

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

@ -1,6 +1,7 @@
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing; using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Guids;
using Win_in.Sfs.Scp.WebApi.Domain.Shared; using Win_in.Sfs.Scp.WebApi.Domain.Shared;
namespace Win_in.Sfs.Scp.WebApi namespace Win_in.Sfs.Scp.WebApi
@ -10,6 +11,9 @@ namespace Win_in.Sfs.Scp.WebApi
/// </summary> /// </summary>
public class PurchaseOrderDetail : EntityDetailBase<Guid> public class PurchaseOrderDetail : EntityDetailBase<Guid>
{ {
public Guid MasterId { get; set; }
/// <summary> /// <summary>
/// 订单号(PoNumber) /// 订单号(PoNumber)
/// </summary> /// </summary>
@ -80,8 +84,8 @@ namespace Win_in.Sfs.Scp.WebApi
public PurchaseOrderDetail() { } public PurchaseOrderDetail() { }
public PurchaseOrderDetail( public PurchaseOrderDetail(
Guid id, string poNumber, string poLine, string partCode, string uom, decimal orderQty, decimal stdPackQty, Guid id, string poNumber, string poLine, string partCode, string uom, decimal orderQty,string stdPackUom,
decimal supplierPackConvertRate, bool isConsignment, int lineStatus, string remark) decimal stdPackQty, decimal supplierPackConvertRate, bool isConsignment, int lineStatus, string remark)
: base(id) : base(id)
{ {
PoNumber = poNumber; PoNumber = poNumber;
@ -89,6 +93,7 @@ namespace Win_in.Sfs.Scp.WebApi
PartCode = partCode; PartCode = partCode;
Uom = uom; Uom = uom;
OrderQty = orderQty; OrderQty = orderQty;
StdPackUom = stdPackUom;
StdPackQty = stdPackQty; StdPackQty = stdPackQty;
SupplierPackConvertRate = supplierPackConvertRate; SupplierPackConvertRate = supplierPackConvertRate;
IsConsignment = isConsignment; IsConsignment = isConsignment;
@ -96,5 +101,10 @@ namespace Win_in.Sfs.Scp.WebApi
Remark = remark; Remark = remark;
} }
public void SetId(IGuidGenerator guidGenerator)
{
Id = guidGenerator.Create();
}
} }
} }

3
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs

@ -210,7 +210,8 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
b.Property(q => q.ContactPhone).HasMaxLength(64); b.Property(q => q.ContactPhone).HasMaxLength(64);
b.Property(q => q.Remark).HasMaxLength(4096); b.Property(q => q.Remark).HasMaxLength(4096);
b.HasMany(u => u.Details).WithOne().HasForeignKey(rd => rd.Id).OnDelete(DeleteBehavior.NoAction).IsRequired(); b.HasMany(u => u.Details).WithOne().HasForeignKey(rd => rd.MasterId)
.OnDelete(DeleteBehavior.NoAction).IsRequired();
}); });
} }

2869
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126082355_ModifyPoDetail.Designer.cs

File diff suppressed because it is too large

56
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220126082355_ModifyPoDetail.cs

@ -0,0 +1,56 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class ModifyPoDetail : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_WebApi_PODetail_WebApi_PO_Id",
table: "WebApi_PODetail");
migrationBuilder.AddColumn<Guid>(
name: "MasterId",
table: "WebApi_PODetail",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
migrationBuilder.CreateIndex(
name: "IX_WebApi_PODetail_MasterId",
table: "WebApi_PODetail",
column: "MasterId");
migrationBuilder.AddForeignKey(
name: "FK_WebApi_PODetail_WebApi_PO_MasterId",
table: "WebApi_PODetail",
column: "MasterId",
principalTable: "WebApi_PO",
principalColumn: "Id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_WebApi_PODetail_WebApi_PO_MasterId",
table: "WebApi_PODetail");
migrationBuilder.DropIndex(
name: "IX_WebApi_PODetail_MasterId",
table: "WebApi_PODetail");
migrationBuilder.DropColumn(
name: "MasterId",
table: "WebApi_PODetail");
migrationBuilder.AddForeignKey(
name: "FK_WebApi_PODetail_WebApi_PO_Id",
table: "WebApi_PODetail",
column: "Id",
principalTable: "WebApi_PO",
principalColumn: "Id");
}
}
}

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

@ -2135,6 +2135,9 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.Property<int>("LineStatus") b.Property<int>("LineStatus")
.HasColumnType("int"); .HasColumnType("int");
b.Property<Guid>("MasterId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("OrderQty") b.Property<decimal>("OrderQty")
.HasPrecision(18, 6) .HasPrecision(18, 6)
.HasColumnType("decimal(18,6)"); .HasColumnType("decimal(18,6)");
@ -2176,6 +2179,8 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("MasterId");
b.ToTable("WebApi_PODetail"); b.ToTable("WebApi_PODetail");
}); });
@ -2761,7 +2766,7 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
{ {
b.HasOne("Win_in.Sfs.Scp.WebApi.PurchaseOrder", null) b.HasOne("Win_in.Sfs.Scp.WebApi.PurchaseOrder", null)
.WithMany("Details") .WithMany("Details")
.HasForeignKey("Id") .HasForeignKey("MasterId")
.OnDelete(DeleteBehavior.NoAction) .OnDelete(DeleteBehavior.NoAction)
.IsRequired(); .IsRequired();
}); });

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

@ -38,6 +38,8 @@ namespace Win_in.Sfs.Scp.WebApi
{ {
//使用AutoMapper执行类型转换 //使用AutoMapper执行类型转换
var tbPoDetail = _objectMapper.Map<PurchaseOrderDetail, TB_PO_DETAIL>(poDetail); var tbPoDetail = _objectMapper.Map<PurchaseOrderDetail, TB_PO_DETAIL>(poDetail);
//接口数据中没有Site,从主表中获取
tbPoDetail.Site = tbPo.Site;
//根据传入数据新增或修改SCP数据 //根据传入数据新增或修改SCP数据
await _tbPoDetailRepository.UpsertAsync(tbPoDetail); await _tbPoDetailRepository.UpsertAsync(tbPoDetail);
} }

22
WebApiService/src/Win_in.Sfs.Scp.v1.Event/WebApiApplicationAutoMapperProfile.cs

@ -100,17 +100,19 @@ namespace Win_in.Sfs.Scp.WebApi
// .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值
.ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值
// .ForMember(p => p.OperName, p => p.MapFrom(q => ""))//默认值 // .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.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 1 : 0))//TODO SCP的BllType含义
// .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 // .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值
; ;
var poLine = 0;
CreateMap<Receipt, TB_RECEIVE_DETAIL_QAD>() CreateMap<Receipt, TB_RECEIVE_DETAIL_QAD>()
.Ignore(p => p.Id) .Ignore(p => p.Id)
.ForMember(p => p.Site, p => p.MapFrom(q => q.Site)) .ForMember(p => p.Site, p => p.MapFrom(q => q.Site))
.ForMember(p => p.ErpRecvBillNum, p => p.MapFrom(q => q.RcNumber)) .ForMember(p => p.ErpRecvBillNum, p => p.MapFrom(q => q.RcNumber))
.ForMember(p => p.RecvBillNum, 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.PoBillNum, p => p.MapFrom(q => q.PoNumber))
.ForMember(p => p.PoLine, p => p.MapFrom(q => q.PoLine)) .ForMember(p => p.PoLine, p => p.MapFrom(q =>int.TryParse(q.PoLine,out poLine)?poLine:0))
.ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode)) .ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode))
.ForMember(p => p.Batch, p => p.MapFrom(q => q.Lot)) .ForMember(p => p.Batch, p => p.MapFrom(q => q.Lot))
.ForMember(p => p.Qty, p => p.MapFrom(q => q.ReceiveQty)) .ForMember(p => p.Qty, p => p.MapFrom(q => q.ReceiveQty))
@ -121,7 +123,7 @@ namespace Win_in.Sfs.Scp.WebApi
.ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO .ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO
// .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值
.ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 .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.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 1 : 0))//TODO SCP的BllType含义
.ForMember(p => p.VendBatch, p => p.MapFrom(q => q.SupplierLot)) .ForMember(p => p.VendBatch, p => p.MapFrom(q => q.SupplierLot))
.ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom)) .ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom))
.ForMember(p => p.LocUnit, p => p.MapFrom(q => q.Uom)) .ForMember(p => p.LocUnit, p => p.MapFrom(q => q.Uom))
@ -144,13 +146,15 @@ namespace Win_in.Sfs.Scp.WebApi
private void CreateMapPurchaseOrder() private void CreateMapPurchaseOrder()
{ {
var poType = 0;
CreateMap<PurchaseOrder, TB_PO>() CreateMap<PurchaseOrder, TB_PO>()
.Ignore(p => p.Id) .Ignore(p => p.Id)
.ForMember(p => p.Site, p => p.MapFrom(q => q.Site)) .ForMember(p => p.Site, p => p.MapFrom(q => q.Site))
.ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber)) .ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber))
.ForMember(p => p.ErpBillNum, 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.VendId, p => p.MapFrom(q => q.SupplierCode))
.ForMember(p => p.ModType, p => p.MapFrom(q => int.Parse(q.PoType))) .ForMember(p => p.ModType, p => p.MapFrom(q => int.TryParse(q.PoType,out poType)?poType:0))
.ForMember(p => p.Contacter, p => p.MapFrom(q => q.ContactName))//TODO Contacter 和 Buyer 如何赋值 .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.Buyer, p => p.MapFrom(q => q.ContactName))
.ForMember(p => p.BuyerPhone, p => p.MapFrom(q => q.ContactPhone)) .ForMember(p => p.BuyerPhone, p => p.MapFrom(q => q.ContactPhone))
@ -169,14 +173,14 @@ namespace Win_in.Sfs.Scp.WebApi
// .ForMember(p => p.UpdateInfo, p => p.MapFrom(q => ""))//默认值 // .ForMember(p => p.UpdateInfo, p => p.MapFrom(q => ""))//默认值
// .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值
.ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值
; ;
var poLine = 0;
CreateMap<PurchaseOrderDetail, TB_PO_DETAIL>() CreateMap<PurchaseOrderDetail, TB_PO_DETAIL>()
.Ignore(p => p.Id) .Ignore(p => p.Id)
.ForMember(p => p.PoBillNum, p => p.MapFrom(q => q.PoNumber)) .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.PoLine, p => p.MapFrom(q => int.TryParse(q.PoLine, out poLine) ? poLine : 0))
.ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode)) .ForMember(p => p.PartCode, p => p.MapFrom(q => q.PartCode))
// .ForMember(p => p.ShippedQty, p => p.MapFrom(q => 0))//默认值 // .ForMember(p => p.ShippedQty, p => p.MapFrom(q => 0))//默认值
// .ForMember(p => p.ReceivedQty, p => p.MapFrom(q => 0))//默认值 // .ForMember(p => p.ReceivedQty, p => p.MapFrom(q => 0))//默认值
@ -229,7 +233,7 @@ namespace Win_in.Sfs.Scp.WebApi
// .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值
.ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 .ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值
// .ForMember(p => p.OperName, p => p.MapFrom(q => ""))//默认值 // .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.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.TrType) ? 1 : 0))//TODO SCP的BllType含义
// .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值 // .ForMember(p => p.Tax, p => p.MapFrom(q => 0))//默认值
; ;
@ -250,7 +254,7 @@ namespace Win_in.Sfs.Scp.WebApi
.ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO .ForMember(p => p.CreateUser, p => p.MapFrom(q => q.CreatorId.ToString()))//TODO
// .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值 // .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值
.ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值 .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.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.TrType) ? 1 : 0))//TODO SCP的BllType含义
// .ForMember(p => p.VendBatch, p => p.MapFrom(q => ""))//默认值 // .ForMember(p => p.VendBatch, p => p.MapFrom(q => ""))//默认值
.ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom)) .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.LocUnit, p => p.MapFrom(q => q.Uom))//TODO 计划外入库单没有LocUnit

Loading…
Cancel
Save