首末巡检自动自检报废 设备相关报表
This commit is contained in:
@@ -323,6 +323,10 @@ public static class DictConst
|
||||
/// 设备生命周期
|
||||
/// </summary>
|
||||
public const string EquipmentLife = "EquipmentLife";
|
||||
/// <summary>
|
||||
/// 设备故障类型
|
||||
/// </summary>
|
||||
public const string FaultType = "FaultType";
|
||||
|
||||
#endregion
|
||||
}
|
||||
13
EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpFaultReportOutput.cs
Normal file
13
EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpFaultReportOutput.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EqpFaultReportOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string fault_name { get; set; }
|
||||
public string fault_type_name { get; set; }
|
||||
public string equip_type_name { get; set; }
|
||||
public string month { get; set; }
|
||||
public int count { get; set; }
|
||||
public decimal? repair_take_time { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EqpMaintainReportOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string workshop_name { get; set; }
|
||||
public string month { get; set; }
|
||||
public int execute_num { get; set; }
|
||||
public int unqualified_num { get; set; }
|
||||
}
|
||||
}
|
||||
13
EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpRepairReportOutput.cs
Normal file
13
EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpRepairReportOutput.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EqpRepairReportOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string workshop_name { get; set; }
|
||||
public string month { get; set; }
|
||||
public int fault_num { get; set; }
|
||||
public int repair_completed_num { get; set; }
|
||||
}
|
||||
}
|
||||
81
EquipMgr/Tnb.EquipMgr/EqpFaultReportService.cs
Normal file
81
EquipMgr/Tnb.EquipMgr/EqpFaultReportService.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备故障统计报表
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class EqpFaultReportService: IOverideVisualDevService,IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "27897732990485";
|
||||
private readonly ISqlSugarRepository<EqpEquipment> _repository;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public EqpFaultReportService(ISqlSugarRepository<EqpEquipment> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IBillRullService billRuleService,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
_billRuleService = billRuleService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
|
||||
string month = queryJson != null && queryJson.ContainsKey("month") ? queryJson["month"].ToString() : "";
|
||||
string name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string userId = _userManager.UserId;
|
||||
month = !string.IsNullOrEmpty(month) ? month : DateTime.Now.ToString("yyyy-MM");
|
||||
SqlSugarPagedList<EqpFaultReportOutput> result = await db.Queryable<EqpEquipType>()
|
||||
.LeftJoin<EqpFault>((a,b)=>1==1)
|
||||
.LeftJoin<DictionaryTypeEntity>((a,b,c)=>c.EnCode==DictConst.FaultType)
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d)=>c.Id==d.DictionaryTypeId && b.fault_type_id==d.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty("name"), (a, b) => b.fault_name.Contains(name))
|
||||
.OrderBy((a,b,c,d)=>a.name)
|
||||
.OrderBy((a,b,c,d)=>b.fault_name)
|
||||
.OrderBy((a,b,c,d)=>d.FullName)
|
||||
.Select((a, b,c,d) => new EqpFaultReportOutput
|
||||
{
|
||||
id = a.id,
|
||||
month = month,
|
||||
fault_name = b.fault_name,
|
||||
fault_type_name = d.FullName,
|
||||
equip_type_name = a.name,
|
||||
count = SqlFunc.Subqueryable<EqpEquipment>().InnerJoin<EqpRepairApply>((x,y)=>x.id==y.equip_id).Where((x,y)=>x.equip_type_id==a.id && y.create_time.Value.ToString("yyyy-MM")==month).Count(),
|
||||
repair_take_time = SqlFunc.Subqueryable<EqpEquipment>().InnerJoin<EqpRepairApply>((x,y)=>x.id==y.equip_id).Where((x,y)=>x.equip_type_id==a.id && y.create_time.Value.ToString("yyyy-MM")==month).Sum((x,y)=>SqlFunc.IsNull(y.repair_take_time,0))
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EqpFaultReportOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
76
EquipMgr/Tnb.EquipMgr/EqpMaintainReportService.cs
Normal file
76
EquipMgr/Tnb.EquipMgr/EqpMaintainReportService.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备保养统计报表
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class EqpMaintainReportService: IOverideVisualDevService,IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "27897660420117";
|
||||
private readonly ISqlSugarRepository<EqpEquipment> _repository;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public EqpMaintainReportService(ISqlSugarRepository<EqpEquipment> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IBillRullService billRuleService,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
_billRuleService = billRuleService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
|
||||
string month = queryJson != null && queryJson.ContainsKey("month") ? queryJson["month"].ToString() : "";
|
||||
string name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string userId = _userManager.UserId;
|
||||
month = !string.IsNullOrEmpty(month) ? month : DateTime.Now.ToString("yyyy-MM");
|
||||
SqlSugarPagedList<EqpMaintainReportOutput> result = await db.Queryable<EqpEquipment>()
|
||||
.LeftJoin<OrganizeEntity>((a,b)=>a.use_department_id==b.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty("name"), (a, b) => a.name.Contains(name))
|
||||
.OrderBy((a,b)=>a.code)
|
||||
.Select((a, b) => new EqpMaintainReportOutput
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
workshop_name = b.FullName,
|
||||
month = month,
|
||||
execute_num = SqlFunc.Subqueryable<EqpMaintainRecordH>().Where(x=>x.equip_id==a.id && x.status!="1" && x.create_time.Value.ToString("yyyy-MM")==month).Count(),
|
||||
unqualified_num = SqlFunc.Subqueryable<EqpMaintainRecordH>().Where(x=>x.equip_id==a.id && (x.repeat_result=="2" || (x.result=="2" && x.repeat_result==null)) && x.create_time.Value.ToString("yyyy-MM")==month).Count(),
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EqpMaintainReportOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
76
EquipMgr/Tnb.EquipMgr/EqpRepairReportService.cs
Normal file
76
EquipMgr/Tnb.EquipMgr/EqpRepairReportService.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备维修统计报表
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class EqpRepairReportService: IOverideVisualDevService,IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "27897802470421";
|
||||
private readonly ISqlSugarRepository<EqpEquipment> _repository;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public EqpRepairReportService(ISqlSugarRepository<EqpEquipment> repository,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService,
|
||||
IBillRullService billRuleService,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
_billRuleService = billRuleService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
|
||||
string month = queryJson != null && queryJson.ContainsKey("month") ? queryJson["month"].ToString() : "";
|
||||
string name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string userId = _userManager.UserId;
|
||||
month = !string.IsNullOrEmpty(month) ? month : DateTime.Now.ToString("yyyy-MM");
|
||||
SqlSugarPagedList<EqpRepairReportOutput> result = await db.Queryable<EqpEquipment>()
|
||||
.LeftJoin<OrganizeEntity>((a,b)=>a.use_department_id==b.Id)
|
||||
.WhereIF(!string.IsNullOrEmpty("name"), (a, b) => a.name.Contains(name))
|
||||
.OrderBy((a,b)=>a.code)
|
||||
.Select((a, b) => new EqpRepairReportOutput
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
workshop_name = b.FullName,
|
||||
month = month,
|
||||
fault_num = SqlFunc.Subqueryable<EqpRepairApply>().Where(x=>x.equip_id==a.id && x.status!=null && x.create_time.Value.ToString("yyyy-MM")==month).Count(),
|
||||
repair_completed_num = SqlFunc.Subqueryable<EqpRepairApply>().Where(x=>x.equip_id==a.id && x.status=="6" && x.create_time.Value.ToString("yyyy-MM")==month).Count(),
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EqpRepairReportOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,5 +74,7 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<dynamic> PrdTaskRelease2(PrdTaskReleaseUpInput input, ISqlSugarClient db = null);
|
||||
|
||||
public Task<dynamic> SelfTestScrapped2(SelfTestScrappedInput input, ISqlSugarClient db = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,36 +60,74 @@ namespace Tnb.ProductionMgr
|
||||
List<ErpExtendField> extendFieldList = new List<ErpExtendField>();
|
||||
foreach (var item in input)
|
||||
{
|
||||
if(string.IsNullOrEmpty(item.mo_code))
|
||||
if (string.IsNullOrEmpty(item.mo_code))
|
||||
{
|
||||
Log.Error("【SavePrdMo】工单代码不能为空");
|
||||
throw Oops.Bah("工单代码不能为空");
|
||||
if(string.IsNullOrEmpty(item.mo_type))
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.mo_type))
|
||||
{
|
||||
Log.Error("【SavePrdMo】工单类型不能为空");
|
||||
throw Oops.Bah("工单类型不能为空");
|
||||
if(item.plan_start_date==null)
|
||||
}
|
||||
|
||||
if (item.plan_start_date == null)
|
||||
{
|
||||
Log.Error("【SavePrdMo】计划开始日期不能为空");
|
||||
throw Oops.Bah("计划开始日期不能为空");
|
||||
if(item.plan_end_date==null)
|
||||
}
|
||||
|
||||
if (item.plan_end_date == null)
|
||||
{
|
||||
Log.Error("【SavePrdMo】计划结束日期不能为空");
|
||||
throw Oops.Bah("计划结束日期不能为空");
|
||||
if(string.IsNullOrEmpty(item.material_code))
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.material_code))
|
||||
{
|
||||
Log.Error("【SavePrdMo】物料编号不能为空");
|
||||
throw Oops.Bah("物料编号不能为空");
|
||||
if(string.IsNullOrEmpty(item.unit_id))
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.unit_id))
|
||||
{
|
||||
Log.Error("【SavePrdMo】单位不能为空");
|
||||
throw Oops.Bah("单位不能为空");
|
||||
if(item.plan_qty==null || item.plan_qty<=0)
|
||||
}
|
||||
|
||||
if (item.plan_qty == null || item.plan_qty <= 0)
|
||||
{
|
||||
Log.Error("【SavePrdMo】计划数量不能为空");
|
||||
throw Oops.Bah("计划数量不能为空");
|
||||
if(item.ebom_version==null || item.ebom_version.IsEmpty())
|
||||
}
|
||||
|
||||
if (item.ebom_version == null || item.ebom_version.IsEmpty())
|
||||
{
|
||||
Log.Error("【SavePrdMo】物料清单版本不能为空");
|
||||
throw Oops.Bah("物料清单版本不能为空");
|
||||
}
|
||||
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x => x.code == item.material_code);
|
||||
if(basMaterial==null)
|
||||
if (basMaterial == null)
|
||||
{
|
||||
Log.Error($"【SavePrdMo】未找到物料编号为{item.material_code}的物料");
|
||||
throw Oops.Bah($"未找到物料编号为{item.material_code}的物料");
|
||||
}
|
||||
|
||||
List<BasMaterialUnit> basMaterialUnits = await _db.Queryable<BasMaterialUnit>().Where(x => x.material_id == basMaterial.id).ToListAsync();
|
||||
List<String> units = basMaterialUnits.Select(x => x.auxiliary_unit_id).Distinct().ToList();
|
||||
if(units!=null && !string.IsNullOrEmpty(basMaterial.unit_id)) units.Add(basMaterial.unit_id);
|
||||
|
||||
if(!units.Contains(item.unit_id))
|
||||
|
||||
if (!units.Contains(item.unit_id))
|
||||
{
|
||||
Log.Error($"【SavePrdMo】{basMaterial.name}不存在{item.unit_id}该单位");
|
||||
throw Oops.Bah($"{basMaterial.name}不存在{item.unit_id}该单位");
|
||||
}
|
||||
|
||||
if (!await _db.Queryable<BasEbomH>().AnyAsync(x => x.material_id == basMaterial.id && x.version == item.ebom_version))
|
||||
{
|
||||
Log.Error($"【SavePrdMo】系统中无法找到物料清单{item.ebom_version}版本");
|
||||
throw Oops.Bah($"系统中无法找到物料清单{item.ebom_version}版本");
|
||||
}
|
||||
|
||||
@@ -114,6 +152,15 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
await _db.Insertable(moList).ExecuteCommandAsync();
|
||||
});
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
Log.Information($"【SavePrdMo】生产工单保存成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"【SavePrdMo】{result.ErrorMessage}");
|
||||
throw Oops.Bah($"{result.ErrorMessage}");
|
||||
}
|
||||
|
||||
return !result.IsSuccess ? result.ErrorMessage : "保存成功";
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace Tnb.ProductionMgr
|
||||
private static readonly Dictionary<string, object> _dicProcess = new();
|
||||
private readonly ISqlSugarClient _db;
|
||||
private ISqlSugarClient _db2;
|
||||
private ISqlSugarClient _db3;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
private readonly IPrdInstockService _prdInstockService;
|
||||
private readonly WmsPrdInstockHService _wmsPrdInstockHService;
|
||||
@@ -1666,15 +1667,22 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
if (qcCheckPlanAdds.Count == 1)
|
||||
{
|
||||
int hour = int.Parse(qcCheckPlanAdds[0].content.Split(" ")[2].Split("/")[1]);
|
||||
int minute = int.Parse(qcCheckPlanAdds[0].content.Split(" ")[1].Split("/")[1]);
|
||||
if (minute > 0)
|
||||
int hour = 0;
|
||||
int minute = 0;
|
||||
string hourStr = qcCheckPlanAdds[0].content.Split(" ")[2];
|
||||
string minuteStr = qcCheckPlanAdds[0].content.Split(" ")[1];
|
||||
if (hourStr.Contains("/"))
|
||||
{
|
||||
TimerPoolHelper.GetInstance().StartTimer(TimeCallback2,list.Where(p => p.mo_task_status == "Pause" || p.mo_task_status == "ToBeStarted").ToList(),TimeSpan.FromMinutes(minute),TimeSpan.FromMinutes(minute),false);
|
||||
}else if (hour > 0)
|
||||
{
|
||||
TimerPoolHelper.GetInstance().StartTimer(TimeCallback2,list.Where(p => p.mo_task_status == "Pause" || p.mo_task_status == "ToBeStarted").ToList(),TimeSpan.FromHours(hour),TimeSpan.FromHours(hour),false);
|
||||
hour = int.Parse(hourStr.Split("/")[1]);
|
||||
}
|
||||
|
||||
if (minuteStr.Contains("/"))
|
||||
{
|
||||
minute = int.Parse(minuteStr.Split("/")[1]);
|
||||
}
|
||||
|
||||
int totalMonute = hour * 60 + minute;
|
||||
TimerPoolHelper.GetInstance().StartTimer(TimeCallback2,list.Where(p => p.mo_task_status == "Pause" || p.mo_task_status == "ToBeStarted").ToList(),TimeSpan.FromMinutes(totalMonute),TimeSpan.FromMinutes(totalMonute),false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1710,7 +1718,14 @@ namespace Tnb.ProductionMgr
|
||||
await PrdTaskRelease(input);
|
||||
return "保存成功";
|
||||
}
|
||||
|
||||
|
||||
public async Task<dynamic> SelfTestScrapped2(SelfTestScrappedInput input, ISqlSugarClient db = null)
|
||||
{
|
||||
this._db3 = db;
|
||||
await SelfTestScrapped(input);
|
||||
return "保存成功";
|
||||
}
|
||||
|
||||
public async void TimeCallback(object args)
|
||||
{
|
||||
try
|
||||
@@ -2089,7 +2104,8 @@ namespace Tnb.ProductionMgr
|
||||
throw Oops.Bah($"提报失败,载具异常");
|
||||
}
|
||||
|
||||
bool isCheckFlag = !basMaterial.category_id.Contains("ZZCP");
|
||||
// bool isCheckFlag = !basMaterial.category_id.Contains("ZZCP");
|
||||
bool isCheckFlag = !basMaterial.category_id.Contains("ZSJ");
|
||||
|
||||
#region 质检模块
|
||||
//质检模块
|
||||
@@ -2648,13 +2664,26 @@ namespace Tnb.ProductionMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> SelfTestScrapped(SelfTestScrappedInput input)
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
bool tranFlag = true;
|
||||
ISqlSugarClient db = null;
|
||||
if (_db3!=null)
|
||||
{
|
||||
tranFlag = false;
|
||||
db = _db3;
|
||||
}
|
||||
else
|
||||
{
|
||||
db = _repository.AsSugarClient();
|
||||
}
|
||||
|
||||
if (await db.Queryable<PrdMoTask>().AnyAsync(x => x.id == input.mo_task_id && x.mo_task_status == DictConst.MoStatusPauseCode))
|
||||
{
|
||||
throw Oops.Bah("暂停的任务单无法报废");
|
||||
}
|
||||
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
if(tranFlag) await db.Ado.BeginTranAsync();
|
||||
|
||||
try
|
||||
{
|
||||
List<PrdMoTaskDefect> destDefects = new();
|
||||
string batch = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
@@ -2772,9 +2801,16 @@ namespace Tnb.ProductionMgr
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
if(tranFlag) await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if(tranFlag) await db.Ado.RollbackTranAsync();
|
||||
Log.Error(e.Message,e);
|
||||
throw Oops.Bah(e.Message);
|
||||
}
|
||||
|
||||
});
|
||||
return result.IsSuccess;
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改组装、包装,生产任务信息
|
||||
|
||||
@@ -6,6 +6,7 @@ using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.TaskScheduler;
|
||||
@@ -446,6 +447,12 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
throw Oops.Bah($"{entity.triggerevent.ToString()}找到多个质检方案");
|
||||
}
|
||||
|
||||
if (list[0].status == "0")
|
||||
{
|
||||
Log.Error($"{list[0].id}已停用");
|
||||
return;
|
||||
}
|
||||
|
||||
// List<string> removes = new();
|
||||
// foreach (QcCheckPlanH data in list)
|
||||
|
||||
@@ -393,12 +393,33 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().Where(x=>x.mo_task_code==QcCheckExecH.mo_task_code && x.id!=null).FirstAsync();
|
||||
string pauseReason = QcCheckExecH.checktype == WmsWareHouseConst.XUNJIAN_ID ? "巡检不合格" : QcCheckExecH.checktype == WmsWareHouseConst.SHOUJIAN_ID ? "首检不合格" : "末检不合格";
|
||||
await _prdMoTaskService.PrdTaskRelease2(new PrdTaskReleaseUpInput()
|
||||
await _prdMoTaskService.PrdTaskRelease2(new PrdTaskReleaseUpInput()
|
||||
{
|
||||
TaskIds = NPOI.Util.Arrays.AsList(prdMoTask.id),
|
||||
Behavior = "Pause",
|
||||
PauseReeson = pauseReason
|
||||
},db);
|
||||
await _prdMoTaskService.SelfTestScrapped2(new SelfTestScrappedInput()
|
||||
{
|
||||
mo_task_id = prdMoTask.id,
|
||||
scrap_qty = rqty,
|
||||
remark = "抽样不合格报废",
|
||||
categoryItems = new List<SelfTestScrappedInputItem>()
|
||||
{
|
||||
new SelfTestScrappedInputItem()
|
||||
{
|
||||
category_id = "25574005966629",
|
||||
items = new List<defectItem>()
|
||||
{
|
||||
new defectItem()
|
||||
{
|
||||
defective_item = "抽样不合格报废",
|
||||
defective_item_qty = rqty
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},db);
|
||||
List<string> carryCodes = await db.Queryable<PrdReport>().Where(x=>x.mo_task_id==prdMoTask.id).Select(x=>x.material_box_code).Distinct().ToListAsync();
|
||||
await db.Updateable<WmsCarryH>()
|
||||
.SetColumns(x => x.is_check == ((int)EnumCheckConclusion.暂控).ToString())
|
||||
|
||||
@@ -350,6 +350,13 @@ namespace Tnb.WarehouseMgr
|
||||
// BasWarehouse scWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==wmsPrdInstockD.scwarehouse_id);
|
||||
// BasWarehouse kcWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==wmsPrdInstockD.warehouse_id);
|
||||
PrdReport prdReport = await _db.Queryable<PrdReport>().SingleAsync(x => x.id == instock.prd_report_id);
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdReport.mo_task_id);
|
||||
PrdMo prdMo = await _db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||
//来源erp才产成品入库
|
||||
if (prdMo.mo_source != "1")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<WmsPrdInstockCode> allInstockDetails = await _db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instock_id == instock.id).ToListAsync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user