|
@@ -9,14 +9,20 @@ import androidx.fragment.app.FragmentTransaction; |
|
|
import androidx.recyclerview.widget.LinearLayoutManager; |
|
|
import androidx.recyclerview.widget.LinearLayoutManager; |
|
|
import androidx.recyclerview.widget.RecyclerView; |
|
|
import androidx.recyclerview.widget.RecyclerView; |
|
|
|
|
|
|
|
|
|
|
|
import android.app.Activity; |
|
|
|
|
|
import android.content.Context; |
|
|
|
|
|
import android.content.ContextWrapper; |
|
|
import android.os.Bundle; |
|
|
import android.os.Bundle; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.LayoutInflater; |
|
|
import android.view.View; |
|
|
import android.view.View; |
|
|
import android.view.ViewGroup; |
|
|
import android.view.ViewGroup; |
|
|
|
|
|
|
|
|
import com.example.bpa.R; |
|
|
import com.example.bpa.R; |
|
|
|
|
|
import com.example.bpa.config.ConfigName; |
|
|
import com.example.bpa.config.DataBus; |
|
|
import com.example.bpa.config.DataBus; |
|
|
|
|
|
import com.example.bpa.helper.MessageLog; |
|
|
import com.example.bpa.helper.WrapContentLinearLayoutManager; |
|
|
import com.example.bpa.helper.WrapContentLinearLayoutManager; |
|
|
|
|
|
import com.example.bpa.service.DeviceData; |
|
|
import com.example.bpa.view.adapter.devstatus_adapter; |
|
|
import com.example.bpa.view.adapter.devstatus_adapter; |
|
|
import com.example.bpa.view.adapter.maingoods_adapter; |
|
|
import com.example.bpa.view.adapter.maingoods_adapter; |
|
|
import com.example.bpa.view.adapter.makegood_adapter; |
|
|
import com.example.bpa.view.adapter.makegood_adapter; |
|
@@ -24,12 +30,14 @@ import com.example.bpa.view.control.MyLayoutManager; |
|
|
import com.example.bpa.view.fragment.setting.mqttparameter; |
|
|
import com.example.bpa.view.fragment.setting.mqttparameter; |
|
|
import com.example.bpa.view.fragment.setting.ovarparameter; |
|
|
import com.example.bpa.view.fragment.setting.ovarparameter; |
|
|
import com.example.bpa.view.fragment.setting.systemparameter; |
|
|
import com.example.bpa.view.fragment.setting.systemparameter; |
|
|
|
|
|
import com.example.bpa.view.from.lsjy_activity; |
|
|
import com.example.bpa.view.mode.StatusMode; |
|
|
import com.example.bpa.view.mode.StatusMode; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
public class SsjkFragment extends Fragment implements View.OnClickListener { |
|
|
public class SsjkFragment extends Fragment implements View.OnClickListener { |
|
|
|
|
|
|
|
|
|
|
|
Activity activity=null; |
|
|
View view; |
|
|
View view; |
|
|
RecyclerView recyclerView; |
|
|
RecyclerView recyclerView; |
|
|
|
|
|
|
|
@@ -52,9 +60,12 @@ public class SsjkFragment extends Fragment implements View.OnClickListener { |
|
|
recyclerView.setLayoutManager(layout); |
|
|
recyclerView.setLayoutManager(layout); |
|
|
adapter = new devstatus_adapter(getContext()); |
|
|
adapter = new devstatus_adapter(getContext()); |
|
|
recyclerView.setAdapter(adapter); |
|
|
recyclerView.setAdapter(adapter); |
|
|
|
|
|
|
|
|
|
|
|
activity=findActivity(view.getContext()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void initEvent() { |
|
|
private void initEvent() { |
|
|
|
|
|
// |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
@@ -64,19 +75,19 @@ public class SsjkFragment extends Fragment implements View.OnClickListener { |
|
|
{ |
|
|
{ |
|
|
try{ |
|
|
try{ |
|
|
DataBus.getInstance().statusModes=new ArrayList<>(); |
|
|
DataBus.getInstance().statusModes=new ArrayList<>(); |
|
|
DataBus.getInstance().statusModes.add(new StatusMode("杯子检测",R.mipmap.gd1,R.mipmap.gd2,true)); |
|
|
|
|
|
|
|
|
DataBus.getInstance().statusModes.add(new StatusMode("杯子检测",R.mipmap.gd1,R.mipmap.gd2,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,true)); |
|
|
|
|
|
|
|
|
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.lxl1,R.mipmap.lxl2,false)); |
|
|
DataBus.getInstance().statusModes.add(new StatusMode("离心泵(四)",R.mipmap.lxl1,R.mipmap.lxl2,true)); |
|
|
|
|
|
|
|
|
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.csf1,R.mipmap.csf2,false)); |
|
|
DataBus.getInstance().statusModes.add(new StatusMode("出水阀",R.mipmap.csf1,R.mipmap.csf2,false)); |
|
@@ -97,8 +108,56 @@ public class SsjkFragment extends Fragment implements View.OnClickListener { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
public void onClick(View v) { |
|
|
public void onClick(View v) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
/** |
|
|
|
|
|
* 实时显示线程 |
|
|
|
|
|
*/ |
|
|
|
|
|
public void Run() { |
|
|
|
|
|
new Thread(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
while (DataBus.getInstance().PlcIsConnect) { |
|
|
|
|
|
try { |
|
|
|
|
|
if(activity!=null) |
|
|
|
|
|
{ |
|
|
|
|
|
activity.runOnUiThread(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
try { |
|
|
|
|
|
// SetStatus(0,DeviceData.getConcurrentHash(1)); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
MessageLog.ShowInfo("状态显示解析异常!"+e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
Thread.sleep(500); |
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}).start(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |