| | |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | private readonly IRepository<WorkPieceProcess, MasterDbContextLocator> _workPieceProcessRep; |
| | | private readonly IAccessInterfaceLogService _accessInterfaceLog; |
| | | private readonly IAccessInterfaceLogForRequestService _accessInterfaceLogForRequest; |
| | | private readonly IRepository<WorkPieceInfoLog, MasterDbContextLocator> _WorkPieceInfoLog; |
| | | private readonly IRepository<EquipmentCurrentMonitor, MasterDbContextLocator> _equipmentCurrentMonitorRep; |
| | | private readonly IRepository<EquipmentBaseInfo, MasterDbContextLocator> _equipmentBaseInfoRep; |
| | |
| | | /// <param name="workPieceInfoRep"></param> |
| | | /// <param name="httpContextAccessor"></param> |
| | | /// <param name="accessInterfaceLog"></param> |
| | | public AccessInterfaceService(IRepository<QualityDataInfo, MasterDbContextLocator> qualityDataInfoRep, |
| | | public AccessInterfaceService( |
| | | IAccessInterfaceLogForRequestService accessInterfaceLogForRequest, |
| | | IRepository<QualityDataInfo, MasterDbContextLocator> qualityDataInfoRep, |
| | | IRepository<QualityDataInfoLog, MasterDbContextLocator> qualityDataInfoLogRep, |
| | | IRepository<WorkPieceInfo, MasterDbContextLocator> workPieceInfoRep, |
| | | IHttpContextAccessor httpContextAccessor, |
| | |
| | | , IRepository<ProductionPlanInfo, MasterDbContextLocator> productionPlanInfoRep |
| | | , IRepository<ShiftInfo, MasterDbContextLocator> shiftInfoRep) |
| | | { |
| | | _accessInterfaceLogForRequest = accessInterfaceLogForRequest; |
| | | _qualityDataInfoRep = qualityDataInfoRep; |
| | | _qualityDataInfoLogRep = qualityDataInfoLogRep; |
| | | _workPieceInfoRep = workPieceInfoRep; |
| | |
| | | { |
| | | try |
| | | { |
| | | addLog.WorkPieceID = input.WorkPieceID; |
| | | addLog.WorkingProcedureCurrent = input.WorkingProcedure; |
| | | addLog.WorkPieceID = input?.WorkPieceID; |
| | | addLog.WorkingProcedureCurrent = input?.WorkingProcedure; |
| | | addLog.QualityState = input?.QualityState; |
| | | |
| | | await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | } |
| | |
| | | [HttpGet("GetWorkingProcedureForID")] |
| | | public async Task<AccessWorPieceInfoOutput> GetWorkingProcedureForID([FromQuery] AccessWorkPieceInfoInput input) |
| | | { |
| | | AddAccessInterfaceLogInput addLog = new(); |
| | | AddAccessInterfaceLogForRequestInput addLog = new(); |
| | | addLog.JsonString = JsonConvert.SerializeObject(input); |
| | | addLog.Action = 2; |
| | | addLog.Key = input.WorkPieceID; |
| | |
| | | if (input == null || string.IsNullOrEmpty(input.WorkPieceID)) |
| | | { |
| | | addLog.Result = "传入参数异常:工件号不能为空!"; |
| | | await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | //await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | //替换[Editby shaocx,2024-09-04] |
| | | await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog); |
| | | throw Oops.Oh(addLog.Result); |
| | | } |
| | | |
| | |
| | | if (workPieceInfo == null) |
| | | { |
| | | addLog.Result = $"传入参数异常:工件号{input.WorkPieceID}不能找到指定工件!"; |
| | | await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | //await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | //替换[Editby shaocx,2024-09-04] |
| | | await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog); |
| | | throw Oops.Oh(addLog.Result); |
| | | } |
| | | var re = workPieceInfo.Adapt<AccessWorPieceInfoOutput>(); |
| | | |
| | | addLog.Result = re; |
| | | |
| | | await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | //await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | //替换[Editby shaocx,2024-09-04] |
| | | await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog); |
| | | |
| | | return re; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | produceCompletionStatus.PlanCompletionRate = Math.Round(((double)produceCompletionStatus.CompletionNum / (double)produceCompletionStatus.PlanCompletionNum), 3) * 100; |
| | | produceCompletionStatus.PlanCompletionRate = (int)Math.Clamp( |
| | | Math.Round(((double)produceCompletionStatus.CompletionNum / (double)produceCompletionStatus.PlanCompletionNum), 3) * 100 |
| | | , 0, 100); |
| | | } |
| | | list.Add(produceCompletionStatus); |
| | | |
| | |
| | | //获取当前月 |
| | | var month = DateTime.Now.ToString("yyyy-MM"); |
| | | //获取当前天 |
| | | var day = DateTime.Now.ToString("yyyy-MM-dd"); |
| | | var day = DateTime.Now.ToString("yyyy-MM-dd"); |
| | | //获取当前月份计划 |
| | | var productionPlanInfos = _productionPlanInfoRep.DetachedEntities.ProjectToType<ProductionPlanInfoOutput>().ToList() |
| | | .Where(o => o.PlanType.Equals("2") && o.PlanTimeHand.Equals(month)).FirstOrDefault(); |
| | |
| | | var workPieceInfo = await _workPieceInfoRep.DetachedEntities |
| | | .FirstOrDefaultAsync(w => w.WorkPieceID == input.WorkPieceID.Trim()); |
| | | |
| | | AddAccessInterfaceLogInput addLog = new(); |
| | | AddAccessInterfaceLogForRequestInput addLog = new(); |
| | | addLog.JsonString = JsonConvert.SerializeObject(input); |
| | | addLog.Action = 2; |
| | | addLog.Key = input.WorkPieceID; |
| | |
| | | addLog.IpAddress = ipAddress.MapToIPv4().ToString(); |
| | | } |
| | | addLog.OperateAddress = $"{_httpContextAccessor.HttpContext.Request.Path}";// {_httpContextAccessor.HttpContext.Request.QueryString}"; //_httpContextAccessor.HttpContext.Request.GetEncodedUrl(); |
| | | await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | //替换[Editby shaocx,2024-09-04] |
| | | // await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog); |
| | | |
| | | return workPieceInfo == null ? null : workPieceInfo.Adapt<AccessWorPieceInfoOutput>(); |
| | | } |
| | |
| | | await _threadStatusMonitorRep.UpdateAsync(threadStatusMonitor); |
| | | } |
| | | } |
| | | AddAccessInterfaceLogInput addLog = new(); |
| | | AddAccessInterfaceLogForRequestInput addLog = new(); |
| | | addLog.JsonString = JsonConvert.SerializeObject(input); |
| | | addLog.Action = 1; |
| | | addLog.Key = input.Threadcode; |
| | | addLog.IpAddress = _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(); |
| | | addLog.OperateAddress = $"{_httpContextAccessor.HttpContext.Request.Path}{_httpContextAccessor.HttpContext.Request.QueryString}"; |
| | | await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | //替换[Editby shaocx,2024-09-04] |
| | | // await _accessInterfaceLog.AddInterfaceLogAsync(addLog); |
| | | await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog); |
| | | } |
| | | #endregion |
| | | } |