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" };