diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
new file mode 100644
index 00000000..b268ef36
--- /dev/null
+++ b/.idea/deploymentTargetSelector.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/git_toolbox_prj.xml b/.idea/git_toolbox_prj.xml
new file mode 100644
index 00000000..02b915b8
--- /dev/null
+++ b/.idea/git_toolbox_prj.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 804e304a..0897082f 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/.idea/migrations.xml b/.idea/migrations.xml
new file mode 100644
index 00000000..f8051a6f
--- /dev/null
+++ b/.idea/migrations.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 60bc3cba..66ec7b08 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
diff --git a/app/build.gradle b/app/build.gradle
index 127cfff1..2f64a3ec 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,6 +1,12 @@
+import java.text.DateFormat
+import java.text.SimpleDateFormat
+
apply plugin: 'com.android.application'
//apply plugin: 'com.jakewharton.butterknife'
-
+def releaseTime() {
+ DateFormat df = new SimpleDateFormat("yyyyMMddHHmm")
+ return df.format(Calendar.getInstance(Locale.CHINA).getTime())
+}
android {
compileSdk rootProject.ext.compileSdkVersion
@@ -51,6 +57,11 @@ android {
}
}
+ applicationVariants.all { variant ->
+ variant.outputs.all {
+ outputFileName = "boluobatai-v${defaultConfig.versionCode}-${releaseTime()}"+"-unsigned-${variant.name}.apk"
+ }
+ }
}
dependencies {
@@ -118,7 +129,7 @@ dependencies {
//leak 内存泄漏检测
- debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3'
+// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3'
//Modbus
implementation 'com.github.licheedev:Modbus4Android:2.0.2'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e3f47563..686eed94 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -146,6 +146,7 @@
activityWeakReference;
+ private WeakReference contextWeakReference;
+ private ProgressDialog progressDialog;
+ private static WaitDialog mInstance; //实例变量设置私有,防止直接通过类名访问
+
+ private WaitDialog() {
+ //默认构造函数私有,防止类外直接new创建对象
+ }
- public static void Show(String title,String msg,Context _context,Activity _activity){
- context=_context;
- activity=_activity;
- if(context==null) return;
- progressDialog = new ProgressDialog(context);
+ public static synchronized WaitDialog getInstance() { //静态同步方法作为唯一的实例对象获取方式
+ if (mInstance==null) {
+ synchronized (WaitDialog.class ){
+ if(mInstance==null){
+ mInstance = new WaitDialog();
+ }
+ }
+ }
+ return mInstance;
+ }
+ //end
+
+ public void Show(String title,String msg,Context _context,Activity _activity){
+ contextWeakReference=new WeakReference<>(_context);
+ activityWeakReference = new WeakReference<>(_activity);
+ if(_context==null) return;
+ if(progressDialog!=null){
+ progressDialog.dismiss();
+ }
+ progressDialog = new ProgressDialog(_context);
progressDialog.setTitle(title);
progressDialog.setCancelable(false);
progressDialog.setMessage(msg);
progressDialog.show();
}
- public static void AddText(String info){
- if(context==null) return;
- if(activity==null) return;
+ public void AddText(String info){
+ if(contextWeakReference.get()==null) return;
+ if(activityWeakReference.get()==null) return;
if(progressDialog==null) return;
- activity.runOnUiThread(()->{ progressDialog.setMessage(info);});
+ activityWeakReference.get().runOnUiThread(()->{ progressDialog.setMessage(info);});
}
- public static void Dismiss(){
- if(activity==null) return;
+ public void Dismiss(){
+ if(activityWeakReference.get()==null) return;
if(progressDialog==null) return;
- activity.runOnUiThread(()->{ progressDialog.dismiss();});
+ activityWeakReference.get().runOnUiThread(()->{ progressDialog.dismiss();});
}
- public static void TimeOut(String info){
- if(activity==null) return;
+ public void TimeOut(String info){
+ if(activityWeakReference.get()==null) return;
if(progressDialog==null) return;
Dismiss();
- DialogManager.showError(activity,info,AlertDialogButton.OK,null);
+ DialogManager.showError(activityWeakReference.get(),info,AlertDialogButton.OK,null);
}
+
+
}
diff --git a/app/src/main/java/com/bonait/bnframework/HBL/Unity.java b/app/src/main/java/com/bonait/bnframework/HBL/Unity.java
index a531fc87..8580885a 100644
--- a/app/src/main/java/com/bonait/bnframework/HBL/Unity.java
+++ b/app/src/main/java/com/bonait/bnframework/HBL/Unity.java
@@ -29,7 +29,7 @@ public class Unity {
Delay(100);
if(timeOut>0&&(System.currentTimeMillis()-startTime)>timeOut) break;
}
- if(!tag) MessageLog.ShowInfo("任务超时,超时时间:"+String.valueOf(timeOut)+"/"+String.valueOf(System.currentTimeMillis()-startTime));
+ if(!tag) MessageLog.ShowInfo("任务超时,超时时间:"+String.valueOf(timeOut)+"/"+String.valueOf(System.currentTimeMillis()-startTime));
// System.out.println("任务超时,超时时间:"+String.valueOf(timeOut)+"/"+String.valueOf(System.currentTimeMillis()-startTime));
return tag?OperateResult.CreateSuccess():OperateResult.CreateFailed("任务超时");
@@ -87,7 +87,18 @@ public class Unity {
*/
public static float Scale( float InputValue, float InputMax, float InputMin, float OutMax, float OutMin)
{
+ MessageLog.ShowInfo("AnalogConvert measureCookTime InputValue="+InputValue+" InputMax="+InputMax+";InputMin="+InputMin+";OutMax="+OutMax+";OutMin="+OutMin);
+
+ if(InputValue<=0|| InputMax<=0||InputMin<=0){
+ return 0;
+ }
+ if(((InputMax - InputMin) + OutMin)==0){
+ return 0;
+ }
float value = ((OutMax - OutMin) * (InputValue - InputMin)) / (InputMax - InputMin) + OutMin;
+ if(value<=0){
+ value = 0;
+ }
String formattedNum = String.format("%.2f", value);
return Float.parseFloat(formattedNum);
}
diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java
index edbc7a47..a4fa2c2b 100644
--- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java
+++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java
@@ -997,6 +997,7 @@ public class ConfigData {
}
+
//endregion
}
diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
index 2a17f693..104bee13 100644
--- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
+++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
@@ -40,6 +40,7 @@ import com.bonait.bnframework.common.helper.ThreadManager;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
+import com.http.utils.LogUtils;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
@@ -295,7 +296,7 @@ public class ExecuteTheRecipe {
} catch (Exception ex) {
ToastUtils.error("PLC设备数据监听异常:" + ex.getMessage());
}
- Thread.sleep(1);
+ Thread.sleep(50);
}
@Override
@@ -509,6 +510,12 @@ public class ExecuteTheRecipe {
}
});
}
+
+ public static void releaseListening(){
+ ThreadManager.Get().Stop("PLC设备数据监听");
+ ThreadManager.Get().Stop("PLC设备数据监听-信号检测");
+ ThreadManager.Get().Stop("商品制作线程");
+ }
//endregion
//region PLC基础控制类
@@ -520,9 +527,12 @@ public class ExecuteTheRecipe {
* @param value
*/
public static void WritePLC(String name, Object value, IWriteCallBack callback) {
+ MessageLog.ShowInfo("WritePLC name="+name +";value="+value.toString());
try {
if (ConfigName.getInstance().PLC_Address.containsKey(name)) {
BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get(name);
+ MessageLog.ShowInfo("WritePLC name="+name + ";plcaddress.address="+plcaddress.address.toString()+";value="+value.toString());
+
if (!plcaddress.address.isEmpty() && ConfigName.getInstance().PlcIsConnect) {
if (plcaddress.address.toUpperCase().startsWith("VD"))//int
{
@@ -563,6 +573,7 @@ public class ExecuteTheRecipe {
}
public static void Write(Object plcName,Object value,IWriteCallBack callBack){
+ MessageLog.ShowInfo("WritePLC plcName=" +plcName.toString() +";value="+value.toString());
WritePLC(plcName.toString(),value,callBack);
}
@@ -573,10 +584,12 @@ public class ExecuteTheRecipe {
* @return
*/
public static Object ReadPLC(String name) {
+
final Object[] ReturnsVariable = {null};
try {
if (ConfigName.getInstance().PLC_Address.containsKey(name)) {
BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get(name);
+ MessageLog.ShowInfo("ReadPLC name=" +name +" plcaddress="+plcaddress.address.toString());
if (!plcaddress.address.isEmpty() && ConfigName.getInstance().PlcIsConnect) {
if (plcaddress.address.toUpperCase().startsWith("VD"))//int
{
@@ -611,16 +624,23 @@ public class ExecuteTheRecipe {
ReturnsVariable[0] = val[0];
});
}
+ if ((plcaddress.address.toUpperCase().equals("VW82"))){
+ MessageLog.ShowInfo("ReadPLC 称当前重量 name=" +name+" ReturnsVariable[0]="+ReturnsVariable[0] );
+ OutletWeigh = (short)ReturnsVariable[0];
+
+ }
}
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
} finally {
+ MessageLog.ShowInfo("ReadPLC name=" +name+" ReturnsVariable[0]="+ReturnsVariable[0] );
return ReturnsVariable[0];
}
}
public static boolean ReadBool(Object plcName){
+ MessageLog.ShowInfo("ReadBool plcName=" +plcName.toString() );
try{
if(ListeningValue.containsKey(plcName)){
return Boolean.parseBoolean(ListeningValue.get(plcName).toString());
@@ -633,11 +653,16 @@ public class ExecuteTheRecipe {
}
public static short ReadShort(Object plcName){
+ MessageLog.ShowInfo("ReadShort "+plcName.toString());
try{
if(ListeningValue.containsKey(plcName)){
- return Short.parseShort(ListeningValue.get(plcName).toString());
+ short result = Short.parseShort(ListeningValue.get(plcName).toString());
+ MessageLog.ShowInfo(plcName.toString()+" result="+result);
+ return result;
}else{
- return Short.parseShort(ReadPLC(plcName.toString()).toString());
+ short result = Short.parseShort(ReadPLC(plcName.toString()).toString());
+ MessageLog.ShowInfo(plcName.toString()+" result="+result);
+ return result;
}
}catch(Exception e){
return 0;
@@ -956,7 +981,7 @@ public class ExecuteTheRecipe {
final boolean[] issucess3 = {false};
//写校准模式
- WritePLC("砝码校准模式", true, new IWriteCallBack() {
+ WritePLC("校准模式", true, new IWriteCallBack() {
@Override
public void onSuccess() {
issucess1[0] =true;
@@ -1000,7 +1025,7 @@ public class ExecuteTheRecipe {
final boolean[] issucess2 = {false};
//写校准模式
- WritePLC("砝码校准模式", false, new IWriteCallBack() {
+ WritePLC("校准模式", false, new IWriteCallBack() {
@Override
public void onSuccess() {
issucess1[0] =true;
diff --git a/app/src/main/java/com/bonait/bnframework/business/PLCName.java b/app/src/main/java/com/bonait/bnframework/business/PLCName.java
index b09e4750..67cd67a1 100644
--- a/app/src/main/java/com/bonait/bnframework/business/PLCName.java
+++ b/app/src/main/java/com/bonait/bnframework/business/PLCName.java
@@ -2,7 +2,7 @@ package com.bonait.bnframework.business;
public enum PLCName {
重量清零,
- 当前重量,
+ 称当前重量,
外置仓1出料时间,
外置仓2出料时间,
外置仓3出料时间,
diff --git a/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java b/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java
index e046252f..a61bb95a 100644
--- a/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java
@@ -52,6 +52,7 @@ public class BaseActivity extends QMUIActivity implements EasyPermissions.Permis
@Override
protected void onDestroy() {
super.onDestroy();
+ ActiveMax.destroy(this);
/*LocalCacheUtils.Get().ClearBitmapFile();*/
}
diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
index ebb9e31e..6f39a7d3 100644
--- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
+++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
@@ -46,6 +46,7 @@ import java.util.concurrent.ConcurrentHashMap;
* 配置文件
*/
public class ConfigName {
+ public static final boolean TEST = true;
//region 单例模式
private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问
@@ -597,7 +598,7 @@ public class ConfigName {
add(new Res_PLCADDRESS("电子秤", "-------------", 0, 0));
add(new Res_PLCADDRESS("称当前重量", "VW82", 1, 0));
add(new Res_PLCADDRESS("砝码值", "VW86", 1, 1));
- add(new Res_PLCADDRESS("重量清零", "M20.2", 0, 1));
+ add(new Res_PLCADDRESS("重量清零", "M20.0", 0, 1));
add(new Res_PLCADDRESS("校准模式", "M20.1", 0, 1));
add(new Res_PLCADDRESS("关闭写保护", "M20.2", 0, 1));
add(new Res_PLCADDRESS("零点校准", "M20.3", 0, 1));
diff --git a/app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java b/app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java
index 0ef76f41..2cbf6659 100644
--- a/app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java
+++ b/app/src/main/java/com/bonait/bnframework/common/helper/ActiveMax.java
@@ -49,6 +49,11 @@ public class ActiveMax {
// activity.getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(setOnSystemUiVisibilityChangeListener);
}
+ public static void destroy(Activity activity){
+ activities.remove(activity);
+ activity.getWindow().getDecorView().getViewTreeObserver().removeOnGlobalLayoutListener(keyboardVisibilityListener);
+ }
+
/**
* 状态栏变化后事件
*/
diff --git a/app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java b/app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java
index f33a8f4b..2d22b2d6 100644
--- a/app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java
+++ b/app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java
@@ -13,6 +13,8 @@ import android.os.SystemClock;
import android.util.Log;
import android.widget.Toast;
+import com.bonait.bnframework.common.constant.ConfigName;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
@@ -85,6 +87,9 @@ public class CrashHandler implements UncaughtExceptionHandler {
* @return true:��������˸��쳣��Ϣ; ����false.
*/
private boolean handleException(Throwable ex) {
+ if(ConfigName.TEST){
+ return false;
+ }
if (ex == null)
return false;
diff --git a/app/src/main/java/com/bonait/bnframework/common/utils/ToastUtils.java b/app/src/main/java/com/bonait/bnframework/common/utils/ToastUtils.java
index 346fb654..3680c408 100644
--- a/app/src/main/java/com/bonait/bnframework/common/utils/ToastUtils.java
+++ b/app/src/main/java/com/bonait/bnframework/common/utils/ToastUtils.java
@@ -45,25 +45,26 @@ public class ToastUtils {
private static final String TOAST_TYPEFACE = "sans-serif-condensed";
+ private static Toast currentToastThread;
private static Toast currentToast;
//***********************普通 使用ApplicationContext 方法*********************//
private static long mExitTime;
public static void normal(@NonNull String message) {
- normal(MainApplication.getContext(), message, Toast.LENGTH_SHORT, null, false).show();
+ normal(MainApplication.getContext(), message, Toast.LENGTH_SHORT, null, false);//.show();
}
public static void normal(@NonNull String message, Drawable icon) {
- normal(MainApplication.getContext(), message, Toast.LENGTH_SHORT, icon, true).show();
+ normal(MainApplication.getContext(), message, Toast.LENGTH_SHORT, icon, true);//.show();
}
public static void normal(@NonNull String message, int duration) {
- normal(MainApplication.getContext(), message, duration, null, false).show();
+ normal(MainApplication.getContext(), message, duration, null, false);//.show();
}
public static void normal(@NonNull String message, int duration, Drawable icon) {
- normal(MainApplication.getContext(), message, duration, icon, true).show();
+ normal(MainApplication.getContext(), message, duration, icon, true);//.show();
}
public static Toast normal(@NonNull String message, int duration, Drawable icon, boolean withIcon) {
@@ -71,11 +72,11 @@ public class ToastUtils {
}
public static void warning(@NonNull String message) {
- warning(MainApplication.getContext(), message, Toast.LENGTH_SHORT, true).show();
+ warning(MainApplication.getContext(), message, Toast.LENGTH_SHORT, true);//.show();
}
public static void warning(@NonNull String message, int duration) {
- warning(MainApplication.getContext(), message, duration, true).show();
+ warning(MainApplication.getContext(), message, duration, true);//.show();
}
public static Toast warning(@NonNull String message, int duration, boolean withIcon) {
@@ -83,11 +84,11 @@ public class ToastUtils {
}
public static void info(@NonNull String message) {
- info(MainApplication.getContext(), message, Toast.LENGTH_SHORT, true).show();
+ info(MainApplication.getContext(), message, Toast.LENGTH_SHORT, true);//.show();
}
public static void info(@NonNull String message, int duration) {
- info(MainApplication.getContext(), message, duration, true).show();
+ info(MainApplication.getContext(), message, duration, true);//.show();
}
public static Toast info(@NonNull String message, int duration, boolean withIcon) {
@@ -95,26 +96,27 @@ public class ToastUtils {
}
public static void success(@NonNull String message) {
- success(MainApplication.getContext(), message, Toast.LENGTH_SHORT, true).show();
+ success(MainApplication.getContext(), message, Toast.LENGTH_SHORT, true);//.show();
}
public static void success(@NonNull String message, int duration) {
- success(MainApplication.getContext(), message, duration, true).show();
+ success(MainApplication.getContext(), message, duration, true);//.show();
}
public static Toast success(@NonNull String message, int duration, boolean withIcon) {
return custom(MainApplication.getContext(), message, getDrawable(MainApplication.getContext(), R.mipmap.ic_check_white_48dp), DEFAULT_TEXT_COLOR, SUCCESS_COLOR, duration, withIcon, true);
}
+ //***********************//
public static void error(@NonNull String message) {
- error(MainApplication.getContext(), message, Toast.LENGTH_SHORT, true).show();
+ error(MainApplication.getContext(), message, Toast.LENGTH_SHORT, true);//.show();
}
//===========================================使用ApplicationContext 方法=========================
//*******************************************常规方法********************************************
public static void error(@NonNull String message, int duration) {
- error(MainApplication.getContext(), message, duration, true).show();
+ error(MainApplication.getContext(), message, duration, true);//.show();
}
public static Toast error(@NonNull String message, int duration, boolean withIcon) {
@@ -259,14 +261,14 @@ public class ToastUtils {
// currentToast.setGravity(Gravity.RIGHT | Gravity.TOP, 0, 0);//右上角
// currentToast.setGravity(Gravity.LEFT | Gravity.BOTTOM, 0, 0);//左下角
// currentToast.setGravity(Gravity.RIGHT | Gravity.BOTTOM, 0, 100);//右下角
-
+ currentToast.show();
return currentToast;
} else {
mHandler.post(new Runnable() {
@Override
public void run() {
- if (currentToast == null) {
- currentToast = new Toast(context);
+ if (currentToastThread == null) {
+ currentToastThread = new Toast(context);
}
final View toastLayout = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.toast_layout, null);
final ImageView toastIcon = toastLayout.findViewById(R.id.toast_icon);
@@ -293,11 +295,11 @@ public class ToastUtils {
toastTextView.setText(message);
toastTextView.setTypeface(Typeface.create(TOAST_TYPEFACE, Typeface.NORMAL));
- currentToast.setView(toastLayout);
- currentToast.setDuration(duration);
-
- currentToast.setGravity(Gravity.TOP,0,100);
+ currentToastThread.setView(toastLayout);
+ currentToastThread.setDuration(duration);
+ currentToastThread.setGravity(Gravity.TOP,0,100);
+ currentToastThread.show();
// currentToast.setGravity(Gravity.LEFT | Gravity.TOP, 0, 0);//左上角
// currentToast.setGravity(Gravity.RIGHT | Gravity.TOP, 0, 0);//右上角
// currentToast.setGravity(Gravity.LEFT | Gravity.BOTTOM, 0, 0);//左下角
@@ -307,7 +309,7 @@ public class ToastUtils {
}
- return currentToast;
+ return null;
}
public static final Drawable tint9PatchDrawableFrame(@NonNull Context context, @ColorInt int tintColor) {
diff --git a/app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java b/app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java
index d1328c9a..9b12ed31 100644
--- a/app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java
+++ b/app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java
@@ -43,7 +43,7 @@ public class UpdateAppUtils {
/**
* 当前版本号
*/
- private static String myVersionCode = "1.0";
+ private static String myVersionCode = "1.2";
/**
* 服务器的版本号
*/
@@ -99,10 +99,15 @@ public class UpdateAppUtils {
mode.branchCode="1712279450412756993";
}else
{
- mode.productCode="1679307017135329280";
- mode.moduleCode="newtwbt";
- mode.serverCode="1680767784879656960";//服务器
- mode.branchCode="1712279534630187009";
+// mode.productCode="1679307017135329280";
+// mode.moduleCode="newtwbt";
+// mode.serverCode="1680767784879656960";//服务器
+// mode.branchCode="1712279534630187009";
+
+ mode.productCode="1769564215952125952";
+ mode.moduleCode="desktopplbt";
+ mode.serverCode="1769564338190921728";//服务器
+ mode.branchCode="1789857238682284033";
}
//调味吧台
diff --git a/app/src/main/java/com/bonait/bnframework/common/view/AddGoodDialog.java b/app/src/main/java/com/bonait/bnframework/common/view/AddGoodDialog.java
index a2283f6a..cc3414e6 100644
--- a/app/src/main/java/com/bonait/bnframework/common/view/AddGoodDialog.java
+++ b/app/src/main/java/com/bonait/bnframework/common/view/AddGoodDialog.java
@@ -397,4 +397,10 @@ public class AddGoodDialog extends Dialog {
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
};
+
+ @Override
+ public void dismiss() {
+ super.dismiss();
+ MessageManager.getInstance().unRegisterMessageReceiver(activity_ma);
+ }
}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
index 14f5855e..a6db02ee 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
@@ -20,6 +20,7 @@ import android.widget.RelativeLayout;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
+import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.OrderServer;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName;
@@ -140,6 +141,9 @@ public class BottomNavigationMainActivity extends BaseActivity{
ConfigData.getInstance().ColsePLC();
MediaPlayerHelper.getInstance().Release();
MQTT.get().ConnMqttBroken(false);//释放mqtt
+ ThreadManager.Get().Stop("PLC断线重连线程");
+ ThreadManager.Get().Stop("心跳服务");
+ ExecuteTheRecipe.releaseListening();
super.onDestroy();
Glide.get(this).clearMemory();
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/goodpf_apapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/goodpf_apapter.java
index 85f3c696..016a070e 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/goodpf_apapter.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/goodpf_apapter.java
@@ -7,6 +7,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -43,8 +44,8 @@ public class goodpf_apapter extends ArrayAdapter {
View view = LayoutInflater.from(getContext()).inflate(resource1, parent, false);
//分别获取 image view 和 textview 的实例
TextView name = view.findViewById(R.id.name);
- ImageView button = view.findViewById(R.id.button_item);
- ImageView button_update = view.findViewById(R.id.button_update);
+ RelativeLayout button = view.findViewById(R.id.button_item);
+ RelativeLayout button_update = view.findViewById(R.id.button_update);
// 设置要显示的图片和文字
name.setText(bpa_goodsrecipename.name);
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java
index 7d36479f..6bc8b18e 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java
@@ -1,9 +1,11 @@
package com.bonait.bnframework.modules.home.adapter;
import android.app.Activity;
+import android.app.Application;
import android.content.Context;
import android.content.ContextWrapper;
import android.media.MediaPlayer;
+import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -18,6 +20,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
+import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.constant.DataBus;
@@ -30,6 +33,7 @@ import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.helper.MediaPlayerHelper;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
+import com.http.utils.LogUtils;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
@@ -46,15 +50,16 @@ public class loadinggood_adapter extends RecyclerView.Adapter datas= DataBus.getInstance().GoodsMake;
int resource1;
- public Context conmain;
- public Activity activity;
+// public Context conmain;
+// public Activity activity;
private final LayoutInflater mLayoutInflater;
+ Handler handler = new Handler();
- public loadinggood_adapter(Context context,MyClickListener myClickListener,Activity ac) {
- this.conmain = context;
- activity=ac;
+ public loadinggood_adapter(Context context,MyClickListener myClickListener) {
+// this.conmain = context;
+// activity=ac;
mListener=myClickListener;
mLayoutInflater = LayoutInflater.from(context);
}
@@ -86,7 +91,7 @@ public class loadinggood_adapter extends RecyclerView.Adapter
* 保存值
*/
Button save_value;
+ /**
+ * 父容器
+ */
+ RelativeLayout root;
RelativeLayout zdbs1,zdbs2,zdbs3,show_wdsz,show_wd;
public WDSZViewHolder(View view) {
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/wl_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/wl_adapter.java
index 0eec817c..87f7c853 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/wl_adapter.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/wl_adapter.java
@@ -7,6 +7,7 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
@@ -43,8 +44,8 @@ public class wl_adapter extends ArrayAdapter {
View view = LayoutInflater.from(getContext()).inflate(resource1, parent, false);
//分别获取 image view 和 textview 的实例
TextView name = view.findViewById(R.id.name);
- ImageView button = view.findViewById(R.id.button_item);
- ImageView button_update = view.findViewById(R.id.button_update);
+ RelativeLayout button = view.findViewById(R.id.button_item);
+ RelativeLayout button_update = view.findViewById(R.id.button_update);
// 设置要显示的图片和文字
name.setText(bpa_material.name);
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
index 03a26a28..9d676aa4 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
@@ -16,6 +16,7 @@ import android.content.res.Resources;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
+import android.os.Looper;
import android.os.Message;
import android.os.ResultReceiver;
import android.text.Editable;
@@ -81,15 +82,8 @@ import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.loadinggood_adapter;
-import com.bonait.bnframework.modules.home.adapter.wl_adapter;
-import com.bonait.bnframework.modules.home.fragment.mode.SerialInter;
-import com.bonait.bnframework.modules.home.fragment.mode.SerialManage;
-import com.bonait.bnframework.modules.home.fragment.mode.SerialPortRead;
-import com.bonait.bnframework.modules.home.fragment.mode.ShaoMaSave;
-//import com.bonait.bnframework.modules.home.fragment.mode.ShaomaTest;
import com.bonait.bnframework.modules.home.fragment.mode.add_makegood_control;
import com.bonait.bnframework.modules.home.fragment.mode.add_manguan_control;
-import com.bonait.bnframework.modules.home.fragment.mode.add_pf_control;
import com.bumptech.glide.Glide;
import com.litao.slider.NiftySlider;
import com.orhanobut.logger.Logger;
@@ -171,7 +165,16 @@ public class MakeGoodFragment extends BaseFragment {
RelativeLayout loadgoodliebiao;
-
+ private Handler handler = new Handler(Looper.getMainLooper()){
+ @Override
+ public void handleMessage(@NonNull Message msg) {
+ super.handleMessage(msg);
+ if(msg.what == 1){
+ DataBus.getInstance().loadinggoodAdapter = new loadinggood_adapter(context, myClickListener);
+ datatab_paiduishangping.setAdapter(DataBus.getInstance().loadinggoodAdapter);
+ }
+ }
+ };
private Context context;
@@ -309,10 +312,12 @@ public class MakeGoodFragment extends BaseFragment {
// LinearLayoutManager layoutManager = new LinearLayoutManager(context);
// layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
// datatab_paiduishangping.setLayoutManager(layoutManager);
- datatab_paiduishangping.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL,false));
- DataBus.getInstance().loadinggoodAdapter = new loadinggood_adapter(context, myClickListener, getActivity());
- datatab_paiduishangping.setAdapter(DataBus.getInstance().loadinggoodAdapter);
+
+ handler.removeMessages(1);
+ handler.sendEmptyMessageDelayed(1,200);
+
+
}
@@ -464,6 +469,8 @@ public class MakeGoodFragment extends BaseFragment {
}
}
};
+ datatab_paiduishangping.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL,false));
+
}
@OnClick({R.id.good_gengxin, R.id.cheng_clear, R.id.loadgood})
@@ -477,6 +484,7 @@ public class MakeGoodFragment extends BaseFragment {
@Override
public void onSuccess() {
ToastUtils.info("清零成功!");
+ mHandler.sendEmptyMessage(0);
}
@Override
@@ -504,7 +512,8 @@ public class MakeGoodFragment extends BaseFragment {
case 0:
plc_status.setText(ConfigName.getInstance().PlcIsConnect ? "正常" : "异常");
plc_status.setTextColor(ConfigName.getInstance().PlcIsConnect ? Color.parseColor("#4CAF50") : Color.parseColor("#D32F2F"));
- wendu1.setText(ExecuteTheRecipe.WaterTemp + "°C");
+// wendu1.setText(ExecuteTheRecipe.WaterTemp + "°C");
+ MessageLog.ShowInfo("重量 ExecuteTheRecipe.OutletWeigh="+ExecuteTheRecipe.OutletWeigh);
dianzichen.setText(String.valueOf((int) ExecuteTheRecipe.OutletWeigh / 10.0) + " g");
break;
case 1:
@@ -666,11 +675,16 @@ public class MakeGoodFragment extends BaseFragment {
//接收扫码信息
ExecuteTheRecipe.OnScanTheCodeInformationT = new IRunT() {
@Override
- public void Run(String msg) {
+ public void Run(String msg2) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
+ String msg = msg2;
+
+ if(ConfigName.TEST){
+ msg = " |03cb1364-8b85-446a-b00b-d3657de1a19f| | ";
+ }
if ((msg != null) && (((String) msg).length() > 2) && ((String) msg).contains("|")) {
//拿到扫码数据
//例如 ORD001|P0003|A001,M002,T001|2
@@ -712,8 +726,11 @@ public class MakeGoodFragment extends BaseFragment {
}
} catch (Exception ex) {
}
-
BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid);
+ ConfigName.getInstance();
+ if(ConfigName.TEST){
+ good = QueryDB.GetGoodsId(goodid);
+ }
if (good == null) {
message = "没有查询到该商品!";
mHandler.sendEmptyMessage(1);
@@ -816,6 +833,7 @@ public class MakeGoodFragment extends BaseFragment {
rv_right.setAdapter(null);
Glide.get(getContext()).clearMemory();
+ MessageManager.getInstance().unRegisterMessageReceiver(getActivity());
}
/**
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/SheZhifragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/SheZhifragment.java
index 40072e60..2218a1d3 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/SheZhifragment.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/SheZhifragment.java
@@ -75,7 +75,7 @@ public class SheZhifragment extends BaseFragment {
skipToActivity(DzcjyActivity.class);
break;
case R.id.wdsz://温度设置
- skipToActivity(WdszActivity.class);
+// skipToActivity(WdszActivity.class);
break;
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DzcjyActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DzcjyActivity.java
index 4a31dcdf..52bc7372 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DzcjyActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DzcjyActivity.java
@@ -83,7 +83,7 @@ public class DzcjyActivity extends BaseActivity {
String outres = edittext_zl.getText().toString().trim();
if (!outres.equals("")) {
- ExecuteTheRecipe.WritePLC("砝码值", Short.parseShort(outres), new IWriteCallBack() {
+ ExecuteTheRecipe.WritePLC("砝码值", Short.parseShort(outres)*10, new IWriteCallBack() {
@Override
public void onSuccess() {
ExecuteTheRecipe.WritePLC("砝码值写入",true,null);
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java
index e9f1fc6e..93138ce9 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java
@@ -420,9 +420,12 @@ public class GoodPeiFangActivity extends BaseActivity {
@Override
public void onDestroy() {
+ add_pf.destroy();
+ add_good.destroy();
super.onDestroy();
rv_right.setAdapter(null);
Glide.get(this).clearMemory();
+ MessageManager.getInstance().unRegisterMessageReceiver(this);
}
@Override
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java
index f534b920..e9045b4b 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java
@@ -144,7 +144,7 @@ public class SilosNewActivity extends BaseActivity {
} else if (k == 4) {
//校准
silos_jz.SetData((lcMode) data, activity);
- silos_jz.setVisibility(View.VISIBLE);
+ silos_jz.show();
} else if (k == 5) {
//
} else if (k == 6) {
@@ -162,7 +162,7 @@ public class SilosNewActivity extends BaseActivity {
@Override
public void clickListenerNew(View v, int k, Object data) {
if (k == 0) {
- silos_jz.setVisibility(View.GONE);
+ silos_jz.close();
}
}
};
@@ -228,6 +228,8 @@ public class SilosNewActivity extends BaseActivity {
@Override
public void onDestroy() {
super.onDestroy();
+ silos_jz.close();
+ MessageManager.getInstance().unRegisterMessageReceiver(this);
}
@Override
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/GoodInformation.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/GoodInformation.java
index 3345122c..5ccb8a2b 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/GoodInformation.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/GoodInformation.java
@@ -469,7 +469,7 @@ public class GoodInformation extends LinearLayout implements MyClickListener {
{
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, Data.id);
if (goodsrecipename != null) {
- ToastUtils.warning("已有改做法配方,不能在新增了!");
+ ToastUtils.warning("已有该做法配方,不能再新增了!");
return;
}
}
@@ -538,7 +538,7 @@ public class GoodInformation extends LinearLayout implements MyClickListener {
//判断配方是否有相同规格的了
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, Data.id);
if (goodsrecipename != null) {
- ToastUtils.warning("已有改做法配方,不能在新增了!");
+ ToastUtils.warning("已有该做法配方,不能再新增了!");
return;
}
//新增配方名称
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java
index c62f99d1..80b1a6ba 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java
@@ -114,6 +114,7 @@ public class Silos_item_fragment extends BaseFragment {
public void onDestroy() {
super.onDestroy();
Logger.d("我的fragment销毁");
+ MessageManager.getInstance().unRegisterMessageReceiver(getActivity());
}
/**
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_jiaoyan_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_jiaoyan_fragment.java
index 9e65f861..955e78bc 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_jiaoyan_fragment.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_jiaoyan_fragment.java
@@ -207,11 +207,14 @@ public class Silos_item_jiaoyan_fragment extends LinearLayout {
ExecuteTheRecipe.WeighComplete = new IRun() {
@Override
public void Run() {
- mHandler.sendEmptyMessage(0);
- if (ExecuteTheRecipe.OutletWeigh >= (zl[0] + 2))//当前重量大于2g
- {
- mHandler.sendEmptyMessage(1);
+ if(mHandler!=null){
+ mHandler.sendEmptyMessage(0);
+ if (ExecuteTheRecipe.OutletWeigh >= (zl[0] + 2))//当前重量大于2g
+ {
+ mHandler.sendEmptyMessage(1);
+ }
}
+
}
};
//通道校准完成
@@ -285,6 +288,17 @@ public class Silos_item_jiaoyan_fragment extends LinearLayout {
}).start();
}
+
+ public void destroy(){
+ if(mHandler!=null){
+ mHandler = null;
+ }
+ if(activity!=null){
+ activity = null;
+ }
+ ExecuteTheRecipe.OnChargeMixtureComNotPar = null;
+ ExecuteTheRecipe.WeighComplete = null;
+ }
//endregion
//region 刷新界面
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java
index d29a1a5d..574d0bf9 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_good_control.java
@@ -227,6 +227,10 @@ public class add_good_control extends LinearLayout {
});
}
+ public void destroy(){
+ MessageManager.getInstance().unRegisterMessageReceiver(activity_ma);
+ }
+
public String ids="";
/**
* 数据验证
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java
index 3b4a9924..dd9a92bb 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java
@@ -317,6 +317,13 @@ public class add_pf_control extends LinearLayout implements MyClickListener {
}
}
+ public void destroy(){
+ Activity activity = findActivity(acontext);
+ if (activity != null) {
+ MessageManager.getInstance().unRegisterMessageReceiver(activity);
+ }
+ }
+
/**
* 保存数据
*/
@@ -439,7 +446,7 @@ public class add_pf_control extends LinearLayout implements MyClickListener {
{
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids,Good.id);
if (goodsrecipename != null) {
- ToastUtils.warning("已有改做法配方,不能在新增了!");
+ ToastUtils.warning("已有该做法配方,不能再新增了!");
return isSuceess;
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_ck.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_ck.java
index 3cc51239..8320ada5 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_ck.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_ck.java
@@ -48,6 +48,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.Delayed;
import butterknife.BindView;
import butterknife.ButterKnife;
@@ -347,11 +348,21 @@ public class add_silos_ck extends LinearLayout {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
Log.e("鼠标", "按下:2222 ");
ExecuteTheRecipe.WritePLC("清洗模式", true,null);
+ try {
+ Thread.sleep(100L);//避免启动的时候还是按时间出料
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
ExecuteTheRecipe.WritePLC(name, true, null);
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
Log.e("鼠标", "松开:33333 ");
- ExecuteTheRecipe.WritePLC("清洗模式", false,null);
ExecuteTheRecipe.WritePLC(name, false, null);
+ try {
+ Thread.sleep(100L);//避免启动的时候还是按时间出料
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ ExecuteTheRecipe.WritePLC("清洗模式", false,null);
}
return false;
});
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java
index e004aacc..7885cb2c 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/silos_jiaoyan.java
@@ -1,30 +1,18 @@
package com.bonait.bnframework.modules.home.fragment.mode;
import android.app.Activity;
-import android.app.ProgressDialog;
import android.content.Context;
-import android.content.DialogInterface;
-import android.graphics.Color;
import android.os.Handler;
import android.os.Message;
-import android.os.SystemClock;
-import android.provider.ContactsContract;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
-import android.view.MotionEvent;
import android.view.View;
-import android.widget.ArrayAdapter;
import android.widget.Button;
-import android.widget.Chronometer;
import android.widget.EditText;
-import android.widget.ImageView;
import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.Spinner;
import android.widget.TextView;
-import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
@@ -32,38 +20,21 @@ import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
import com.bonait.bnframework.HBL.Dialog.DialogManager;
import com.bonait.bnframework.HBL.Dialog.WaitDialog;
import com.bonait.bnframework.HBL.Executor;
-import com.bonait.bnframework.HBL.Interface.IFunc;
import com.bonait.bnframework.HBL.Trig.TTrig;
import com.bonait.bnframework.HBL.Unity;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.PLCName;
-import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.QueryDB;
-import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
-import com.bonait.bnframework.common.db.mode.BPA_SILOS;
-import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
import com.bonait.bnframework.common.db.res.lcMode;
import com.bonait.bnframework.common.helper.I.IRun;
-import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.I.MyClickListener;
-import com.bonait.bnframework.common.model.mode.ResMenuLeft;
+import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.utils.ToastUtils;
-import com.bonait.bnframework.modules.home.fragment.from.SilosNewActivity;
-import com.qmuiteam.qmui.arch.QMUIFragment;
-import com.qmuiteam.qmui.arch.QMUIFragmentPagerAdapter;
-import com.qmuiteam.qmui.widget.QMUIViewPager;
-import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
-import com.qmuiteam.qmui.widget.tab.QMUIBasicTabSegment;
-import com.qmuiteam.qmui.widget.tab.QMUITabSegment;
-import com.suke.widget.SwitchButton;
-
-import java.io.Console;
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.List;
+
+import java.util.Timer;
+import java.util.TimerTask;
import butterknife.BindView;
import butterknife.ButterKnife;
@@ -90,20 +61,23 @@ public class silos_jiaoyan extends LinearLayout {
private View root;
@BindView(R.id.min_time)
- EditText min_time;
+ EditText min_time;
@BindView(R.id.min_weight)
- EditText min_weight;
+ EditText min_weight;
@BindView(R.id.max_time)
- EditText max_time;
+ EditText max_time;
@BindView(R.id.max_weight)
- EditText max_weight;
+ EditText max_weight;
@BindView(R.id.sim_discharge_weight)
EditText sim_discharge_weight;
+ @BindView(R.id.current_weight)
+ TextView current_weight;
+
// @BindView(R.id.controlStatus)
// TextView controlStatus;
//endregion
@@ -169,11 +143,11 @@ public class silos_jiaoyan extends LinearLayout {
if(res!=null){
min_time.setText(String.valueOf(res.outputTimeMin));
max_time.setText(String.valueOf(res.outputTimeMax));
- min_weight.setText(String.valueOf(res.inputWightMin));
- max_weight.setText(String.valueOf(res.inputWightMax));
+ min_weight.setText(res.inputWightMin+"");
+ max_weight.setText(res.inputWightMax+"");
}else{
min_time.setText("2");
- max_time.setText("2");
+ max_time.setText("5");
min_weight.setText("0");
max_weight.setText("0");
}
@@ -201,43 +175,36 @@ public class silos_jiaoyan extends LinearLayout {
ExecuteTheRecipe.WeighComplete = new IRun() {
@Override
public void Run() {
- mHandler.sendEmptyMessage(0);
+ if(mHandler!=null){
+ mHandler.sendEmptyMessage(0);
+ }
}
};
//通道校准完成
ExecuteTheRecipe.OnChargeMixtureComNotPar = new IRun() {
@Override
public void Run() {
- final int kkk = lcMode.num;
- try {
- if(activity!=null)
- {
- activity.runOnUiThread(new Runnable() {
+ if(mHandler!=null){
+ final int kkk = lcMode.num;
+ try {
+
+ mHandler.postDelayed(new Runnable() {
@Override
public void run() {
- try {
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- // 在2秒后执行按钮操作
- int zhongliangxianshi = ExecuteTheRecipe.OutletWeigh;
- ExecuteTheRecipe.WritePLC("校准值" + kkk, (short) zhongliangxianshi, null);
- String s = String.valueOf(zhongliangxianshi);
- String zll = String.format("%.1f", (Double.parseDouble(s) / 10));
+ // 在2秒后执行按钮操作
+ int zhongliangxianshi = ExecuteTheRecipe.OutletWeigh;
+ ExecuteTheRecipe.WritePLC("校准值" + kkk, (short) zhongliangxianshi, null);
+ String s = String.valueOf(zhongliangxianshi);
+ String zll = String.format("%.1f", (Double.parseDouble(s) / 10));
// wljz3.setText(zll + "");
- lcMode.jValue = zll;
- QueryDB.UpdateJYZ(lcMode.id, zll);
- ToastUtils.warning("通道校准完成!");
- }
- }, 2000);
- } catch (Exception e) {
- ToastUtils.error("重量解析显示异常!" + e.getMessage());
- }
+ lcMode.jValue = zll;
+ QueryDB.UpdateJYZ(lcMode.id, zll);
+ ToastUtils.warning("通道校准完成!");
}
- });
+ }, 2000);
+ } catch (Exception e) {
+ ToastUtils.error("重量解析显示异常!" + e.getMessage());
}
- } catch (Exception ex) {
- Log.d("dsds", "Run: " + ex.getMessage());
}
}
};
@@ -264,11 +231,48 @@ public class silos_jiaoyan extends LinearLayout {
*/
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
-
+ if(msg.what == 1){
+ }
}
};
//endregion
+ private Timer timer;
+ private TimerTask timerTask;
+
+ public void show(){
+ close();
+ setVisibility(VISIBLE);
+ timer = new Timer();
+ timerTask = new TimerTask() {
+ @Override
+ public void run() {
+ activity.runOnUiThread(()->{
+ float resultWeight = (float) (ExecuteTheRecipe.ReadShort(PLCName.称当前重量)/10.0);
+ current_weight.setText(resultWeight+"g");
+ });
+ }
+ };
+ timer.schedule(timerTask,500,500);
+ }
+
+ public void close(){
+ setVisibility(GONE);
+ if(mHandler!=null){
+ mHandler.removeCallbacksAndMessages(null);
+ mHandler = null;
+ }
+ ExecuteTheRecipe.WeighComplete = null;
+ ExecuteTheRecipe.OnChargeMixtureComNotPar = null;
+ if(timer!=null){
+ timer.cancel();
+ timer = null;
+ }
+ if(timerTask!=null){
+ timerTask.cancel();
+ timerTask = null;
+ }
+ }
private float EditTextValidate(EditText et,String info){
@@ -297,33 +301,55 @@ public class silos_jiaoyan extends LinearLayout {
if(time<0) return;
DialogManager.showWarn(activity,"校准前请确认是否准备就绪?\r\n是否开始校准?", AlertDialogButton.YesNo,s->{
if(s){
- WaitDialog.Show("最小校准","开始校准",getContext(),activity);
+ WaitDialog.getInstance().Show(view.getId()==R.id.min_time?"最小校准":"最大校准","开始校准",getContext(),activity);
Executor.get().runThread(()->{
- WaitDialog.AddText("电子秤清零");
- ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零
-
- WaitDialog.AddText("等待清零完成");
+ WaitDialog.getInstance().AddText("电子秤清零");
+ try {
+ ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零
+ Thread.sleep(100);
+ ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零
+ Thread.sleep(100);
+ ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ WaitDialog.getInstance().AddText("等待清零完成");
//等待清零完成
- Unity.Wait(()->{return ExecuteTheRecipe.ReadShort(PLCName.当前重量)==0;},3000).OnSource(()->{
+ Unity.Wait(()->{
+ return ExecuteTheRecipe.ReadShort(PLCName.称当前重量)>-20&&ExecuteTheRecipe.ReadShort(PLCName.称当前重量)<=20;},3000).OnSource(()->{
- WaitDialog.AddText("下发参数,开始校准");
- ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"出料时间",time,null);//下发出料时间
+ WaitDialog.getInstance().AddText("下发参数,开始校准");
+ ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"出料时间",((int) time)*100,null);//下发出料时间
+ long startTime = System.currentTimeMillis();
+ MessageLog.ShowInfo("下发参数,开始校准 当前时间:"+startTime +" 出料时间"+((int) time)*100);
ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"启停控制",true,null);//下发启动信号
- WaitDialog.AddText("等待校准完成");
+
+ WaitDialog.getInstance().AddText("等待校准完成");
String name = lcMode.name+lcMode.num+"启停控制";
//等待出料完成
- Unity.Wait(()->{return TTrig.get(name).Start(ExecuteTheRecipe.ReadBool(name));},(int)(time+2000)).OnSource(()->{
+ Unity.Wait(()->{return TTrig.get(name).Start(ExecuteTheRecipe.ReadBool(name));},(int)(time*1000+2000)).OnSource(()->{
//获取电子秤重量,并填充到对应位置
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ MessageLog.ShowInfo("下发参数,结束校准 结束时间:"+(System.currentTimeMillis()-startTime) +" 读取启停控制 false");
+
activity.runOnUiThread(()->{
- if(view.getId()==R.id.min_time) min_time.setText(ExecuteTheRecipe.ReadShort(PLCName.当前重量));
- else max_time.setText(ExecuteTheRecipe.ReadShort(PLCName.当前重量));
+ float weight = (float) (ExecuteTheRecipe.ReadShort(PLCName.称当前重量)/10.0);
+ MessageLog.ShowInfo("下发参数,结束校准 校准重量:"+weight);
+ if(view.getId()==R.id.btn_min_standard) min_weight.setText(weight+"");
+ else max_weight.setText(weight+"");
});
+ WaitDialog.getInstance().Dismiss();
DialogManager.showInfo(activity,"校准完成",AlertDialogButton.OK,null);
- }).OnFailed(msg->{WaitDialog.TimeOut("等待校准完成超时,请退出后重试!");});
+ }).OnFailed(msg->{WaitDialog.getInstance().TimeOut("等待校准完成超时,请退出后重试!");});
TTrig.Remove(name);
- }).OnFailed((msg)->{WaitDialog.TimeOut("等待清零超时,请退出后重试!");});
+ }).OnFailed((msg)->{WaitDialog.getInstance().TimeOut("等待清零超时,请退出后重试!");});
});
}
});
@@ -333,43 +359,63 @@ public class silos_jiaoyan extends LinearLayout {
float minWeight = Float.parseFloat(min_weight.getText().toString());
float weight = Float.parseFloat(sim_discharge_weight.getText().toString());
float maxweight = Float.parseFloat(max_weight.getText().toString());
- if(weightmaxweight){
- DialogManager.showError(activity,"模拟出料重量大于最大出料重量,请重新输入模拟出料重量",AlertDialogButton.OK,null);
- return;
- }
+// if(weightmaxweight){
+// DialogManager.showError(activity,"模拟出料重量大于最大出料重量,请重新输入模拟出料重量",AlertDialogButton.OK,null);
+// return;
+// }
}catch(Exception e){}
-
+ WaitDialog.getInstance().Show("模拟","模拟出料",getContext(),activity);
DialogManager.showWarn(activity,"模拟出料前请将容器放入指定位置!\r\n请问是否继续",AlertDialogButton.YesNo,(s->{
if(s){
try{
float weight = Float.parseFloat(sim_discharge_weight.getText().toString());
BPA_SILOS_CALIBRATE res = QueryDB.GetSilosCalibrateByNum(lcMode.num);
if(res!=null){
- float outValue = Unity.Scale(weight,res.inputWightMax,res.inputWightMin,res.outputTimeMax,res.outputTimeMin);
- WaitDialog.Show("模拟出料","启动模拟出料",getContext(),activity);
- Executor.get().runThread(()->{
- ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"出料时间",(short)(outValue*100),null);//下发出料时间
- ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"启停控制",true,null);//下发启动信号
- WaitDialog.AddText("等待出料完成");
- String name = lcMode.name+lcMode.num+"启停控制";
- Unity.Wait(()->{return TTrig.get(name).Start(ExecuteTheRecipe.ReadBool(name));},(int)(outValue*1000)+2000).OnSource(()->{
- WaitDialog.Dismiss();
- }).OnFailed(msg->{WaitDialog.TimeOut("等待出料完成超时,请退出后重试!");});
- TTrig.Remove(name);
- });
-
+ WaitDialog.getInstance().AddText("电子秤清零");
+ try {
+ ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零
+ Thread.sleep(100);
+ ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零
+ Thread.sleep(100);
+ ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ WaitDialog.getInstance().AddText("等待清零完成");
+ //等待清零完成
+ Unity.Wait(()->{
+ return ExecuteTheRecipe.ReadShort(PLCName.称当前重量)>-20&&ExecuteTheRecipe.ReadShort(PLCName.称当前重量)<=20;},2000).OnSource(()->{
+ float outValue = Unity.Scale(weight,res.inputWightMax,res.inputWightMin,res.outputTimeMax,res.outputTimeMin);
+ WaitDialog.getInstance().Show("模拟出料","启动模拟出料",getContext(),activity);
+ Executor.get().runThread(()->{
+ ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"出料时间",(short)(outValue*100),null);//下发出料时间
+ ExecuteTheRecipe.Write(lcMode.name+lcMode.num+"启停控制",true,null);//下发启动信号
+ WaitDialog.getInstance().AddText("等待出料完成");
+ String name = lcMode.name+lcMode.num+"启停控制";
+ try {
+ Thread.sleep((int)(outValue*1000)+500);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ WaitDialog.getInstance().Dismiss();
+ TTrig.Remove(name);
+ });
+ }).OnFailed((msg)->{WaitDialog.getInstance().TimeOut("等待清零超时,请退出后重试!");});
}else{
DialogManager.showWarn(activity,"料仓参数未校准,请校准后再试!",AlertDialogButton.OK,null);
}
}catch(Exception e){
DialogManager.showError(activity,"模拟出料失败,"+e.getMessage(),AlertDialogButton.OK,null);
}
+ }else {
+ WaitDialog.getInstance().Dismiss();
}
}));
break;
diff --git a/app/src/main/res/layout/datatab/layout/wl_item.xml b/app/src/main/res/layout/datatab/layout/wl_item.xml
index fbce4ddc..27d92d20 100644
--- a/app/src/main/res/layout/datatab/layout/wl_item.xml
+++ b/app/src/main/res/layout/datatab/layout/wl_item.xml
@@ -57,25 +57,25 @@
android:layout_weight="1"
android:background="@drawable/border">
diff --git a/app/src/main/res/layout/fragment_gongneng.xml b/app/src/main/res/layout/fragment_gongneng.xml
index 9fbdfecf..3a9443c6 100644
--- a/app/src/main/res/layout/fragment_gongneng.xml
+++ b/app/src/main/res/layout/fragment_gongneng.xml
@@ -133,7 +133,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed-medium"
- android:text="饮料配方管理"
+ android:text="配方管理"
android:textColor="@color/white"
android:textSize="26dp"
android:focusable="false"/>
@@ -243,13 +243,24 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/app_color_blue" >
-
+ android:layout_height="?attr/qmui_topbar_height">
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_make_good.xml b/app/src/main/res/layout/fragment_make_good.xml
index dd1115fd..79689e9c 100644
--- a/app/src/main/res/layout/fragment_make_good.xml
+++ b/app/src/main/res/layout/fragment_make_good.xml
@@ -66,13 +66,14 @@
android:id="@+id/rv_right"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:layout_marginRight="250dp"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
@@ -164,6 +167,7 @@
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="称(单击清零):"
+ android:paddingTop="15dp"
android:textSize="@dimen/TitleSize" />
+
+
+
diff --git a/app/src/main/res/layout/item/layout/dialog_add_silos_ck.xml b/app/src/main/res/layout/item/layout/dialog_add_silos_ck.xml
index df33e1d0..d62cb3ad 100644
--- a/app/src/main/res/layout/item/layout/dialog_add_silos_ck.xml
+++ b/app/src/main/res/layout/item/layout/dialog_add_silos_ck.xml
@@ -11,7 +11,7 @@
@@ -22,12 +22,11 @@
@@ -139,8 +138,8 @@
android:orientation="vertical">
diff --git a/app/src/main/res/layout/item/layout/loadinggood_item.xml b/app/src/main/res/layout/item/layout/loadinggood_item.xml
index 46ba02f7..7d436089 100644
--- a/app/src/main/res/layout/item/layout/loadinggood_item.xml
+++ b/app/src/main/res/layout/item/layout/loadinggood_item.xml
@@ -10,7 +10,7 @@
+ android:layout_height="100dp">
+ />
@@ -26,6 +27,20 @@
android:text="通道校准"
android:textSize="20dp"
android:textStyle="bold" />
+
+
+
+
+ android:textSize="20sp"/>
+ android:textSize="20sp"/>
+ android:textSize="20sp"/>
+ android:textSize="20sp"/>
+ android:textSize="20sp"/>
+ android:textSize="20sp"/>
+ android:textSize="20sp"/>
+ android:textSize="20sp"/>
+ android:textSize="20sp"/>
+ android:textSize="20sp" />
+
+
+
+
+ android:textSize="20sp"/>
+ android:text="10"
+ android:textSize="20sp"/>
@@ -284,32 +315,20 @@
android:background="@drawable/bg_btn_login_selected"
android:text="模拟出料"
android:textColor="@color/white"
- android:textSize="25sp" />
+ android:textSize="20sp" />
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/item/layout/wdsz_item.xml b/app/src/main/res/layout/item/layout/wdsz_item.xml
index d5ec11f3..c405bc53 100644
--- a/app/src/main/res/layout/item/layout/wdsz_item.xml
+++ b/app/src/main/res/layout/item/layout/wdsz_item.xml
@@ -2,6 +2,7 @@
diff --git a/app/src/main/res/mipmap-xxxhdpi/yxz.png b/app/src/main/res/mipmap-xxxhdpi/yxz.png
new file mode 100644
index 00000000..bceb80e2
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/yxz.png differ
diff --git a/build.gradle b/build.gradle
index d33ce3df..bb47f2fb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -35,8 +35,8 @@ task clean(type: Delete) {
ext { // 统一版本入口
//App版本号
- versionCode = 1
- versionName = "1.0.0"
+ versionCode = 12
+ versionName = "1.2.0"
// 支持Android版本
buildToolsVersion = "33.0.0"
diff --git a/gradle.properties b/gradle.properties
index 5cd40bd4..3fabf948 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx1536m
+org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects