From 70ab40e6d36e32ae793e47e679f38b75435ef3bf Mon Sep 17 00:00:00 2001 From: fyf Date: Tue, 6 Jun 2023 10:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95222?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/example/bpa/db/QueryDB.java | 135 ++++++++++++++++++ .../com/example/bpa/db/file/DBHelper.java | 7 +- .../com/example/bpa/db/mode/BPA_CRAFT.java | 15 ++ .../example/bpa/db/mode/BPA_CRAFTPROCESS.java | 18 +++ .../com/example/bpa/db/mode/BPA_GOODS.java | 2 + 5 files changed, 174 insertions(+), 3 deletions(-) create mode 100644 app/src/main/java/com/example/bpa/db/mode/BPA_CRAFT.java create mode 100644 app/src/main/java/com/example/bpa/db/mode/BPA_CRAFTPROCESS.java diff --git a/app/src/main/java/com/example/bpa/db/QueryDB.java b/app/src/main/java/com/example/bpa/db/QueryDB.java index 85fe03e..4b174f5 100644 --- a/app/src/main/java/com/example/bpa/db/QueryDB.java +++ b/app/src/main/java/com/example/bpa/db/QueryDB.java @@ -5,6 +5,8 @@ import android.database.sqlite.SQLiteDatabase; import com.example.bpa.config.ConfigName; import com.example.bpa.db.file.DBHelper; import com.example.bpa.db.mode.BPA_ALERTLOG; +import com.example.bpa.db.mode.BPA_CRAFT; +import com.example.bpa.db.mode.BPA_CRAFTPROCESS; import com.example.bpa.db.mode.BPA_GOODS; import com.example.bpa.db.mode.BPA_GOODSRECIPE; import com.example.bpa.db.mode.BPA_LOG; @@ -1669,6 +1671,125 @@ public class QueryDB { } //endregion + //region BPA_CRAFT 工艺基础信息表 + + /** + * 新增工艺基础信息表 + * add fengyoufu 20230413 + * + * @param data + * @return 是否成功 + */ + public static boolean AddCraft(BPA_CRAFT data) { + return Add(BPA_CRAFT.class, data); + } + + /** + * 修改工艺基础信息表 + * add fengyoufu 20230413 + * + * @param data + */ + public static void UpdateCraft(BPA_CRAFT data) { + Update(BPA_CRAFT.class, data); + } + + /** + * 删除工艺基础信息表 + * add fengyoufu 20230413 + * + * @return 是否成功 + */ + public static boolean DeleteCraft(String id) { + return Delete(BPA_CRAFT.class, id); + } + + /** + * 获取工艺基础信息表 + * + * @return + */ + public static ArrayList GetCraftALL() { + String orderby = Desc_Time_Up;//先按排序 创建时间倒序 + String where = "isDelete=?"; + String[] args = new String[]{"0"}; + ArrayList data = new ArrayList<>(); + ArrayList obj = Get(BPA_CRAFT.class, where, args, orderby); + for (Object k : obj) { + data.add((BPA_CRAFT) k); + } + return data; + } + //endregion + + //region BPA_CRAFTPROCESS 工艺流程表 + + /** + * 新增工艺流程表 + * add fengyoufu 20230413 + * + * @param data + * @return 是否成功 + */ + public static boolean AddCraftProcess(BPA_CRAFTPROCESS data) { + return Add(BPA_CRAFTPROCESS.class, data); + } + + /** + * 修改工艺流程表 + * add fengyoufu 20230413 + * + * @param data + */ + public static void UpdateCraftProcess(BPA_CRAFTPROCESS data) { + Update(BPA_CRAFTPROCESS.class, data); + } + + /** + * 删除工艺流程表 + * add fengyoufu 20230413 + * + * @return 是否成功 + */ + public static boolean DeleteCraftProcess(String id) { + return Delete(BPA_CRAFTPROCESS.class, id); + } + + /** + * 获取工艺流程表 + * + * @return + */ + public static ArrayList GetCraftProcessALL() { + String orderby = Desc_Time_Up;//先按排序 创建时间倒序 + String where = "isDelete=?"; + String[] args = new String[]{"0"}; + ArrayList data = new ArrayList<>(); + ArrayList obj = Get(BPA_CRAFTPROCESS.class, where, args, orderby); + for (Object k : obj) { + data.add((BPA_CRAFTPROCESS) k); + } + return data; + } + + /** + * 根据工艺id获取工艺流程表 + * + * @return + */ + public static ArrayList GetCraftProcessId(String id) { + String orderby = Desc_Time_Up;//先按排序 创建时间倒序 + String where = "isDelete=? and gyid=?"; + String[] args = new String[]{"0",id}; + ArrayList data = new ArrayList<>(); + ArrayList obj = Get(BPA_CRAFTPROCESS.class, where, args, orderby); + for (Object k : obj) { + data.add((BPA_CRAFTPROCESS) k); + } + return data; + } + //endregion + //region 私有 /** @@ -1880,6 +2001,7 @@ public class QueryDB { ((BPA_GOODS) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); ((BPA_GOODS) data).status = cursor.getInt((int) cursor.getColumnIndex("status")); ((BPA_GOODS) data).url = cursor.getString((int) cursor.getColumnIndex("url")); + ((BPA_GOODS) data).gyid = cursor.getString((int) cursor.getColumnIndex("gyid")); break; case "BPA_GOODSRECIPE": data = new BPA_GOODSRECIPE(); @@ -1960,6 +2082,19 @@ public class QueryDB { //私有 ((BPA_SUGAR)data).sugarName = cursor.getString((int) cursor.getColumnIndex("sugarName")); ((BPA_SUGAR)data).plcvar = cursor.getString((int) cursor.getColumnIndex("plcvar")); + case "BPA_CRAFT": + data = new BPA_CRAFT(); + //私有 + ((BPA_CRAFT)data).status = cursor.getInt((int) cursor.getColumnIndex("status")); + ((BPA_CRAFT)data).name = cursor.getString((int) cursor.getColumnIndex("name")); + case "BPA_CRAFTPROCESS": + data = new BPA_CRAFTPROCESS(); + //私有 + ((BPA_CRAFTPROCESS)data).gyid = cursor.getString((int) cursor.getColumnIndex("gyid")); + ((BPA_CRAFTPROCESS)data).pfid = cursor.getString((int) cursor.getColumnIndex("pfid")); + ((BPA_CRAFTPROCESS)data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); + ((BPA_CRAFTPROCESS)data).value = cursor.getInt((int) cursor.getColumnIndex("value")); + } ((ModeBase) data).id = cursor.getString((int) cursor.getColumnIndex("id")); ((ModeBase) data).createTime = cursor.getString((int) cursor.getColumnIndex("createTime")); diff --git a/app/src/main/java/com/example/bpa/db/file/DBHelper.java b/app/src/main/java/com/example/bpa/db/file/DBHelper.java index 9676b99..57f9679 100644 --- a/app/src/main/java/com/example/bpa/db/file/DBHelper.java +++ b/app/src/main/java/com/example/bpa/db/file/DBHelper.java @@ -4,6 +4,8 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.example.bpa.config.ConfigName; import com.example.bpa.db.mode.BPA_ALERTLOG; +import com.example.bpa.db.mode.BPA_CRAFT; +import com.example.bpa.db.mode.BPA_CRAFTPROCESS; import com.example.bpa.db.mode.BPA_GOODS; import com.example.bpa.db.mode.BPA_GOODSRECIPE; import com.example.bpa.db.mode.BPA_LOG; @@ -106,11 +108,10 @@ public class DBHelper extends SQLiteOpenHelper { CreateTablesAll(BPA_MENUANDUSER.class,null);//菜单用户关联表 CreateTablesAll(BPA_SUGAR.class,null);//果糖表 - + CreateTablesAll(BPA_CRAFT.class,null);//工艺基础信息表 + CreateTablesAll(BPA_CRAFTPROCESS.class,null);//工艺流程表 ForeignKeys(); - - } /** * 创建数据库表 diff --git a/app/src/main/java/com/example/bpa/db/mode/BPA_CRAFT.java b/app/src/main/java/com/example/bpa/db/mode/BPA_CRAFT.java new file mode 100644 index 0000000..628bfd9 --- /dev/null +++ b/app/src/main/java/com/example/bpa/db/mode/BPA_CRAFT.java @@ -0,0 +1,15 @@ +package com.example.bpa.db.mode; + +/** + * BPA_CRAFT[工艺基础信息表] + * 创建人:fengyoufu add 20230412 + */ +public class BPA_CRAFT { + /** + * 0:禁用 + * 1:启用 + */ + public int status; + //日志描述 + public String name; +} diff --git a/app/src/main/java/com/example/bpa/db/mode/BPA_CRAFTPROCESS.java b/app/src/main/java/com/example/bpa/db/mode/BPA_CRAFTPROCESS.java new file mode 100644 index 0000000..6b3fec0 --- /dev/null +++ b/app/src/main/java/com/example/bpa/db/mode/BPA_CRAFTPROCESS.java @@ -0,0 +1,18 @@ +package com.example.bpa.db.mode; + +/** + * BPA_CRAFTPROCESS[工艺流程表] + * 创建人:fengyoufu add 20230412 + */ +public class BPA_CRAFTPROCESS { + + /** + * 工艺id + */ + public String gyid; + //排序 + public int sort; + //出料数值:20g + public int value; + public String pfid; +} diff --git a/app/src/main/java/com/example/bpa/db/mode/BPA_GOODS.java b/app/src/main/java/com/example/bpa/db/mode/BPA_GOODS.java index 3e86f37..72fc9d8 100644 --- a/app/src/main/java/com/example/bpa/db/mode/BPA_GOODS.java +++ b/app/src/main/java/com/example/bpa/db/mode/BPA_GOODS.java @@ -13,4 +13,6 @@ public class BPA_GOODS extends ModeBase { public int sort; //状态:0 禁用 1 启用 public int status; + //工艺id + public String gyid; }