| | |
| | | [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; |
| | | } |
| | | |
| | |
| | | .Select(s => new WorkPieceProcessOutput |
| | | { |
| | | Id = s.a.Id, |
| | | |
| | | JiaJuGongWei = s.a.JiaJuGongWei, |
| | | |
| | | DataCapturePointCname = s.a.DataCapturePointCname, |
| | | UpdateDataCapturePointCname = s.a.UpdateDataCapturePointCname, |
| | | QualityNoOkReason = s.a.QualityNoOkReason, |
| | | CreateUserName = s.a.CreatedUserName, |
| | | UpdatedUserName = s.a.UpdatedUserName, |
| | | |
| | | WorkPieceID = s.a.WorkPieceID, |
| | | WorkingProcedureCurrent = s.a.WorkingProcedureCurrent, |
| | | EquipmentID = s.a.EquipmentID, |
| | |
| | | public async Task<string> outBoundWorkPiece([FromBody] OutBoundInput input) |
| | | { |
| | | |
| | | if (input.Password == null || !input.Password.Equals("123456")) |
| | | { |
| | | throw Oops.Oh("修改工件质量状态失败:密码输入错误!"); |
| | | } |
| | | //if (input.Password == null || !input.Password.Equals("123456")) |
| | | //{ |
| | | // throw Oops.Oh("修改工件质量状态失败:密码输入错误!"); |
| | | //} |
| | | if (input.WorkPieceInfoLst.Count < 1) |
| | | { |
| | | throw Oops.Oh("工件出库失败:数据不能为空!"); |
| | | throw Oops.Oh("工件入库失败:数据不能为空!"); |
| | | } |
| | | |
| | | List<OutBoundDetailsInput> WorkPieceInfoLst = input.WorkPieceInfoLst; |
| | |
| | | |
| | | List<WorkPieceInfo> db_WorkPieceInfoList = await _workPieceInfoRep.Where(w => queryOP80NewCodeList.Contains(w.OP80NewCode) && w.IsDeleted == false).ToListAsync(); |
| | | |
| | | var addOutBoundLogList = new List<WorkPieceOutboundRecord>(); |
| | | |
| | | foreach (var item in WorkPieceInfoLst) |
| | | { |
| | | var itemModel = db_itemModelList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode); |
| | | var itemModel = db_itemModelList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode && w.IsDeleted == false); |
| | | if (itemModel != null) |
| | | { |
| | | //itemModel.IsDeleted = true; |
| | | //itemModel.Remark = itemModel.Remark ?? "" + "二次发货自动撤销发货"; |
| | | //await _workPieceOutboundRep.UpdateAsync(itemModel); |
| | | |
| | | /* |
| | | var createitme = itemModel.CreatedTime == null ? "" : (((DateTimeOffset)itemModel.CreatedTime).UtcDateTime.ToString("yyyy-MM-dd HH:mm:ss")); |
| | | throw Oops.Oh($"成品码{itemModel.OP80NewCode}已出库,出库时间:{createitme}"); |
| | | |
| | | //*/ |
| | | |
| | | //不再提示出来,自动忽略 【Editby shaocx,2024-09-04】 |
| | | continue; |
| | | } |
| | | var workPiece = db_WorkPieceInfoList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode); |
| | | if (workPiece != null) |
| | | { |
| | | workPiece.OutPerson = CurrentUserInfo.Name; |
| | | workPiece.OutRemark = "撤销工件出库"; |
| | | workPiece.OutRemark = "撤销工件入库"; |
| | | workPiece.OutTime = DateTime.Now; |
| | | workPiece.IsOut = false; |
| | | |
| | |
| | | }; |
| | | addOutBoundList.Add(outBoundLog); |
| | | |
| | | var outBoundLogRecord = new WorkPieceOutboundRecord |
| | | { |
| | | OperationType = OutboundOperationType.入库.ToString(), |
| | | WorkPieceID = workPiece?.WorkPieceID, |
| | | OP80NewCode = item.OP80NewCode, |
| | | |
| | | CreatedUserId = CurrentUserInfo.UserId, |
| | | CreatedUserName = CurrentUserInfo.Name, |
| | | |
| | | |
| | | //CarNo = input.CarNo, |
| | | Remark = "工件入库", |
| | | |
| | | }; |
| | | addOutBoundLogList.Add(outBoundLogRecord); |
| | | |
| | | |
| | | } |
| | | await _workPieceOutboundRep.InsertAsync(addOutBoundList); |
| | | |
| | | await _workPieceOutboundRecordRep.InsertAsync(addOutBoundLogList); |
| | | |
| | | return "出库成功"; |
| | | } |
| | | |