| | |
| | | |
| | | using iWare.Wms.Core; |
| | | using iWare_SCADA_Model; |
| | | using log4net; |
| | | using Newtonsoft.Json; |
| | |
| | | |
| | | //不正常的码写入数据库 |
| | | var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(workPieceID); |
| | | PieceLogTypeEnum pieceLogTypeEnum = PieceLogTypeEnum.正常; |
| | | if (isRight == false) |
| | | { |
| | | WorkPieceLog workPieceLog = new WorkPieceLog() |
| | | { |
| | | Id = Yitter.IdGenerator.YitIdHelper.NextId(), |
| | | WorkPieceID = workPieceID, |
| | | WorkingProcedure = _dataCaptureConfig.WorkingProcedure, |
| | | CreatedTime = DateTime.Now, |
| | | CreatedUserName = _dataCaptureConfig.DataCapturePointCode, |
| | | MyRemarks = "读码值异常", |
| | | Remarks = "读码值异常" |
| | | }; |
| | | using (DbModel db = new DbModel()) |
| | | { |
| | | db.WorkPieceLog.Add(workPieceLog); |
| | | db.SaveChanges(); |
| | | } |
| | | pieceLogTypeEnum = PieceLogTypeEnum.读码值异常; |
| | | } |
| | | WorkPieceLog workPieceLog = new WorkPieceLog() |
| | | { |
| | | Id = Yitter.IdGenerator.YitIdHelper.NextId(), |
| | | WorkPieceID = workPieceID, |
| | | WorkingProcedure = _dataCaptureConfig.WorkingProcedure, |
| | | CreatedTime = DateTime.Now, |
| | | CreatedUserName = _dataCaptureConfig.DataCapturePointCode, |
| | | MyRemarks = "", |
| | | Remarks = pieceLogTypeEnum.ToString(), |
| | | PieceLogType = (int)pieceLogTypeEnum, |
| | | PieceLogTypeName = pieceLogTypeEnum.ToString() |
| | | }; |
| | | using (DbModel db = new DbModel()) |
| | | { |
| | | db.WorkPieceLog.Add(workPieceLog); |
| | | db.SaveChanges(); |
| | | } |
| | | } |
| | | catch (Exception ex) |