2022-09-05 16:36:31 +08:00
using BLL ;
2025-12-22 21:14:34 +08:00
using BLL.Common ;
2022-09-05 16:36:31 +08:00
using System ;
using System.Linq ;
2025-12-22 21:14:34 +08:00
using System.Text.RegularExpressions ;
2022-09-05 16:36:31 +08:00
namespace FineUIPro.Web.common.ProjectSet
{
public partial class ProjectSysSet : PageBase
{
/// <summary>
/// 页面加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
GetButtonPower ( ) ;
Show ( this . CurrUser . LoginProjectId ) ;
}
}
#region 判 断 按 钮 权 限
/// <summary>
/// 判断按钮权限
/// </summary>
private void GetButtonPower ( )
{
if ( BLL . CommonService . GetAllButtonPowerList ( this . CurrUser . LoginProjectId , this . CurrUser . PersonId , Const . CQMSSysSetMenuId , Const . BtnSave ) )
{
this . btnSave . Hidden = false ;
}
}
#endregion
#region 提 交 按 钮
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click ( object sender , EventArgs e )
{
string projectId = this . CurrUser . LoginProjectId ;
if ( string . IsNullOrEmpty ( projectId ) )
{
ShowNotify ( "请选择项目!" , MessageBoxIcon . Warning ) ;
return ;
}
2025-12-22 21:14:34 +08:00
#region 通 用
///通用
var getProject = ProjectService . GetProjectByProjectId ( projectId ) ;
if ( getProject ! = null )
{
getProject . IsYunMou = this . ckbIsYunMou . Checked ;
if ( this . ckbIsYunMou . Checked )
{
var token = YunMouHelper . getToken ( ) ;
string data ;
data = Regex . Replace ( getProject . ProjectCode , "[^0-9A-Fa-f]" , "" , RegexOptions . IgnoreCase ) ;
YunMouHelper . addDevicesGroups ( getProject . ProjectName , data , token ) ;
var groupId = YunMouHelper . addPermissionGroups ( getProject . ProjectName , token ) ;
if ( ! string . IsNullOrEmpty ( groupId ) )
{
getProject . YunMouGroupId = groupId ;
}
//var ids = YunMouHelper.AddConsumer(token);
// YunMouHelper.consumerMessage(ids, token);
//var res1 = YunMouHelper.getPerson("340824199505010015", token);
//var res2 = YunMouHelper.getPerson("340824199505010016", token);
//var res3 = YunMouHelper.getPerson("340824199505010014", token);
// var res = YunMouHelper.personCreate("340824199505010015", "李超", "15201934796", "FileUpload\\PersonBaseInfo\\2024-6\\638543008082105530_lichao.jpg", token);
//var res = YunMouHelper.addPersonsToGroups("badad00cc88d40a89e1601fb7ed193a0", new string[] { "340824199505010015" }, token);
// var res = YunMouHelper.addDevicesToGroups("badad00cc88d40a89e1601fb7ed193a0", new string[] { "FC2347699" }, token);
//YunMouHelper.setDefence("FC2347699", "1", token);
}
else
{
var token = YunMouHelper . getToken ( ) ;
string data ;
data = Regex . Replace ( getProject . ProjectCode , "[^0-9A-Fa-f]" , "" , RegexOptions . IgnoreCase ) ;
YunMouHelper . deleteDevicesGroups ( data , token ) ; //删除设备分组,如果有子节点,可以不删除
}
Funs . DB . SubmitChanges ( ) ;
}
#endregion
2022-09-05 16:36:31 +08:00
#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 ) ;
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 ;
}
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 ) ;
2022-10-26 00:57:05 +08:00
//this.Show(projectId);
2022-09-05 16:36:31 +08:00
#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 )
{
2022-10-25 22:30:17 +08:00
if ( ! string . IsNullOrEmpty ( this . drpJointNOCompleteColor . SelectedValue . Trim ( ) ) )
2022-09-05 16:36:31 +08:00
{
2022-10-25 22:30:17 +08:00
Model_JointNOCompleteColor . SetValue = this . drpJointNOCompleteColor . SelectedValue . Trim ( ) ;
2022-09-05 16:36:31 +08:00
BLL . Project_SysSetService . UpdateSet ( Model_JointNOCompleteColor ) ;
}
}
else
{
2022-10-25 22:30:17 +08:00
if ( ! string . IsNullOrEmpty ( this . drpJointNOCompleteColor . SelectedValue . Trim ( ) ) )
2022-09-05 16:36:31 +08:00
{
Model . Project_Sys_Set newModel = new Model . Project_Sys_Set ( )
{
SetId = SQLHelper . GetNewID ( typeof ( Model . Project_Sys_Set ) ) ,
ProjectId = this . CurrUser . LoginProjectId ,
SetName = "焊口未完成" ,
2022-10-25 22:30:17 +08:00
SetValue = this . drpJointNOCompleteColor . SelectedValue . Trim ( ) ,
2022-09-05 16:36:31 +08:00
} ;
BLL . Project_SysSetService . AddSet ( newModel ) ;
}
}
Model . Project_Sys_Set Model_JointCompleteColor = BLL . Project_SysSetService . GetSysSetBySetName ( "焊口已完成" , this . CurrUser . LoginProjectId ) ;
if ( Model_JointCompleteColor ! = null )
{
2022-10-25 22:30:17 +08:00
if ( ! string . IsNullOrEmpty ( this . drpJointCompleteColor . SelectedValue . Trim ( ) ) )
2022-09-05 16:36:31 +08:00
{
2022-10-25 22:30:17 +08:00
Model_JointCompleteColor . SetValue = this . drpJointCompleteColor . SelectedValue . Trim ( ) ;
2022-09-05 16:36:31 +08:00
BLL . Project_SysSetService . UpdateSet ( Model_JointCompleteColor ) ;
}
}
else
{
2022-10-25 22:30:17 +08:00
if ( ! string . IsNullOrEmpty ( this . drpJointCompleteColor . SelectedValue . Trim ( ) ) )
2022-09-05 16:36:31 +08:00
{
Model . Project_Sys_Set newModel = new Model . Project_Sys_Set ( )
{
SetId = SQLHelper . GetNewID ( typeof ( Model . Project_Sys_Set ) ) ,
ProjectId = this . CurrUser . LoginProjectId ,
SetName = "焊口已完成" ,
2022-10-25 22:30:17 +08:00
SetValue = this . drpJointCompleteColor . SelectedValue . Trim ( ) ,
2022-09-05 16:36:31 +08:00
} ;
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 ( ) ) )
{
2023-09-11 08:27:33 +08:00
CheckMonthEndDay . SetValue = this . txtEndTime . Text . Trim ( ) ;
BLL . Project_SysSetService . UpdateSet ( CheckMonthEndDay ) ;
2022-09-05 16:36:31 +08:00
}
}
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 ) ;
}
#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 )
{
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" )
{
this . AvevaNetUrl . Text = s . SetValue ;
}
}
}
//颜色模型设置
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 )
{
2022-10-25 22:30:17 +08:00
this . drpJointNOCompleteColor . SelectedValue = Model_JointNOCompleteColor . SetValue ;
2022-09-05 16:36:31 +08:00
}
Model . Project_Sys_Set Model_JointCompleteColor = BLL . Project_SysSetService . GetSysSetBySetName ( "焊口已完成" , this . CurrUser . LoginProjectId ) ;
if ( Model_JointCompleteColor ! = null )
{
2022-10-25 22:30:17 +08:00
this . drpJointCompleteColor . SelectedValue = Model_JointCompleteColor . SetValue ;
2022-09-05 16:36:31 +08:00
}
///质量页面呈现
Model . Project_Sys_Set CheckEquipmentDay = BLL . Project_SysSetService . GetSysSetBySetName ( "检试验设备到期提醒天数" , this . CurrUser . LoginProjectId ) ;
if ( CheckEquipmentDay ! = null )
{
this . txtRemindDay . Text = CheckEquipmentDay . SetValue ;
}
Model . Project_Sys_Set CheckMonthStartDay = BLL . Project_SysSetService . GetSysSetBySetName ( "月报开始日期" , this . CurrUser . LoginProjectId ) ;
if ( CheckMonthStartDay ! = null )
{
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" ;
}
}
#endregion
}
}