From 7c53baa6987b895296d526d3f07d6e95a3cc4f52 Mon Sep 17 00:00:00 2001 From: yangw Date: Sat, 13 Apr 2024 12:57:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProductionSystem/Forms/HomeFormInfo.cs | 45 ++++++++++++------- ProductionSystem/Untils/MFSerialInfo.cs | 14 ++++-- ProductionSystem/Untils/Tool/SitongTool.cs | 2 +- .../DbModel/T_Product_Step.cs | 3 ++ 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/ProductionSystem/Forms/HomeFormInfo.cs b/ProductionSystem/Forms/HomeFormInfo.cs index 0a4afcb..288923b 100644 --- a/ProductionSystem/Forms/HomeFormInfo.cs +++ b/ProductionSystem/Forms/HomeFormInfo.cs @@ -35,6 +35,7 @@ using SqlSugar; using ProductionSystem_Model.DbModel; using NewLife.Reflection; using System.Collections; +using System.Globalization; namespace ProductionSystem.Forms { @@ -737,40 +738,54 @@ namespace ProductionSystem.Forms step.ProductBarcode = GetCode(); var model = paraConfigService.GetParaTargetVal(ModeTypeEnum.BZ1_DB, Program.ProductType); - + Stopwatch stopwatch = new Stopwatch(); + + // 开始计时 + stopwatch.Start(); + //四通1 var stf1= model.STF1; int val = stf1.TargetVal.ToDouble().ToInt(); + val = 3; SitongTool sitongTool = new SitongTool(stf1.Com,val); var si1 = sitongTool.ToAction(); sitongTool.Dispose(); + stopwatch.Stop(); + var miao = stopwatch.Elapsed.TotalSeconds; + step.Id = Guid.NewGuid().ToString("N"); step.ReturnValue = sitongTool.Val; step.WriteValue = val.ToString(); step.CreateTime = DateTime.Now; step.EquipmentName = "FKSTF1ZT_DB"; - + step.Ms = miao.ToString(CultureInfo.InvariantCulture); stepService.AddProductStep(step); + stopwatch.Restart(); // //四通2 - // var stf2 = model.STF2; - // sitongTool = new SitongTool(stf2.Com, stf2.TargetVal.ToDouble().ToInt()); - // var si2 = sitongTool.ToAction(); - // sitongTool.Dispose(); - // - // step.Id = Guid.NewGuid().ToString("N"); - // step.ReturnValue = sitongTool.Val; - // step.WriteValue = val.ToString(); - // step.CreateTime = DateTime.Now; - // - // step.EquipmentName = "FKSTF2ZT_DB"; - // stepService.AddProductStep(step); + var stf2 = model.STF2; + sitongTool = new SitongTool(stf2.Com, stf2.TargetVal.ToDouble().ToInt()); + // var si2 = sitongTool.ToAction(); + sitongTool.Dispose(); + + step.Id = Guid.NewGuid().ToString("N"); + step.ReturnValue = sitongTool.Val; + step.WriteValue = val.ToString(); + step.CreateTime = DateTime.Now; + step.EquipmentName = "FKSTF2ZT_DB"; + step.Ms = miao.ToString(CultureInfo.InvariantCulture); + stepService.AddProductStep(step); + + stopwatch.Stop(); + miao = stopwatch.Elapsed.TotalSeconds; + + var ss = miao; // // // //// lin 1 com10 - // ////1 调试成功 + ////1 调试成功 // // //电子膨胀阀 // diff --git a/ProductionSystem/Untils/MFSerialInfo.cs b/ProductionSystem/Untils/MFSerialInfo.cs index 4e89c2a..52de341 100644 --- a/ProductionSystem/Untils/MFSerialInfo.cs +++ b/ProductionSystem/Untils/MFSerialInfo.cs @@ -27,7 +27,7 @@ namespace ProductionSystem.Untils { _mfser.Lin_Open(com, int.Parse(fre)); } - _timer = new TimerX(DoBackup, _mfser, 200, 300) { Async = true }; + _timer = new TimerX(DoBackup, _mfser, 100, 200) { Async = true }; @@ -81,6 +81,14 @@ namespace ProductionSystem.Untils public void SendMsg2(string data, int num = 3, int mill = 500) { + + + for (int i = 0; i < 8; i++) + { + + _mfser.SendMsg(Entrance, data); + Thread.Sleep(500); + } for (int i = 0; i < num; i++) { @@ -89,9 +97,7 @@ namespace ProductionSystem.Untils break; } - _mfser.SendMsg(Entrance, data); - Thread.Sleep(mill); - _mfser.SendLinMasterSend(Export); + Thread.Sleep(mill); _mfser.SendLinMasterSend(Export); diff --git a/ProductionSystem/Untils/Tool/SitongTool.cs b/ProductionSystem/Untils/Tool/SitongTool.cs index fb84ba2..ab0b9d9 100644 --- a/ProductionSystem/Untils/Tool/SitongTool.cs +++ b/ProductionSystem/Untils/Tool/SitongTool.cs @@ -145,7 +145,7 @@ namespace ProductionSystem.Untils.Tool }; - mfSerialInfo.SendMsg2(sendMes,50,500); + mfSerialInfo.SendMsg2(sendMes,10,300); return b; diff --git a/ProductionSystem_Model/DbModel/T_Product_Step.cs b/ProductionSystem_Model/DbModel/T_Product_Step.cs index f12c6d4..e054fc9 100644 --- a/ProductionSystem_Model/DbModel/T_Product_Step.cs +++ b/ProductionSystem_Model/DbModel/T_Product_Step.cs @@ -38,5 +38,8 @@ namespace ProductionSystem_Model.DbModel [SugarColumn(ColumnName = "product_barcode")] public string ProductBarcode { get; set; } + + [SugarColumn(ColumnName = "ms")] + public string Ms { get; set; } } }