125 lines
3.9 KiB
C#
125 lines
3.9 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel.DataAnnotations;
|
|||
|
using System.ComponentModel.DataAnnotations.Schema;
|
|||
|
using System.Data.Entity.Core.Objects;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Runtime.Serialization;
|
|||
|
using Resources;
|
|||
|
using Newtonsoft.Json;
|
|||
|
using Weee.Models.Survey_form_metadata;
|
|||
|
using Weee.Models.ExtensionMethods;
|
|||
|
|
|||
|
namespace Weee.Models
|
|||
|
{
|
|||
|
[Table("ProductLCA")]
|
|||
|
public class ProductLCA : LCA
|
|||
|
{
|
|||
|
public ProductLCA()
|
|||
|
: base()
|
|||
|
{
|
|||
|
Materials = new HashSet<Material>();
|
|||
|
TransportSheet = new HashSet<Transport>();
|
|||
|
WaterUsageSheet = new HashSet<WaterUsage>();
|
|||
|
WasteSheet = new HashSet<Waste>();
|
|||
|
WasteTransportSheet = new HashSet<WasteTransport>();
|
|||
|
OtherCompoundSheet = new HashSet<OtherCompound>();
|
|||
|
|
|||
|
}
|
|||
|
public int? PCRID { get; set; }
|
|||
|
[ForeignKey("PCRID")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual PCR PCR { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Material> Materials { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<WaterUsage> WaterUsageSheet { get; set; }
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Transport> TransportSheet { get; set; }
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<Waste> WasteSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<WasteTransport> WasteTransportSheet { get; set; }
|
|||
|
|
|||
|
[InverseProperty("OwnerLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<OtherCompound> OtherCompoundSheet { get; set; }
|
|||
|
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual AbandonedStage AbandonedStage { get; set; }
|
|||
|
|
|||
|
[InverseProperty("RepliedByWhichLCA")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual ICollection<ProductLCAReplyRequest> RepliedRequests { get; set; }
|
|||
|
|
|||
|
public int? ProductID { get; set; }
|
|||
|
[ForeignKey("ProductID")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual Product TargetProduct { get; set; }
|
|||
|
|
|||
|
public int? FabID { get; set; }
|
|||
|
[ForeignKey("FabID")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual Fab TargetFab { get; set; }
|
|||
|
|
|||
|
public int? InventoryStageDataID { get; set; }
|
|||
|
[ForeignKey("InventoryStageDataID")]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual InventoryStageData TargetInventoryStageData { get; set; }
|
|||
|
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public virtual SnapShotSurveyResult SnapShotSurveyResult { get; set; }
|
|||
|
|
|||
|
|
|||
|
public decimal? FabProductionWeight { get; set; }
|
|||
|
public decimal? FabProductionArea { get; set; }
|
|||
|
public decimal? FabProductionHour { get; set; }
|
|||
|
public decimal? ProductProductionPcs { get; set; }
|
|||
|
public decimal? ProductProductionHour { get; set; }
|
|||
|
public decimal? DistributeKgCO2eInWeight { get; set; }
|
|||
|
public decimal? DistributeKgCO2eInArea { get; set; }
|
|||
|
public decimal? DistributeKgCO2eInWorkHour { get; set; }
|
|||
|
[NotMapped]
|
|||
|
public bool CanReplyOtherRequest
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return PCRID == null && Status == LCAStatus.Confirmed;
|
|||
|
}
|
|||
|
}
|
|||
|
[NotMapped]
|
|||
|
[JsonIgnore]
|
|||
|
[IgnoreDataMember]
|
|||
|
public ICollection<ProductLCAReplyRequest> SentRequests
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
var a = Materials.Where(x => x.RequestSent != null).Select(x => x.RequestSent).ToList();
|
|||
|
return a;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|