From c7d51c4f236b5302804c9ddc975e80d27edfbbcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Wed, 10 Apr 2024 09:04:35 +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/HomeForm.cs | 24 +++++++++++++++---- ProductionSystem/Untils/Tool/UxTool.cs | 4 +++- .../DbModel/T_Product_Step.cs | 6 +++-- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ProductionSystem/Forms/HomeForm.cs b/ProductionSystem/Forms/HomeForm.cs index 1141275..5b85f6d 100644 --- a/ProductionSystem/Forms/HomeForm.cs +++ b/ProductionSystem/Forms/HomeForm.cs @@ -32,6 +32,8 @@ using NewLife.Security; using ProductionSystem.Untils.Tool; using DevExpress.Data.Diagram.Core; using SqlSugar; +using ProductionSystem_Model.DbModel; +using NewLife.Reflection; namespace ProductionSystem.Forms { @@ -746,17 +748,19 @@ namespace ProductionSystem.Forms - + ProductStepService stepService = new ProductStepService(); - var d1300Value = GetPlcValue("D1300"); + var d1300Value = GetPlcValue("D1300"); string[] str = new[] { "COM9", "COM10" }; //步骤1水泵1空载 if(Convert.ToInt32(Double.Parse(d1300Value).ToString("0")) == 0) { - + T_Product_Step step=new T_Product_Step(); + + - middleIsCanRound = false; + middleIsCanRound = false; @@ -789,7 +793,17 @@ namespace ProductionSystem.Forms var ya= uxTool.ToAction(); - + step.Id = Guid.NewGuid().ToString("N"); + step.ReturnValue = uxTool.Val; + step.WriteValue = uxTool.Write; + step.CreateTime = DateTime.Now; + step.ProductType = Program.ProductType; + step.EquipmentName = "SB1"; + step.StepName = ""; + + stepService.AddProductStep(step); + + Thread.Sleep(2000); diff --git a/ProductionSystem/Untils/Tool/UxTool.cs b/ProductionSystem/Untils/Tool/UxTool.cs index a4ff2cc..3aa6a0e 100644 --- a/ProductionSystem/Untils/Tool/UxTool.cs +++ b/ProductionSystem/Untils/Tool/UxTool.cs @@ -30,11 +30,13 @@ namespace ProductionSystem.Untils.Tool public string Val { get; set; } + public string Write { get; set; } + public bool ToAction() { uint seep = uint.Parse((mo * 0.4).ToString()); - + Write = seep.ToString(); XTrace.WriteLine("真实速度:{0}", seep); MFMsgVariable me = new MFMsgVariable(8); diff --git a/ProductionSystem_Model/DbModel/T_Product_Step.cs b/ProductionSystem_Model/DbModel/T_Product_Step.cs index e61b301..a3f956b 100644 --- a/ProductionSystem_Model/DbModel/T_Product_Step.cs +++ b/ProductionSystem_Model/DbModel/T_Product_Step.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Security.Principal; using System.Text; using System.Threading.Tasks; @@ -13,7 +14,8 @@ namespace ProductionSystem_Model.DbModel public class T_Product_Step { [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] - public int Id { get; set; } + + public string Id { get; set; } [SugarColumn(ColumnName = "step_name")] public string StepName { get; set; } @@ -27,7 +29,7 @@ namespace ProductionSystem_Model.DbModel [SugarColumn(ColumnName = "return_value")] public string ReturnValue { get; set; } - [SugarColumn(ColumnName = "createdtime")] + [SugarColumn(ColumnName = "create_time")] public DateTime CreateTime { get; set; } [SugarColumn(ColumnName = "product_type")]