@@ -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 { | |||
@@ -146,6 +146,7 @@ | |||
<activity | |||
android:name=".modules.home.activity.BottomNavigationMainActivity" | |||
android:exported="false" | |||
android:launchMode="singleTask" | |||
android:windowSoftInputMode="stateHidden|stateAlwaysHidden" | |||
/> | |||
<activity | |||
@@ -6,41 +6,66 @@ import android.content.Context; | |||
import android.content.DialogInterface; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import java.lang.ref.WeakReference; | |||
public class WaitDialog { | |||
static Context context; | |||
static Activity activity; | |||
static ProgressDialog progressDialog; | |||
private WeakReference<Activity> activityWeakReference; | |||
private WeakReference<Context> 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); | |||
} | |||
} |
@@ -25,7 +25,6 @@ public class Unity { | |||
if(func==null) return OperateResult.CreateFailed("条件为空"); | |||
boolean tag=false; | |||
while(!tag){ | |||
Delay(100); | |||
tag=func.Run(); | |||
Delay(100); | |||
if(timeOut>0&&(System.currentTimeMillis()-startTime)>timeOut) break; | |||
@@ -82,7 +82,7 @@ public class MainInit { | |||
MainNotification.initNotificationChannel(app); | |||
// 内存泄漏检测 | |||
initLeakCanary(BuildConfig.DEBUG,app); | |||
initLeakCanary(true,app); | |||
// Log日志打印框架 | |||
initLogCat(); | |||
@@ -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; | |||
@@ -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) { | |||
@@ -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"; | |||
} | |||
//调味吧台 | |||
@@ -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<RecyclerView.ViewH | |||
private MyClickListener mListener; | |||
private ArrayList<ResGoodsMake> 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<RecyclerView.ViewH | |||
break; | |||
case "制作中": | |||
// myViewHolder.quxiaozhizuo.setVisibility(View.VISIBLE);//取消制作 | |||
myViewHolder.loading_status.setTextColor(conmain.getResources().getColor(R.color.green_primary_dark)); | |||
myViewHolder.loading_status.setTextColor(myViewHolder.loading_status.getContext().getResources().getColor(R.color.green_primary_dark)); | |||
break; | |||
case "制作完成": | |||
// myViewHolder.quxiaozhizuo.setVisibility(View.VISIBLE);//取消制作 | |||
@@ -105,7 +110,7 @@ public class loadinggood_adapter extends RecyclerView.Adapter<RecyclerView.ViewH | |||
public void onClick(View view) { | |||
String title = "温馨提示!"; | |||
String message = "客官确定要取消制作【"+goodsMake.good.name+"】吗?"; | |||
AlertDialogUtils.showDialog(conmain, title, message, new QMUIDialogAction.ActionListener() { | |||
AlertDialogUtils.showDialog(MainApplication.getContext(), title, message, new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
DataBus.getInstance().DeleteGoodsMake(goodsMake.subOrder.id); | |||
@@ -134,16 +139,17 @@ public class loadinggood_adapter extends RecyclerView.Adapter<RecyclerView.ViewH | |||
* @param | |||
*/ | |||
public void refresh() { | |||
activity.runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
if(handler!=null){ | |||
handler.postDelayed(new Runnable() { | |||
@Override | |||
public void run() { | |||
datas= DataBus.getInstance().GoodsMake; | |||
notifyDataSetChanged(); | |||
} catch (Exception e) { | |||
LogUtils.error("****","刷新 size="+datas.size()); | |||
} | |||
} | |||
}); | |||
},500); | |||
} | |||
} | |||
/** | |||
@@ -67,6 +67,7 @@ public class wdsz_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> | |||
myViewHolder.control_switch_bs.setChecked(false); | |||
if(goodsMake.name.equals("水池温度")) | |||
{ | |||
myViewHolder.zdbs1.setVisibility(View.VISIBLE); | |||
myViewHolder.zdbs2.setVisibility(View.VISIBLE); | |||
@@ -322,6 +323,10 @@ public class wdsz_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> | |||
* 保存值 | |||
*/ | |||
Button save_value; | |||
/** | |||
* 父容器 | |||
*/ | |||
RelativeLayout root; | |||
RelativeLayout zdbs1,zdbs2,zdbs3,show_wdsz,show_wd; | |||
public WDSZViewHolder(View view) { | |||
@@ -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<BPA_MATERIAL> { | |||
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); | |||
@@ -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; | |||
@@ -164,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; | |||
@@ -302,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); | |||
} | |||
@@ -457,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}) | |||
@@ -498,7 +512,7 @@ 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; | |||
@@ -75,7 +75,7 @@ public class SheZhifragment extends BaseFragment { | |||
skipToActivity(DzcjyActivity.class); | |||
break; | |||
case R.id.wdsz://温度设置 | |||
skipToActivity(WdszActivity.class); | |||
// skipToActivity(WdszActivity.class); | |||
break; | |||
} | |||
} | |||
@@ -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,7 @@ public class SilosNewActivity extends BaseActivity { | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
silos_jz.close(); | |||
MessageManager.getInstance().unRegisterMessageReceiver(this); | |||
} | |||
@@ -33,6 +33,9 @@ import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.helper.MessageLog; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import java.util.Timer; | |||
import java.util.TimerTask; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
@@ -71,8 +74,9 @@ public class silos_jiaoyan extends LinearLayout { | |||
@BindView(R.id.sim_discharge_weight) | |||
EditText sim_discharge_weight; | |||
@BindView(R.id.tv_discharge_result) | |||
TextView tv_discharge_result; | |||
@BindView(R.id.current_weight) | |||
TextView current_weight; | |||
// @BindView(R.id.controlStatus) | |||
// TextView controlStatus; | |||
@@ -139,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"); | |||
} | |||
@@ -180,34 +184,22 @@ public class silos_jiaoyan extends LinearLayout { | |||
public void Run() { | |||
final int kkk = lcMode.num; | |||
try { | |||
if(activity!=null) | |||
{ | |||
activity.runOnUiThread(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)); | |||
mHandler.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)); | |||
// wljz3.setText(zll + ""); | |||
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()); | |||
lcMode.jValue = zll; | |||
QueryDB.UpdateJYZ(lcMode.id, zll); | |||
ToastUtils.warning("通道校准完成!"); | |||
} | |||
}, 2000); | |||
} catch (Exception e) { | |||
ToastUtils.error("重量解析显示异常!" + e.getMessage()); | |||
} | |||
} | |||
}; | |||
@@ -234,11 +226,42 @@ 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(timer!=null){ | |||
timer.cancel(); | |||
timer = null; | |||
} | |||
if(timerTask!=null){ | |||
timerTask.cancel(); | |||
timerTask = null; | |||
} | |||
} | |||
private float EditTextValidate(EditText et,String info){ | |||
@@ -267,26 +290,33 @@ public class silos_jiaoyan extends LinearLayout { | |||
if(time<0) return; | |||
DialogManager.showWarn(activity,"校准前请确认是否准备就绪?\r\n是否开始校准?", AlertDialogButton.YesNo,s->{ | |||
if(s){ | |||
WaitDialog.Show(view.getId()==R.id.min_time?"最小校准":"最大校准","开始校准",getContext(),activity); | |||
WaitDialog.getInstance().Show(view.getId()==R.id.min_time?"最小校准":"最大校准","开始校准",getContext(),activity); | |||
Executor.get().runThread(()->{ | |||
WaitDialog.AddText("电子秤清零"); | |||
ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零 | |||
ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零 | |||
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.称当前重量)>-20&&ExecuteTheRecipe.ReadShort(PLCName.称当前重量)<=20;},3000).OnSource(()->{ | |||
Unity.Wait(()->{ | |||
return ExecuteTheRecipe.ReadShort(PLCName.称当前重量)>-20&&ExecuteTheRecipe.ReadShort(PLCName.称当前重量)<=20;},3000).OnSource(()->{ | |||
WaitDialog.AddText("下发参数,开始校准"); | |||
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*1000+2000)).OnSource(()->{ | |||
@@ -304,11 +334,11 @@ public class silos_jiaoyan extends LinearLayout { | |||
if(view.getId()==R.id.btn_min_standard) min_weight.setText(weight+""); | |||
else max_weight.setText(weight+""); | |||
}); | |||
WaitDialog.Dismiss(); | |||
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("等待清零超时,请退出后重试!");}); | |||
}); | |||
} | |||
}); | |||
@@ -329,49 +359,52 @@ public class silos_jiaoyan extends LinearLayout { | |||
// } | |||
}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){ | |||
WaitDialog.AddText("电子秤清零"); | |||
ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零 | |||
ExecuteTheRecipe.Write(PLCName.重量清零, true, null);//电子秤重量清零 | |||
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.称当前重量)>-20&&ExecuteTheRecipe.ReadShort(PLCName.称当前重量)<=20;},3000).OnSource(()->{ | |||
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.Show("模拟出料","启动模拟出料",getContext(),activity); | |||
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.AddText("等待出料完成"); | |||
WaitDialog.getInstance().AddText("等待出料完成"); | |||
String name = lcMode.name+lcMode.num+"启停控制"; | |||
Unity.Wait(()->{return TTrig.get(name).Start(ExecuteTheRecipe.ReadBool(name));},(int)(outValue*1000)+2000).OnSource(()->{ | |||
try { | |||
Thread.sleep(500); | |||
} catch (InterruptedException e) { | |||
throw new RuntimeException(e); | |||
} | |||
WaitDialog.Dismiss(); | |||
activity.runOnUiThread(()->{ | |||
float resultWeight = (float) (ExecuteTheRecipe.ReadShort(PLCName.称当前重量)/10.0); | |||
tv_discharge_result.setText(resultWeight+"g"); | |||
}); | |||
}).OnFailed(msg->{WaitDialog.TimeOut("等待出料完成超时,请退出后重试!");}); | |||
try { | |||
Thread.sleep((int)(outValue*1000)+500); | |||
} catch (InterruptedException e) { | |||
throw new RuntimeException(e); | |||
} | |||
WaitDialog.getInstance().Dismiss(); | |||
TTrig.Remove(name); | |||
}); | |||
}).OnFailed((msg)->{WaitDialog.TimeOut("等待清零超时,请退出后重试!");}); | |||
}).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; | |||
@@ -148,6 +148,7 @@ | |||
android:layout_height="wrap_content" | |||
android:layout_margin="5dp" | |||
android:text="水箱:" | |||
android:visibility="gone" | |||
android:textSize="@dimen/TitleSize" /> | |||
<TextView | |||
@@ -155,6 +156,7 @@ | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_margin="5dp" | |||
android:visibility="gone" | |||
android:text="89.9°C" | |||
android:textColor="@color/green_primary" | |||
android:textSize="@dimen/TitleSize" /> | |||
@@ -78,6 +78,7 @@ | |||
android:layout_height="match_parent" | |||
android:layout_margin="20dp" | |||
android:layout_weight="1" | |||
android:visibility="gone" | |||
android:orientation="vertical"> | |||
<LinearLayout | |||
@@ -157,6 +158,14 @@ | |||
android:textSize="26dp" /> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_margin="20dp" | |||
android:layout_weight="1" | |||
android:orientation="vertical"/> | |||
</LinearLayout> | |||
</LinearLayout> | |||
@@ -3,6 +3,7 @@ | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:clickable="true" | |||
android:focusable="true" | |||
android:background="@color/black"> | |||
@@ -38,7 +39,7 @@ | |||
android:id="@+id/current_weight" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="实际出料重量:" | |||
tools:text="实际出料重量:" | |||
android:textSize="20sp"/> | |||
</LinearLayout> | |||
@@ -156,7 +157,7 @@ | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:background="@drawable/edit_bord" | |||
android:digits="0123456789" | |||
android:digits="0123456789." | |||
android:hint="请输入" | |||
android:inputType="numberDecimal|number" | |||
android:maxLines="1" | |||
@@ -228,7 +229,7 @@ | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:background="@drawable/edit_bord" | |||
android:digits="0123456789" | |||
android:digits="0123456789." | |||
android:hint="请输入" | |||
android:inputType="numberDecimal|number" | |||
android:maxLines="1" | |||
@@ -296,12 +297,12 @@ | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:background="@drawable/edit_bord" | |||
android:digits="0123456789" | |||
android:digits="0123456789." | |||
android:hint="请输入" | |||
android:inputType="number|numberDecimal" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:text="2" | |||
android:text="10" | |||
android:textSize="20sp"/> | |||
</LinearLayout> | |||
@@ -318,32 +319,7 @@ | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="20dp" | |||
android:orientation="horizontal"> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:orientation="horizontal"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="实际出料重量:" | |||
android:textSize="20sp"/> | |||
<TextView | |||
android:id="@+id/tv_discharge_result" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="" | |||
android:textSize="20sp"/> | |||
</LinearLayout> | |||
</LinearLayout> | |||
@@ -2,6 +2,7 @@ | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:layout_width="wrap_content" | |||
android:id="@+id/root" | |||
android:layout_height="match_parent"> | |||
@@ -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" | |||
@@ -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 | |||