|
|
@@ -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<BPA_MATERIAL> 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<BPA_MATERIAL> wl= QueryDB.GetMaterialALL(); |
|
|
|
for (BPA_MATERIAL d:wl |
|
|
|
) { |
|
|
|
String json= new Json<BPA_MATERIAL>().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<BPA_MATERIAL> 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<BPA_MATERIAL> wl = QueryDB.GetMaterialALL(); |
|
|
|
for (BPA_MATERIAL d : wl |
|
|
|
) { |
|
|
|
String json = new Json<BPA_MATERIAL>().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); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |