@@ -28,6 +28,9 @@ | |||||
android:theme="@style/AppTheme" | android:theme="@style/AppTheme" | ||||
tools:ignore="GoogleAppIndexingWarning" | tools:ignore="GoogleAppIndexingWarning" | ||||
tools:node="merge"> | tools:node="merge"> | ||||
<activity | |||||
android:name=".modules.home.fragment.from.fragment.SystemCsPLCFragment" | |||||
android:exported="false" /> | |||||
<activity | <activity | ||||
android:name=".modules.home.fragment.from.FileActivity" | android:name=".modules.home.fragment.from.FileActivity" | ||||
android:exported="false" /> | android:exported="false" /> | ||||
@@ -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(); | InitProcessData(); | ||||
@@ -7,6 +7,7 @@ import com.bonait.bnframework.common.model.mode.DeviceInformation; | |||||
import com.bonait.bnframework.common.model.mode.OrganizeMode; | import com.bonait.bnframework.common.model.mode.OrganizeMode; | ||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.LinkedHashMap; | |||||
/** | /** | ||||
@@ -202,7 +203,7 @@ public class ConfigName { | |||||
* PLC地址配置 | * PLC地址配置 | ||||
*/ | */ | ||||
public HashMap<String,String> PlcAddress=new HashMap<String,String>(); | public HashMap<String,String> PlcAddress=new HashMap<String,String>(); | ||||
public HashMap<String,String> PlcAddress_ys=new HashMap<String,String>(){ | |||||
public LinkedHashMap<String,String> PlcAddress_ys=new LinkedHashMap<String,String>(){ | |||||
{ | { | ||||
//搅拌模型 | //搅拌模型 | ||||
put("搅拌", "M1.0"); | put("搅拌", "M1.0"); | ||||
@@ -2369,7 +2369,7 @@ public class QueryDB { | |||||
* @return | * @return | ||||
*/ | */ | ||||
public static ArrayList<BPA_PLCADDRESS> GetPlcaddressALL() { | public static ArrayList<BPA_PLCADDRESS> GetPlcaddressALL() { | ||||
String orderby = Desc_Sort_Up + ',' +Desc_Time_Up;//出料顺序 | |||||
String orderby = Desc_Sort_Up;//出料顺序 | |||||
String where = "isDelete=?"; | String where = "isDelete=?"; | ||||
String[] args = new String[]{"0"}; | String[] args = new String[]{"0"}; | ||||
ArrayList<BPA_PLCADDRESS> data = new ArrayList<>(); | ArrayList<BPA_PLCADDRESS> data = new ArrayList<>(); | ||||
@@ -1,6 +1,8 @@ | |||||
package com.bonait.bnframework.modules.home.fragment.from; | package com.bonait.bnframework.modules.home.fragment.from; | ||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import com.bonait.bnframework.modules.home.fragment.from.fragment.SystemCsPLCFragment; | |||||
import com.google.android.material.bottomnavigation.BottomNavigationView; | import com.google.android.material.bottomnavigation.BottomNavigationView; | ||||
import androidx.core.content.ContextCompat; | import androidx.core.content.ContextCompat; | ||||
import androidx.viewpager.widget.ViewPager; | import androidx.viewpager.widget.ViewPager; | ||||
@@ -57,6 +59,8 @@ public class WhActivity extends BaseActivity { | |||||
*/ | */ | ||||
private void initFragment() { | private void initFragment() { | ||||
FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | ||||
fragmentAdapter.addFragment(new SystemCsPLCFragment()); | |||||
fragmentAdapter.addFragment(new SystemCsJrFragment()); | fragmentAdapter.addFragment(new SystemCsJrFragment()); | ||||
fragmentAdapter.addFragment(new SystemCsTlFragment()); | fragmentAdapter.addFragment(new SystemCsTlFragment()); | ||||
fragmentAdapter.addFragment(new SystemCsFltlFragment()); | fragmentAdapter.addFragment(new SystemCsFltlFragment()); | ||||
@@ -72,15 +76,18 @@ public class WhActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) { | public boolean onNavigationItemSelected(@NonNull MenuItem item) { | ||||
switch (item.getItemId()) { | switch (item.getItemId()) { | ||||
case R.id.bottom_navigation_1: | |||||
case R.id.bottom_navigation_0: | |||||
viewPager.setCurrentItem(0); | viewPager.setCurrentItem(0); | ||||
return true; | return true; | ||||
case R.id.bottom_navigation_2: | |||||
case R.id.bottom_navigation_1: | |||||
viewPager.setCurrentItem(1); | viewPager.setCurrentItem(1); | ||||
return true; | return true; | ||||
case R.id.bottom_navigation_3: | |||||
case R.id.bottom_navigation_2: | |||||
viewPager.setCurrentItem(2); | viewPager.setCurrentItem(2); | ||||
return true; | return true; | ||||
case R.id.bottom_navigation_3: | |||||
viewPager.setCurrentItem(3); | |||||
return true; | |||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
@@ -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<BPA_PLCADDRESS> 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; | |||||
} | |||||
} |
@@ -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; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,43 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
xmlns:tools="http://schemas.android.com/tools" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
tools:context=".modules.home.fragment.from.fragment.SystemCsPLCFragment"> | |||||
<LinearLayout | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:orientation="vertical" | |||||
android:background="@color/main_background"> | |||||
<ScrollView | |||||
android:layout_marginTop="20dp" | |||||
android:layout_weight="1" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent"> | |||||
<LinearLayout | |||||
android:id="@+id/gxchid" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:orientation="vertical"> | |||||
</LinearLayout> | |||||
</ScrollView> | |||||
<LinearLayout | |||||
android:layout_margin="20dp" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="34dp" | |||||
android:gravity="center_vertical" | |||||
android:orientation="horizontal"> | |||||
<Button | |||||
android:id="@+id/chushihua" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="wrap_content" | |||||
android:background="@drawable/bg_btn_login_selected" | |||||
android:text="恢复出厂设置" | |||||
android:layout_weight="1" | |||||
/> | |||||
</LinearLayout> | |||||
</LinearLayout> | |||||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -87,14 +87,15 @@ | |||||
<RelativeLayout | <RelativeLayout | ||||
android:layout_width="match_parent" | android:layout_width="match_parent" | ||||
android:layout_height="wrap_content"> | android:layout_height="wrap_content"> | ||||
<Button | <Button | ||||
android:id="@+id/add_wl" | android:id="@+id/add_wl" | ||||
android:layout_width="80dp" | android:layout_width="80dp" | ||||
android:layout_height="26dp" | android:layout_height="26dp" | ||||
android:layout_alignParentRight="true" | android:layout_alignParentRight="true" | ||||
android:layout_marginRight="100dp" | |||||
android:layout_centerInParent="true" | android:layout_centerInParent="true" | ||||
android:layout_marginLeft="@dimen/dp_10" | android:layout_marginLeft="@dimen/dp_10" | ||||
android:layout_marginRight="100dp" | |||||
android:background="@drawable/button1" | android:background="@drawable/button1" | ||||
android:text="增加" | android:text="增加" | ||||
android:textSize="14dp" /> | android:textSize="14dp" /> | ||||
@@ -0,0 +1,50 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||||
xmlns:tools="http://schemas.android.com/tools" | |||||
android:layout_width="match_parent" | |||||
android:layout_height="30dp" | |||||
android:layout_marginBottom="@dimen/dp_10" | |||||
android:orientation="horizontal"> | |||||
<RelativeLayout | |||||
android:layout_width="90dp" | |||||
android:layout_height="match_parent"> | |||||
<TextView | |||||
android:id="@+id/name" | |||||
android:layout_width="wrap_content" | |||||
android:layout_height="wrap_content" | |||||
android:layout_alignParentRight="true" | |||||
android:layout_centerInParent="true" | |||||
android:text="搅拌动作:"/> | |||||
</RelativeLayout> | |||||
<EditText | |||||
android:id="@+id/edittext_plc" | |||||
android:layout_width="120dp" | |||||
android:layout_height="wrap_content" | |||||
android:layout_marginLeft="5dp" | |||||
android:background="@drawable/input_bj" | |||||
android:hint="请输入地址" | |||||
android:layout_weight="1" | |||||
android:inputType="text" | |||||
android:maxLines="1" | |||||
android:padding="3dp" | |||||
android:textSize="12dp" /> | |||||
<RelativeLayout | |||||
android:layout_width="wrap_content" | |||||
android:layout_alignParentRight="true" | |||||
android:layout_height="match_parent"> | |||||
<Button | |||||
android:id="@+id/update_plc" | |||||
android:layout_width="80dp" | |||||
android:layout_height="26dp" | |||||
android:layout_marginLeft="@dimen/dp_10" | |||||
android:background="@drawable/button1" | |||||
android:layout_centerInParent="true" | |||||
android:text="修改" | |||||
android:textSize="14dp" /> | |||||
</RelativeLayout> | |||||
</LinearLayout> |
@@ -1,5 +1,8 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | <menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
<item | |||||
android:id="@+id/bottom_navigation_0" | |||||
android:title="PLC#地址" /> | |||||
<item | <item | ||||
android:id="@+id/bottom_navigation_1" | android:id="@+id/bottom_navigation_1" | ||||