|
@@ -42,7 +42,8 @@ namespace UAS_MES.Make
|
|
|
int MaxWeight;
|
|
int MaxWeight;
|
|
|
//最小重量
|
|
//最小重量
|
|
|
int MinWeight;
|
|
int MinWeight;
|
|
|
-
|
|
|
|
|
|
|
+ //重量倍率
|
|
|
|
|
+ int Wetghtunit =1;
|
|
|
DataTable ListC = new DataTable();
|
|
DataTable ListC = new DataTable();
|
|
|
|
|
|
|
|
Thread InitPrint;
|
|
Thread InitPrint;
|
|
@@ -116,15 +117,17 @@ namespace UAS_MES.Make
|
|
|
string _weight = dt.Rows[0]["pr_cartongw"].ToString();
|
|
string _weight = dt.Rows[0]["pr_cartongw"].ToString();
|
|
|
string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
|
|
string _maxweight = dt.Rows[0]["pr_cartonmaxw"].ToString();
|
|
|
string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
|
|
string _minweight = dt.Rows[0]["pr_cartonminw"].ToString();
|
|
|
|
|
+ string pa_pr_cartonunit = dt.Rows[0]["pr_cartonunit"].ToString();
|
|
|
Weight = int.Parse(_weight == "" ? "0" : _weight);
|
|
Weight = int.Parse(_weight == "" ? "0" : _weight);
|
|
|
MaxWeight = int.Parse(_maxweight == "" ? "0" : _maxweight);
|
|
MaxWeight = int.Parse(_maxweight == "" ? "0" : _maxweight);
|
|
|
MinWeight = int.Parse(_minweight == "" ? "0" : _minweight);
|
|
MinWeight = int.Parse(_minweight == "" ? "0" : _minweight);
|
|
|
pa_totalqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
|
|
pa_totalqty = int.Parse(dt.Rows[0]["pa_totalqty"].ToString());
|
|
|
|
|
+ Wetghtunit = int.Parse(pa_pr_cartonunit == "kg" ?"1000":"1");
|
|
|
if (Weight - MinWeight == MaxWeight - Weight)
|
|
if (Weight - MinWeight == MaxWeight - Weight)
|
|
|
pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight);
|
|
pr_cartongw.Text = Weight + "±" + (MaxWeight - Weight);
|
|
|
else
|
|
else
|
|
|
pr_cartongw.Text = MinWeight + "-" + MaxWeight;
|
|
pr_cartongw.Text = MinWeight + "-" + MaxWeight;
|
|
|
- int ActualWeight = int.Parse(weight.Text == "" ? "0" : weight.Text);
|
|
|
|
|
|
|
+ double ActualWeight = double.Parse(weight.Text == "" ? "0" : weight.Text);
|
|
|
//称量合格或不合格都记录重量
|
|
//称量合格或不合格都记录重量
|
|
|
if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
|
|
if (ActualWeight >= MinWeight && ActualWeight <= MaxWeight)
|
|
|
{
|
|
{
|
|
@@ -164,7 +167,7 @@ namespace UAS_MES.Make
|
|
|
{
|
|
{
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- weight.Text = Regex.Replace(serialPort1.ReadLine(), "\\D+", "");
|
|
|
|
|
|
|
+ weight.Text = Double.Parse(Regex.Replace(serialPort1.ReadLine(), "\\D+", ""))/ Wetghtunit+"";
|
|
|
}
|
|
}
|
|
|
catch (Exception)
|
|
catch (Exception)
|
|
|
{
|
|
{
|