@@ -127,7 +127,7 @@ public class ExecuteTest { | |||||
public static void Write_PLC_Material(int silos, int val) { | public static void Write_PLC_Material(int silos, int val) { | ||||
try { | try { | ||||
if(IsForcedEnd){ return;} | if(IsForcedEnd){ return;} | ||||
ToastUtils.info("准备写入PLC仓号需求:" + silos + "," + val / 10.0); | |||||
ToastUtils.info("准备写入PLC仓号需求:" + silos + "," + val ); | |||||
String name = "料仓" + silos + "下料完成"; | String name = "料仓" + silos + "下料完成"; | ||||
ExecuteTheRecipe.WritePLC(name, false, null); | ExecuteTheRecipe.WritePLC(name, false, null); | ||||
@@ -211,11 +211,17 @@ public class ExecuteTheRecipe { | |||||
String[] wl = item.split("[,]"); | String[] wl = item.split("[,]"); | ||||
if (wl != null && wl.length == 2) { | if (wl != null && wl.length == 2) { | ||||
String name = wl[0]; | 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]); | //int val = Integer.parseInt(wl[1]); | ||||
List<BPA_SILOS> bpa_silos = QueryDB.GetSolisByMaterialName(name); | List<BPA_SILOS> bpa_silos = QueryDB.GetSolisByMaterialName(name); | ||||
if (bpa_silos.size() > 0 && val > 0) { | if (bpa_silos.size() > 0 && val > 0) { | ||||
BPA_SILOS silos = bpa_silos.get(0); | BPA_SILOS silos = bpa_silos.get(0); | ||||
if(val>=32767) | |||||
{ | |||||
val=32767; | |||||
ThreadWhile("料仓" + silos.num + "出量克数溢出,已按照最大出量出料!!!"); | |||||
} | |||||
formulation.put(silos, val); | formulation.put(silos, val); | ||||
} | } | ||||
} | } | ||||
@@ -337,7 +343,8 @@ public class ExecuteTheRecipe { | |||||
if (ExecuteCurrentOperation != null) { | if (ExecuteCurrentOperation != null) { | ||||
ExecuteCurrentOperation.Run("液体料|" + silos.num); | 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 + "下料完成"; | String name = "料仓" + silos.num + "下料完成"; | ||||
ExecuteTheRecipe.WritePLC(name, false, null); | ExecuteTheRecipe.WritePLC(name, false, null); | ||||
@@ -754,7 +761,8 @@ public class ExecuteTheRecipe { | |||||
val = Integer.parseInt(value); | val = Integer.parseInt(value); | ||||
} else if (key.contains("出料克数")) { | } else if (key.contains("出料克数")) { | ||||
//1000.0 10000/3 3333 | //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))); | |||||
} | } | ||||
} | } | ||||
@@ -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; | |||||
} | |||||
} |
@@ -174,12 +174,13 @@ public class add_silos_message extends LinearLayout { | |||||
} | } | ||||
int jzzl_1 = 0; | int jzzl_1 = 0; | ||||
try { | 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) { | } catch (Exception e) { | ||||
ToastUtils.error("校准重量!" + e.getMessage()); | ToastUtils.error("校准重量!" + e.getMessage()); | ||||
return; | return; | ||||
} | } | ||||
ExecuteTheRecipe.WritePLC("料仓"+mode.num+"校准值",(short)jzzl_1,null); | |||||
ExecuteTheRecipe.WritePLC("料仓"+mode.num+"校准值",jzzl_1,null); | |||||
ToastUtils.warning("调料标定成功!"); | ToastUtils.warning("调料标定成功!"); | ||||
break; | break; | ||||
case R.id.save_ghtl: | case R.id.save_ghtl: | ||||
@@ -316,16 +317,18 @@ public class add_silos_message extends LinearLayout { | |||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
String jzz="0.0"; | |||||
String jzz="0"; | |||||
Object obj1= ExecuteTheRecipe.ReadPLC("料仓"+mode.num+"校准值"); | Object obj1= ExecuteTheRecipe.ReadPLC("料仓"+mode.num+"校准值"); | ||||
if(obj1!=null) | if(obj1!=null) | ||||
{ | { | ||||
String s = String.valueOf(obj1); | 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 | }else | ||||
{ | { | ||||
String s = String.valueOf(0); | 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; | String finalJzz = jzz; | ||||
activity.runOnUiThread(new Runnable() { | activity.runOnUiThread(new Runnable() { | ||||
@@ -56,7 +56,8 @@ public class fragment_silos_cl extends LinearLayout { | |||||
return; | 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; | //Short val=(short)val1; | ||||
ExecuteTheRecipe.WritePLC("料仓" + model.num + "需求值", val1, new IWriteCallBack() { | ExecuteTheRecipe.WritePLC("料仓" + model.num + "需求值", val1, new IWriteCallBack() { | ||||
@@ -157,7 +157,7 @@ | |||||
android:layout_marginTop="80dp" | android:layout_marginTop="80dp" | ||||
android:layout_marginRight="140dp" | android:layout_marginRight="140dp" | ||||
android:background="@drawable/input_bj" | android:background="@drawable/input_bj" | ||||
android:digits="0123456789." | |||||
android:digits="0123456789" | |||||
android:hint="请输入制作时长" | android:hint="请输入制作时长" | ||||
android:inputType="text" | android:inputType="text" | ||||
android:maxLines="1" | android:maxLines="1" | ||||
@@ -28,7 +28,7 @@ | |||||
android:background="@drawable/input_bj" | android:background="@drawable/input_bj" | ||||
android:hint="请写入需求值" | android:hint="请写入需求值" | ||||
android:layout_weight="1" | android:layout_weight="1" | ||||
android:inputType="number|numberDecimal" | |||||
android:inputType="number" | |||||
android:maxLines="1" | android:maxLines="1" | ||||
android:padding="3dp" | android:padding="3dp" | ||||
android:textSize="12dp" | android:textSize="12dp" | ||||