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;
...@@ -1540,7 +1543,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1540,7 +1543,7 @@ namespace JunmpPoliceStation.Controllers
string flowState = (string)entity.flowState.ToLower(); string flowState = (string)entity.flowState.ToLower();
bool processResult = _unitOfWork.AddProcess(processCurrentId, orderID, (string)entity.userType, (string)entity.userInfo, (string)entity.dataScope, (string)entity.nextStepId, (string)entity.currentStepName bool processResult = _unitOfWork.AddProcess(processCurrentId, orderID, (string)entity.userType, (string)entity.userInfo, (string)entity.dataScope, (string)entity.nextStepId, (string)entity.currentStepName
, (string)entity.flowType, (string)entity.flowName, (string)entity.flowId, flowState, (string)entity.orgId, (string)entity.note, (string)(string)entity.applyId, (string)entity.applyName, OrderCode); , (string)entity.flowType, (string)entity.flowName, (string)entity.flowId, flowState, (string)entity.orgId, (string)entity.note, (string)(string)entity.applyId, (string)entity.applyName, OrderCode);
//新增数据 //新增数据
CommonJpBorrowReturnApply order = new CommonJpBorrowReturnApply() CommonJpBorrowReturnApply order = new CommonJpBorrowReturnApply()
{ {
...@@ -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)
...@@ -1607,7 +1610,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1607,7 +1610,7 @@ namespace JunmpPoliceStation.Controllers
borrowReturn.CreateTime = DateTime.Now; borrowReturn.CreateTime = DateTime.Now;
borrowReturn.CreateUser = entity.auditUser; borrowReturn.CreateUser = entity.auditUser;
borrowReturn.IsWork = false; borrowReturn.IsWork = false;
borrowReturn.PolicemanId = order.PoliceId; borrowReturn.PolicemanId = order.PoliceId;
foreach (var item in detailsList) foreach (var item in detailsList)
{ {
//int.TryParse(item.quantity, out int qty); //int.TryParse(item.quantity, out int qty);
...@@ -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,14 +969,16 @@ namespace JunmpPoliceStation.Controllers ...@@ -969,14 +969,16 @@ 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)
id = s.Id, .Select(s => new
name = s.EquipmentCodeNavigation?.Name, {
size = s.Cabinet?.BaseJpPolicemen.First().Id == s.PoliceCode ? s.EquipmentSizecodeNavigation?.SizeName : s.EquipmentSizecodeNavigation?.SizeName + "(" + s.Cabinet?.BaseJpPolicemen.First().Name + ")", id = s.Id,
stateCode = s.CurrentState, name = s.EquipmentCodeNavigation?.Name,
epc = s.Epc size = s.Cabinet?.BaseJpPolicemen.First().Id == s.PoliceCode ? s.EquipmentSizecodeNavigation?.SizeName : s.EquipmentSizecodeNavigation?.SizeName + "(" + s.Cabinet?.BaseJpPolicemen.First().Name + ")",
}).ToList() stateCode = s.CurrentState,
epc = s.Epc
}).ToList()
}; };
return JsonManager.ReturnSuccessResponse(data); return JsonManager.ReturnSuccessResponse(data);
} }
...@@ -2715,7 +2717,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2715,7 +2717,7 @@ namespace JunmpPoliceStation.Controllers
ActionState = 5, ActionState = 5,
OutInState = 0, OutInState = 0,
OrgId = cabinet.OrganizationId, OrgId = cabinet.OrganizationId,
PoliceId = policeman != null ? policeman.Id : null PoliceId = policeman != null ? policeman.Id : null
}; };
InsertState.Add(history); InsertState.Add(history);
...@@ -2734,7 +2736,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2734,7 +2736,7 @@ namespace JunmpPoliceStation.Controllers
//{ //{
// editEquipment.PoliceCode = policeman != null ? policeman.Id : null; // editEquipment.PoliceCode = policeman != null ? policeman.Id : null;
//} //}
editEquipment.CabinetId = cabinet.Id; editEquipment.CabinetId = cabinet.Id;
editEquipment.OutTime = DateTime.Now; //todo 临时使用 editEquipment.OutTime = DateTime.Now; //todo 临时使用
CommonJpEquipmentState history = new CommonJpEquipmentState CommonJpEquipmentState history = new CommonJpEquipmentState
...@@ -2776,8 +2778,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -2776,8 +2778,8 @@ 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;
} }
...@@ -2807,7 +2809,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2807,7 +2809,7 @@ namespace JunmpPoliceStation.Controllers
InsertState.Add(history); InsertState.Add(history);
} }
//SendMsg errEquipmentDic = new SendMsg(); //SendMsg errEquipmentDic = new SendMsg();
//errEquipmentDic.State = "error"; //errEquipmentDic.State = "error";
//errEquipmentDic.Time = time; //errEquipmentDic.Time = time;
...@@ -2850,7 +2852,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2850,7 +2852,7 @@ namespace JunmpPoliceStation.Controllers
//{ //{
// editEquipment.PoliceCode = policeman != null ? policeman.Id : null; // editEquipment.PoliceCode = policeman != null ? policeman.Id : null;
//} //}
editEquipment.OrgId = cabinet.OrganizationId; editEquipment.OrgId = cabinet.OrganizationId;
editEquipment.WarehouseCode = null; editEquipment.WarehouseCode = null;
OutEpc.Add(editEquipment); OutEpc.Add(editEquipment);
...@@ -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);
...@@ -2918,12 +2920,12 @@ namespace JunmpPoliceStation.Controllers ...@@ -2918,12 +2920,12 @@ namespace JunmpPoliceStation.Controllers
equipmentDic.EPC = string.IsNullOrEmpty(equipmentDic.EPC) ? item.Epc : equipmentDic.EPC + "," + item.Epc; equipmentDic.EPC = string.IsNullOrEmpty(equipmentDic.EPC) ? item.Epc : equipmentDic.EPC + "," + item.Epc;
equipmentDic.Name = string.IsNullOrEmpty(equipmentDic.Name) ? item.EquipmentCodeNavigation.Name + "-" + item.EquipmentSizecodeNavigation.SizeName : equipmentDic.Name + "," + item.EquipmentCodeNavigation.Name + "-" + item.EquipmentSizecodeNavigation.SizeName; equipmentDic.Name = string.IsNullOrEmpty(equipmentDic.Name) ? item.EquipmentCodeNavigation.Name + "-" + item.EquipmentSizecodeNavigation.SizeName : equipmentDic.Name + "," + item.EquipmentCodeNavigation.Name + "-" + item.EquipmentSizecodeNavigation.SizeName;
} }
} }
} }
if (invBind.Count>0) if (invBind.Count > 0)
{ {
foreach (var item in invBind) foreach (var item in invBind)
{ {
...@@ -2936,7 +2938,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2936,7 +2938,7 @@ namespace JunmpPoliceStation.Controllers
} }
} }
} }
if (!string.IsNullOrEmpty(equipmentDic.EPC)) if (!string.IsNullOrEmpty(equipmentDic.EPC))
{ {
InvStates.Add(equipmentDic); InvStates.Add(equipmentDic);
} }
...@@ -2957,11 +2959,11 @@ namespace JunmpPoliceStation.Controllers ...@@ -2957,11 +2959,11 @@ namespace JunmpPoliceStation.Controllers
var CurrentEI = _unitOfWork.EquipmentInventoryRepository.GetList(p => p.InventoryState != "loss" && p.Cabinet.CabinetRealNum.Equals(cabinetID) && p.Cabinet.CabinetChildNum.Equals(Convert.ToInt32(cabinetChildID)), null, false, param); var CurrentEI = _unitOfWork.EquipmentInventoryRepository.GetList(p => p.InventoryState != "loss" && p.Cabinet.CabinetRealNum.Equals(cabinetID) && p.Cabinet.CabinetChildNum.Equals(Convert.ToInt32(cabinetChildID)), null, false, param);
var InsideEI = CurrentEI.Where(p => p.CurrentState.Equals(3)).ToList();//在单警柜中的物资 var InsideEI = CurrentEI.Where(p => p.CurrentState.Equals(3)).ToList();//在单警柜中的物资
var errReturnEI = InsideEI.Where(p => p.Cabinet.BaseJpPolicemen.FirstOrDefault().Id != p.PoliceCode).ToList(); var errReturnEI = InsideEI.Where(p => p.Cabinet.BaseJpPolicemen.FirstOrDefault().Id != p.PoliceCode).ToList();
var OutsideEI = CurrentEI.Where(p => p.CurrentState.Equals(7)).ToList();//在单警柜外的物资 var OutsideEI = CurrentEI.Where(p => p.CurrentState.Equals(7)).ToList();//在单警柜外的物资
if (rebind.Equals("false") && (InsertState.Where(p => p.ActionState.Equals(5) && p.OutInState.Equals(1)).ToList().Count > 0 && InsertState.Where(p => p.ActionState.Equals(5) if (rebind.Equals("false") && (InsertState.Where(p => p.ActionState.Equals(5) && p.OutInState.Equals(1)).ToList().Count > 0 && InsertState.Where(p => p.ActionState.Equals(5)
&& p.OutInState.Equals(0)).ToList().Count <= 0 && OutsideEI.Count() > 0))//放入了物资 少还了物资 && p.OutInState.Equals(0)).ToList().Count <= 0 && OutsideEI.Count() > 0))//放入了物资 少还了物资
{ {
if (policeman != null) if (policeman != null)
{ {
......
...@@ -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;
} }
//生成流水表 //江北仓库特殊处理
GenerateRecord(order); if (order.OrgId == "E05CC28D-C189-4389-8081-DD0D6E483B40")
//反写库存状态 {
UpdateInvState(order.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), order.Action, order.OrderCode, false); //生成流水表
GenerateRecordMK2(order);
//反写库存状态
UpdateInvStateMK2(order.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), order.Action, order.OrderCode, false);
}
else
{
//生成流水表
GenerateRecord(order);
//反写库存状态
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;
} }
//生成流水表 //江北仓库特殊处理
GenerateRecord(orderInfo); if (orderInfo.OrgId == "E05CC28D-C189-4389-8081-DD0D6E483B40")
//反写库存状态 {
UpdateInvState(orderInfo.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), orderInfo.Action, orderInfo.OrderCode, isLost); //生成流水表
GenerateRecordMK2(orderInfo);
//反写库存状态
UpdateInvStateMK2(orderInfo.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), orderInfo.Action, orderInfo.OrderCode, false);
}
else
{
//生成流水表
GenerateRecord(orderInfo);
//反写库存状态
UpdateInvState(orderInfo.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), orderInfo.Action, orderInfo.OrderCode, false);
}
} }
......
...@@ -7245,45 +7245,51 @@ namespace JunmpPoliceStation.Controllers ...@@ -7245,45 +7245,51 @@ namespace JunmpPoliceStation.Controllers
{ {
if (currentState.Equals("1")) if (currentState.Equals("1"))
{ {
//入库,无脑存 //入库 如果之前不存在就添加
_unitOfWork.DbContext.CommonJpEquipmentFailWarehouseStates.Add( var oldstate = _unitOfWork.DbContext.CommonJpEquipmentFailWarehouseStates
new CommonJpEquipmentFailWarehouseState .Where(x => x.Epc == inventory.Epc && x.FailWarehouseId == warehouseId && x.IsCompleted == false)
{ .FirstOrDefault();
Id = Guid.NewGuid().ToString(), if (oldstate == null)
CreateTime = DateTime.Now, {
Epc = inventory.Epc, _unitOfWork.DbContext.CommonJpEquipmentFailWarehouseStates.Add(
EquipmentDetailId = inventory.EquipmentCode, new CommonJpEquipmentFailWarehouseState
EquipmentDetailName = inventory.EquipmentCodeNavigation?.Name, {
EquipmentSizeId = inventory.EquipmentSizecode, Id = Guid.NewGuid().ToString(),
EquipmentSizeName = inventory.EquipmentSizecodeNavigation?.SizeName, CreateTime = DateTime.Now,
PoliceId = police?.Id, Epc = inventory.Epc,
PoliceName = police?.Name, InventoryId = inventory.Id,
OutInState = 1, EquipmentDetailId = inventory.EquipmentCode,
FailWarehouseId = warehouseId, EquipmentDetailName = inventory.EquipmentCodeNavigation?.Name,
FailWarehouseName = warehouseInfo.Name, EquipmentSizeId = inventory.EquipmentSizecode,
FailOrgId = warehouseInfo.OrgizationId, EquipmentSizeName = inventory.EquipmentSizecodeNavigation?.SizeName,
FailOrgName = warehouseInfo.Orgization?.Name, PoliceId = police?.Id,
TrueWarehouseId = inventory.WarehouseCode, PoliceName = police?.Name,
TrueWarehouseName = inventory.WarehouseCodeNavigation?.Name, OutInState = 1,
TrueOrgId = inventory.OrgId, FailWarehouseId = warehouseId,
TrueOrgName = inventory.Org?.Name, FailWarehouseName = warehouseInfo.Name,
PicUrl = picUrl FailOrgId = warehouseInfo.OrgizationId,
}); FailOrgName = warehouseInfo.Orgization?.Name,
TrueWarehouseId = inventory.WarehouseCode,
TrueWarehouseName = inventory.WarehouseCodeNavigation?.Name,
TrueOrgId = inventory.OrgId,
TrueOrgName = inventory.Org?.Name,
PicUrl = picUrl
});
}
} }
if (currentState.Equals("0")) if (currentState.Equals("0"))
{ {
//出库 判断之前是否有记录 //出库 判断之前是否有记录
var oldstate = _unitOfWork.DbContext.CommonJpEquipmentFailWarehouseStates var oldstate = _unitOfWork.DbContext.CommonJpEquipmentFailWarehouseStates
.Where(x => x.Epc == inventory.Epc && x.FailWarehouseId == warehouseId) .Where(x => x.Epc == inventory.Epc && x.FailWarehouseId == warehouseId && x.IsCompleted == false)
.OrderByDescending(x => x.CreateTime)
.FirstOrDefault(); .FirstOrDefault();
if (oldstate==null) if (oldstate == null)
{ {
//无之前入库记录,认为误读,过滤 //无之前入库记录,认为误读,过滤
continue; continue;
} }
if (oldstate.OutInState==0) if (oldstate.OutInState == 0)
{ {
//出库 重复出库 过滤 //出库 重复出库 过滤
continue; continue;
...@@ -9630,6 +9636,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -9630,6 +9636,7 @@ namespace JunmpPoliceStation.Controllers
}) })
.Select(x => new .Select(x => new
{ {
id = x.FirstOrDefault()?.Id,
orgizationCode = x.Key.OrgizationCode, orgizationCode = x.Key.OrgizationCode,
orgizationId = x.FirstOrDefault()?.OrgId, orgizationId = x.FirstOrDefault()?.OrgId,
orgizationName = x.FirstOrDefault()?.Org.Name, orgizationName = x.FirstOrDefault()?.Org.Name,
...@@ -9671,6 +9678,293 @@ namespace JunmpPoliceStation.Controllers ...@@ -9671,6 +9678,293 @@ namespace JunmpPoliceStation.Controllers
} }
/// <summary> /// <summary>
/// 获取本组织机构物资状态对应物资信息详情(group)
/// </summary>
/// <remarks>
///
/// ## 例子
///
/// {
/// "size":10,
/// "page":0,
/// "orgId":"当前组织机构代码",
/// "type":"物资状态,中文:装备总数、在库数量、调拨数量、领用数量、维修数量、报废数量、单警柜中、报废区数量、销毁数量",
/// "level":"本级、本级及下级",
/// "name":"装备名称",
/// "topTypeName":"九大类名称",
/// "safeLevel":"0:保质期内,1:即将过期,2:已过期",
/// "equipmentSizeId":"装备型号",
/// }
///
/// </remarks>
/// <param name="jdata"></param>
/// <returns></returns>
[HttpPost("GetGroupListEquipmentByOrgAndTypeDetailV2")]
//[NoSign]
public async Task<HttpResponseMessage> GetGroupListEquipmentByOrgAndTypeDetailV2([FromBody] JObject jdata)
{
return await Task.Run(() =>
{
try
{
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
string orgCode = entity.orgId;
int.TryParse(entity.page, out int page);
int.TryParse(entity.size, out int size);
if (size == 0)
{
size = 10;
}
string OrgId = Guid.Empty.ToString();
if (String.IsNullOrEmpty(entity.orgId))
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
else
{
OrgId = entity.orgId;
}
var param = new string[] {
"EquipmentSizecodeNavigation" ,
"EquipmentSizecodeNavigation.Detail" ,
"EquipmentCodeNavigation" ,
"WarehouseCodeNavigation" ,
"Org",
"CommonJpEquipmentStates",
"SupplierCodeNavigation",
"Cabinet",
"Shelf",
"CommonJpEquipmentStates",
"CommonJpEquipmentStates.Transfer",
"CommonJpEquipmentStates.Transfer.Reality",
"CommonJpEquipmentStates.Transfer.Reality.SendWarehouse",
"CommonJpEquipmentStates.Transfer.Reality.ReceiveWarehouse",
};
ListEq = _unitOfWork.OrganizationRepository.GetList(t => t.State == 1, x => x.Code).ToList();
List<BaseJpOrganization> dataList = GetClassID(OrgId);
dataList = dataList.ToList().Concat(ListEq.Where(c => c.Id.Equals(OrgId))).ToList();
Expression<Func<CommonJpEquipmentInventory, bool>> expression;
if (!string.IsNullOrEmpty(entity.level))
{
if (!String.IsNullOrEmpty(entity.level))
{
if (entity.level == "本级")
{
expression = t => t.OrgId.Equals(OrgId);
}
else
{
expression = t => dataList.Select(c => c.Id).Contains(t.OrgId);
}
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
expression = LambdaExtensions.AndAlso(expression, t => t.InventoryState != "loss");
if (!String.IsNullOrEmpty(entity.type))
{
string type = entity.type;
switch (type)
{
case "装备总数":
{
//无过滤
break;
}
case "在库数量":
{
//0:库存内+3:单警柜
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0 || t.CurrentState == 3);
break;
}
case "调拨数量":
{
//1:调拨中
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 1);
break;
}
case "领用数量":
{
//使用中=装备总数-(0:+3:在库数量)-1:调拨数量-4:维修数量-6:报废数量
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 0 && t.CurrentState != 3 && t.CurrentState != 1 && t.CurrentState != 4 && t.CurrentState != 6);
break;
}
case "维修数量":
{
//4:维修中
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 4);
break;
}
case "销毁数量":
case "报废数量":
{
//6:已报废
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 6);
break;
}
case "报废区数量":
{
//6:已报废
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6 && t.IsFixed == true);
break;
}
case "单警柜中":
{
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7);
break;
}
default:
break;
}
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
if (!String.IsNullOrEmpty(entity.equipmentSizeId))
{
string equipmentSizeId = entity.equipmentSizeId;
expression = LambdaExtensions.AndAlso(expression, t => t.EquipmentSizecode == equipmentSizeId);
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
if (!string.IsNullOrEmpty(entity.safeLevel))
{
if (int.TryParse(entity.safeLevel, out int safeLevel))
{
expression = expression.AndAlso(t => t.CurrentState != 6 && t.SafeLevel == safeLevel);
}
}
if (!string.IsNullOrEmpty(entity.name))
{
string name = entity.name;
expression = expression.AndAlso(x => x.EquipmentSizecodeNavigation != null && x.EquipmentSizecodeNavigation.Detail != null && x.EquipmentSizecodeNavigation.Detail.Name.Contains(name));
}
if (!string.IsNullOrEmpty(entity.topTypeName))
{
string topTypeName = entity.topTypeName;
var topTypeInfo = _unitOfWork.EquipmentInfoRepository.Get(x => x.Name == topTypeName);
if (topTypeInfo == null)
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
//遍历下级(3级)
var secondInfoList =
_unitOfWork.EquipmentInfoRepository.GetList(x => x.ParentId == topTypeInfo.Id).ToList();
var threedInfoList = new List<BaseJpEquipmentInfo>();
foreach (var info in secondInfoList)
{
threedInfoList.AddRange(_unitOfWork.EquipmentInfoRepository.GetList(x => x.ParentId == info.Id).ToList());
}
var equIdList = threedInfoList.Select(x => x.Id);
expression = expression.AndAlso(x => x.EquipmentSizecodeNavigation != null && x.EquipmentSizecodeNavigation.Detail != null && equIdList.Contains(x.EquipmentSizecodeNavigation.Detail.EquipmentId));
}
var EquipmentList = _unitOfWork.EquipmentInventoryRepository.GetList(expression, c => c.CreateTime, false, param)
.ToList();
var datas = EquipmentList.Select(equipment => new
{
equipment.Id,
equipment.Epc,
equipment.UseDirection,
equipment.WarrantyCycle,
equipment.ProductTime,
equipment.UseTime,
equipment.CurrentState,
shelfId = equipment.ShelfId,
shelfCode = equipment.Shelf?.Code,
shelfName = equipment.Shelf?.Name,
shelf = equipment.Shelf == null ? null : new
{
equipment.Shelf.Id,
equipment.Shelf.CreateTime,
equipment.Shelf.Name,
equipment.Shelf.Code,
equipment.Shelf.Type,
equipment.Shelf.WarehouseId,
equipment.Shelf.Row,
equipment.Shelf.Column,
equipment.Shelf.Range,
},
range = equipment.ShelfRange,
row = equipment.ShelfRow,
column = equipment.ShelfColumn,
safeLevel = equipment.SafeLevel,
equipment.Address,
sizeName = equipment.EquipmentSizecodeNavigation?.SizeName,
equipment.EquipmentSizecode,
equipmentName = equipment.EquipmentCodeNavigation?.Name,
equipment.EquipmentCode,
warehouseName = equipment.WarehouseCodeNavigation?.Name,
equipment.WarehouseCode,
equipment.WarehouseCodeNavigation?.Orgization?.Name,
equipment.WarehouseCodeNavigation?.OrgizationId,
supplierName = equipment.SupplierCodeNavigation?.Name,
equipment.SupplierCode,
cabinetID = equipment.Cabinet?.Id,
CabinetChildNum = equipment.Cabinet?.CabinetChildNum + "号柜",
equipment.Cabinet?.CabinetNum,
equipment.Price,
equipment.RepairCycle
}
);
var content = new
{
totalElements = datas.Count(),
content = datas.Skip(page * size).Take(size).ToList()
};
return JsonManager.ReturnSuccessResponse(content);
// return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
}
catch (Exception ex)
{
//_logger.LogError("Login/SignIn 错误:" + ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
});
}
/// <summary>
/// 查看盘点记录 /// 查看盘点记录
/// </summary> /// </summary>
/// <remarks> /// <remarks>
......
...@@ -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,
createTime = x.CreateTime,
type = x.Type,
orgId = x.OrgId,
orgName = x.OrgName,
equCount = x.EquCount,
configId = x.ConfigId,
}),
xj = xjLogList.Select(x => new
{ {
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:
}) {
}); //超期未归还
message.Add($"超期未归还装备共{log.EquCount}件,请尽快处理");
break;
}
case 2:
{
//非本仓库装备
message.Add($"本仓库存在其他仓库装备{log.EquCount}件,请尽快处理");
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.CurrentState = 8;
invenItem.EquipmentLocation = 3;//外出
invenItem.PoliceCode = realityItem.Reality?.Apply?.PoliceId; 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.EquipmentLocation = 3;//外出
}
}
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论