|
|
@@ -35,6 +35,7 @@ namespace UAS_MES.Make
|
|
|
//是否通过串口获取数据
|
|
|
bool GetData = true;
|
|
|
string LastSncode;
|
|
|
+ bool WeightChange = false;
|
|
|
|
|
|
string ErrorMessage;
|
|
|
|
|
|
@@ -121,6 +122,10 @@ namespace UAS_MES.Make
|
|
|
}
|
|
|
}
|
|
|
//如果未打开串口设置为0
|
|
|
+ if (pr_colorboxunit.Text == "kg" && !WeightChange)
|
|
|
+ {
|
|
|
+ weight.Text = (float.Parse(weight.Text) / 1000).ToString();
|
|
|
+ }
|
|
|
double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text);
|
|
|
if ((ActualWeight >= MinWeight) && (ActualWeight <= MaxWeight))
|
|
|
{
|
|
|
@@ -173,7 +178,13 @@ namespace UAS_MES.Make
|
|
|
{
|
|
|
weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
|
|
|
if (pr_colorboxunit.Text == "kg")
|
|
|
+ {
|
|
|
weight.Text = (float.Parse(weight.Text) / 1000).ToString();
|
|
|
+ WeightChange = true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ WeightChange = false;
|
|
|
+ }
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|