Commit 5c9dc64a by zxw

1222 部署

parent 8278dcff
...@@ -135,6 +135,12 @@ namespace JmpModel.Model ...@@ -135,6 +135,12 @@ namespace JmpModel.Model
public string BagInventoryId { get; set; } public string BagInventoryId { get; set; }
[Column("is_need_push_update")] [Column("is_need_push_update")]
public bool? IsNeedPushUpdate { get; set; } public bool? IsNeedPushUpdate { get; set; }
/// <summary>
/// 是否继续使用
/// </summary>
[Required]
[Column("is_continue_use")]
public bool? IsContinueUse { get; set; }
[ForeignKey(nameof(BagInventoryId))] [ForeignKey(nameof(BagInventoryId))]
[InverseProperty(nameof(CommonJpBagInventory.CommonJpEquipmentInventories))] [InverseProperty(nameof(CommonJpBagInventory.CommonJpEquipmentInventories))]
......
...@@ -392,6 +392,7 @@ namespace JmpModel.Model.DataContext ...@@ -392,6 +392,7 @@ namespace JmpModel.Model.DataContext
entity.HasOne(d => d.Apply) entity.HasOne(d => d.Apply)
.WithMany(p => p.CommonJpBorrowReturns) .WithMany(p => p.CommonJpBorrowReturns)
.HasForeignKey(d => d.ApplyId) .HasForeignKey(d => d.ApplyId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_borrow_return_ibfk_6"); .HasConstraintName("common_jp_borrow_return_ibfk_6");
entity.HasOne(d => d.Org) entity.HasOne(d => d.Org)
...@@ -449,6 +450,7 @@ namespace JmpModel.Model.DataContext ...@@ -449,6 +450,7 @@ namespace JmpModel.Model.DataContext
entity.HasOne(d => d.Estimate) entity.HasOne(d => d.Estimate)
.WithMany(p => p.CommonJpBorrowReturnDetailEstimates) .WithMany(p => p.CommonJpBorrowReturnDetailEstimates)
.HasForeignKey(d => d.EstimateId) .HasForeignKey(d => d.EstimateId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_borrow_return_detail_estimate_ibfk_5"); .HasConstraintName("common_jp_borrow_return_detail_estimate_ibfk_5");
entity.HasOne(d => d.Size) entity.HasOne(d => d.Size)
...@@ -478,6 +480,7 @@ namespace JmpModel.Model.DataContext ...@@ -478,6 +480,7 @@ namespace JmpModel.Model.DataContext
entity.HasOne(d => d.Estimate) entity.HasOne(d => d.Estimate)
.WithMany(p => p.CommonJpBorrowReturnDetailRealities) .WithMany(p => p.CommonJpBorrowReturnDetailRealities)
.HasForeignKey(d => d.EstimateId) .HasForeignKey(d => d.EstimateId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_borrow_return_detail_reality_ibfk_7"); .HasConstraintName("common_jp_borrow_return_detail_reality_ibfk_7");
entity.HasOne(d => d.Reality) entity.HasOne(d => d.Reality)
...@@ -609,6 +612,10 @@ namespace JmpModel.Model.DataContext ...@@ -609,6 +612,10 @@ namespace JmpModel.Model.DataContext
entity.Property(e => e.IsBorrowed).HasDefaultValueSql("b'0'"); entity.Property(e => e.IsBorrowed).HasDefaultValueSql("b'0'");
entity.Property(e => e.IsContinueUse)
.HasDefaultValueSql("b'0'")
.HasComment("是否继续使用");
entity.Property(e => e.IsInBox).HasDefaultValueSql("b'0'"); entity.Property(e => e.IsInBox).HasDefaultValueSql("b'0'");
entity.Property(e => e.IsNeedPushUpdate).HasDefaultValueSql("b'0'"); entity.Property(e => e.IsNeedPushUpdate).HasDefaultValueSql("b'0'");
...@@ -1416,6 +1423,10 @@ namespace JmpModel.Model.DataContext ...@@ -1416,6 +1423,10 @@ namespace JmpModel.Model.DataContext
{ {
entity.ToView("v_scrap_view"); entity.ToView("v_scrap_view");
entity.Property(e => e.IsContinueUse)
.HasDefaultValueSql("b'0'")
.HasComment("是否继续使用");
entity.Property(e => e.IsScrap) entity.Property(e => e.IsScrap)
.UseCollation("utf8mb4_general_ci") .UseCollation("utf8mb4_general_ci")
.HasCharSet("utf8mb4"); .HasCharSet("utf8mb4");
...@@ -1472,6 +1483,10 @@ namespace JmpModel.Model.DataContext ...@@ -1472,6 +1483,10 @@ namespace JmpModel.Model.DataContext
entity.Property(e => e.InventoryState).HasDefaultValueSql("'normal'"); entity.Property(e => e.InventoryState).HasDefaultValueSql("'normal'");
entity.Property(e => e.IsContinueUse)
.HasDefaultValueSql("b'0'")
.HasComment("是否继续使用");
entity.Property(e => e.IsMap).HasDefaultValueSql("'0'"); entity.Property(e => e.IsMap).HasDefaultValueSql("'0'");
entity.Property(e => e.Price).HasPrecision(12, 2); entity.Property(e => e.Price).HasPrecision(12, 2);
......
...@@ -15,6 +15,12 @@ namespace JmpModel.Model ...@@ -15,6 +15,12 @@ namespace JmpModel.Model
[Column("id")] [Column("id")]
[StringLength(36)] [StringLength(36)]
public string Id { get; set; } public string Id { get; set; }
/// <summary>
/// 是否继续使用
/// </summary>
[Required]
[Column("isContinueUse")]
public bool? IsContinueUse { get; set; }
[Column("epc")] [Column("epc")]
[StringLength(128)] [StringLength(128)]
public string Epc { get; set; } public string Epc { get; set; }
......
...@@ -78,5 +78,10 @@ namespace JmpModel.Model ...@@ -78,5 +78,10 @@ namespace JmpModel.Model
public int? SafeLevel { get; set; } public int? SafeLevel { get; set; }
[Column("is_map", TypeName = "smallint(6)")] [Column("is_map", TypeName = "smallint(6)")]
public short? IsMap { get; set; } public short? IsMap { get; set; }
/// <summary>
/// 是否继续使用
/// </summary>
[Column("is_continue_use")]
public bool? IsContinueUse { get; set; }
} }
} }
\ No newline at end of file
...@@ -1428,117 +1428,117 @@ namespace JunmpPoliceStation.Controllers ...@@ -1428,117 +1428,117 @@ namespace JunmpPoliceStation.Controllers
lock (BorrowSign) lock (BorrowSign)
{ {
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata); if (jdata != null)
if (entity == null)
{
return JsonManager.SimpleCustResponse($"model is null");
}
else if (string.IsNullOrEmpty(entity.id ?? ""))
{
return JsonManager.SimpleCustResponse($"id is require");
}
else if (string.IsNullOrEmpty(entity.orgId ?? ""))
{
return JsonManager.SimpleCustResponse($"orgId is require");
}
else
{ {
var id = (string)(entity.id); var entity = JsonManager.GetJsonEntity(jdata);
var flowState = (string)(entity.flowState).ToLower(); if (entity == null)
var orderInfo = _unitOfWork.DbContext.CommonJpBorrowReturnApplies.Include(p => p.ProcessCurrent).FirstOrDefault(t => t.Id == id);
if (orderInfo.ProcessCurrent.FlowState == "ture")
{ {
return JsonManager.SimpleStatusResponse(ResultCode.ORDER_OPERATE_ERROR); return JsonManager.SimpleCustResponse($"model is null");
} }
if (orderInfo == null) else if (string.IsNullOrEmpty(entity.id ?? ""))
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleCustResponse($"id is require");
}
else if (string.IsNullOrEmpty(entity.orgId ?? ""))
{
return JsonManager.SimpleCustResponse($"orgId is require");
} }
else else
{ {
bool processResult = _unitOfWork.CheckProcess(orderInfo.Id);
if (processResult) var id = (string)(entity.id);
var flowState = (string)(entity.flowState).ToLower();
var orderInfo = _unitOfWork.DbContext.CommonJpBorrowReturnApplies.Include(p => p.ProcessCurrent).FirstOrDefault(t => t.Id == id);
if (orderInfo.ProcessCurrent.FlowState == "ture")
{
return JsonManager.SimpleStatusResponse(ResultCode.ORDER_OPERATE_ERROR);
}
if (orderInfo == null)
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
else
{ {
bool processResult = _unitOfWork.CheckProcess(orderInfo.Id);
if (processResult)
{
_unitOfWork.ApproveMessage(orderInfo.Id); _unitOfWork.ApproveMessage(orderInfo.Id);
_unitOfWork.AuditProcess((string)entity.actionType, orderInfo.Id, (string)entity.userType, (string)entity.userInfo, (string)entity.dataScope, (string)entity.nextStepId, _unitOfWork.AuditProcess((string)entity.actionType, orderInfo.Id, (string)entity.userType, (string)entity.userInfo, (string)entity.dataScope, (string)entity.nextStepId,
(string)entity.currentStepName, flowState, (string)entity.approvalMsg, (string)entity.auditUser, (string)entity.auditUserName, "", "approve"); (string)entity.currentStepName, flowState, (string)entity.approvalMsg, (string)entity.auditUser, (string)entity.auditUserName, "", "approve");
orderInfo.ApprovalTime = DateTime.Now; orderInfo.ApprovalTime = DateTime.Now;
if (flowState.Equals("false")) if (flowState.Equals("false"))
{
orderInfo.ApprovalMsg = entity.approvalMsg;
}
else
{
List<CommonJpBorrowReturn> detailsList = new List<CommonJpBorrowReturn>();
CommonJpBorrowReturn borrowReturn = new CommonJpBorrowReturn();
borrowReturn.Id = Guid.NewGuid().ToString();
borrowReturn.ActionType = orderInfo.ActionType;
borrowReturn.WarehouseId = orderInfo.WarehouseId;
borrowReturn.OrderCode = orderInfo.OrderCode;
borrowReturn.CurrentState = (int)CurrentState.未出去;
borrowReturn.ApplyId = orderInfo.Id;
borrowReturn.OrgId = orderInfo.OrgId;
borrowReturn.CreateTime = DateTime.Now;
borrowReturn.CreateUser = entity.auditUser;
borrowReturn.IsWork = false;
var DetailEstimates = _unitOfWork.BorrowReturnDetailEstimateRepository.GetList(p => p.EstimateId.Equals(id));
foreach (var item in DetailEstimates)
{ {
//int.TryParse(item.quantity, out int qty); orderInfo.ApprovalMsg = entity.approvalMsg;
}
borrowReturn.CommonJpBorrowReturnDetailRealities.Add(new CommonJpBorrowReturnDetailReality() else
{
List<CommonJpBorrowReturn> detailsList = new List<CommonJpBorrowReturn>();
CommonJpBorrowReturn borrowReturn = new CommonJpBorrowReturn();
borrowReturn.Id = Guid.NewGuid().ToString();
borrowReturn.ActionType = orderInfo.ActionType;
borrowReturn.WarehouseId = orderInfo.WarehouseId;
borrowReturn.OrderCode = orderInfo.OrderCode;
borrowReturn.CurrentState = (int)CurrentState.未出去;
borrowReturn.ApplyId = orderInfo.Id;
borrowReturn.OrgId = orderInfo.OrgId;
borrowReturn.CreateTime = DateTime.Now;
borrowReturn.CreateUser = entity.auditUser;
borrowReturn.IsWork = false;
var DetailEstimates = _unitOfWork.BorrowReturnDetailEstimateRepository.GetList(p => p.EstimateId.Equals(id));
foreach (var item in DetailEstimates)
{ {
Id = Guid.NewGuid().ToString(), //int.TryParse(item.quantity, out int qty);
SizeId = item.SizeId,
EquipmentDetailId = item.EquipmentId,
RealityId = borrowReturn.Id,
State = (int)CurrentState.未出去,
EstimateId = id,
EquipmentCount = item.EquipmentCount,
SupplierId = item.SupplierId borrowReturn.CommonJpBorrowReturnDetailRealities.Add(new CommonJpBorrowReturnDetailReality()
{
Id = Guid.NewGuid().ToString(),
SizeId = item.SizeId,
EquipmentDetailId = item.EquipmentId,
RealityId = borrowReturn.Id,
State = (int)CurrentState.未出去,
EstimateId = id,
EquipmentCount = item.EquipmentCount,
}); SupplierId = item.SupplierId
//transferCom.CommonJpTransferDetailRealities = transferDetailsList;
});
//transferCom.CommonJpTransferDetailRealities = transferDetailsList;
detailsList.Add(borrowReturn);
}
detailsList.Add(borrowReturn);
}
orderInfo.CommonJpBorrowReturns = detailsList;
}
bool result = _unitOfWork.BorrowReturnApplyRepository.Update(orderInfo); orderInfo.CommonJpBorrowReturns = detailsList;
if (result) }
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS); bool result = _unitOfWork.BorrowReturnApplyRepository.Update(orderInfo);
if (result)
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
} }
else else
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.APPROVE_ERROR);
} }
} }
else
{
return JsonManager.SimpleStatusResponse(ResultCode.APPROVE_ERROR);
}
} }
} }
else
} {
else return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
{ }
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
} }
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -114,6 +114,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -114,6 +114,7 @@ namespace JunmpPoliceStation.Controllers
c.UpdateTime, c.UpdateTime,
c.UpdateUser, c.UpdateUser,
c.UnitType, c.UnitType,
c.AliasName,
supplierList = c.BaseJpSupplierEquipments.Select(t => new { t.SupplierCode }) supplierList = c.BaseJpSupplierEquipments.Select(t => new { t.SupplierCode })
} }
).ToList(); ).ToList();
...@@ -207,6 +208,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -207,6 +208,7 @@ namespace JunmpPoliceStation.Controllers
c.Id, c.Id,
c.Sort, c.Sort,
c.Name, c.Name,
c.AliasName,
c.EquipmentId, c.EquipmentId,
EquipmentName = c.Equipment?.Name, EquipmentName = c.Equipment?.Name,
c.Unit, c.Unit,
...@@ -323,6 +325,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -323,6 +325,7 @@ namespace JunmpPoliceStation.Controllers
c.Id, c.Id,
c.Sort, c.Sort,
c.Name, c.Name,
c.AliasName,
c.EquipmentId, c.EquipmentId,
c.Code, c.Code,
EquipmentName = c.Equipment?.Name, EquipmentName = c.Equipment?.Name,
...@@ -437,6 +440,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -437,6 +440,7 @@ namespace JunmpPoliceStation.Controllers
c.Id, c.Id,
c.Sort, c.Sort,
c.Name, c.Name,
c.AliasName,
c.EquipmentId, c.EquipmentId,
EquipmentName = c.Equipment?.Name, EquipmentName = c.Equipment?.Name,
c.Unit, c.Unit,
...@@ -522,7 +526,14 @@ namespace JunmpPoliceStation.Controllers ...@@ -522,7 +526,14 @@ namespace JunmpPoliceStation.Controllers
if (updateObject != null) if (updateObject != null)
{ {
updateObject.AliasName = entity.aliasName; updateObject.AliasName = entity.aliasName;
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS); if (_unitOfWork.EquipmentDetailRepository.Update(updateObject))
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
} }
else else
{ {
......
...@@ -1562,11 +1562,11 @@ namespace JunmpPoliceStation.Controllers ...@@ -1562,11 +1562,11 @@ namespace JunmpPoliceStation.Controllers
// && t.WarehouseCode != warehouseId // && t.WarehouseCode != warehouseId
// &&(t.CurrentState==0) // &&(t.CurrentState==0)
// && (t.LostFlag == false || t.LostFlag == null)).ToList(); // && (t.LostFlag == false || t.LostFlag == null)).ToList();
if (wz_info.Count() <= 0) //if (wz_info.Count() <= 0)
{ //{
return JsonManager.SimpleCustResponse("未找到物资信息"); // return JsonManager.SimpleCustResponse("未找到物资信息");
} //}
else //else
{ {
var newList = wz_info.Select(t => new var newList = wz_info.Select(t => new
{ {
...@@ -2933,7 +2933,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -2933,7 +2933,7 @@ namespace JunmpPoliceStation.Controllers
string orderNo = entity.orderNo; string orderNo = entity.orderNo;
string type = entity.type; string type = entity.type;
string orgId = entity.orgId; string orgId = entity.orgId;
string policeId = entity.policeId; string policeId = string.IsNullOrEmpty(entity.policeId) ? null : entity.policeId;
string warehouseId = entity.warehouseId; string warehouseId = entity.warehouseId;
string outInState = entity.outInState; string outInState = entity.outInState;
...@@ -3194,51 +3194,149 @@ namespace JunmpPoliceStation.Controllers ...@@ -3194,51 +3194,149 @@ namespace JunmpPoliceStation.Controllers
} }
//#endregion //#endregion
var resultEpc = UpdateEpc?.Select(p => new //提取所有上下文跟踪出入库信息
{ var newInvStateList = _unitOfWork.DbContext.ChangeTracker.Entries()
p.Epc, .Where(x => x.Entity is CommonJpEquipmentState)
p.CurrentState .Select(x => x.Entity as CommonJpEquipmentState)
}).ToList();//更新的库存信息 .ToList();
var resultInsertEpc = InsertEpc?.Select(p => new
foreach (var newInvState in newInvStateList)
{ {
p.Epc, newInvState.PoliceId = string.IsNullOrEmpty(entity.policeId) ? null : newInvState.PoliceId;
p.CurrentState }
}).ToList();//新增的库存信息
var resultErrorEpc = ErrorEq?.Select(p => new using (var scope = _unitOfWork.BeginTransaction())
{ {
Epc = p, try
CurrentState = 11 {
}).ToList();//不在该仓库的物资信息 var resultEpc = UpdateEpc?.Select(p => new
{
p.Epc,
p.CurrentState
}).ToList();//更新的库存信息
var resultInsertEpc = InsertEpc?.Select(p => new
{
p.Epc,
p.CurrentState
}).ToList();//新增的库存信息
var resultErrorEpc = ErrorEq?.Select(p => new
{
Epc = p,
CurrentState = 11
}).ToList();//不在该仓库的物资信息
resultEpc.AddRange(resultInsertEpc); resultEpc.AddRange(resultInsertEpc);
resultEpc.AddRange(resultErrorEpc); resultEpc.AddRange(resultErrorEpc);
//跨仓库出库业务清空存放位置(只有update.currentState=1:调拨中 8:领用中 15跨仓库借用中 17跨仓库归还中) //跨仓库出库业务清空存放位置(只有update.currentState=1:调拨中 8:领用中 15跨仓库借用中 17跨仓库归还中)
if (outInState.Equals("出库")) if (outInState.Equals("出库"))
{ {
foreach (var inventory in UpdateEpc.Where(x => new[] { 1, 8, 15, 17 }.Contains(x.CurrentState))) foreach (var inventory in UpdateEpc.Where(x => new[] { 1, 8, 15, 17 }.Contains(x.CurrentState)))
{ {
inventory.ShelfId = null; inventory.ShelfId = null;
inventory.ShelfRange = null; inventory.ShelfRange = null;
inventory.ShelfRow = null; inventory.ShelfRow = null;
inventory.ShelfColumn = null; inventory.ShelfColumn = null;
} }
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc); _unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc);
} }
//计算阈值 //上报数据
var sizeList = InsertEpc.Select(x => x.EquipmentSizecode).ToList(); var pushData = new List<object>();
sizeList.AddRange(UpdateEpc.Select(x => x.EquipmentSizecode).ToList()); pushData.AddRange(InsertEpc.Select(x => new
_unitOfWork.CalcThreshold(sizeList.Distinct().ToList(), orgId, warehouseId); {
editType = "ADD",
id = x.Id,
supplierCode = x.SupplierCode,
epc = x.Epc,
policeCode = x.PoliceCode,
equipmentCode = x.EquipmentCode,
warehouseCode = x.WarehouseCode,
cabinetId = x.CabinetId,
equipmentSizecode = x.EquipmentSizecode,
equipmentLocation = x.EquipmentLocation,
currentState = x.CurrentState,
createTime = x.CreateTime,
warrantyCycle = x.WarrantyCycle,
repairCycle = x.RepairCycle,
productTime = x.ProductTime,
useTime = x.UseTime,
price = x.Price,
isBorrowed = x.IsBorrowed,
lostFlag = x.LostFlag,
inventoryState = x.InventoryState,
isInBox = x.IsInBox,
boxMarkId = x.BoxMarkId,
instantiationState = x.InstantiationState,
}));
pushData.AddRange(UpdateEpc.Select(x => new
{
editType = "UPDATE",
id = x.Id,
supplierCode = x.SupplierCode,
epc = x.Epc,
policeCode = x.PoliceCode,
equipmentCode = x.EquipmentCode,
warehouseCode = x.WarehouseCode,
cabinetId = x.CabinetId,
equipmentSizecode = x.EquipmentSizecode,
equipmentLocation = x.EquipmentLocation,
currentState = x.CurrentState,
createTime = x.CreateTime,
warrantyCycle = x.WarrantyCycle,
repairCycle = x.RepairCycle,
productTime = x.ProductTime,
useTime = x.UseTime,
price = x.Price,
isBorrowed = x.IsBorrowed,
lostFlag = x.LostFlag,
inventoryState = x.InventoryState,
isInBox = x.IsInBox,
boxMarkId = x.BoxMarkId,
instantiationState = x.InstantiationState,
}));
var httpResult = _httpHelper.GetHtml(new HttpItem()
{
URL = _httpHelper._centerServerAddress + "/api/Print/EditInventory",
Encoding = Encoding.UTF8,
Method = "POST",
ContentType = "application/json",
Timeout = 5000,
Postdata = _httpHelper.CreatePostData(JsonConvert.SerializeObject(new
{
data = pushData
}))
});
if (httpResult.StatusCode != HttpStatusCode.OK || string.IsNullOrEmpty(httpResult.Html))
{
scope.Rollback();
return JsonManager.SimpleCustResponse("远端上报数据失败");
}
var obj = JsonConvert.DeserializeObject<JmpBaseResponse<object>>(httpResult.Html);
if (obj.code != "10000")
{
scope.Rollback();
return JsonManager.SimpleCustResponse(obj.msg);
}
scope.Commit();
//计算阈值
var sizeList = InsertEpc.Select(x => x.EquipmentSizecode).ToList();
sizeList.AddRange(UpdateEpc.Select(x => x.EquipmentSizecode).ToList());
_unitOfWork.CalcThreshold(sizeList.Distinct().ToList(), orgId, warehouseId);
return JsonManager.ReturnSuccessResponse(resultEpc); return JsonManager.ReturnSuccessResponse(resultEpc);
}
catch (Exception e)
{
scope.Rollback();
throw;
}
}
} }
else else
{ {
......
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
...@@ -207,6 +208,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -207,6 +208,7 @@ namespace JunmpPoliceStation.Controllers
/// "days":7, /// "days":7,
/// "scrap":true, /// "scrap":true,
/// "position":"全部 仓库 库外 单警柜", /// "position":"全部 仓库 库外 单警柜",
/// "isContinueUse":"是否继续使用 true",
/// } /// }
/// </remarks> /// </remarks>
[HttpPost("GetTreeScrapMsg")] [HttpPost("GetTreeScrapMsg")]
...@@ -227,6 +229,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -227,6 +229,7 @@ namespace JunmpPoliceStation.Controllers
DateTime startTime = default; DateTime startTime = default;
DateTime endTime = default; DateTime endTime = default;
bool.TryParse(entity?.scrap ?? "false", out bool scrap); bool.TryParse(entity?.scrap ?? "false", out bool scrap);
bool.TryParse(entity?.isContinueUse ?? "false", out bool isContinueUse);
if (string.IsNullOrEmpty(orgId)) if (string.IsNullOrEmpty(orgId))
{ {
return JsonManager.SimpleCustResponse("orgId is require"); return JsonManager.SimpleCustResponse("orgId is require");
...@@ -283,6 +286,9 @@ namespace JunmpPoliceStation.Controllers ...@@ -283,6 +286,9 @@ namespace JunmpPoliceStation.Controllers
} }
} }
//继续使用
expression = expression.AndAlso(x => x.IsContinueUse == isContinueUse);
var scrapList = _unitOfWork.ScrapViewRepository.GetPage(expression, "WarrantyTime", 0, 999999); var scrapList = _unitOfWork.ScrapViewRepository.GetPage(expression, "WarrantyTime", 0, 999999);
var data = scrapList.content var data = scrapList.content
.GroupBy(x => new { x.WarehouseName, x.WarehouseId, x.EquName, x.SizeName }) .GroupBy(x => new { x.WarehouseName, x.WarehouseId, x.EquName, x.SizeName })
...@@ -296,6 +302,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -296,6 +302,7 @@ namespace JunmpPoliceStation.Controllers
children = s.Select(y => new children = s.Select(y => new
{ {
id = y.Id, id = y.Id,
equId = y.EquId,
epc = y.Epc, epc = y.Epc,
sizeId = y.SizeId, sizeId = y.SizeId,
sizeName = y.SizeName, sizeName = y.SizeName,
...@@ -335,6 +342,74 @@ namespace JunmpPoliceStation.Controllers ...@@ -335,6 +342,74 @@ namespace JunmpPoliceStation.Controllers
} }
/// <summary> /// <summary>
/// 更新是否继续使用状态
/// </summary>
/// <param name="jdata"></param>
/// <returns></returns>
/// <remarks>
///
/// ## 例子
/// {
/// "isContinueUse":"是否继续使用 true",
/// "detailList":[
/// {
/// "id":"装备id"
/// }]
/// }
///
/// </remarks>
[HttpPost("UpdateEquIsContinueUse")]
public async Task<HttpResponseMessage> UpdateEquIsContinueUse([FromBody] JObject jdata)
{
return await Task.Run(() =>
{
try
{
if (jdata != null)
{
var entity = JsonManager.GetJsonEntity(jdata);
var idList = new List<string>();
if (entity.detailList is IEnumerable)
{
foreach (var obj in entity.detailList)
{
idList.Add(obj.id);
}
}
if (!bool.TryParse(entity?.isContinueUse, out bool isContinueUse))
{
return JsonManager.SimpleCustResponse("isContinueUse is require");
}
var invList = _unitOfWork.EquipmentInventoryRepository.GetList(x => idList.Contains(x.Id)).ToList();
foreach (var inv in invList)
{
inv.IsContinueUse = isContinueUse;
}
if (_unitOfWork.EquipmentInventoryRepository.Update(invList))
{
return JsonManager.ReturnSuccessResponse(ResultCode.OPERATE_SUCCESS);
}
else
{
return JsonManager.ReturnSuccessResponse(ResultCode.OPERATE_FAILED);
}
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
}
catch (Exception ex)
{
return JsonManager.SimpleCustResponse(ex.ToString());
}
});
}
/// <summary>
/// 获取借用超期明细 /// 获取借用超期明细
/// </summary> /// </summary>
/// <param name="jdata"></param> /// <param name="jdata"></param>
......
...@@ -223,7 +223,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -223,7 +223,7 @@ namespace JunmpPoliceStation.Controllers
//即将报废 //即将报废
jjbfCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && c.SafeLevel.Equals(1) && !c.CurrentState.Equals(6)).Count(); jjbfCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && c.SafeLevel.Equals(1) && !c.CurrentState.Equals(6)).Count();
//已超期未报废 //已超期未报废
ycqCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && c.SafeLevel.Equals(2) && !c.CurrentState.Equals(6)).Count(); ycqCount = ViewEquipmentList.Where(c => c.ParentName.Equals(parentName) && c.SafeLevel.Equals(2) && !c.CurrentState.Equals(6) && c.IsContinueUse != true).Count();
//超期未还 //超期未还
cqwhCount = Convert.ToInt32(_unitOfWork.BorrowViewRepository.Count(x => cqwhCount = Convert.ToInt32(_unitOfWork.BorrowViewRepository.Count(x =>
...@@ -244,7 +244,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -244,7 +244,7 @@ namespace JunmpPoliceStation.Controllers
//即将报废 //即将报废
jjbfCount = ViewEquipmentList.Where(c => c.SafeLevel.Equals(1) && !c.CurrentState.Equals(6)).Count(); jjbfCount = ViewEquipmentList.Where(c => c.SafeLevel.Equals(1) && !c.CurrentState.Equals(6)).Count();
//已超期未报废 //已超期未报废
ycqCount = ViewEquipmentList.Where(c => c.SafeLevel.Equals(2) && !c.CurrentState.Equals(6)).Count(); ycqCount = ViewEquipmentList.Where(c => c.SafeLevel.Equals(2) && !c.CurrentState.Equals(6) && c.IsContinueUse != true).Count();
//超期未还 //超期未还
cqwhCount = Convert.ToInt32(_unitOfWork.BorrowViewRepository.Count(x => cqwhCount = Convert.ToInt32(_unitOfWork.BorrowViewRepository.Count(x =>
...@@ -1329,7 +1329,7 @@ namespace JunmpPoliceStation.Controllers ...@@ -1329,7 +1329,7 @@ namespace JunmpPoliceStation.Controllers
}).ToList(); }).ToList();
var data = groupData.GroupBy(t => new { t.id, t.PoliceCode, t.Name }).Where(c=>!string.IsNullOrEmpty(c.Key.id)).Select(c => new var data = groupData.GroupBy(t => new { t.id, t.PoliceCode, t.Name }).Where(c => !string.IsNullOrEmpty(c.Key.id)).Select(c => new
{ {
c.Key.id, c.Key.id,
c.Key.PoliceCode, c.Key.PoliceCode,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论