diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs index 1f07e4c0..4d61460c 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs @@ -5,6 +5,7 @@ namespace Tnb.EquipMgr.Entities.Dto public string id { get; set; } = string.Empty; public string repeat_result { get; set; } = string.Empty; + public string repeat_descrip { get; set; } = string.Empty; public string? repeat_remark { get; set; } public string? attachment { get; set; } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainTask.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainTask.cs index e843dc6d..a8dba99a 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainTask.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainTask.cs @@ -61,4 +61,29 @@ public partial class ToolMoldMaintainTask : BaseEntity public string? wxattachment { get; set; } public string? wxdescribe { get; set; } + /// + /// 复核 1 通过 2 不通过 + /// + public string repeat_result { get; set; } + + /// + /// 复核结果描述 + /// + public string repeat_descrip { get; set; } + + /// + /// 复核人 + /// + public string repeat_user_id { get; set; } + + /// + /// 复核时间 + /// + public DateTime? repeat_time { get; set; } + + /// + /// 工时(小时) + /// + public decimal cost_work_time { get; set; } + } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs index fcbe2d65..beb4a8f6 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs @@ -122,5 +122,27 @@ namespace Tnb.EquipMgr throw Oops.Oh(ErrorCode.COM1001); } } + + [HttpPost] + public async Task RepeatRepair(MaintainRecordRepeatInput input) + { + ToolMoldMaintainTask toolMoldMaintainTask = await _db.Queryable().SingleAsync(x => x.id == input.id); + if (toolMoldMaintainTask.status != "YWC") + { + throw Oops.Bah("状态错误"); + } + DbResult result = await _db.Ado.UseTranAsync(async () => + { + await _db.Updateable() + .SetColumns(x => x.repeat_result == input.repeat_result) + .SetColumns(x => x.repeat_descrip == input.repeat_descrip) + .SetColumns(x=>x.repeat_user_id==_userManager.UserId) + .SetColumns(x=>x.repeat_time==DateTime.Now) + .Where(x => x.id == input.id) + .ExecuteCommandAsync(); + }); + + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "复核成功" : result.ErrorMessage; + } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdRawMaterialBarcodeListDto.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdRawMaterialBarcodeListDto.cs index e0715a7e..58a22755 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdRawMaterialBarcodeListDto.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdRawMaterialBarcodeListDto.cs @@ -47,7 +47,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// /// 管道状态 /// - public int piping_status { get; set; } + public string piping_status { get; set; } /// /// 开始时间 diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs index ba838c8a..98f695a1 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs @@ -140,8 +140,7 @@ namespace Tnb.ProductionMgr ["TagName"] = "开工1", ["Value"] = "true", }; - string responseresult = - await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand, false); + string responseresult = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand, false); Log.Information($"注塑主控柜开工1开启返回结果:{responseresult}"); Dictionary dicCommand2 = new(StringComparer.OrdinalIgnoreCase) @@ -152,9 +151,19 @@ namespace Tnb.ProductionMgr ["Value"] = "true", }; - string responseresult2 = - await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2, false); + string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2, false); Log.Information($"注塑主控柜开工2开启返回结果:{responseresult2}"); + + Dictionary dicCommand4 = new(StringComparer.OrdinalIgnoreCase) + { + ["DevName"] = "挤出集中供料", + ["token"] = _eleCtlCfg.token, + ["TagName"] = "开关1", + ["Value"] = "true", + }; + + string responseresult4 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4, false); + Log.Information($"挤出集中供料开关1开启返回结果:{responseresult4}"); List prdRawMaterialBarcodeList = await _db.Queryable() .Where(x => ids.Contains(x.id)).ToListAsync(); @@ -224,6 +233,17 @@ namespace Tnb.ProductionMgr }; string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2, false); Log.Information($"注塑主控柜开工2关闭返回结果:{responseresult2}"); + + Dictionary dicCommand4 = new(StringComparer.OrdinalIgnoreCase) + { + ["DevName"] = "挤出集中供料", + ["token"] = _eleCtlCfg.token, + ["TagName"] = "开关1", + ["Value"] = "false", + }; + + string responseresult4 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4, false); + Log.Information($"挤出集中供料开关1关闭返回结果:{responseresult4}"); } return "成功"; diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs new file mode 100644 index 00000000..8eb03053 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs @@ -0,0 +1,111 @@ +using JNPF; +using JNPF.Common.Core.Manager; +using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Extension; +using JNPF.Common.Filter; +using JNPF.Common.Security; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.FriendlyException; +using JNPF.Logging; +using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Interfaces; +using Mapster; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using Senparc.CO2NET.HttpUtility; +using SqlSugar; +using Tnb.BasicData; +using Tnb.BasicData.Entities; +using Tnb.Common.Extension; +using Tnb.EquipMgr.Entities; +using Tnb.ProductionMgr.Entities; +using Tnb.WarehouseMgr.Entities.Configs; +using Tnb.Common.Utils; +using Tnb.WarehouseMgr.Entities.Consts; +using HttpClientHelper = Tnb.Common.Utils.HttpClientHelper; +using Tnb.Common.Redis; +using Tnb.ProductionMgr.Entities.Dto.PrdManage; + +namespace Tnb.ProductionMgr +{ + /// + /// 机台原料设定服务 + /// + [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + [OverideVisualDev(ModuleId)] + public class PrdRawMaterialBarcodeTwoService: IOverideVisualDevService,IDynamicApiController, ITransient + { + private const string ModuleId = "36009683052821"; + private readonly ISqlSugarClient _db; + private readonly IDictionaryDataService _dictionaryDataService; + private readonly IUserManager _userManager; + private static Dictionary> _dicWorkLine = new(); + private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build(); + private readonly IBillRullService _billRuleService; + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + private readonly IVisualDevService _visualDevService; + private readonly IRunService _runService; + private readonly RedisData _redisData; + + public PrdRawMaterialBarcodeTwoService(ISqlSugarRepository repository, + IUserManager userManager, + IBillRullService billRuleService, + IVisualDevService visualDevService, + RedisData redisData, + IRunService runService, + IDictionaryDataService dictionaryDataService) + { + _db = repository.AsSugarClient(); + _userManager = userManager; + _billRuleService = billRuleService; + _dictionaryDataService = dictionaryDataService; + _visualDevService = visualDevService; + _runService = runService; + _redisData = redisData; + OverideFuncs.GetListAsync = GetList; + } + + private async Task GetList(VisualDevModelListQueryInput input) + { + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string billCode = queryJson.ContainsKey("bill_code") ? queryJson["bill_code"].ToString() : ""; + string equipTypeId = queryJson.ContainsKey("f_flowid") ? queryJson["f_flowid"].ToString() : ""; + string isUpdate = queryJson.ContainsKey("is_update") ? queryJson["is_update"].ToString() : ""; + + SqlSugarPagedList result = await _db.Queryable() + .LeftJoin((a, b) => a.material_id == b.id) + .LeftJoin((a, b,c) => a.equip_id == c.id) + .LeftJoin((a,b,c,d)=>c.equip_type_id==d.id) + .WhereIF(!string.IsNullOrEmpty(billCode),(a,b,c)=>a.bill_code.Contains(billCode)) + .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") + .Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto + { + id = a.id, + bill_code = a.bill_code, + equip_id = c.name, + material_id = b.name, + absorb_material_finish = a.absorb_material_finish==1 ? "是" : "否", + is_update = a.is_update==1 ? "是" : "否", + piping_status = a.piping_status == 1 ? "开" : "关", + start_time = a.start_time!=null ? a.start_time.Value.ToString(DbTimeFormat.SS) : "", + end_time = a.end_time!=null ? a.end_time.Value.ToString(DbTimeFormat.SS) : "", + remark = a.remark, + stop_valve = a.stop_valve, + f_flowid = d.name, + equip_id_id = c.id, + material_id_id = b.id, + equip_ids = SqlFunc.Subqueryable().Where(x=>a.equip_ids.Contains(x.id)).SelectStringJoin(x=>x.name,",") + }).ToPagedListAsync(input.currentPage, int.MaxValue); + return PageResult.SqlSugarPageResult(result); + } + + } +} \ No newline at end of file