Commit 8fa4380a by zxw

1

parent e4279208
...@@ -100,6 +100,11 @@ namespace JmpModel.Model ...@@ -100,6 +100,11 @@ namespace JmpModel.Model
[Column("file_url")] [Column("file_url")]
[StringLength(255)] [StringLength(255)]
public string FileUrl { get; set; } public string FileUrl { get; set; }
/// <summary>
/// 是否绑定单警柜(领用)
/// </summary>
[Column("is_bind_cabinet")]
public bool? IsBindCabinet { get; set; }
[ForeignKey(nameof(ApplyId))] [ForeignKey(nameof(ApplyId))]
[InverseProperty(nameof(BaseJpPoliceman.CommonJpBorrowReturnApplyApplies))] [InverseProperty(nameof(BaseJpPoliceman.CommonJpBorrowReturnApplyApplies))]
......
...@@ -1221,6 +1221,8 @@ Smart:智能货架 ...@@ -1221,6 +1221,8 @@ Smart:智能货架
.IsUnicode(false) .IsUnicode(false)
.HasComment("单据附加文件地址(上传)"); .HasComment("单据附加文件地址(上传)");
entity.Property(e => e.IsBindCabinet).HasComment("是否绑定单警柜(领用)");
entity.Property(e => e.Note).IsUnicode(false); entity.Property(e => e.Note).IsUnicode(false);
entity.Property(e => e.OrderCode).IsUnicode(false); entity.Property(e => e.OrderCode).IsUnicode(false);
......
...@@ -3,6 +3,7 @@ using JmpCommon.Tools; ...@@ -3,6 +3,7 @@ using JmpCommon.Tools;
using JmpModel.Model; using JmpModel.Model;
using JmpModel.Model.Repository; using JmpModel.Model.Repository;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
...@@ -34,13 +35,13 @@ namespace JunmpPoliceStation.App_Start ...@@ -34,13 +35,13 @@ namespace JunmpPoliceStation.App_Start
private readonly INacosNamingClient _serverNamingClient; private readonly INacosNamingClient _serverNamingClient;
private readonly IHttpClientFactory _clientFactory; private readonly IHttpClientFactory _clientFactory;
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }
private ILogger<PrintController> _logger; private ILogger<AuthLoginAttribute> _logger;
private Boolean flg; private Boolean flg;
ApiConfig apicfg; ApiConfig apicfg;
string urlGetSecretKey = string.Empty;//获取seckey的路由 string urlGetSecretKey = string.Empty;//获取seckey的路由
string urlCheckApp = string.Empty;//获取审核的路由 string urlCheckApp = string.Empty;//获取审核的路由
public AuthLoginAttribute(IConfiguration configuration, ApiConfig apicfg, INacosServerManager _serverManager, INacosNamingClient _serverNamingClient, IHttpClientFactory _clientFactory, Boolean AuthFlg = true) public AuthLoginAttribute(IConfiguration configuration, ApiConfig apicfg, INacosServerManager _serverManager, INacosNamingClient _serverNamingClient, IHttpClientFactory _clientFactory, ILogger<AuthLoginAttribute> _logger, Boolean AuthFlg = true)
{ {
flg = AuthFlg; flg = AuthFlg;
this.apicfg = apicfg; this.apicfg = apicfg;
...@@ -48,6 +49,7 @@ namespace JunmpPoliceStation.App_Start ...@@ -48,6 +49,7 @@ namespace JunmpPoliceStation.App_Start
this._serverNamingClient = _serverNamingClient; this._serverNamingClient = _serverNamingClient;
this._clientFactory = _clientFactory; this._clientFactory = _clientFactory;
this.Configuration = configuration; this.Configuration = configuration;
this._logger = _logger;
_serverNamingClient.RegisterInstanceAsync(new RegisterInstanceRequest _serverNamingClient.RegisterInstanceAsync(new RegisterInstanceRequest
{ {
ServiceName = apicfg.serviceName, ServiceName = apicfg.serviceName,
...@@ -65,6 +67,14 @@ namespace JunmpPoliceStation.App_Start ...@@ -65,6 +67,14 @@ namespace JunmpPoliceStation.App_Start
public override void OnActionExecuting(ActionExecutingContext context) public override void OnActionExecuting(ActionExecutingContext context)
{ {
//获取访问ip
var userHostAddress = context.HttpContext.Connection.RemoteIpAddress?.MapToIPv4().ToString();
if (!string.IsNullOrEmpty(userHostAddress) && IsIP(userHostAddress))
{
//有效ip
_logger.LogDebug("获取访问ip:" + userHostAddress);
}
if (bool.TryParse(Configuration.GetSection("Auth:NoSign").Value, out bool noSignFlag) && noSignFlag) if (bool.TryParse(Configuration.GetSection("Auth:NoSign").Value, out bool noSignFlag) && noSignFlag)
{ {
return; return;
...@@ -191,6 +201,16 @@ namespace JunmpPoliceStation.App_Start ...@@ -191,6 +201,16 @@ namespace JunmpPoliceStation.App_Start
} }
} }
/// <summary>
/// 检查IP地址格式
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
private static bool IsIP(string ip)
{
return System.Text.RegularExpressions.Regex.IsMatch(ip, @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$");
}
} }
public class PlaInfo public class PlaInfo
{ {
......
...@@ -750,6 +750,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -750,6 +750,7 @@ namespace JunmpPoliceStation.Controllers
var entity = JsonManager.GetJsonEntity(jdata); var entity = JsonManager.GetJsonEntity(jdata);
string id = entity?.id ?? ""; string id = entity?.id ?? "";
bool bExpectedTime = DateTime.TryParse(entity?.expectedTime ?? "", out DateTime expectedTime); bool bExpectedTime = DateTime.TryParse(entity?.expectedTime ?? "", out DateTime expectedTime);
bool bIsBindCabinet = bool.TryParse(entity?.isBindCabinet ?? "", out bool isBindCabinet);
if (entity == null) if (entity == null)
{ {
return JsonManager.SimpleCustResponse($"model is null"); return JsonManager.SimpleCustResponse($"model is null");
...@@ -795,6 +796,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -795,6 +796,7 @@ namespace JunmpPoliceStation.Controllers
order.PoliceNote = entity.policeNote; order.PoliceNote = entity.policeNote;
order.PoliceId = entity.policeId; order.PoliceId = entity.policeId;
order.FileUrl = string.IsNullOrEmpty(entity.fileUrl) ? null : entity.fileUrl; order.FileUrl = string.IsNullOrEmpty(entity.fileUrl) ? null : entity.fileUrl;
order.IsBindCabinet = isBindCabinet;
List<string> tmpList = JsonManager.GetDetails(entity.detailList); List<string> tmpList = JsonManager.GetDetails(entity.detailList);
List<string> tmpList2 = JsonManager.GetDetailIds(entity.detailList); List<string> tmpList2 = JsonManager.GetDetailIds(entity.detailList);
...@@ -959,7 +961,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -959,7 +961,8 @@ namespace JunmpPoliceStation.Controllers
Note = entity.note, Note = entity.note,
PoliceNote = entity.policeNote, PoliceNote = entity.policeNote,
PoliceId = entity.policeId, PoliceId = entity.policeId,
FileUrl = string.IsNullOrEmpty(entity.fileUrl) ? null : entity.fileUrl FileUrl = string.IsNullOrEmpty(entity.fileUrl) ? null : entity.fileUrl,
IsBindCabinet = isBindCabinet
}; };
//if (entity.police!=null) //if (entity.police!=null)
...@@ -1409,7 +1412,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1409,7 +1412,7 @@ namespace JunmpPoliceStation.Controllers
order.ApplyUser = entity.applyId; order.ApplyUser = entity.applyId;
order.ApplyUserName = entity.applyName; order.ApplyUserName = entity.applyName;
order.PoliceNote = entity.policeNote; order.PoliceNote = entity.policeNote;
order.PoliceId = entity.policeId; order.PoliceId = string.IsNullOrEmpty(entity.policeId) ? null : entity.policeId;
order.ExpectedReturnTime = expectedTime; order.ExpectedReturnTime = expectedTime;
...@@ -1558,7 +1561,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1558,7 +1561,7 @@ namespace JunmpPoliceStation.Controllers
ProcessCurrentId = processCurrentId, ProcessCurrentId = processCurrentId,
ExpectedReturnTime = expectedTime, ExpectedReturnTime = expectedTime,
PoliceNote = entity.policeNote, PoliceNote = entity.policeNote,
PoliceId = entity.policeId PoliceId = string.IsNullOrEmpty(entity.policeId) ? null : entity.policeId
}; };
List<CommonJpBorrowReturnDetailEstimate> detailsList = new List<CommonJpBorrowReturnDetailEstimate>(); List<CommonJpBorrowReturnDetailEstimate> detailsList = new List<CommonJpBorrowReturnDetailEstimate>();
foreach (var item in entity.detailList) foreach (var item in entity.detailList)
...@@ -2018,7 +2021,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2018,7 +2021,7 @@ namespace JunmpPoliceStation.Controllers
t.PoliceId, t.PoliceId,
policeName = t.Police?.Name, policeName = t.Police?.Name,
processActionType = t.ProcessCurrent?.ActionType, processActionType = t.ProcessCurrent?.ActionType,
fileUrl= t.FileUrl, fileUrl = t.FileUrl,
historyList = t.ProcessCurrent?.CommonJpProcessHistories?.Select(x => new historyList = t.ProcessCurrent?.CommonJpProcessHistories?.Select(x => new
{ {
x.Id, x.Id,
......
...@@ -285,7 +285,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -285,7 +285,7 @@ namespace JunmpPoliceStation.Controllers
{ {
var entity = JsonManager.GetJsonEntity(jdata); var entity = JsonManager.GetJsonEntity(jdata);
string currentCabinetNum = entity?.currentCabinetNum ?? ""; string currentCabinetNum = entity?.currentCabinetNum ?? "";
bool bType = int.TryParse(entity?.type,out int type); bool bType = int.TryParse(entity?.type, out int type);
var param = new string[] var param = new string[]
{ {
"Cabinet", "Cabinet",
...@@ -294,7 +294,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -294,7 +294,7 @@ namespace JunmpPoliceStation.Controllers
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
} }
if (!bType|| type>2) if (!bType || type > 2)
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
} }
...@@ -969,7 +969,9 @@ namespace JunmpPoliceStation.Controllers ...@@ -969,7 +969,9 @@ namespace JunmpPoliceStation.Controllers
// stateCode = s.CurrentState, // stateCode = s.CurrentState,
// epc = s.Epc // epc = s.Epc
//}).ToList(), //}).ToList(),
equList = cab.CommonJpEquipmentInventories?.Select(s => new equList = cab.CommonJpEquipmentInventories?
.Where(s => s.CurrentState == 3 || s.CurrentState == 7)
.Select(s => new
{ {
id = s.Id, id = s.Id,
name = s.EquipmentCodeNavigation?.Name, name = s.EquipmentCodeNavigation?.Name,
...@@ -2777,7 +2779,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2777,7 +2779,7 @@ namespace JunmpPoliceStation.Controllers
editEpcEquipment = EpcEquipments.Where(p => p.Epc.Contains(rfid)).FirstOrDefault(); editEpcEquipment = EpcEquipments.Where(p => p.Epc.Contains(rfid)).FirstOrDefault();
if (editEpcEquipment == null ) if (editEpcEquipment == null)
{ {
continue; continue;
} }
...@@ -2889,7 +2891,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2889,7 +2891,7 @@ namespace JunmpPoliceStation.Controllers
} }
if (rebind.Equals("true")) if (rebind.Equals("true"))
{ {
var CurrentBindEquipments = _unitOfWork.EquipmentInventoryRepository.GetList(t => t.InventoryState != "loss" &&(t.CabinetId.Equals(cabinet.Id)|| t.PoliceCode== cabinet.BaseJpPolicemen.FirstOrDefault().Id), null, false, param);//单警柜的东西 var CurrentBindEquipments = _unitOfWork.EquipmentInventoryRepository.GetList(t => t.InventoryState != "loss" && (t.CabinetId.Equals(cabinet.Id) || t.PoliceCode == cabinet.BaseJpPolicemen.FirstOrDefault().Id), null, false, param);//单警柜的东西
SendMsg equipmentDic = new SendMsg(); SendMsg equipmentDic = new SendMsg();
equipmentDic.State = "rebind"; equipmentDic.State = "rebind";
equipmentDic.Msg = ""; equipmentDic.Msg = "";
...@@ -2902,7 +2904,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2902,7 +2904,7 @@ namespace JunmpPoliceStation.Controllers
{ {
if (!Rfids.Contains(item.Epc)) if (!Rfids.Contains(item.Epc))
{ {
if (item.PoliceCode==policeman.Id) if (item.PoliceCode == policeman.Id)
{ {
item.PoliceCode = null; item.PoliceCode = null;
OutEpc.Add(item); OutEpc.Add(item);
...@@ -2923,7 +2925,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2923,7 +2925,7 @@ namespace JunmpPoliceStation.Controllers
} }
if (invBind.Count>0) if (invBind.Count > 0)
{ {
foreach (var item in invBind) foreach (var item in invBind)
{ {
......
...@@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking.Internal; ...@@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using StackExchange.Redis;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -652,12 +653,21 @@ namespace JunmpPoliceStation.Controllers ...@@ -652,12 +653,21 @@ namespace JunmpPoliceStation.Controllers
{ {
detail.State = 1; detail.State = 1;
} }
//江北仓库特殊处理
if (order.OrgId == "E05CC28D-C189-4389-8081-DD0D6E483B40")
{
//生成流水表
GenerateRecordMK2(order);
//反写库存状态
UpdateInvStateMK2(order.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), order.Action, order.OrderCode, false);
}
else
{
//生成流水表 //生成流水表
GenerateRecord(order); GenerateRecord(order);
//反写库存状态 //反写库存状态
UpdateInvState(order.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), order.Action, order.OrderCode, false); UpdateInvState(order.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), order.Action, order.OrderCode, false);
}
} }
bool result = _unitOfWork.FixReceiveApplyRepository.Insert(order, true); bool result = _unitOfWork.FixReceiveApplyRepository.Insert(order, true);
...@@ -1032,11 +1042,21 @@ namespace JunmpPoliceStation.Controllers ...@@ -1032,11 +1042,21 @@ namespace JunmpPoliceStation.Controllers
{ {
detail.State = 1; detail.State = 1;
} }
//江北仓库特殊处理
if (orderInfo.OrgId == "E05CC28D-C189-4389-8081-DD0D6E483B40")
{
//生成流水表
GenerateRecordMK2(orderInfo);
//反写库存状态
UpdateInvStateMK2(orderInfo.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), orderInfo.Action, orderInfo.OrderCode, false);
}
else
{
//生成流水表 //生成流水表
GenerateRecord(orderInfo); GenerateRecord(orderInfo);
//反写库存状态 //反写库存状态
UpdateInvState(orderInfo.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), orderInfo.Action, orderInfo.OrderCode, isLost); UpdateInvState(orderInfo.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), orderInfo.Action, orderInfo.OrderCode, false);
}
} }
......
...@@ -210,7 +210,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -210,7 +210,7 @@ namespace JunmpPoliceStation.Controllers
IsPushParentWithBorrow = isPushParentWithBorrow, IsPushParentWithBorrow = isPushParentWithBorrow,
IsPushParentWithFailWarehouse = isPushParentWithFailWarehouse, IsPushParentWithFailWarehouse = isPushParentWithFailWarehouse,
Enable = enable, Enable = enable,
EquipmentJson= equipmentJson, EquipmentJson = equipmentJson,
}); });
if (_unitOfWork.SaveChanges() > 0) if (_unitOfWork.SaveChanges() > 0)
{ {
...@@ -343,36 +343,40 @@ namespace JunmpPoliceStation.Controllers ...@@ -343,36 +343,40 @@ namespace JunmpPoliceStation.Controllers
var bjLogList = _unitOfWork.DbContext var bjLogList = _unitOfWork.DbContext
.BaseJpMessageReminderLogs .BaseJpMessageReminderLogs
.Where(x => x.OrgId == orgId) .Where(x => x.OrgId == orgId && x.EquCount != 0)
.ToList(); .ToList();
var xjLogList = _unitOfWork.DbContext var xjLogList = _unitOfWork.DbContext
.BaseJpMessageReminderLogs .BaseJpMessageReminderLogs
.Where(x => x.ParentOrgId == orgId && x.IsNeedPushParent) .Where(x => x.ParentOrgId == orgId && x.IsNeedPushParent && x.EquCount != 0)
.ToList(); .ToList();
return JsonManager.ReturnSuccessResponse(new var message = new List<string>();
foreach (var log in bjLogList)
{ {
bj = bjLogList.Select(x => new switch (log.Type)
{ {
id = x.Id, case 0:
createTime = x.CreateTime, {
type = x.Type, //已超期未报废
orgId = x.OrgId, message.Add($"已超期未报废装备共{log.EquCount}件,请尽快处理");
orgName = x.OrgName, break;
equCount = x.EquCount, }
configId = x.ConfigId, case 1:
}), {
xj = xjLogList.Select(x => new //超期未归还
{ message.Add($"超期未归还装备共{log.EquCount}件,请尽快处理");
id = x.Id, break;
createTime = x.CreateTime, }
type = x.Type, case 2:
orgId = x.OrgId, {
orgName = x.OrgName, //非本仓库装备
equCount = x.EquCount, message.Add($"本仓库存在其他仓库装备{log.EquCount}件,请尽快处理");
configId = x.ConfigId, break;
}) }
}); }
}
return JsonManager.ReturnSuccessResponse(message);
} }
else else
{ {
......
...@@ -615,6 +615,15 @@ namespace JunmpPoliceStation.Controllers ...@@ -615,6 +615,15 @@ namespace JunmpPoliceStation.Controllers
if (string.IsNullOrEmpty(entity.cabinetId)) if (string.IsNullOrEmpty(entity.cabinetId))
{ {
updateObject.CabinetId = null; updateObject.CabinetId = null;
//解绑装备
var equList = _unitOfWork.EquipmentInventoryRepository
.GetList(x => x.PoliceCode == updateObject.Id && (x.CurrentState == 3 || x.CurrentState == 7))
.ToList();
foreach (var inventory in equList)
{
inventory.PoliceCode = null;
}
_unitOfWork.EquipmentInventoryRepository.Update(equList, false);
} }
else else
{ {
......
...@@ -637,14 +637,12 @@ namespace JunmpPoliceStation.Controllers ...@@ -637,14 +637,12 @@ namespace JunmpPoliceStation.Controllers
if (findcode.Length == 6) if (findcode.Length == 6)
{ {
var data = equipmentList.GroupBy(t => t.OrgCode).Select(c => new var data = equipmentList.GroupBy(t => t.OrgName).Select(c => new
{ {
OrgName = c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgName, c.FirstOrDefault().OrgName,
NameJc = c.OrderBy(f => f.OrgCode).FirstOrDefault().NameJc,
c.FirstOrDefault().FindCode, c.FirstOrDefault().FindCode,
c.FirstOrDefault().OrgCode, c.FirstOrDefault().OrgCode,
c.FirstOrDefault().SortCode, zsCount = c.Count(f => f.CurrentState != null),
zsCount = c.Count(f => f.CurrentState != null && f.InventoryState != "loss"),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(),
ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(3) || f.CurrentState.Equals(6))).Count(), ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(3) || f.CurrentState.Equals(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
...@@ -653,7 +651,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -653,7 +651,7 @@ namespace JunmpPoliceStation.Controllers
{ {
id = c.FirstOrDefault().EquipmentCode, id = c.FirstOrDefault().EquipmentCode,
name = c.FirstOrDefault().EquipmentName, name = c.FirstOrDefault().EquipmentName,
zsCount = c.Count(f => f.CurrentState != null && f.InventoryState != "loss"), zsCount = c.Count(f => f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(),
ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(3) || f.CurrentState.Equals(6))).Count(), ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(3) || f.CurrentState.Equals(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
...@@ -662,7 +660,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -662,7 +660,7 @@ namespace JunmpPoliceStation.Controllers
}).ToList(); }).ToList();
data = data.Where(c => c.zsCount != 0) data = data.Where(c => c.zsCount != 0)
.OrderBy(c => c.SortCode.Length) .OrderBy(c => c.FindCode.Length)
.ThenBy(c => c.FindCode) .ThenBy(c => c.FindCode)
.ThenBy(c => c.OrgCode) .ThenBy(c => c.OrgCode)
.ToList(); .ToList();
...@@ -682,15 +680,12 @@ namespace JunmpPoliceStation.Controllers ...@@ -682,15 +680,12 @@ namespace JunmpPoliceStation.Controllers
else else
{ {
var codeLen = findcode.Length + 2; var codeLen = findcode.Length + 2;
//var data = equipmentList.GroupBy(t => t.FindCode.PadLeft(codeLen, '0').Substring(0, codeLen)).Select(c => new var data = equipmentList.GroupBy(t => t.FindCode.PadLeft(codeLen, '0').Substring(0, codeLen)).Select(c => new
var data = equipmentList.GroupBy(t => t.OrgCode).Select(c => new
{ {
OrgName = c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgName, OrgName = c.OrderBy(f => f.OrgCode).FirstOrDefault().AreaName,
NameJc = c.OrderBy(f => f.OrgCode).FirstOrDefault().NameJc,
c.OrderBy(f => f.OrgCode).FirstOrDefault().FindCode, c.OrderBy(f => f.OrgCode).FirstOrDefault().FindCode,
c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgCode, c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgCode,
c.FirstOrDefault().SortCode, zsCount = c.Count(f => f.CurrentState != null),
zsCount = c.Count(f => f.CurrentState != null && f.InventoryState != "loss"),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(),
ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(3) || f.CurrentState.Equals(6))).Count(), ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(3) || f.CurrentState.Equals(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
...@@ -699,7 +694,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -699,7 +694,7 @@ namespace JunmpPoliceStation.Controllers
{ {
id = c.FirstOrDefault().EquipmentCode, id = c.FirstOrDefault().EquipmentCode,
name = c.FirstOrDefault().EquipmentName, name = c.FirstOrDefault().EquipmentName,
zsCount = c.Count(f => f.CurrentState != null && f.InventoryState != "loss"), zsCount = c.Count(f => f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(),
ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(3) || f.CurrentState.Equals(6))).Count(), ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(3) || f.CurrentState.Equals(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
...@@ -708,7 +703,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -708,7 +703,7 @@ namespace JunmpPoliceStation.Controllers
}).ToList(); }).ToList();
data = data.Where(c => c.zsCount != 0) data = data.Where(c => c.zsCount != 0)
.OrderBy(c => c.SortCode.Length) .OrderBy(c => c.FindCode.Length)
.ThenBy(c => c.FindCode) .ThenBy(c => c.FindCode)
.ThenBy(c => c.OrgCode) .ThenBy(c => c.OrgCode)
.ToList(); .ToList();
......
...@@ -956,6 +956,7 @@ namespace JunmpPoliceStation.Extensions ...@@ -956,6 +956,7 @@ namespace JunmpPoliceStation.Extensions
InsideItem.EquipmentLocation = 0; InsideItem.EquipmentLocation = 0;
InsideItem.UpdateUser = policeId; InsideItem.UpdateUser = policeId;
InsideItem.WarehouseCode = warehouseId; InsideItem.WarehouseCode = warehouseId;
InsideItem.PoliceCode = null; //借用归还清空人员绑定
if (borrowIntoRealDetailEpcItem.InsideRealCount == null) if (borrowIntoRealDetailEpcItem.InsideRealCount == null)
{ {
borrowIntoRealDetailEpcItem.InsideRealCount = 0; borrowIntoRealDetailEpcItem.InsideRealCount = 0;
...@@ -1069,9 +1070,30 @@ namespace JunmpPoliceStation.Extensions ...@@ -1069,9 +1070,30 @@ namespace JunmpPoliceStation.Extensions
{ {
brCount++; brCount++;
invenItem.PoliceCode = realityItem.Reality?.Apply?.PoliceId;
if (realityItem.Reality?.Apply?.IsBindCabinet == true)
{
var police = _unitOfWork.PolicemanRepository.Get(invenItem.PoliceCode);
if (police != null && !string.IsNullOrEmpty(police.CabinetId))
{
//绑定单警柜
invenItem.CabinetId = police.CabinetId;
invenItem.CurrentState = 7;
invenItem.EquipmentLocation = 3;//外出
}
else
{
//无效设置,不绑定单警柜
invenItem.CurrentState = 8; invenItem.CurrentState = 8;
invenItem.EquipmentLocation = 3;//外出 invenItem.EquipmentLocation = 3;//外出
invenItem.PoliceCode = realityItem.Reality?.Apply?.PoliceId; }
}
else
{
invenItem.CurrentState = 8;
invenItem.EquipmentLocation = 3;//外出
}
invenItem.UpdateUser = policeId; invenItem.UpdateUser = policeId;
if (reRealEpcDetailList.Count.Equals(0)) if (reRealEpcDetailList.Count.Equals(0))
{ {
......
...@@ -35,6 +35,7 @@ using Nacos.AspNetCore; ...@@ -35,6 +35,7 @@ using Nacos.AspNetCore;
using NLog.Extensions.Logging; using NLog.Extensions.Logging;
using Rextec.SOA.Infrastructure; using Rextec.SOA.Infrastructure;
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment; using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
using Microsoft.AspNetCore.HttpOverrides;
namespace JunmpPoliceStation namespace JunmpPoliceStation
{ {
...@@ -147,6 +148,13 @@ namespace JunmpPoliceStation ...@@ -147,6 +148,13 @@ namespace JunmpPoliceStation
.UseMemoryStorage());//使用内存 .UseMemoryStorage());//使用内存
services.AddHangfireServer();//添加hangfire服务 services.AddHangfireServer();//添加hangfire服务
services.AddScoped<CronJob>();//注册执行类 services.AddScoped<CronJob>();//注册执行类
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
});
} }
} }
...@@ -204,6 +212,8 @@ namespace JunmpPoliceStation ...@@ -204,6 +212,8 @@ namespace JunmpPoliceStation
RecurringJob.AddOrUpdate(() => cronJob.UpdateMessageReminderData(), "0 0 2 1/1 * *", TimeZoneInfo.Local); RecurringJob.AddOrUpdate(() => cronJob.UpdateMessageReminderData(), "0 0 2 1/1 * *", TimeZoneInfo.Local);
} }
app.UseForwardedHeaders();
//app.UseMvc(routes => //app.UseMvc(routes =>
//{ //{
// routes.MapRoute( // routes.MapRoute(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论