diff --git a/app/src/main/java/com/example/bpa/app/BusinessServer.java b/app/src/main/java/com/example/bpa/app/BusinessServer.java index 5ea1e6c..bbb0663 100644 --- a/app/src/main/java/com/example/bpa/app/BusinessServer.java +++ b/app/src/main/java/com/example/bpa/app/BusinessServer.java @@ -2,10 +2,13 @@ package com.example.bpa.app; import com.example.bpa.Model.IThread; import com.example.bpa.db.QueryDB; +import com.example.bpa.helper.MessageLog; import com.example.bpa.helper.ThreadManager; import com.example.bpa.view.mode.ResGoodsRecipe; import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; import java.util.concurrent.ConcurrentLinkedQueue; public class BusinessServer { @@ -38,6 +41,20 @@ public class BusinessServer { while (Commoditys.size() > 0) { String GoodId = Commoditys.poll(); ArrayList goods = QueryDB.GetGoodsSrecipeList(GoodId); + LinkedHashMap> rgrs = new LinkedHashMap<>(); + + //更具步骤分组 + for (int i = 0; i < goods.size(); i++) { + if (!rgrs.containsKey(goods.get(i).sort)) + rgrs.put(goods.get(i).sort, new ArrayList<>()); + rgrs.get(goods.get(i).sort).add(goods.get(i)); + } + + for (int i = 0; i < rgrs.size(); i++) { + for (int m = 0; m < rgrs.get(i).size(); m++) { + + } + } } Thread.sleep(1000); diff --git a/app/src/main/java/com/example/bpa/app/ICSApp.java b/app/src/main/java/com/example/bpa/app/ICSApp.java index b69b434..fb455fd 100644 --- a/app/src/main/java/com/example/bpa/app/ICSApp.java +++ b/app/src/main/java/com/example/bpa/app/ICSApp.java @@ -21,95 +21,94 @@ import java.util.ArrayList; * 创建:fengyoufu 20230413 */ public class ICSApp extends Application { - private static ICSApp instance; - @Override - public void onCreate() { - super.onCreate(); - //1.设置程序active,初始化Main函数进程 - ConfigName.getInstance().dishesCon = this; - ToastUtil.init(this); - Main.getInstance(); - //2.初始化SD卡,数据库DB - SdCart.getInstance().initSD(); - //3.初始化数据 - InitDBdata(); - } - - /** - * 初始化数据库数据(323232) - */ - public void InitDBdata() - { - //1.没有用户数据 默认写一个admin - if(QueryDB.GetUserALL().size()<=0) - { - BPA_USER user=new BPA_USER(); - user.id="20230415-fyf"; - user.name="管理员"; - user.account="admin"; - user.pass="123456"; - user.deviceID=ConfigName.getInstance().DeviceId; - user.userID="20230415-fyf"; - user.exp="管理员"; - QueryDB.AddUser(user); - - } - } - - public void AddTestLC() - { - BPA_SILOS par=new BPA_SILOS(); - par.id="1231333"; - par.num=1; - par.name="料仓"; - par.warningValue=49; - par.thrsoleValue=20; - par.plcValue="232"; - par.bValue=30; - par.jValue=23; - par.status=1; - par.Sort=0; - QueryDB.AddSilos(par); - - //2.获取物料 - ArrayList materials= QueryDB.GetMaterialALL(); - - BPA_SILOSANDMATERIAL al=new BPA_SILOSANDMATERIAL(); - al.silosID="1231333"; - al.materialID=materials.get(0).id; - QueryDB.AddSilosAndMaterial(al); - } - /** - * 测试数据库 新增 修改 删除 - */ - public void Test() - { - //新增 - BPA_MATERIAL ba=new BPA_MATERIAL(); - ba.deviceID=java.util.UUID.randomUUID().toString(); - ba.userID="张三---------"; - ba.exp="测试-----"; - ba.name="测试物料12312----"; - ba.imgUrl="wwwwwwwww---"; - QueryDB.AddMaterial(ba); - - //查询 - ArrayList wl= QueryDB.GetMaterialALL(); - for (BPA_MATERIAL d:wl - ) { - String json= new Json().objectToJson(BPA_MATERIAL.class,d); - Log.i("日志","物料查询:"+ json); - - //d.name="测试修改"; + private static ICSApp instance; + + @Override + public void onCreate() { + super.onCreate(); + //1.设置程序active,初始化Main函数进程 + ConfigName.getInstance().dishesCon = this; + ToastUtil.init(this); + Main.getInstance(); + //2.初始化SD卡,数据库DB + SdCart.getInstance().initSD(); + BusinessServer.get().Start(); + //3.初始化数据 + InitDBdata(); + } + + /** + * 初始化数据库数据(323232) + */ + public void InitDBdata() { + //1.没有用户数据 默认写一个admin + if (QueryDB.GetUserALL().size() <= 0) { + BPA_USER user = new BPA_USER(); + user.id = "20230415-fyf"; + user.name = "管理员"; + user.account = "admin"; + user.pass = "123456"; + user.deviceID = ConfigName.getInstance().DeviceId; + user.userID = "20230415-fyf"; + user.exp = "管理员"; + QueryDB.AddUser(user); + + } + } + + public void AddTestLC() { + BPA_SILOS par = new BPA_SILOS(); + par.id = "1231333"; + par.num = 1; + par.name = "料仓"; + par.warningValue = 49; + par.thrsoleValue = 20; + par.plcValue = "232"; + par.bValue = 30; + par.jValue = 23; + par.status = 1; + par.Sort = 0; + QueryDB.AddSilos(par); + + //2.获取物料 + ArrayList materials = QueryDB.GetMaterialALL(); + + BPA_SILOSANDMATERIAL al = new BPA_SILOSANDMATERIAL(); + al.silosID = "1231333"; + al.materialID = materials.get(0).id; + QueryDB.AddSilosAndMaterial(al); + } + + /** + * 测试数据库 新增 修改 删除 + */ + public void Test() { + //新增 + BPA_MATERIAL ba = new BPA_MATERIAL(); + ba.deviceID = java.util.UUID.randomUUID().toString(); + ba.userID = "张三---------"; + ba.exp = "测试-----"; + ba.name = "测试物料12312----"; + ba.imgUrl = "wwwwwwwww---"; + QueryDB.AddMaterial(ba); + + //查询 + ArrayList wl = QueryDB.GetMaterialALL(); + for (BPA_MATERIAL d : wl + ) { + String json = new Json().objectToJson(BPA_MATERIAL.class, d); + Log.i("日志", "物料查询:" + json); + + //d.name="测试修改"; // QueryDB.UpdateMaterial(d); - } + } - //删除 - //808be95d-68ae-4c7c-8e9e-b064408a61db + //删除 + //808be95d-68ae-4c7c-8e9e-b064408a61db // BPA_MATERIAL ba1=new BPA_MATERIAL(); // ba1.id="fa3e7c53-d349-4637-9d97-4ba96b8b1d65"; // QueryDB.DeleteMaterial(ba1); - } + } }