新增管道颜色标识导入功能及API控制器
更新了多个服务和页面,增加了导入管道颜色标识数据的功能,并实现了包装管理、车次管理、管道组件和焊口信息的API控制器。修正了文件路径错误,优化了分页和排序逻辑,删除了不再使用的API方法。
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using FineUIPro;
|
||||
|
||||
namespace FineUIPro.Web.common.ProjectSet
|
||||
{
|
||||
@@ -48,595 +50,292 @@ namespace FineUIPro.Web.common.ProjectSet
|
||||
ShowNotify("请选择项目!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
#region 焊接
|
||||
// 焊接
|
||||
Model.Project_Sys_Set dayReport = BLL.Project_SysSetService.GetSysSetBySetId("1", projectId);
|
||||
Model.Project_Sys_Set point = BLL.Project_SysSetService.GetSysSetBySetId("2", projectId);
|
||||
Model.Project_Sys_Set trust = BLL.Project_SysSetService.GetSysSetBySetId("3", projectId);
|
||||
Model.Project_Sys_Set pdms = BLL.Project_SysSetService.GetSysSetBySetId("4", projectId);
|
||||
Model.Project_Sys_Set batch = BLL.Project_SysSetService.GetSysSetBySetId("5", projectId);
|
||||
Model.Project_Sys_Set jointB = BLL.Project_SysSetService.GetSysSetBySetId("6", projectId);
|
||||
Model.Project_Sys_Set thickness = BLL.Project_SysSetService.GetSysSetBySetId("7", projectId);
|
||||
Model.Project_Sys_Set pressUnit = BLL.Project_SysSetService.GetSysSetBySetId("8", projectId);
|
||||
Model.Project_Sys_Set AvevaNetUrl = BLL.Project_SysSetService.GetSysSetBySetId("9", projectId);
|
||||
Model.Project_Sys_Set PressMustCheckBItem = BLL.Project_SysSetService.GetSysSetBySetId("10", projectId);
|
||||
if (PressMustCheckBItem != null)
|
||||
{
|
||||
if (this.ckPressMustCheckBItem.Checked)
|
||||
{
|
||||
PressMustCheckBItem.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
PressMustCheckBItem.IsAuto = false;
|
||||
}
|
||||
BLL.Project_SysSetService.UpdateSet(PressMustCheckBItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.Project_Sys_Set newPressMustCheckBItem = new Model.Project_Sys_Set();
|
||||
newPressMustCheckBItem.SetId = "10";
|
||||
newPressMustCheckBItem.ProjectId = projectId;
|
||||
if (this.ckPressMustCheckBItem.Checked)
|
||||
{
|
||||
newPressMustCheckBItem.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
newPressMustCheckBItem.IsAuto = false;
|
||||
}
|
||||
BLL.Project_SysSetService.AddSet(newPressMustCheckBItem);
|
||||
}
|
||||
if (jointB != null)
|
||||
{
|
||||
if (this.ckbJointB.Checked)
|
||||
{
|
||||
jointB.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
jointB.IsAuto = false;
|
||||
}
|
||||
BLL.Project_SysSetService.UpdateSet(jointB);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.Project_Sys_Set newJointB = new Model.Project_Sys_Set();
|
||||
newJointB.SetId = "6";
|
||||
newJointB.ProjectId = projectId;
|
||||
if (this.ckbJointB.Checked)
|
||||
{
|
||||
newJointB.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
newJointB.IsAuto = false;
|
||||
}
|
||||
BLL.Project_SysSetService.AddSet(newJointB);
|
||||
}
|
||||
if (pressUnit != null)
|
||||
{
|
||||
pressUnit.SetValue = this.rblPressUnit.SelectedValue;
|
||||
BLL.Project_SysSetService.UpdateSet(pressUnit);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.Project_Sys_Set newPressUnit = new Model.Project_Sys_Set();
|
||||
newPressUnit.SetId = "8";
|
||||
newPressUnit.SetValue = this.rblPressUnit.SelectedValue;
|
||||
newPressUnit.ProjectId = projectId;
|
||||
BLL.Project_SysSetService.AddSet(newPressUnit);
|
||||
}
|
||||
if (AvevaNetUrl != null)
|
||||
{
|
||||
AvevaNetUrl.SetValue = this.AvevaNetUrl.Text.Trim();
|
||||
BLL.Project_SysSetService.UpdateSet(AvevaNetUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.Project_Sys_Set newAvevaNetUrl = new Model.Project_Sys_Set();
|
||||
newAvevaNetUrl.SetId = "9";
|
||||
newAvevaNetUrl.SetName = "AVEVA NET 地址";
|
||||
newAvevaNetUrl.SetValue = this.AvevaNetUrl.Text.Trim();
|
||||
newAvevaNetUrl.ProjectId = projectId;
|
||||
BLL.Project_SysSetService.AddSet(newAvevaNetUrl);
|
||||
}
|
||||
if (thickness != null)
|
||||
{
|
||||
if (this.ckbThickness.Checked)
|
||||
{
|
||||
thickness.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
thickness.IsAuto = false;
|
||||
}
|
||||
BLL.Project_SysSetService.UpdateSet(thickness);
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.Project_Sys_Set newThickness = new Model.Project_Sys_Set();
|
||||
newThickness.SetId = "7";
|
||||
newThickness.ProjectId = projectId;
|
||||
if (this.ckbThickness.Checked)
|
||||
{
|
||||
newThickness.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
newThickness.IsAuto = false;
|
||||
}
|
||||
BLL.Project_SysSetService.AddSet(newThickness);
|
||||
}
|
||||
if (this.ckbPdms.Checked)
|
||||
{
|
||||
pdms.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pdms.IsAuto = false;
|
||||
}
|
||||
|
||||
if (ckbDayReport.Checked)
|
||||
{
|
||||
dayReport.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dayReport.IsAuto = false;
|
||||
}
|
||||
SaveWeldingSettings(projectId);
|
||||
SaveColorModelSettings(projectId);
|
||||
SaveQualitySettings(projectId);
|
||||
|
||||
if (ckbPoint.Checked)
|
||||
{
|
||||
point.IsAuto = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
point.IsAuto = false;
|
||||
}
|
||||
|
||||
if (robStandard.SelectedValue == "1")
|
||||
{
|
||||
trust.IsAuto = true;
|
||||
trust.SetValue = null;
|
||||
}
|
||||
else if (robStandard.SelectedValue == "2")
|
||||
{
|
||||
trust.IsAuto = false;
|
||||
trust.SetValue = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
trust.IsAuto = null;
|
||||
trust.SetValue = robStandard.SelectedValue;
|
||||
}
|
||||
string lists = string.Empty;
|
||||
if (cb1.Checked)
|
||||
{
|
||||
lists += "1|";
|
||||
}
|
||||
if (cb2.Checked)
|
||||
{
|
||||
lists += "2|";
|
||||
}
|
||||
if (cb3.Checked)
|
||||
{
|
||||
lists += "3|";
|
||||
}
|
||||
if (cb4.Checked)
|
||||
{
|
||||
lists += "4|";
|
||||
}
|
||||
if (cb5.Checked)
|
||||
{
|
||||
lists += "5|";
|
||||
}
|
||||
if (cb6.Checked)
|
||||
{
|
||||
lists += "6|";
|
||||
}
|
||||
if (cb7.Checked)
|
||||
{
|
||||
lists += "7|";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(lists))
|
||||
{
|
||||
lists = lists.Substring(0, lists.LastIndexOf('|'));
|
||||
batch.IsAuto = true;
|
||||
batch.SetValue = lists;
|
||||
}
|
||||
|
||||
BLL.Project_SysSetService.UpdateSet(dayReport);
|
||||
BLL.Project_SysSetService.UpdateSet(point);
|
||||
BLL.Project_SysSetService.UpdateSet(pdms);
|
||||
BLL.Project_SysSetService.UpdateSet(trust);
|
||||
BLL.Project_SysSetService.UpdateSet(batch);
|
||||
//this.Show(projectId);
|
||||
#endregion
|
||||
#region 颜色模型设置
|
||||
Model.Project_Sys_Set Model_PipelineNOComplete = BLL.Project_SysSetService.GetSysSetBySetName("管线未完成", this.CurrUser.LoginProjectId);
|
||||
if (Model_PipelineNOComplete != null)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtPipelineNOComplete.Text.Trim()))
|
||||
{
|
||||
Model_PipelineNOComplete.SetValue = this.txtPipelineNOComplete.Text.Trim();
|
||||
BLL.Project_SysSetService.UpdateSet(Model_PipelineNOComplete);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtPipelineNOComplete.Text.Trim()))
|
||||
{
|
||||
Model.Project_Sys_Set newModel_PipelineNOComplete = new Model.Project_Sys_Set()
|
||||
{
|
||||
SetId = SQLHelper.GetNewID(typeof(Model.Project_Sys_Set)),
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
SetName = "管线未完成",
|
||||
SetValue = this.txtPipelineNOComplete.Text.Trim(),
|
||||
};
|
||||
BLL.Project_SysSetService.AddSet(newModel_PipelineNOComplete);
|
||||
}
|
||||
}
|
||||
Model.Project_Sys_Set Model_PipelineComplete = BLL.Project_SysSetService.GetSysSetBySetName("管线已完成", this.CurrUser.LoginProjectId);
|
||||
if (Model_PipelineComplete != null)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtPipelineComplete.Text.Trim()))
|
||||
{
|
||||
Model_PipelineComplete.SetValue = this.txtPipelineComplete.Text.Trim();
|
||||
BLL.Project_SysSetService.UpdateSet(Model_PipelineComplete);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtPipelineComplete.Text.Trim()))
|
||||
{
|
||||
Model.Project_Sys_Set newModel = new Model.Project_Sys_Set()
|
||||
{
|
||||
SetId = SQLHelper.GetNewID(typeof(Model.Project_Sys_Set)),
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
SetName = "管线已完成",
|
||||
SetValue = this.txtPipelineComplete.Text.Trim(),
|
||||
};
|
||||
|
||||
BLL.Project_SysSetService.AddSet(newModel);
|
||||
}
|
||||
}
|
||||
Model.Project_Sys_Set Model_JointNOCompleteColor = BLL.Project_SysSetService.GetSysSetBySetName("焊口未完成", this.CurrUser.LoginProjectId);
|
||||
if (Model_JointNOCompleteColor != null)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(this.drpJointNOCompleteColor.SelectedValue.Trim()))
|
||||
{
|
||||
Model_JointNOCompleteColor.SetValue = this.drpJointNOCompleteColor.SelectedValue.Trim();
|
||||
BLL.Project_SysSetService.UpdateSet(Model_JointNOCompleteColor);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.drpJointNOCompleteColor.SelectedValue.Trim()))
|
||||
{
|
||||
Model.Project_Sys_Set newModel = new Model.Project_Sys_Set()
|
||||
{
|
||||
SetId = SQLHelper.GetNewID(typeof(Model.Project_Sys_Set)),
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
SetName = "焊口未完成",
|
||||
SetValue = this.drpJointNOCompleteColor.SelectedValue.Trim(),
|
||||
};
|
||||
|
||||
BLL.Project_SysSetService.AddSet(newModel);
|
||||
}
|
||||
}
|
||||
Model.Project_Sys_Set Model_JointCompleteColor = BLL.Project_SysSetService.GetSysSetBySetName("焊口已完成", this.CurrUser.LoginProjectId);
|
||||
if (Model_JointCompleteColor != null)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(this.drpJointCompleteColor.SelectedValue.Trim()))
|
||||
{
|
||||
Model_JointCompleteColor.SetValue = this.drpJointCompleteColor.SelectedValue.Trim();
|
||||
BLL.Project_SysSetService.UpdateSet(Model_JointCompleteColor);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.drpJointCompleteColor.SelectedValue.Trim()))
|
||||
{
|
||||
Model.Project_Sys_Set newModel = new Model.Project_Sys_Set()
|
||||
{
|
||||
SetId = SQLHelper.GetNewID(typeof(Model.Project_Sys_Set)),
|
||||
ProjectId = this.CurrUser.LoginProjectId,
|
||||
SetName = "焊口已完成",
|
||||
SetValue = this.drpJointCompleteColor.SelectedValue.Trim(),
|
||||
};
|
||||
|
||||
BLL.Project_SysSetService.AddSet(newModel);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region 质量
|
||||
|
||||
Model.Project_Sys_Set CheckEquipmentDay = BLL.Project_SysSetService.GetSysSetBySetName("检试验设备到期提醒天数", this.CurrUser.LoginProjectId);
|
||||
if (CheckEquipmentDay != null)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtRemindDay.Text.Trim()))
|
||||
{
|
||||
CheckEquipmentDay.SetValue = this.txtRemindDay.Text.Trim();
|
||||
BLL.Project_SysSetService.UpdateSet(CheckEquipmentDay);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtRemindDay.Text.Trim()))
|
||||
{
|
||||
Model.Project_Sys_Set newCheckEquipmentDay = new Model.Project_Sys_Set();
|
||||
newCheckEquipmentDay.SetId = SQLHelper.GetNewID(typeof(Model.Project_Sys_Set));
|
||||
|
||||
newCheckEquipmentDay.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newCheckEquipmentDay.SetName = "检试验设备到期提醒天数";
|
||||
newCheckEquipmentDay.SetValue = this.txtRemindDay.Text.Trim();
|
||||
BLL.Project_SysSetService.AddSet(newCheckEquipmentDay);
|
||||
}
|
||||
}
|
||||
Model.Project_Sys_Set CheckMonthStartDay = BLL.Project_SysSetService.GetSysSetBySetName("月报开始日期", this.CurrUser.LoginProjectId);
|
||||
if (CheckMonthStartDay != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtStarTime.Text.Trim()))
|
||||
{
|
||||
CheckMonthStartDay.SetValue = this.txtStarTime.Text.Trim();
|
||||
BLL.Project_SysSetService.UpdateSet(CheckMonthStartDay);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtStarTime.Text.Trim()))
|
||||
{
|
||||
Model.Project_Sys_Set newCheckEquipmentDay = new Model.Project_Sys_Set();
|
||||
newCheckEquipmentDay.SetId = SQLHelper.GetNewID(typeof(Model.Project_Sys_Set));
|
||||
newCheckEquipmentDay.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newCheckEquipmentDay.SetName = "月报开始日期";
|
||||
newCheckEquipmentDay.SetValue = this.txtStarTime.Text.Trim();
|
||||
BLL.Project_SysSetService.AddSet(newCheckEquipmentDay);
|
||||
}
|
||||
}
|
||||
Model.Project_Sys_Set CheckMonthEndDay = BLL.Project_SysSetService.GetSysSetBySetName("月报结束日期", this.CurrUser.LoginProjectId);
|
||||
if (CheckMonthEndDay != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
|
||||
{
|
||||
CheckMonthEndDay.SetValue = this.txtEndTime.Text.Trim();
|
||||
BLL.Project_SysSetService.UpdateSet(CheckMonthEndDay);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
|
||||
{
|
||||
Model.Project_Sys_Set newCheckEquipmentDay = new Model.Project_Sys_Set();
|
||||
newCheckEquipmentDay.SetId = SQLHelper.GetNewID(typeof(Model.Project_Sys_Set));
|
||||
newCheckEquipmentDay.ProjectId = this.CurrUser.LoginProjectId;
|
||||
newCheckEquipmentDay.SetName = "月报结束日期";
|
||||
newCheckEquipmentDay.SetValue = this.txtEndTime.Text.Trim();
|
||||
BLL.Project_SysSetService.AddSet(newCheckEquipmentDay);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
// 刷新界面
|
||||
this.Show(projectId);
|
||||
|
||||
//BLL.Sys_LogService.AddLog(BLL.Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.PersonId, "提交项目环境设置");
|
||||
Alert.ShowInTop("提交成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
|
||||
private void SaveWeldingSettings(string projectId)
|
||||
{
|
||||
// Booleans stored in IsAuto
|
||||
UpsertIsAutoById("1", projectId, this.ckbDayReport.Checked);
|
||||
UpsertIsAutoById("2", projectId, this.ckbPoint.Checked);
|
||||
// trust (id 3) uses special mapping: 1->IsAuto=true, 2->IsAuto=false, otherwise IsAuto=null and SetValue holds value
|
||||
UpsertTrustSetting("3", projectId, this.robStandard.SelectedValue);
|
||||
UpsertIsAutoById("4", projectId, this.ckbPdms.Checked);
|
||||
// batch (id 5) is a list of checked items
|
||||
UpsertBatchSetting("5", projectId);
|
||||
UpsertIsAutoById("6", projectId, this.ckbJointB.Checked);
|
||||
UpsertIsAutoById("7", projectId, this.ckbThickness.Checked);
|
||||
UpsertValueById("8", projectId, this.rblPressUnit.SelectedValue);
|
||||
UpsertValueById("9", projectId, this.AvevaNetUrl.Text.Trim(), setName: "AVEVA NET 地址");
|
||||
UpsertIsAutoById("10", projectId, this.ckPressMustCheckBItem.Checked);
|
||||
UpsertValueById("11", projectId, this.rbMaterialColorAttribute.SelectedValue);
|
||||
}
|
||||
|
||||
private void SaveColorModelSettings(string projectId)
|
||||
{
|
||||
UpsertByName("管线未完成", projectId, this.txtPipelineNOComplete.Text.Trim());
|
||||
UpsertByName("管线已完成", projectId, this.txtPipelineComplete.Text.Trim());
|
||||
UpsertByName("焊口未完成", projectId, this.drpJointNOCompleteColor.SelectedValue.Trim());
|
||||
UpsertByName("焊口已完成", projectId, this.drpJointCompleteColor.SelectedValue.Trim());
|
||||
}
|
||||
|
||||
private void SaveQualitySettings(string projectId)
|
||||
{
|
||||
UpsertByName("检试验设备到期提醒天数", projectId, this.txtRemindDay.Text.Trim());
|
||||
UpsertByName("月报开始日期", projectId, this.txtStarTime.Text.Trim());
|
||||
UpsertByName("月报结束日期", projectId, this.txtEndTime.Text.Trim());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Upsert Helpers
|
||||
private void UpsertIsAutoById(string setId, string projectId, bool value)
|
||||
{
|
||||
var existing = BLL.Project_SysSetService.GetSysSetBySetId(setId, projectId);
|
||||
if (existing != null)
|
||||
{
|
||||
existing.IsAuto = value;
|
||||
BLL.Project_SysSetService.UpdateSet(existing);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newSet = new Model.Project_Sys_Set
|
||||
{
|
||||
SetId = setId,
|
||||
ProjectId = projectId,
|
||||
IsAuto = value
|
||||
};
|
||||
BLL.Project_SysSetService.AddSet(newSet);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpsertValueById(string setId, string projectId, string value, string setName = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return;
|
||||
var existing = BLL.Project_SysSetService.GetSysSetBySetId(setId, projectId);
|
||||
if (existing != null)
|
||||
{
|
||||
existing.SetValue = value;
|
||||
if (!string.IsNullOrEmpty(setName)) existing.SetName = setName;
|
||||
BLL.Project_SysSetService.UpdateSet(existing);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newSet = new Model.Project_Sys_Set
|
||||
{
|
||||
SetId = setId,
|
||||
ProjectId = projectId,
|
||||
SetValue = value,
|
||||
SetName = setName
|
||||
};
|
||||
BLL.Project_SysSetService.AddSet(newSet);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpsertByName(string setName, string projectId, string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return;
|
||||
var existing = BLL.Project_SysSetService.GetSysSetBySetName(setName, projectId);
|
||||
if (existing != null)
|
||||
{
|
||||
existing.SetValue = value;
|
||||
BLL.Project_SysSetService.UpdateSet(existing);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newSet = new Model.Project_Sys_Set
|
||||
{
|
||||
SetId = SQLHelper.GetNewID(typeof(Model.Project_Sys_Set)),
|
||||
ProjectId = projectId,
|
||||
SetName = setName,
|
||||
SetValue = value
|
||||
};
|
||||
BLL.Project_SysSetService.AddSet(newSet);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpsertTrustSetting(string setId, string projectId, string selectedValue)
|
||||
{
|
||||
var existing = BLL.Project_SysSetService.GetSysSetBySetId(setId, projectId);
|
||||
if (existing != null)
|
||||
{
|
||||
if (selectedValue == "1")
|
||||
{
|
||||
existing.IsAuto = true;
|
||||
existing.SetValue = null;
|
||||
}
|
||||
else if (selectedValue == "2")
|
||||
{
|
||||
existing.IsAuto = false;
|
||||
existing.SetValue = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
existing.IsAuto = null;
|
||||
existing.SetValue = selectedValue;
|
||||
}
|
||||
BLL.Project_SysSetService.UpdateSet(existing);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newSet = new Model.Project_Sys_Set
|
||||
{
|
||||
SetId = setId,
|
||||
ProjectId = projectId
|
||||
};
|
||||
if (selectedValue == "1")
|
||||
{
|
||||
newSet.IsAuto = true;
|
||||
}
|
||||
else if (selectedValue == "2")
|
||||
{
|
||||
newSet.IsAuto = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
newSet.IsAuto = null;
|
||||
newSet.SetValue = selectedValue;
|
||||
}
|
||||
BLL.Project_SysSetService.AddSet(newSet);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpsertBatchSetting(string setId, string projectId)
|
||||
{
|
||||
var items = new List<string>();
|
||||
if (cb1.Checked) items.Add("1");
|
||||
if (cb2.Checked) items.Add("2");
|
||||
if (cb3.Checked) items.Add("3");
|
||||
if (cb4.Checked) items.Add("4");
|
||||
if (cb5.Checked) items.Add("5");
|
||||
if (cb6.Checked) items.Add("6");
|
||||
if (cb7.Checked) items.Add("7");
|
||||
|
||||
if (items.Count == 0) return;
|
||||
|
||||
var lists = string.Join("|", items);
|
||||
var existing = BLL.Project_SysSetService.GetSysSetBySetId(setId, projectId);
|
||||
if (existing != null)
|
||||
{
|
||||
existing.IsAuto = true;
|
||||
existing.SetValue = lists;
|
||||
BLL.Project_SysSetService.UpdateSet(existing);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newSet = new Model.Project_Sys_Set
|
||||
{
|
||||
SetId = setId,
|
||||
ProjectId = projectId,
|
||||
IsAuto = true,
|
||||
SetValue = lists
|
||||
};
|
||||
BLL.Project_SysSetService.AddSet(newSet);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 页面呈现
|
||||
/// <summary>
|
||||
///
|
||||
/// 页面呈现
|
||||
/// </summary>
|
||||
private void Show(string projectId)
|
||||
{
|
||||
var q = from x in Funs.DB.Project_Sys_Set where x.ProjectId == projectId select x;
|
||||
if (q.Count() > 0)
|
||||
if (q.Any())
|
||||
{
|
||||
foreach (var s in q)
|
||||
{
|
||||
if (s.SetId == "1")
|
||||
{
|
||||
if (s.IsAuto == true)
|
||||
{
|
||||
this.ckbDayReport.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ckbDayReport.Checked = false;
|
||||
}
|
||||
}
|
||||
else if (s.SetId == "2")
|
||||
{
|
||||
if (s.IsAuto == true)
|
||||
{
|
||||
this.ckbPoint.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ckbPoint.Checked = false;
|
||||
}
|
||||
}
|
||||
else if (s.SetId == "3")
|
||||
{
|
||||
if (s.IsAuto == true)
|
||||
{
|
||||
this.robStandard.SelectedValue = "1";
|
||||
}
|
||||
if (s.IsAuto == false)
|
||||
{
|
||||
this.robStandard.SelectedValue = "2";
|
||||
}
|
||||
if (s.SetValue == "3")
|
||||
{
|
||||
this.robStandard.SelectedValue = "3";
|
||||
}
|
||||
if (s.SetValue == "4")
|
||||
{
|
||||
this.robStandard.SelectedValue = "4";
|
||||
}
|
||||
}
|
||||
else if (s.SetId == "4")
|
||||
{
|
||||
if (s.IsAuto == true)
|
||||
{
|
||||
this.ckbPdms.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ckbPdms.Checked = false;
|
||||
}
|
||||
}
|
||||
else if (s.SetId == "5")
|
||||
{
|
||||
cb4.Checked = false;
|
||||
cb5.Checked = false;
|
||||
cb6.Checked = false;
|
||||
cb7.Checked = false;
|
||||
var lists = s.SetValue.Split('|');
|
||||
foreach (var item in lists)
|
||||
{
|
||||
if (item == "1")
|
||||
{
|
||||
cb1.Checked = true;
|
||||
}
|
||||
else if (item == "2")
|
||||
{
|
||||
cb2.Checked = true;
|
||||
}
|
||||
else if (item == "3")
|
||||
{
|
||||
cb3.Checked = true;
|
||||
}
|
||||
else if (item == "4")
|
||||
{
|
||||
cb4.Checked = true;
|
||||
}
|
||||
else if (item == "5")
|
||||
{
|
||||
cb5.Checked = true;
|
||||
}
|
||||
else if (item == "6")
|
||||
{
|
||||
cb6.Checked = true;
|
||||
}
|
||||
else if (item == "7")
|
||||
{
|
||||
cb7.Checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.SetId == "6")
|
||||
{
|
||||
if (s.IsAuto == true)
|
||||
{
|
||||
this.ckbJointB.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ckbJointB.Checked = false;
|
||||
}
|
||||
}
|
||||
else if (s.SetId == "7")
|
||||
{
|
||||
if (s.IsAuto == true)
|
||||
{
|
||||
this.ckbThickness.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ckbThickness.Checked = false;
|
||||
}
|
||||
}
|
||||
else if (s.SetId == "8")
|
||||
{
|
||||
if (s.SetValue == "1")
|
||||
{
|
||||
this.rblPressUnit.SelectedValue = "1";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.rblPressUnit.SelectedValue = "2";
|
||||
}
|
||||
}
|
||||
else if (s.SetId == "9")
|
||||
{
|
||||
var dict = q.ToDictionary(x => x.SetId, x => x);
|
||||
|
||||
this.AvevaNetUrl.Text = s.SetValue;
|
||||
}
|
||||
else if (s.SetId == "10")
|
||||
{
|
||||
if (s.IsAuto == true)
|
||||
{
|
||||
this.ckPressMustCheckBItem.Checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ckPressMustCheckBItem.Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
SetCheckFromDict(dict, "1", this.ckbDayReport);
|
||||
SetCheckFromDict(dict, "2", this.ckbPoint);
|
||||
SetRobStandardFromDict(dict, "3");
|
||||
SetCheckFromDict(dict, "4", this.ckbPdms);
|
||||
SetBatchFromDict(dict, "5");
|
||||
SetCheckFromDict(dict, "6", this.ckbJointB);
|
||||
SetCheckFromDict(dict, "7", this.ckbThickness);
|
||||
SetRadioValueFromDict(dict, "8", this.rblPressUnit, defaultValue: "2");
|
||||
if (dict.ContainsKey("9")) this.AvevaNetUrl.Text = dict["9"].SetValue;
|
||||
SetCheckFromDict(dict, "10", this.ckPressMustCheckBItem);
|
||||
if (dict.ContainsKey("11")) this.rbMaterialColorAttribute.SelectedValue = dict["11"].SetValue == "1" ? "1" : "2";
|
||||
}
|
||||
|
||||
//颜色模型设置
|
||||
Model.Project_Sys_Set Model_PipelineNOComplete = BLL.Project_SysSetService.GetSysSetBySetName("管线未完成", this.CurrUser.LoginProjectId);
|
||||
if (Model_PipelineNOComplete != null)
|
||||
{
|
||||
this.txtPipelineNOComplete.Text = Model_PipelineNOComplete.SetValue;
|
||||
}
|
||||
Model.Project_Sys_Set Model_PipelineComplete = BLL.Project_SysSetService.GetSysSetBySetName("管线已完成", this.CurrUser.LoginProjectId);
|
||||
if (Model_PipelineComplete != null)
|
||||
{
|
||||
this.txtPipelineComplete.Text = Model_PipelineComplete.SetValue;
|
||||
}
|
||||
Model.Project_Sys_Set Model_JointNOCompleteColor = BLL.Project_SysSetService.GetSysSetBySetName("焊口未完成", this.CurrUser.LoginProjectId);
|
||||
if (Model_JointNOCompleteColor != null)
|
||||
{
|
||||
this.drpJointNOCompleteColor.SelectedValue = Model_JointNOCompleteColor.SetValue;
|
||||
}
|
||||
Model.Project_Sys_Set Model_JointCompleteColor = BLL.Project_SysSetService.GetSysSetBySetName("焊口已完成", this.CurrUser.LoginProjectId);
|
||||
if (Model_JointCompleteColor != null)
|
||||
{
|
||||
this.drpJointCompleteColor.SelectedValue = Model_JointCompleteColor.SetValue;
|
||||
}
|
||||
var m1 = BLL.Project_SysSetService.GetSysSetBySetName("管线未完成", this.CurrUser.LoginProjectId);
|
||||
if (m1 != null) this.txtPipelineNOComplete.Text = m1.SetValue;
|
||||
var m2 = BLL.Project_SysSetService.GetSysSetBySetName("管线已完成", this.CurrUser.LoginProjectId);
|
||||
if (m2 != null) this.txtPipelineComplete.Text = m2.SetValue;
|
||||
var m3 = BLL.Project_SysSetService.GetSysSetBySetName("焊口未完成", this.CurrUser.LoginProjectId);
|
||||
if (m3 != null) this.drpJointNOCompleteColor.SelectedValue = m3.SetValue;
|
||||
var m4 = BLL.Project_SysSetService.GetSysSetBySetName("焊口已完成", this.CurrUser.LoginProjectId);
|
||||
if (m4 != null) this.drpJointCompleteColor.SelectedValue = m4.SetValue;
|
||||
|
||||
///质量页面呈现
|
||||
Model.Project_Sys_Set CheckEquipmentDay = BLL.Project_SysSetService.GetSysSetBySetName("检试验设备到期提醒天数", this.CurrUser.LoginProjectId);
|
||||
if (CheckEquipmentDay != null)
|
||||
var c1 = BLL.Project_SysSetService.GetSysSetBySetName("检试验设备到期提醒天数", this.CurrUser.LoginProjectId);
|
||||
if (c1 != null) this.txtRemindDay.Text = c1.SetValue;
|
||||
var c2 = BLL.Project_SysSetService.GetSysSetBySetName("月报开始日期", this.CurrUser.LoginProjectId);
|
||||
if (c2 != null) this.txtStarTime.Text = c2.SetValue; else this.txtStarTime.Text = "25";
|
||||
var c3 = BLL.Project_SysSetService.GetSysSetBySetName("月报结束日期", this.CurrUser.LoginProjectId);
|
||||
if (c3 != null) this.txtEndTime.Text = c3.SetValue; else this.txtEndTime.Text = "24";
|
||||
}
|
||||
|
||||
private void SetCheckFromDict(Dictionary<string, Model.Project_Sys_Set> dict, string setId, CheckBox checkBox)
|
||||
{
|
||||
if (!dict.ContainsKey(setId)) return;
|
||||
var s = dict[setId];
|
||||
checkBox.Checked = s.IsAuto == true;
|
||||
}
|
||||
|
||||
private void SetRobStandardFromDict(Dictionary<string, Model.Project_Sys_Set> dict, string setId)
|
||||
{
|
||||
if (!dict.ContainsKey(setId)) return;
|
||||
var s = dict[setId];
|
||||
if (s.IsAuto == true) this.robStandard.SelectedValue = "1";
|
||||
else if (s.IsAuto == false) this.robStandard.SelectedValue = "2";
|
||||
else if (s.SetValue == "3") this.robStandard.SelectedValue = "3";
|
||||
else if (s.SetValue == "4") this.robStandard.SelectedValue = "4";
|
||||
}
|
||||
|
||||
private void SetBatchFromDict(Dictionary<string, Model.Project_Sys_Set> dict, string setId)
|
||||
{
|
||||
if (!dict.ContainsKey(setId)) return;
|
||||
// reset some checkboxes first
|
||||
cb1.Checked = cb2.Checked = cb3.Checked = cb4.Checked = cb5.Checked = cb6.Checked = cb7.Checked = false;
|
||||
var s = dict[setId];
|
||||
if (string.IsNullOrEmpty(s.SetValue)) return;
|
||||
var items = s.SetValue.Split('|');
|
||||
foreach (var item in items)
|
||||
{
|
||||
this.txtRemindDay.Text = CheckEquipmentDay.SetValue;
|
||||
switch (item)
|
||||
{
|
||||
case "1": cb1.Checked = true; break;
|
||||
case "2": cb2.Checked = true; break;
|
||||
case "3": cb3.Checked = true; break;
|
||||
case "4": cb4.Checked = true; break;
|
||||
case "5": cb5.Checked = true; break;
|
||||
case "6": cb6.Checked = true; break;
|
||||
case "7": cb7.Checked = true; break;
|
||||
}
|
||||
}
|
||||
Model.Project_Sys_Set CheckMonthStartDay = BLL.Project_SysSetService.GetSysSetBySetName("月报开始日期", this.CurrUser.LoginProjectId);
|
||||
if (CheckMonthStartDay != null)
|
||||
}
|
||||
|
||||
private void SetRadioValueFromDict(Dictionary<string, Model.Project_Sys_Set> dict, string setId, RadioButtonList rbl, string defaultValue = null)
|
||||
{
|
||||
if (!dict.ContainsKey(setId))
|
||||
{
|
||||
this.txtStarTime.Text = CheckMonthStartDay.SetValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtStarTime.Text = "25";
|
||||
}
|
||||
Model.Project_Sys_Set CheckMonthEndDay = BLL.Project_SysSetService.GetSysSetBySetName("月报结束日期", this.CurrUser.LoginProjectId);
|
||||
if (CheckMonthEndDay != null)
|
||||
{
|
||||
this.txtEndTime.Text = CheckMonthEndDay.SetValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.txtEndTime.Text = "24";
|
||||
if (defaultValue != null) rbl.SelectedValue = defaultValue;
|
||||
return;
|
||||
}
|
||||
var s = dict[setId];
|
||||
rbl.SelectedValue = s.SetValue ?? defaultValue;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user