From b2e04d15e8284aa23af89200075b6fd52a77477e Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期四, 08 五月 2025 14:50:36 +0800
Subject: [PATCH] 1
---
project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs | 69 +++
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Parameters.cs | 7
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs | 4
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json | 5
project/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs | 3
project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs | 103 ++---
.vs/VSWorkspaceState.json | 7
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs | 197 ++++++-----
.vs/ShenSuoGanKongZhi/v17/.wsuo | 0
project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs | 408 +++++++++++++++++------
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile1.pubxml | 17 +
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs | 70 +++
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile1.pubxml | 17 +
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs | 8
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs | 8
project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs | 17 +
project/后台管理/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs | 36 +-
.vs/ShenSuoGanKongZhi/v17/DocumentLayout.json | 23 +
18 files changed, 692 insertions(+), 307 deletions(-)
diff --git a/.vs/ShenSuoGanKongZhi/v17/.wsuo b/.vs/ShenSuoGanKongZhi/v17/.wsuo
new file mode 100644
index 0000000..052e3e9
--- /dev/null
+++ b/.vs/ShenSuoGanKongZhi/v17/.wsuo
Binary files differ
diff --git a/.vs/ShenSuoGanKongZhi/v17/DocumentLayout.json b/.vs/ShenSuoGanKongZhi/v17/DocumentLayout.json
new file mode 100644
index 0000000..843acc3
--- /dev/null
+++ b/.vs/ShenSuoGanKongZhi/v17/DocumentLayout.json
@@ -0,0 +1,23 @@
+{
+ "Version": 1,
+ "WorkspaceRootPath": "E:\\ssg\\ShenSuoGanKongZhi\\",
+ "Documents": [],
+ "DocumentGroupContainers": [
+ {
+ "Orientation": 0,
+ "VerticalTabListWidth": 256,
+ "DocumentGroups": [
+ {
+ "DockedWidth": 200,
+ "SelectedChildIndex": -1,
+ "Children": [
+ {
+ "$type": "Bookmark",
+ "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json
new file mode 100644
index 0000000..e456863
--- /dev/null
+++ b/.vs/VSWorkspaceState.json
@@ -0,0 +1,7 @@
+{
+ "ExpandedNodes": [
+ ""
+ ],
+ "SelectedNode": "\\WIDESEAWCS_Server.sln (project\\\u540E\u53F0\u7BA1\u7406\\WIDESEAWCS_Server\\WIDESEAWCS_Server.sln)",
+ "PreviewInSolutionExplorer": false
+}
\ No newline at end of file
diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
index cce280e..bf8deae 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
@@ -218,6 +218,9 @@
img = user.HeadImageUrl,
ID = user.UserId,
RoleId = user.RoleId,
+ depid = disbled.Dept_Id,
+
+
});
}
diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
index 8aec54b..5727609 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
@@ -1,117 +1,319 @@
-锘縰sing HslCommunication.WebSocket;
-using Newtonsoft.Json;
-using Quartz;
-using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using WIDESEAWCS_Core.HttpContextUser;
-using WIDESEAWCS_Core;
-using WIDESEAWCS_ITaskInfoService;
-using WIDESEAWCS_Model.Models;
-using WIDESEAWCS_QuartzJob;
-using WIDESEAWCS_TelescopicService;
-using WIDESEAWCS_ISystemServices;
+锘�// using HslCommunication.WebSocket;
+// using Newtonsoft.Json;
+// using Quartz;
+// using SqlSugar;
+// using System;
+// using System.Collections.Generic;
+// using System.Linq;
+// using System.Text;
+// using System.Threading.Tasks;
+// using WIDESEAWCS_Core.HttpContextUser;
+// using WIDESEAWCS_Core;
+// using WIDESEAWCS_ITaskInfoService;
+// using WIDESEAWCS_Model.Models;
+// using WIDESEAWCS_QuartzJob;
+// using WIDESEAWCS_TelescopicService;
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// using WIDESEAWCS_ISystemServices;
+// =======
+// <<<<<<< Updated upstream:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// =======
+// using WIDESEAWCS_ISystemServices;
+// using WIDESEAWCS_Core.Helper;
+// >>>>>>> Stashed changes:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
-namespace WIDESEAWCS_Tasks
-{
- [DisallowConcurrentExecution]
- public class AlarmResetJob : JobBase, IJob
- {
+// namespace WIDESEAWCS_Tasks
+// {
+// [DisallowConcurrentExecution]
+// public class AlarmResetJob : JobBase, IJob
+// {
- private readonly IAlarmResetHsyServer _alarmResetHsyServer;
- private readonly ISys_UserService _UserService;
- WebSocketServer _webSocketServer;
+// private readonly IAlarmResetHsyServer _alarmResetHsyServer;
+// private readonly ISys_UserService _UserService;
+// WebSocketServer _webSocketServer;
- public AlarmResetJob(WebSocketServer webSocketServer, IAlarmResetHsyServer alarmResetHsyServer, ISys_UserService UserService)
- {
- _webSocketServer = webSocketServer;
- _alarmResetHsyServer = alarmResetHsyServer;
- _UserService = UserService;
- }
+// public AlarmResetJob(WebSocketServer webSocketServer, IAlarmResetHsyServer alarmResetHsyServer, ISys_UserService UserService)
+// {
+// _webSocketServer = webSocketServer;
+// _alarmResetHsyServer = alarmResetHsyServer;
+// _UserService = UserService;
+// }
- public Task Execute(IJobExecutionContext context)
- {
- try
- {
+// /// <summary>
+// /// 杩欎釜鍒版椂鍊欐牴鎹幇鍦烘儏鍐垫潵閰嶇疆锛岃澶囧彿鍜岀幇鍦烘儏鍐垫潵瀹氥��
+// /// 涓�涓建閬撲咯涓猵lc
+// /// </summary>
+// /// <param name="context"></param>
+// /// <returns></returns>
+// //public Task Execute(IJobExecutionContext context)
+// //{
+// // try
+// // {
+
+// // //鑾峰彇璁惧鍙�
+// // // 鑾峰彇璁惧閰嶇疆
+// // OtherDevice serialPortDevice = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams");
+// // if (serialPortDevice!=null)
+// // {
+// // //棣栧厛瑕佷竴鐩磋锛屽鏋滃彂鐢熶簡鏁呴殰瑕佸啓鍒癬alarmResetHsyServer涓褰曚笅鏉ュ苟涓旂粰鍒板墠绔暟鎹�
+// // //宸lc
+
+// // if (serialPortDevice.DeviceCode == "SSG001")
+// // {
+// // var leftPLcstuck = serialPortDevice.Communicator.Read<bool>("M104"); //鍗′綇鎶ヨ
+// // var leftPLcOher = serialPortDevice.Communicator.Read<bool>("M105"); //鍏朵粬鎶ヨ //榛樿鏄痜alse
+// // Console.WriteLine($"{serialPortDevice.DeviceName}:鍗′綇鎶ヨ{leftPLcstuck}锛屽叾浠栨姤璀leftPLcOher}");
+// // if (leftPLcstuck == true && leftPLcOher == false)
+// // //if (leftPLcOher == false)
+// // {
+// // string text = "杞ㄩ亾涓�锛氫几缂╁崱浣忔姤璀�";
+// // //鎶ヨ浜嗗湪杩欒皟鐢ㄦ坊鍔犳柟娉曪紝骞朵紶缁欏墠绔�
+// // var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
+
+// // }
+// // if (leftPLcOher == true && leftPLcstuck == false)
+// // {
+// // string text = "杞ㄩ亾涓�锛氬叾浠栨晠闅滄姤璀�";
+// // var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
+
+// // }
+// // if (leftPLcstuck == true && leftPLcOher == true)//濡傛灉鎶ヨ浜�
+// // {
+// // string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀﹀拰鍏朵粬鏁呴殰鎶ヨ";
+// // var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
+
+// // }
+
+// // var alrt = _alarmResetHsyServer.GetWebSocketInfo();
+// // _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(alrt));//websocketserver杩欑鍙兘浼犵粰鍓嶇json鏍煎紡
+// // }
+// // else if (serialPortDevice.DeviceCode == "SSG002")
+// // {
+// // //鍙硃lc
+// // var rightPLcSuck = serialPortDevice.Communicator.Read<bool>("M104"); //鍗′綇鎶ヨ
+// // var rightPLcOher = serialPortDevice.Communicator.Read<bool>("M105");//鍏朵粬鎶ヨ
+// // Console.WriteLine($"{serialPortDevice.DeviceName}:鍗′綇鎶ヨ{rightPLcSuck}锛屽叾浠栨姤璀rightPLcOher}");
+// // if (rightPLcSuck == true && rightPLcOher == false)
+// // {
+// // string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀�";
+// // //鎶ヨ浜嗗湪杩欒皟鐢ㄦ坊鍔犳柟娉曪紝骞朵紶缁欏墠绔�
+// // var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcSuck);
+// // // _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(reslut));//websocketserver杩欑鍙兘浼犵粰鍓嶇json鏍煎紡
+// // }
+// // if (rightPLcOher == true && rightPLcSuck == false)
+// // {
+// // string text = "杞ㄩ亾涓�锛氬叾浠栨晠闅滄姤璀�";
+// // var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcOher);
+// // }
+// // if (rightPLcSuck == true && rightPLcOher == true)//濡傛灉鎶ヨ浜�
+// // {
+// // string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀﹀拰鍏朵粬鏁呴殰鎶ヨ";
+// // var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcOher);//娣诲姞鏁版嵁
+// // }
+// // var alrt = _alarmResetHsyServer.GetWebSocketInfo();
+// // _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(alrt));
+// // }
+
+// // }
+// // }
+// // catch (Exception ex)
+// // {
+
+// // Console.WriteLine("閿欒淇℃伅锛�" + ex.Message);
+// // Console.WriteLine(ex.StackTrace);
+// // }
+// // return Task.CompletedTask;
+// //}
+
+
+// public Task Execute(IJobExecutionContext context)
+// {
+// try
+// {
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
- //鑾峰彇璁惧鍙�
- // 鑾峰彇璁惧閰嶇疆
- OtherDevice serialPortDevice = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams");
- if (serialPortDevice!=null)
- {
- //棣栧厛瑕佷竴鐩磋锛屽鏋滃彂鐢熶簡鏁呴殰瑕佸啓鍒癬alarmResetHsyServer涓褰曚笅鏉ュ苟涓旂粰鍒板墠绔暟鎹�
- //宸lc
+// =======
+// <<<<<<< Updated upstream:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// =======
+
+// >>>>>>> Stashed changes:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// //鑾峰彇璁惧鍙�
+// // 鑾峰彇璁惧閰嶇疆
+// //OtherDevice serialPortDevice = (OtherDevice)context.JobDetail.JobDataMap.Get("JobParams");
+// if (!int.TryParse(AppSettings.Get("DepartmentID"), out int deid))
+// {
+// Console.WriteLine("閰嶇疆椤� DepartmentID 鏃犳硶杞崲涓烘暣鏁�");
+// }
+// var devices = GetDevicesByDeptId(deid);
+// if (devices != null)
+// {
+// //棣栧厛瑕佷竴鐩磋锛屽鏋滃彂鐢熶簡鏁呴殰瑕佸啓鍒癬alarmResetHsyServer涓褰曚笅鏉ュ苟涓旂粰鍒板墠绔暟鎹�
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// //宸lc
- if (serialPortDevice.DeviceCode == "SSG001")
- {
- var leftPLcstuck = serialPortDevice.Communicator.Read<bool>("M104"); //鍗′綇鎶ヨ
- var leftPLcOher = serialPortDevice.Communicator.Read<bool>("M105"); //鍏朵粬鎶ヨ //榛樿鏄痜alse
- Console.WriteLine($"{serialPortDevice.DeviceName}:鍗′綇鎶ヨ{leftPLcstuck}锛屽叾浠栨姤璀leftPLcOher}");
- if (leftPLcstuck == true && leftPLcOher == false)
- //if (leftPLcOher == false)
- {
- string text = "杞ㄩ亾涓�锛氫几缂╁崱浣忔姤璀�";
- //鎶ヨ浜嗗湪杩欒皟鐢ㄦ坊鍔犳柟娉曪紝骞朵紶缁欏墠绔�
- var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
+// if (serialPortDevice.DeviceCode == "SSG001")
+// =======
+// <<<<<<< Updated upstream:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// if (serialPortDevice.DeviceName=="宸︽眹宸漃LC")
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// {
+// var leftPLcstuck = serialPortDevice.Communicator.Read<bool>("M104"); //鍗′綇鎶ヨ
+// var leftPLcOher = serialPortDevice.Communicator.Read<bool>("M105"); //鍏朵粬鎶ヨ //榛樿鏄痜alse
+// Console.WriteLine($"{serialPortDevice.DeviceName}:鍗′綇鎶ヨ{leftPLcstuck}锛屽叾浠栨姤璀leftPLcOher}");
+// if (leftPLcstuck == true && leftPLcOher == false)
+// //if (leftPLcOher == false)
+// {
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "杞ㄩ亾涓�锛氫几缂╁崱浣忔姤璀�";
+// //鎶ヨ浜嗗湪杩欒皟鐢ㄦ坊鍔犳柟娉曪紝骞朵紶缁欏墠绔�
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
- }
- if (leftPLcOher == true && leftPLcstuck == false)
- {
- string text = "杞ㄩ亾涓�锛氬叾浠栨晠闅滄姤璀�";
- var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
+// }
+// if (leftPLcOher == true && leftPLcstuck == false)
+// {
+// string text = "杞ㄩ亾涓�锛氬叾浠栨晠闅滄姤璀�";
+// =======
+// string text = "浼哥缉鍗′綇鎶ヨ";
+// =======
+
+// //宸lc
+// var leftPLcstuck1 = devices.Value.left.Communicator.Read<bool>("M104"); //鍗′綇鎶ヨ
+// var leftPLcOher1 = devices.Value.left.Communicator.Read<bool>("M105"); //鍏朵粬鎶ヨ //榛樿鏄痜alse
+// Console.WriteLine($"{devices.Value.left.DeviceName}:榛樿鏄痜alse锛岀幇鍦ㄥ崱浣忔姤璀﹀�硷細{leftPLcstuck1}锛岀幇鍦ㄥ叾浠栨姤璀﹀�硷細{leftPLcOher1}");
+// if (leftPLcstuck1 == true && leftPLcOher1 == false)
+// //if (leftPLcOher1 == false)
+// {
+// string text =$"杞ㄩ亾{deid}锛氫几缂╁崱浣忔姤璀�";
+// >>>>>>> Stashed changes:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// //鎶ヨ浜嗗湪杩欒皟鐢ㄦ坊鍔犳柟娉曪紝骞朵紶缁欏墠绔�
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck1);
+
+// }
+// if (leftPLcstuck1 == true && leftPLcOher1 == false)
+// {
+// <<<<<<< Updated upstream:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "鍏朵粬鏁呴殰鎶ヨ";
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
- }
- if (leftPLcstuck == true && leftPLcOher == true)//濡傛灉鎶ヨ浜�
- {
- string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀﹀拰鍏朵粬鏁呴殰鎶ヨ";
- var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
+// =======
+// string text = $"杞ㄩ亾{deid}锛氬叾浠栨晠闅滄姤璀�";
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck1);
+
+// >>>>>>> Stashed changes:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// }
+// if (leftPLcstuck1 == true && leftPLcOher1 == true)//濡傛灉鎶ヨ浜�
+// {
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀﹀拰鍏朵粬鏁呴殰鎶ヨ";
+// =======
+// <<<<<<< Updated upstream:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "鎶ヨ浼哥缉鍗′綇鎶ヨ鍜屽叾浠栨晠闅滄姤璀�";
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck);
- }
+// }
- var alrt = _alarmResetHsyServer.GetWebSocketInfo();
- _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(alrt));//websocketserver杩欑鍙兘浼犵粰鍓嶇json鏍煎紡
- }
- else if (serialPortDevice.DeviceCode == "SSG002")
- {
- //鍙硃lc
- var rightPLcSuck = serialPortDevice.Communicator.Read<bool>("M104"); //鍗′綇鎶ヨ
- var rightPLcOher = serialPortDevice.Communicator.Read<bool>("M105");//鍏朵粬鎶ヨ
- Console.WriteLine($"{serialPortDevice.DeviceName}:鍗′綇鎶ヨ{rightPLcSuck}锛屽叾浠栨姤璀rightPLcOher}");
- if (rightPLcSuck == true && rightPLcOher == false)
- {
- string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀�";
- //鎶ヨ浜嗗湪杩欒皟鐢ㄦ坊鍔犳柟娉曪紝骞朵紶缁欏墠绔�
- var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcSuck);
- // _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(reslut));//websocketserver杩欑鍙兘浼犵粰鍓嶇json鏍煎紡
- }
- if (rightPLcOher == true && rightPLcSuck == false)
- {
- string text = "杞ㄩ亾涓�锛氬叾浠栨晠闅滄姤璀�";
- var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcOher);
- }
- if (rightPLcSuck == true && rightPLcOher == true)//濡傛灉鎶ヨ浜�
- {
- string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀﹀拰鍏朵粬鏁呴殰鎶ヨ";
- var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcOher);//娣诲姞鏁版嵁
- }
- var alrt = _alarmResetHsyServer.GetWebSocketInfo();
- _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(alrt));
- }
+// var alrt = _alarmResetHsyServer.GetWebSocketInfo();
+// _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(alrt));//websocketserver杩欑鍙兘浼犵粰鍓嶇json鏍煎紡
+// }
+// else if (serialPortDevice.DeviceCode == "SSG002")
+// {
+// //鍙硃lc
+// var rightPLcSuck = serialPortDevice.Communicator.Read<bool>("M104"); //鍗′綇鎶ヨ
+// var rightPLcOher = serialPortDevice.Communicator.Read<bool>("M105");//鍏朵粬鎶ヨ
+// Console.WriteLine($"{serialPortDevice.DeviceName}:鍗′綇鎶ヨ{rightPLcSuck}锛屽叾浠栨姤璀rightPLcOher}");
+// if (rightPLcSuck == true && rightPLcOher == false)
+// {
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀�";
+// =======
+// string text = "鎶ヨ浼哥缉鍗′綇鎶ヨ";
+// =======
+// string text = $"杞ㄩ亾{deid}锛氭姤璀︿几缂╁崱浣忔姤璀﹀拰鍏朵粬鏁呴殰鎶ヨ";
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, leftPLcstuck1);
+// }
+
+// //鍙硃lc
+// var rightPLcSuck = devices.Value.right.Communicator.Read<bool>("M104"); //鍗′綇鎶ヨ
+// var rightPLcOher = devices.Value.right.Communicator.Read<bool>("M105");//鍏朵粬鎶ヨ
+// Console.WriteLine($"{devices.Value.right.DeviceName}::榛樿鏄痜alse锛岀幇鍦ㄥ崱浣忔姤璀﹀�硷細{rightPLcSuck}锛�:鐜板湪鍏朵粬鎶ヨ鍊硷細{rightPLcOher}");
+// if (rightPLcSuck == true && rightPLcOher == false)
+// {
+// string text = $"杞ㄩ亾{deid}锛氭姤璀︿几缂╁崱浣忔姤璀�";
+// >>>>>>> Stashed changes:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// //鎶ヨ浜嗗湪杩欒皟鐢ㄦ坊鍔犳柟娉曪紝骞朵紶缁欏墠绔�
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcSuck);
+
+// }
+// if (rightPLcOher == true && rightPLcSuck == false)
+// {
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "杞ㄩ亾涓�锛氬叾浠栨晠闅滄姤璀�";
+// =======
+// <<<<<<< Updated upstream:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "鍏朵粬鏁呴殰鎶ヨ";
+// =======
+// string text = $"杞ㄩ亾{deid}锛氬叾浠栨晠闅滄姤璀�";
+// >>>>>>> Stashed changes:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcOher);
+// }
+// if (rightPLcSuck == true && rightPLcOher == true)//濡傛灉鎶ヨ浜�
+// {
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "杞ㄩ亾涓�锛氭姤璀︿几缂╁崱浣忔姤璀﹀拰鍏朵粬鏁呴殰鎶ヨ";
+// =======
+// <<<<<<< Updated upstream:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// string text = "鎶ヨ浼哥缉鍗′綇鎶ヨ鍜屽叾浠栨晠闅滄姤璀�";
+// =======
+// string text = $"杞ㄩ亾{deid}锛氭姤璀︿几缂╁崱浣忔姤璀﹀拰鍏朵粬鏁呴殰鎶ヨ";
+// >>>>>>> Stashed changes:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// var reslut = _alarmResetHsyServer.AddAlarmHsy(text, rightPLcOher);//娣诲姞鏁版嵁
+// }
+// var alrt = _alarmResetHsyServer.GetWebSocketInfo();
+// _webSocketServer.PublishAllClientPayload(JsonConvert.SerializeObject(alrt));
+// <<<<<<< HEAD:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// }
- }
- }
- catch (Exception ex)
- {
+// =======
+// <<<<<<< Updated upstream:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// }
+// >>>>>>> qy0318:椤圭洰浠g爜/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// }
+// =======
+// }
+
+// >>>>>>> Stashed changes:project/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs
+// }
+// catch (Exception ex)
+// {
- Console.WriteLine("閿欒淇℃伅锛�" + ex.Message);
- Console.WriteLine(ex.StackTrace);
- }
- return Task.CompletedTask;
- }
- }
-}
+// Console.WriteLine("閿欒淇℃伅锛�" + ex.Message);
+// Console.WriteLine(ex.StackTrace);
+// }
+// return Task.CompletedTask;
+// }
+// public (OtherDevice left, OtherDevice right)? GetDevicesByDeptId(int deptId)
+// {
+// // 宸﹁澶囧彿锛�1 -> 001锛�2 -> 003锛�3 -> 005...
+// int baseCode = 1 + (deptId - 1) * 2;
+// string leftCode = $"SSG{baseCode.ToString("D3")}";
+// string rightCode = $"SSG{(baseCode + 1).ToString("D3")}";
+
+// var left = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == leftCode);
+// var right = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == rightCode);
+
+// if (left == null || right == null)
+// return null;
+
+// return (left, right);
+// }
+// }
+// }
diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs
index e2edc32..a8902a4 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/LoginhsyService.cs
@@ -76,6 +76,23 @@
query = query.OrderBy((a, b) => b.LoginTiem, OrderByType.Desc);
}
+ // 濡傛灉涓嶆槸绠$悊鍛橈紝鏍规嵁閮ㄩ棬杩囨护
+ if (pagination.account != "admin")
+ {
+ var currentUser = _user.Db.Queryable<Sys_User>()
+ .Where(u => u.UserName == pagination.account)
+ .First();
+
+ if (currentUser == null)
+ {
+ return new WebResponseContent { Status = false, Data = "鏈幏鍙栧埌鐢ㄦ埛淇℃伅" };
+ }
+
+ int? deptId = currentUser.Dept_Id;
+
+ query = query.Where((a, b) => a.Dept_Id == deptId);
+ }
+
//杩斿洖缁撴灉
var result = query.Select((a, b) => new
diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs
index 561685d..bd1cb30 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs
@@ -13,20 +13,30 @@
using WIDESEAWCS_DTO;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using WIDESEAWCS_DTO.Telescopic;
+using SqlSugar.DistributedSystem.Snowflake;
+using System.IO;
namespace WIDESEAWCS_TelescopicService
{
public class MaintenanceService : ServiceBase<Dt_Maintenance, IRepository<Dt_Maintenance>>, IMaintenanceService
{
public IRepository<Dt_Maintenance> Repository => BaseDal;
+ public readonly IRepository<Dt_MaintenanceTeam> _team;
private readonly IRepository<Sys_User> _user;
- public MaintenanceService(IRepository<Dt_Maintenance> BaseDal, IRepository<Sys_User> user) : base(BaseDal)
+ public MaintenanceService(IRepository<Dt_Maintenance> BaseDal, IRepository<Sys_User> user, IRepository<Dt_MaintenanceTeam> team) : base(BaseDal)
{
_user = user;
+ _team = team;
}
+
+ /// <summary>
+ /// 璁剧疆妫�淇潈闄�
+ /// </summary>
+ /// <param name="pagination"></param>
+ /// <returns></returns>
public WebResponseContent ShowMaintence(PaginationDTO pagination)
{
try
@@ -110,28 +120,47 @@
{
try
{
+ // 绗竴姝ワ細鑷姩娓呯悊杩囨湡妫�淇姸鎬�
+ var today = DateTime.Today;
+ var recordsToUpdate = Db.Queryable<Dt_Maintenance>()
+ .Where(b => b.MaintenancStartTime != null &&
+ b.MaintenancStartTime.Value.Date < today )
+ .ToList();
+
+ if (recordsToUpdate.Count > 0)
+ {
+ foreach (var record in recordsToUpdate)//鏇存柊
+ {
+ record.MaintenancStartTime = null;//娓呯┖寮�濮嬫椂闂�
+ record.MaintenancEendTime = null;//娓呯┖缁撴潫鏃堕棿
+ record.MaintenanceStatus = 0; // Set to false
+ record.IsPossible = "NULL"; //鏇存敼鐘舵�佷负false涓嶈繍琛屾淇�//榛樿涓篘ULL
+ }
+ Db.Updateable(recordsToUpdate).ExecuteCommand();
+ }
+
int totalCount = 0;
var sys = _user.Db.Queryable<Sys_User>();
var main = Db.Queryable<Dt_Maintenance>();
var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount)
- .Where((a, b) => b.IsPossible == "true"); // 鍏堢瓫閫� IsPossible 涓� true 鐨勬暟鎹�
+ .Where((a, b) => b.IsPossible == "true"); // 灞曠ず杩愯妫�淇殑
- // 濡傛灉鎻愪緵浜嗘悳绱㈠叧閿瓧锛屽垯杩涜妯$硦鏌ヨ
+ // 鎼滅储鍏抽敭瀛�
if (!string.IsNullOrEmpty(pagination.searchKeyword))
{
query = query.Where((a, b) =>
- a.UserTrueName.Contains(pagination.searchKeyword) || // 鎸夌湡瀹炲鍚嶆ā绯婃悳绱�
- a.Userteam.Contains(pagination.searchKeyword)); // 鎸夌敤鎴风彮缁勬ā绯婃悳绱�
+ a.UserTrueName.Contains(pagination.searchKeyword) ||
+ a.Userteam.Contains(pagination.searchKeyword));
}
- // 濡傛灉鎻愪緵浜� status 鍙傛暟锛屽垯鎸夌姸鎬佺瓫閫�
- if (pagination.status.HasValue)//绛変环if锛坰tatus锛�=null锛�
+ // 鐘舵�佸弬鏁�
+ if (pagination.status.HasValue)
{
query = query.Where((a, b) => b.MaintenanceStatus == pagination.status.Value);
}
- // 濡傛灉涓嶆槸绠$悊鍛橈紝鏍规嵁閮ㄩ棬杩囨护
+ // 濡傛灉涓嶆槸绠$悊鍛橈紝璇锋寜閮ㄩ棬杩囨护
if (pagination.account != "admin")
{
var currentUser = _user.Db.Queryable<Sys_User>()
@@ -144,7 +173,6 @@
}
int? deptId = currentUser.Dept_Id;
-
query = query.Where((a, b) => a.Dept_Id == deptId);
}
@@ -158,16 +186,16 @@
b.MaintenanceDate,
b.IsPossible,
})
- .ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount); // 鍒嗛〉
+ .ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount);
return new WebResponseContent
{
Status = true,
Data = new
{
- TotalCount = totalCount, // 鎬绘暟
- PageIndex = pagination.pageIndex, // 褰撳墠椤电爜
- PageSize = pagination.pageSize, // 姣忛〉鏁版嵁閲�
+ TotalCount = totalCount,
+ PageIndex = pagination.pageIndex,
+ PageSize = pagination.pageSize,
Items = result
}
};
@@ -193,11 +221,26 @@
try
{
var mon = BaseDal.QueryFirst(x => x.ID == id);
+ if (mon == null)
+ {
+ return new WebResponseContent { Status = false, Message = "鏃犳硶鏇存敼锛屾病鏈夋壘鍒拌鐢ㄦ埛" };
+ }
+ var sysuer = _user.QueryData(x => x.UserName == mon.UserAccount).FirstOrDefault();
if (ispossible == "true")
{
mon.IsPossible = "true";
mon.MaintenanceDate = DateTime.Now;
BaseDal.UpdateData(mon);
+ var recording = new Dt_MaintenanceTeam
+ {
+ OperatorName = sysuer.UserTrueName,
+ TeamName = sysuer.RoleName,
+ DistributionTime = DateTime.Now,
+ Creater = "admin",
+ CreateDate = DateTime.Now,
+
+ };
+ _team.AddData(recording);
}
else
{
diff --git a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
index ebcf6ae..45cd188 100644
--- a/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
+++ b/project/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs
@@ -9,6 +9,7 @@
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_ITelescopicService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -31,35 +32,21 @@
/// 鑷姩鎺у埗浼哥缉鏉嗙殑浼稿嚭鍜岀缉鍥為�熷害
/// </summary>
/// <param name="ExtendedState">浼�/鍑虹姸鎬�</param>
- /// <param name="account">鐢ㄦ埛璐﹀彿</param>
/// <returns></returns>
- public WebResponseContent automation(string ExtendedState, string account)
+ public WebResponseContent automation(string ExtendedState)
{
try
{
- var loginer = _user.QueryData(x => x.UserName == account).FirstOrDefault();
- if (loginer == null)
- return new WebResponseContent { Status = false, Message = "鐧诲綍鐢ㄦ埛涓嶅瓨鍦�" };
- // 璁惧缂栧彿瑙勫垯鏄寜閮ㄩ棬缂栧彿渚濇涓� SSG001~SSG010
- string liftDeviceCode = $"SSG{(loginer.Dept_Id * 2 - 1):D3}";
- string rightDeviceCode = $"SSG{(loginer.Dept_Id * 2):D3}";
-
- OtherDevice liftDevice = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == liftDeviceCode);
- OtherDevice rightDevice = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == rightDeviceCode);
-
- if (liftDevice == null || rightDevice == null)
+ //鏍规嵁int.TryParse(AppSettings.Get("DepartmentID")璇诲彇鍒板綋鍓嶆槸杞ㄩ亾鍑狅紝鎵�鏈変汉閮藉彧鑳芥搷浣滃綋鍓�
+ if (!int.TryParse(AppSettings.Get("DepartmentID"), out int deid))
{
- return new WebResponseContent { Status = false, Message = $"璁惧 {liftDeviceCode} 鎴� {rightDeviceCode} 鏈壘鍒�" };
- }
-
- if (liftDevice.Communicator == null || rightDevice.Communicator == null)
- {
- return new WebResponseContent { Status = false, Message = "璁惧閫氳鏈垵濮嬪寲" };
- }
+ return new WebResponseContent { Status = false, Message = "閰嶇疆椤� DepartmentID 鏃犳硶杞崲涓烘暣鏁�" };
+ };
+ var devices = GetDevicesByDeptId(deid);
//鎵惧埌Dt_Parameters涓殑鏈�鏂颁竴鏉℃暟鎹�
- var para = BaseDal.QueryData().OrderByDescending(x => x.CreateDate).FirstOrDefault();
+ var para = BaseDal.QueryData().Where(x=>x.Deptid== deid).OrderByDescending(x => x.CreateDate).FirstOrDefault();
if (para == null)
return new WebResponseContent { Status = false, Message = "鏈壘鍒板弬鏁伴厤缃�" };
@@ -68,19 +55,19 @@
if (ExtendedState == "浼稿嚭")
{
- liftDevice.Communicator.Write<int>("D500", ext);
- liftDevice.Communicator.Write<bool>("M100", true);
- rightDevice.Communicator.Write<int>("D500", ext);
- rightDevice.Communicator.Write<bool>("M100", true);
- Console.WriteLine($"浼哥缉鏉嗕几鍑� {ext}");
+ devices.Value.left.Communicator.Write<int>("D500", ext);//浼稿嚭閫熷害
+ devices.Value.left.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
+ devices.Value.right.Communicator.Write<int>("D500", ext);//浼稿嚭閫熷害
+ devices.Value.right.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
+ Console.WriteLine($"鑷姩浼哥缉鏉嗕几鍑� {ext}");
}
else if (ExtendedState == "缂╁洖")
{
- liftDevice.Communicator.Write<int>("D501", ret);
- liftDevice.Communicator.Write<bool>("M101", true);
- rightDevice.Communicator.Write<int>("D501", ret);
- rightDevice.Communicator.Write<bool>("M101", true);
- Console.WriteLine($"浼哥缉鏉嗙缉鍥� {ret}");
+ devices.Value.left.Communicator.Write<int>("D501", ext);//浼稿嚭閫熷害
+ devices.Value.left.Communicator.Write<bool>("M101", true);//浼稿嚭鎸夐挳
+ devices.Value.right.Communicator.Write<int>("D501", ext);//浼稿嚭閫熷害
+ devices.Value.right.Communicator.Write<bool>("M101", true);//浼稿嚭鎸夐挳
+ Console.WriteLine($"鑷姩浼哥缉鏉嗙缉鍥� {ret}");
}
else
{
@@ -99,53 +86,55 @@
- public WebResponseContent ManualOperation(string position, string ExtendedState,string account)
- {
+ /// <summary>
+ /// 鎵嬪姩鎺у埗锛屼几缂╂潌鐨勭缉鍥炲拰浼稿嚭閫熷害
+ /// </summary>
+ /// <param name="position">浼哥缉鏉嗙殑浣嶇疆锛堝乏鍙筹級</param>
+ /// <param name="ExtendedState">浼�/缂╃姸鎬�</param>
+ /// <returns></returns>
+ ///
+ public WebResponseContent ManualOperation(string position, string ExtendedState)
+ {
try
{
- var loginer = _user.QueryData(x => x.UserName == account).FirstOrDefault();
- if (loginer == null)
- return new WebResponseContent { Status = false, Message = "鐢ㄦ埛涓嶅瓨鍦�" };
+ if (!int.TryParse(AppSettings.Get("DepartmentID"), out int deid))
+ {
+ return new WebResponseContent { Status = false, Message = "閰嶇疆椤� DepartmentID 鏃犳硶杞崲涓烘暣鏁�" };
+ }
+ var devices = GetDevicesByDeptId(deid);
- var devices = GetDevicesByDeptId((int)loginer.Dept_Id);
- if (devices == null)
- return new WebResponseContent { Status = false, Message = "璁惧鏈壘鍒�" };
-
- var para = BaseDal.QueryData().OrderByDescending(x => x.CreateDate).FirstOrDefault();
- if (para == null)
- return new WebResponseContent { Status = false, Message = "鍙傛暟鏈厤缃�" };
-
- int ext = (int)para.ExtendSpeed;
- int ret = (int)para.RetractionSpeed;
-
+ //淇╀釜plc宸﹀彸鍚勪竴涓�
+ //OtherDevice liftotherDevice = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == "SSG001");
+ //OtherDevice rightotherDevice = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == "SSG002");
+ //鎵惧埌Dt_Parameters涓殑鏈�鏂颁竴鏉℃暟鎹牴鎹綋鍓嶇殑deid
+ var para = BaseDal.QueryData().Where(x => x.Deptid == deid).OrderByDescending(x => x.CreateDate).FirstOrDefault();
+ int ext = (int)para.ManualExtend;//鎵嬪姩浼稿嚭閫熷害
+ int ret = (int)para.ManualRetraction;//鎵嬪姩缂╁洖閫熷害
if (position == "宸�" && ExtendedState == "浼稿嚭")
{
- devices.Value.left.Communicator.Write<int>("D500", ext);
- devices.Value.left.Communicator.Write<bool>("M100", true);
+ devices.Value.left.Communicator.Write<int>("D500", ext);//浼稿嚭閫熷害
+ devices.Value.left.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
+ Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄤ几鍑簕ext}");
}
else if (position == "宸�" && ExtendedState == "缂╁洖")
{
- devices.Value.left.Communicator.Write<int>("D501", ret);
+ devices.Value.left.Communicator.Write<int>("D501", ret);//缂╁洖閫熷害
devices.Value.left.Communicator.Write<bool>("M101", true);
+ Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄧ缉鍥瀧ret}");
}
else if (position == "鍙�" && ExtendedState == "浼稿嚭")
{
devices.Value.right.Communicator.Write<int>("D500", ext);
devices.Value.right.Communicator.Write<bool>("M100", true);
+ Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄤ几鍑簕ext}");
}
else if (position == "鍙�" && ExtendedState == "缂╁洖")
{
devices.Value.right.Communicator.Write<int>("D501", ret);
devices.Value.right.Communicator.Write<bool>("M101", true);
+ Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄧ缉鍥瀧ret}");
}
-
- else
- {
- return new WebResponseContent { Status = false, Message = "鐘舵�佸弬鏁伴敊璇�" };
- }
-
return new WebResponseContent { Status = true, Message = "鎴愬姛" };
-
}
catch (Exception ex)
{
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs"
index cc0928a..1523f08 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs"
@@ -20,7 +20,7 @@
/// </summary>
/// <param name="ExtendedState">浼�/鍑虹姸鎬�</param>
/// <returns></returns>
- WebResponseContent automation(string ExtendedState, string account);
+ WebResponseContent automation(string ExtendedState);
/// <summary>
/// 鎵嬪姩鎺у埗锛屼几缂╂潌鐨勭缉鍥炲拰浼稿嚭閫熷害
@@ -29,7 +29,7 @@
/// <param name="ExtendedState">浼�/缂╃姸鎬�</param>
/// <returns></returns>
///
- WebResponseContent ManualOperation(string position, string ExtendedState, string account);
+ WebResponseContent ManualOperation(string position, string ExtendedState, int DeptId);
}
}
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Parameters.cs" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Parameters.cs"
index 1731298..31e8bd2 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Parameters.cs"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Parameters.cs"
@@ -42,5 +42,12 @@
/// </summary>
[SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "鎵嬪姩缂╁洖閫熷害")]
public double ManualRetraction { get; set; }
+
+
+ /// <summary>
+ /// 閮ㄩ棬id
+ /// </summary>
+ [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "閮ㄩ棬id")]
+ public int Deptid { get; set; }
}
}
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs"
index 8c93625..1af844f 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs"
@@ -25,9 +25,9 @@
/// <returns></returns>
///
[HttpPost,Route("ManualOperation"),AllowAnonymous]
- public WebResponseContent ManualOperation(string position, string ExtendedState, string account)
+ public WebResponseContent ManualOperation(string position, string ExtendedState, int DeptId)
{
- return Service.ManualOperation(position, ExtendedState, account);
+ return Service.ManualOperation(position, ExtendedState, DeptId);
}
/// <summary>
@@ -37,9 +37,9 @@
/// <returns></returns>
[HttpPost,Route("automation"),AllowAnonymous]
- public WebResponseContent automation(string ExtendedState, string account)
+ public WebResponseContent automation(string ExtendedState)
{
- return Service.automation(ExtendedState, account);
+ return Service.automation(ExtendedState);
}
}
}
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs"
index 434230c..fbdb0ca 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs"
@@ -30,7 +30,7 @@
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()).ConfigureContainer<ContainerBuilder>(builder =>
{
- builder.RegisterModule(new AutofacModuleRegister());//带有接口层的服务注入
+ builder.RegisterModule(new AutofacModuleRegister());//锟斤拷锟叫接口诧拷姆锟斤拷锟阶拷锟�
builder.RegisterModule(new QuartzJobAutofacModuleRegister());
builder.RegisterModule<AutofacPropertityModuleReg>();//
}).ConfigureAppConfiguration((hostingContext, config) =>
@@ -41,14 +41,14 @@
}); ;
builder.ConfigureApplication();
-// 2、配置服务
-builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注册
-builder.Services.AddAllOptionRegister();//读取配置文件
-builder.Services.AddMemoryCacheSetup();//缓存
-builder.Services.AddSqlsugarSetup();//SqlSugar 启动服务
-//builder.Services.AddInitializationHostServiceSetup();//应用初始化服务注入
+// 2锟斤拷锟斤拷锟矫凤拷锟斤拷
+builder.Services.AddSingleton(new AppSettings(builder.Configuration));//注锟斤拷
+builder.Services.AddAllOptionRegister();//锟斤拷取锟斤拷锟斤拷锟侥硷拷
+builder.Services.AddMemoryCacheSetup();//锟斤拷锟斤拷
+builder.Services.AddSqlsugarSetup();//SqlSugar 锟斤拷锟斤拷锟斤拷锟斤拷
+//builder.Services.AddInitializationHostServiceSetup();//应锟矫筹拷始锟斤拷锟斤拷锟斤拷注锟斤拷
builder.Services.AddHostedService<SeedDataHostedService>();
-builder.Services.AddDbSetup();//Db 启动服务
+builder.Services.AddDbSetup();//Db 锟斤拷锟斤拷锟斤拷锟斤拷
builder.Services.AddScoped<QuartzJobCreateDataTabel>();
builder.Services.AddHostedService<QuartzJobDataTableHostedService>();
@@ -65,7 +65,7 @@
builder.Services.AddSwaggerSetup();
-builder.Services.AddJobSetup();//任务调度 启动服务
+builder.Services.AddJobSetup();//锟斤拷锟斤拷锟斤拷锟� 锟斤拷锟斤拷锟斤拷锟斤拷
builder.Services.AddHttpContextSetup();
@@ -79,7 +79,7 @@
builder.Services.AddAuthorizationSetup();
-builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit限流 启动服务
+builder.Services.AddIpPolicyRateLimitSetup(builder.Configuration);//IPLimit锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷
builder.Services.AddScoped<UseServiceDIAttribute>();
@@ -89,7 +89,7 @@
builder.Services.AddControllers(o =>
{
- o.Filters.Add(typeof(GlobalExceptionsFilter));//全局异常
+ o.Filters.Add(typeof(GlobalExceptionsFilter));//全锟斤拷锟届常
})
.AddNewtonsoftJson(options =>
{
@@ -110,20 +110,20 @@
var app = builder.Build();
-// 3、配置中间件
-app.UseMiniProfiler();//性能分析器
-app.ConfigureApplication();//配置文件
-app.UseApplicationSetup();//启动配置
+// 3锟斤拷锟斤拷锟斤拷锟叫硷拷锟�
+app.UseMiniProfiler();//锟斤拷锟杰凤拷锟斤拷锟斤拷
+app.ConfigureApplication();//锟斤拷锟斤拷锟侥硷拷
+app.UseApplicationSetup();//锟斤拷锟斤拷锟斤拷锟斤拷
app.UseAllServicesMiddle(builder.Services);
-//FaceAI.Face.Main();//人脸识别
+//FaceAI.Face.sdk_init(null);//锟斤拷锟斤拷识锟斤拷
app.UseSession();
//if (app.Environment.IsDevelopment())
{
//todo
app.UseSwaggerAuthorized();
- app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html") ?? throw new Exception("未找到WIDESEAWCS_Server.index.html文件"));
-}//判断是否需要打开swagger
+ app.UseSwaggerMiddle(() => Assembly.GetExecutingAssembly().GetManifestResourceStream("WIDESEAWCS_Server.index.html") ?? throw new Exception("未锟揭碉拷WIDESEAWCS_Server.index.html锟侥硷拷"));
+}//锟叫讹拷锟角凤拷锟斤拷要锟斤拷swagger
app.UseIpLimitMiddle();
app.UseApiLogMiddleware();
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile1.pubxml" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile1.pubxml"
new file mode 100644
index 0000000..be1824a
--- /dev/null
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile1.pubxml"
@@ -0,0 +1,17 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<!--
+https://go.microsoft.com/fwlink/?LinkID=208121.
+-->
+<Project>
+ <PropertyGroup>
+ <DeleteExistingFiles>false</DeleteExistingFiles>
+ <ExcludeApp_Data>false</ExcludeApp_Data>
+ <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
+ <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
+ <LastUsedPlatform>Any CPU</LastUsedPlatform>
+ <PublishProvider>FileSystem</PublishProvider>
+ <PublishUrl>E:\鍙戝竷鏂囦欢\鍚庡彴</PublishUrl>
+ <WebPublishMethod>FileSystem</WebPublishMethod>
+ <_TargetId>Folder</_TargetId>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json"
index faaddbe..5f24c1f 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json"
@@ -38,5 +38,8 @@
"LogAOPEnable": true, //鏄惁璁板綍AOP鏃ュ織
"WebSocketEnable": true,
//"WebSocketPort": 9260
- "WebSocketPort": 5173
+ "WebSocketPort": 5173,
+ "DepartmentID": "1" //杩欎釜鏄几鍑�/浼稿洖鐨勯儴闂╥d
+
}
+//鍗曟満鐗�
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs"
index af5f99c..f343ec7 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Tasks/SSG/AlarmResetJob.cs"
@@ -66,7 +66,7 @@
try
{
var stuck = device.Communicator.Read<bool>("M104");//浼哥缉鏉嗘姤璀�//榛樿鏄痜alse
- var other = device.Communicator.Read<bool>("M105");//鍏朵粬鎶ヨ //榛樿鏄�
+ var other = device.Communicator.Read<bool>("M105");//鍏朵粬鎶ヨ //榛樿鏄痜alse
Console.WriteLine($"{device.DeviceName}:鍗′綇鎶ヨ鐨勯粯璁ゅ�间负{stuck}锛屽叾浠栨姤璀︾殑榛樿鍊间负{other}");
string location = device.DeviceCode switch
{
@@ -74,11 +74,11 @@
"SSG002" => "杞ㄩ亾涓�-鍙�",
"SSG003" => "杞ㄩ亾浜�-宸�",
"SSG004" => "杞ㄩ亾浜�-鍙�",
- "SSG005" => "杞ㄩ亾涓�-鍙�",
+ "SSG005" => "杞ㄩ亾涓�-宸�",
"SSG006" => "杞ㄩ亾涓�-鍙�",
- "SSG007" => "杞ㄩ亾鍥�-鍙�",
+ "SSG007" => "杞ㄩ亾鍥�-宸�",
"SSG008" => "杞ㄩ亾鍥�-鍙�",
- "SSG009" => "杞ㄩ亾浜�-鍙�",
+ "SSG009" => "杞ㄩ亾浜�-宸�",
"SSG0010" => "杞ㄩ亾浜�-鍙�",
// 渚濇绫绘帹...
_ => $"鏈煡璁惧({device.DeviceCode})"
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
index 8a0db39..0219037 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
@@ -13,17 +13,20 @@
using WIDESEAWCS_DTO;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using WIDESEAWCS_DTO.Telescopic;
+using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace WIDESEAWCS_TelescopicService
{
public class MaintenanceService : ServiceBase<Dt_Maintenance, IRepository<Dt_Maintenance>>, IMaintenanceService
{
public IRepository<Dt_Maintenance> Repository => BaseDal;
+ public readonly IRepository<Dt_MaintenanceTeam> _team;
private readonly IRepository<Sys_User> _user;
- public MaintenanceService(IRepository<Dt_Maintenance> BaseDal, IRepository<Sys_User> user) : base(BaseDal)
+ public MaintenanceService(IRepository<Dt_Maintenance> BaseDal, IRepository<Sys_User> user, IRepository<Dt_MaintenanceTeam> team) : base(BaseDal)
{
_user = user;
+ _team = team;
}
@@ -53,7 +56,10 @@
a.CardNumber,
a.Userteam,
a.HeadImageUrl,
- b.IsPossible
+ a.Dept_Id,
+ b.IsPossible,
+
+
}).ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount);
return new WebResponseContent
{
@@ -87,26 +93,48 @@
{
try
{
+ // 绗竴姝ワ細鑷姩娓呯悊杩囨湡妫�淇姸鎬�
+ var today = DateTime.Today;
+ var recordsToUpdate = Db.Queryable<Dt_Maintenance>()
+ .Where(b => b.MaintenancStartTime != null &&
+ b.MaintenancStartTime.Value.Date < today) // Assuming 0 is false
+ .ToList();
+
+ if (recordsToUpdate.Count > 0)
+ {
+ foreach (var record in recordsToUpdate)//鏇存柊
+ {
+ record.MaintenancStartTime = null;//娓呯┖寮�濮嬫椂闂�
+ record.MaintenancEendTime = null;//娓呯┖缁撴潫鏃堕棿
+ record.MaintenanceStatus = 0; // Set to false
+ record.IsPossible = "NULL"; //鏇存敼鐘舵�佷负false涓嶈繍琛屾淇�//榛樿涓篘ULL
+ }
+ Db.Updateable(recordsToUpdate).ExecuteCommand();
+
+ }
+
int totalCount = 0;
var sys = _user.Db.Queryable<Sys_User>();
var main = Db.Queryable<Dt_Maintenance>();
var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount)
- .Where((a, b) => b.IsPossible == "true"); // 鍏堢瓫閫� IsPossible 涓� true 鐨勬暟鎹�
+ .Where((a, b) => b.IsPossible == "true"); // Filter IsPossible true first
- // 濡傛灉鎻愪緵浜嗘悳绱㈠叧閿瓧锛屽垯杩涜妯$硦鏌ヨ
+ // 鎼滅储鍏抽敭瀛�
if (!string.IsNullOrEmpty(pagination.searchKeyword))
{
query = query.Where((a, b) =>
- a.UserTrueName.Contains(pagination.searchKeyword) || // 鎸夌湡瀹炲鍚嶆ā绯婃悳绱�
- a.Userteam.Contains(pagination.searchKeyword)); // 鎸夌敤鎴风彮缁勬ā绯婃悳绱�
+ a.UserTrueName.Contains(pagination.searchKeyword) ||
+ a.Userteam.Contains(pagination.searchKeyword));
}
- // 濡傛灉鎻愪緵浜� status 鍙傛暟锛屽垯鎸夌姸鎬佺瓫閫�
- if (pagination.status.HasValue)//绛変环if锛坰tatus锛�=null锛�
+ // 鐘舵�佸弬鏁�
+ if (pagination.status.HasValue)
{
query = query.Where((a, b) => b.MaintenanceStatus == pagination.status.Value);
}
+
+
var result = query
.Select((a, b) => new
@@ -118,16 +146,16 @@
b.MaintenanceDate,
b.IsPossible,
})
- .ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount); // 鍒嗛〉
+ .ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount);
return new WebResponseContent
{
Status = true,
Data = new
{
- TotalCount = totalCount, // 鎬绘暟
- PageIndex = pagination.pageIndex, // 褰撳墠椤电爜
- PageSize = pagination.pageSize, // 姣忛〉鏁版嵁閲�
+ TotalCount = totalCount,
+ PageIndex = pagination.pageIndex,
+ PageSize = pagination.pageSize,
Items = result
}
};
@@ -153,17 +181,35 @@
try
{
var mon = BaseDal.QueryFirst(x => x.ID == id);
+ if (mon==null)
+ {
+ return new WebResponseContent { Status = false, Message = "鏃犳硶鏇存敼锛屾病鏈夋壘鍒拌鐢ㄦ埛" };
+ }
+ var sysuer = _user.QueryData(x => x.UserName == mon.UserAccount).FirstOrDefault();
+
if (ispossible == "true")
{
mon.IsPossible = "true";
mon.MaintenanceDate = DateTime.Now;
BaseDal.UpdateData(mon);
+ var recording = new Dt_MaintenanceTeam
+ {
+ OperatorName = sysuer.UserTrueName,
+ TeamName = sysuer.RoleName,
+ DistributionTime = DateTime.Now,
+ Creater = "admin",
+ CreateDate = DateTime.Now,
+
+ };
+ _team.AddData(recording);
}
else
{
mon.IsPossible = "false";
BaseDal.UpdateData(mon);
}
+
+
return new WebResponseContent { Status = true, Data = mon };
}
catch (Exception ex)
diff --git "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs" "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
index fb818db..a10f1af 100644
--- "a/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
+++ "b/project/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
@@ -9,6 +9,7 @@
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseRepository;
using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_ITelescopicService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -28,72 +29,73 @@
/// <summary>
- /// 鑷姩鎺у埗浼哥缉鏉嗙殑浼稿嚭鍜岀缉鍥為�熷害
+ /// 鑷姩鎺у埗浼哥缉鏉嗙殑浼稿嚭鍜岀缉鍥為�熷害锛堜竴娆℃�ф帶鍒舵墍鏈夌殑锛�
/// </summary>
/// <param name="ExtendedState">浼�/鍑虹姸鎬�</param>
- /// <param name="account">鐢ㄦ埛璐﹀彿</param>
/// <returns></returns>
- public WebResponseContent automation(string ExtendedState, string account)
+ public WebResponseContent automation(string extendedState)
{
try
{
- var loginer = _user.QueryData(x => x.UserName == account).FirstOrDefault();
- if (loginer == null)
- return new WebResponseContent { Status = false, Message = "鐧诲綍鐢ㄦ埛涓嶅瓨鍦�" };
-
- // 璁惧缂栧彿瑙勫垯鏄寜閮ㄩ棬缂栧彿渚濇涓� SSG001~SSG010
- string liftDeviceCode = $"SSG{(loginer.Dept_Id * 2 - 1):D3}";
- string rightDeviceCode = $"SSG{(loginer.Dept_Id * 2):D3}";
-
- OtherDevice liftDevice = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == liftDeviceCode);
- OtherDevice rightDevice = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == rightDeviceCode);
-
- if (liftDevice == null || rightDevice == null)
+ for (int deptId = 1; deptId <= 5; deptId++)
{
- return new WebResponseContent { Status = false, Message = $"璁惧 {liftDeviceCode} 鎴� {rightDeviceCode} 鏈壘鍒�" };
+ var devices = GetDevicesByDeptId(deptId);
+ if (devices == null)
+ {
+ Console.WriteLine($"DeptId={deptId} 鏈壘鍒拌澶囷紝璺宠繃");
+ continue;
+ }
+
+ var para = BaseDal.QueryData()
+ .Where(x => x.Deptid == deptId)
+ .OrderByDescending(x => x.CreateDate)
+ .FirstOrDefault();
+
+ if (para == null)
+ {
+ Console.WriteLine($"DeptId={deptId} 鏈壘鍒板弬鏁伴厤缃紝璺宠繃");
+ continue;
+ }
+
+ int ext = (int)para.ExtendSpeed;
+ int ret = (int)para.RetractionSpeed;
+
+ if (extendedState == "浼稿嚭")
+ {
+ devices.Value.left.Communicator.Write<int>("D500", ext);//浼稿嚭閫熷害
+ devices.Value.left.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
+
+ devices.Value.right.Communicator.Write<int>("D500", ext);
+ devices.Value.right.Communicator.Write<bool>("M100", true);
+
+ Console.WriteLine($"DeptId={deptId} 浼稿嚭鎿嶄綔锛岄�熷害={ext}");
+ }
+ else if (extendedState == "缂╁洖")
+ {
+ devices.Value.left.Communicator.Write<int>("D501", ret);//浼稿嚭閫熷害
+ devices.Value.left.Communicator.Write<bool>("M101", true);//浼稿嚭鎸夐挳
+
+ devices.Value.right.Communicator.Write<int>("D501", ret);
+ devices.Value.right.Communicator.Write<bool>("M101", true);
+
+ Console.WriteLine($"DeptId={deptId} 缂╁洖鎿嶄綔锛岄�熷害={ret}");
+ }
+ else
+ {
+ return new WebResponseContent { Status = false, Message = "鏈煡鐨勬搷浣滃懡浠�" };
+ }
}
- if (liftDevice.Communicator == null || rightDevice.Communicator == null)
- {
- return new WebResponseContent { Status = false, Message = "璁惧閫氳鏈垵濮嬪寲" };
- }
-
- //鎵惧埌Dt_Parameters涓殑鏈�鏂颁竴鏉℃暟鎹�
- var para = BaseDal.QueryData().OrderByDescending(x => x.CreateDate).FirstOrDefault();
- if (para == null)
- return new WebResponseContent { Status = false, Message = "鏈壘鍒板弬鏁伴厤缃�" };
-
- int ext = (int)para.ExtendSpeed;
- int ret = (int)para.RetractionSpeed;
-
- if (ExtendedState == "浼稿嚭")
- {
- liftDevice.Communicator.Write<int>("D500", ext);
- liftDevice.Communicator.Write<bool>("M100", true);
- rightDevice.Communicator.Write<int>("D500", ext);
- rightDevice.Communicator.Write<bool>("M100", true);
- Console.WriteLine($"浼哥缉鏉嗕几鍑� {ext}");
- }
- else if (ExtendedState == "缂╁洖")
- {
- liftDevice.Communicator.Write<int>("D501", ret);
- liftDevice.Communicator.Write<bool>("M101", true);
- rightDevice.Communicator.Write<int>("D501", ret);
- rightDevice.Communicator.Write<bool>("M101", true);
- Console.WriteLine($"浼哥缉鏉嗙缉鍥� {ret}");
- }
- else
- {
- return new WebResponseContent { Status = false, Message = "鏈煡鐨勬搷浣滃懡浠�" };
- }
-
- return new WebResponseContent { Status = true, Message = "鎴愬姛" };
+ return new WebResponseContent { Status = true, Message = "鍏ㄩ儴璁惧鎿嶄綔瀹屾垚" };
}
catch (Exception ex)
{
- return new WebResponseContent { Status = false, Message = ex.Message };
+ return new WebResponseContent { Status = false, Message = $"鎿嶄綔寮傚父锛歿ex.Message}" };
}
}
+
+
+
@@ -116,53 +118,58 @@
// var para = BaseDal.QueryData().OrderBy(x => x.CreateDate).FirstOrDefault();
// int ext = (int)para.ManualExtend;//鑷姩浼稿嚭閫熷害
// int ret = (int)para.ManualRetraction;//鑷姩缂╁洖閫熷害
- // if (position == "宸�" && ExtendedState == "浼稿嚭")
- // {
- // var values = liftotherDevice.Communicator.Write<int>("D500", ext);//閫熷害
- // var button = liftotherDevice.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
- // Console.WriteLine($"{position}浼哥缉鏉嗕几鍑簕ext}");
- // }
- // if (position == "宸�" && ExtendedState == "缂╁洖")
- // {
- // var values = liftotherDevice.Communicator.Write<int>("D501", ret);
- //var button = liftotherDevice.Communicator.Write<bool>("M101", true);//缂╁洖鎸夐挳
- //Console.WriteLine($"{position}浼哥缉鏉嗙缉鍥瀧ret}");
- // }
-// if (position == "鍙�" && ExtendedState == "浼稿嚭")
-// {
-// var values = rightotherDevice.Communicator.Write<int>("D500", ext);//閫熷害
-// var button = rightotherDevice.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
-// Console.WriteLine($"{position}浼哥缉鏉嗕几鍑簕ext}");
-// }
-// if (position == "鍙�" && ExtendedState == "缂╁洖")
-// {
-// var values = rightotherDevice.Communicator.Write<int>("D501", ret);
-// var button = rightotherDevice.Communicator.Write<bool>("M101", true);//缂╁洖鎸夐挳
-// Console.WriteLine($"{position}浼哥缉鏉嗙缉鍥瀧ret}");
-// }
-// return new WebResponseContent { Status = true, Message = "鎴愬姛" };
-// }
-// catch (Exception ex)
-// {
-// return new WebResponseContent { Status = false, Message = ex.Message };
+ // if (position == "宸�" && ExtendedState == "浼稿嚭")
+ // {
+ // var values = liftotherDevice.Communicator.Write<int>("D500", ext);//閫熷害
+ // var button = liftotherDevice.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
+ // Console.WriteLine($"{position}浼哥缉鏉嗕几鍑簕ext}");
+ // }
+ // if (position == "宸�" && ExtendedState == "缂╁洖")
+ // {
+ // var values = liftotherDevice.Communicator.Write<int>("D501", ret);
+ //var button = liftotherDevice.Communicator.Write<bool>("M101", true);//缂╁洖鎸夐挳
+ //Console.WriteLine($"{position}浼哥缉鏉嗙缉鍥瀧ret}");
+ // }
+ // if (position == "鍙�" && ExtendedState == "浼稿嚭")
+ // {
+ // var values = rightotherDevice.Communicator.Write<int>("D500", ext);//閫熷害
+ // var button = rightotherDevice.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
+ // Console.WriteLine($"{position}浼哥缉鏉嗕几鍑簕ext}");
+ // }
+ // if (position == "鍙�" && ExtendedState == "缂╁洖")
+ // {
+ // var values = rightotherDevice.Communicator.Write<int>("D501", ret);
+ // var button = rightotherDevice.Communicator.Write<bool>("M101", true);//缂╁洖鎸夐挳
+ // Console.WriteLine($"{position}浼哥缉鏉嗙缉鍥瀧ret}");
+ // }
+ // return new WebResponseContent { Status = true, Message = "鎴愬姛" };
+ // }
+ // catch (Exception ex)
+ // {
+ // return new WebResponseContent { Status = false, Message = ex.Message };
-// }
-//}
+ // }
+ //}
- public WebResponseContent ManualOperation(string position, string ExtendedState,string account)
+
+ /// <summary>
+ /// 鎵嬪姩鎺у埗锛屼几缂╂潌鐨勭缉鍥炲拰浼稿嚭閫熷害
+ /// </summary>
+ /// <param name="position">浼哥缉鏉嗙殑浣嶇疆锛堝乏鍙筹級</param>
+ /// <param name="ExtendedState">浼�/缂╃姸鎬�</param>
+ /// <param name="DeptId">鑲¢亾鍙�</param>
+ /// <returns></returns>
+ public WebResponseContent ManualOperation(string position, string ExtendedState,int DeptId)
{
try
{
- var loginer = _user.QueryData(x => x.UserName == account).FirstOrDefault();
- if (loginer == null)
- return new WebResponseContent { Status = false, Message = "鐢ㄦ埛涓嶅瓨鍦�" };
- var devices = GetDevicesByDeptId((int)loginer.Dept_Id);
+ var devices = GetDevicesByDeptId(DeptId);
if (devices == null)
return new WebResponseContent { Status = false, Message = "璁惧鏈壘鍒�" };
- var para = BaseDal.QueryData().OrderByDescending(x => x.CreateDate).FirstOrDefault();
+ var para = BaseDal.QueryData(x=>x.Deptid== DeptId).OrderByDescending(x => x.CreateDate).FirstOrDefault();
if (para == null)
return new WebResponseContent { Status = false, Message = "鍙傛暟鏈厤缃�" };
@@ -171,23 +178,27 @@
if (position == "宸�" && ExtendedState == "浼稿嚭")
{
- devices.Value.left.Communicator.Write<int>("D500", ext);
- devices.Value.left.Communicator.Write<bool>("M100", true);
+ devices.Value.left.Communicator.Write<int>("D500", ext);//浼稿嚭閫熷害
+ devices.Value.left.Communicator.Write<bool>("M100", true);//浼稿嚭鎸夐挳
+ Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄤ几鍑簕ext}");
}
else if (position == "宸�" && ExtendedState == "缂╁洖")
{
- devices.Value.left.Communicator.Write<int>("D501", ret);
+ devices.Value.left.Communicator.Write<int>("D501", ret);//缂╁洖閫熷害
devices.Value.left.Communicator.Write<bool>("M101", true);
+ Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄧ缉鍥瀧ret}");
}
else if (position == "鍙�" && ExtendedState == "浼稿嚭")
{
devices.Value.right.Communicator.Write<int>("D500", ext);
devices.Value.right.Communicator.Write<bool>("M100", true);
+ Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄤ几鍑簕ext}");
}
else if (position == "鍙�" && ExtendedState == "缂╁洖")
{
devices.Value.right.Communicator.Write<int>("D501", ret);
devices.Value.right.Communicator.Write<bool>("M101", true);
+ Console.WriteLine($"{position}浼哥缉鏉嗘墜鍔ㄧ缉鍥瀧ret}");
}
else
@@ -216,8 +227,8 @@
// 宸﹁澶囧彿锛�1 -> 001锛�2 -> 003锛�3 -> 005...
int baseCode = 1 + (deptId - 1) * 2;
string leftCode = $"SSG{baseCode.ToString("D3")}";
+ //鍙宠澶囷細1->002 ,2->004
string rightCode = $"SSG{(baseCode + 1).ToString("D3")}";
-
var left = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == leftCode);
var right = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == rightCode);
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile1.pubxml" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile1.pubxml"
new file mode 100644
index 0000000..36847ea
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Properties/PublishProfiles/FolderProfile1.pubxml"
@@ -0,0 +1,17 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<!--
+https://go.microsoft.com/fwlink/?LinkID=208121.
+-->
+<Project>
+ <PropertyGroup>
+ <DeleteExistingFiles>false</DeleteExistingFiles>
+ <ExcludeApp_Data>false</ExcludeApp_Data>
+ <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
+ <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
+ <LastUsedPlatform>Any CPU</LastUsedPlatform>
+ <PublishProvider>FileSystem</PublishProvider>
+ <PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
+ <WebPublishMethod>FileSystem</WebPublishMethod>
+ <_TargetId>Folder</_TargetId>
+ </PropertyGroup>
+</Project>
\ No newline at end of file
--
Gitblit v1.9.3