212 lines
11 KiB
C#
212 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 项目级施工日志
|
|
/// </summary>
|
|
public static class CQMSConstructionLogService
|
|
{
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
/// <summary>
|
|
/// 根据主键获取项目级施工日志
|
|
/// </summary>
|
|
/// <param name="ConstructionLogId"></param>
|
|
/// <returns></returns>
|
|
public static Model.CQMS_ConstructionLog GetConstructionLogById(string ConstructionLogId)
|
|
{
|
|
return Funs.DB.CQMS_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId == ConstructionLogId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据项目、用户及日期获取项目级施工日志
|
|
/// </summary>
|
|
/// <param name="ConstructionLogId"></param>
|
|
/// <returns></returns>
|
|
public static Model.CQMS_ConstructionLog GetConstructionLogByProjectIdAndUserIDAndDate(string constructionLogId, string projectId, string userId, DateTime date)
|
|
{
|
|
return Funs.DB.CQMS_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId != constructionLogId && e.ProjectId == projectId && e.CompileMan == userId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加项目级施工日志
|
|
/// </summary>
|
|
/// <param name="ConstructionLog"></param>
|
|
public static void AddConstructionLog(Model.CQMS_ConstructionLog ConstructionLog)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.CQMS_ConstructionLog newConstructionLog = new Model.CQMS_ConstructionLog
|
|
{
|
|
ConstructionLogId = ConstructionLog.ConstructionLogId,
|
|
ProjectId = ConstructionLog.ProjectId,
|
|
LogDate = ConstructionLog.LogDate,
|
|
WeatherAM = ConstructionLog.WeatherAM,
|
|
WeatherPM = ConstructionLog.WeatherPM,
|
|
Weather = ConstructionLog.Weather,
|
|
DayTemperature = ConstructionLog.DayTemperature,
|
|
DayTemperatureMax = ConstructionLog.DayTemperatureMax,
|
|
NightTemperature = ConstructionLog.NightTemperature,
|
|
NightTemperatureMax = ConstructionLog.NightTemperatureMax,
|
|
WeatherRemark = ConstructionLog.WeatherRemark,
|
|
UnitId = ConstructionLog.UnitId,
|
|
ProgressAndWorkSituation = ConstructionLog.ProgressAndWorkSituation,
|
|
ConstructionManager = ConstructionLog.ConstructionManager,
|
|
SafetyGuardian = ConstructionLog.SafetyGuardian,
|
|
ConstructionWorker = ConstructionLog.ConstructionWorker,
|
|
MechanicNum = ConstructionLog.MechanicNum,
|
|
LabourNum = ConstructionLog.LabourNum,
|
|
MainConstructionMachine = ConstructionLog.MainConstructionMachine,
|
|
ConstructionContent = ConstructionLog.ConstructionContent,
|
|
ConstructionEnvironment = ConstructionLog.ConstructionEnvironment,
|
|
SafetyWorkSituation = ConstructionLog.SafetyWorkSituation,
|
|
SafetyAndQualityMeasures = ConstructionLog.SafetyAndQualityMeasures,
|
|
HabituaViolations = ConstructionLog.HabituaViolations,
|
|
SafetyStandardization = ConstructionLog.SafetyStandardization,
|
|
CivilizedConstruction = ConstructionLog.CivilizedConstruction,
|
|
Equipment1 = ConstructionLog.Equipment1,
|
|
Equipment2 = ConstructionLog.Equipment2,
|
|
Equipment3 = ConstructionLog.Equipment3,
|
|
Equipment4 = ConstructionLog.Equipment4,
|
|
Equipment5 = ConstructionLog.Equipment5,
|
|
Equipment6 = ConstructionLog.Equipment6,
|
|
Equipment7 = ConstructionLog.Equipment7,
|
|
Equipment8 = ConstructionLog.Equipment8,
|
|
Equipment9 = ConstructionLog.Equipment9,
|
|
Equipment10 = ConstructionLog.Equipment10,
|
|
ProcessHandover = ConstructionLog.ProcessHandover,
|
|
WorkArrangement = ConstructionLog.WorkArrangement,
|
|
MeetingSituation = ConstructionLog.MeetingSituation,
|
|
VisaRecords = ConstructionLog.VisaRecords,
|
|
UnresolvedIssues = ConstructionLog.UnresolvedIssues,
|
|
FileProcessing = ConstructionLog.FileProcessing,
|
|
RectificationOfIssues = ConstructionLog.RectificationOfIssues,
|
|
ImportantEvents = ConstructionLog.ImportantEvents,
|
|
ProblemAndCauseAnalysis = ConstructionLog.ProblemAndCauseAnalysis,
|
|
CompileMan = ConstructionLog.CompileMan,
|
|
CompileDate = ConstructionLog.CompileDate,
|
|
State = ConstructionLog.State,
|
|
};
|
|
db.CQMS_ConstructionLog.InsertOnSubmit(newConstructionLog);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改项目级施工日志
|
|
/// </summary>
|
|
/// <param name="ConstructionLog"></param>
|
|
public static void UpdateConstructionLog(Model.CQMS_ConstructionLog ConstructionLog)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.CQMS_ConstructionLog newConstructionLog = db.CQMS_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId == ConstructionLog.ConstructionLogId);
|
|
if (newConstructionLog != null)
|
|
{
|
|
newConstructionLog.LogDate = ConstructionLog.LogDate;
|
|
newConstructionLog.Weather = ConstructionLog.Weather;
|
|
newConstructionLog.WeatherAM = ConstructionLog.WeatherAM;
|
|
newConstructionLog.WeatherPM = ConstructionLog.WeatherPM;
|
|
newConstructionLog.Weather = ConstructionLog.Weather;
|
|
newConstructionLog.DayTemperature = ConstructionLog.DayTemperature;
|
|
newConstructionLog.DayTemperatureMax = ConstructionLog.DayTemperatureMax;
|
|
newConstructionLog.NightTemperature = ConstructionLog.NightTemperature;
|
|
newConstructionLog.NightTemperatureMax = ConstructionLog.NightTemperatureMax;
|
|
newConstructionLog.WeatherRemark = ConstructionLog.WeatherRemark;
|
|
newConstructionLog.UnitId = ConstructionLog.UnitId;
|
|
newConstructionLog.ProgressAndWorkSituation = ConstructionLog.ProgressAndWorkSituation;
|
|
newConstructionLog.ConstructionManager = ConstructionLog.ConstructionManager;
|
|
newConstructionLog.SafetyGuardian = ConstructionLog.SafetyGuardian;
|
|
newConstructionLog.ConstructionWorker = ConstructionLog.ConstructionWorker;
|
|
newConstructionLog.MechanicNum = ConstructionLog.MechanicNum;
|
|
newConstructionLog.LabourNum = ConstructionLog.LabourNum;
|
|
newConstructionLog.MainConstructionMachine = ConstructionLog.MainConstructionMachine;
|
|
newConstructionLog.ConstructionContent = ConstructionLog.ConstructionContent;
|
|
newConstructionLog.ConstructionEnvironment = ConstructionLog.ConstructionEnvironment;
|
|
newConstructionLog.SafetyWorkSituation = ConstructionLog.SafetyWorkSituation;
|
|
newConstructionLog.SafetyAndQualityMeasures = ConstructionLog.SafetyAndQualityMeasures;
|
|
newConstructionLog.HabituaViolations = ConstructionLog.HabituaViolations;
|
|
newConstructionLog.SafetyStandardization = ConstructionLog.SafetyStandardization;
|
|
newConstructionLog.CivilizedConstruction = ConstructionLog.CivilizedConstruction;
|
|
newConstructionLog.Equipment1 = ConstructionLog.Equipment1;
|
|
newConstructionLog.Equipment2 = ConstructionLog.Equipment2;
|
|
newConstructionLog.Equipment3 = ConstructionLog.Equipment3;
|
|
newConstructionLog.Equipment4 = ConstructionLog.Equipment4;
|
|
newConstructionLog.Equipment5 = ConstructionLog.Equipment5;
|
|
newConstructionLog.Equipment6 = ConstructionLog.Equipment6;
|
|
newConstructionLog.Equipment7 = ConstructionLog.Equipment7;
|
|
newConstructionLog.Equipment8 = ConstructionLog.Equipment8;
|
|
newConstructionLog.Equipment9 = ConstructionLog.Equipment9;
|
|
newConstructionLog.Equipment10 = ConstructionLog.Equipment10;
|
|
newConstructionLog.ProcessHandover = ConstructionLog.ProcessHandover;
|
|
newConstructionLog.WorkArrangement = ConstructionLog.WorkArrangement;
|
|
newConstructionLog.MeetingSituation = ConstructionLog.MeetingSituation;
|
|
newConstructionLog.VisaRecords = ConstructionLog.VisaRecords;
|
|
newConstructionLog.UnresolvedIssues = ConstructionLog.UnresolvedIssues;
|
|
newConstructionLog.FileProcessing = ConstructionLog.FileProcessing;
|
|
newConstructionLog.RectificationOfIssues = ConstructionLog.RectificationOfIssues;
|
|
newConstructionLog.ImportantEvents = ConstructionLog.ImportantEvents;
|
|
newConstructionLog.ProblemAndCauseAnalysis = ConstructionLog.ProblemAndCauseAnalysis;
|
|
newConstructionLog.State = ConstructionLog.State;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除项目级施工日志
|
|
/// </summary>
|
|
/// <param name="ConstructionLogId"></param>
|
|
public static void DeleteConstructionLogById(string ConstructionLogId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.CQMS_ConstructionLog ConstructionLog = db.CQMS_ConstructionLog.FirstOrDefault(e => e.ConstructionLogId == ConstructionLogId);
|
|
if (ConstructionLog != null)
|
|
{
|
|
////删除附件表
|
|
BLL.CommonService.DeleteAttachFileById(ConstructionLog.ConstructionLogId);
|
|
db.CQMS_ConstructionLog.DeleteOnSubmit(ConstructionLog);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
public static void Init(FineUIPro.DropDownList dropName, string state, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "Value";
|
|
dropName.DataTextField = "Text";
|
|
dropName.DataSource = GetDHandleTypeByState(state);
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据状态选择下一步办理类型
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
public static ListItem[] GetDHandleTypeByState(string state)
|
|
{
|
|
if (state == Const.ConstructionLog_Compile || state == Const.ConstructionLog_ReCompile) //无是否同意
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("审核", Const.ConstructionLog_Audit);
|
|
return lis;
|
|
}
|
|
else if (state == Const.ConstructionLog_Audit)//有是否同意
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("审批完成", Const.ConstructionLog_Complete);//是 加载
|
|
lis[1] = new ListItem("重新编制", Const.ConstructionLog_ReCompile);//否加载
|
|
return lis;
|
|
}
|
|
else
|
|
return null;
|
|
}
|
|
}
|
|
}
|