From 95b80dcb6eca2b0bd70ac8518b3ec113fc3d3d76 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Thu, 19 Jun 2025 16:53:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8D=95No.183901=09?= =?UTF-8?q?=E4=B8=87=E7=A6=8F=E6=9B=B4=E6=8D=A2=E6=96=B0=E7=A7=B0=EF=BC=8C?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E8=B0=83=E6=95=B4=E4=B8=8E=E7=A7=B0?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ButcherFactory.Form.csproj | 5 +- .../Controls/Utils/CombineWeightDataFormat.cs | 61 +++++++++++++++++++ ButcherFactory.Form/Controls/WeightControl.cs | 3 + .../Controls/WeightSettingFrom.cs | 2 +- 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 ButcherFactory.Form/Controls/Utils/CombineWeightDataFormat.cs diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj index fa4c52a..2b667ee 100644 --- a/ButcherFactory.Form/ButcherFactory.Form.csproj +++ b/ButcherFactory.Form/ButcherFactory.Form.csproj @@ -34,9 +34,9 @@ - + False - ..\ButcherFactory.Login\bin\Debug\BwpClientPrint.dll + ..\..\..\tsref\Debug\BwpClientPrint.dll @@ -117,6 +117,7 @@ + diff --git a/ButcherFactory.Form/Controls/Utils/CombineWeightDataFormat.cs b/ButcherFactory.Form/Controls/Utils/CombineWeightDataFormat.cs new file mode 100644 index 0000000..4452972 --- /dev/null +++ b/ButcherFactory.Form/Controls/Utils/CombineWeightDataFormat.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ButcherFactory.Controls +{ + internal class CombineWeightDataFormat : DataFormatBase + { + + public override int DataLength + { + get { return 17; } + } + + public override char Beginchar + { + get { return (char)0x02; } + } + + public override char Endchar + { + get { return (char)0x6B; } + } + + public override short Bufsize + { + get { return 17; } + } + + public override string ParseData(string buf, out bool isStatic) + { + isStatic = true; // 默认 为 稳定 + return buf.Substring(9, 7).Trim(); + } + + public override bool ParseAscii(string buf, out string weight, out bool isStatic) + { + isStatic = false; + weight = FindDataFrame(buf, DataLength); + + if (string.IsNullOrEmpty(weight)) + { + return false; + } + + weight = ParseData(weight, out isStatic); + + return true; + } + + public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) + { + isStatic = false; + weight = "0"; + subStr = ""; + return true; + } + } +} diff --git a/ButcherFactory.Form/Controls/WeightControl.cs b/ButcherFactory.Form/Controls/WeightControl.cs index f812b95..3af8fae 100644 --- a/ButcherFactory.Form/Controls/WeightControl.cs +++ b/ButcherFactory.Form/Controls/WeightControl.cs @@ -144,6 +144,9 @@ namespace ButcherFactory.Controls break; case "JST2018S": _dataFormat = new JST2018SDataFormat(); + break; + case "一体称"://02 10 53 54 2C 47 53 3A 20 30 30 30 31 2E 37 31 6B 67 A8 FE 00 49 01 00 AC 99 A8 FE 00 + _dataFormat = new CombineWeightDataFormat(); break; default: _dataFormat = new Xk3190D10DataFormat(); diff --git a/ButcherFactory.Form/Controls/WeightSettingFrom.cs b/ButcherFactory.Form/Controls/WeightSettingFrom.cs index cbebad7..52b1598 100644 --- a/ButcherFactory.Form/Controls/WeightSettingFrom.cs +++ b/ButcherFactory.Form/Controls/WeightSettingFrom.cs @@ -12,7 +12,7 @@ namespace ButcherFactory.Controls { public partial class WeightSettingFrom : Form { - List weight = new List { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10", "IND231", "AHS3000", "JST2018S" }; + List weight = new List { "IND560", "Xk3124", "Xk3190A9", "Xk3190D10", "IND231", "AHS3000", "JST2018S", "一体称" }; List com = new List { "COM1", "COM2", "COM3", "COM4", "COM5" }; List rate = new List { "1200", "2400", "4800", "7200", "9600" }; List bit = new List { "5", "6", "7", "8" };