Commit 8fa4380a by zxw

1

parent e4279208
......@@ -100,6 +100,11 @@ namespace JmpModel.Model
[Column("file_url")]
[StringLength(255)]
public string FileUrl { get; set; }
/// <summary>
/// 是否绑定单警柜(领用)
/// </summary>
[Column("is_bind_cabinet")]
public bool? IsBindCabinet { get; set; }
[ForeignKey(nameof(ApplyId))]
[InverseProperty(nameof(BaseJpPoliceman.CommonJpBorrowReturnApplyApplies))]
......
......@@ -1221,6 +1221,8 @@ Smart:智能货架
.IsUnicode(false)
.HasComment("单据附加文件地址(上传)");
entity.Property(e => e.IsBindCabinet).HasComment("是否绑定单警柜(领用)");
entity.Property(e => e.Note).IsUnicode(false);
entity.Property(e => e.OrderCode).IsUnicode(false);
......
......@@ -3,6 +3,7 @@ using JmpCommon.Tools;
using JmpModel.Model;
using JmpModel.Model.Repository;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
......@@ -34,13 +35,13 @@ namespace JunmpPoliceStation.App_Start
private readonly INacosNamingClient _serverNamingClient;
private readonly IHttpClientFactory _clientFactory;
public IConfiguration Configuration { get; }
private ILogger<PrintController> _logger;
private ILogger<AuthLoginAttribute> _logger;
private Boolean flg;
ApiConfig apicfg;
string urlGetSecretKey = string.Empty;//获取seckey的路由
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;
this.apicfg = apicfg;
......@@ -48,6 +49,7 @@ namespace JunmpPoliceStation.App_Start
this._serverNamingClient = _serverNamingClient;
this._clientFactory = _clientFactory;
this.Configuration = configuration;
this._logger = _logger;
_serverNamingClient.RegisterInstanceAsync(new RegisterInstanceRequest
{
ServiceName = apicfg.serviceName,
......@@ -65,6 +67,14 @@ namespace JunmpPoliceStation.App_Start
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)
{
return;
......@@ -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
{
......
......@@ -750,6 +750,7 @@ namespace JunmpPoliceStation.Controllers
var entity = JsonManager.GetJsonEntity(jdata);
string id = entity?.id ?? "";
bool bExpectedTime = DateTime.TryParse(entity?.expectedTime ?? "", out DateTime expectedTime);
bool bIsBindCabinet = bool.TryParse(entity?.isBindCabinet ?? "", out bool isBindCabinet);
if (entity == null)
{
return JsonManager.SimpleCustResponse($"model is null");
......@@ -795,6 +796,7 @@ namespace JunmpPoliceStation.Controllers
order.PoliceNote = entity.policeNote;
order.PoliceId = entity.policeId;
order.FileUrl = string.IsNullOrEmpty(entity.fileUrl) ? null : entity.fileUrl;
order.IsBindCabinet = isBindCabinet;
List<string> tmpList = JsonManager.GetDetails(entity.detailList);
List<string> tmpList2 = JsonManager.GetDetailIds(entity.detailList);
......@@ -959,7 +961,8 @@ namespace JunmpPoliceStation.Controllers
Note = entity.note,
PoliceNote = entity.policeNote,
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)
......@@ -1409,7 +1412,7 @@ namespace JunmpPoliceStation.Controllers
order.ApplyUser = entity.applyId;
order.ApplyUserName = entity.applyName;
order.PoliceNote = entity.policeNote;
order.PoliceId = entity.policeId;
order.PoliceId = string.IsNullOrEmpty(entity.policeId) ? null : entity.policeId;
order.ExpectedReturnTime = expectedTime;
......@@ -1558,7 +1561,7 @@ namespace JunmpPoliceStation.Controllers
ProcessCurrentId = processCurrentId,
ExpectedReturnTime = expectedTime,
PoliceNote = entity.policeNote,
PoliceId = entity.policeId
PoliceId = string.IsNullOrEmpty(entity.policeId) ? null : entity.policeId
};
List<CommonJpBorrowReturnDetailEstimate> detailsList = new List<CommonJpBorrowReturnDetailEstimate>();
foreach (var item in entity.detailList)
......@@ -2018,7 +2021,7 @@ namespace JunmpPoliceStation.Controllers
t.PoliceId,
policeName = t.Police?.Name,
processActionType = t.ProcessCurrent?.ActionType,
fileUrl= t.FileUrl,
fileUrl = t.FileUrl,
historyList = t.ProcessCurrent?.CommonJpProcessHistories?.Select(x => new
{
x.Id,
......
......@@ -285,7 +285,7 @@ namespace JunmpPoliceStation.Controllers
{
var entity = JsonManager.GetJsonEntity(jdata);
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[]
{
"Cabinet",
......@@ -294,7 +294,7 @@ namespace JunmpPoliceStation.Controllers
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
if (!bType|| type>2)
if (!bType || type > 2)
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
......@@ -969,7 +969,9 @@ namespace JunmpPoliceStation.Controllers
// stateCode = s.CurrentState,
// epc = s.Epc
//}).ToList(),
equList = cab.CommonJpEquipmentInventories?.Select(s => new
equList = cab.CommonJpEquipmentInventories?
.Where(s => s.CurrentState == 3 || s.CurrentState == 7)
.Select(s => new
{
id = s.Id,
name = s.EquipmentCodeNavigation?.Name,
......@@ -2777,7 +2779,7 @@ namespace JunmpPoliceStation.Controllers
editEpcEquipment = EpcEquipments.Where(p => p.Epc.Contains(rfid)).FirstOrDefault();
if (editEpcEquipment == null )
if (editEpcEquipment == null)
{
continue;
}
......@@ -2889,7 +2891,7 @@ namespace JunmpPoliceStation.Controllers
}
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();
equipmentDic.State = "rebind";
equipmentDic.Msg = "";
......@@ -2902,7 +2904,7 @@ namespace JunmpPoliceStation.Controllers
{
if (!Rfids.Contains(item.Epc))
{
if (item.PoliceCode==policeman.Id)
if (item.PoliceCode == policeman.Id)
{
item.PoliceCode = null;
OutEpc.Add(item);
......@@ -2923,7 +2925,7 @@ namespace JunmpPoliceStation.Controllers
}
if (invBind.Count>0)
if (invBind.Count > 0)
{
foreach (var item in invBind)
{
......
......@@ -12,6 +12,7 @@ using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -652,12 +653,21 @@ namespace JunmpPoliceStation.Controllers
{
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);
//反写库存状态
UpdateInvState(order.CommonJpFixReceiveApplyDetails?.Select(x => x.Epc).ToList(), order.Action, order.OrderCode, false);
}
}
bool result = _unitOfWork.FixReceiveApplyRepository.Insert(order, true);
......@@ -1032,11 +1042,21 @@ namespace JunmpPoliceStation.Controllers
{
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);
//反写库存状态
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);
}
}
......
......@@ -7245,13 +7245,19 @@ namespace JunmpPoliceStation.Controllers
{
if (currentState.Equals("1"))
{
//入库,无脑存
//入库 如果之前不存在就添加
var oldstate = _unitOfWork.DbContext.CommonJpEquipmentFailWarehouseStates
.Where(x => x.Epc == inventory.Epc && x.FailWarehouseId == warehouseId && x.IsCompleted == false)
.FirstOrDefault();
if (oldstate == null)
{
_unitOfWork.DbContext.CommonJpEquipmentFailWarehouseStates.Add(
new CommonJpEquipmentFailWarehouseState
{
Id = Guid.NewGuid().ToString(),
CreateTime = DateTime.Now,
Epc = inventory.Epc,
InventoryId = inventory.Id,
EquipmentDetailId = inventory.EquipmentCode,
EquipmentDetailName = inventory.EquipmentCodeNavigation?.Name,
EquipmentSizeId = inventory.EquipmentSizecode,
......@@ -7270,20 +7276,20 @@ namespace JunmpPoliceStation.Controllers
PicUrl = picUrl
});
}
}
if (currentState.Equals("0"))
{
//出库 判断之前是否有记录
var oldstate = _unitOfWork.DbContext.CommonJpEquipmentFailWarehouseStates
.Where(x => x.Epc == inventory.Epc && x.FailWarehouseId == warehouseId)
.OrderByDescending(x => x.CreateTime)
.Where(x => x.Epc == inventory.Epc && x.FailWarehouseId == warehouseId && x.IsCompleted == false)
.FirstOrDefault();
if (oldstate==null)
if (oldstate == null)
{
//无之前入库记录,认为误读,过滤
continue;
}
if (oldstate.OutInState==0)
if (oldstate.OutInState == 0)
{
//出库 重复出库 过滤
continue;
......@@ -9630,6 +9636,7 @@ namespace JunmpPoliceStation.Controllers
})
.Select(x => new
{
id = x.FirstOrDefault()?.Id,
orgizationCode = x.Key.OrgizationCode,
orgizationId = x.FirstOrDefault()?.OrgId,
orgizationName = x.FirstOrDefault()?.Org.Name,
......@@ -9671,6 +9678,293 @@ namespace JunmpPoliceStation.Controllers
}
/// <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>
/// <remarks>
......
......@@ -210,7 +210,7 @@ namespace JunmpPoliceStation.Controllers
IsPushParentWithBorrow = isPushParentWithBorrow,
IsPushParentWithFailWarehouse = isPushParentWithFailWarehouse,
Enable = enable,
EquipmentJson= equipmentJson,
EquipmentJson = equipmentJson,
});
if (_unitOfWork.SaveChanges() > 0)
{
......@@ -343,36 +343,40 @@ namespace JunmpPoliceStation.Controllers
var bjLogList = _unitOfWork.DbContext
.BaseJpMessageReminderLogs
.Where(x => x.OrgId == orgId)
.Where(x => x.OrgId == orgId && x.EquCount != 0)
.ToList();
var xjLogList = _unitOfWork.DbContext
.BaseJpMessageReminderLogs
.Where(x => x.ParentOrgId == orgId && x.IsNeedPushParent)
.Where(x => x.ParentOrgId == orgId && x.IsNeedPushParent && x.EquCount != 0)
.ToList();
return JsonManager.ReturnSuccessResponse(new
var message = new List<string>();
foreach (var log in bjLogList)
{
bj = bjLogList.Select(x => new
{
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,
createTime = x.CreateTime,
type = x.Type,
orgId = x.OrgId,
orgName = x.OrgName,
equCount = x.EquCount,
configId = x.ConfigId,
})
});
switch (log.Type)
{
case 0:
{
//已超期未报废
message.Add($"已超期未报废装备共{log.EquCount}件,请尽快处理");
break;
}
case 1:
{
//超期未归还
message.Add($"超期未归还装备共{log.EquCount}件,请尽快处理");
break;
}
case 2:
{
//非本仓库装备
message.Add($"本仓库存在其他仓库装备{log.EquCount}件,请尽快处理");
break;
}
}
}
return JsonManager.ReturnSuccessResponse(message);
}
else
{
......
......@@ -615,6 +615,15 @@ namespace JunmpPoliceStation.Controllers
if (string.IsNullOrEmpty(entity.cabinetId))
{
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
{
......
......@@ -637,14 +637,12 @@ namespace JunmpPoliceStation.Controllers
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,
NameJc = c.OrderBy(f => f.OrgCode).FirstOrDefault().NameJc,
c.FirstOrDefault().OrgName,
c.FirstOrDefault().FindCode,
c.FirstOrDefault().OrgCode,
c.FirstOrDefault().SortCode,
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(),
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(),
......@@ -653,7 +651,7 @@ namespace JunmpPoliceStation.Controllers
{
id = c.FirstOrDefault().EquipmentCode,
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(),
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(),
......@@ -662,7 +660,7 @@ namespace JunmpPoliceStation.Controllers
}).ToList();
data = data.Where(c => c.zsCount != 0)
.OrderBy(c => c.SortCode.Length)
.OrderBy(c => c.FindCode.Length)
.ThenBy(c => c.FindCode)
.ThenBy(c => c.OrgCode)
.ToList();
......@@ -682,15 +680,12 @@ namespace JunmpPoliceStation.Controllers
else
{
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.OrgCode).Select(c => new
var data = equipmentList.GroupBy(t => t.FindCode.PadLeft(codeLen, '0').Substring(0, codeLen)).Select(c => new
{
OrgName = c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgName,
NameJc = c.OrderBy(f => f.OrgCode).FirstOrDefault().NameJc,
OrgName = c.OrderBy(f => f.OrgCode).FirstOrDefault().AreaName,
c.OrderBy(f => f.OrgCode).FirstOrDefault().FindCode,
c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgCode,
c.FirstOrDefault().SortCode,
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(),
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(),
......@@ -699,7 +694,7 @@ namespace JunmpPoliceStation.Controllers
{
id = c.FirstOrDefault().EquipmentCode,
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(),
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(),
......@@ -708,7 +703,7 @@ namespace JunmpPoliceStation.Controllers
}).ToList();
data = data.Where(c => c.zsCount != 0)
.OrderBy(c => c.SortCode.Length)
.OrderBy(c => c.FindCode.Length)
.ThenBy(c => c.FindCode)
.ThenBy(c => c.OrgCode)
.ToList();
......
......@@ -956,6 +956,7 @@ namespace JunmpPoliceStation.Extensions
InsideItem.EquipmentLocation = 0;
InsideItem.UpdateUser = policeId;
InsideItem.WarehouseCode = warehouseId;
InsideItem.PoliceCode = null; //借用归还清空人员绑定
if (borrowIntoRealDetailEpcItem.InsideRealCount == null)
{
borrowIntoRealDetailEpcItem.InsideRealCount = 0;
......@@ -1069,9 +1070,30 @@ namespace JunmpPoliceStation.Extensions
{
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.EquipmentLocation = 3;//外出
invenItem.PoliceCode = realityItem.Reality?.Apply?.PoliceId;
}
}
else
{
invenItem.CurrentState = 8;
invenItem.EquipmentLocation = 3;//外出
}
invenItem.UpdateUser = policeId;
if (reRealEpcDetailList.Count.Equals(0))
{
......
......@@ -35,6 +35,7 @@ using Nacos.AspNetCore;
using NLog.Extensions.Logging;
using Rextec.SOA.Infrastructure;
using IHostingEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
using Microsoft.AspNetCore.HttpOverrides;
namespace JunmpPoliceStation
{
......@@ -147,6 +148,13 @@ namespace JunmpPoliceStation
.UseMemoryStorage());//使用内存
services.AddHangfireServer();//添加hangfire服务
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
RecurringJob.AddOrUpdate(() => cronJob.UpdateMessageReminderData(), "0 0 2 1/1 * *", TimeZoneInfo.Local);
}
app.UseForwardedHeaders();
//app.UseMvc(routes =>
//{
// routes.MapRoute(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论