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
...@@ -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,10 +526,17 @@ namespace JunmpPoliceStation.Controllers ...@@ -522,10 +526,17 @@ namespace JunmpPoliceStation.Controllers
if (updateObject != null) if (updateObject != null)
{ {
updateObject.AliasName = entity.aliasName; updateObject.AliasName = entity.aliasName;
if (_unitOfWork.EquipmentDetailRepository.Update(updateObject))
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS); return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
} }
else else
{ {
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
} }
} }
......
...@@ -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,11 +3194,23 @@ namespace JunmpPoliceStation.Controllers ...@@ -3194,11 +3194,23 @@ namespace JunmpPoliceStation.Controllers
} }
//#endregion
//提取所有上下文跟踪出入库信息
var newInvStateList = _unitOfWork.DbContext.ChangeTracker.Entries()
.Where(x => x.Entity is CommonJpEquipmentState)
.Select(x => x.Entity as CommonJpEquipmentState)
.ToList();
foreach (var newInvState in newInvStateList)
{
newInvState.PoliceId = string.IsNullOrEmpty(entity.policeId) ? null : newInvState.PoliceId;
}
//#endregion using (var scope = _unitOfWork.BeginTransaction())
{
try
{
var resultEpc = UpdateEpc?.Select(p => new var resultEpc = UpdateEpc?.Select(p => new
{ {
p.Epc, p.Epc,
...@@ -3232,14 +3244,100 @@ namespace JunmpPoliceStation.Controllers ...@@ -3232,14 +3244,100 @@ namespace JunmpPoliceStation.Controllers
_unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc); _unitOfWork.EquipmentInventoryRepository.Update(UpdateEpc);
} }
//上报数据
var pushData = new List<object>();
pushData.AddRange(InsertEpc.Select(x => new
{
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(); var sizeList = InsertEpc.Select(x => x.EquipmentSizecode).ToList();
sizeList.AddRange(UpdateEpc.Select(x => x.EquipmentSizecode).ToList()); sizeList.AddRange(UpdateEpc.Select(x => x.EquipmentSizecode).ToList());
_unitOfWork.CalcThreshold(sizeList.Distinct().ToList(), orgId, warehouseId); _unitOfWork.CalcThreshold(sizeList.Distinct().ToList(), orgId, warehouseId);
return JsonManager.ReturnSuccessResponse(resultEpc); return JsonManager.ReturnSuccessResponse(resultEpc);
} }
catch (Exception e)
{
scope.Rollback();
throw;
}
}
}
else else
{ {
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR); return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
......
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论