You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
5.4 KiB

4 years ago
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Volo.Abp;
4 years ago
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.Guids;
using Win_in.Sfs.Scp.WebApi.Domain.Shared;
4 years ago
namespace Win_in.Sfs.Scp.WebApi
{
/// <summary>
/// 发货单主表
/// </summary>
public class ASN: EntityBase<Guid>
4 years ago
{
/// <summary>
/// 发货单号(ASN Number)
/// </summary>
[Display(Name = "发货单号(AsnNumber)")]
public string AsnNumber { set; get; }
/// <summary>
/// 要货计划单号(Request Plan Number)
/// </summary>
[Display(Name = "要货计划单号(RpNumber)")]
public string RpNumber { set; get; }
/// <summary>
/// 订单号(Purchase order number)
/// </summary>
[Display(Name = "订单号(PoNumber)")]
public string PoNumber { set; get; }
/// <summary>
/// 供应商代码(Supplier code)
/// </summary>
[Display(Name = "供应商代码(SupplierCode)")]
public string SupplierCode { set; get; }
/// <summary>
/// 状态(Status)
/// </summary>
[Display(Name = "状态(Status)")]
public int Status { set; get; }
/// <summary>
/// 联系人(Contact person)
/// </summary>
[Display(Name = "联系人(ContactName)")]
public string ContactName { set; get; }
/// <summary>
/// 联系电话(Contact phone)
/// </summary>
[Display(Name = "联系电话(ContactPhone)")]
public string ContactPhone { set; get; }
/// <summary>
/// 版本(Car Number)
/// </summary>
[Display(Name = "车牌号(CarNumber)")]
public string CarNumber { set; get; }
/// <summary>
/// 仓库(Warehouse code)
/// </summary>
[Display(Name = "仓库(Warehouse)")]
public decimal Warehouse { set; get; }
/// <summary>
/// 收货口(Warehouse Dock)
/// </summary>
[Display(Name = "收货口(WarehouseDock)")]
public string WarehouseDock { set; get; }
/// <summary>
4 years ago
/// 时间窗口开始(Time Window Begin)
/// </summary>
[Display(Name = "时间窗口开始(TimeWindowBegin)")]
public DateTime TimeWindowBegin { set; get; }
/// <summary>
4 years ago
/// 时间窗口结束(Time Window End)
/// </summary>
4 years ago
[Display(Name = "时间窗口结束(TimeWindowEnd)")]
public DateTime TimeWindowEnd { set; get; }
/// <summary>
/// 地点(Site)
/// </summary>
[Display(Name = "地点(Site)")]
public string Site { set; get; }
/// <summary>
/// 公司(IAC company code)
/// </summary>
4 years ago
[Display(Name = "公司(Company)")]
public string Company { set; get; }
/// <summary>
/// 备注(Remark)
/// </summary>
[Display(Name = "备注(Remark)")]
public string Remark { set; get; }
4 years ago
/// <summary>
4 years ago
/// 是否已读(IsRead)
4 years ago
/// </summary>
4 years ago
[Display(Name = "是否已读(IsRead)")]
public bool IsRead { set; get; }
4 years ago
public virtual List<ASNDetail> ASNDetails { get; set; }
#region details handler
public virtual void AddDetail(IGuidGenerator guidGenerator, ASNDetail detail)
{
Check.NotNull(guidGenerator, nameof(guidGenerator));
Check.NotNull(detail, nameof(ASNDetail));
if (IsInDetails(detail.PoNumber, detail.PoLine))
{
throw new Exception(detail.PoNumber + detail.PoLine + "已经在明细中存在!");
}
4 years ago
ASNDetails.Add(new ASNDetail(guidGenerator.Create(), detail.AsnNumber, detail.PoNumber, detail.PoLine, detail.PartCode, detail.Lot, detail.SupplierLot, detail.ProductionDate,
detail.Uom, detail.DeliverQty, detail.StdPackUom, detail.StdPackQty, detail.SupplierPackUom,detail.SupplierPackQty,detail.SupplierPackConvertRate, detail.LabelCode,detail.BarCode,detail.PalletLabelCode));
}
public virtual void AddDetails(IGuidGenerator guidGenerator, IEnumerable<ASNDetail> details)
{
Check.NotNull(guidGenerator, nameof(guidGenerator));
foreach (var detail in details)
{
AddDetail(guidGenerator, detail);
}
}
public virtual bool IsInDetails(string ponumber, string poline)
{
return ASNDetails.Any(di => di.PoNumber == ponumber && di.PoLine == poline);
}
public virtual bool IsInDetails(Guid itemId)
{
return ASNDetails.Any(di => di.Id == itemId);
}
public virtual bool UpdateDetail(IGuidGenerator guidGenerator, ASNDetail detail)
{
Check.NotNull(detail, nameof(ASNDetail));
var item = FindDetail(detail.Id);
if (item == null)
{
AddDetail(guidGenerator, detail);
}
else
{
Check.NotNull(item, nameof(ASNDetail));
//item.Set(detail.Remark, detail.Enabled);
}
return true;
}
public virtual ASNDetail FindDetail(Guid itemId)
{
var item = ASNDetails.FirstOrDefault(p => p.Id == itemId);
return item;
}
#endregion
4 years ago
}
}