bug,异常停机添加报修申请
This commit is contained in:
@@ -14,6 +14,7 @@ using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
@@ -40,6 +41,7 @@ namespace Tnb.ProductionMgr
|
||||
private readonly IToolMoldsService _moldService;
|
||||
private readonly IPrdMoTaskService _prdMoTaskService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
|
||||
private static Dictionary<string, object> _dicWorkStationAndShopRelacion = new Dictionary<string, object>();
|
||||
private static Dictionary<string, object> _dicWorkShop = new Dictionary<string, object>();
|
||||
@@ -51,6 +53,7 @@ namespace Tnb.ProductionMgr
|
||||
IPrdMoTaskService prdMoTaskService,
|
||||
IToolMoldsService moldsService,
|
||||
IToolMoldMaintainTaskService maintainTaskService,
|
||||
IBillRullService billRullService,
|
||||
IUserManager userManager
|
||||
)
|
||||
{
|
||||
@@ -58,6 +61,7 @@ namespace Tnb.ProductionMgr
|
||||
_maintainTaskService = maintainTaskService;
|
||||
_moldService = moldsService;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
_db = repository.AsSugarClient();
|
||||
}
|
||||
/// <summary>
|
||||
@@ -226,6 +230,30 @@ namespace Tnb.ProductionMgr
|
||||
await _maintainTaskService.Create(maintaindTask);
|
||||
}
|
||||
|
||||
string reason = "";
|
||||
if (!string.IsNullOrEmpty(input.reason))
|
||||
{
|
||||
List<PrdCancelClosedownReason> prdCancelClosedownReasons = await _db.Queryable<PrdCancelClosedownReason>().ToListAsync();
|
||||
string[] reasonArr = input.reason.Split(",");
|
||||
var reasonList = prdCancelClosedownReasons.Where(x => reasonArr.Contains(x.id)).Select(x => x.reason).ToList();
|
||||
reason = string.Join(',', reasonList);
|
||||
|
||||
}
|
||||
string code = await _billRullService.GetBillNumber("EqpRepair");
|
||||
EqpRepairApply eqpRepairApply = new EqpRepairApply()
|
||||
{
|
||||
code = code,
|
||||
name = eqp.name + "停机",
|
||||
equip_id = input.eqp_id,
|
||||
status = Tnb.EquipMgr.RepairApplyStatus.TOBEEXECUTED,
|
||||
description = reason,
|
||||
create_id = _userManager.UserId,
|
||||
create_time = DateTime.Now,
|
||||
remark = input.remark,
|
||||
};
|
||||
|
||||
await _db.Insertable(eqpRepairApply).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
else throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user