Browse Source

878

master
fyf 2 years ago
parent
commit
525e0b575a
5 changed files with 44 additions and 5 deletions
  1. +3
    -3
      DataVAPI.ServerDB/MongoDB/MongodbHelper.cs
  2. +18
    -0
      DataVAPI/Controllers/DeviceController.cs
  3. +21
    -0
      DataVAPI/Controllers/OrderController.cs
  4. +1
    -1
      DataVIOT.Help/MainWindow.xaml
  5. +1
    -1
      DataVIOT.Help/ViewModel/MainViewModel.cs

+ 3
- 3
DataVAPI.ServerDB/MongoDB/MongodbHelper.cs View File

@@ -79,7 +79,7 @@ namespace DataVAPI.ServerDB.MongoDB

public void Modify(string id, string field, string value)
{
var filter = Builders<T>.Filter.Eq("IdStr", id);
var filter = Builders<T>.Filter.Eq("Id", id);
var updated = Builders<T>.Update.Set(field, value);
UpdateResult result = collection.UpdateOneAsync(filter, updated).Result;
}
@@ -115,13 +115,13 @@ namespace DataVAPI.ServerDB.MongoDB
old.State = "y";
old.UpdateTime = DateTime.Now;//.ToString("yyyy-MM-dd HH:mm:ss");

var filter = Builders<T>.Filter.Eq("IdStr", entity.Id);
var filter = Builders<T>.Filter.Eq("Id", entity.Id);
ReplaceOneResult result = collection.ReplaceOneAsync(filter, old).Result;
}

public void Delete(string id)
{
var filter = Builders<T>.Filter.Eq("IdStr",id);
var filter = Builders<T>.Filter.Eq("Id", id);
collection.DeleteOneAsync(filter);
}



+ 18
- 0
DataVAPI/Controllers/DeviceController.cs View File

@@ -88,6 +88,24 @@ namespace DataVAPI.Controllers
}
}
/// <summary>
/// 根据设备名称查询数据
/// </summary>
/// <param name="id">ID</param>
[HttpGet]
public JsonMsg<DeviceTable> QueryDeviceName(string DeviceName)
{
st = System.Reflection.MethodBase.GetCurrentMethod().Name;
try
{
DeviceTable device = mg.QueryDeviceName(DeviceName);
return JsonMsg<DeviceTable>.OK(device, st);
}
catch (Exception ex)
{
return JsonMsg<DeviceTable>.Error(null, st, ex.Message);
}
}
/// <summary>
/// 根据客户端ID、设备ID、时间查询设备信息
/// </summary>
/// <param name="clientId">客户端ID</param>


+ 21
- 0
DataVAPI/Controllers/OrderController.cs View File

@@ -29,6 +29,27 @@ namespace DataVAPI.Controllers
return JsonMsg<object>.Error(null, st, ex.Message);
}
}
/// <summary>
///
/// </summary>
/// <param name="auth"></param>
/// <returns></returns>
[HttpGet]
public JsonMsg<object> GetAllOrderDataState(int OrgId)
{
st = System.Reflection.MethodBase.GetCurrentMethod().Name;
try
{
FullScreenInput fullScreen = new FullScreenInput();
fullScreen.OrgId = OrgId;
object retdata = orderProvider.GetAllOrderDataState(fullScreen);
return JsonMsg<object>.OK(retdata, st);
}
catch (System.Exception ex)
{
return JsonMsg<object>.Error(null, st, ex.Message);
}
}

/// <summary>
/// 折线图


+ 1
- 1
DataVIOT.Help/MainWindow.xaml View File

@@ -35,7 +35,7 @@
<StackPanel Grid.Column="0" Margin="10">
<StackPanel Orientation="Horizontal" Margin="0,20,0,0">
<TextBlock Width="150">API查询地址:</TextBlock>
<TextBox x:Name="apiurl" Margin="10,0,0,0" Width="200">http://111.9.47.105:21527/datav</TextBox>
<TextBox x:Name="apiurl" Margin="10,0,0,0" Width="200">https://bpa.black-pa.com:21527/datav</TextBox>
<Button Tag="SetUrl" Margin="10,0,0,0" Click="Button_Click" >设置</Button>
</StackPanel>


+ 1
- 1
DataVIOT.Help/ViewModel/MainViewModel.cs View File

@@ -51,7 +51,7 @@ namespace DataVIOT.Help.ViewModel
/// <summary>
/// API 地址
/// </summary>
public string ApiURL = "http://192.168.1.90:6005";
public string ApiURL = "https://bpa.black-pa.com:21527/datav";
#endregion

#region 不需要监听


Loading…
Cancel
Save