Commit 96a67afe by zxw

修复数据

parent c6e660fa
...@@ -105,6 +105,11 @@ namespace JmpModel.Model ...@@ -105,6 +105,11 @@ namespace JmpModel.Model
[Column("latitude")] [Column("latitude")]
[StringLength(255)] [StringLength(255)]
public string Latitude { get; set; } public string Latitude { get; set; }
/// <summary>
/// 0为本级,1为非本级
/// </summary>
[Column("level_flag")]
public bool? LevelFlag { get; set; }
[InverseProperty(nameof(BaseJpBag.Org))] [InverseProperty(nameof(BaseJpBag.Org))]
public virtual ICollection<BaseJpBag> BaseJpBags { get; set; } public virtual ICollection<BaseJpBag> BaseJpBags { get; set; }
......
...@@ -88,7 +88,6 @@ namespace JmpModel.Model ...@@ -88,7 +88,6 @@ namespace JmpModel.Model
/// <summary> /// <summary>
/// 申请警员id /// 申请警员id
/// </summary> /// </summary>
[Required]
[Column("apply_police_id")] [Column("apply_police_id")]
[StringLength(36)] [StringLength(36)]
public string ApplyPoliceId { get; set; } public string ApplyPoliceId { get; set; }
......
...@@ -129,7 +129,7 @@ namespace JmpModel.Model.DataContext ...@@ -129,7 +129,7 @@ namespace JmpModel.Model.DataContext
if (!optionsBuilder.IsConfigured) 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. #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 ...@@ -326,6 +326,7 @@ namespace JmpModel.Model.DataContext
entity.HasOne(d => d.Policeman) entity.HasOne(d => d.Policeman)
.WithMany(p => p.BaseJpCabinetPolicemen) .WithMany(p => p.BaseJpCabinetPolicemen)
.HasForeignKey(d => d.PolicemanId) .HasForeignKey(d => d.PolicemanId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("base_jp_cabinet_policeman_ibfk_2"); .HasConstraintName("base_jp_cabinet_policeman_ibfk_2");
}); });
...@@ -684,6 +685,8 @@ namespace JmpModel.Model.DataContext ...@@ -684,6 +685,8 @@ namespace JmpModel.Model.DataContext
.IsUnicode(false) .IsUnicode(false)
.HasComment("纬度"); .HasComment("纬度");
entity.Property(e => e.LevelFlag).HasComment("0为本级,1为非本级");
entity.Property(e => e.Longitude) entity.Property(e => e.Longitude)
.IsUnicode(false) .IsUnicode(false)
.HasComment("经度"); .HasComment("经度");
...@@ -1148,7 +1151,7 @@ Smart:智能货架 ...@@ -1148,7 +1151,7 @@ Smart:智能货架
entity.HasIndex(e => e.CurrentState) entity.HasIndex(e => e.CurrentState)
.HasName("IX_common_jp_borrow_return"); .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"); .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 }) 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:智能货架 ...@@ -1256,6 +1259,7 @@ Smart:智能货架
entity.HasOne(d => d.Police) entity.HasOne(d => d.Police)
.WithMany(p => p.CommonJpBorrowReturnApplyPolices) .WithMany(p => p.CommonJpBorrowReturnApplyPolices)
.HasForeignKey(d => d.PoliceId) .HasForeignKey(d => d.PoliceId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__polic__3726238F"); .HasConstraintName("FK__common_jp__polic__3726238F");
entity.HasOne(d => d.ProcessCurrent) entity.HasOne(d => d.ProcessCurrent)
...@@ -1453,6 +1457,7 @@ Smart:智能货架 ...@@ -1453,6 +1457,7 @@ Smart:智能货架
entity.HasOne(d => d.Police) entity.HasOne(d => d.Police)
.WithMany(p => p.CommonJpChannelMonitorRecords) .WithMany(p => p.CommonJpChannelMonitorRecords)
.HasForeignKey(d => d.PoliceId) .HasForeignKey(d => d.PoliceId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__polic__4A6E022D"); .HasConstraintName("FK__common_jp__polic__4A6E022D");
entity.HasOne(d => d.Warehouse) entity.HasOne(d => d.Warehouse)
...@@ -1685,6 +1690,7 @@ Smart:智能货架 ...@@ -1685,6 +1690,7 @@ Smart:智能货架
entity.HasOne(d => d.Inventory) entity.HasOne(d => d.Inventory)
.WithMany(p => p.CommonJpEquipmentFailWarehouseStates) .WithMany(p => p.CommonJpEquipmentFailWarehouseStates)
.HasForeignKey(d => d.InventoryId) .HasForeignKey(d => d.InventoryId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("FK__common_jp__inven__3DD3211E"); .HasConstraintName("FK__common_jp__inven__3DD3211E");
entity.HasOne(d => d.Police) entity.HasOne(d => d.Police)
...@@ -1722,6 +1728,7 @@ Smart:智能货架 ...@@ -1722,6 +1728,7 @@ Smart:智能货架
entity.HasOne(d => d.OperatorNavigation) entity.HasOne(d => d.OperatorNavigation)
.WithMany(p => p.CommonJpEquipmentHistories) .WithMany(p => p.CommonJpEquipmentHistories)
.HasForeignKey(d => d.Operator) .HasForeignKey(d => d.Operator)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("common_jp_equipment_history_ibfk_1"); .HasConstraintName("common_jp_equipment_history_ibfk_1");
entity.HasOne(d => d.WarehouseNavigation) entity.HasOne(d => d.WarehouseNavigation)
...@@ -1773,7 +1780,7 @@ Smart:智能货架 ...@@ -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 }) 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"); .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"); .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 }) 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:智能货架 ...@@ -1895,6 +1902,7 @@ Smart:智能货架
entity.HasOne(d => d.PoliceCodeNavigation) entity.HasOne(d => d.PoliceCodeNavigation)
.WithMany(p => p.CommonJpEquipmentInventories) .WithMany(p => p.CommonJpEquipmentInventories)
.HasForeignKey(d => d.PoliceCode) .HasForeignKey(d => d.PoliceCode)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__polic__6A1BB7B0"); .HasConstraintName("FK__common_jp__polic__6A1BB7B0");
entity.HasOne(d => d.Shelf) entity.HasOne(d => d.Shelf)
...@@ -2240,6 +2248,7 @@ Warehouse:仓库"); ...@@ -2240,6 +2248,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Order) entity.HasOne(d => d.Order)
.WithMany(p => p.CommonJpFixReceiveApplyDetails) .WithMany(p => p.CommonJpFixReceiveApplyDetails)
.HasForeignKey(d => d.OrderId) .HasForeignKey(d => d.OrderId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_fix_receive_apply_detail_ibfk_3"); .HasConstraintName("common_jp_fix_receive_apply_detail_ibfk_3");
entity.HasOne(d => d.Size) entity.HasOne(d => d.Size)
...@@ -2759,7 +2768,7 @@ Warehouse:仓库"); ...@@ -2759,7 +2768,7 @@ Warehouse:仓库");
entity.HasOne(d => d.ApplyPolice) entity.HasOne(d => d.ApplyPolice)
.WithMany(p => p.CommonJpPoliceShiftJobsApplies) .WithMany(p => p.CommonJpPoliceShiftJobsApplies)
.HasForeignKey(d => d.ApplyPoliceId) .HasForeignKey(d => d.ApplyPoliceId)
.OnDelete(DeleteBehavior.ClientSetNull) .OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__apply__569ECEE8"); .HasConstraintName("FK__common_jp__apply__569ECEE8");
entity.HasOne(d => d.ProcessCurrent) entity.HasOne(d => d.ProcessCurrent)
...@@ -3095,6 +3104,7 @@ Warehouse:仓库"); ...@@ -3095,6 +3104,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Apply) entity.HasOne(d => d.Apply)
.WithMany(p => p.CommonJpTransfers) .WithMany(p => p.CommonJpTransfers)
.HasForeignKey(d => d.ApplyId) .HasForeignKey(d => d.ApplyId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_transfer_ibfk_5"); .HasConstraintName("common_jp_transfer_ibfk_5");
entity.HasOne(d => d.ReceiveOrgization) entity.HasOne(d => d.ReceiveOrgization)
...@@ -3167,6 +3177,7 @@ Warehouse:仓库"); ...@@ -3167,6 +3177,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Apply) entity.HasOne(d => d.Apply)
.WithMany(p => p.CommonJpTransferApplyApplies) .WithMany(p => p.CommonJpTransferApplyApplies)
.HasForeignKey(d => d.ApplyId) .HasForeignKey(d => d.ApplyId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("common_jp_transfer_apply_ibfk_6"); .HasConstraintName("common_jp_transfer_apply_ibfk_6");
entity.HasOne(d => d.ApprovalPersonNavigation) entity.HasOne(d => d.ApprovalPersonNavigation)
...@@ -3262,6 +3273,7 @@ Warehouse:仓库"); ...@@ -3262,6 +3273,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Estimate) entity.HasOne(d => d.Estimate)
.WithMany(p => p.CommonJpTransferDetailRealities) .WithMany(p => p.CommonJpTransferDetailRealities)
.HasForeignKey(d => d.EstimateId) .HasForeignKey(d => d.EstimateId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_transfer_detail_reality_ibfk_4"); .HasConstraintName("common_jp_transfer_detail_reality_ibfk_4");
entity.HasOne(d => d.Reality) entity.HasOne(d => d.Reality)
...@@ -3326,6 +3338,7 @@ Warehouse:仓库"); ...@@ -3326,6 +3338,7 @@ Warehouse:仓库");
entity.HasOne(d => d.Police) entity.HasOne(d => d.Police)
.WithMany(p => p.CommonJpUsers) .WithMany(p => p.CommonJpUsers)
.HasForeignKey(d => d.PoliceId) .HasForeignKey(d => d.PoliceId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("FK__common_jp__polic__7869D707"); .HasConstraintName("FK__common_jp__polic__7869D707");
}); });
...@@ -3367,7 +3380,6 @@ Warehouse:仓库"); ...@@ -3367,7 +3380,6 @@ Warehouse:仓库");
entity.HasOne(d => d.User) entity.HasOne(d => d.User)
.WithMany(p => p.UsersRoles) .WithMany(p => p.UsersRoles)
.HasForeignKey(d => d.UserId) .HasForeignKey(d => d.UserId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("users_roles_ibfk_2"); .HasConstraintName("users_roles_ibfk_2");
}); });
...@@ -3542,6 +3554,8 @@ Warehouse:仓库"); ...@@ -3542,6 +3554,8 @@ Warehouse:仓库");
entity.Property(e => e.AreaName).IsUnicode(false); 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.EquipmentCode).IsUnicode(false);
entity.Property(e => e.EquipmentCode1).IsUnicode(false); entity.Property(e => e.EquipmentCode1).IsUnicode(false);
......
...@@ -87,5 +87,10 @@ namespace JmpModel.Model ...@@ -87,5 +87,10 @@ namespace JmpModel.Model
public short? IsMap { get; set; } public short? IsMap { get; set; }
[Column("is_fixed")] [Column("is_fixed")]
public bool? IsFixed { get; set; } 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 ...@@ -13,7 +13,7 @@ namespace JmpModel.Model
[StringLength(36)] [StringLength(36)]
public string OrgId { get; set; } public string OrgId { get; set; }
[Column("org_name")] [Column("org_name")]
[StringLength(64)] [StringLength(255)]
public string OrgName { get; set; } public string OrgName { get; set; }
[Column("area_name")] [Column("area_name")]
[StringLength(128)] [StringLength(128)]
......
...@@ -435,7 +435,7 @@ ...@@ -435,7 +435,7 @@
"ObjectType": 3 "ObjectType": 3
} }
], ],
"UiHint": "pc.junmppolicesqldev.dbo", "UiHint": "pc.junmppolicesqldev_mk2.dbo",
"UncountableWords": null, "UncountableWords": null,
"UseBoolPropertiesWithoutDefaultSql": false, "UseBoolPropertiesWithoutDefaultSql": false,
"UseDatabaseNames": false, "UseDatabaseNames": false,
......
...@@ -68,7 +68,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -68,7 +68,7 @@ namespace JunmpPoliceStation.Controllers
}; };
var param2 = new string[] { var param2 = new string[] {
"Warehouse" , "Warehouse" ,
"CommonJpFixReceiveApplyDetails" , "CommonJpFixReceiveApplyDetails" ,
"CommonJpFixReceiveApplyDetails.Equipment" , "CommonJpFixReceiveApplyDetails.Equipment" ,
...@@ -79,7 +79,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -79,7 +79,7 @@ namespace JunmpPoliceStation.Controllers
Expression<Func<CommonJpFixReceiveApply, bool>> expression = p => p.Id.Equals(id) || p.OrderCode.Equals(id); Expression<Func<CommonJpFixReceiveApply, bool>> expression = p => p.Id.Equals(id) || p.OrderCode.Equals(id);
var fix = _unitOfWork.FixReceiveApplyRepository.GetList(expression, null, false, param2).ToList(); var fix = _unitOfWork.FixReceiveApplyRepository.GetList(expression, null, false, param2).ToList();
if (fix.Count > 0) if (fix.Count > 0)
{ {
var first = fix[0]; var first = fix[0];
...@@ -1176,6 +1176,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1176,6 +1176,7 @@ namespace JunmpPoliceStation.Controllers
epc = wz_info.Epc, epc = wz_info.Epc,
warehouseId = wz_info?.WarehouseCode, warehouseId = wz_info?.WarehouseCode,
warehouseName = wz_info?.WarehouseCodeNavigation?.Name, warehouseName = wz_info?.WarehouseCodeNavigation?.Name,
orgId = wz_info.OrgId,
isBindBag = !string.IsNullOrEmpty(wz_info.BagInventoryId) isBindBag = !string.IsNullOrEmpty(wz_info.BagInventoryId)
}; };
return JsonManager.ReturnSuccessResponse(data); return JsonManager.ReturnSuccessResponse(data);
...@@ -1292,7 +1293,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1292,7 +1293,7 @@ namespace JunmpPoliceStation.Controllers
//单警柜解绑 //单警柜解绑
x.CabinetId = null; x.CabinetId = null;
x.PoliceCode = null; x.PoliceCode = null;
x.UpdateTime=DateTime.Now; x.UpdateTime = DateTime.Now;
_unitOfWork.EquipmentInventoryRepository.Update(x, false); _unitOfWork.EquipmentInventoryRepository.Update(x, false);
}); });
......
...@@ -8394,6 +8394,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -8394,6 +8394,7 @@ namespace JunmpPoliceStation.Controllers
var data = equipmentList.GroupBy(t => new { t.OrgId, t.WarehouseCode, t.EquipmentSizecode }).Select(c => new var data = equipmentList.GroupBy(t => new { t.OrgId, t.WarehouseCode, t.EquipmentSizecode }).Select(c => new
{ {
c.FirstOrDefault().OrgId, c.FirstOrDefault().OrgId,
c.FirstOrDefault().OrgName,
WarehouseCode = c.FirstOrDefault(x => x.WarehouseCode != null)?.WarehouseCode ?? "00000000-0000-0000-0000-000000000000", WarehouseCode = c.FirstOrDefault(x => x.WarehouseCode != null)?.WarehouseCode ?? "00000000-0000-0000-0000-000000000000",
WarehouseName = c.FirstOrDefault(x => x.WarehouseCode != null)?.WarehouseName ?? "", WarehouseName = c.FirstOrDefault(x => x.WarehouseCode != null)?.WarehouseName ?? "",
c.FirstOrDefault().EquipmentCode, c.FirstOrDefault().EquipmentCode,
...@@ -8536,17 +8537,19 @@ namespace JunmpPoliceStation.Controllers ...@@ -8536,17 +8537,19 @@ namespace JunmpPoliceStation.Controllers
id = x.Key.WarehouseCode + x.Key.EquipmentSizecode, id = x.Key.WarehouseCode + x.Key.EquipmentSizecode,
warehouseName = x.FirstOrDefault().WarehouseCodeNavigation?.Name, warehouseName = x.FirstOrDefault().WarehouseCodeNavigation?.Name,
equipmentName = x.FirstOrDefault().EquipmentCodeNavigation?.Name, equipmentName = x.FirstOrDefault().EquipmentCodeNavigation?.Name,
equipmentCode = x.FirstOrDefault().EquipmentCodeNavigation?.Code,
warehouseId = x.FirstOrDefault().WarehouseCodeNavigation?.Id ?? "00000000-0000-0000-0000-000000000000", warehouseId = x.FirstOrDefault().WarehouseCodeNavigation?.Id ?? "00000000-0000-0000-0000-000000000000",
equipmentSizeName = x.FirstOrDefault().EquipmentSizecodeNavigation?.SizeName, equipmentSizeName = x.FirstOrDefault().EquipmentSizecodeNavigation?.SizeName,
equipmentSizeId = x.FirstOrDefault().EquipmentSizecodeNavigation?.Id, equipmentSizeId = x.FirstOrDefault().EquipmentSizecodeNavigation?.Id,
equipmentSizeCode = x.FirstOrDefault().EquipmentSizecodeNavigation?.SizeCode,
sumCount = x.Count(), sumCount = x.Count(),
zkCount = x.Count(c => c.CurrentState.Equals(3) || c.CurrentState.Equals(0)), 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))), ckCount = x.Count(c => !(c.CurrentState.Equals(3) || c.CurrentState.Equals(0) || c.CurrentState.Equals(6))),
bfCount = x.Count(c => c.CurrentState.Equals(6)), bfCount = x.Count(c => c.CurrentState.Equals(6)),
baofeiquCount = x.Count(c => c.IsFixed == true && c.CurrentState != 6), baofeiquCount = x.Count(c => c.IsFixed == true && c.CurrentState != 6),
}) })
.OrderBy(c => c.equipmentName) .OrderBy(c => c.equipmentCode)
.ThenBy(c => c.equipmentSizeName); .ThenBy(c => c.equipmentSizeCode);
var content = new var content = new
{ {
...@@ -9363,13 +9366,14 @@ namespace JunmpPoliceStation.Controllers ...@@ -9363,13 +9366,14 @@ namespace JunmpPoliceStation.Controllers
{ {
case "装备总数": case "装备总数":
{ {
//无过滤 //过滤已报废
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6);
break; break;
} }
case "在库数量": case "在库数量":
{ {
//0:库存内+3:单警柜 //0:库存内
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0 || t.CurrentState == 3); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0);
break; break;
} }
case "调拨数量": case "调拨数量":
...@@ -9380,8 +9384,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -9380,8 +9384,8 @@ namespace JunmpPoliceStation.Controllers
} }
case "领用数量": case "领用数量":
{ {
//使用中=装备总数-(0:+3:在库数量)-1:调拨数量-4:维修数量-6:报废数量 //使用中=装备总数-(0:库存内)-1:调拨数量-4:维修数量-6:报废数量
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 0 && t.CurrentState != 3 && t.CurrentState != 1 && t.CurrentState != 4 && t.CurrentState != 6); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 0 && t.CurrentState != 1 && t.CurrentState != 4 && t.CurrentState != 6);
break; break;
} }
case "维修数量": case "维修数量":
...@@ -9409,12 +9413,12 @@ namespace JunmpPoliceStation.Controllers ...@@ -9409,12 +9413,12 @@ namespace JunmpPoliceStation.Controllers
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7);
break; break;
} }
case "仓库装备": //case "仓库装备":
{ // {
//(不包括单警柜的装备) // //(不包括单警柜的装备)
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 3 && t.CurrentState != 7); // expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 3 && t.CurrentState != 7);
break; // break;
} // }
default: default:
break; break;
} }
...@@ -9666,13 +9670,14 @@ namespace JunmpPoliceStation.Controllers ...@@ -9666,13 +9670,14 @@ namespace JunmpPoliceStation.Controllers
{ {
case "装备总数": case "装备总数":
{ {
//无过滤 //过滤已报废
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6);
break; break;
} }
case "在库数量": case "在库数量":
{ {
//0:库存内+3:单警柜 //0:库存内
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0 || t.CurrentState == 3); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 0);
break; break;
} }
case "调拨数量": case "调拨数量":
...@@ -9683,8 +9688,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -9683,8 +9688,8 @@ namespace JunmpPoliceStation.Controllers
} }
case "领用数量": case "领用数量":
{ {
//使用中=装备总数-(0:+3:在库数量)-1:调拨数量-4:维修数量-6:报废数量 //使用中=装备总数-(0:库存内)-1:调拨数量-4:维修数量-6:报废数量
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 0 && t.CurrentState != 3 && t.CurrentState != 1 && t.CurrentState != 4 && t.CurrentState != 6); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 0 && t.CurrentState != 1 && t.CurrentState != 4 && t.CurrentState != 6);
break; break;
} }
case "维修数量": case "维修数量":
...@@ -9706,11 +9711,18 @@ namespace JunmpPoliceStation.Controllers ...@@ -9706,11 +9711,18 @@ namespace JunmpPoliceStation.Controllers
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6 && t.IsFixed == true); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 6 && t.IsFixed == true);
break; break;
} }
case "单警柜装备":
case "单警柜中": case "单警柜中":
{ {
expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7); expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState == 3 || t.CurrentState == 7);
break; break;
} }
//case "仓库装备":
// {
// //(不包括单警柜的装备)
// expression = LambdaExtensions.AndAlso(expression, t => t.CurrentState != 3 && t.CurrentState != 7);
// break;
// }
default: default:
break; break;
} }
......
...@@ -188,7 +188,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -188,7 +188,7 @@ namespace JunmpPoliceStation.Controllers
} }
catch (Exception ex) catch (Exception ex)
{ {
return JsonManager.SimpleCustResponse(ex.ToString()); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
}); });
} }
...@@ -365,7 +365,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -365,7 +365,7 @@ namespace JunmpPoliceStation.Controllers
} }
catch (Exception ex) catch (Exception ex)
{ {
return JsonManager.SimpleCustResponse(ex.ToString()); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
}); });
} }
...@@ -482,7 +482,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -482,7 +482,7 @@ namespace JunmpPoliceStation.Controllers
} }
catch (Exception ex) catch (Exception ex)
{ {
return JsonManager.SimpleCustResponse(ex.ToString()); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
}); });
} }
...@@ -599,7 +599,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -599,7 +599,7 @@ namespace JunmpPoliceStation.Controllers
} }
catch (Exception ex) catch (Exception ex)
{ {
return JsonManager.SimpleCustResponse(ex.ToString()); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
} }
}); });
} }
......
...@@ -330,7 +330,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -330,7 +330,7 @@ namespace JunmpPoliceStation.Controllers
} }
if (!string.IsNullOrEmpty(vendorName)) 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)) if (!string.IsNullOrEmpty(productName))
{ {
...@@ -2628,7 +2628,11 @@ namespace JunmpPoliceStation.Controllers ...@@ -2628,7 +2628,11 @@ namespace JunmpPoliceStation.Controllers
{ {
//子单据完成 //子单据完成
detailObj.State = 1; 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; detailObj.Order.CurrentState = 1;
......
...@@ -650,18 +650,21 @@ namespace JunmpPoliceStation.Controllers ...@@ -650,18 +650,21 @@ namespace JunmpPoliceStation.Controllers
expressionPoliceman = LambdaExtensions.AndAlso(expressionPoliceman, t => t.EquipmentSizecode.Equals(equipmentSizecode)); expressionPoliceman = LambdaExtensions.AndAlso(expressionPoliceman, t => t.EquipmentSizecode.Equals(equipmentSizecode));
} }
List<ViewEquipment> equipmentList = _unitOfWork.ViewEquipmentRepository.GetList(expressionPoliceman).OrderBy(c => c.FindCode.Length).ToList(); List<ViewEquipment> equipmentList = _unitOfWork.ViewEquipmentRepository
.GetList(expressionPoliceman)
.OrderBy(c => c.FindCode.Length)
.ToList();
if (org.FindCode.Length == 6) if (org.FindCode.Length == 6)
{ {
var data = equipmentList.GroupBy(t => t.OrgName).Select(c => new 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().FindCode, c.FirstOrDefault().FindCode,
c.FirstOrDefault().OrgCode, c.FirstOrDefault().OrgCode,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
djgCount = c.Count(x => x.CurrentState == 3), djgCount = c.Count(x => x.CurrentState == 3),
...@@ -673,8 +676,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -673,8 +676,8 @@ 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 != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
djgCount = c.Count(x => x.CurrentState == 3), djgCount = c.Count(x => x.CurrentState == 3),
...@@ -709,14 +712,22 @@ namespace JunmpPoliceStation.Controllers ...@@ -709,14 +712,22 @@ namespace JunmpPoliceStation.Controllers
else else
{ {
var codeLen = org.FindCode.Length + 2; var codeLen = org.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.OrderBy(f => f.OrgCode).FirstOrDefault().AreaName, FindCode = t.FindCode.PadRight(codeLen, '0').Substring(0, codeLen),
FindCodeFlag = t.OrgCode.Substring(0, 6) == org.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.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,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
djgCount = c.Count(x => x.CurrentState == 3), djgCount = c.Count(x => x.CurrentState == 3),
...@@ -728,8 +739,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -728,8 +739,8 @@ 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 != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
djgCount = c.Count(x => x.CurrentState == 3), djgCount = c.Count(x => x.CurrentState == 3),
...@@ -740,7 +751,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -740,7 +751,8 @@ namespace JunmpPoliceStation.Controllers
}).ToList(); }).ToList();
data = data.Where(c => c.zsCount != 0 || c.bfCount != 0) data = data.Where(c => c.zsCount != 0 || c.bfCount != 0)
.OrderBy(c => c.FindCode.Length) .OrderBy(c => c.sortFlag)
.ThenBy(c => c.FindCode.Length)
.ThenBy(c => c.FindCode) .ThenBy(c => c.FindCode)
.ThenBy(c => c.OrgCode) .ThenBy(c => c.OrgCode)
.ToList(); .ToList();
...@@ -1152,26 +1164,67 @@ namespace JunmpPoliceStation.Controllers ...@@ -1152,26 +1164,67 @@ namespace JunmpPoliceStation.Controllers
size = 10; size = 10;
} }
Expression<Func<BaseJpOrganization, bool>> expression = t => t.State == 1; //Expression<Func<BaseJpOrganization, bool>> expression = t => t.State == 1;
ListEq = _unitOfWork.OrganizationRepository.GetList(expression, t => t.Code).ToList(); //ListEq = _unitOfWork.OrganizationRepository.GetList(expression, t => t.Code).ToList();
string orgizationCode = Guid.Empty.ToString(); //string orgizationCode = Guid.Empty.ToString();
List<BaseJpOrganization> dataList = null; //List<BaseJpOrganization> dataList = null;
if (!String.IsNullOrEmpty(entity.orgId)) //if (!String.IsNullOrEmpty(entity.orgId))
//{
// orgizationCode = entity.orgId;
//}
//var findcode = ListEq.Where(c => c.Id.Equals(orgizationCode)).FirstOrDefault().FindCode;
//dataList = GetClassID(orgizationCode);
//dataList = dataList.ToList().Concat(ListEq.Where(c => c.Id.Equals(orgizationCode))).ToList();
//Expression<Func<ViewEquipment, bool>> expressionPoliceman = null;
string orgId = entity.orgId;
if (string.IsNullOrEmpty(orgId))
{ {
orgizationCode = entity.orgId; return JsonManager.SimpleCustResponse($"orgId is require");
}
var org = _unitOfWork.DbContext.BaseJpOrganizations.FirstOrDefault(x => x.Id == orgId);
if (org == null)
{
return JsonManager.SimpleCustResponse($"orgId is require");
} }
var findcode = ListEq.Where(c => c.Id.Equals(orgizationCode)).FirstOrDefault().FindCode; var orgModelList = new List<OrgTreeModel>();
if (MemoryCacheHelper.Exists("orgModelList"))
{
orgModelList = (List<OrgTreeModel>)MemoryCacheHelper.Get("orgModelList");
}
else
{
orgModelList = _unitOfWork.OrganizationRepository
.Entities
.Select(x => new OrgTreeModel
{
Id = x.Id,
State = x.State == 1,
Name = x.Name,
Code = x.Code,
ParentId = x.ParentId
})
.ToList();
dataList = GetClassID(orgizationCode); //默认过期时间1天
MemoryCacheHelper.AddMemoryCache("orgModelList", orgModelList, 1440);
}
dataList = dataList.ToList().Concat(ListEq.Where(c => c.Id.Equals(orgizationCode))).ToList();
Expression<Func<ViewEquipment, bool>> expressionPoliceman = null; Expression<Func<ViewEquipment, bool>> expressionPoliceman = null;
var idList = OrgTreeModel.GetOrgIdList(orgModelList, org.Id);
expressionPoliceman = t => idList.Contains(t.OrgId);
string typeId = entity.typeId; string typeId = entity.typeId;
string equipmentCode = entity.equipmentCode; string equipmentCode = entity.equipmentCode;
string equipmentSizecode = entity.equipmentSizecode; string equipmentSizecode = entity.equipmentSizecode;
...@@ -1182,9 +1235,9 @@ namespace JunmpPoliceStation.Controllers ...@@ -1182,9 +1235,9 @@ namespace JunmpPoliceStation.Controllers
year = int.Parse(entity.year); year = int.Parse(entity.year);
} }
List<string> IdList = dataList.Select(c => c.Id).ToList(); //List<string> IdList = dataList.Select(c => c.Id).ToList();
expressionPoliceman = t => IdList.Contains(t.OrgId); //expressionPoliceman = t => IdList.Contains(t.OrgId);
if (!String.IsNullOrEmpty(typeId)) if (!String.IsNullOrEmpty(typeId))
{ {
...@@ -1203,7 +1256,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1203,7 +1256,7 @@ namespace JunmpPoliceStation.Controllers
List<ViewEquipment> equipmentList = _unitOfWork.ViewEquipmentRepository.GetList(expressionPoliceman).OrderBy(c => c.FindCode.Length).ToList(); List<ViewEquipment> equipmentList = _unitOfWork.ViewEquipmentRepository.GetList(expressionPoliceman).OrderBy(c => c.FindCode.Length).ToList();
if (findcode.Length == 6) if (org.FindCode.Length == 6)
{ {
var data = equipmentList.GroupBy(t => t.OrgName).Select(c => new var data = equipmentList.GroupBy(t => t.OrgName).Select(c => new
{ {
...@@ -1228,7 +1281,11 @@ namespace JunmpPoliceStation.Controllers ...@@ -1228,7 +1281,11 @@ namespace JunmpPoliceStation.Controllers
}).Where(f => f.id != null).ToList() }).Where(f => f.id != null).ToList()
}).ToList(); }).ToList();
data = data.OrderBy(c => c.OrgCode).ToList(); //data = data.OrderBy(c => c.OrgCode).ToList();
data = data.Where(c => c.yearStartCount != 0 || c.yearEndCount != 0)
.OrderBy(c => c.OrgCode)
.ToList();
var dataPage = new var dataPage = new
{ {
...@@ -1245,15 +1302,26 @@ namespace JunmpPoliceStation.Controllers ...@@ -1245,15 +1302,26 @@ namespace JunmpPoliceStation.Controllers
} }
else else
{ {
var codeLen = findcode.Length + 2; var codeLen = org.FindCode.Length + 2;
var temp = equipmentList.GroupBy(t => t.FindCode.PadLeft(codeLen, '0').Substring(0, codeLen)) //var temp = equipmentList.GroupBy(t => t.FindCode.PadLeft(codeLen, '0').Substring(0, codeLen))
.ToList(); // .ToList();
var data = temp.Select(c => new var data1 = equipmentList.GroupBy(t => new
{
FindCode = t.FindCode.PadRight(codeLen, '0').Substring(0, codeLen),
FindCodeFlag = t.OrgCode.Substring(0, 6) == org.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,
FindCode = c.FirstOrDefault().FindCode, FindCode = c.FirstOrDefault().FindCode,
OrgName = codeLen < 6 ? //OrgName = codeLen < 6 ?
ListEq.FirstOrDefault(x => x.Code == c.FirstOrDefault().FindCode.Substring(0, codeLen).PadRight(12, '0')).AreaName // ListEq.FirstOrDefault(x => x.Code == c.FirstOrDefault().FindCode.Substring(0, codeLen).PadRight(12, '0')).AreaName
: c.FirstOrDefault().AreaName, // : c.FirstOrDefault().AreaName,
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().OrgCode, c.FirstOrDefault().OrgCode,
yearStartCount = c.Count(f => !f.CurrentState.Equals(6) && f.CreateTime?.Year < year), yearStartCount = c.Count(f => !f.CurrentState.Equals(6) && f.CreateTime?.Year < year),
yearStartPrice = c.Where(f => !f.CurrentState.Equals(6) && f.Price != null && f.CreateTime?.Year < year).Sum(k => k.Price), yearStartPrice = c.Where(f => !f.CurrentState.Equals(6) && f.Price != null && f.CreateTime?.Year < year).Sum(k => k.Price),
...@@ -1274,7 +1342,13 @@ namespace JunmpPoliceStation.Controllers ...@@ -1274,7 +1342,13 @@ namespace JunmpPoliceStation.Controllers
}).Where(f => f.id != null).ToList() }).Where(f => f.id != null).ToList()
}).ToList(); }).ToList();
data = data.OrderBy(c => c.OrgCode).ToList(); //data = data.OrderBy(c => c.OrgCode).ToList();
data = data.Where(c => c.yearStartCount != 0 || c.yearEndCount != 0)
.OrderBy(c => c.sortFlag)
.ThenBy(c => c.FindCode.Length)
.ThenBy(c => c.FindCode)
.ThenBy(c => c.OrgCode)
.ToList();
var dataPage = new var dataPage = new
{ {
...@@ -1731,8 +1805,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -1731,8 +1805,8 @@ namespace JunmpPoliceStation.Controllers
id = c.FirstOrDefault().TypeOneId, id = c.FirstOrDefault().TypeOneId,
name = c.FirstOrDefault().ParentName, name = c.FirstOrDefault().ParentName,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
children = c.Where(c => c.TypeTwoId != c.TypeOneId).OrderBy(c => c.TypeTwoId).GroupBy(a => a.TypeTwoId).Select((c, idx1) => new children = c.Where(c => c.TypeTwoId != c.TypeOneId).OrderBy(c => c.TypeTwoId).GroupBy(a => a.TypeTwoId).Select((c, idx1) => new
{ {
...@@ -1740,8 +1814,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -1740,8 +1814,8 @@ namespace JunmpPoliceStation.Controllers
id = c.FirstOrDefault().TypeTwoId, id = c.FirstOrDefault().TypeTwoId,
name = c.FirstOrDefault().TypeName, name = c.FirstOrDefault().TypeName,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
children = c.Where(c => c.TypeThreeId != c.TypeTwoId).OrderBy(c => c.TypeThreeId).GroupBy(a => a.TypeThreeId).Select((c, idx2) => new children = c.Where(c => c.TypeThreeId != c.TypeTwoId).OrderBy(c => c.TypeThreeId).GroupBy(a => a.TypeThreeId).Select((c, idx2) => new
{ {
...@@ -1749,8 +1823,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -1749,8 +1823,8 @@ namespace JunmpPoliceStation.Controllers
id = c.FirstOrDefault().TypeThreeId, id = c.FirstOrDefault().TypeThreeId,
name = c.FirstOrDefault().Name, name = c.FirstOrDefault().Name,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
children = c.OrderBy(c => c.EquipmentCode).GroupBy(a => a.EquipmentCode).Select((c, idx3) => new children = c.OrderBy(c => c.EquipmentCode).GroupBy(a => a.EquipmentCode).Select((c, idx3) => new
{ {
...@@ -1758,8 +1832,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -1758,8 +1832,8 @@ 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 != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(), bfCount = c.Where(f => f.CurrentState.Equals(6)).Count(),
children = c.OrderBy(c => c.EquipmentSizecode).GroupBy(a => new { a.EquipmentSizecode, a.Address, a.SupplierName, a.Price }).Select((c, idx4) => new children = c.OrderBy(c => c.EquipmentSizecode).GroupBy(a => new { a.EquipmentSizecode, a.Address, a.SupplierName, a.Price }).Select((c, idx4) => new
{ {
...@@ -1771,8 +1845,8 @@ namespace JunmpPoliceStation.Controllers ...@@ -1771,8 +1845,8 @@ namespace JunmpPoliceStation.Controllers
price = c.Key.Price, price = c.Key.Price,
sumPrice = c.Count(f => f.CurrentState != null) * c.Key.Price, sumPrice = c.Count(f => f.CurrentState != null) * c.Key.Price,
zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != 6 && f.CurrentState != null),
zkCount = c.Where(f => f.CurrentState.Equals(0) || f.CurrentState.Equals(3)).Count(), zkCount = c.Where(f => f.CurrentState.Equals(0)).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(6))).Count(),
bfCount = c.Where(f => f.CurrentState.Equals(6)).Count() bfCount = c.Where(f => f.CurrentState.Equals(6)).Count()
} }
).Where(c => c.id != null).ToList() ).Where(c => c.id != null).ToList()
......
...@@ -106,11 +106,11 @@ namespace JunmpPoliceStation.Controllers ...@@ -106,11 +106,11 @@ namespace JunmpPoliceStation.Controllers
if (!String.IsNullOrEmpty(entity.name)) if (!String.IsNullOrEmpty(entity.name))
{ {
string parentName = 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(); 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(); wxCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && c.CurrentState.Equals(4)).Count();
//报废总量 //报废总量
...@@ -122,11 +122,11 @@ namespace JunmpPoliceStation.Controllers ...@@ -122,11 +122,11 @@ namespace JunmpPoliceStation.Controllers
} }
else 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(); 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(); wxCount = ViewEquipmentList.Where(c => c.CurrentState.Equals(4)).Count();
//报废总量 //报废总量
...@@ -469,11 +469,11 @@ namespace JunmpPoliceStation.Controllers ...@@ -469,11 +469,11 @@ namespace JunmpPoliceStation.Controllers
if (level == "本级") 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 == "本级及下级") 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 else
{ {
...@@ -1204,7 +1204,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1204,7 +1204,7 @@ namespace JunmpPoliceStation.Controllers
Expression<Func<ViewEquipment, bool>> expressionPoliceman = null; 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(); List<ViewEquipment> equipmentList = _unitOfWork.ViewEquipmentRepository.GetList(expressionPoliceman).OrderBy(c => c.FindCode.Length).ToList();
...@@ -1212,7 +1212,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1212,7 +1212,7 @@ namespace JunmpPoliceStation.Controllers
{ {
var data = equipmentList.GroupBy(t => t.OrgName).Select(c => new 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().OrgCode,
c.FirstOrDefault().FindCode, c.FirstOrDefault().FindCode,
c.FirstOrDefault().IsMap, c.FirstOrDefault().IsMap,
...@@ -1236,7 +1236,10 @@ namespace JunmpPoliceStation.Controllers ...@@ -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 }; var redata = new { data = data.OrderBy(x => x.OrgCode).ToList(), pList = pList };
return JsonManager.ReturnSuccessResponse(redata); return JsonManager.ReturnSuccessResponse(redata);
...@@ -1244,11 +1247,22 @@ namespace JunmpPoliceStation.Controllers ...@@ -1244,11 +1247,22 @@ 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 data1 = equipmentList.GroupBy(t => new
{ {
OrgName = c.FirstOrDefault().AreaName, FindCode = t.FindCode.PadRight(codeLen, '0').Substring(0, codeLen),
c.FirstOrDefault(x => x.OrgCode == c.FirstOrDefault().FindCode.PadRight(12, '0'))?.OrgCode,
c.FirstOrDefault().FindCode, 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, isMap = c.FirstOrDefault(x => x.OrgCode == c.FirstOrDefault().FindCode.PadRight(12, '0'))?.IsMap ?? 0,
zsCount = c.Count(f => f.CurrentState != null), zsCount = c.Count(f => f.CurrentState != null),
children = c.GroupBy(a => a.ParentName).Select(c => new children = c.GroupBy(a => a.ParentName).Select(c => new
...@@ -1258,6 +1272,14 @@ namespace JunmpPoliceStation.Controllers ...@@ -1258,6 +1272,14 @@ namespace JunmpPoliceStation.Controllers
zsCount = c.Count(f => f.CurrentState != null) zsCount = c.Count(f => f.CurrentState != null)
}).Where(f => f.id != null).OrderBy(c => c.id).ToList() }).Where(f => f.id != null).OrderBy(c => c.id).ToList()
}).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>(); List<String> pList = new List<String>();
for (var i = 0; i < data.Count; i++) for (var i = 0; i < data.Count; i++)
...@@ -1271,7 +1293,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -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); return JsonManager.ReturnSuccessResponse(redata);
} }
......
...@@ -368,6 +368,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -368,6 +368,7 @@ namespace JunmpPoliceStation.Controllers
string devCode = entity.devCode ?? ""; string devCode = entity.devCode ?? "";
string orgid = entity.orgId ?? Guid.Empty.ToString(); string orgid = entity.orgId ?? Guid.Empty.ToString();
string warehouseId = entity.warehouseId ?? ""; string warehouseId = entity.warehouseId ?? "";
string level = entity.level ?? "";
if (size == 0) if (size == 0)
...@@ -382,7 +383,17 @@ namespace JunmpPoliceStation.Controllers ...@@ -382,7 +383,17 @@ namespace JunmpPoliceStation.Controllers
ListEq = _unitOfWork.OrganizationRepository.GetList(t => t.State == 1, t => t.Code).ToList(); 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(); 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)) if (!string.IsNullOrEmpty(devName))
{ {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论