Commit 5c9dc64a by zxw

1222 部署

parent 8278dcff
......@@ -135,6 +135,12 @@ namespace JmpModel.Model
public string BagInventoryId { get; set; }
[Column("is_need_push_update")]
public bool? IsNeedPushUpdate { get; set; }
/// <summary>
/// 是否继续使用
/// </summary>
[Required]
[Column("is_continue_use")]
public bool? IsContinueUse { get; set; }
[ForeignKey(nameof(BagInventoryId))]
[InverseProperty(nameof(CommonJpBagInventory.CommonJpEquipmentInventories))]
......
......@@ -392,6 +392,7 @@ namespace JmpModel.Model.DataContext
entity.HasOne(d => d.Apply)
.WithMany(p => p.CommonJpBorrowReturns)
.HasForeignKey(d => d.ApplyId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_borrow_return_ibfk_6");
entity.HasOne(d => d.Org)
......@@ -449,6 +450,7 @@ namespace JmpModel.Model.DataContext
entity.HasOne(d => d.Estimate)
.WithMany(p => p.CommonJpBorrowReturnDetailEstimates)
.HasForeignKey(d => d.EstimateId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_borrow_return_detail_estimate_ibfk_5");
entity.HasOne(d => d.Size)
......@@ -478,6 +480,7 @@ namespace JmpModel.Model.DataContext
entity.HasOne(d => d.Estimate)
.WithMany(p => p.CommonJpBorrowReturnDetailRealities)
.HasForeignKey(d => d.EstimateId)
.OnDelete(DeleteBehavior.Cascade)
.HasConstraintName("common_jp_borrow_return_detail_reality_ibfk_7");
entity.HasOne(d => d.Reality)
......@@ -609,6 +612,10 @@ namespace JmpModel.Model.DataContext
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.IsNeedPushUpdate).HasDefaultValueSql("b'0'");
......@@ -1416,6 +1423,10 @@ namespace JmpModel.Model.DataContext
{
entity.ToView("v_scrap_view");
entity.Property(e => e.IsContinueUse)
.HasDefaultValueSql("b'0'")
.HasComment("是否继续使用");
entity.Property(e => e.IsScrap)
.UseCollation("utf8mb4_general_ci")
.HasCharSet("utf8mb4");
......@@ -1472,6 +1483,10 @@ namespace JmpModel.Model.DataContext
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.Price).HasPrecision(12, 2);
......
......@@ -15,6 +15,12 @@ namespace JmpModel.Model
[Column("id")]
[StringLength(36)]
public string Id { get; set; }
/// <summary>
/// 是否继续使用
/// </summary>
[Required]
[Column("isContinueUse")]
public bool? IsContinueUse { get; set; }
[Column("epc")]
[StringLength(128)]
public string Epc { get; set; }
......
......@@ -78,5 +78,10 @@ namespace JmpModel.Model
public int? SafeLevel { get; set; }
[Column("is_map", TypeName = "smallint(6)")]
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
c.UpdateTime,
c.UpdateUser,
c.UnitType,
c.AliasName,
supplierList = c.BaseJpSupplierEquipments.Select(t => new { t.SupplierCode })
}
).ToList();
......@@ -207,6 +208,7 @@ namespace JunmpPoliceStation.Controllers
c.Id,
c.Sort,
c.Name,
c.AliasName,
c.EquipmentId,
EquipmentName = c.Equipment?.Name,
c.Unit,
......@@ -323,6 +325,7 @@ namespace JunmpPoliceStation.Controllers
c.Id,
c.Sort,
c.Name,
c.AliasName,
c.EquipmentId,
c.Code,
EquipmentName = c.Equipment?.Name,
......@@ -437,6 +440,7 @@ namespace JunmpPoliceStation.Controllers
c.Id,
c.Sort,
c.Name,
c.AliasName,
c.EquipmentId,
EquipmentName = c.Equipment?.Name,
c.Unit,
......@@ -522,10 +526,17 @@ namespace JunmpPoliceStation.Controllers
if (updateObject != null)
{
updateObject.AliasName = entity.aliasName;
if (_unitOfWork.EquipmentDetailRepository.Update(updateObject))
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_SUCCESS);
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.OPERATE_FAILED);
}
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
}
}
......
......@@ -1562,11 +1562,11 @@ namespace JunmpPoliceStation.Controllers
// && t.WarehouseCode != warehouseId
// &&(t.CurrentState==0)
// && (t.LostFlag == false || t.LostFlag == null)).ToList();
if (wz_info.Count() <= 0)
{
return JsonManager.SimpleCustResponse("未找到物资信息");
}
else
//if (wz_info.Count() <= 0)
//{
// return JsonManager.SimpleCustResponse("未找到物资信息");
//}
//else
{
var newList = wz_info.Select(t => new
{
......@@ -2933,7 +2933,7 @@ namespace JunmpPoliceStation.Controllers
string orderNo = entity.orderNo;
string type = entity.type;
string orgId = entity.orgId;
string policeId = entity.policeId;
string policeId = string.IsNullOrEmpty(entity.policeId) ? null : entity.policeId;
string warehouseId = entity.warehouseId;
string outInState = entity.outInState;
......@@ -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
{
p.Epc,
......@@ -3232,14 +3244,100 @@ namespace JunmpPoliceStation.Controllers
_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();
sizeList.AddRange(UpdateEpc.Select(x => x.EquipmentSizecode).ToList());
_unitOfWork.CalcThreshold(sizeList.Distinct().ToList(), orgId, warehouseId);
return JsonManager.ReturnSuccessResponse(resultEpc);
}
catch (Exception e)
{
scope.Rollback();
throw;
}
}
}
else
{
return JsonManager.SimpleStatusResponse(ResultCode.REQUEST_DATA_ERROR);
......
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
......@@ -207,6 +208,7 @@ namespace JunmpPoliceStation.Controllers
/// "days":7,
/// "scrap":true,
/// "position":"全部 仓库 库外 单警柜",
/// "isContinueUse":"是否继续使用 true",
/// }
/// </remarks>
[HttpPost("GetTreeScrapMsg")]
......@@ -227,6 +229,7 @@ namespace JunmpPoliceStation.Controllers
DateTime startTime = default;
DateTime endTime = default;
bool.TryParse(entity?.scrap ?? "false", out bool scrap);
bool.TryParse(entity?.isContinueUse ?? "false", out bool isContinueUse);
if (string.IsNullOrEmpty(orgId))
{
return JsonManager.SimpleCustResponse("orgId is require");
......@@ -283,6 +286,9 @@ namespace JunmpPoliceStation.Controllers
}
}
//继续使用
expression = expression.AndAlso(x => x.IsContinueUse == isContinueUse);
var scrapList = _unitOfWork.ScrapViewRepository.GetPage(expression, "WarrantyTime", 0, 999999);
var data = scrapList.content
.GroupBy(x => new { x.WarehouseName, x.WarehouseId, x.EquName, x.SizeName })
......@@ -296,6 +302,7 @@ namespace JunmpPoliceStation.Controllers
children = s.Select(y => new
{
id = y.Id,
equId = y.EquId,
epc = y.Epc,
sizeId = y.SizeId,
sizeName = y.SizeName,
......@@ -335,6 +342,74 @@ namespace JunmpPoliceStation.Controllers
}
/// <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>
/// <param name="jdata"></param>
......
......@@ -223,7 +223,7 @@ namespace JunmpPoliceStation.Controllers
//即将报废
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 =>
......@@ -244,7 +244,7 @@ namespace JunmpPoliceStation.Controllers
//即将报废
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 =>
......@@ -1329,7 +1329,7 @@ namespace JunmpPoliceStation.Controllers
}).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.PoliceCode,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论