| | |
| | | using iWare_SCADA_BusinessLogical; |
| | | using iWare_SCADA_BusinessLogical.BLL; |
| | | using iWare_SCADA_BusinessLogical.BLL.Important; |
| | | using iWare_SCADA_BusinessLogical.Utils; |
| | | using iWare_SCADA_Model; |
| | | using Microsoft.VisualStudio.TestTools.UnitTesting; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data.Entity.Validation; |
| | | using System.IO; |
| | | using System.Linq; |
| | | |
| | |
| | | [TestClass] |
| | | public class UnitTest1 |
| | | { |
| | | [TestMethod] |
| | | public void TestMethoEntityValidationErrors() |
| | | { |
| | | var aa = ""; |
| | | WorkPieceInfo cur_db_info = new WorkPieceInfo() |
| | | { |
| | | WorkingProcedureCurrent = "OP05" |
| | | }; |
| | | |
| | | try |
| | | { |
| | | using (DbModel db = new DbModel()) |
| | | { |
| | | db.WorkPieceInfo.Add(cur_db_info); |
| | | db.SaveChanges(); |
| | | } |
| | | } |
| | | catch (DbEntityValidationException dbEx) |
| | | { |
| | | //var bb = dbEx.EntityValidationErrors.ToList(); |
| | | //var pp = bb.First().ValidationErrors.ToList(); |
| | | //var z = JsonConvert.SerializeObject(pp); |
| | | |
| | | var errorMessages = |
| | | dbEx.EntityValidationErrors |
| | | .SelectMany(validationResult => validationResult.ValidationErrors) |
| | | .Select(m => m.ErrorMessage); |
| | | |
| | | var fullErrorMessage = string.Join(", ", errorMessages); |
| | | |
| | | //throw new DbEntityValidationException(exceptionMessage, exception.EntityValidationErrors); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | [TestMethod] |
| | | public void TestMetho22() |
| | | { |
| | | var aa = ""; |
| | | WorkPieceInfo cur_db_info = new WorkPieceInfo() |
| | | { |
| | | WorkingProcedureCurrent = "OP05" |
| | | }; |
| | | WorkPieceInfoManager.SetWorkingProcedureCurrentForOP10(cur_db_info, ref aa); |
| | | } |
| | | |
| | | [TestMethod] |
| | | public void TestMethod1() |
| | | { |
| | |
| | | WorkingProcedure = "OP30", |
| | | WorkPieceID = "DZ045L2406240103521TAS", |
| | | UpdatedTime = DateTime.Now, |
| | | QualityState = (int)QualityState.NG, |
| | | QualityNoOk = (int)QualityNoOkEnum.OP30涨断工位力矩大, |
| | | QualityNoOkReason = QualityNoOkEnum.OP30涨断工位力矩大.ToString(), |
| | | QualityState = (int)QualityStateEnum.NG, |
| | | QualityNoOk = (int)QualityNoOkEnum.OP30涨断工位力矩超差, |
| | | QualityNoOkReason = QualityNoOkEnum.OP30涨断工位力矩超差.ToString(), |
| | | MonitoringPoint = "", |
| | | QualityStateStr = "NG" |
| | | } |
| | |
| | | WorkPieceInfoManager.SetLogMiddleForQuality(ref logMiddle); |
| | | |
| | | //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表 |
| | | WorkPieceInfoManager.QualityInfoComplete(logMiddle, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure)); |
| | | QualityInfoCompleteManager.QualityInfoComplete(logMiddle, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure)); |
| | | |
| | | |
| | | string cc = ""; |