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);
|
||||
|
||||
|
||||
@@ -1318,6 +1318,9 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
deductNum = deductNum - (detail.num - detail.use_num);
|
||||
|
||||
if (deductNum <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (deductNum > 0)
|
||||
@@ -1329,9 +1332,9 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
foreach (var detail in details)
|
||||
{
|
||||
db.Updateable<PrdFeedingD>().SetColumns(x => x.use_num == x.num)
|
||||
await db.Updateable<PrdFeedingD>().SetColumns(x => x.use_num == x.num)
|
||||
.SetColumns(x=>x.status=="2")
|
||||
.Where(x => x.id == detail.id);
|
||||
.Where(x => x.id == detail.id).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1341,6 +1344,10 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//throw new Exception("无投入物料");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,6 +147,15 @@ namespace Tnb.ProductionMgr
|
||||
nsChild[i].process_id = $"{items[i].process_code}/{items[i].process_name}";
|
||||
nsChild[i].plan_start_date = items[i].estimated_start_date.HasValue ? items[i].estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
|
||||
nsChild[i].plan_end_date = items[i].estimated_end_date.HasValue ? items[i].estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
|
||||
|
||||
if (nsChild[i].workline_id.IsNotEmptyOrNull())
|
||||
{
|
||||
var workLine = _dicWorkLine.ContainsKey(nsChild[i].workline_id) ? (Tuple<string, string>)_dicWorkLine[nsChild[i].workline_id] : null;
|
||||
if (workLine != null)
|
||||
{
|
||||
nsChild[i].workline_id = $"{workLine.Item1}/{workLine.Item2}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nodes.AddRange(nsChild);
|
||||
|
||||
Reference in New Issue
Block a user