Commit 7b1ffc81 by zxw

0506

parent 96a67afe
......@@ -1706,6 +1706,7 @@ Smart:智能货架
entity.HasOne(d => d.TrueWarehouse)
.WithMany(p => p.CommonJpEquipmentFailWarehouseStateTrueWarehouses)
.HasForeignKey(d => d.TrueWarehouseId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("FK__common_jp__trueW__438BFA74");
});
......@@ -2564,7 +2565,6 @@ Warehouse:仓库");
entity.HasOne(d => d.Warehouse)
.WithMany(p => p.CommonJpInventoryTables)
.HasForeignKey(d => d.WarehouseId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("FK_common_jp_inventory_table_base_jp_warehouse");
});
......@@ -2768,7 +2768,6 @@ Warehouse:仓库");
entity.HasOne(d => d.ApplyPolice)
.WithMany(p => p.CommonJpPoliceShiftJobsApplies)
.HasForeignKey(d => d.ApplyPoliceId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__apply__569ECEE8");
entity.HasOne(d => d.ProcessCurrent)
......@@ -3712,6 +3711,8 @@ Warehouse:仓库");
entity.ToView("view_equipment_type");
entity.Property(e => e.EquCode).IsUnicode(false);
entity.Property(e => e.EquipmentCode).IsUnicode(false);
entity.Property(e => e.EquipmentName).IsUnicode(false);
......
......@@ -17,6 +17,9 @@ namespace JmpModel.Model
[Column("equipment_code")]
[StringLength(36)]
public string EquipmentCode { get; set; }
[Column("equ_code")]
[StringLength(36)]
public string EquCode { get; set; }
[Column("equipment_name")]
[StringLength(64)]
public string EquipmentName { get; set; }
......
......@@ -74,7 +74,7 @@ namespace JunmpPoliceStation.Controllers
List<BaseJpEquipmentSize> dataList = _unitOfWork.EquipmentSizeRepository.GetList(expression, t => t.UpdateTime, false, param).ToList();
var i = 0;
var data = dataList.Select(c => new
var data = dataList.OrderBy(c => c.SizeName).Select(c => new
{
c.Id,
c.SizeName,
......
......@@ -8359,6 +8359,8 @@ namespace JunmpPoliceStation.Controllers
/// {
/// "findCode":"当前组织机构代码",
/// "equipmentId":"装备名称",
/// "orgId":"组织机构过滤",
/// "sizeId":"型号过滤",
/// }
///
/// </remarks>
......@@ -8379,6 +8381,9 @@ namespace JunmpPoliceStation.Controllers
string equipmentId = entity.equipmentId;
string orgCode = entity.orgCode;
string orgId = entity.orgId;
string sizeId = entity.sizeId;
Expression<Func<ViewEquipment, bool>> expressionPoliceman = null;
expressionPoliceman = t => t.FindCode.Contains(findcode) && t.EquipmentCode.Equals(equipmentId);
......@@ -8389,14 +8394,24 @@ namespace JunmpPoliceStation.Controllers
expressionPoliceman = LambdaExtensions.AndAlso(expressionPoliceman, t => t.OrgCode.Equals(orgCode));
}
if (!string.IsNullOrEmpty(orgId))
{
expressionPoliceman = LambdaExtensions.AndAlso(expressionPoliceman, t => t.OrgId.Equals(orgId));
}
if (!string.IsNullOrEmpty(sizeId))
{
expressionPoliceman = LambdaExtensions.AndAlso(expressionPoliceman, t => t.EquipmentSizecode.Equals(sizeId));
}
List<ViewEquipment> equipmentList = _unitOfWork.ViewEquipmentRepository.GetList(expressionPoliceman).OrderBy(c => c.FindCode.Length).ToList();
var data = equipmentList.GroupBy(t => new { t.OrgId, t.WarehouseCode, t.EquipmentSizecode }).Select(c => new
var data = equipmentList.GroupBy(t => new { t.OrgId, t.EquipmentSizecode }).Select(c => new
{
c.FirstOrDefault().OrgId,
c.FirstOrDefault().OrgName,
WarehouseCode = c.FirstOrDefault(x => x.WarehouseCode != null)?.WarehouseCode ?? "00000000-0000-0000-0000-000000000000",
WarehouseName = c.FirstOrDefault(x => x.WarehouseCode != null)?.WarehouseName ?? "",
c.FirstOrDefault().OrgCode,
//WarehouseCode = c.FirstOrDefault(x => x.WarehouseCode != null)?.WarehouseCode ?? "00000000-0000-0000-0000-000000000000",
//WarehouseName = c.FirstOrDefault(x => x.WarehouseCode != null)?.WarehouseName ?? "",
c.FirstOrDefault().EquipmentCode,
c.FirstOrDefault().EquipmentName,
c.FirstOrDefault().EquipmentSizecode,
......@@ -8405,7 +8420,9 @@ namespace JunmpPoliceStation.Controllers
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()
}).Where(c => c.OrgId != null).ToList();
}).Where(c => c.OrgId != null)
.OrderBy(x => x.SizeName)
.ThenByDescending(x => x.OrgCode).ToList();
return JsonManager.ReturnSuccessResponse(data);
}
else
......@@ -8972,6 +8989,185 @@ namespace JunmpPoliceStation.Controllers
}
/// <summary>
/// 获取本组织机构型号对应物资信息详情
/// </summary>
/// <remarks>
///
/// ## 例子
///
/// {
/// "size":10,
/// "page":0,
/// "orgId":"当前组织机构代码",
/// "equipmentSizeId":"装备型号",
/// "shelfId":"货架id",
/// "range":"货架排位置",
/// "row":"货架行位置",
/// "column":"货架列位置",
/// }
///
/// </remarks>
/// <param name="jdata"></param>
/// <returns></returns>
[HttpPost("GetListEquipmentByOrgSizeV2")]
//[NoSign]
public async Task<HttpResponseMessage> GetListEquipmentByOrgSizeV2([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.equipmentSizeId))
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
if (String.IsNullOrEmpty(entity.orgId))
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
else
{
OrgId = entity.orgId;
}
var param = new string[] {
"EquipmentSizecodeNavigation" ,
"EquipmentCodeNavigation" ,
"WarehouseCodeNavigation" ,
"Org",
"CommonJpEquipmentStates",
"SupplierCodeNavigation",
"Cabinet",
"Shelf"
};
Expression<Func<CommonJpEquipmentInventory, bool>> expression = t => OrgId.Equals(t.OrgId);
expression = LambdaExtensions.AndAlso(expression, t => t.InventoryState != "loss");
//orgList.Add(orgInfo.Id);//查询所有组织机构仓库库存信息
//装备型号
if (!String.IsNullOrEmpty(entity.equipmentSizeId))
{
string equipmentSizeId = entity.equipmentSizeId;
expression = LambdaExtensions.AndAlso(expression, t => t.EquipmentSizecode.Contains(equipmentSizeId));
}
//位置
if (!string.IsNullOrEmpty(entity.shelfId))
{
string shelfId = entity.shelfId;
expression = expression.AndAlso(t => t.ShelfId == shelfId);
if (int.TryParse(entity.range, out int range) && range > 0)
{
expression = expression.AndAlso(t => t.ShelfRange == range);
}
if (int.TryParse(entity.row, out int row) && row > 0)
{
expression = expression.AndAlso(t => t.ShelfRow == row);
}
if (int.TryParse(entity.column, out int column) && column > 0)
{
expression = expression.AndAlso(t => t.ShelfColumn == column);
}
}
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.Org.Name,
equipment.OrgId,
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>
......@@ -9789,13 +9985,15 @@ namespace JunmpPoliceStation.Controllers
warehouseCode = x.Key.WarehouseCode,
warehouseName = x.FirstOrDefault()?.WarehouseCodeNavigation?.Name,
equipmentCode = x.Key.EquipmentCode,
equCode = x.FirstOrDefault().EquipmentCodeNavigation?.Code,
equipmentName = x.FirstOrDefault()?.EquipmentCodeNavigation?.Name,
equipmentSizecode = x.Key.EquipmentSizecode,
equSizecode = x.FirstOrDefault()?.EquipmentSizecodeNavigation?.SizeName,
equipmentSizeName = x.FirstOrDefault()?.EquipmentSizecodeNavigation?.SizeName,
count = x.Count()
})
.OrderBy(x => x.equipmentCode)
.ThenBy(x => x.equipmentSizecode)
.OrderBy(x => x.equCode)
.ThenBy(x => x.equSizecode)
.ThenBy(x => x.orgizationCode)
.ThenBy(x => x.warehouseCode);
......
......@@ -532,7 +532,7 @@ namespace JunmpPoliceStation.Controllers
/// <summary>
/// 添加或修改警员信息
/// 添加或修改警员信息(第三方使用)
/// </summary>
/// <remarks>
///
......@@ -823,6 +823,296 @@ namespace JunmpPoliceStation.Controllers
});
}
/// <summary>
/// 添加或修改警员信息(主平台使用)
/// </summary>
/// <remarks>
///
/// ## 例子
///
/// {
/// "id" : "编号",
/// "name":"姓名",
/// "idCardNo":"身份证",
/// "orgizationCode":"组织机构",
/// "policeCode":"警号编号",
/// "sex" : "姓别",
/// "cabinetId":"单警柜ID",
/// "photo": "人脸照片路径",
/// "phone" : "手机号码",
/// "updateUser":"操作用户ID",
/// "isCreatedAccount":"是否注册账户",
/// "account":"注册账户名(缺省为姓名)",
/// "thirdPoliceId":"第三方自建平台创建警员id(新增用)"
/// }
///
/// </remarks>
/// <param name="jdata"></param>
/// <returns></returns>
[HttpPost("AddOrUpdatePolicemanFromHost")]
//[NoSign]
public async Task<HttpResponseMessage> AddOrUpdatePolicemanFromHost([FromBody] JObject jdata)
{
return await Task.Run(() =>
{
try
{
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
string id = entity?.id ?? "";
if (entity == null)
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
//第三方调用接口验证orgId正确性
if (!string.IsNullOrEmpty(entity._PUSHORG))
{
if (entity.orgizationCode?.ToString() != entity._PUSHORG.ToString())
{
return JsonManager.SimpleStatusResponse(ResultCode.ORGANIZATION_ERROR);
}
}
if (string.IsNullOrEmpty(entity.name ?? ""))
{
return JsonManager.SimpleCustResponse($"Name is require");
}
else if (string.IsNullOrEmpty(entity.policeCode ?? ""))
{
return JsonManager.SimpleCustResponse($"PoliceCode is require");
}
else if (entity.policeCode.Length > 9)
{
return JsonManager.SimpleCustResponse($"PoliceCode長度不能超過9位");
}
else if (string.IsNullOrEmpty(entity.orgizationCode ?? ""))
{
return JsonManager.SimpleCustResponse($"OrgizationCode is require");
}
else if (string.IsNullOrEmpty(entity.phone ?? ""))
{
return JsonManager.SimpleCustResponse($"Phone is require");
}
else if (string.IsNullOrEmpty(entity.sex ?? ""))
{
return JsonManager.SimpleCustResponse($"Sex is require");
}
else if (!string.IsNullOrEmpty(id))
{
Expression<Func<BaseJpPoliceman, bool>> expression = t => t.Id.Equals(id);
BaseJpPoliceman updateObject = _unitOfWork.PolicemanRepository.Get(expression);
if (updateObject != null)
{
updateObject.Name = entity.name;
updateObject.OrgizationCode = entity.orgizationCode;
updateObject.PoliceCode = entity.policeCode;
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
{
updateObject.CabinetId = entity.cabinetId;
}
updateObject.Sex = entity.sex;
updateObject.Photo = entity.photo;
updateObject.Phone = entity.phone;
updateObject.UpdateTime = System.DateTime.Now;
updateObject.UpdateUser = entity.updateUser;
updateObject.IdCardNo = entity.idCardNo;
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
if (Convert.ToBoolean(entity.isCreatedAccount))
{
if (updateObject.IsCreatedAccount)
{
//已创建账户,过滤
}
else
{
//注册账户
string name = string.IsNullOrEmpty(entity.account) ? entity.name : entity.account;
var old = _unitOfWork.CommonJpUserRepository.Get(predicate: x => x.Username == name);
if (old != null)
{
return JsonManager.SimpleCustResponse("重名注册");
}
var userId = Guid.NewGuid().ToString();
var res = _unitOfWork.CommonJpUserRepository.Insert(new CommonJpUser()
{
Id = userId,
Password = "e10adc3949ba59abbe56e057f20f883e",
Username = name,
Phone = entity.phone,
CreateTime = DateTime.Now,
NickName = entity.name,
OrganizationId = entity.orgizationCode,
Enabled = 1,
PoliceId = updateObject.Id
});
if (!res)
{
return JsonManager.SimpleCustResponse("注册失败,请稍后再试");
}
_unitOfWork.UsersRoleRepository.Insert(new UsersRole
{
RoleId = 6,
UserId = userId
});
updateObject.IsCreatedAccount = true;
}
}
bool result = _unitOfWork.PolicemanRepository.Update(updateObject);
if (result)
{
return JsonManager.ReturnSuccessResponse(new
{
id = updateObject.Id,
name = updateObject.Name,
orgizationCode = updateObject.OrgizationCode,
phone = updateObject.Phone,
policeCode = updateObject.PoliceCode,
sex = updateObject.Sex,
});
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
}
else
{
string cabinetId = null;
if (string.IsNullOrEmpty(entity.cabinetId))
{
cabinetId = null;
}
else
{
cabinetId = entity.cabinetId;
}
string policeCode = entity.policeCode;
Expression<Func<BaseJpPoliceman, bool>> expression = t => t.PoliceCode.Equals(policeCode);
BaseJpPoliceman cfObject = _unitOfWork.PolicemanRepository.Get(expression);
if (cfObject != null)
{
return JsonManager.SimpleStatusResponse(ResultCode.POLICE_C_ERROR);
}
//新增数据
BaseJpPoliceman addObject = new BaseJpPoliceman()
{
Id = string.IsNullOrEmpty(entity.thirdPoliceId) ? Guid.NewGuid().ToString() : entity.thirdPoliceId,
Sort = null,
Name = entity.name,
CabinetId = cabinetId,
OrgizationCode = entity.orgizationCode,
PoliceCode = entity.policeCode,
Sex = entity.sex,
FingerInfo1 = null,
FaceInfo = null,
Photo = entity.photo,
Phone = entity.phone,
CreateTime = System.DateTime.Now,
UpdateTime = System.DateTime.Now,
UpdateUser = entity.updateUser,
IdCardNo = entity.idCardNo,
};
bool result = false;
if (Convert.ToBoolean(entity.isCreatedAccount))
{
//注册账户
string name = string.IsNullOrEmpty(entity.account) ? entity.name : entity.account;
var old = _unitOfWork.CommonJpUserRepository.Get(predicate: x => x.Username == name);
if (old != null)
{
return JsonManager.SimpleCustResponse("重名注册");
}
var userId = Guid.NewGuid().ToString();
_unitOfWork.CommonJpUserRepository.Insert(new CommonJpUser()
{
Id = userId,
Password = "e10adc3949ba59abbe56e057f20f883e",
Username = name,
Phone = entity.phone,
CreateTime = DateTime.Now,
NickName = entity.name,
OrganizationId = entity.orgizationCode,
Enabled = 1,
PoliceId = addObject.Id
}, false);
_unitOfWork.UsersRoleRepository.Insert(new UsersRole
{
RoleId = 6,
UserId = userId
}, false);
addObject.IsCreatedAccount = true;
_unitOfWork.PolicemanRepository.Insert(addObject, false);
result = _unitOfWork.DbContext.SaveChanges() > 0;
if (!result)
{
return JsonManager.SimpleCustResponse("注册失败,请稍后再试");
}
}
else
{
result = _unitOfWork.PolicemanRepository.Insert(addObject);
}
if (result)
{
return JsonManager.ReturnSuccessResponse(new
{
id = addObject.Id,
name = addObject.Name,
orgizationCode = addObject.OrgizationCode,
phone = addObject.Phone,
policeCode = addObject.PoliceCode,
sex = addObject.Sex,
});
}
else
{
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>
/// 删除警员信息
......
......@@ -662,6 +662,7 @@ namespace JunmpPoliceStation.Controllers
OrgName = string.IsNullOrEmpty(c.FirstOrDefault().DName) ? c.FirstOrDefault().OrgName : c.FirstOrDefault().DName,
c.FirstOrDefault().FindCode,
c.FirstOrDefault().OrgCode,
c.FirstOrDefault().OrgId,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0)).Count(),
ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(6))).Count(),
......@@ -674,6 +675,7 @@ namespace JunmpPoliceStation.Controllers
children = c.OrderBy(z => z.TypeOneId).ThenBy(z => z.TypeTwoId).ThenBy(z => z.TypeThreeId).GroupBy(a => a.EquipmentCode).Select(c => new
{
id = c.FirstOrDefault().EquipmentCode,
code = c.FirstOrDefault().EquipmentCode1,
name = c.FirstOrDefault().EquipmentName,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0)).Count(),
......@@ -684,7 +686,7 @@ namespace JunmpPoliceStation.Controllers
djgckCount = c.Count(x => x.CurrentState == 7),
priceCount = c.Where(f => !f.CurrentState.Equals(6) && f.Price != null).Sum(k => k.Price)
}).Where(f => f.id != null && (f.zsCount != 0 || f.bfCount != 0)).ToList()
}).Where(f => f.id != null && (f.zsCount != 0 || f.bfCount != 0)).OrderBy(f => f.code).ToList()
}).ToList();
data = data.Where(c => c.zsCount != 0 || c.bfCount != 0)
......@@ -725,6 +727,7 @@ namespace JunmpPoliceStation.Controllers
OrgName = string.IsNullOrEmpty(c.OrderBy(f => f.OrgCode).FirstOrDefault().DName) ? c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgName : c.OrderBy(f => f.OrgCode).FirstOrDefault().DName,
c.OrderBy(f => f.OrgCode).FirstOrDefault().FindCode,
c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgCode,
c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgId,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0)).Count(),
ckCount = c.Where(f => !(f.CurrentState == null || f.CurrentState.Equals(0) || f.CurrentState.Equals(6))).Count(),
......@@ -737,6 +740,7 @@ namespace JunmpPoliceStation.Controllers
children = c.OrderBy(z => z.TypeOneId).ThenBy(z => z.TypeTwoId).ThenBy(z => z.TypeThreeId).GroupBy(a => a.EquipmentCode).Select(c => new
{
id = c.FirstOrDefault().EquipmentCode,
code = c.FirstOrDefault().EquipmentCode1,
name = c.FirstOrDefault().EquipmentName,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0)).Count(),
......@@ -747,7 +751,7 @@ namespace JunmpPoliceStation.Controllers
djgckCount = c.Count(x => x.CurrentState == 7),
priceCount = c.Where(f => !f.CurrentState.Equals(6) && f.Price != null).Sum(k => k.Price)
}).Where(f => f.id != null && (f.zsCount != 0 || f.bfCount != 0)).ToList()
}).Where(f => f.id != null && (f.zsCount != 0 || f.bfCount != 0)).OrderBy(f => f.code).ToList()
}).ToList();
data = data.Where(c => c.zsCount != 0 || c.bfCount != 0)
......@@ -870,7 +874,7 @@ namespace JunmpPoliceStation.Controllers
var EquipmentList = _unitOfWork.EquipmentInventoryRepository.GetList(expression, null, false, param).ToList();
var datas = EquipmentList.GroupBy(p => p.EquipmentCode).Select(c => new
{
code = c.FirstOrDefault().EquipmentCodeNavigation?.Equipment?.Code,
code = c.FirstOrDefault().EquipmentCodeNavigation?.Code,
equipmentCode = c.Key,
equipmentName = c.FirstOrDefault().EquipmentCodeNavigation.Name,
sumCount = c.Where(p => p.CurrentState != 6).Count(),
......@@ -1659,6 +1663,8 @@ namespace JunmpPoliceStation.Controllers
TypeTwoId = c.FirstOrDefault().TypeTwoId,
TypeThreeId = c.FirstOrDefault().TypeThreeId,
EquipmentCode = c.FirstOrDefault().EquipmentCode,
EquCode = c.FirstOrDefault().EquCode,
EquipmentSizecode = c.FirstOrDefault().EquipmentSizecode,
ParentName = c.FirstOrDefault().Name,
EquipmentName = c.FirstOrDefault().EquipmentName,
......@@ -1670,8 +1676,8 @@ namespace JunmpPoliceStation.Controllers
).OrderBy(x => x.id)
.ThenBy(x => x.TypeTwoId)
.ThenBy(x => x.TypeThreeId)
.ThenBy(x => x.EquipmentCode)
.ThenBy(x => x.EquipmentSizecode)
.ThenBy(x => x.EquCode)
.ThenBy(x => x.SizeName)
.ToList();
return JsonManager.ReturnSuccessResponse(new
......
......@@ -482,7 +482,12 @@ namespace JunmpPoliceStation.Controllers
IQueryable<ViewEquipment> ViewEquipmentList = _unitOfWork.ViewEquipmentRepository.GetArray(ViewEquipmentExpression, t => t.FindCode, false);
var groupList = ViewEquipmentList.GroupBy(c => c.ParentName).Select(g => new { name = g.Key, value = g.Count() }).ToList();
var groupList = ViewEquipmentList
.GroupBy(c => new {c.TypeOneId,c.ParentName})
.Select(g => new {id=g.Key.TypeOneId, name = g.Key.ParentName, value = g.Count() })
.ToList()
.OrderBy(x=>x.id)
.ToList();
return JsonManager.ReturnSuccessResponse(groupList);
......@@ -1147,7 +1152,7 @@ namespace JunmpPoliceStation.Controllers
List<Object> tList = new List<Object>();
for (var i = 0; i < data.Count; i++)
{
var t = new { ParentName = data[i].ParentName, 近三个月报废数 = data[i].WeekP, 近半年使报废数 = data[i].MonthP };
var t = new { ParentName = data[i].ParentName, 近三个月报废数 = data[i].WeekP, 近半年报废数 = data[i].MonthP };
tList.Add(t);
}
return JsonManager.ReturnSuccessResponse(tList);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论