Commit a6211cdb by zxw

公共柜获取绑定信息

3d大屏接口调整
parent 8d9db90e
...@@ -457,7 +457,13 @@ namespace JunmpPoliceStation.Controllers ...@@ -457,7 +457,13 @@ namespace JunmpPoliceStation.Controllers
_unitOfWork.DbContext.BaseJpCabinetWorklogs _unitOfWork.DbContext.BaseJpCabinetWorklogs
.Where(x => x.DeviceNo == oldCabinetRealNum) .Where(x => x.DeviceNo == oldCabinetRealNum)
.UpdateFromQuery(x => new BaseJpCabinetWorklog { DeviceNo = replaceCabinetNum }); .UpdateFromQuery(x => new BaseJpCabinetWorklog { DeviceNo = replaceCabinetNum });
if (first.Type == 2)
{
//公共柜更新表base_jp_cabinet_policeman_multiple
_unitOfWork.DbContext.BaseJpCabinetPolicemanMultiples
.Where(x => x.CabinetRealId == oldCabinetRealNum)
.UpdateFromQuery(x => new BaseJpCabinetPolicemanMultiple { CabinetRealId = replaceCabinetNum });
}
} }
transaction.Commit(); transaction.Commit();
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
...@@ -3872,6 +3878,58 @@ namespace JunmpPoliceStation.Controllers ...@@ -3872,6 +3878,58 @@ namespace JunmpPoliceStation.Controllers
} }
/// <summary> /// <summary>
/// 获取公共柜下绑定的警员信息 公共柜使用
/// </summary>
/// <remarks>
/// ## 例子
///
/// {
/// cabinetRealID://单警柜号
/// }
///
/// </remarks>
/// <param name="jdata"></param>
/// <returns></returns>
[HttpPost("GetCabinetPolicemanMultiple")]
[NoSignAttribute]
public async Task<HttpResponseMessage> GetCabinetPolicemanMultiple([FromBody] JObject jdata)
{
return await Task.Run(() =>
{
try
{
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
string cabinetRealID = entity?.cabinetRealID ?? "";
var res = _unitOfWork.CabinetPolicemanMultipleRepository
.GetList(x => x.CabinetRealId == cabinetRealID, null, false)
.ToList();
var data = res.Select(x => new
{
x.CabinetRealId,
x.BoxNo,
x.UserId,
x.UserName
});
return JsonManager.ReturnSuccessResponse(data);
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
}
catch (Exception ex)
{
//_logger.LogError("Login/SignIn 错误:" + ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
});
}
/// <summary>
/// 绑定单警柜和警员信息 /// 绑定单警柜和警员信息
/// </summary> /// </summary>
/// <remarks> /// <remarks>
......
...@@ -11909,10 +11909,10 @@ namespace JunmpPoliceStation.Controllers ...@@ -11909,10 +11909,10 @@ namespace JunmpPoliceStation.Controllers
{ {
return JsonManager.SimpleCustResponse($"orgId is require"); return JsonManager.SimpleCustResponse($"orgId is require");
} }
if (!bOutInState) //if (!bOutInState) //异常入库无outInState
{ //{
return JsonManager.SimpleCustResponse($"outInState is require"); // return JsonManager.SimpleCustResponse($"outInState is require");
} //}
if (!bState) if (!bState)
{ {
return JsonManager.SimpleCustResponse($"state is require"); return JsonManager.SimpleCustResponse($"state is require");
......
...@@ -15,6 +15,7 @@ using JunmpPoliceStation.App_Start; ...@@ -15,6 +15,7 @@ using JunmpPoliceStation.App_Start;
using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Serialization;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Text; using System.Text;
using System.Web.Http;
namespace JunmpPoliceStation.Controllers namespace JunmpPoliceStation.Controllers
{ {
...@@ -47,34 +48,17 @@ namespace JunmpPoliceStation.Controllers ...@@ -47,34 +48,17 @@ namespace JunmpPoliceStation.Controllers
/// </remarks> /// </remarks>
/// <param name="jdata"></param> /// <param name="jdata"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("GetAllInventory")] [HttpGet("GetAllInventory")]
[NoSign] [NoSign]
public async Task<HttpResponseMessage> GetAllInventory([FromBody] JObject jdata) public HttpResponseMessage GetAllInventory(string warehouseId, string shelfId)
{
return await Task.Run(() =>
{ {
try try
{ {
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
int.TryParse(entity.page, out int page);
int.TryParse(entity.size, out int size);
if (size == 0)
{
size = 10;
}
var param = new string[] var param = new string[]
{ {
"EquipmentCodeNavigation", "EquipmentCodeNavigation",
}; };
string warehouseId = entity.warehouseId;
string shelfId = entity.shelfId;
if (String.IsNullOrEmpty(warehouseId)) if (String.IsNullOrEmpty(warehouseId))
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
...@@ -101,11 +85,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -101,11 +85,7 @@ namespace JunmpPoliceStation.Controllers
imgurl = "http://192.168.2.39:5000/Screen3DShow/1.png" imgurl = "http://192.168.2.39:5000/Screen3DShow/1.png"
}) })
.ToList(); .ToList();
//var content = new
//{
// totalElements = data.Count,
// content = data.Skip(page * size).Take(size)
//};
JsonSerializerSettings setting = new JsonSerializerSettings(); JsonSerializerSettings setting = new JsonSerializerSettings();
setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat; setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
...@@ -117,22 +97,16 @@ namespace JunmpPoliceStation.Controllers ...@@ -117,22 +97,16 @@ namespace JunmpPoliceStation.Controllers
return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(data, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") }; return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(data, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") };
} }
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
}
catch (Exception ex) catch (Exception ex)
{ {
//_logger.LogError("Login/SignIn 错误:" + ex.ToString()); //_logger.LogError("Login/SignIn 错误:" + ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
});
} }
/// <summary> /// <summary>
/// 获取出入库数据 /// 获取出入库数据(展示最新30条)
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// ///
...@@ -147,26 +121,12 @@ namespace JunmpPoliceStation.Controllers ...@@ -147,26 +121,12 @@ namespace JunmpPoliceStation.Controllers
/// </remarks> /// </remarks>
/// <param name="jdata"></param> /// <param name="jdata"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("GetInventoryInOutLog")] [HttpGet("GetInventoryInOutLog")]
[NoSign] [NoSign]
public async Task<HttpResponseMessage> GetInventoryInOutLog([FromBody] JObject jdata) public HttpResponseMessage GetInventoryInOutLog(string warehouseId)
{
return await Task.Run(() =>
{ {
try try
{ {
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
int.TryParse(entity.page, out int page);
int.TryParse(entity.size, out int size);
if (size == 0)
{
size = 10;
}
var param = new string[] var param = new string[]
{ {
"Eqiupment", "Eqiupment",
...@@ -174,21 +134,20 @@ namespace JunmpPoliceStation.Controllers ...@@ -174,21 +134,20 @@ namespace JunmpPoliceStation.Controllers
"Eqiupment.Shelf", "Eqiupment.Shelf",
}; };
string warehouseId = entity.warehouseId;
string shelfId = entity.shelfId;
if (String.IsNullOrEmpty(warehouseId)) if (String.IsNullOrEmpty(warehouseId))
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
} }
Expression<Func<CommonJpEquipmentState, bool>> expression = x => x.WarehouseId.Equals(warehouseId); Expression<Func<CommonJpEquipmentState, bool>> expression = x => x.WarehouseId.Equals(warehouseId) && !string.IsNullOrEmpty(x.EqiupmentId);
var equipmentStates = _unitOfWork.EquipmentStateRepository var equipmentStates = _unitOfWork.EquipmentStateRepository
.GetPage(expression, "-CreateTime", page, size, false, param); .GetList(expression, null, false, param)
.OrderByDescending(x => x.CreateTime)
.Take(30)
.ToList();
var data = equipmentStates.content var data = equipmentStates
.Select(x => new .Select(x => new
{ {
name = x.Eqiupment?.EquipmentCodeNavigation?.Name, name = x.Eqiupment?.EquipmentCodeNavigation?.Name,
...@@ -198,11 +157,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -198,11 +157,7 @@ namespace JunmpPoliceStation.Controllers
imgurl = "http://192.168.2.39:5000/Screen3DShow/1.png" imgurl = "http://192.168.2.39:5000/Screen3DShow/1.png"
}) })
.ToList(); .ToList();
//var content = new
//{
// totalElements = equipmentStates.totalElements,
// content = data
//};
JsonSerializerSettings setting = new JsonSerializerSettings(); JsonSerializerSettings setting = new JsonSerializerSettings();
setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat; setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
...@@ -213,12 +168,6 @@ namespace JunmpPoliceStation.Controllers ...@@ -213,12 +168,6 @@ namespace JunmpPoliceStation.Controllers
return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(data, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") }; return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(data, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") };
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -226,7 +175,6 @@ namespace JunmpPoliceStation.Controllers ...@@ -226,7 +175,6 @@ namespace JunmpPoliceStation.Controllers
//_logger.LogError("Login/SignIn 错误:" + ex.ToString()); //_logger.LogError("Login/SignIn 错误:" + ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
});
} }
/// <summary> /// <summary>
...@@ -245,34 +193,17 @@ namespace JunmpPoliceStation.Controllers ...@@ -245,34 +193,17 @@ namespace JunmpPoliceStation.Controllers
/// </remarks> /// </remarks>
/// <param name="jdata"></param> /// <param name="jdata"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("GetInventoryState")] [HttpGet("GetInventoryState")]
[NoSign] [NoSign]
public async Task<HttpResponseMessage> GetInventoryState([FromBody] JObject jdata) public HttpResponseMessage GetInventoryState(string warehouseId)
{
return await Task.Run(() =>
{ {
try try
{ {
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
int.TryParse(entity.page, out int page);
int.TryParse(entity.size, out int size);
if (size == 0)
{
size = 10;
}
var param = new string[] var param = new string[]
{ {
"EquipmentCodeNavigation", "EquipmentCodeNavigation",
}; };
string warehouseId = entity.warehouseId;
string shelfId = entity.shelfId;
if (String.IsNullOrEmpty(warehouseId)) if (String.IsNullOrEmpty(warehouseId))
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
...@@ -294,11 +225,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -294,11 +225,7 @@ namespace JunmpPoliceStation.Controllers
value = x.Count() value = x.Count()
}) })
.ToList(); .ToList();
//var content = new
//{
// totalElements = data.Count,
// content = data.Skip(page * size).Take(size)
//};
JsonSerializerSettings setting = new JsonSerializerSettings(); JsonSerializerSettings setting = new JsonSerializerSettings();
setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat; setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
...@@ -309,12 +236,6 @@ namespace JunmpPoliceStation.Controllers ...@@ -309,12 +236,6 @@ namespace JunmpPoliceStation.Controllers
return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(data, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") }; return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(data, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") };
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -322,7 +243,6 @@ namespace JunmpPoliceStation.Controllers ...@@ -322,7 +243,6 @@ namespace JunmpPoliceStation.Controllers
//_logger.LogError("Login/SignIn 错误:" + ex.ToString()); //_logger.LogError("Login/SignIn 错误:" + ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
});
} }
/// <summary> /// <summary>
...@@ -341,34 +261,18 @@ namespace JunmpPoliceStation.Controllers ...@@ -341,34 +261,18 @@ namespace JunmpPoliceStation.Controllers
/// </remarks> /// </remarks>
/// <param name="jdata"></param> /// <param name="jdata"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost("GetAllInventoryByCabinet")] [HttpGet("GetAllInventoryByCabinet")]
[NoSign] [NoSign]
public async Task<HttpResponseMessage> GetAllInventoryByCabinet([FromBody] JObject jdata) public HttpResponseMessage GetAllInventoryByCabinet(string orgId)
{
return await Task.Run(() =>
{ {
try try
{ {
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
int.TryParse(entity.page, out int page);
int.TryParse(entity.size, out int size);
if (size == 0)
{
size = 10;
}
var param = new string[] var param = new string[]
{ {
"EquipmentCodeNavigation", "EquipmentCodeNavigation",
"Cabinet", "Cabinet",
}; };
string orgId = entity.orgId;
if (String.IsNullOrEmpty(orgId)) if (String.IsNullOrEmpty(orgId))
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
...@@ -389,11 +293,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -389,11 +293,7 @@ namespace JunmpPoliceStation.Controllers
x.CurrentState==3?"在库":"不在库" x.CurrentState==3?"在库":"不在库"
}) })
.ToList(); .ToList();
//var content = new
//{
// totalElements = data.Count,
// content = data.Skip(page * size).Take(size)
//};
JsonSerializerSettings setting = new JsonSerializerSettings(); JsonSerializerSettings setting = new JsonSerializerSettings();
setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat; setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
...@@ -404,12 +304,6 @@ namespace JunmpPoliceStation.Controllers ...@@ -404,12 +304,6 @@ namespace JunmpPoliceStation.Controllers
return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(data, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") }; return new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(data, Formatting.Indented, setting), Encoding.GetEncoding("UTF-8"), "application/json") };
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -417,7 +311,6 @@ namespace JunmpPoliceStation.Controllers ...@@ -417,7 +311,6 @@ namespace JunmpPoliceStation.Controllers
//_logger.LogError("Login/SignIn 错误:" + ex.ToString()); //_logger.LogError("Login/SignIn 错误:" + ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
});
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论