From f0c35de27dd69b6bc90d1f8524e75612f010bbfc Mon Sep 17 00:00:00 2001 From: 10191 <506754232@qq.com> Date: Mon, 22 Dec 2025 21:14:34 +0800 Subject: [PATCH] 11 --- DataBase/版本日志/SGGLDB_V2025-12-20.sql | 15 + SGGL/BLL/Common/Const.cs | 5 + SGGL/FineUIPro.Web/FineUIPro.Web.csproj | 16 + .../ProjectData/ProjectDevices.aspx | 134 +++++++ .../ProjectData/ProjectDevices.aspx.cs | 327 ++++++++++++++++++ .../ProjectDevices.aspx.designer.cs | 179 ++++++++++ .../ProjectData/ProjectDevicesEdit.aspx | 63 ++++ .../ProjectData/ProjectDevicesEdit.aspx.cs | 131 +++++++ .../ProjectDevicesEdit.aspx.designer.cs | 125 +++++++ .../ProjectData/ProjectSysSet.aspx | 24 ++ .../ProjectData/ProjectSysSet.aspx.cs | 43 +++ .../ProjectSysSet.aspx.designer.cs | 27 ++ SGGL/WebAPI/Controllers/PersonController.cs | 6 +- 13 files changed, 1094 insertions(+), 1 deletion(-) create mode 100644 SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx create mode 100644 SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs create mode 100644 SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.designer.cs create mode 100644 SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx create mode 100644 SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs create mode 100644 SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.designer.cs diff --git a/DataBase/版本日志/SGGLDB_V2025-12-20.sql b/DataBase/版本日志/SGGLDB_V2025-12-20.sql index 6d2428f9..83d9a18f 100644 --- a/DataBase/版本日志/SGGLDB_V2025-12-20.sql +++ b/DataBase/版本日志/SGGLDB_V2025-12-20.sql @@ -1,3 +1,18 @@ +INSERT INTO [dbo].[Sys_Menu] ([MenuId], [MenuName], [Icon], [Url], [SortIndex], [SuperMenu], [MenuType], [IsOffice], [IsEnd], [IsUsed]) VALUES (N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'项目设备', NULL, N'ProjectData/ProjectDevices.aspx', '86', N'0', N'Menu_ProjectSet', '0', '1', '1'); + +INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'1E3A5ADC-BAA7-45BC-AAF9-012A024F4752', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'保存', '4'); +INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'37E51622-FB4E-40F4-8D37-603EE626DB7F', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'增加', '1'); +INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'6EBFA308-581A-4260-9ECA-7E30283EF9EA', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'删除', '3'); +INSERT INTO [dbo].[Sys_ButtonToMenu] ([ButtonToMenuId], [MenuId], [ButtonName], [SortIndex]) VALUES (N'939F4F2D-F03B-4DBD-963C-D55196535D8C', N'E4DC0A35-C585-4C4F-8F79-10F528892314', N'修改', '2'); + + + +Alter TABLE [dbo].[Base_Project] + add + [IsYunMou] [bit] NULL, + [YunMouGroupId] [nvarchar](50) NULL + +GO CREATE TABLE [dbo].[Project_Devices]( [DeviceId] [nvarchar](50) NOT NULL, diff --git a/SGGL/BLL/Common/Const.cs b/SGGL/BLL/Common/Const.cs index 153ce344..b9bbcc74 100644 --- a/SGGL/BLL/Common/Const.cs +++ b/SGGL/BLL/Common/Const.cs @@ -5131,6 +5131,11 @@ namespace BLL /// public const string SafetyProductionEvaluationMenuId = "C48087A8-4C9F-485D-B0A4-C85E112BA705"; + + /// + /// 项目设备 + /// + public const string ProjectDevicesMenuId = "E4DC0A35-C585-4C4F-8F79-10F528892314"; /// /// 中央企业安全生产治本攻坚三年行动工作台账 /// diff --git a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj index fd310b8d..99c39687 100644 --- a/SGGL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/SGGL/FineUIPro.Web/FineUIPro.Web.csproj @@ -3061,6 +3061,8 @@ + + @@ -14772,6 +14774,20 @@ MainItemView.aspx + + ProjectDevices.aspx + ASPXCodeBehind + + + ProjectDevices.aspx + + + ProjectDevicesEdit.aspx + ASPXCodeBehind + + + ProjectDevicesEdit.aspx + ProjectInformation.aspx ASPXCodeBehind diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx new file mode 100644 index 00000000..bf46519f --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx @@ -0,0 +1,134 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectDevices.aspx.cs" Inherits="FineUIPro.Web.ProjectData.ProjectDevices" %> + + + + + + 项目设备 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs new file mode 100644 index 00000000..f85822d3 --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs @@ -0,0 +1,327 @@ +using BLL; +using BLL.Common; +using FineUIPro.Web.DataShow; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Web.Services.Description; +using WIA; +using AspNet = System.Web.UI.WebControls; + +namespace FineUIPro.Web.ProjectData +{ + public partial class ProjectDevices : PageBase + { + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + Funs.DropDownPageSize(this.ddlPageSize); + + this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString(); + + // 绑定表格 + this.BindGrid(); + ////权限按钮方法 + this.GetButtonPower(); + } + } + #endregion + + /// + /// 绑定数据 + /// + private void BindGrid() + { + + string strSql = @" Select * ,case when [isInOut] =1 then '进' else '出' end [IsInOutValue] ,case when [YunMouDeviceId] is not null and [YunMouDeviceId] <> '' then '是' else '' end [DeviceToYunMou] from Project_Devices WHERE "; + List listStr = new List(); + strSql += " ProjectId = @ProjectId"; + listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId)); + if (!string.IsNullOrEmpty(this.txtDeviceName.Text.Trim())) + { + strSql += " AND DeviceName LIKE @DeviceName"; + listStr.Add(new SqlParameter("@DeviceName", "%" + this.txtDeviceName.Text.Trim() + "%")); + } + SqlParameter[] parameter = listStr.ToArray(); + DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter); + + Grid1.RecordCount = tb.Rows.Count; + tb = GetFilteredTable(Grid1.FilteredData, tb); + var table = this.GetPagedDataTable(Grid1, tb); + Grid1.DataSource = table; + Grid1.DataBind(); + } + + #region 操作 Events + /// + /// 右键删除事件 + /// + /// + /// + protected void btnMenuDelete_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length > 0) + { + string unitName = string.Empty; + foreach (int rowIndex in Grid1.SelectedRowIndexArray) + { + string deviceId = Grid1.DataKeys[rowIndex][0].ToString(); + Model.Project_Devices devices = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == deviceId); + var token = YunMouHelper.getToken(); + YunMouHelper.deleteDevices(devices.DeviceSerial, token); + Funs.DB.Project_Devices.DeleteOnSubmit(devices); + Funs.DB.SubmitChanges(); + } + + BindGrid(); + if (string.IsNullOrEmpty(unitName)) + { + ShowNotify("删除数据成功!", MessageBoxIcon.Success); + } + } + } + #endregion + + #region 排序 分页 + /// + /// + /// + /// + /// + protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e) + { + BindGrid(); + } + + /// + /// + /// + /// + /// + protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); + BindGrid(); + } + + /// + /// + /// + /// + /// + protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e) + { + BindGrid(); + } + #endregion + + /// + /// 增加按钮事件 + /// + /// + /// + protected void btnAdd_Click(object sender, EventArgs e) + { + + PageContext.RegisterStartupScript(Window1.GetShowReference("ProjectDevicesEdit.aspx", "添加设备", 800, 300)); + + } + + /// + /// 双击事件 + /// + /// + /// + protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) + { + this.EditData(); + } + + /// + /// 右键编辑事件 + /// + /// + /// + protected void btnMenuEdit_Click(object sender, EventArgs e) + { + this.EditData(); + } + protected void btnMenuDeviceToYunMou_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + var device = Funs.DB.Project_Devices.FirstOrDefault(x=>x.DeviceId== Grid1.SelectedRowID) ; + if (device != null) + { + var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); + var token = YunMouHelper.getToken(); + string data; + data = Regex.Replace(project.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase); + var YunMouDeviceId = YunMouHelper.addDevices(device.DeviceSerial, data, device.ValidateCode, token);//添加设备 + if (!string.IsNullOrEmpty(YunMouDeviceId)) + { + device.YunMouDeviceId = YunMouDeviceId; + Funs.DB.SubmitChanges(); + ShowNotify("同步成功", MessageBoxIcon.Success); + BindGrid(); + } + else + { + Alert.ShowInTop("同步设备出错!", MessageBoxIcon.Warning); + + } + } + } + protected void btnMenuSyncPermission_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + var device = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == Grid1.SelectedRowID); + if (device != null) + { + var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); + var token = YunMouHelper.getToken(); + var res = YunMouHelper.addDevicesToGroups(project.YunMouGroupId, new string[] { device.DeviceSerial }, token);//添加到权限组 + YunMouHelper.setDefence(device.DeviceSerial,"1",token); + if (string.IsNullOrEmpty(res)) + { + Alert.ShowInTop("关联权限出错!", MessageBoxIcon.Warning); + + } + else { + device.YunMouPermission = "是"; + Funs.DB.SubmitChanges(); + ShowNotify("关联成功", MessageBoxIcon.Success); + BindGrid(); + } + } + } + + protected void btnMenuDeletePermission_Click(object sender, EventArgs e) + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + var device = Funs.DB.Project_Devices.FirstOrDefault(x => x.DeviceId == Grid1.SelectedRowID); + if (device != null) + { + var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); + var token = YunMouHelper.getToken(); + var res = YunMouHelper.deleteDevicesFromGroups(project.YunMouGroupId, new string[] { device.DeviceSerial }, token);//从权限组移除设备 + if (string.IsNullOrEmpty(res)) + { + Alert.ShowInTop("关联权限出错!", MessageBoxIcon.Warning); + + } + else + { + device.YunMouPermission = null; + Funs.DB.SubmitChanges(); + BindGrid(); + } + + } + } + /// + /// 编辑数据方法 + /// + private void EditData() + { + if (Grid1.SelectedRowIndexArray.Length == 0) + { + Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning); + return; + } + + PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectDevicesEdit.aspx?DeviceId={0}", Grid1.SelectedRowID), "编辑项目单位", 800, 300)); + + } + + /// + /// + /// + /// + /// + protected void Window1_Close(object sender, EventArgs e) + { + BindGrid(); + } + + #region 获取按钮权限 + /// + /// 获取按钮权限 + /// + /// + /// + private void GetButtonPower() + { + if (Request.Params["value"] == "0") + { + return; + } + string menuId = BLL.Const.ProjectDevicesMenuId; + + var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, menuId); + if (buttonList.Count() > 0) + { + if (buttonList.Contains(BLL.Const.BtnAdd)) + { + this.btnAdd.Hidden = false; + + } + if (buttonList.Contains(BLL.Const.BtnModify)) + { + this.btnMenuDeletePermission.Hidden= false; + this.btnAdd.Hidden = false; + this.btnMenuEdit.Hidden = false; + this.btnMenuDeviceToYunMou.Hidden = false; + this.btnMenuSyncPermission.Hidden = false; + } + if (buttonList.Contains(BLL.Const.BtnDelete)) + { + this.btnMenuDelete.Hidden = false; + } + } + + + } + #endregion + + #region 查询 + /// + /// 查询 + /// + /// + /// + protected void TextBox_TextChanged(object sender, EventArgs e) + { + this.BindGrid(); + this.GetButtonPower(); + } + #endregion + + + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.designer.cs new file mode 100644 index 00000000..62f2bf25 --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.designer.cs @@ -0,0 +1,179 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.ProjectData +{ + + + public partial class ProjectDevices + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Panel Panel1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Grid Grid1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar2; + + /// + /// txtDeviceName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDeviceName; + + /// + /// btnAdd 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnAdd; + + /// + /// lblNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label lblNumber; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.ToolbarText ToolbarText1; + + /// + /// ddlPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList ddlPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Window Window1; + + /// + /// Menu1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Menu Menu1; + + /// + /// btnMenuEdit 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuEdit; + + /// + /// btnMenuDeviceToYunMou 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDeviceToYunMou; + + /// + /// btnMenuSyncPermission 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuSyncPermission; + + /// + /// btnMenuDeletePermission 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDeletePermission; + + /// + /// btnMenuDelete 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.MenuButton btnMenuDelete; + } +} diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx new file mode 100644 index 00000000..15651b88 --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx @@ -0,0 +1,63 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProjectDevicesEdit.aspx.cs" + Inherits="FineUIPro.Web.ProjectData.ProjectDevicesEdit" %> + + + + + 编辑班组信息 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs new file mode 100644 index 00000000..ade4bc6c --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using BLL; +using BLL.Common; +using FastReport.Cloud.OAuth; +using FineUIPro.Web.DataShow; +using Org.BouncyCastle.Crypto; + +namespace FineUIPro.Web.ProjectData +{ + public partial class ProjectDevicesEdit : PageBase + { + #region 定义项 + /// + /// 主键 + /// + public string DeviceId + { + get + { + return (string)ViewState["DeviceId"]; + } + set + { + ViewState["DeviceId"] = value; + } + } + #endregion + + #region 加载 + /// + /// 加载页面 + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + btnClose.OnClientClick = ActiveWindow.GetHideReference(); + this.DeviceId = Request.Params["DeviceId"]; + if (!string.IsNullOrEmpty(this.DeviceId)) + { + Model.Project_Devices device = Funs.DB.Project_Devices.FirstOrDefault(x=>x.DeviceId==this.DeviceId); + if (device != null) + { + this.txtDeviceName.Text = device.DeviceName; + this.txtDeviceSerial.Text = device.DeviceSerial; + this.txtAddress.Text = device.Address; + this.txtValidateCode.Text = device.ValidateCode; + if (!string.IsNullOrEmpty(device.IsInOut)) + { + this.drpInOut.SelectedValue = device.IsInOut; + } + //this.txtThirdTeamCode.Text = teamGroup.ThirdTeamCode; + if (device.CreateDate != null) + { + this.dpCreateDate.Text = string.Format("{0:yyyy-MM-dd}", device.CreateDate); + } + + } + } + } + } + #endregion + + #region 保存 + /// + /// 保存按钮 + /// + /// + /// + protected void btnSave_Click(object sender, EventArgs e) + { + + + Model.Project_Devices device = new Model.Project_Devices + { + ProjectId = this.CurrUser.LoginProjectId, + DeviceName = this.txtDeviceName.Text.Trim(), + DeviceSerial = this.txtDeviceSerial.Text.Trim(), + Address = txtAddress.Text.Trim(), + ValidateCode=txtValidateCode.Text.Trim(), + CreateDate = Funs.GetNewDateTime(this.dpCreateDate.Text.Trim()) + }; + if (this.drpInOut.SelectedValue != BLL.Const._Null) + { + device.IsInOut = this.drpInOut.SelectedValue; + } + + if (!string.IsNullOrEmpty(this.DeviceId)) + { + device.DeviceId = this.DeviceId; + BLL.ProjectDeviceService.UpdateProjectDevice(device); + var token = YunMouHelper.getToken(); + YunMouHelper.updateDevices(device.DeviceSerial, device.DeviceName, token); + BLL.LogService.AddSys_Log(this.CurrUser, device.DeviceName, device.DeviceId, BLL.Const.ProjectDevicesMenuId, BLL.Const.BtnModify); + } + else + { + this.DeviceId = SQLHelper.GetNewID(typeof(Model.Project_Devices)); + device.DeviceId = this.DeviceId; + var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); + var token = YunMouHelper.getToken(); + string data; + data = Regex.Replace(project.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase); + device.YunMouDeviceId = YunMouHelper.addDevices(device.DeviceSerial, data, device.ValidateCode, token);//添加设备之后,将权限添加到权限组 + var res = YunMouHelper.addDevicesToGroups(project.YunMouGroupId, new string[] { device.DeviceSerial }, token);//添加到权限组 + if (!string.IsNullOrEmpty(res)) + { + device.YunMouPermission = "已关联"; + } + BLL.ProjectDeviceService.AddProjectDevice(device); + BLL.LogService.AddSys_Log(this.CurrUser, device.DeviceName, device.DeviceId, BLL.Const.ProjectDevicesMenuId, BLL.Const.BtnAdd); + } + ShowNotify("保存数据成功!", MessageBoxIcon.Success); + PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); + } + #endregion + + + + + + } +} \ No newline at end of file diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.designer.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.designer.cs new file mode 100644 index 00000000..f88bb1f4 --- /dev/null +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.designer.cs @@ -0,0 +1,125 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace FineUIPro.Web.ProjectData +{ + + + public partial class ProjectDevicesEdit + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.PageManager PageManager1; + + /// + /// SimpleForm1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form SimpleForm1; + + /// + /// txtDeviceName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDeviceName; + + /// + /// txtDeviceSerial 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtDeviceSerial; + + /// + /// dpCreateDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DatePicker dpCreateDate; + + /// + /// drpInOut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.DropDownList drpInOut; + + /// + /// txtValidateCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtValidateCode; + + /// + /// txtAddress 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.TextBox txtAddress; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Toolbar Toolbar1; + + /// + /// btnSave 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnSave; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Button btnClose; + } +} diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx b/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx index 192002cd..3d269000 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectSysSet.aspx @@ -14,6 +14,30 @@ + + + + + + + + + + + + + + + + + + + + + + protected global::FineUIPro.Region Region2; + /// + /// GroupPanel0 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.GroupPanel GroupPanel0; + + /// + /// Form4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.Form Form4; + + /// + /// ckbIsYunMou 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUIPro.CheckBox ckbIsYunMou; + /// /// GroupPanel2 控件。 /// diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index 86800b99..d115bc9b 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -762,11 +762,15 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { + var trainingIds = Funs.DB.EduTrain_TrainRecord.Where(x => projectId == projectId).Select(x => x.TrainingId).ToList(); + var personIds = Funs.DB.EduTrain_TrainRecordDetail.Where(x => trainingIds.Contains(x.TrainingId)).Select(x=>x.PersonId).ToList(); ; + responeData.data = (from x in Funs.DB.SitePerson_Person join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId - join persons in Funs.DB.Person_Persons on x.IdentityCard equals persons.IdentityCard + join persons in Funs.DB.Person_Persons on x.IdentityCard equals persons.IdentityCard where x.ProjectId == projectId && !x.ExchangeTime.HasValue && x.States == Const.ProjectPersonStates_1 && x.CardNo.Length > 5 && persons.PhotoUrl != null + where personIds.Contains(x.PersonId) select new { x.PersonId,