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.
 
 
 
 
 

132 lines
3.7 KiB

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