| | |
| | | using Furion.DatabaseAccessor; |
| | | using Furion.FriendlyException; |
| | | using iWare.Wms.Core.Util; |
| | | using iWare.Wms.Core; |
| | | using Mapster; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Furion.DependencyInjection; |
| | | using Furion.DynamicApiController; |
| | | using System.Text; |
| | | using Furion.FriendlyException; |
| | | using iWare.Wms.Core; |
| | | using iWare.Wms.Core.Enum; |
| | | using iWare.Wms.Core.Util; |
| | | using Mapster; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Microsoft.EntityFrameworkCore.Internal; |
| | | using System.Text; |
| | | |
| | | namespace iWare.Wms.Application.Service.Pda |
| | | { |
| | |
| | | [HttpPost("UpdateAlertStatus")] |
| | | public async Task<int> UpdateAlertStatus(EquipmentAlertClose input) |
| | | { |
| | | var v_GetEquipmentAlert = await _v_GetEquipmentAlertRep.FirstAsync(x => x.Id == input.v_get_equipment_alert_id); |
| | | |
| | | var equipmentBaseInfo = await _equipmentBaseInfoRep.FirstOrDefaultAsync(u => u.EquipmentId == input.EquipmentId && u.IsDeleted == false); |
| | | |
| | | if (equipmentBaseInfo == null) |
| | |
| | | { |
| | | throw Oops.Oh($"未传入需关闭的告警类型,不能关闭!"); |
| | | } |
| | | //告警类型 (1:清洗液更换告警;2:刀具更换告警;3:切削液更换告警;4:设备告警) |
| | | if (input.AlertType.Equals("1")) |
| | | { |
| | | equipmentBaseInfo.Detergentchangetime = DateTime.Now; |
| | | v_GetEquipmentAlert.IsAlertDetergent = false; |
| | | } |
| | | else if (input.AlertType.Equals("2")) |
| | | { |
| | | equipmentBaseInfo.KnifeToolChangeTime = DateTime.Now; |
| | | v_GetEquipmentAlert.IsAlertKnifeTool = false; |
| | | } |
| | | else if (input.AlertType.Equals("3")) |
| | | { |
| | | equipmentBaseInfo.CuttingFluidChangeTime = DateTime.Now; |
| | | v_GetEquipmentAlert.IsAlertCuttingFluid = false; |
| | | } |
| | | else if (input.AlertType.Equals("4")) |
| | | { |
| | |
| | | if (equipmentCurrentMonitor != null) |
| | | { |
| | | equipmentCurrentMonitor.IsCloseAlert = true; |
| | | await _equipmentCurrentMonitorRep.UpdateAsync(equipmentCurrentMonitor); |
| | | } |
| | | v_GetEquipmentAlert.IsAlert = false; |
| | | } |
| | | else |
| | | { |
| | | throw Oops.Oh($"设备{input.EquipmentId}传入告警类型{input.AlertType}不存在,不能关闭!"); |
| | | } |
| | | |
| | | var isSucess = await _equipmentBaseInfoRep.UpdateAsync(equipmentBaseInfo); |
| | | await _v_GetEquipmentAlertRep.UpdateAsync(v_GetEquipmentAlert); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | |
| | | { |
| | | var workPieceProcesss = await _workPieceProcessRep.DetachedEntities |
| | | .Join(_equipmentBaseInfoRep.DetachedEntities, a => a.EquipmentID, b => b.EquipmentId, (a, b) => new { a, b }) |
| | | // 新增 Left Join 到 _workPieceInfo 表 |
| | | .Join(_workPieceInfoRep.DetachedEntities, |
| | | temp => temp.a.WorkPieceID, // 使用之前 Join 结果的 a.WorkPieceID |
| | | c => c.WorkPieceID, // _workPieceInfo 表的 WorkPieceID |
| | | (temp, c) => new { temp.a, temp.b, workPieceInfo = c }) // 创建新的匿名类型包含三个实体 |
| | | |
| | | .Where(!string.IsNullOrEmpty(input.WorkPieceID), u => u.a.WorkPieceID.Equals(input.WorkPieceID)) |
| | | .Where(o => !string.IsNullOrEmpty(o.a.WorkPieceID)) |
| | | .Select(s => new WorkPieceProcessOutput |
| | | { |
| | | Id = s.a.Id, |
| | | |
| | | JiaJuGongWei = s.a.JiaJuGongWei, |
| | | |
| | | DataCapturePointCname = s.a.DataCapturePointCname, |
| | | UpdateDataCapturePointCname = s.a.UpdateDataCapturePointCname, |
| | |
| | | UpdatedUserName = s.a.UpdatedUserName, |
| | | |
| | | WorkPieceID = s.a.WorkPieceID, |
| | | OP80NewCode = s.workPieceInfo.OP80NewCode,//成品码 |
| | | |
| | | WorkingProcedureCurrent = s.a.WorkingProcedureCurrent, |
| | | EquipmentID = s.a.EquipmentID, |
| | | EquipmentName = s.b.EquipmentName, |