diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs index 97d82d49..f26494bf 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/RepairApplyStatus.cs @@ -53,6 +53,10 @@ namespace Tnb.EquipMgr /// 申请外修 /// public const string TOBEOUTAPPLY = "12"; + /// + /// 复核中 + /// + public const string REPEATCHECKING = "13"; } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotReportOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotReportOutput.cs new file mode 100644 index 00000000..b9064197 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotReportOutput.cs @@ -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; } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRepeatInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRepeatInput.cs new file mode 100644 index 00000000..8a636604 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRepeatInput.cs @@ -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; } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs index 36e4ba59..da1c3e43 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs @@ -163,5 +163,15 @@ public partial class EqpRepairApply : BaseEntity /// 生产任务单号 /// public string? mo_task_code { get; set; } + + /// + /// 复核结果 + /// + public string repeat_result { get; set; } + + /// + /// 复核描述 + /// + public string repeat_descrip { get; set; } = string.Empty; } diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs index fec6b500..c416c3f9 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs @@ -273,7 +273,8 @@ namespace Tnb.EquipMgr { 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() { fault_id = input.fault_id, @@ -426,5 +427,28 @@ namespace Tnb.EquipMgr return PageResult.SqlSugarPageResult(result); } + + [HttpPost] + public async Task 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() + .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("状态错误"); + } + + + } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs index a4e3b8fe..70ed3edd 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs @@ -186,7 +186,7 @@ namespace Tnb.EquipMgr attachment = input.attachment, }, x => x.id == input.id); - _ = await db.Updateable().SetColumns(x => x.status == RepairApplyStatus.COMPLETED) + _ = await db.Updateable().SetColumns(x => x.status == RepairApplyStatus.REPEATCHECKING) .Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync(); }); return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "登记成功" : result.ErrorMessage; diff --git a/EquipMgr/Tnb.EquipMgr/EqpSpotReportService.cs b/EquipMgr/Tnb.EquipMgr/EqpSpotReportService.cs new file mode 100644 index 00000000..db01dffb --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr/EqpSpotReportService.cs @@ -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 +{ + /// + /// 设备维修登记 + /// + [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 _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 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 GetList(VisualDevModelListQueryInput input) + { + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + 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 result = await db.Queryable() + .LeftJoin((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().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().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.SqlSugarPageResult(result); + } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs index ae1d634c..a7bfc7e3 100644 --- a/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs @@ -311,8 +311,8 @@ namespace Tnb.EquipMgr string executeUserId = dic["executeUserId"]; string repeat_user_id = dic["repeat_user_id"]; EqpMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id); - if (eqpSpotInsRecordH.status == "1") - { + // if (eqpSpotInsRecordH.status == "1") + // { _ = await _repository.UpdateAsync(x => new EqpMaintainRecordH() { execute_user_id = executeUserId, @@ -321,11 +321,11 @@ namespace Tnb.EquipMgr modify_time = DateTime.Now }, x => x.id == id); return "指派成功"; - } - else - { - throw Oops.Bah("状态错误"); - } + // } + // else + // { + // throw Oops.Bah("状态错误"); + // } } } diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs index 233286c9..884ff8c4 100644 --- a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs @@ -270,8 +270,8 @@ namespace Tnb.EquipMgr string spotRecordUserId = dic["spotRecordUserId"]; string repeat_user_id = dic["repeat_user_id"]; EqpSpotInsRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id); - if (eqpSpotInsRecordH.status == "1") - { + // if (eqpSpotInsRecordH.status == "1") + // { _ = await _repository.UpdateAsync(x => new EqpSpotInsRecordH() { spot_record_user_id = spotRecordUserId, @@ -280,11 +280,11 @@ namespace Tnb.EquipMgr modify_time = DateTime.Now }, x => x.id == id); return "指派成功"; - } - else - { - throw Oops.Bah("状态错误"); - } + // } + // else + // { + // throw Oops.Bah("状态错误"); + // } } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRecordService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRecordService.cs index deef4d0f..a7e179e5 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRecordService.cs @@ -313,8 +313,8 @@ namespace Tnb.EquipMgr string executeUserId = dic["executeUserId"]; string repeat_user_id = dic["repeat_user_id"]; ToolMoldMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id); - if (eqpSpotInsRecordH.status == "1") - { + // if (eqpSpotInsRecordH.status == "1") + // { _ = await _repository.UpdateAsync(x => new ToolMoldMaintainRecordH() { execute_user_id = executeUserId, @@ -323,11 +323,11 @@ namespace Tnb.EquipMgr modify_time = DateTime.Now }, x => x.id == id); return "指派成功"; - } - else - { - throw Oops.Bah("状态错误"); - } + // } + // else + // { + // throw Oops.Bah("状态错误"); + // } } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordService.cs index ed778212..407f9853 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordService.cs @@ -86,6 +86,7 @@ namespace Tnb.ProductionMgr .WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId) .WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate) .Where((a,b,c)=>a.type=="1") + .OrderBy((a,b,c,d)=>c.code) .Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto { id = a.id, diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordTwoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordTwoService.cs index aac145c3..e4f036ad 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordTwoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordTwoService.cs @@ -90,6 +90,7 @@ namespace Tnb.ProductionMgr .WhereIF(!string.IsNullOrEmpty(equipId),(a,b,c)=>a.equip_id.ToString()==equipId) .WhereIF(!string.IsNullOrEmpty(stopValue),(a,b,c)=>a.stop_valve.ToString()==stopValue) .Where((a,b,c)=>a.type=="2") + .OrderBy((a,b,c,d)=>c.code) .Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto { id = a.id, diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs index 4037bc03..3528ea8b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs @@ -87,6 +87,7 @@ namespace Tnb.ProductionMgr .WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId) .WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate) .Where((a,b,c)=>a.type=="1") + .OrderBy((a,b,c,d)=>c.code) .Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto { id = a.id, @@ -259,6 +260,7 @@ namespace Tnb.ProductionMgr public async Task AsyncMaterialWarhouse() { List equipIds = await _db.Queryable().Where(x=>x.type=="1").Select(x=>x.equip_id).ToListAsync(); + // code JZGL开始的为料仓 List equipments = await _db.Queryable().Where(x=>!equipIds.Contains(x.id) && x.code.StartsWith("JZGL")).ToListAsync(); List insertList = new List(); diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs index cd9935e5..5424ed99 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs @@ -86,6 +86,7 @@ namespace Tnb.ProductionMgr .WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId) .WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate) .Where((a,b,c)=>a.type=="2") + .OrderBy((a,b,c,d)=>c.code) .Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto { id = a.id,