diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicesConnectController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicesConnectController.cs index e2b3bfe0..d81ed9fa 100644 --- a/Src/Dlhis.Basic/Device/Controllers/DevicesConnectController.cs +++ b/Src/Dlhis.Basic/Device/Controllers/DevicesConnectController.cs @@ -72,10 +72,13 @@ public class DevicesConnectController : ControllerBase /// 获取品牌设备 /// /// + /// /// [HttpGet("brand-devices")] - public async Task> GetDeviceUniqueInfoByBrandAsync([Required(ErrorMessage = "请明确设备品牌")] string brand) + public async Task> GetDeviceUniqueInfoByBrandAsync( + [Required(ErrorMessage = "请明确设备品牌")] string brand, + [Required(ErrorMessage = "请明确厂区")] string factory) { - return await _deviceConnectService.GetDeviceUniqueInfoByBrandAsync(brand); + return await _deviceConnectService.GetDeviceUniqueInfoByBrandAsync(brand, factory); } } \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs index 40d4229d..598dbac2 100644 --- a/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs +++ b/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs @@ -37,11 +37,24 @@ public class DevicesController : ControllerBase /// /// /// + [Authorize(Roles = "admin")] [HttpGet("template/page")] public async Task> GetTemplatePageAsync([FromQuery] DeviceTemplatePageRequest request) { return await _deviceTemplateService.GetPageAsync(request); } + + /// + /// 设备模板保存 + /// + /// + /// + [Authorize(Roles = "admin")] + [HttpPost("template")] + public async Task SaveTemplateAsync(DeviceTemplateSaveRequest request) + { + await _deviceTemplateService.SaveTemplateAsync(request); + } /// @@ -70,17 +83,6 @@ public class DevicesController : ControllerBase return await _deviceConnectService.RegisterAsync(request); } - /// - /// 设备模板保存 - /// - /// - /// - [Authorize(Roles = "admin")] - [HttpPost("template")] - public async Task SaveTemplateAsync(DeviceTemplateSaveRequest request) - { - await _deviceTemplateService.SaveTemplateAsync(request); - } /// /// 设备分页 @@ -219,6 +221,6 @@ public class DevicesController : ControllerBase [HttpPost("import")] public async Task Import(List request) { - await _deviceService.ImportAsync(request); + await _deviceService.ImportAsync(request); } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Services/IDeviceConnectService.cs b/Src/Dlhis.Basic/Device/Services/IDeviceConnectService.cs index 9e3304bc..fed6c305 100644 --- a/Src/Dlhis.Basic/Device/Services/IDeviceConnectService.cs +++ b/Src/Dlhis.Basic/Device/Services/IDeviceConnectService.cs @@ -51,6 +51,7 @@ public interface IDeviceConnectService : IScopeDependency /// 根据品牌获取设备信息 /// /// + /// /// - Task> GetDeviceUniqueInfoByBrandAsync(string brand); + Task> GetDeviceUniqueInfoByBrandAsync(string brand, string factory); } \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceConnectService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceConnectService.cs index ba73cb91..629294ea 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceConnectService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceConnectService.cs @@ -123,12 +123,12 @@ public class DeviceConnectService : IDeviceConnectService }) .ToListAsync(); } - - public async Task> GetDeviceUniqueInfoByBrandAsync(string brand) + + public async Task> GetDeviceUniqueInfoByBrandAsync(string brand, string factory) { return await _dbContext.Queryable() .LeftJoin((d, dt) => d.TemplateCode == dt.Code) - .Where((d, dt) => dt.Brand == brand) + .Where((d, dt) => dt.Brand == brand && d.TenantId == factory) .Select(d => new DeviceUniqueWithConnectionInfoDto { DeviceUnique = d.UniqueNo, @@ -176,7 +176,7 @@ public class DeviceConnectService : IDeviceConnectService Funcs = new List(), Type = DeviceTypeEnumType.Meal, DeployPlace = deployPlace, - HeartbeatInterval = 30, + HeartbeatInterval = 0, DeployDirection = null, Enable = true, AsAttendance = false,