From 2f2a247f1335feae7e9386dbe38115d35a40f7d3 Mon Sep 17 00:00:00 2001 From: nodyang Date: Thu, 26 Oct 2023 15:21:09 +0800 Subject: [PATCH] =?UTF-8?q?short=20=20=E7=B1=BB=E5=9E=8B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoControl/GelerWeterControl.cs | 16 +++++++------- .../LjMixManager/LjMixManagerDb.cs | 6 ++--- .../LjMixManager/RecipePlcView.cs | 6 ++--- .../LjPlanning/Db/LjFormulaDb.cs | 6 ++--- .../LjPlanning/Entity/LjFormulaDetail.cs | 6 ++--- .../LjPlanning/LjPlanningPlcHelp.cs | 22 ++++++++++--------- 6 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs index f687c59..5257f3a 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs @@ -150,13 +150,13 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl RecipePlcView recipe1 = new RecipePlcView() { - Bin = (ushort)StockMaterrialDbHelp.GetCodeById(bin1), + Bin = (short)StockMaterrialDbHelp.GetCodeById(bin1), Set = Convert.ToSingle(ControlsEntity.MaterialWeight1.MCValue.ToString()), Tolerance = Convert.ToSingle(ControlsEntity.MaterialTolerance1.MCValue.ToString()), }; RecipePlcView recipe2 = new RecipePlcView() { - Bin = (ushort)StockMaterrialDbHelp.GetCodeById(bin2), + Bin = (short)StockMaterrialDbHelp.GetCodeById(bin2), Set = Convert.ToSingle(ControlsEntity.MaterialWeight2.MCValue.ToString()), Tolerance = Convert.ToSingle(ControlsEntity.MaterialTolerance2.MCValue.ToString()), }; @@ -178,7 +178,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl Step step3 = new Step() { MixCode = 3, - MixTime = Convert.ToUInt16(ControlsEntity.GelPosTimeC.MCValue.ToString()), + MixTime = Convert.ToInt16(ControlsEntity.GelPosTimeC.MCValue.ToString()), MixTemp = Convert.ToSingle(ControlsEntity.GelPosTimeA.MCValue.ToString()), MixSpeed = Convert.ToSingle(ControlsEntity.GelNagTimeB.MCValue.ToString()) }; @@ -189,7 +189,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl Step step5 = new Step() { MixCode = 5, - MixTime = Convert.ToUInt16(ControlsEntity.GelWaterTime.MCValue.ToString()) + MixTime = Convert.ToInt16(ControlsEntity.GelWaterTime.MCValue.ToString()) }; Step step6 = new Step() { @@ -198,12 +198,12 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl Step step7 = new Step() { MixCode = 5, - MixTime = Convert.ToUInt16(ControlsEntity.GelWaitTime.MCValue.ToString()) + MixTime = Convert.ToInt16(ControlsEntity.GelWaitTime.MCValue.ToString()) }; Step step8 = new Step() { MixCode = 7, - MixTime = Convert.ToUInt16(ControlsEntity.GelCloseHeatTime.MCValue.ToString()), + MixTime = Convert.ToInt16(ControlsEntity.GelCloseHeatTime.MCValue.ToString()), MixTemp = Convert.ToSingle(ControlsEntity.GelOutDelayTime.MCValue.ToString()) }; @@ -230,7 +230,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl MixStep mixStep3 = new MixStep() { MixCode = 3, - MixTime = Convert.ToUInt16(ControlsEntity.WetMixTime.MCValue.ToString()) + MixTime = Convert.ToInt16(ControlsEntity.WetMixTime.MCValue.ToString()) }; MixStep mixStep4 = new MixStep() { @@ -239,7 +239,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl MixStep mixStep5 = new MixStep() { MixCode = 5, - MixTime = Convert.ToUInt16(ControlsEntity.WetOutDelayTime.MCValue.ToString()), + MixTime = Convert.ToInt16(ControlsEntity.WetOutDelayTime.MCValue.ToString()), }; mixSteps.Add(mixStep1); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/LjMixManagerDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/LjMixManagerDb.cs index f5ab70c..a058cbf 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/LjMixManagerDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/LjMixManagerDb.cs @@ -269,7 +269,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixManager { RecipePlcView view = new RecipePlcView() { - Bin = Convert.ToUInt16(dataTableRow["Code"]), + Bin = Convert.ToInt16(dataTableRow["Code"]), Set = Convert.ToSingle(dataTableRow["Weight"]), Tolerance = Convert.ToSingle(dataTableRow["Weight"]) }; @@ -294,9 +294,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixManager { Step step = new Step(); //代码 - step.MixCode = Convert.ToUInt16(tableRow["ActionId"]); + step.MixCode = Convert.ToInt16(tableRow["ActionId"]); //时间 - step.MixTime = Convert.ToUInt16(tableRow["SecondTime"]); + step.MixTime = Convert.ToInt16(tableRow["SecondTime"]); //温度 step.MixTemp = Convert.ToInt32(tableRow["SecondTime"]); //速度 diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/RecipePlcView.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/RecipePlcView.cs index 91dc7c4..f356c65 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/RecipePlcView.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/RecipePlcView.cs @@ -2,15 +2,15 @@ { public class RecipePlcView { - public ushort Bin { get; set; } + public short Bin { get; set; } public float Set { get; set; } public float Tolerance { get; set; } } public class Step { - public ushort MixCode { get; set; } - public ushort MixTime { get; set; } + public short MixCode { get; set; } + public short MixTime { get; set; } public float MixTemp { get; set; } public float MixSpeed { get; set; } } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/Db/LjFormulaDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/Db/LjFormulaDb.cs index 047a930..b534809 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/Db/LjFormulaDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/Db/LjFormulaDb.cs @@ -111,7 +111,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning.Db LjFormulaDetail detail = new LjFormulaDetail(); detail.Id = Convert.ToInt32(item["id"].ToString()); detail.FormulaId = formulaId; - detail.BinNo = Convert.ToUInt16(item["BinNo"]); + detail.BinNo = Convert.ToInt16(item["BinNo"]); detail.MId = Convert.ToInt32(item["MId"]); detail.MName = item["MName"].ToString(); detail.Weight = Convert.ToSingle(item["Weight"]); @@ -119,9 +119,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning.Db detail.Machine = Convert.ToString(item["Machine"]); detail.MachineType = item["MachineType"].ToString(); detail.FormulaType = Convert.ToInt32(item["FormulaType"]); - detail.ActionCode = Convert.ToUInt16(item["ActionCode"]); + detail.ActionCode = Convert.ToInt16(item["ActionCode"]); detail.ActionName = item["ActionName"].ToString(); - detail.TimeInfo = Convert.ToUInt16(item["TimeInfo"].ToString()); + detail.TimeInfo = Convert.ToInt16(item["TimeInfo"].ToString()); detail.Temp = Convert.ToSingle(item["Temp"].ToString()); detail.Speed = Convert.ToSingle(item["Speed"].ToString()); detail.SetValue = Convert.ToSingle(item["SetValue"].ToString()); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/Entity/LjFormulaDetail.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/Entity/LjFormulaDetail.cs index e91a000..6a44f56 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/Entity/LjFormulaDetail.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/Entity/LjFormulaDetail.cs @@ -7,7 +7,7 @@ public int FormulaId { get; set; } - public ushort BinNo { get; set; } + public short BinNo { get; set; } public int MId { get; set; } @@ -23,11 +23,11 @@ public int FormulaType { get; set; } - public ushort ActionCode { get; set; } + public short ActionCode { get; set; } public string ActionName { get; set; } - public ushort TimeInfo { get; set; } + public short TimeInfo { get; set; } public float Temp { get; set; } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs index 43d812b..7210b0f 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs @@ -486,8 +486,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning var bytes = data.Skip(i * 10).Take(10).ToArray(); RecipePlcView plcView = new RecipePlcView { - Bin = byteTransform.TransUInt16(bytes, 0), - Set = byteTransform.TransUInt16(bytes, 2), + Bin = byteTransform.TransInt16(bytes, 0), + Set = byteTransform.TransSingle(bytes, 2), Tolerance = byteTransform.TransSingle(bytes, 6) }; ls.Add(plcView); @@ -503,8 +503,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning var bytes = data.Skip(i * 10).Take(12).ToArray(); Step step = new Step() { - MixCode = byteTransform.TransUInt16(bytes, 0), - MixTime = byteTransform.TransUInt16(bytes, 2), + MixCode = byteTransform.TransInt16(bytes, 0), + MixTime = byteTransform.TransInt16(bytes, 2), MixTemp = byteTransform.TransSingle(bytes, 4), MixSpeed = byteTransform.TransSingle(bytes, 8) }; @@ -534,8 +534,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning var bytes = data.Skip(i * 10).Take(10).ToArray(); RecipePlcView plcView = new RecipePlcView { - Bin = byteTransform.TransUInt16(bytes, 0), - Set = byteTransform.TransUInt16(bytes, 2), + Bin = byteTransform.TransInt16(bytes, 0), + Set = byteTransform.TransSingle(bytes, 2), Tolerance = byteTransform.TransSingle(bytes, 6) }; ls.Add(plcView); @@ -551,8 +551,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning var bytes = data.Skip(i * 10).Take(12).ToArray(); Step step = new Step() { - MixCode = byteTransform.TransUInt16(bytes, 0), - MixTime = byteTransform.TransUInt16(bytes, 2), + MixCode = byteTransform.TransInt16(bytes, 0), + MixTime = byteTransform.TransInt16(bytes, 2), MixTemp = byteTransform.TransSingle(bytes, 4), MixSpeed = byteTransform.TransSingle(bytes, 8) }; @@ -581,14 +581,16 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning var data = operateResult.Content; + for (int i = 0; i < 10; i++) { var bytes = data.Skip(i * 10).Take(20).ToArray(); MixStep step = new MixStep() { - MixCode = byteTransform.TransUInt16(bytes, 0), - MixTime = byteTransform.TransUInt16(bytes, 2), + + MixCode = byteTransform.TransInt16(bytes, 0), + MixTime = byteTransform.TransInt16(bytes, 2), MixTemp = byteTransform.TransSingle(bytes, 4), MixSpeed = byteTransform.TransSingle(bytes, 8), SetValue = byteTransform.TransSingle(bytes, 12),