215 lines
10 KiB
C#
215 lines
10 KiB
C#
using Model;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
public class SESReportService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取数据
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public static Model.FC_SESReport GetSESReportById(string id)
|
|
{
|
|
return Funs.DB.FC_SESReport.FirstOrDefault(e => e.ID == Convert.ToInt32(id));
|
|
}
|
|
|
|
public static Model.FC_SESReport GetSESReportBySESNo(string sesNo)
|
|
{
|
|
return Funs.DB.FC_SESReport.FirstOrDefault(e => e.SES_No == sesNo);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加
|
|
/// </summary>
|
|
/// <param name="sesReport"></param>
|
|
public static void AddSESReport(Model.FC_SESReport sesReport)
|
|
{
|
|
Model.FC_SESReport newSESReport = new Model.FC_SESReport();
|
|
newSESReport.ID = sesReport.ID;
|
|
newSESReport.SES_No = sesReport.SES_No;
|
|
newSESReport.Short_Descrption = sesReport.Short_Descrption;
|
|
newSESReport.Start_Date = sesReport.Start_Date;
|
|
newSESReport.End_Date = sesReport.End_Date;
|
|
newSESReport.Created_by = sesReport.Created_by;
|
|
newSESReport.Created_on = sesReport.Created_on;
|
|
newSESReport.TECO_Date = sesReport.TECO_Date;
|
|
newSESReport.TECO_Format = sesReport.TECO_Format;
|
|
newSESReport.Requisitioner = sesReport.Requisitioner;
|
|
newSESReport.FO = sesReport.FO;
|
|
newSESReport.Item = sesReport.Item;
|
|
newSESReport.Vendor_Name = sesReport.Vendor_Name;
|
|
newSESReport.Discipline = sesReport.Discipline;
|
|
newSESReport.SSR_budget = sesReport.SSR_budget;
|
|
newSESReport.Currency = sesReport.Currency;
|
|
newSESReport.Contractor_quotation = sesReport.Contractor_quotation;
|
|
newSESReport.SSR_Actual_cost = sesReport.SSR_Actual_cost;
|
|
newSESReport.Cost_checker = sesReport.Cost_checker;
|
|
newSESReport.Tax_rate = sesReport.Tax_rate;
|
|
newSESReport.Changed_by = sesReport.Changed_by;
|
|
newSESReport.Deviation = sesReport.Deviation;
|
|
newSESReport.Deviation_Percentage = sesReport.Deviation_Percentage;
|
|
newSESReport.Overrun = sesReport.Overrun;
|
|
newSESReport.Long_text = sesReport.Long_text;
|
|
newSESReport.Work_Order = sesReport.Work_Order;
|
|
newSESReport.Function_location = sesReport.Function_location;
|
|
newSESReport.Main_work_center = sesReport.Main_work_center;
|
|
newSESReport.Work_Center = sesReport.Work_Center;
|
|
newSESReport.Dep = sesReport.Dep;
|
|
newSESReport.Section = sesReport.Section;
|
|
newSESReport.Cost_center = sesReport.Cost_center;
|
|
newSESReport.WBS = sesReport.WBS;
|
|
newSESReport.Network = sesReport.Network;
|
|
newSESReport.TODAY = sesReport.TODAY;
|
|
newSESReport.Claim_sheets_receive = sesReport.Claim_sheets_receive;
|
|
newSESReport.CS_REC_Format = sesReport.CS_REC_Format;
|
|
newSESReport.No_SUBM_To_today = sesReport.No_SUBM_To_today;
|
|
newSESReport.Contractor_duration = sesReport.Contractor_duration;
|
|
newSESReport.Engineer_confirmed_o = sesReport.Engineer_confirmed_o;
|
|
newSESReport.ENG_CONF_Format = sesReport.ENG_CONF_Format;
|
|
newSESReport.No_BoQ_CONF_to_today = sesReport.No_BoQ_CONF_to_today;
|
|
newSESReport.BoQ_confirmation_dur = sesReport.BoQ_confirmation_dur;
|
|
newSESReport.SES_Confirmed_on = sesReport.SES_Confirmed_on;
|
|
newSESReport.SES_CONF_Format = sesReport.SES_CONF_Format;
|
|
newSESReport.No_SES_to_today = sesReport.No_SES_to_today;
|
|
newSESReport.Settlement_duration = sesReport.Settlement_duration;
|
|
newSESReport.Invoiced_on = sesReport.Invoiced_on;
|
|
newSESReport.Invoice_duration = sesReport.Invoice_duration;
|
|
newSESReport.Payment_made_on = sesReport.Payment_made_on;
|
|
newSESReport.Payment_duration = sesReport.Payment_duration;
|
|
newSESReport.DateIn = sesReport.DateIn;
|
|
newSESReport.Remark1 = sesReport.Remark1;
|
|
newSESReport.Remark2 = sesReport.Remark2;
|
|
newSESReport.Accepted = sesReport.Accepted;
|
|
newSESReport.Deleted = sesReport.Deleted;
|
|
newSESReport.Blocked = sesReport.Blocked;
|
|
Funs.DB.FC_SESReport.InsertOnSubmit(newSESReport);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="sesReport"></param>
|
|
public static void UpdateSESReport(FC_SESReport sesReport)
|
|
{
|
|
Model.FC_SESReport newSESReport = Funs.DB.FC_SESReport.FirstOrDefault(e => e.ID == sesReport.ID);
|
|
if (newSESReport!=null)
|
|
{
|
|
newSESReport.SES_No = sesReport.SES_No;
|
|
newSESReport.Short_Descrption = sesReport.Short_Descrption;
|
|
newSESReport.Start_Date = sesReport.Start_Date;
|
|
newSESReport.End_Date = sesReport.End_Date;
|
|
newSESReport.Created_by = sesReport.Created_by;
|
|
newSESReport.Created_on = sesReport.Created_on;
|
|
newSESReport.TECO_Date = sesReport.TECO_Date;
|
|
newSESReport.TECO_Format = sesReport.TECO_Format;
|
|
newSESReport.Requisitioner = sesReport.Requisitioner;
|
|
newSESReport.FO = sesReport.FO;
|
|
newSESReport.Item = sesReport.Item;
|
|
newSESReport.Vendor_Name = sesReport.Vendor_Name;
|
|
newSESReport.Discipline = sesReport.Discipline;
|
|
newSESReport.SSR_budget = sesReport.SSR_budget;
|
|
newSESReport.Currency = sesReport.Currency;
|
|
newSESReport.Contractor_quotation = sesReport.Contractor_quotation;
|
|
newSESReport.SSR_Actual_cost = sesReport.SSR_Actual_cost;
|
|
newSESReport.Cost_checker = sesReport.Cost_checker;
|
|
newSESReport.Tax_rate = sesReport.Tax_rate;
|
|
newSESReport.Changed_by = sesReport.Changed_by;
|
|
newSESReport.Deviation = sesReport.Deviation;
|
|
newSESReport.Deviation_Percentage = sesReport.Deviation_Percentage;
|
|
newSESReport.Overrun = sesReport.Overrun;
|
|
newSESReport.Long_text = sesReport.Long_text;
|
|
newSESReport.Work_Order = sesReport.Work_Order;
|
|
newSESReport.Function_location = sesReport.Function_location;
|
|
newSESReport.Main_work_center = sesReport.Main_work_center;
|
|
newSESReport.Work_Center = sesReport.Work_Center;
|
|
newSESReport.Dep = sesReport.Dep;
|
|
newSESReport.Section = sesReport.Section;
|
|
newSESReport.Cost_center = sesReport.Cost_center;
|
|
newSESReport.WBS = sesReport.WBS;
|
|
newSESReport.Network = sesReport.Network;
|
|
newSESReport.TODAY = sesReport.TODAY;
|
|
newSESReport.Claim_sheets_receive = sesReport.Claim_sheets_receive;
|
|
newSESReport.CS_REC_Format = sesReport.CS_REC_Format;
|
|
newSESReport.No_SUBM_To_today = sesReport.No_SUBM_To_today;
|
|
newSESReport.Contractor_duration = sesReport.Contractor_duration;
|
|
newSESReport.Engineer_confirmed_o = sesReport.Engineer_confirmed_o;
|
|
newSESReport.ENG_CONF_Format = sesReport.ENG_CONF_Format;
|
|
newSESReport.No_BoQ_CONF_to_today = sesReport.No_BoQ_CONF_to_today;
|
|
newSESReport.BoQ_confirmation_dur = sesReport.BoQ_confirmation_dur;
|
|
newSESReport.SES_Confirmed_on = sesReport.SES_Confirmed_on;
|
|
newSESReport.SES_CONF_Format = sesReport.SES_CONF_Format;
|
|
newSESReport.No_SES_to_today = sesReport.No_SES_to_today;
|
|
newSESReport.Settlement_duration = sesReport.Settlement_duration;
|
|
newSESReport.Invoiced_on = sesReport.Invoiced_on;
|
|
newSESReport.Invoice_duration = sesReport.Invoice_duration;
|
|
newSESReport.Payment_made_on = sesReport.Payment_made_on;
|
|
newSESReport.Payment_duration = sesReport.Payment_duration;
|
|
newSESReport.DateIn = sesReport.DateIn;
|
|
newSESReport.Remark1 = sesReport.Remark1;
|
|
newSESReport.Remark2 = sesReport.Remark2;
|
|
newSESReport.Accepted = sesReport.Accepted;
|
|
newSESReport.Deleted = sesReport.Deleted;
|
|
newSESReport.Blocked = sesReport.Blocked;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除数据
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
public static void DeleteSESReportById(string id)
|
|
{
|
|
Model.FC_SESReport SESReport = Funs.DB.FC_SESReport.FirstOrDefault(e => e.ID == Convert.ToInt32(id));
|
|
if (SESReport!=null)
|
|
{
|
|
Funs.DB.FC_SESReport.DeleteOnSubmit(SESReport);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据合同号删除SES
|
|
/// </summary>
|
|
/// <param name="fo"></param>
|
|
public static void DeleteSESReportByFO(string fo)
|
|
{
|
|
var ses = (from x in Funs.DB.FC_SESReport where x.FO == fo select x).ToList();
|
|
if (ses!=null)
|
|
{
|
|
Funs.DB.FC_SESReport.DeleteAllOnSubmit(ses);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断SES_NO是否存在
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <param name="SES_No"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExistSES_No(string SES_No)
|
|
{
|
|
bool isExist = false;
|
|
var fono = Funs.DB.FC_SESReport.FirstOrDefault(x => x.SES_No == SES_No);
|
|
if (fono != null)
|
|
{
|
|
isExist = true;
|
|
}
|
|
return isExist;
|
|
}
|
|
|
|
public static decimal? getSumSSRActualCostByFo(string fo)
|
|
{
|
|
return (from x in Funs.DB.FC_SESReport
|
|
where x.FO == fo
|
|
select x.SSR_Actual_cost).Sum();
|
|
}
|
|
|
|
}
|
|
}
|