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.

133 lines
3.7 KiB

1 year ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using ChangKeTec.Wms.Models.Enums;
using CK.SCP.Models;
namespace ChangKeTec.Wms.Models.Wms
{
public partial class TF_PO_DETAIL
{
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public int UID { get; set; }
[NotMapped]
public string ϸ״̬ => ((EnumFormState)State).ToString();
[Key]
[Column(Order = 0)]
[StringLength(50)]
[DisplayName("������")]
public string BillNum { get; set; }
[Key]
[Column(Order = 1)]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[DisplayName("�к�")]
public int LineNum { get; set; }
[Required(AllowEmptyStrings = true)]
[StringLength(50)]
[DisplayName("������")]
public string PartCode { get; set; }
[NotMapped]
[DisplayName("����һ")]
public string PartDesc1 => WmsCache.GetPartDesc1(PartCode);
[NotMapped]
[DisplayName("������")]
public string PartDesc2 => WmsCache.GetPartDesc2(PartCode);
[NotMapped]
[DisplayName("��Ӧ��������")]
public string VendPartCode => WmsCache.GetVendPartCode(VendId, PartCode);
[Column(TypeName = "money")]
[DisplayName("��������")]
public decimal BillQty { get; set; }
[Column(TypeName = "money")]
[DisplayName("�ѽ�����")]
public decimal ClosedQty { get; set; }
[NotMapped]
[DisplayName("�����")]
public decimal OpenQty => BillQty - ClosedQty;
[Column(TypeName = "money")]
[DisplayName("������")]
public decimal PackQty { get; set; }
[StringLength(50)]
[DisplayName("�ɹ���λ")]
public string PoUnit { get; set; }
[StringLength(50)]
[DisplayName("�洢��λ")]
public string LocUnit { get; set; }
[Column(TypeName = "money")]
[DisplayName("����")]
public decimal Price { get; set; }
[NotMapped]
[DisplayName("��������")]
public DateTime? BillTIme => GetBillTime(BillNum);
[Column(TypeName = "date")]
[DisplayName("��ֹ����")]
public DateTime? DueDate { get; set; }
public int State { get; set; }
[StringLength(200)]
[DisplayName("��ע")]
public string Remark { get; set; }
public decimal UmConv { get; set; } = 1;
[NotMapped]
[DisplayName("��Ӧ�̱���")]
public string VendId => GetVendId(BillNum);
[NotMapped]
[DisplayName("��Ӧ������")]
public string VendName => WmsCache.GetVenderName(VendId);
[NotMapped]
[DisplayName("��Ӧ�̼���")]
public string VendAbbr => WmsCache.GetVendAbbr(VendId);
//[NotMapped]
//[DisplayName("QLevel")]
//public string QLevel => WmsCache.GetPartQlevel(PartCode);
List<TF_PO> _poList = new List<TF_PO>();
private string GetVendId(string billNum)
{
var db = EntitiesFactory.CreateWmsInstance();
if (_poList.Count == 0)
_poList = db.TF_PO.ToList();
var po = _poList.FirstOrDefault(p => p.BillNum == billNum);
return po?.VendId ?? "";
}
private DateTime? GetBillTime(string billNum)
{
var db = EntitiesFactory.CreateWmsInstance();
if (_poList.Count == 0)
_poList = db.TF_PO.ToList();
var po = _poList.FirstOrDefault(p => p.BillNum == billNum);
return po?.BillTime;
}
}
}