Browse Source

调整出料精度问题!

master
fyf 11 months ago
parent
commit
28104345fc
7 changed files with 55 additions and 12 deletions
  1. +1
    -1
      app/src/main/java/com/bonait/bnframework/business/ExecuteTest.java
  2. +11
    -3
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +31
    -0
      app/src/main/java/com/bonait/bnframework/common/helper/RangeInputFilter.java
  4. +8
    -5
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_message.java
  5. +2
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_silos_cl.java
  6. +1
    -1
      app/src/main/res/layout/item/layout/dialog_silos_message.xml
  7. +1
    -1
      app/src/main/res/layout/item/layout/fragment_item_silos_cl.xml

+ 1
- 1
app/src/main/java/com/bonait/bnframework/business/ExecuteTest.java View File

@@ -127,7 +127,7 @@ public class ExecuteTest {
public static void Write_PLC_Material(int silos, int val) {
try {
if(IsForcedEnd){ return;}
ToastUtils.info("准备写入PLC仓号需求:" + silos + "," + val / 10.0);
ToastUtils.info("准备写入PLC仓号需求:" + silos + "," + val );

String name = "料仓" + silos + "下料完成";
ExecuteTheRecipe.WritePLC(name, false, null);


+ 11
- 3
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -211,11 +211,17 @@ public class ExecuteTheRecipe {
String[] wl = item.split("[,]");
if (wl != null && wl.length == 2) {
String name = wl[0];
int val = (int) Math.round((Double.parseDouble(wl[1]) * 10));
//int val = (int) Math.round((Double.parseDouble(wl[1]) * 10));
int val = (int) Math.round((Double.parseDouble(wl[1])));
//int val = Integer.parseInt(wl[1]);
List<BPA_SILOS> bpa_silos = QueryDB.GetSolisByMaterialName(name);
if (bpa_silos.size() > 0 && val > 0) {
BPA_SILOS silos = bpa_silos.get(0);
if(val>=32767)
{
val=32767;
ThreadWhile("料仓" + silos.num + "出量克数溢出,已按照最大出量出料!!!");
}
formulation.put(silos, val);
}
}
@@ -337,7 +343,8 @@ public class ExecuteTheRecipe {
if (ExecuteCurrentOperation != null) {
ExecuteCurrentOperation.Run("液体料|" + silos.num);
}
ExecuteTheRecipe.showlog("准备写入PLC仓号需求:" + silos.num + "," + val / 10.0);
//ExecuteTheRecipe.showlog("准备写入PLC仓号需求:" + silos.num + "," + val / 10.0);
ExecuteTheRecipe.showlog("准备写入PLC仓号需求:" + silos.num + "," + val);

String name = "料仓" + silos.num + "下料完成";
ExecuteTheRecipe.WritePLC(name, false, null);
@@ -754,7 +761,8 @@ public class ExecuteTheRecipe {
val = Integer.parseInt(value);
} else if (key.contains("出料克数")) {
//1000.0 10000/3 3333
cl_value = (int) Math.round((Double.parseDouble(value) * 10));
//cl_value = (int) Math.round((Double.parseDouble(value) * 10));
cl_value = (int) Math.round((Double.parseDouble(value)));
}
}



+ 31
- 0
app/src/main/java/com/bonait/bnframework/common/helper/RangeInputFilter.java View File

@@ -0,0 +1,31 @@
package com.bonait.bnframework.common.helper;

import android.text.InputFilter;
import android.text.Spanned;

public class RangeInputFilter implements InputFilter {
private int min;
private int max;

public RangeInputFilter(int min, int max) {
this.min = min;
this.max = max;
}

@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
try {
int input = Integer.parseInt(dest.toString() + source.toString());
if (isInRange(input)) {
return null;
}
} catch (NumberFormatException e) {
return null;
}
return "";
}

private boolean isInRange(int value) {
return value >= min && value <= max;
}
}

+ 8
- 5
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_message.java View File

@@ -174,12 +174,13 @@ public class add_silos_message extends LinearLayout {
}
int jzzl_1 = 0;
try {
jzzl_1 = (int) Math.round((Double.parseDouble(jzzl) * 10));
//jzzl_1 = (int) Math.round((Double.parseDouble(jzzl) * 10));
jzzl_1 = (int) Math.round((Double.parseDouble(jzzl)));// ()int) Math.round((Double.parseDouble(jzzl)));
} catch (Exception e) {
ToastUtils.error("校准重量!" + e.getMessage());
return;
}
ExecuteTheRecipe.WritePLC("料仓"+mode.num+"校准值",(short)jzzl_1,null);
ExecuteTheRecipe.WritePLC("料仓"+mode.num+"校准值",jzzl_1,null);
ToastUtils.warning("调料标定成功!");
break;
case R.id.save_ghtl:
@@ -316,16 +317,18 @@ public class add_silos_message extends LinearLayout {
@Override
public void run() {

String jzz="0.0";
String jzz="0";
Object obj1= ExecuteTheRecipe.ReadPLC("料仓"+mode.num+"校准值");
if(obj1!=null)
{
String s = String.valueOf(obj1);
jzz = String.format("%.1f", (Double.parseDouble(s) / 10));
//jzz = String.format("%.1f", (Double.parseDouble(s) / 10));
jzz = s;//String.format("%.1f", (Double.parseDouble(s)));
}else
{
String s = String.valueOf(0);
jzz = String.format("%.1f", (Double.parseDouble(s) / 10));
jzz = "0";//String.format("%.1f", (Double.parseDouble(s)));
//jzz = String.format("%.1f", (Double.parseDouble(s) / 10));
}
String finalJzz = jzz;
activity.runOnUiThread(new Runnable() {


+ 2
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_silos_cl.java View File

@@ -56,7 +56,8 @@ public class fragment_silos_cl extends LinearLayout {
return;
}

int val1 = (int)Math.round((Double.parseDouble(text) * 10));
//int val1 = (int)Math.round((Double.parseDouble(text) * 10));
int val1 = (int)Math.round((Double.parseDouble(text)));

//Short val=(short)val1;
ExecuteTheRecipe.WritePLC("料仓" + model.num + "需求值", val1, new IWriteCallBack() {


+ 1
- 1
app/src/main/res/layout/item/layout/dialog_silos_message.xml View File

@@ -157,7 +157,7 @@
android:layout_marginTop="80dp"
android:layout_marginRight="140dp"
android:background="@drawable/input_bj"
android:digits="0123456789."
android:digits="0123456789"
android:hint="请输入制作时长"
android:inputType="text"
android:maxLines="1"


+ 1
- 1
app/src/main/res/layout/item/layout/fragment_item_silos_cl.xml View File

@@ -28,7 +28,7 @@
android:background="@drawable/input_bj"
android:hint="请写入需求值"
android:layout_weight="1"
android:inputType="number|numberDecimal"
android:inputType="number"
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp"


Loading…
Cancel
Save