| | |
| | | using iWare_SCADA_BusinessLogical.Utils; |
| | | using HslCommunication.BasicFramework; |
| | | using iWare_SCADA_BusinessLogical.Utils; |
| | | using iWare_SCADA_Model; |
| | | using iWare_SCADA_Model.MiddleModel; |
| | | using iWare_SCADA_Model.TableModel; |
| | |
| | | using System.Collections.Concurrent; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Data.Entity.Validation; |
| | | using System.Diagnostics; |
| | | //using System.Data.Entity.Infrastructure; |
| | | using System.Linq; |
| | |
| | | catch (Exception e) |
| | | { |
| | | loginfo.Remarks = (loginfo.Remarks ?? "") + $"读取二维码{loginfo.WorkPieceID ?? "空"}更新数据异常{e.Message}"; |
| | | Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}上线监控读码标记 读取工件码数据[{loginfo.WorkPieceID ?? "空"}]时异常:", e); |
| | | } |
| | | finally |
| | | { |
| | | loginfo.Id = Yitter.IdGenerator.YitIdHelper.NextId(); |
| | | db.WorkPieceLog.Add(loginfo); |
| | | |
| | | //保存数据库的异常捕捉 [Editby shaocx,2024-08-29] |
| | | try |
| | | { |
| | | db.SaveChanges(); |
| | | } |
| | | catch (DbEntityValidationException exception) |
| | | { |
| | | var errorMessages = |
| | | exception.EntityValidationErrors |
| | | .SelectMany(validationResult => validationResult.ValidationErrors) |
| | | .Select(m => m.ErrorMessage); |
| | | var fullErrorMessage = string.Join(", ", errorMessages); |
| | | var exceptionMessage = string.Concat(exception.Message, " 验证异常消息是:", fullErrorMessage); |
| | | |
| | | Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}上线监控读码标记 读取工件码数据[{loginfo.WorkPieceID ?? "空"}],保存数据库时异常:" + exceptionMessage, exception); |
| | | |
| | | throw new DbEntityValidationException(exceptionMessage, exception.EntityValidationErrors); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | {// OP10 没有上线扫码枪,约定用测量完成信号当上线标记,所以上线需要修改的字段放这里 |
| | | //上线是每次都插入 |
| | | |
| | | WorkPieceProcess process_05 = WorkPieceProcessHelper.CreateWorkPieceProcessForOP05(logMiddle, db, pieceInfo); |
| | | if (process_05 != null) |
| | | {//创建OP05工序,当没有05工序时,才创建 【Editby shaocx,2024-08-29】 |
| | | db.WorkPieceProcess.Add(process_05); |
| | | } |
| | | |
| | | WorkPieceProcess process = new WorkPieceProcess(); |
| | | process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(pieceInfo); |
| | | QualityStateHelper.ResetQualityNoOkForNewProcess(ref process); |