@@ -924,19 +924,6 @@ public class ConfigName { | |||
//region 火力最大级别 | |||
public String HuoLi = "八档"; | |||
//endregion | |||
/** | |||
* 炒锅状态上报信息 | |||
*/ | |||
public List<StatusMode> statusModes = new ArrayList<StatusMode>() {{ | |||
//硬件设备 初始化 | |||
add(new StatusMode("急停", false, R.mipmap.jiting, R.mipmap.jiting, 0)); | |||
add(new StatusMode("炒锅正限位报警", false, R.mipmap.cg_sxw, R.mipmap.cg_sxw, 2)); | |||
add(new StatusMode("炒锅负限位报警", false, R.mipmap.cgxxw, R.mipmap.cgxxw, 3)); | |||
add(new StatusMode("编码器通讯异常", false, R.mipmap.bmq, R.mipmap.bmq, 4)); | |||
add(new StatusMode("搅拌电机变频器通讯异常", false, R.mipmap.bpq, R.mipmap.bpq, 6)); | |||
add(new StatusMode("翻转电机变频器通讯异常", false, R.mipmap.bpq, R.mipmap.bpq, 7)); | |||
}}; | |||
/** | |||
* 电机状态上报信息 | |||
*/ | |||
@@ -381,11 +381,13 @@ public class DataBus { | |||
//endregion | |||
//region 自动清洗 | |||
public boolean ZDQX_IsStart = false; | |||
public ArrayList<BPA_SUGAR> zdqx = new ArrayList<BPA_SUGAR>(); | |||
public zdqxchid_adapter zdqxchidAdapter=null; | |||
public void GetZDQXChid() | |||
{ | |||
try { | |||
DataBus.getInstance().ZDQX_IsStart=false; | |||
zdqx.clear(); | |||
ArrayList<BPA_SUGAR> data= QueryDB.GetSugarALL(); | |||
@@ -475,17 +477,6 @@ public class DataBus { | |||
/** | |||
* 设备状态列表 | |||
*/ | |||
public List<StatusMode> statusModes = new ArrayList<StatusMode>(); | |||
public void Sbzt() | |||
{ | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) | |||
{ | |||
}else | |||
{ | |||
} | |||
} | |||
public ArrayList<StatusMode> statusModes = new ArrayList<StatusMode>(); | |||
//endregion | |||
} |
@@ -9,15 +9,12 @@ public class StatusMode { | |||
public int Url_open; | |||
public int Url_close; | |||
public int sort; | |||
public StatusMode(String name,Boolean Status,int Url_open,int | |||
Url_close,int sort) | |||
public StatusMode(String name,int Url_open,int Url_close,Boolean Status) | |||
{ | |||
this.Name=name; | |||
this.Status=Status; | |||
this.Url_open=Url_open; | |||
this.Url_close=Url_close; | |||
this.sort=sort; | |||
} | |||
} |
@@ -357,26 +357,10 @@ public class MainNavigateTabBar extends LinearLayout implements View.OnClickList | |||
public void SetDataResh(int index) | |||
{ | |||
if(index==1)//校验 | |||
{ | |||
//刷新料仓 | |||
//DataBus.getInstance().GetSilosLsjy(); | |||
//刷新温度控制 | |||
//DataBus.getInstance().GetWdsz(); | |||
//刷新手动控制 | |||
}else if (index==3) | |||
if (index==3) | |||
{ | |||
//刷新商品 | |||
new Thread(new Runnable() { | |||
@Override | |||
public void run() { | |||
//设置清洗模式 | |||
ExecuteTheRecipe.WritePLC("清洗模式",false,null); | |||
ExecuteTheRecipe.WritePLC("砝码校准模式",false,null); | |||
ExecuteTheRecipe.WritePLC("手自切换", true, null); | |||
} | |||
}).start(); | |||
} | |||
} | |||
@@ -17,6 +17,7 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.db.res.StatusMode; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
@@ -28,10 +29,12 @@ public class devstatus_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol | |||
private Context context; | |||
List<StatusMode> statusModes = DataBus.getInstance().statusModes; | |||
public ArrayList<StatusMode> statusModes = DataBus.getInstance().statusModes; | |||
public Activity activity; | |||
public devstatus_adapter(Context context) { | |||
public devstatus_adapter(Context context, Activity _activity) { | |||
this.context = context; | |||
activity=_activity; | |||
mLayoutInflater = LayoutInflater.from(context); | |||
} | |||
@@ -39,15 +42,15 @@ public class devstatus_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol | |||
@Override | |||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
View inflate = mLayoutInflater.inflate(R.layout.devstatus, parent, false); | |||
return new devstatus_adapter.MyViewHolder(inflate); | |||
return new MyViewHolder(inflate); | |||
} | |||
@Override | |||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { | |||
try { | |||
if (holder instanceof devstatus_adapter.MyViewHolder) { | |||
devstatus_adapter.MyViewHolder myViewHolder = (devstatus_adapter.MyViewHolder) holder; | |||
if (holder instanceof MyViewHolder) { | |||
MyViewHolder myViewHolder = (MyViewHolder) holder; | |||
StatusMode statusMode= statusModes.get(position); | |||
myViewHolder.title.setText(statusMode.Name); | |||
if(statusMode.Status) | |||
@@ -66,34 +69,21 @@ public class devstatus_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol | |||
e.printStackTrace(); | |||
} | |||
} | |||
private Activity findActivity(@NonNull Context context) { | |||
if (context instanceof Activity) { | |||
return (Activity) context; | |||
} else if (context instanceof ContextWrapper) { | |||
return findActivity(((ContextWrapper) context).getBaseContext()); | |||
} else { | |||
return null; | |||
} | |||
} | |||
/** | |||
* 刷新 | |||
* @param | |||
*/ | |||
public void refresh(){ | |||
Activity activity= findActivity(context); | |||
if(activity!=null) | |||
{ | |||
activity.runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
notifyDataSetChanged(); | |||
} catch (Exception e) { | |||
} | |||
activity.runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
notifyDataSetChanged(); | |||
} catch (Exception e) { | |||
} | |||
}); | |||
} | |||
} | |||
}); | |||
} | |||
@Override | |||
@@ -30,7 +30,7 @@ public class monitor_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolde | |||
private Context context; | |||
List<StatusMode> statusModes = ConfigName.getInstance().statusModes; | |||
List<StatusMode> statusModes = DataBus.getInstance().statusModes; | |||
public monitor_adapter(Context context) { | |||
this.context = context; | |||
@@ -27,7 +27,10 @@ import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUGAR; | |||
import com.bonait.bnframework.common.db.res.wdszMode; | |||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
import com.suke.widget.SwitchButton; | |||
import java.util.List; | |||
@@ -128,16 +131,27 @@ public class zdqxchid_adapter extends RecyclerView.Adapter<RecyclerView.ViewHold | |||
+myViewHolder.edittext_xhsj.getText().toString()+"|" | |||
+myViewHolder.edittext_qxwd.getText().toString(); | |||
QueryDB.UpdateSugar(goodsMake); | |||
ToastUtils.info("保存成功!"); | |||
} | |||
}); | |||
myViewHolder.delete_time.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
QueryDB.DeleteSugar(goodsMake); | |||
zdqxModes.remove(position); | |||
notifyDataSetChanged(); | |||
String title = "温馨提示!"; | |||
String message = "客官确定要删除【"+"步骤-"+(position+1)+"】吗?"; | |||
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
QueryDB.DeleteSugar(goodsMake); | |||
zdqxModes.remove(position); | |||
notifyDataSetChanged(); | |||
dialog.dismiss(); | |||
} | |||
}); | |||
} | |||
}); | |||
} | |||
@@ -145,15 +159,6 @@ public class zdqxchid_adapter extends RecyclerView.Adapter<RecyclerView.ViewHold | |||
e.printStackTrace(); | |||
} | |||
} | |||
private Activity findActivity(@NonNull Context context) { | |||
if (context instanceof Activity) { | |||
return (Activity) context; | |||
} else if (context instanceof ContextWrapper) { | |||
return findActivity(((ContextWrapper) context).getBaseContext()); | |||
} else { | |||
return null; | |||
} | |||
} | |||
/** | |||
* 刷新 | |||
* @param | |||
@@ -23,8 +23,10 @@ import android.widget.TextView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.model.mode.ResMenuLeft; | |||
import com.bonait.bnframework.common.tabbar.MainNavigateTabBar; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter; | |||
import com.bonait.bnframework.modules.home.adapter.jiaoyan_adapter; | |||
import com.bonait.bnframework.modules.home.fragment.from.fragment.JiaoYan_clsfbc_fragment; | |||
@@ -117,6 +119,8 @@ public class JiaoYanFragment extends BaseFragment { | |||
fragmentList.add(item.fragment); | |||
} | |||
ShowFragment(menuModes.get(0).fragment); | |||
rv_left.setSelection(0); | |||
adapter=new jiaoyan_adapter(getContext(),menuModes); | |||
rv_left.setAdapter(adapter); | |||
rv_left.setOnItemClickListener(new AdapterView.OnItemClickListener() { | |||
@@ -125,6 +129,7 @@ public class JiaoYanFragment extends BaseFragment { | |||
ItemClick(adapterView,view,i,l); | |||
} | |||
}); | |||
} | |||
/** | |||
* 配置ViewPager监听器,手指滑动监听 | |||
@@ -150,6 +155,12 @@ public class JiaoYanFragment extends BaseFragment { | |||
* @param id | |||
*/ | |||
public void ItemClick(AdapterView<?> adapterView, View view, int position, long id) { | |||
if(DataBus.getInstance().ZDQX_IsStart) | |||
{ | |||
ToastUtils.warning("自动清洗中,请等待清洗完成!"); | |||
return; | |||
} | |||
//即使刷新adapter | |||
mPosition=position; | |||
adapter.notifyDataSetChanged(); | |||
@@ -241,6 +241,12 @@ public class MakeGoodFragment extends BaseFragment { | |||
return; | |||
} | |||
if(DataBus.getInstance().ZDQX_IsStart) | |||
{ | |||
ToastUtils.warning("自动清洗中,请等待清洗完成!"); | |||
return; | |||
} | |||
if(ExecuteTheRecipe.IsMakeGood) | |||
{ | |||
ToastUtils.warning("请耐心等待上一商品制作完成..."); | |||
@@ -286,6 +292,16 @@ public class MakeGoodFragment extends BaseFragment { | |||
} | |||
} | |||
new Thread(new Runnable() { | |||
@Override | |||
public void run() { | |||
//设置清洗模式 | |||
ExecuteTheRecipe.WritePLC("清洗模式",false,null); | |||
ExecuteTheRecipe.WritePLC("砝码校准模式",false,null); | |||
ExecuteTheRecipe.WritePLC("手自切换", true, null); | |||
} | |||
}).start(); | |||
String title = "温馨提示!"; | |||
String message = "客官确定要开始制作【"+makegood.good.name+"】吗?"; | |||
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { | |||
@@ -7,15 +7,21 @@ import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.db.res.StatusMode; | |||
import com.bonait.bnframework.common.view.MyLayoutManager; | |||
import com.bonait.bnframework.modules.home.adapter.devstatus_adapter; | |||
import com.bonait.bnframework.modules.home.fragment.GuanLifragment; | |||
import com.bonait.bnframework.modules.home.fragment.from.fragment.Jcsjgl_sxgl_fragment; | |||
import com.bonait.bnframework.modules.home.fragment.from.fragment.Jcsjgl_wl_fragment; | |||
@@ -25,6 +31,8 @@ import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
import com.qmuiteam.qmui.widget.QMUIViewPager; | |||
import com.qmuiteam.qmui.widget.tab.QMUITabSegment; | |||
import java.util.ArrayList; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
@@ -35,12 +43,14 @@ public class RealTimeActivity extends BaseActivity { | |||
@BindView(R.id.recycler_view) | |||
RecyclerView recycler_view; | |||
private Context context; | |||
Activity activity=null; | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setContentView(R.layout.activity_realtime); | |||
ButterKnife.bind(this); | |||
context=getContext(); | |||
activity=this; | |||
initTopBar(); | |||
initFragment(); | |||
} | |||
@@ -54,11 +64,186 @@ public class RealTimeActivity extends BaseActivity { | |||
} | |||
}); | |||
} | |||
public devstatus_adapter adapter=null; | |||
/** | |||
* viewPager里添加fragment | |||
*/ | |||
private void initFragment() { | |||
Initdata(); | |||
MyLayoutManager layout = new MyLayoutManager(); | |||
layout.setAutoMeasureEnabled(true); | |||
recycler_view.setLayoutManager(layout); | |||
adapter = new devstatus_adapter(getContext(),this); | |||
recycler_view.setAdapter(adapter); | |||
} | |||
/** | |||
* 初始化数据加载 | |||
*/ | |||
public void Initdata() | |||
{ | |||
try{ | |||
if (!ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) | |||
{ | |||
DataBus.getInstance().statusModes=new ArrayList<>(); | |||
DataBus.getInstance().statusModes.add(new StatusMode("出料口光电",R.mipmap.gd1,R.mipmap.gd2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("果糖电机(左)",R.mipmap.djcgq1,R.mipmap.djcgq2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("清洗池浮球",R.mipmap.fq1,R.mipmap.fq2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("果糖电机(右)",R.mipmap.djcgq1,R.mipmap.djcgq2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("果糖液位检测(左)",R.mipmap.fq1,R.mipmap.fq2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("果糖液位检测(右)",R.mipmap.fq1,R.mipmap.fq2,false)); | |||
//16 | |||
DataBus.getInstance().statusModes.add(new StatusMode("果糖加热(左)",R.mipmap.lcjr1,R.mipmap.lcjr2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("果糖加热(右)",R.mipmap.lcjr1,R.mipmap.lcjr2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("清洗池加热",R.mipmap.lcjr1,R.mipmap.lcjr2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("三色灯(红)",R.mipmap.ssd1,R.mipmap.ssd2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("三色灯(黄)",R.mipmap.ssd1,R.mipmap.ssd2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("三色灯(绿)",R.mipmap.ssd1,R.mipmap.ssd2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(一)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(二)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(三)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(四)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(五)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(一)",R.mipmap.lxl1,R.mipmap.lxl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(二)",R.mipmap.lxl1,R.mipmap.lxl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(三)",R.mipmap.lxl1,R.mipmap.lxl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(四)",R.mipmap.lxl1,R.mipmap.lxl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(五)",R.mipmap.lxl1,R.mipmap.lxl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("果糖泵(左)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("果糖泵(右)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("清洗剂泵",R.mipmap.lxl1,R.mipmap.lxl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("排水阀开",R.mipmap.csf1,R.mipmap.csf2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("排水阀关",R.mipmap.csf1,R.mipmap.csf2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("进水阀",R.mipmap.jsf1,R.mipmap.jsf2,false)); | |||
}else | |||
{ | |||
DataBus.getInstance().statusModes=new ArrayList<>(); | |||
DataBus.getInstance().statusModes.add(new StatusMode("出料口按钮",R.mipmap.gd1,R.mipmap.gd2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("清洗池浮球",R.mipmap.fq1,R.mipmap.fq2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(一)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(二)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(三)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(四)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(五)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(六)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(一)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(二)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(三)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(四)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(五)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(六)",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(一)",R.mipmap.djcgq1,R.mipmap.djcgq2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(二)",R.mipmap.djcgq1,R.mipmap.djcgq2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(三)",R.mipmap.djcgq1,R.mipmap.djcgq2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("酱油泵",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("醋泵",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("猪油泵",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("牛油泵",R.mipmap.rdl1,R.mipmap.rdl2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("水池进水阀",R.mipmap.jsf1,R.mipmap.jsf2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("水池排水阀",R.mipmap.csf1,R.mipmap.csf2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("猪油管道保温",R.mipmap.lcjr1,R.mipmap.lcjr2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("牛油管道保温",R.mipmap.lcjr1,R.mipmap.lcjr2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("水池加热",R.mipmap.lcjr1,R.mipmap.lcjr2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("三色灯(绿)",R.mipmap.ssd1,R.mipmap.ssd2,false)); | |||
DataBus.getInstance().statusModes.add(new StatusMode("三色灯(红)",R.mipmap.ssd1,R.mipmap.ssd2,false)); | |||
} | |||
Run(); | |||
}catch(Exception e){ | |||
} | |||
} | |||
/** | |||
* 设置状态显示 | |||
* @param i | |||
* @param bool | |||
*/ | |||
public void SetStatus(int i,boolean bool) | |||
{ | |||
if(DataBus.getInstance().statusModes.size()>=i) | |||
{ | |||
StatusMode mode= DataBus.getInstance().statusModes.get(i); | |||
mode.Status=bool; | |||
DataBus.getInstance().statusModes.set(i,mode); | |||
} | |||
} | |||
/** | |||
* 实时显示线程 | |||
*/ | |||
public void Run() { | |||
new Thread(new Runnable() { | |||
@Override | |||
public void run() { | |||
while (ConfigName.getInstance().PlcIsConnect) { | |||
try { | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
if (!ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) | |||
{ | |||
//64位 | |||
//1.出口 0-15 | |||
SetStatus(0,ExecuteTheRecipe.getConcurrentHash(0)); | |||
SetStatus(1,ExecuteTheRecipe.getConcurrentHash(1)); | |||
SetStatus(2,ExecuteTheRecipe.getConcurrentHash(2)); | |||
SetStatus(3,ExecuteTheRecipe.getConcurrentHash(3)); | |||
SetStatus(4,ExecuteTheRecipe.getConcurrentHash(4)); | |||
SetStatus(5,ExecuteTheRecipe.getConcurrentHash(5)); | |||
//3. | |||
for(int i=0;i<6;i++)//25 | |||
{ | |||
SetStatus(2+i,ExecuteTheRecipe.getConcurrentHash(16+i)); | |||
} | |||
for(int i=0;i<16;i++)//25 | |||
{ | |||
SetStatus(12+i,ExecuteTheRecipe.getConcurrentHash(32+i)); | |||
} | |||
adapter.refresh(); | |||
}else | |||
{ | |||
//64位 | |||
//1.出口 0-15 | |||
SetStatus(0,ExecuteTheRecipe.getConcurrentHash(0)); | |||
SetStatus(1,ExecuteTheRecipe.getConcurrentHash(1)); | |||
//3. | |||
for(int i=0;i<10;i++)//25 | |||
{ | |||
SetStatus(2+i,ExecuteTheRecipe.getConcurrentHash(16+i)); | |||
} | |||
for(int i=0;i<16;i++)//25 | |||
{ | |||
SetStatus(12+i,ExecuteTheRecipe.getConcurrentHash(32+i)); | |||
} | |||
adapter.refresh(); | |||
} | |||
} catch (Exception e) { | |||
} | |||
} | |||
}); | |||
Thread.sleep(500); | |||
} catch (InterruptedException e) { | |||
throw new RuntimeException(e); | |||
} | |||
} | |||
} | |||
}).start(); | |||
} | |||
//-------------------------配置viewPager与fragment关联----------------------------// | |||
@@ -70,7 +70,6 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||
Initdata(); | |||
} | |||
boolean IsStart = false; | |||
@OnClick({R.id.bt_add_zdqx,R.id.bt_start}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
@@ -83,7 +82,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||
break; | |||
case R.id.bt_start://开始清洗 | |||
if (IsStart) { | |||
if (DataBus.getInstance().ZDQX_IsStart) { | |||
String title = "温馨提示!"; | |||
String message = "客官确定要强制停止清洗吗?"; | |||
@@ -94,7 +93,8 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||
getActivity().runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
IsStart=false; | |||
ExecuteTheRecipe.WritePLC("清洗模式", false,null); | |||
DataBus.getInstance().ZDQX_IsStart=false; | |||
bt_start.setText("开始清洗"); | |||
bt_start.setBackgroundResource(R.drawable.sz_bj); | |||
@@ -116,7 +116,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||
getActivity().runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
IsStart=true; | |||
DataBus.getInstance().ZDQX_IsStart=true; | |||
bt_start.setText("正在清洗"); | |||
bt_start.setBackgroundResource(R.drawable.cp_bj); | |||
} | |||
@@ -144,7 +144,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||
}; | |||
long a = System.currentTimeMillis(); | |||
while (IsStart && !IsStop[0]) { | |||
while (DataBus.getInstance().ZDQX_IsStart && !IsStop[0]) { | |||
if ((System.currentTimeMillis() - a) > 1000 * 500) { | |||
break; | |||
} | |||
@@ -154,7 +154,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||
DataBus.getInstance().zdqxchidAdapter.refresh(); | |||
} | |||
if(IsStart) | |||
if(DataBus.getInstance().ZDQX_IsStart) | |||
{ | |||
ExecuteTheRecipe.WritePLC("管道自动排水",true,null); | |||
} | |||
@@ -211,7 +211,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||
@Override | |||
public void run() { | |||
ToastUtils.warning("清洗完成!"); | |||
IsStart=false; | |||
DataBus.getInstance().ZDQX_IsStart=false; | |||
bt_start.setText("开始清洗"); | |||
bt_start.setBackgroundResource(R.drawable.sz_bj); | |||
@@ -17,6 +17,7 @@ import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1; | |||
import com.bonait.bnframework.common.helper.AutoNextLineLinearLayout; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
public class sdkz_control extends LinearLayout { | |||
@@ -69,8 +70,17 @@ public class sdkz_control extends LinearLayout { | |||
public void onClick(View view) { | |||
boolean isopen= aSwitch.isChecked(); | |||
String addr= aSwitch.getTag().toString(); | |||
ExecuteTheRecipe.WritePLC("手自切换",false,null); | |||
ExecuteTheRecipe.WritePLCSD(addr,isopen,null); | |||
new Thread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
ExecuteTheRecipe.WritePLC("手自切换",false,null); | |||
ExecuteTheRecipe.WritePLCSD(addr,isopen,null); | |||
} catch (Exception e) { | |||
} | |||
} | |||
}).start(); | |||
ToastUtils.info(aSwitch.getText().toString()+",地址:"+addr+".状态:"+isopen); | |||
} | |||
}); | |||
@@ -5,9 +5,9 @@ | |||
android:orientation="vertical" | |||
android:padding="5dp"> | |||
<RelativeLayout | |||
android:layout_height="160dp" | |||
android:layout_height="140dp" | |||
android:layout_width="130dp" | |||
android:background="@drawable/shadow_bottom"> | |||
android:background="@color/activity_background1"> | |||
<TextView | |||
android:id="@+id/title" | |||
android:layout_marginTop="10dp" | |||
@@ -25,7 +25,7 @@ | |||
android:layout_height="60dp" | |||
android:layout_alignParentTop="true" | |||
android:layout_centerInParent="true" | |||
android:layout_marginTop="45dp"> | |||
android:layout_marginTop="40dp"> | |||
</ImageView> | |||
<TextView | |||
android:id="@+id/text" | |||
@@ -14,7 +14,7 @@ | |||
android:layout_width="300dp" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical" | |||
android:background="@mipmap/listbj"> | |||
android:background="@color/activity_background1"> | |||
<TextView | |||
android:layout_marginTop="60dp" | |||