diff --git a/app/build.gradle b/app/build.gradle
index 544ed7da..9e8094fa 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -118,4 +118,13 @@ dependencies {
//表格控件
implementation 'com.github.huangyanbin:SmartTable:2.2.0'
+ //轮播图
+ implementation 'com.youth.banner:banner:1.4.10'
+
+ //图片加载
+ implementation 'com.github.bumptech.glide:glide:4.11.0'
+ annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
+
+
+
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 91b2ee70..b5d48003 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/common/db/mode/BPA_PROCESSModel.java b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PROCESSModel.java
index f9b99b7c..216f62c9 100644
--- a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PROCESSModel.java
+++ b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PROCESSModel.java
@@ -24,4 +24,5 @@ public class BPA_PROCESSModel extends ModeBase{
* 排序
*/
public int sort;
+
}
diff --git a/app/src/main/java/com/bonait/bnframework/common/helper/MyImage.java b/app/src/main/java/com/bonait/bnframework/common/helper/MyImage.java
new file mode 100644
index 00000000..8470e001
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/common/helper/MyImage.java
@@ -0,0 +1,20 @@
+package com.bonait.bnframework.common.helper;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.ImageView;
+
+import com.bumptech.glide.Glide;
+import com.youth.banner.loader.ImageLoaderInterface;
+
+public class MyImage implements ImageLoaderInterface {
+ @Override
+ public void displayImage(Context context, Object path, View imageView) {
+ Glide.with(context).load(path).into((ImageView) imageView);
+ }
+
+ @Override
+ public View createImageView(Context context) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java
index 4fbc0d54..bb61adba 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java
@@ -1,12 +1,42 @@
package com.bonait.bnframework.modules.home.fragment.from;
+import static com.bonait.bnframework.MainApplication.getContext;
+
import androidx.appcompat.app.AppCompatActivity;
+
+import android.annotation.SuppressLint;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.util.AttributeSet;
+import android.util.Xml;
import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseActivity;
+import com.bonait.bnframework.common.db.QueryDB;
+import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
+import com.bonait.bnframework.common.db.mode.BPA_PROCESS;
+import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
+import com.bonait.bnframework.common.helper.MyImage;
+import com.bonait.bnframework.modules.home.fragment.mode.fragment_gx;
+import com.bonait.bnframework.modules.home.fragment.mode.item_gx;
import com.qmuiteam.qmui.widget.QMUITopBar;
+import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
+import com.youth.banner.Banner;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
@@ -14,13 +44,95 @@ import butterknife.ButterKnife;
public class DiyActivity extends BaseActivity {
@BindView(R.id.topbar)
QMUITopBar mTopBar;
+ @BindView(R.id.Banner_Main)
+ Banner Banner_Main;//轮播图
+ //用于存放获取的图片
+ List Banner_list = new ArrayList<>();
+
+ @BindView(R.id.hrgx)
+ Spinner hrgx;//工序
+ Map hrgx_map = new LinkedHashMap<>();
+
+ @BindView(R.id.gxchid)
+ LinearLayout gxchid;//工序子集
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_diy);//属性绑定
ButterKnife.bind(this);
initTopBar();
+ initData();
}
+
+ private void initData()
+ {
+ //1.初始化轮播图
+ Drawable_Get(Banner_list);
+ //2.初始化工序
+ ArrayList data=QueryDB.GetProcessALL();
+ for (BPA_PROCESS item:data)
+ {
+ hrgx_map.put(item.name,item.id);
+ }
+ ArrayAdapter adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(hrgx_map.keySet()));
+ adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item);
+ hrgx.setAdapter(adapter_kk);
+ hrgx.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+ @Override
+ public void onItemSelected(AdapterView> adapterView, View view, int i, long l) {
+ String id= hrgx_map.get(hrgx.getSelectedItem().toString());
+ SelectItemFrom(id);
+ }
+ @Override
+ public void onNothingSelected(AdapterView> adapterView) {
+ }
+ });
+ //3.
+ }
+
+ /**
+ * 根据选中工序id显示集合
+ * @param id
+ */
+ public void SelectItemFrom(String id)
+ {
+ try
+ {
+ gxchid.removeAllViews();
+ ArrayList mode= QueryDB.GetProcessModelProcessID(id);
+ if(mode.size()>0)//工序
+ {
+ for (BPA_PROCESSModel item : mode)
+ {
+ item_gx gx=new item_gx();
+ gx.datatype=item.datatype;
+ gx.name=item.name;
+ gx.data=item.data;
+ gx.IsWL=false;
+ fragment_gx gongxu=new fragment_gx(this,null,gx);
+ gxchid.addView(gongxu);
+ }
+ }else //物料
+ {
+ ArrayList materials= QueryDB.GetMaterialALL();
+ for (BPA_MATERIAL item2 : materials)
+ {
+ item_gx gx=new item_gx();
+ gx.datatype=0;//液体料都是数字
+ gx.name=item2.name;
+ gx.IsWL=true;
+ fragment_gx gongxu=new fragment_gx(this,null,gx);
+ gxchid.addView(gongxu);
+ }
+
+ }
+ }catch (Exception ex)
+ {
+
+ }
+ }
+
private void initTopBar() {
mTopBar.setTitle("DIY模式");
mTopBar.addLeftImageButton(R.mipmap.fanhui,R.id.topbar).setOnClickListener(new View.OnClickListener() {
@@ -30,7 +142,25 @@ public class DiyActivity extends BaseActivity {
}
});
}
-
+ //获取图片存放到list中
+ private void Drawable_Get(List arrayList) {
+ //从drawable文件夹下获取到事先准备的图片,在这里演示三张图片
+ Drawable drawable = getResources().getDrawable(R.mipmap.hgr);
+ Drawable drawable1 = getResources().getDrawable(R.mipmap.hgr);
+ Drawable drawable2 = getResources().getDrawable(R.mipmap.hgr);
+ //把他们存放到一个list集合中
+ arrayList.add(drawable);
+ arrayList.add(drawable1);
+ arrayList.add(drawable2);
+ //调用轮播图设置方法
+ Banner_Set(Banner_list);
+ }
+ //将图片存放到轮播图中
+ private void Banner_Set(List arrayList) {
+ //这是设置轮播图的关键位置,setImages(list) 设置轮播图的图片资源
+ //setImageLoader(一个实体类)用于加载图片到手机页面上显示
+ Banner_Main.setImages(Banner_list).setImageLoader(new MyImage()).start();
+ }
@Override
public void onDestroy() {
super.onDestroy();
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/ResBPA_PROCESSModel.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/ResBPA_PROCESSModel.java
new file mode 100644
index 00000000..28d26d95
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/ResBPA_PROCESSModel.java
@@ -0,0 +1,10 @@
+package com.bonait.bnframework.modules.home.fragment.mode;
+
+import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
+
+public class ResBPA_PROCESSModel extends BPA_PROCESSModel {
+ /**
+ * 选中变量
+ */
+ public String val;
+}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_gx.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_gx.java
new file mode 100644
index 00000000..679c0397
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_gx.java
@@ -0,0 +1,113 @@
+package com.bonait.bnframework.modules.home.fragment.mode;
+
+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.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Spinner;
+import android.widget.TextView;
+
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.common.base.BaseFragment;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class fragment_gx extends LinearLayout {
+ @BindView(R.id.name)
+ TextView name;
+ @BindView(R.id.editsp)
+ Spinner editsp;
+ Map editsp_map = new LinkedHashMap<>();
+ @BindView(R.id.edittext)
+ EditText edittext;
+ @BindView(R.id.check)
+ CheckBox check;
+ private View root;
+ private item_gx model;
+ public fragment_gx(Context context, @Nullable AttributeSet attrs,item_gx mode) {
+ super(context, attrs);
+ root=LayoutInflater.from(context).inflate(R.layout.fragment_item_gx, this);
+ ButterKnife.bind(this, root);
+ model=mode;
+ Init();
+ }
+ public void Init()
+ {
+ name.setText(model.name);
+ if(model.IsWL)
+ {
+ check.setVisibility(View.VISIBLE);
+ }else
+ {
+ check.setVisibility(View.GONE);
+ }
+ switch (model.datatype)
+ {
+ case 0://数字
+ editsp.setVisibility(View.GONE);
+ edittext.setVisibility(View.VISIBLE);
+ edittext.setInputType(InputType.TYPE_CLASS_NUMBER);
+ edittext.setText("0".toCharArray(), 0, "0".length());
+ break;
+ case 1://字符串
+ editsp.setVisibility(View.GONE);
+ edittext.setVisibility(View.VISIBLE);
+ edittext.setInputType(InputType.TYPE_CLASS_TEXT);
+ break;
+ case 2://选项
+ editsp.setVisibility(View.VISIBLE);
+ edittext.setVisibility(View.VISIBLE);
+ if(!model.data.isEmpty() && model.data.contains("、"))
+ {
+ String[] res = model.data.split("[、]");
+ int index=1;
+ for (String item: res)
+ {
+ editsp_map.put(item,index);
+ index++;
+ }
+ }else
+ {
+ editsp_map.put(model.data,1);
+ }
+ ArrayAdapter adapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(editsp_map.keySet()));
+ adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item);
+ editsp.setAdapter(adapter2);
+ break;
+ }
+ }
+ /**
+ * 获取选择变量
+ * @return
+ */
+ public String GetValues()
+ {
+ String ResStu="";
+ switch (model.datatype)
+ {
+ case 0://数字
+ case 1://字符串
+ ResStu=edittext.getText().toString();
+ break;
+ case 2://选项
+ ResStu=editsp.getSelectedItem().toString();
+ break;
+ }
+ return ResStu;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/item_gx.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/item_gx.java
new file mode 100644
index 00000000..502b69a9
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/item_gx.java
@@ -0,0 +1,12 @@
+package com.bonait.bnframework.modules.home.fragment.mode;
+
+public class item_gx {
+ public String name;
+ public int datatype;
+ /**
+ * 数据集合 [停止、一档、二档、三档、四档、五档]
+ */
+ public String data;
+
+ public boolean IsWL=false;
+}
diff --git a/app/src/main/res/layout/activity_diy.xml b/app/src/main/res/layout/activity_diy.xml
index c32c978f..de559867 100644
--- a/app/src/main/res/layout/activity_diy.xml
+++ b/app/src/main/res/layout/activity_diy.xml
@@ -22,7 +22,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
-
-
+
+
+
+ android:hint="请输入菜谱名称"
+ android:inputType="text"
+ android:maxLines="1"
+ android:padding="3dp"
+ android:textSize="12dp" />
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+ android:layout_height="400dp">
@@ -107,24 +110,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
-
-
-
-
+
@@ -159,8 +147,6 @@
android:text="操作模式"
android:textColor="@color/black"
android:textSize="14dp"/>
-
-
+
-
-
+
-
-
-
-
-
-
+
+ android:layout_alignParentBottom="true"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+
+
+
diff --git a/app/src/main/res/layout/datatab/values/strings.xml b/app/src/main/res/layout/datatab/values/strings.xml
new file mode 100644
index 00000000..73862c41
--- /dev/null
+++ b/app/src/main/res/layout/datatab/values/strings.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item/layout/fragment_item_gx.xml b/app/src/main/res/layout/item/layout/fragment_item_gx.xml
new file mode 100644
index 00000000..301a3d08
--- /dev/null
+++ b/app/src/main/res/layout/item/layout/fragment_item_gx.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/item_huolikongzhi.xml b/app/src/main/res/layout/item/layout/item_huolikongzhi.xml
similarity index 100%
rename from app/src/main/res/layout/item_huolikongzhi.xml
rename to app/src/main/res/layout/item/layout/item_huolikongzhi.xml
diff --git a/app/src/main/res/layout/item_liaochang.xml b/app/src/main/res/layout/item/layout/item_liaochang.xml
similarity index 100%
rename from app/src/main/res/layout/item_liaochang.xml
rename to app/src/main/res/layout/item/layout/item_liaochang.xml
diff --git a/app/src/main/res/layout/item_sp.xml b/app/src/main/res/layout/item/layout/item_sp.xml
similarity index 100%
rename from app/src/main/res/layout/item_sp.xml
rename to app/src/main/res/layout/item/layout/item_sp.xml
diff --git a/app/src/main/res/layout/note_rv_tree_second.xml b/app/src/main/res/layout/item/layout/note_rv_tree_second.xml
similarity index 100%
rename from app/src/main/res/layout/note_rv_tree_second.xml
rename to app/src/main/res/layout/item/layout/note_rv_tree_second.xml
diff --git a/app/src/main/res/layout/item/layout/spinner_text_item.xml b/app/src/main/res/layout/item/layout/spinner_text_item.xml
index 79ccfa1d..cf3f6428 100644
--- a/app/src/main/res/layout/item/layout/spinner_text_item.xml
+++ b/app/src/main/res/layout/item/layout/spinner_text_item.xml
@@ -9,7 +9,8 @@
android:textAlignment="inherit"
android:gravity="center_vertical"
android:text="请选择"
- android:textSize="12dp">
+ android:textSize="12dp"
+ android:textColor="@color/black">
diff --git a/app/src/main/res/layout/toast_layout.xml b/app/src/main/res/layout/item/layout/toast_layout.xml
similarity index 100%
rename from app/src/main/res/layout/toast_layout.xml
rename to app/src/main/res/layout/item/layout/toast_layout.xml