提交 495ffad9 编写于 作者: W wq1234wq

设备超时设置

上级 49d59915
......@@ -12,7 +12,9 @@
</nz-select>
</se>
<se label="超时" error="超时" required>
<input nz-input formControlName="timeout" placeholder="名称" />
</se>
<se label="设备型号" error="设备型号" >
<nz-select formControlName="deviceModelId" placeholder="设备型号" >
<nz-option *ngFor="let o of devicemodel" [nzValue]="o.deviceModelId" [nzLabel]="o.modelName"></nz-option>
......
......@@ -55,6 +55,7 @@ export class DeviceformComponent implements OnInit {
deviceType: [null, [Validators.required]],
customerId: [null, []],
deviceModelId: [null, []],
timeout: [300, []],
id: [Guid.EMPTY, []],
identityType: [Guid.EMPTY, []],
});
......
......@@ -577,6 +577,7 @@ namespace IoTSharp.Controllers
dev.DeviceModel = _context.DeviceModels.FirstOrDefault(c => c.DeviceModelId == device.DeviceModelId);
dev.Name = device.Name;
dev.Timeout = device.Timeout;
try
{
await _context.SaveChangesAsync();
......@@ -621,7 +622,7 @@ namespace IoTSharp.Controllers
{
var cid = User.Claims.First(c => c.Type == IoTSharpClaimTypes.Customer);
var tid = User.Claims.First(c => c.Type == IoTSharpClaimTypes.Tenant);
var devvalue = new Device() { Name = device.Name, DeviceType = device.DeviceType, Timeout = 300, LastActive = DateTime.Now, Status = 1,
var devvalue = new Device() { Name = device.Name, DeviceType = device.DeviceType, Timeout = device.Timeout, LastActive = DateTime.Now, Status = 1,
DeviceModel = _context.DeviceModels.FirstOrDefault(c => c.DeviceModelId == device.DeviceModelId),
//CreateDate = DateTime.Today,
//CreateMonth =DateTime.Now.ToString("yyyy-MM"),
......@@ -629,8 +630,9 @@ namespace IoTSharp.Controllers
};
devvalue.Tenant = _context.Tenant.Find(new Guid(tid.Value));
devvalue.Customer = _context.Customer.Find(new Guid(cid.Value));
if (devvalue.Tenant == null || devvalue.Customer == null)
{
return new ApiResult<Device>(ApiCode.NotFoundTenantOrCustomer, "Not found Tenant or Customer", null);
......
......@@ -10,7 +10,9 @@ namespace IoTSharp.Dtos
{
public string Name { get; set; }
public DeviceType DeviceType { get; set; }
public Guid DeviceModelId { get; set; }
public Guid? DeviceModelId { get; set; }
public int Timeout { get; set; }
public IdentityType IdentityType { get; set; }
}
}
......@@ -11,7 +11,8 @@ namespace IoTSharp.Dtos
public Guid Id { get; set; }
public string Name { get; set; }
public Guid DeviceModelId { get; set; }
public int Timeout { get; set; }
public Guid? DeviceModelId { get; set; }
public IdentityType IdentityType { get; set; }
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册