点巡检报表 设备维修复核
This commit is contained in:
@@ -53,6 +53,10 @@ namespace Tnb.EquipMgr
|
|||||||
/// 申请外修
|
/// 申请外修
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string TOBEOUTAPPLY = "12";
|
public const string TOBEOUTAPPLY = "12";
|
||||||
|
/// <summary>
|
||||||
|
/// 复核中
|
||||||
|
/// </summary>
|
||||||
|
public const string REPEATCHECKING = "13";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
13
EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotReportOutput.cs
Normal file
13
EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotReportOutput.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace Tnb.EquipMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class EqpSpotReportOutput
|
||||||
|
{
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Tnb.EquipMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class RepairApplyRepeatInput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
public string repeat_result { get; set; }
|
||||||
|
public string repeat_descrip { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -163,5 +163,15 @@ public partial class EqpRepairApply : BaseEntity<string>
|
|||||||
/// 生产任务单号
|
/// 生产任务单号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? mo_task_code { get; set; }
|
public string? mo_task_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核结果
|
||||||
|
/// </summary>
|
||||||
|
public string repeat_result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核描述
|
||||||
|
/// </summary>
|
||||||
|
public string repeat_descrip { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -273,7 +273,8 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||||
{
|
{
|
||||||
string status = input.is_out_apply == 1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
// string status = input.is_out_apply == 1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
||||||
|
string status = input.is_out_apply == 1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.REPEATCHECKING;
|
||||||
_ = await _repository.UpdateAsync(x => new EqpRepairApply()
|
_ = await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||||
{
|
{
|
||||||
fault_id = input.fault_id,
|
fault_id = input.fault_id,
|
||||||
@@ -426,5 +427,28 @@ namespace Tnb.EquipMgr
|
|||||||
|
|
||||||
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<string> Repeat(RepairApplyRepeatInput input)
|
||||||
|
{
|
||||||
|
|
||||||
|
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||||
|
if (eqpRepairApply.status == RepairApplyStatus.REPEATCHECKING)
|
||||||
|
{
|
||||||
|
string status = input.repeat_result=="1" ? RepairApplyStatus.COMPLETED : RepairApplyStatus.TOBEEXECUTED;
|
||||||
|
await _repository.AsSugarClient().Updateable<EqpRepairApply>()
|
||||||
|
.SetColumns(x => x.repeat_result == input.repeat_result)
|
||||||
|
.SetColumns(x => x.repeat_descrip == input.repeat_descrip)
|
||||||
|
.SetColumns(x => x.status == status)
|
||||||
|
.Where(x => x.id == input.id).ExecuteCommandAsync();
|
||||||
|
return "复核成功";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw Oops.Bah("状态错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ namespace Tnb.EquipMgr
|
|||||||
attachment = input.attachment,
|
attachment = input.attachment,
|
||||||
}, x => x.id == input.id);
|
}, x => x.id == input.id);
|
||||||
|
|
||||||
_ = await db.Updateable<EqpRepairApply>().SetColumns(x => x.status == RepairApplyStatus.COMPLETED)
|
_ = await db.Updateable<EqpRepairApply>().SetColumns(x => x.status == RepairApplyStatus.REPEATCHECKING)
|
||||||
.Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync();
|
.Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync();
|
||||||
});
|
});
|
||||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "登记成功" : result.ErrorMessage;
|
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "登记成功" : result.ErrorMessage;
|
||||||
|
|||||||
75
EquipMgr/Tnb.EquipMgr/EqpSpotReportService.cs
Normal file
75
EquipMgr/Tnb.EquipMgr/EqpSpotReportService.cs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
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 EqpSpotReportService: IOverideVisualDevService,IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private const string ModuleId = "27895087469589";
|
||||||
|
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 EqpSpotReportService(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<EqpSpotReportOutput> 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))
|
||||||
|
.Select((a, b) => new EqpSpotReportOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
code = a.code,
|
||||||
|
name = a.name,
|
||||||
|
workshop_name = b.FullName,
|
||||||
|
month = month,
|
||||||
|
execute_num = SqlFunc.Subqueryable<EqpSpotInsRecordH>().Where(x=>x.equip_id==a.id && x.status!="1" && x.status!=null && x.create_time.Value.ToString("yyyy-MM")==month).Count(),
|
||||||
|
unqualified_num = SqlFunc.Subqueryable<EqpSpotInsRecordH>().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<EqpSpotReportOutput>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -311,8 +311,8 @@ namespace Tnb.EquipMgr
|
|||||||
string executeUserId = dic["executeUserId"];
|
string executeUserId = dic["executeUserId"];
|
||||||
string repeat_user_id = dic["repeat_user_id"];
|
string repeat_user_id = dic["repeat_user_id"];
|
||||||
EqpMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
EqpMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
||||||
if (eqpSpotInsRecordH.status == "1")
|
// if (eqpSpotInsRecordH.status == "1")
|
||||||
{
|
// {
|
||||||
_ = await _repository.UpdateAsync(x => new EqpMaintainRecordH()
|
_ = await _repository.UpdateAsync(x => new EqpMaintainRecordH()
|
||||||
{
|
{
|
||||||
execute_user_id = executeUserId,
|
execute_user_id = executeUserId,
|
||||||
@@ -321,11 +321,11 @@ namespace Tnb.EquipMgr
|
|||||||
modify_time = DateTime.Now
|
modify_time = DateTime.Now
|
||||||
}, x => x.id == id);
|
}, x => x.id == id);
|
||||||
return "指派成功";
|
return "指派成功";
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
throw Oops.Bah("状态错误");
|
// throw Oops.Bah("状态错误");
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -270,8 +270,8 @@ namespace Tnb.EquipMgr
|
|||||||
string spotRecordUserId = dic["spotRecordUserId"];
|
string spotRecordUserId = dic["spotRecordUserId"];
|
||||||
string repeat_user_id = dic["repeat_user_id"];
|
string repeat_user_id = dic["repeat_user_id"];
|
||||||
EqpSpotInsRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
EqpSpotInsRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
||||||
if (eqpSpotInsRecordH.status == "1")
|
// if (eqpSpotInsRecordH.status == "1")
|
||||||
{
|
// {
|
||||||
_ = await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
_ = await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
||||||
{
|
{
|
||||||
spot_record_user_id = spotRecordUserId,
|
spot_record_user_id = spotRecordUserId,
|
||||||
@@ -280,11 +280,11 @@ namespace Tnb.EquipMgr
|
|||||||
modify_time = DateTime.Now
|
modify_time = DateTime.Now
|
||||||
}, x => x.id == id);
|
}, x => x.id == id);
|
||||||
return "指派成功";
|
return "指派成功";
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
throw Oops.Bah("状态错误");
|
// throw Oops.Bah("状态错误");
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,8 +313,8 @@ namespace Tnb.EquipMgr
|
|||||||
string executeUserId = dic["executeUserId"];
|
string executeUserId = dic["executeUserId"];
|
||||||
string repeat_user_id = dic["repeat_user_id"];
|
string repeat_user_id = dic["repeat_user_id"];
|
||||||
ToolMoldMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
ToolMoldMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
||||||
if (eqpSpotInsRecordH.status == "1")
|
// if (eqpSpotInsRecordH.status == "1")
|
||||||
{
|
// {
|
||||||
_ = await _repository.UpdateAsync(x => new ToolMoldMaintainRecordH()
|
_ = await _repository.UpdateAsync(x => new ToolMoldMaintainRecordH()
|
||||||
{
|
{
|
||||||
execute_user_id = executeUserId,
|
execute_user_id = executeUserId,
|
||||||
@@ -323,11 +323,11 @@ namespace Tnb.EquipMgr
|
|||||||
modify_time = DateTime.Now
|
modify_time = DateTime.Now
|
||||||
}, x => x.id == id);
|
}, x => x.id == id);
|
||||||
return "指派成功";
|
return "指派成功";
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
throw Oops.Bah("状态错误");
|
// throw Oops.Bah("状态错误");
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ namespace Tnb.ProductionMgr
|
|||||||
.WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId)
|
.WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId)
|
||||||
.WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate)
|
.WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate)
|
||||||
.Where((a,b,c)=>a.type=="1")
|
.Where((a,b,c)=>a.type=="1")
|
||||||
|
.OrderBy((a,b,c,d)=>c.code)
|
||||||
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ namespace Tnb.ProductionMgr
|
|||||||
.WhereIF(!string.IsNullOrEmpty(equipId),(a,b,c)=>a.equip_id.ToString()==equipId)
|
.WhereIF(!string.IsNullOrEmpty(equipId),(a,b,c)=>a.equip_id.ToString()==equipId)
|
||||||
.WhereIF(!string.IsNullOrEmpty(stopValue),(a,b,c)=>a.stop_valve.ToString()==stopValue)
|
.WhereIF(!string.IsNullOrEmpty(stopValue),(a,b,c)=>a.stop_valve.ToString()==stopValue)
|
||||||
.Where((a,b,c)=>a.type=="2")
|
.Where((a,b,c)=>a.type=="2")
|
||||||
|
.OrderBy((a,b,c,d)=>c.code)
|
||||||
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ namespace Tnb.ProductionMgr
|
|||||||
.WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId)
|
.WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId)
|
||||||
.WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate)
|
.WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate)
|
||||||
.Where((a,b,c)=>a.type=="1")
|
.Where((a,b,c)=>a.type=="1")
|
||||||
|
.OrderBy((a,b,c,d)=>c.code)
|
||||||
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
@@ -259,6 +260,7 @@ namespace Tnb.ProductionMgr
|
|||||||
public async Task<dynamic> AsyncMaterialWarhouse()
|
public async Task<dynamic> AsyncMaterialWarhouse()
|
||||||
{
|
{
|
||||||
List<string> equipIds = await _db.Queryable<PrdRawMaterialBarcode>().Where(x=>x.type=="1").Select(x=>x.equip_id).ToListAsync();
|
List<string> equipIds = await _db.Queryable<PrdRawMaterialBarcode>().Where(x=>x.type=="1").Select(x=>x.equip_id).ToListAsync();
|
||||||
|
// code JZGL开始的为料仓
|
||||||
List<EqpEquipment> equipments = await _db.Queryable<EqpEquipment>().Where(x=>!equipIds.Contains(x.id) && x.code.StartsWith("JZGL")).ToListAsync();
|
List<EqpEquipment> equipments = await _db.Queryable<EqpEquipment>().Where(x=>!equipIds.Contains(x.id) && x.code.StartsWith("JZGL")).ToListAsync();
|
||||||
|
|
||||||
List<PrdRawMaterialBarcode> insertList = new List<PrdRawMaterialBarcode>();
|
List<PrdRawMaterialBarcode> insertList = new List<PrdRawMaterialBarcode>();
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ namespace Tnb.ProductionMgr
|
|||||||
.WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId)
|
.WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId)
|
||||||
.WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate)
|
.WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate)
|
||||||
.Where((a,b,c)=>a.type=="2")
|
.Where((a,b,c)=>a.type=="2")
|
||||||
|
.OrderBy((a,b,c,d)=>c.code)
|
||||||
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
.Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user