using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace wispro.sp.entity
{
///
/// 绩效事项清单
///
public class PerformanceItem
{
public PerformanceItem()
{
ItemStaffs = new HashSet();
AllocationRatios = new HashSet();
}
///
/// 编号
///
public int Id { get; set; }
///
/// 我方文号
///
public string CaseNo { get; set; }
///
/// 申请类型
///
public string ApplicationType { get; set; }
///
/// 业务类型
///
public string BusinessType { get; set; }
///
/// 代理人反馈Memo
///
public string AgentFeedbackMemo { get; set; }
///
/// 处理事项
///
public string DoItem { get; set; }
///
/// 案件阶段
///
public string CaseStage { get; set; }
///
/// 案件系数
///
public string CaseCoefficient { get; set; }
///
/// 处理事项系数
///
public string DoItemCoefficient { get; set; }
///
/// 前一次OA处理人Id
///
public int? PreOastaffId { get; set; }
///
/// 核稿人Id
///
public int? ReviewerId { get; set; }
///
/// 对外处理人Id
///
public int? ExternalHandlerId { get; set; }
///
/// 客户Id
///
public int? CustomerId { get; set; }
///
/// 申请人
///
public string ApplicationName { get; set; }
///
/// 处理事项完成日
///
public DateTime? FinishedDate { get; set; }
///
/// 定稿日
///
public DateTime? FinalizationDate { get; set; }
///
/// 返稿日
///
public DateTime? ReturnDate { get; set; }
///
/// 案件类型
///
public string CaseType { get; set; }
///
/// 案件状态
///
public string CaseState { get; set; }
///
/// 处理事项备注
///
public string DoItemMemo { get; set; }
///
/// 处理状态
///
public string DoItemState { get; set; }
///
/// 案件名称
///
public string CaseName { get; set; }
///
/// 客户期限
///
public DateTime? CustomerLimitDate { get; set; }
///
/// 委托日期
///
public DateTime? EntrustingDate { get; set; }
///
/// 内部期限
///
public DateTime? InternalDate { get; set; }
///
/// 初稿日
///
public DateTime? FirstDraftDate { get; set; }
///
/// 备注(发文严重超期是否属客观原因,若为否,请填写原因)
///
public string OverDueMemo { get; set; }
///
/// 基础点数
///
public double? BasePoint { get; set; }
///
/// 绩效核算状态:
///
public int? Status { get; set; }
///
/// 案件备注
///
public string CaseMemo { get; set; }
///
/// 按翻译字数计算设定的字数值
///
public int? WordCount { get; set; }
///
/// 撤回案件编号
///
public string ReturnCasseNo { get; set; }
///
/// 国家或地区
///
public string Country { get; set; }
///
/// 绩效类型
///
public string Type { get; set; }
///
/// 客户
///
public virtual Customer Customer { get; set; }
///
/// 前一次OA处理人
///
[Description("前一次OA处理人")]
public virtual Staff PreOastaff { get; set; }
public virtual ICollection ItemStaffs { get; set; }
public virtual ICollection AllocationRatios { get; set; }
///
/// 核稿人
///
[Description("核稿人")]
public virtual Staff Reviewer { get; set; }
///
/// 客户处理人
///
[Description("客户处理人")]
public virtual Staff ExternalHandler { get; set; }
///
/// 流程负责人Id
///
public int? WorkflowUserId { get; set; }
///
/// 流程负责人
///
public virtual Staff WorkflowUser { get; set; }
public virtual CalMonth CalMonth { get; set; }
public int CalMonthId { get; set; }
///
/// 最终延迟天数,延迟申诉后由审核人确定
///
public int? FinallyDelayDays { get; set; }
public double getDelayDays()
{
if (!String.IsNullOrEmpty(DoItem) && DoItem.ToString() == "新申请")
{
if (Type == "其他新申请")
{
//最终延迟天数大于0
if (FinallyDelayDays != null && FinallyDelayDays.Value > 0)
{
return FinallyDelayDays.Value;
}
DateTime? dt1 = this.EntrustingDate;
DateTime? dt2 = this.FinishedDate;
if (dt2 == null)
{
dt2 = DateTime.Now;
}
return (dt2.Value - dt1.Value).TotalDays - 45;
}
else
{
DateTime dt1 = DateTime.Now;
if (ReturnDate != null)
{
dt1 = ReturnDate.Value;
}
else
{
if (FinishedDate != null)
{
dt1 = FinishedDate.Value;
}
}
DateTime dt2 = DateTime.MinValue;
if (CustomerLimitDate != null)
{
dt2 = CustomerLimitDate.Value;
}
else
{
if (InternalDate != null)
{
dt2 = InternalDate.Value;
}
else
{
if (EntrustingDate != null)
{
dt2 = EntrustingDate.Value;
}
}
}
return (dt1 - dt2).TotalDays;
}
}
return 0.0;
}
public bool isDanger()
{
if (!String.IsNullOrEmpty(DoItem) && DoItem.ToString() == "新申请")
{
if(Type == "其他新申请")
{
return getDelayDays() > 0;
//return _OtherAppCalDanger();
}
else
{
return getDelayDays() > 30;
}
}
return false;
}
private bool _OtherAppCalDanger()
{
//最终延迟天数大于0
if (FinallyDelayDays != null && FinallyDelayDays.Value > 0)
{
return true;
}
DateTime? dt1 = this.EntrustingDate;
DateTime? dt2 = this.FinishedDate;
if (dt2 == null)
{
dt2 = DateTime.Now;
}
return (dt2.Value - dt1.Value).TotalDays > 45;
}
}
}