| | |
| | | using iWare_SCADA_BusinessLogical.Utils; |
| | | 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; |
| | | |
| | | namespace iWare_SCADA_Test |
| | | { |
| | | [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() |
| | | { |
| | |
| | | File.Move(file.FullName, "../CA4GC20TD_COPY/" + file.Name);//移动 |
| | | } |
| | | } |
| | | |
| | | |
| | | [TestMethod] |
| | | public void bb() |
| | | { |
| | | var aa = "-2024-06-16_08_43_23__part_"; |
| | | var bb = aa.Split('-'); |
| | | |
| | | string cc = bb[0]; |
| | | } |
| | | |
| | | [TestMethod] |
| | | public void zzz() |
| | | { |
| | | WorkPieceLogMiddle logMiddle = new WorkPieceLogMiddle( |
| | | ) |
| | | { |
| | | WorkingProcedure = "OP30" |
| | | } |
| | | ; |
| | | QualityDataInfo qualityData = new QualityDataInfo(); |
| | | //修改QualityDataInfo表 //重复收到质量信息,会覆盖之前的 |
| | | EntityPropHelper<WorkPieceLogMiddle, QualityDataInfo>.CopyProp(logMiddle, qualityData, WorkPieceInfoManager.GetQualityDataInfoUpdate(logMiddle, logMiddle.WorkingProcedure, logMiddle.MonitoringPoint));//指定修改字段 |
| | | |
| | | string cc = ""; |
| | | } |
| | | |
| | | [TestMethod] |
| | | public void pp() |
| | | { |
| | | Yitter.IdGenerator.IdGeneratorOptions options = new Yitter.IdGenerator.IdGeneratorOptions(1); |
| | | Yitter.IdGenerator.YitIdHelper.SetIdGenerator(options); |
| | | |
| | | WorkPieceLogMiddle logMiddle = new WorkPieceLogMiddle( |
| | | ) |
| | | { |
| | | WorkingProcedure = "OP30", |
| | | WorkPieceID = "DZ045L2406240103521TAS", |
| | | UpdatedTime = DateTime.Now, |
| | | QualityState = (int)QualityStateEnum.NG, |
| | | QualityNoOk = (int)QualityNoOkEnum.OP30涨断工位力矩超差, |
| | | QualityNoOkReason = QualityNoOkEnum.OP30涨断工位力矩超差.ToString(), |
| | | MonitoringPoint = "", |
| | | QualityStateStr = "NG" |
| | | } |
| | | ; |
| | | string WorkingProcedure = logMiddle.WorkingProcedure; |
| | | //根据质量数据判断是否合格/不合格 【Editby shaocx,2024-06-25】 |
| | | WorkPieceInfoManager.SetLogMiddleForQuality(ref logMiddle); |
| | | |
| | | //更新WorkPieceInfo表以及插入WorkPieceLog表和WorkPieceInfoLog表 |
| | | QualityInfoCompleteManager.QualityInfoComplete(logMiddle, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure)); |
| | | |
| | | |
| | | string cc = ""; |
| | | } |
| | | |
| | | [TestMethod] |
| | | public void aaaaa() |
| | | { |
| | | //获取OP70未结束的工件列表 |
| | | var ooDateTime = Convert.ToDateTime("0001-01-01"); |
| | | List<WorkPieceProcess> noFinishWorkPieceProcessList = null; |
| | | using (DbModel db = new DbModel()) |
| | | { |
| | | var dateTime = DateTime.Now; |
| | | noFinishWorkPieceProcessList = db.WorkPieceProcess.Where(x => |
| | | 1 == 1 |
| | | && x.WorkingProcedureCurrent == "OP70" |
| | | && x.EndTime == ooDateTime).ToList(); |
| | | } |
| | | |
| | | |
| | | string cc = ""; |
| | | } |
| | | } |
| | | } |