Commit 96a67afe by zxw

修复数据

parent c6e660fa
......@@ -105,6 +105,11 @@ namespace JmpModel.Model
[Column("latitude")]
[StringLength(255)]
public string Latitude { get; set; }
/// <summary>
/// 0为本级,1为非本级
/// </summary>
[Column("level_flag")]
public bool? LevelFlag { get; set; }
[InverseProperty(nameof(BaseJpBag.Org))]
public virtual ICollection<BaseJpBag> BaseJpBags { get; set; }
......
......@@ -88,7 +88,6 @@ namespace JmpModel.Model
/// <summary>
/// 申请警员id
/// </summary>
[Required]
[Column("apply_police_id")]
[StringLength(36)]
public string ApplyPoliceId { get; set; }
......
......@@ -129,7 +129,7 @@ namespace JmpModel.Model.DataContext
if (!optionsBuilder.IsConfigured)
{
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
optionsBuilder.UseSqlServer("Data Source=192.168.3.188;Initial Catalog=junmppolicesqldev;Persist Security Info=True;User ID=sa;Password=Junmp123");
optionsBuilder.UseSqlServer("Data Source=192.168.3.188;Initial Catalog=junmppolicesqldev_mk2;Persist Security Info=True;User ID=sa;Password=Junmp123");
}
}
......@@ -326,6 +326,7 @@ namespace JmpModel.Model.DataContext
entity.HasOne(d => d.Policeman)
.WithMany(p => p.BaseJpCabinetPolicemen)
.HasForeignKey(d => d.PolicemanId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("base_jp_cabinet_policeman_ibfk_2");
});
......@@ -684,6 +685,8 @@ namespace JmpModel.Model.DataContext
.IsUnicode(false)
.HasComment("纬度");
entity.Property(e => e.LevelFlag).HasComment("0为本级,1为非本级");
entity.Property(e => e.Longitude)
.IsUnicode(false)
.HasComment("经度");
......@@ -1148,7 +1151,7 @@ Smart:智能货架
entity.HasIndex(e => e.CurrentState)
.HasName("IX_common_jp_borrow_return");
entity.HasIndex(e => new { e.WarehouseId, e.OrderCode, e.OrgId, e.CreateTime, e.IsWork, e.CurrentState, e.ActionType, e.ApplyId, e.Id })
entity.HasIndex(e => new { e.CreateTime, e.IsWork, e.OrderCode, e.OrgId, e.WarehouseId, e.CurrentState, e.ActionType, e.ApplyId, e.Id })
.HasName("_dta_index_common_jp_borrow_return_9_1013578649__K4_K5_K12_K1_6_8_9_11_14");
entity.HasIndex(e => new { e.Sort, e.PolicemanId, e.CurrentState, e.ActionType, e.WarehouseId, e.OutTime, e.OrderCode, e.OrgId, e.CreateUser, e.CreateTime, e.IsAfter, e.IsWork, e.UpdateUser, e.ApplyId, e.Id })
......@@ -1256,6 +1259,7 @@ Smart:智能货架
entity.HasOne(d => d.Police)
.WithMany(p => p.CommonJpBorrowReturnApplyPolices)
.HasForeignKey(d => d.PoliceId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__polic__3726238F");
entity.HasOne(d => d.ProcessCurrent)
......@@ -1453,6 +1457,7 @@ Smart:智能货架
entity.HasOne(d => d.Police)
.WithMany(p => p.CommonJpChannelMonitorRecords)
.HasForeignKey(d => d.PoliceId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__polic__4A6E022D");
entity.HasOne(d => d.Warehouse)
......@@ -1685,6 +1690,7 @@ Smart:智能货架
entity.HasOne(d => d.Inventory)
.WithMany(p => p.CommonJpEquipmentFailWarehouseStates)
.HasForeignKey(d => d.InventoryId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("FK__common_jp__inven__3DD3211E");
entity.HasOne(d => d.Police)
......@@ -1722,6 +1728,7 @@ Smart:智能货架
entity.HasOne(d => d.OperatorNavigation)
.WithMany(p => p.CommonJpEquipmentHistories)
.HasForeignKey(d => d.Operator)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("common_jp_equipment_history_ibfk_1");
entity.HasOne(d => d.WarehouseNavigation)
......@@ -1773,7 +1780,7 @@ Smart:智能货架
entity.HasIndex(e => new { e.Id, e.SupplierCode, e.WarrantyCycle, e.UseTime, e.EquipmentCode, e.WarehouseCode, e.CabinetId, e.EquipmentSizecode, e.CurrentState })
.HasName("_dta_index_common_jp_equipment_inventory_8_1109578991__K6_K8_K9_K10_K12_1_3_20_23");
entity.HasIndex(e => new { e.CurrentState, e.CreateTime, e.Price, e.SafeLevel, e.IsFixed, e.OrgId, e.InventoryState, e.EquipmentSizecode, e.EquipmentCode, e.WarehouseCode })
entity.HasIndex(e => new { e.CreateTime, e.CurrentState, e.IsFixed, e.Price, e.SafeLevel, e.OrgId, e.InventoryState, e.EquipmentSizecode, e.EquipmentCode, e.WarehouseCode })
.HasName("_dta_index_common_jp_equipment_inventory_9_1109578991__K41_K31_K10_K6_K8_12_15_24_36_42");
entity.HasIndex(e => new { e.Sort, e.SupplierCode, e.Epc, e.PoliceCode, e.EquipmentCode, e.Wzdm, e.CabinetId, e.EquipmentSizecode, e.EquipmentLocation, e.OutTime, e.ReturnTime, e.CreateTime, e.FirstUseTime, e.FixCount, e.CreateUser, e.UpdateUser, e.WarrantyCycle, e.RepairCycle, e.ProductTime, e.UseTime, e.Price, e.UseDirection, e.CurrentState, e.Id, e.WarehouseCode })
......@@ -1895,6 +1902,7 @@ Smart:智能货架
entity.HasOne(d => d.PoliceCodeNavigation)
.WithMany(p => p.CommonJpEquipmentInventories)
.HasForeignKey(d => d.PoliceCode)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__polic__6A1BB7B0");
entity.HasOne(d => d.Shelf)
......@@ -2240,6 +2248,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Order)
.WithMany(p => p.CommonJpFixReceiveApplyDetails)
.HasForeignKey(d => d.OrderId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_fix_receive_apply_detail_ibfk_3");
entity.HasOne(d => d.Size)
......@@ -2759,7 +2768,7 @@ Warehouse:仓库");
entity.HasOne(d => d.ApplyPolice)
.WithMany(p => p.CommonJpPoliceShiftJobsApplies)
.HasForeignKey(d => d.ApplyPoliceId)
.OnDelete(DeleteBehavior.ClientSetNull)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__apply__569ECEE8");
entity.HasOne(d => d.ProcessCurrent)
......@@ -3095,6 +3104,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Apply)
.WithMany(p => p.CommonJpTransfers)
.HasForeignKey(d => d.ApplyId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_transfer_ibfk_5");
entity.HasOne(d => d.ReceiveOrgization)
......@@ -3167,6 +3177,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Apply)
.WithMany(p => p.CommonJpTransferApplyApplies)
.HasForeignKey(d => d.ApplyId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("common_jp_transfer_apply_ibfk_6");
entity.HasOne(d => d.ApprovalPersonNavigation)
......@@ -3262,6 +3273,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Estimate)
.WithMany(p => p.CommonJpTransferDetailRealities)
.HasForeignKey(d => d.EstimateId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_transfer_detail_reality_ibfk_4");
entity.HasOne(d => d.Reality)
......@@ -3326,6 +3338,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Police)
.WithMany(p => p.CommonJpUsers)
.HasForeignKey(d => d.PoliceId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__polic__7869D707");
});
......@@ -3367,7 +3380,6 @@ Warehouse:仓库");
entity.HasOne(d => d.User)
.WithMany(p => p.UsersRoles)
.HasForeignKey(d => d.UserId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("users_roles_ibfk_2");
});
......@@ -3542,6 +3554,8 @@ Warehouse:仓库");
entity.Property(e => e.AreaName).IsUnicode(false);
entity.Property(e => e.DName).IsUnicode(false);
entity.Property(e => e.EquipmentCode).IsUnicode(false);
entity.Property(e => e.EquipmentCode1).IsUnicode(false);
......
......@@ -87,5 +87,10 @@ namespace JmpModel.Model
public short? IsMap { get; set; }
[Column("is_fixed")]
public bool? IsFixed { get; set; }
[Column("level_flag")]
public bool? LevelFlag { get; set; }
[Column("d_name")]
[StringLength(64)]
public string DName { get; set; }
}
}
\ No newline at end of file
......@@ -13,7 +13,7 @@ namespace JmpModel.Model
[StringLength(36)]
public string OrgId { get; set; }
[Column("org_name")]
[StringLength(64)]
[StringLength(255)]
public string OrgName { get; set; }
[Column("area_name")]
[StringLength(128)]
......
......@@ -435,7 +435,7 @@
"ObjectType": 3
}
],
"UiHint": "pc.junmppolicesqldev.dbo",
"UiHint": "pc.junmppolicesqldev_mk2.dbo",
"UncountableWords": null,
"UseBoolPropertiesWithoutDefaultSql": false,
"UseDatabaseNames": false,
......
......@@ -1176,6 +1176,7 @@ namespace JunmpPoliceStation.Controllers
epc = wz_info.Epc,
warehouseId = wz_info?.WarehouseCode,
warehouseName = wz_info?.WarehouseCodeNavigation?.Name,
orgId = wz_info.OrgId,
isBindBag = !string.IsNullOrEmpty(wz_info.BagInventoryId)
};
return JsonManager.ReturnSuccessResponse(data);
......@@ -1292,7 +1293,7 @@ namespace JunmpPoliceStation.Controllers
//单警柜解绑
x.CabinetId = null;
x.PoliceCode = null;
x.UpdateTime=DateTime.Now;
x.UpdateTime = DateTime.Now;
_unitOfWork.EquipmentInventoryRepository.Update(x, false);
});
......
......@@ -8394,6 +8394,7 @@ namespace JunmpPoliceStation.Controllers
var data = equipmentList.GroupBy(t => new { t.OrgId, t.WarehouseCode, 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().EquipmentCode,
......@@ -8536,17 +8537,19 @@ namespace JunmpPoliceStation.Controllers
id = x.Key.WarehouseCode + x.Key.EquipmentSizecode,
warehouseName = x.FirstOrDefault().WarehouseCodeNavigation?.Name,
equipmentName = x.FirstOrDefault().EquipmentCodeNavigation?.Name,
equipmentCode = x.FirstOrDefault().EquipmentCodeNavigation?.Code,
warehouseId = x.FirstOrDefault().WarehouseCodeNavigation?.Id ?? "00000000-0000-0000-0000-000000000000",
equipmentSizeName = x.FirstOrDefault().EquipmentSizecodeNavigation?.SizeName,
equipmentSizeId = x.FirstOrDefault().EquipmentSizecodeNavigation?.Id,
equipmentSizeCode = x.FirstOrDefault().EquipmentSizecodeNavigation?.SizeCode,
sumCount = x.Count(),
zkCount = x.Count(c => c.CurrentState.Equals(3) || c.CurrentState.Equals(0)),
ckCount = x.Count(c => !(c.CurrentState.Equals(3) || c.CurrentState.Equals(0) || c.CurrentState.Equals(6))),
bfCount = x.Count(c => c.CurrentState.Equals(6)),
baofeiquCount = x.Count(c => c.IsFixed == true && c.CurrentState != 6),
})
.OrderBy(c => c.equipmentName)
.ThenBy(c => c.equipmentSizeName);
.OrderBy(c => c.equipmentCode)
.ThenBy(c => c.equipmentSizeCode);
var content = new
{
......@@ -9363,13 +9366,14 @@ namespace JunmpPoliceStation.Controllers
{
case "装备总数":
{
//无过滤
//过滤已报废
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6);
break;
}
case "在库数量":
{
//0:库存内+3:单警柜
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0 || t.CurrentState == 3);
//0:库存内
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0);
break;
}
case "调拨数量":
......@@ -9380,8 +9384,8 @@ namespace JunmpPoliceStation.Controllers
}
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);
//使用中=装备总数-(0:库存内)-1:调拨数量-4:维修数量-6:报废数量
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 0 && t.CurrentState != 1 && t.CurrentState != 4 && t.CurrentState != 6);
break;
}
case "维修数量":
......@@ -9409,12 +9413,12 @@ namespace JunmpPoliceStation.Controllers
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7);
break;
}
case "仓库装备":
{
//(不包括单警柜的装备)
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 3 && t.CurrentState != 7);
break;
}
//case "仓库装备":
// {
// //(不包括单警柜的装备)
// expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 3 && t.CurrentState != 7);
// break;
// }
default:
break;
}
......@@ -9666,13 +9670,14 @@ namespace JunmpPoliceStation.Controllers
{
case "装备总数":
{
//无过滤
//过滤已报废
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6);
break;
}
case "在库数量":
{
//0:库存内+3:单警柜
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0 || t.CurrentState == 3);
//0:库存内
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0);
break;
}
case "调拨数量":
......@@ -9683,8 +9688,8 @@ namespace JunmpPoliceStation.Controllers
}
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);
//使用中=装备总数-(0:库存内)-1:调拨数量-4:维修数量-6:报废数量
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 0 && t.CurrentState != 1 && t.CurrentState != 4 && t.CurrentState != 6);
break;
}
case "维修数量":
......@@ -9706,11 +9711,18 @@ namespace JunmpPoliceStation.Controllers
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6 && t.IsFixed == true);
break;
}
case "单警柜装备":
case "单警柜中":
{
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7);
break;
}
//case "仓库装备":
// {
// //(不包括单警柜的装备)
// expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 3 && t.CurrentState != 7);
// break;
// }
default:
break;
}
......
......@@ -188,7 +188,7 @@ namespace JunmpPoliceStation.Controllers
}
catch (Exception ex)
{
return JsonManager.SimpleCustResponse(ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
});
}
......@@ -365,7 +365,7 @@ namespace JunmpPoliceStation.Controllers
}
catch (Exception ex)
{
return JsonManager.SimpleCustResponse(ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
});
}
......@@ -482,7 +482,7 @@ namespace JunmpPoliceStation.Controllers
}
catch (Exception ex)
{
return JsonManager.SimpleCustResponse(ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
});
}
......@@ -599,7 +599,7 @@ namespace JunmpPoliceStation.Controllers
}
catch (Exception ex)
{
return JsonManager.SimpleCustResponse(ex.ToString());
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
});
}
......
......@@ -330,7 +330,7 @@ namespace JunmpPoliceStation.Controllers
}
if (!string.IsNullOrEmpty(vendorName))
{
expression = LambdaExtensions.And(expression, t => t.Detail.Supplier.Name.Contains(vendorName));
expression = LambdaExtensions.And(expression, t => t.Supplier.Name.Contains(vendorName));
}
if (!string.IsNullOrEmpty(productName))
{
......@@ -2628,7 +2628,11 @@ namespace JunmpPoliceStation.Controllers
{
//子单据完成
detailObj.State = 1;
if (detailObj.Order.CommonJpPurchaseDetails.Count(p => p.State.Equals(0) || p.State == null) <= 0)
var allDetailList = _unitOfWork.PurchaseDetailRepository.GetList(x=>x.OrderId==detailObj.OrderId).ToList();
if (allDetailList.Count(p => p.State.Equals(0) || p.State == null) <= 0)
{
//总单据完成
detailObj.Order.CurrentState = 1;
......
......@@ -106,11 +106,11 @@ namespace JunmpPoliceStation.Controllers
if (!String.IsNullOrEmpty(entity.name))
{
string parentName = entity.name;
zkCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && (c.CurrentState.Equals(0) || c.CurrentState.Equals(3))).Count();
zkCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && (c.CurrentState.Equals(0))).Count();
//调拨数量
houseCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && c.CurrentState.Equals(1)).Count();
//领用总量
lyCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && !(c.CurrentState.Equals(0) || c.CurrentState.Equals(3) || c.CurrentState.Equals(1) || c.CurrentState.Equals(4) || c.CurrentState.Equals(6))).Count();
lyCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && !(c.CurrentState.Equals(0) || c.CurrentState.Equals(1) || c.CurrentState.Equals(4) || c.CurrentState.Equals(6))).Count();
//维修数量
wxCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && c.CurrentState.Equals(4)).Count();
//报废总量
......@@ -122,11 +122,11 @@ namespace JunmpPoliceStation.Controllers
}
else
{
zkCount = ViewEquipmentList.Where(c => (c.CurrentState.Equals(0) || c.CurrentState.Equals(3))).Count();
zkCount = ViewEquipmentList.Where(c => (c.CurrentState.Equals(0))).Count();
//调拨数量
houseCount = ViewEquipmentList.Where(c => c.CurrentState.Equals(1)).Count();
//领用总量
lyCount = ViewEquipmentList.Where(c => !(c.CurrentState.Equals(0) || c.CurrentState.Equals(3) || c.CurrentState.Equals(1) || c.CurrentState.Equals(4) || c.CurrentState.Equals(6))).Count();
lyCount = ViewEquipmentList.Where(c => !(c.CurrentState.Equals(0) || c.CurrentState.Equals(1) || c.CurrentState.Equals(4) || c.CurrentState.Equals(6))).Count();
//维修数量
wxCount = ViewEquipmentList.Where(c => c.CurrentState.Equals(4)).Count();
//报废总量
......@@ -469,11 +469,11 @@ namespace JunmpPoliceStation.Controllers
if (level == "本级")
{
ViewEquipmentExpression = t => t.OrgCode == FindCode.PadRight(12, '0') && t.ParentName != null && (t.CurrentState.Equals(0) || t.CurrentState.Equals(3));
ViewEquipmentExpression = t => t.OrgCode == FindCode.PadRight(12, '0') && t.ParentName != null && (t.CurrentState.Equals(0));
}
else if (level == "本级及下级")
{
ViewEquipmentExpression = t => t.OrgCode.IndexOf(FindCode) == 0 && t.ParentName != null && (t.CurrentState.Equals(0) || t.CurrentState.Equals(3));
ViewEquipmentExpression = t => t.OrgCode.IndexOf(FindCode) == 0 && t.ParentName != null && (t.CurrentState.Equals(0));
}
else
{
......@@ -1204,7 +1204,7 @@ namespace JunmpPoliceStation.Controllers
Expression<Func<ViewEquipment, bool>> expressionPoliceman = null;
expressionPoliceman = t => t.FindCode.Contains(findcode);
expressionPoliceman = t => t.FindCode.Contains(findcode) && t.CurrentState != 6;//过滤已报废数据
List<ViewEquipment> equipmentList = _unitOfWork.ViewEquipmentRepository.GetList(expressionPoliceman).OrderBy(c => c.FindCode.Length).ToList();
......@@ -1212,7 +1212,7 @@ namespace JunmpPoliceStation.Controllers
{
var data = equipmentList.GroupBy(t => t.OrgName).Select(c => new
{
c.FirstOrDefault().OrgName,
OrgName = string.IsNullOrEmpty(c.FirstOrDefault().DName) ? c.FirstOrDefault().OrgName : c.FirstOrDefault().DName,
c.FirstOrDefault().OrgCode,
c.FirstOrDefault().FindCode,
c.FirstOrDefault().IsMap,
......@@ -1236,7 +1236,10 @@ namespace JunmpPoliceStation.Controllers
}
}
}
data = data.Where(c => c.children.Count > 0)
.OrderBy(c => c.FindCode)
.ThenBy(c => c.OrgCode)
.ToList();
var redata = new { data = data.OrderBy(x => x.OrgCode).ToList(), pList = pList };
return JsonManager.ReturnSuccessResponse(redata);
......@@ -1244,11 +1247,22 @@ 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 data1 = equipmentList.GroupBy(t => new
{
OrgName = c.FirstOrDefault().AreaName,
c.FirstOrDefault(x => x.OrgCode == c.FirstOrDefault().FindCode.PadRight(12, '0'))?.OrgCode,
c.FirstOrDefault().FindCode,
FindCode = t.FindCode.PadRight(codeLen, '0').Substring(0, codeLen),
FindCodeFlag = t.OrgCode.Substring(0, 6) == findcode.PadRight(6, '0') ? t.OrgCode : ""
});
var data = data1.Select(c => new
{
sortFlag = c.FirstOrDefault().FindCode.PadRight(12, '0') == c.FirstOrDefault().OrgCode || c.Key.FindCodeFlag == "" ? 0 : 1,
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.FirstOrDefault(x => x.OrgCode == c.FirstOrDefault().FindCode.PadRight(12, '0'))?.OrgCode,
//c.FirstOrDefault().FindCode,
c.OrderBy(f => f.OrgCode).FirstOrDefault().FindCode,
c.OrderBy(f => f.OrgCode).FirstOrDefault().OrgCode,
isMap = c.FirstOrDefault(x => x.OrgCode == c.FirstOrDefault().FindCode.PadRight(12, '0'))?.IsMap ?? 0,
zsCount = c.Count(f => f.CurrentState != null),
children = c.GroupBy(a => a.ParentName).Select(c => new
......@@ -1258,6 +1272,14 @@ namespace JunmpPoliceStation.Controllers
zsCount = c.Count(f => f.CurrentState != null)
}).Where(f => f.id != null).OrderBy(c => c.id).ToList()
}).ToList();
data = data.Where(c => c.zsCount != 0)
.OrderBy(c => c.sortFlag)
.ThenBy(c => c.FindCode.Length)
.ThenBy(c => c.FindCode)
.ThenBy(c => c.OrgCode)
.ToList();
List<String> pList = new List<String>();
for (var i = 0; i < data.Count; i++)
......@@ -1271,7 +1293,7 @@ namespace JunmpPoliceStation.Controllers
}
}
var redata = new { data = data.OrderBy(x => x.OrgCode).ToList(), pList = pList };
var redata = new { data = data.ToList(), pList = pList };
return JsonManager.ReturnSuccessResponse(redata);
}
......
......@@ -368,6 +368,7 @@ namespace JunmpPoliceStation.Controllers
string devCode = entity.devCode ?? "";
string orgid = entity.orgId ?? Guid.Empty.ToString();
string warehouseId = entity.warehouseId ?? "";
string level = entity.level ?? "";
if (size == 0)
......@@ -382,7 +383,17 @@ namespace JunmpPoliceStation.Controllers
ListEq = _unitOfWork.OrganizationRepository.GetList(t => t.State == 1, t => t.Code).ToList();
var dataList = GetClassID(orgid).Concat(ListEq.Where(c => c.Id.Equals(orgid))).ToList();
Expression<Func<BaseJpWarehouseDev, bool>> expression = t => dataList.Select(c => c.Id).Contains(t.Warehouse.OrgizationId);
Expression<Func<BaseJpWarehouseDev, bool>> expression = t => true;
if (level == "本级")
{
expression = LambdaExtensions.AndAlso(expression, t => t.Warehouse.OrgizationId == orgid);
}
else
{
expression = LambdaExtensions.AndAlso(expression, t => dataList.Select(c => c.Id).Contains(t.Warehouse.OrgizationId));
}
if (!string.IsNullOrEmpty(devName))
{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论