diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0e4c5933..b3ec7717 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -28,6 +28,9 @@
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"
tools:node="merge">
+
diff --git a/app/src/main/java/com/bonait/bnframework/MainApplication.java b/app/src/main/java/com/bonait/bnframework/MainApplication.java
index 18edb603..fb5f3117 100644
--- a/app/src/main/java/com/bonait/bnframework/MainApplication.java
+++ b/app/src/main/java/com/bonait/bnframework/MainApplication.java
@@ -148,18 +148,6 @@ public class MainApplication extends Application {
}
}
- //20个测试商品
- for (int i=0;i<20;i++)
- {
- BPA_GOODS good=new BPA_GOODS();
- good.name="回锅肉"+i;
- good.status=1;
- good.sort=i+1;
- good.maketime=1605+i;
- good.issc=0;
- QueryDB.AddGoods(good);
- }
-
//工序模型表
InitProcessData();
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 e84b6981..8912837b 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
@@ -7,6 +7,7 @@ import com.bonait.bnframework.common.model.mode.DeviceInformation;
import com.bonait.bnframework.common.model.mode.OrganizeMode;
import java.util.HashMap;
+import java.util.LinkedHashMap;
/**
@@ -202,7 +203,7 @@ public class ConfigName {
* PLC地址配置
*/
public HashMap PlcAddress=new HashMap();
- public HashMap PlcAddress_ys=new HashMap(){
+ public LinkedHashMap PlcAddress_ys=new LinkedHashMap(){
{
//搅拌模型
put("搅拌", "M1.0");
diff --git a/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java b/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
index 323509aa..1d0b1782 100644
--- a/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
+++ b/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
@@ -2369,7 +2369,7 @@ public class QueryDB {
* @return
*/
public static ArrayList GetPlcaddressALL() {
- String orderby = Desc_Sort_Up + ',' +Desc_Time_Up;//出料顺序
+ String orderby = Desc_Sort_Up;//出料顺序
String where = "isDelete=?";
String[] args = new String[]{"0"};
ArrayList data = new ArrayList<>();
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/WhActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/WhActivity.java
index fe2a57ad..3be63ae6 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/WhActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/WhActivity.java
@@ -1,6 +1,8 @@
package com.bonait.bnframework.modules.home.fragment.from;
import androidx.annotation.NonNull;
+
+import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsPLCFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
@@ -57,6 +59,8 @@ public class WhActivity extends BaseActivity {
*/
private void initFragment() {
FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager());
+
+ fragmentAdapter.addFragment(new SystemCsPLCFragment());
fragmentAdapter.addFragment(new SystemCsJrFragment());
fragmentAdapter.addFragment(new SystemCsTlFragment());
fragmentAdapter.addFragment(new SystemCsFltlFragment());
@@ -72,15 +76,18 @@ public class WhActivity extends BaseActivity {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
- case R.id.bottom_navigation_1:
+ case R.id.bottom_navigation_0:
viewPager.setCurrentItem(0);
return true;
- case R.id.bottom_navigation_2:
+ case R.id.bottom_navigation_1:
viewPager.setCurrentItem(1);
return true;
- case R.id.bottom_navigation_3:
+ case R.id.bottom_navigation_2:
viewPager.setCurrentItem(2);
return true;
+ case R.id.bottom_navigation_3:
+ viewPager.setCurrentItem(3);
+ return true;
}
return false;
}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsPLCFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsPLCFragment.java
new file mode 100644
index 00000000..05718196
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemCsPLCFragment.java
@@ -0,0 +1,110 @@
+package com.bonait.bnframework.modules.home.fragment.from.fragment;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.text.InputType;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.business.ConfigData;
+import com.bonait.bnframework.common.base.BaseFragment;
+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_PLCADDRESS;
+import com.bonait.bnframework.common.utils.AlertDialogUtils;
+import com.bonait.bnframework.common.utils.NetworkUtils;
+import com.bonait.bnframework.common.utils.ToastUtils;
+import com.bonait.bnframework.modules.home.fragment.mode.fragment_gx;
+import com.bonait.bnframework.modules.home.fragment.mode.fragment_plc;
+import com.orhanobut.logger.Logger;
+import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
+import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
+
+import java.util.ArrayList;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+
+public class SystemCsPLCFragment extends BaseFragment {
+ @BindView(R.id.gxchid)
+ LinearLayout gxchid;//工序子集
+
+ private Context context;
+ @Override
+ protected View onCreateView() {
+ View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_system_cs_plc, null);
+ ButterKnife.bind(this, root);
+ return root;
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ Logger.d("我的fragment创建");
+ context = getContext();
+ Init();
+ }
+
+ /**
+ * 初始化
+ */
+ public void Init()
+ {
+ gxchid.removeAllViews();
+ ArrayList arrayList= QueryDB.GetPlcaddressALL();
+ for (BPA_PLCADDRESS item:arrayList)
+ {
+ fragment_plc gongxu=new fragment_plc(context,null,item);
+ gxchid.addView(gongxu);
+ }
+ }
+
+ @OnClick({R.id.chushihua})
+ public void onViewClicked(View view) {
+ switch (view.getId()) {
+ case R.id.chushihua:
+ String title = "温馨提示!";
+ String message = "客官确定要初始化PLC地址吗,小菠萝温馨提示你,此操作将会影响到实际运行哦?";
+ AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() {
+ @Override
+ public void onClick(QMUIDialog dialog, int index) {
+ ConfigData.getInstance().RevertPLC();
+ Init();
+ ToastUtils.info("初始化成功!");
+ dialog.dismiss();
+ }
+ });
+ break;
+
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ Logger.d("我的fragment销毁");
+ }
+
+ /**
+ * 当在activity设置viewPager + BottomNavigation + fragment时,
+ * 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题,
+ * 必须加上此方法,禁止fragment左滑返回上一界面。
+ *
+ * 切记!切记!切记!否则会闪退!
+ *
+ * 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。
+ */
+ @Override
+ protected boolean canDragBack() {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_plc.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_plc.java
new file mode 100644
index 00000000..ded0563b
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_plc.java
@@ -0,0 +1,82 @@
+package com.bonait.bnframework.modules.home.fragment.mode;
+
+import android.content.Context;
+import android.text.InputType;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import androidx.annotation.Nullable;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.business.ConfigData;
+import com.bonait.bnframework.common.db.QueryDB;
+import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
+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 java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+
+
+public class fragment_plc extends LinearLayout {
+ @BindView(R.id.name)
+ TextView name;
+ @BindView(R.id.edittext_plc)
+ EditText edittext_plc;
+ private View root;
+ public BPA_PLCADDRESS model;
+ public fragment_plc(Context context, @Nullable AttributeSet attrs, BPA_PLCADDRESS mode) {
+ super(context, attrs);
+ root= LayoutInflater.from(context).inflate(R.layout.fragment_item_plc, this);
+ ButterKnife.bind(this, root);
+ model=mode;
+ Init();
+ }
+ public void Init()
+ {
+ name.setText(model.name);
+ ((EditText)root.findViewById(R.id.edittext_plc)).setText(model.address.toString());
+ }
+
+ @OnClick({R.id.update_plc})
+ public void onViewClicked(View view) {
+ switch (view.getId()) {
+ case R.id.update_plc:
+ String text=edittext_plc.getText().toString();
+ if(text.isEmpty())
+ {
+ ToastUtils.warning("地址不允许为空!");
+ return;
+ }
+
+ String title = "温馨提示!";
+ String message = "客官确定要修改PLC地址吗,小菠萝温馨提示你,此操作将会影响到实际运行哦?";
+ AlertDialogUtils.showDialog(getContext(), title, message, new QMUIDialogAction.ActionListener() {
+ @Override
+ public void onClick(QMUIDialog dialog, int index) {
+ model.address=text;
+ QueryDB.UpdatePlcaddress(model);
+ ToastUtils.info("修改成功!");
+ dialog.dismiss();
+ }
+ });
+ break;
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_system_cs_plc.xml b/app/src/main/res/layout/fragment_system_cs_plc.xml
new file mode 100644
index 00000000..bab2d3ee
--- /dev/null
+++ b/app/src/main/res/layout/fragment_system_cs_plc.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_system_seasoningset.xml b/app/src/main/res/layout/fragment_system_seasoningset.xml
index a47f7368..a4358965 100644
--- a/app/src/main/res/layout/fragment_system_seasoningset.xml
+++ b/app/src/main/res/layout/fragment_system_seasoningset.xml
@@ -87,14 +87,15 @@
+
diff --git a/app/src/main/res/layout/item/layout/fragment_item_plc.xml b/app/src/main/res/layout/item/layout/fragment_item_plc.xml
new file mode 100644
index 00000000..ff1674a2
--- /dev/null
+++ b/app/src/main/res/layout/item/layout/fragment_item_plc.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/maintenance.xml b/app/src/main/res/menu/maintenance.xml
index 1ca40e54..cb576679 100644
--- a/app/src/main/res/menu/maintenance.xml
+++ b/app/src/main/res/menu/maintenance.xml
@@ -1,5 +1,8 @@