diff --git a/app/src/main/java/com/bonait/bnframework/MainApplication.java b/app/src/main/java/com/bonait/bnframework/MainApplication.java index edd0507b..18edb603 100644 --- a/app/src/main/java/com/bonait/bnframework/MainApplication.java +++ b/app/src/main/java/com/bonait/bnframework/MainApplication.java @@ -11,9 +11,12 @@ import com.bonait.bnframework.business.ConfigData; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.DataBus; import com.bonait.bnframework.common.db.QueryDB; +import com.bonait.bnframework.common.db.file.DBHelper; import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG; +import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA; import com.bonait.bnframework.common.db.mode.BPA_GOODS; import com.bonait.bnframework.common.db.mode.BPA_LOG; +import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; import com.bonait.bnframework.common.db.mode.BPA_PROCESS; import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; import com.bonait.bnframework.common.db.mode.BPA_SILOS; @@ -111,7 +114,6 @@ public class MainApplication extends Application { //初始化DB数据 InitDBdata(); DataBus.getInstance().GetLc();//获取料仓数据 - } //========================================================================// @@ -162,6 +164,20 @@ public class MainApplication extends Application { InitProcessData(); } + + if(QueryDB.GetPlcaddressALL().size()<=0) + { + ConfigData.getInstance().RevertPLC(); + } + } + /** + * 删除表-重新生成新表 + */ + public void DBdelete() + { + DBHelper.getInstance(this).DeleteCreateTables(BPA_CLOUDDATA.class,null); + DBHelper.getInstance(this).DeleteCreateTables(BPA_PLCADDRESS.class,null); + } /** diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index 41bf1b19..1dfe2f2b 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -3,22 +3,37 @@ package com.bonait.bnframework.business; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import android.util.Log; import com.bonait.bnframework.R; import com.bonait.bnframework.common.constant.ConfigName; -import com.bonait.bnframework.common.constant.MessageName; import com.bonait.bnframework.common.db.QueryDB; +import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA; +import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; import com.bonait.bnframework.common.helper.ConfigUtil; -import com.bonait.bnframework.common.helper.HttpUtils; -import com.bonait.bnframework.common.helper.Json; -import com.bonait.bnframework.common.helper.mode.OrderStatusChange; -import com.bonait.bnframework.common.helper.mode.VersionMode; +import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; import com.bonait.bnframework.common.image.utils.LocalCacheUtils; +import com.bonait.bnframework.common.model.ResAPI; +import com.bonait.bnframework.common.model.ResListAPI; +import com.bonait.bnframework.common.model.mode.CloudGood; +import com.bonait.bnframework.common.model.mode.DeviceInformation; +import com.bonait.bnframework.common.model.mode.DicModel; +import com.bonait.bnframework.common.model.mode.InPage; +import com.bonait.bnframework.common.model.mode.InputDev; +import com.bonait.bnframework.common.model.mode.OrganizeMode; +import com.bonait.bnframework.common.model.mode.ResALLData; +import com.bonait.bnframework.common.utils.NetworkUtils; +import com.google.gson.Gson; +import com.lzy.okgo.OkGo; +import com.lzy.okgo.model.HttpHeaders; +import com.lzy.okgo.model.Response; import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import okhttp3.MediaType; +import okhttp3.RequestBody; /** @@ -51,7 +66,6 @@ public class ConfigData { LoadSystem(); ToggleEnvironment(); //2.加载配置 - LoadingDPPZ(); LoadingPZ(); //3.初始化业务 //4.初始化日志上报adad @@ -60,70 +74,63 @@ public class ConfigData { /** * 加载系统配置 */ - public void LoadSystem() - { - ArrayList bpa_systemsets= QueryDB.GetSystemsetALL(); + public void LoadSystem() { + ArrayList bpa_systemsets = QueryDB.GetSystemsetALL(); // for(BPA_SYSTEMSET item:bpa_systemsets) // { // QueryDB.DeleteSystemset(item.id); // } - for (int i = 0; i <5;i++){ - int ty=i; - BPA_SYSTEMSET set=new BPA_SYSTEMSET(); - set.type=ty; - switch (ty) - { + for (int i = 0; i < 5; i++) { + int ty = i; + BPA_SYSTEMSET set = new BPA_SYSTEMSET(); + set.type = ty; + switch (ty) { case 0: - set.value=ConfigName.getInstance().Environment; + set.value = ConfigName.getInstance().Environment; break; case 1: - set.value=ConfigName.getInstance().Address; + set.value = ConfigName.getInstance().Address; break; case 2: - set.value=String.valueOf(ConfigName.getInstance().Post); + set.value = String.valueOf(ConfigName.getInstance().Post); break; case 3: - set.value=ConfigName.getInstance().ClientId; + set.value = ConfigName.getInstance().ClientAutoKey; break; case 4: - set.value=ConfigName.getInstance().DeviceId; + set.value = ConfigName.getInstance().DeviceAutoKey; break; } set.deviceID = ConfigName.getInstance().DeviceId; set.userID = ConfigName.getInstance().user.userID; - BPA_SYSTEMSET find=null; - for (BPA_SYSTEMSET item:bpa_systemsets) - { - if(item.type==ty) - { - find=item; + BPA_SYSTEMSET find = null; + for (BPA_SYSTEMSET item : bpa_systemsets) { + if (item.type == ty) { + find = item; break; } } - if(find==null) - { + if (find == null) { QueryDB.AddSystemset(set); } } - bpa_systemsets= QueryDB.GetSystemsetALL(); - for (BPA_SYSTEMSET item:bpa_systemsets) - { - switch (item.type) - { + bpa_systemsets = QueryDB.GetSystemsetALL(); + for (BPA_SYSTEMSET item : bpa_systemsets) { + switch (item.type) { case 0: - ConfigName.getInstance().Environment=item.value; + ConfigName.getInstance().Environment = item.value; break; case 1: - ConfigName.getInstance().Address=item.value; + ConfigName.getInstance().Address = item.value; break; case 2: - ConfigName.getInstance().Post=Integer.parseInt(item.value); + ConfigName.getInstance().Post = Integer.parseInt(item.value); break; case 3: - ConfigName.getInstance().ClientId=item.value; + ConfigName.getInstance().ClientAutoKey = item.value; break; case 4: - ConfigName.getInstance().DeviceId=item.value; + ConfigName.getInstance().DeviceAutoKey = item.value; break; } @@ -133,38 +140,28 @@ public class ConfigData { /** * 切换环境 */ - public void ToggleEnvironment() - { - if(ConfigName.getInstance().Environment.equals("开发环境")) - { - ConfigName.getInstance().SaasAddress="https://bpa.black-pa.com:21527/"; - ConfigName.getInstance().mqtt_userName="emqx_u_block"; - ConfigName.getInstance().mqtt_passWord="emqx_p_admin8765490789"; - ConfigName.getInstance().mqtt_ip="10.2.1.21"; - ConfigName.getInstance().mqtt_post=1883; - }else if(ConfigName.getInstance().Environment.equals("测试环境")) - { - ConfigName.getInstance().SaasAddress="https://bpa.black-pa.com:21528/"; - ConfigName.getInstance().mqtt_userName="emqx_u_block"; - ConfigName.getInstance().mqtt_passWord="emqx_p_admin8456765490789"; - ConfigName.getInstance().mqtt_ip="111.9.47.105"; - ConfigName.getInstance().mqtt_post=18889; - }else if(ConfigName.getInstance().Environment.equals("正式环境")) - { - ConfigName.getInstance().SaasAddress="https://witt.black-pa.com/"; - ConfigName.getInstance().mqtt_userName="emqx_u_block"; - ConfigName.getInstance().mqtt_passWord="emqx_p_admin3658765490789"; - ConfigName.getInstance().mqtt_ip="47.108.65.220"; - ConfigName.getInstance().mqtt_post=1883; + public void ToggleEnvironment() { + if (ConfigName.getInstance().Environment.equals("开发环境")) { + ConfigName.getInstance().SaasAddress = "https://bpa.black-pa.com:21527/"; + ConfigName.getInstance().mqtt_userName = "emqx_u_block"; + ConfigName.getInstance().mqtt_passWord = "emqx_p_admin8765490789"; + ConfigName.getInstance().mqtt_ip = "10.2.1.21"; + ConfigName.getInstance().mqtt_post = 1883; + } else if (ConfigName.getInstance().Environment.equals("测试环境")) { + ConfigName.getInstance().SaasAddress = "https://bpa.black-pa.com:21528/"; + ConfigName.getInstance().mqtt_userName = "emqx_u_block"; + ConfigName.getInstance().mqtt_passWord = "emqx_p_admin8456765490789"; + ConfigName.getInstance().mqtt_ip = "111.9.47.105"; + ConfigName.getInstance().mqtt_post = 18889; + } else if (ConfigName.getInstance().Environment.equals("正式环境")) { + ConfigName.getInstance().SaasAddress = "https://witt.black-pa.com/"; + ConfigName.getInstance().mqtt_userName = "emqx_u_block"; + ConfigName.getInstance().mqtt_passWord = "emqx_p_admin3658765490789"; + ConfigName.getInstance().mqtt_ip = "47.108.65.220"; + ConfigName.getInstance().mqtt_post = 1883; } } - /** - * 加载店铺配置 - */ - public void LoadingDPPZ() { - ConfigName.getInstance().Shop_Name="黑菠萝奶茶机"; - ConfigName.getInstance().DeviceId="20020415-test"; - } + /** * 加载配置 */ @@ -182,35 +179,220 @@ public class ConfigData { /** * 保存配置 */ - public void SavePZ() - { + public void SavePZ() { //1.店铺配置 // ConfigUtil.write(ConfigName.getInstance().dishesCon,"Shop_Name", ConfigName.getInstance().Shop_Name); // ConfigUtil.write(ConfigName.getInstance().dishesCon,"AutKey", ConfigName.getInstance().AutKey); //2.用户信息 - ConfigUtil.write(ConfigName.getInstance().dishesCon,"username", ConfigName.getInstance().user.account); - ConfigUtil.write(ConfigName.getInstance().dishesCon,"password", ConfigName.getInstance().user.pass); - ConfigUtil.write(ConfigName.getInstance().dishesCon,"IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); - ConfigUtil.write(ConfigName.getInstance().dishesCon,"IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); - ConfigUtil.write(ConfigName.getInstance().dishesCon,"Version", ConfigName.getInstance().Version); + ConfigUtil.write(ConfigName.getInstance().dishesCon, "username", ConfigName.getInstance().user.account); + ConfigUtil.write(ConfigName.getInstance().dishesCon, "password", ConfigName.getInstance().user.pass); + ConfigUtil.write(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); + ConfigUtil.write(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); + ConfigUtil.write(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version); } /** - * 增加本地图片 + * 获取组织信息 + * + * @param context */ - public void AddImage(Context context) + public void GetOrganize(Context context) { + if (NetworkUtils.isNetworkConnected(context)) { + + //获取店铺信息 + OkGo.>get(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetStore + ConfigName.getInstance().ClientAutoKey) + .tag(context) + .execute(new JsonDialogCallback>(context) { + @Override + public void onSuccess(Response> response) { + ResAPI organize = response.body(); + if (organize.isSuccess) { + ConfigName.getInstance().organizeMode = organize.data; + + + OkGo.>get( + String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetDeviceInformation, + ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceAutoKey)) + .tag(context) + .execute(new JsonDialogCallback>(context) { + @Override + public void onSuccess(Response> response) { + ResAPI deviceInformation = response.body(); + if (deviceInformation.succeeded) { + ConfigName.getInstance().deviceInformation = deviceInformation.data; + if (ConfigName.getInstance().deviceInformation!=null) + { + ConfigName.getInstance().DeviceId=ConfigName.getInstance().deviceInformation.id; + } + } + } + }); + } + } + }); + + + } + } + + /** + * 同步云端数据 + */ + public void SyncDataInTheCloud(Context context) { + //region 拉取物料数据 + OkGo.>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetBaseDataModel, + ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceAutoKey)) + .tag(context) + .headers(new HttpHeaders("TenantId",ConfigName.getInstance().organizeMode.companyId)) + .execute(new JsonDialogCallback>(context) { + @Override + public void onSuccess(Response> response) { + ResAPI allDataResAPI = response.body(); + if (allDataResAPI.succeeded && allDataResAPI.data!=null) { + BPA_CLOUDDATA data=new BPA_CLOUDDATA(); + + ArrayList arrayList= QueryDB.GetClouddataALL(); + for (BPA_CLOUDDATA item:arrayList) + { + QueryDB.DeleteClouddata(item); + } + + if(allDataResAPI.data.batchingInfo!=null) + { + data=new BPA_CLOUDDATA(); + data.id=java.util.UUID.randomUUID().toString(); + data.name="物料集合"; + data.text=new Gson().toJson(allDataResAPI.data.batchingInfo); + QueryDB.AddClouddata(data); + } + + if(allDataResAPI.data.goodsTechnology!=null) + { + data=new BPA_CLOUDDATA(); + data.id=java.util.UUID.randomUUID().toString(); + data.name="工艺模型"; + data.text=new Gson().toJson(allDataResAPI.data.goodsTechnology); + QueryDB.AddClouddata(data); + } + + if(allDataResAPI.data.technologyAction!=null) + { + data=new BPA_CLOUDDATA(); + data.id=java.util.UUID.randomUUID().toString(); + data.name="工艺模型详细信息"; + data.text=new Gson().toJson(allDataResAPI.data.technologyAction); + QueryDB.AddClouddata(data); + } + + if(allDataResAPI.data.foodMenuInfo!=null) + { + data=new BPA_CLOUDDATA(); + data.id=java.util.UUID.randomUUID().toString(); + data.name="菜谱信息"; + data.text=new Gson().toJson(allDataResAPI.data.foodMenuInfo); + QueryDB.AddClouddata(data); + } + + if(allDataResAPI.data.goodsTypeInfo!=null) + { + data=new BPA_CLOUDDATA(); + data.id=java.util.UUID.randomUUID().toString(); + data.name="商品小类"; + data.text=new Gson().toJson(allDataResAPI.data.goodsTypeInfo); + QueryDB.AddClouddata(data); + } + + if(allDataResAPI.data.goodsParentTypeInfo!=null) + { + data=new BPA_CLOUDDATA(); + data.id=java.util.UUID.randomUUID().toString(); + data.name="商品大类"; + data.text=new Gson().toJson(allDataResAPI.data.goodsParentTypeInfo); + QueryDB.AddClouddata(data); + } + + if(allDataResAPI.data.goodsUintInfo!=null) + { + data=new BPA_CLOUDDATA(); + data.id=java.util.UUID.randomUUID().toString(); + data.name="商品单位"; + data.text=new Gson().toJson(allDataResAPI.data.goodsUintInfo); + QueryDB.AddClouddata(data); + } + + } + } + }); + //endregion + } + + /** + * 获取所有商品信息 + * @param context + */ + public void GetGevGood(Context context) + { + OkGo.>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoods, + ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceId)) + .tag(context) + .headers(new HttpHeaders("TenantId",ConfigName.getInstance().organizeMode.companyId)) + .execute(new JsonDialogCallback>>(context) { + @Override + public void onSuccess(Response>> response) { + ResAPI> allDataResAPI = response.body(); + if (allDataResAPI.succeeded && allDataResAPI.data!=null) { + + + } + } + }); + } + + /** + * 增加本地图片 + */ + public void AddImage(Context context) { BitmapFactory.Options options = new BitmapFactory.Options(); - options.inSampleSize=2;//宽高压缩为原来的1/2 - Bitmap bitmap1= BitmapFactory.decodeResource(context.getResources(), R.mipmap.image1,options); - Bitmap bitmap2= BitmapFactory.decodeResource(context.getResources(), R.mipmap.image2,options); - Bitmap bitmap3= BitmapFactory.decodeResource(context.getResources(), R.mipmap.image3,options); - Bitmap bitmap4= BitmapFactory.decodeResource(context.getResources(), R.mipmap.image4,options); - LocalCacheUtils localCacheUtils=new LocalCacheUtils(); - localCacheUtils.setBitmapToLocal("image1.png",bitmap1); - localCacheUtils.setBitmapToLocal("image2.png",bitmap2); - localCacheUtils.setBitmapToLocal("image3.png",bitmap3); - localCacheUtils.setBitmapToLocal("image4.png",bitmap4); + options.inSampleSize = 2;//宽高压缩为原来的1/2 + Bitmap bitmap1 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image1, options); + Bitmap bitmap2 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image2, options); + Bitmap bitmap3 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image3, options); + Bitmap bitmap4 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image4, options); + LocalCacheUtils localCacheUtils = new LocalCacheUtils(); + localCacheUtils.setBitmapToLocal("image1.png", bitmap1); + localCacheUtils.setBitmapToLocal("image2.png", bitmap2); + localCacheUtils.setBitmapToLocal("image3.png", bitmap3); + localCacheUtils.setBitmapToLocal("image4.png", bitmap4); + } + + /** + * 还原PLC + */ + public void RevertPLC() + { + try + { + ArrayList arrayList= QueryDB.GetPlcaddressALL(); + for (BPA_PLCADDRESS item:arrayList) + { + QueryDB.DeletePlcaddress(item); + } + int k=1; + for (Map.Entry entry : ConfigName.getInstance().PlcAddress_ys.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + BPA_PLCADDRESS plc=new BPA_PLCADDRESS(); + plc.name=key; + plc.address=value; + plc.sort=k; + k++; + QueryDB.AddPlcaddress(plc); + } + }catch (Exception ex) + { + + } } //endregion } diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index fd045aae..43fa91f2 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -54,7 +54,7 @@ public class ExecuteTheRecipe { if(!text.isEmpty()) { //仓号 值 - Map formulation=new IdentityHashMap<>(); + HashMap formulation=new HashMap<>(); //region 获取仓号和值 List data=new ArrayList<>(); if(text.contains("|")) diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java index 9f0a001a..e84b6981 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java @@ -3,6 +3,10 @@ package com.bonait.bnframework.common.constant; import android.content.Context; import com.bonait.bnframework.common.db.mode.BPA_USER; +import com.bonait.bnframework.common.model.mode.DeviceInformation; +import com.bonait.bnframework.common.model.mode.OrganizeMode; + +import java.util.HashMap; /** @@ -51,11 +55,15 @@ public class ConfigName { /** * 门店Id */ - public String ClientId="152"; + public String ClientAutoKey="152"; /** * 店铺设备号 */ - public String DeviceId="146"; + public String DeviceAutoKey="146"; + /** + * 设备id + */ + public String DeviceId="29318217-838a-4572-982d-51773bef6249"; //endregion //region MQTT配置中心 @@ -96,6 +104,17 @@ public class ConfigName { public BPA_USER user=new BPA_USER(); //endregion + //region 组织信息 + /** + * 组织信息 + */ + public OrganizeMode organizeMode=null; + /** + * 设备信息 + */ + public DeviceInformation deviceInformation=null; + //endregion + //region 版本信息 /** * 版本更新,当前版本 @@ -156,25 +175,241 @@ public class ConfigName { public int Post=502; //endregion - /** - * 是否单杯制作 - */ - public boolean IsSingleCupMake=true; - /** - * 是否测试 - */ - public boolean IsTest=true; //region URL //Sass地址 public String SaasAddress="http://order.test1.com"; //public String SaasAddress="https://bpa.black-pa.com:21527"; //public String SaasAddress="https://witt.black-pa.com"; - //获取订单详情接口 Get - public String GetOrder="order/order/fullorderbynumber/"; - //POST - public String OrderChange="order/order/robotstatuschange"; - + //获取店铺详细信息 Get + public String GetStore="kitchen/api/StoreHelper/GetStoreInfoById?storeId="; + //获取设备信息分页 Get + public String GetDeviceInformation="kitchen/api/Device/GetDeviceInfo?storeId=%s&autoKey=%s"; + //获取 获取基础信息(所有物料信息、设备工序模型、菜谱列表、商品小类、商品大类、单位数据 + public String GetBaseDataModel="kitchen/api/CommInteface/GetBaseDataModel?storeId=%s&autoKey=%s"; + //获取 商品 + public String GetGoods="kitchen/api/CommInteface/GetDeviceGood?storeId=%s&deviceId=%s"; + //获取商品配方信息 + public String GetGoodsBom="kitchen/api/CommInteface/GetDeviceGoodBomTechnology?goodsId=%s"; + //上传商品 + public String UpdateGoods="kitchen/api/CommInteface/SendGoodsInfo"; + //版本更新 public String UpdateVersion="http://111.9.47.105:18097/api/Version/GetLatest"; //endregion + + //region PLC地址配置 + /** + * PLC地址配置 + */ + public HashMap PlcAddress=new HashMap(); + public HashMap PlcAddress_ys=new HashMap(){ + { + //搅拌模型 + put("搅拌", "M1.0"); + put("搅拌动作", "M1.0"); + put("正转速度", "M1.0"); + put("反转速度", "M1.0"); + put("正转(秒)", "M1.0"); + put("反转(秒)", "M1.0"); + put("停止(秒)", "M1.0"); + put("延迟(秒)", "M1.0"); + + //热油模型 + put("热油", "M1.0"); + put("加热功率", "M1.0"); + put("热油(克)", "M1.0"); + + //主料模型 + put("主料", "M1.0"); + put("主料名称", "M1.0"); + put("主料重量", "M1.0"); + put("烹饪(秒)", "M1.0"); + put("投料动作", "M1.0"); + + //加热模型 + put("加热", "M1.0"); + put("加热功率", "M1.0"); + put("延迟(秒)", "M1.0"); + + //勾芡模型 + put("勾芡", "M1.0"); + put("勾芡(克)", "M1.0"); + + //出菜模型 + put("出菜", "M1.0"); + put("时间(秒)", "M1.0"); + + //热锅模型 + put("热锅", "M1.0"); + put("热锅功率", "M1.0"); + + //液体料模型 + put("校准时间", "M1.0"); + put("料仓1", "M1.0"); + put("料仓2", "M1.0"); + put("料仓3", "M1.0"); + put("料仓4", "M1.0"); + put("料仓5", "M1.0"); + put("料仓6", "M1.0"); + put("料仓7", "M1.0"); + put("料仓8", "M1.0"); + put("料仓9", "M1.0"); + put("料仓10", "M1.0"); + + put("料仓1校准值", "M1.0"); + put("料仓2校准值", "M1.0"); + put("料仓3校准值", "M1.0"); + put("料仓4校准值", "M1.0"); + put("料仓5校准值", "M1.0"); + put("料仓6校准值", "M1.0"); + put("料仓7校准值", "M1.0"); + put("料仓8校准值", "M1.0"); + put("料仓9校准值", "M1.0"); + put("料仓10校准值", "M1.0"); + + put("料仓1出料值", "M1.0"); + put("料仓2出料值", "M1.0"); + put("料仓3出料值", "M1.0"); + put("料仓4出料值", "M1.0"); + put("料仓5出料值", "M1.0"); + put("料仓6出料值", "M1.0"); + put("料仓7出料值", "M1.0"); + put("料仓8出料值", "M1.0"); + put("料仓9出料值", "M1.0"); + put("料仓10出料值", "M1.0"); + + //火力选择 + put("火力", "M1.0"); + + //清洗 + put("清洗", "M1.0"); + + //锅位 + put("锅位", "M1.0"); + + //摇芡 + put("摇芡", "M1.0"); + } + }; + //endregion } + + + +//配方信息 +//{ +// "statusCode": 200, +// "data": { +// "bomInfo": [ +// { +// "name": "爆炒肥肠", +// "code": "10005", +// "isMain": true, +// "autoKey": 1099, +// "bomInfo": null, +// "sort": 2, +// "groupId": "4cc8935c-9519-4a3c-a2fd-b49ca54f6f0d", +// "status": 0, +// "isDeleted": 0, +// "deleteAt": null, +// "deleteBy": null, +// "updateAt": null, +// "updateBy": null, +// "createAt": "2023-07-10 16:11:41", +// "createBy": "af27ebbd-5c1a-441f-8e26-cf6cc1352349", +// "id": "5c4f80d9-13f3-4dcf-9cca-db4d37ffc9d0" +// } +// ], +// "bomTechnologyActionInfo": [ +// { +// "stepName": "热油", +// "actionJson": "[{\"TechnologyactionId\":\"a82d2621-7016-4240-b5d5-7d5e41fb4d22\",\"ActionName\":\"加热功率\",\"ActionValue\":\"三档\",\"BatchingId\":\"\"},{\"TechnologyactionId\":\"df17c307-8f15-4d20-b497-61caf5668270\",\"ActionName\":\"热油(克)\",\"ActionValue\":333,\"BatchingId\":\"\"}]", +// "bomId": "5c4f80d9-13f3-4dcf-9cca-db4d37ffc9d0", +// "isBatch": false, +// "chnologyId": "f9ca0cff-ba94-4036-88f4-a5d05f8165e6", +// "createAt": "2023-07-11 17:47:28", +// "groupId": "4cc8935c-9519-4a3c-a2fd-b49ca54f6f0d", +// "isDeleted": 0, +// "sort": 6, +// "id": "7c3a5fe9-f1c6-4578-b6a8-a09006740d69" +// }, +// { +// "stepName": "液体料", +// "actionJson": "[{\"TechnologyactionId\":\"10915b41-268e-4d04-b259-8e4c5f65bbda\",\"ActionName\":\"酱油\",\"ActionValue\":\"10\",\"BatchingId\":\"210f346d-8b79-4059-a991-b22391e5193f\"},{\"TechnologyactionId\":\"897bc239-ba70-4cde-bd99-c4bb14219b04\",\"ActionName\":\"盐水\",\"ActionValue\":\"20\",\"BatchingId\":\"33a529a3-de63-49c0-aed0-ea83e852050b\"}]", +// "bomId": "5c4f80d9-13f3-4dcf-9cca-db4d37ffc9d0", +// "isBatch": true, +// "chnologyId": "315b149d-53bd-4fa0-9694-bf1d47ef9ba3", +// "createAt": "2023-07-11 17:36:46", +// "groupId": "4cc8935c-9519-4a3c-a2fd-b49ca54f6f0d", +// "isDeleted": 0, +// "sort": 5, +// "id": "a9e95580-89ba-400c-a91f-53fefbabb627" +// } +// ] +// }, +// "succeeded": true, +// "errors": null, +// "extras": null, +// "timestamp": 1689070602181 +// } + + + +// +//{ +// "goodsInfo": { +// "id": "string", +// "isDeleted": 0, +// "deleteAt": "2023-07-11T10:17:20.548Z", +// "deleteBy": "string", +// "updateAt": "2023-07-11T10:17:20.548Z", +// "updateBy": "string", +// "createAt": "2023-07-11T10:17:20.548Z", +// "createBy": "string", +// "status": 0, +// "groupId": "string", +// "goods_Name": "string", +// "goods_TypeID": "string", +// "goods_Descritption": "string", +// "goods_ImgUrl": "string", +// "goods_ImgMode": 0, +// "goods_Sort": 0, +// "goods_Enable": 0, +// "deleteUpdateTime": "2023-07-11T10:17:20.548Z", +// "key": "string", +// "code": "string", +// "price": 0, +// "tasteID": "string", +// "parentTypeID": "string", +// "vipPrice": 0, +// "goodsAttribute": 0, +// "goodsUintId": "string", +// "isWeigh": true, +// "autoKey": 0 +// }, +// "bomInfo": { +// "bomType": "string", +// "name": "string", +// "code": "string", +// "isMain": true, +// "autoKey": 0, +// "bomInfo": "string", +// "sort": 0 +// }, +// "bomTechnologyActionInfo": [ +// { +// "id": "string", +// "stepName": "string", +// "actionJson": "string", +// "bomId": "string", +// "isBatch": true, +// "chnologyId": "string", +// "createAt": "2023-07-11T10:17:20.548Z", +// "groupId": "string", +// "isDeleted": 0, +// "sort": 0 +// } +// ], +// "foodMenuId": "string", +// "storeId": "string" +// } \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java b/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java index 44f39217..323509aa 100644 --- a/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java +++ b/app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java @@ -7,6 +7,7 @@ import android.util.Log; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.file.DBHelper; +import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; import com.bonait.bnframework.common.db.file.DBHelper; import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG; @@ -21,6 +22,7 @@ import com.bonait.bnframework.common.db.mode.BPA_MENUANDUSER; import com.bonait.bnframework.common.db.mode.BPA_ORDER; import com.bonait.bnframework.common.db.mode.BPA_ORDERLOG; import com.bonait.bnframework.common.db.mode.BPA_ORDERLOGDESC; +import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; import com.bonait.bnframework.common.db.mode.BPA_PROCESS; import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; import com.bonait.bnframework.common.db.mode.BPA_SILOS; @@ -2274,6 +2276,145 @@ public class QueryDB { } //endregion + //region BPA_CLOUDDATA 云端数据表 + /** + * 新增工序模型表 + * add fengyoufu 20230413 + * + * @param data 工序数据 + * @return 是否成功 + */ + public static boolean AddClouddata(BPA_CLOUDDATA data) { + + return Add(BPA_CLOUDDATA.class, data); + } + + /** + * 修改工序模型表 + * add fengyoufu 20230413 + * + * @param data + */ + public static void UpdateClouddata(BPA_CLOUDDATA data) { + Update(BPA_CLOUDDATA.class, data); + } + + /** + * 删除工序模型表 + * add fengyoufu 20230413 + * + * @param data 工序数据 + * @return 是否成功 + */ + public static boolean DeleteClouddata(BPA_CLOUDDATA data) { + return Delete(BPA_CLOUDDATA.class, data.id); + } + + /** + * 获取所有工序模型表 + * + * @return + */ + public static ArrayList GetClouddataALL() { + String orderby = Desc_Time_Up;//出料顺序 + String where = "isDelete=?"; + String[] args = new String[]{"0"}; + ArrayList data = new ArrayList<>(); + ArrayList obj = Get(BPA_CLOUDDATA.class, where, args, orderby); + for (Object k : obj) { + data.add((BPA_CLOUDDATA) k); + } + return data; + } + //endregion + + + //region BPA_PLCADDRESS PLC地址管理表 + /** + * 新增工序模型表 + * add fengyoufu 20230413 + * + * @param data 工序数据 + * @return 是否成功 + */ + public static boolean AddPlcaddress(BPA_PLCADDRESS data) { + + return Add(BPA_PLCADDRESS.class, data); + } + + /** + * 修改工序模型表 + * add fengyoufu 20230413 + * + * @param data + */ + public static void UpdatePlcaddress(BPA_PLCADDRESS data) { + Update(BPA_PLCADDRESS.class, data); + } + + /** + * 删除工序模型表 + * add fengyoufu 20230413 + * + * @param data 工序数据 + * @return 是否成功 + */ + public static boolean DeletePlcaddress(BPA_PLCADDRESS data) { + return Delete(BPA_PLCADDRESS.class, data.id); + } + + /** + * 获取所有工序模型表 + * + * @return + */ + public static ArrayList GetPlcaddressALL() { + String orderby = Desc_Sort_Up + ',' +Desc_Time_Up;//出料顺序 + String where = "isDelete=?"; + String[] args = new String[]{"0"}; + ArrayList data = new ArrayList<>(); + ArrayList obj = Get(BPA_PLCADDRESS.class, where, args, orderby); + for (Object k : obj) { + data.add((BPA_PLCADDRESS) k); + } + return data; + } + /** + * ID查询工序模型表 + * + * @param id + * @return + */ + public static BPA_PLCADDRESS GetPlcaddressID(String id) { + try { + BPA_PLCADDRESS bpa_material = null; + boolean isSucess = false; + String orderby = Desc_Time_Up;//出料顺序 + String where = "isDelete=? and id=?"; + String[] args = new String[]{"0", id}; + ArrayList data = new ArrayList<>(); + ArrayList obj = Get(BPA_PLCADDRESS.class, where, args, orderby); + for (Object k : obj) { + bpa_material = (BPA_PLCADDRESS) k; + } + return bpa_material; + } catch (Exception e) { + return null; + } + + } + /** + * 修改地址 + */ + public static void UpdatePlcaddressText(String id, String address) { + BPA_PLCADDRESS material = GetPlcaddressID(id); + if (material != null) { + material.address = address; + Update(BPA_PLCADDRESS.class, material); + } + } + //endregion + //region 私有 /** @@ -2631,6 +2772,19 @@ public class QueryDB { ((BPA_PROCESSModel) data).data = cursor.getString((int) cursor.getColumnIndex("data")); ((BPA_PROCESSModel) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); break; + case "BPA_CLOUDDATA": + data = new BPA_CLOUDDATA(); + //私有 + ((BPA_CLOUDDATA) data).name = cursor.getString((int) cursor.getColumnIndex("name")); + ((BPA_CLOUDDATA) data).text = cursor.getString((int) cursor.getColumnIndex("text")); + break; + case "BPA_PLCADDRESS": + data = new BPA_PLCADDRESS(); + //私有 + ((BPA_PLCADDRESS) data).name = cursor.getString((int) cursor.getColumnIndex("name")); + ((BPA_PLCADDRESS) data).address = cursor.getString((int) cursor.getColumnIndex("address")); + ((BPA_PLCADDRESS) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); + break; } ((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/bonait/bnframework/common/db/file/DBHelper.java b/app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java index 0833c2c4..061ebf19 100644 --- a/app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java +++ b/app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java @@ -5,6 +5,7 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import com.bonait.bnframework.common.constant.ConfigName; +import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG; import com.bonait.bnframework.common.db.mode.BPA_CRAFT; @@ -18,6 +19,7 @@ import com.bonait.bnframework.common.db.mode.BPA_MENUANDUSER; import com.bonait.bnframework.common.db.mode.BPA_ORDER; import com.bonait.bnframework.common.db.mode.BPA_ORDERLOG; import com.bonait.bnframework.common.db.mode.BPA_ORDERLOGDESC; +import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; import com.bonait.bnframework.common.db.mode.BPA_PROCESS; import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; import com.bonait.bnframework.common.db.mode.BPA_SILOS; @@ -119,6 +121,10 @@ public class DBHelper extends SQLiteOpenHelper { CreateTablesAll(BPA_PROCESS.class,null);//工序表 CreateTablesAll(BPA_PROCESSModel.class,null);//工序模型表 + + CreateTablesAll(BPA_CLOUDDATA.class,null);//云端表 + CreateTablesAll(BPA_PLCADDRESS.class,null);//工序模型表 + ForeignKeys(); } /** @@ -217,7 +223,13 @@ public class DBHelper extends SQLiteOpenHelper { } tables.add(t); for (Table table : tables) { - db.execSQL(table.deleteSql()); + try + { + db.execSQL(table.deleteSql()); + }catch (Exception ex) + { + + } db.execSQL(table.createSQL(premarykey)); } db.setTransactionSuccessful(); diff --git a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_CLOUDDATA.java b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_CLOUDDATA.java new file mode 100644 index 00000000..1283b515 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_CLOUDDATA.java @@ -0,0 +1,9 @@ +package com.bonait.bnframework.common.db.mode; + +/** + * 云端数据表 + */ +public class BPA_CLOUDDATA extends ModeBase{ + public String name;//名称 + public String text;//数据 +} diff --git a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PLCADDRESS.java b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PLCADDRESS.java new file mode 100644 index 00000000..23081ec2 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_PLCADDRESS.java @@ -0,0 +1,11 @@ +package com.bonait.bnframework.common.db.mode; + +/** + * PLC地址管理 + */ +public class BPA_PLCADDRESS extends ModeBase{ + public String name; + public String address; + + public int sort; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/http/callback/json/JsonConvert.java b/app/src/main/java/com/bonait/bnframework/common/http/callback/json/JsonConvert.java index f9a5e0fe..d9d5150a 100644 --- a/app/src/main/java/com/bonait/bnframework/common/http/callback/json/JsonConvert.java +++ b/app/src/main/java/com/bonait/bnframework/common/http/callback/json/JsonConvert.java @@ -4,10 +4,10 @@ import android.text.TextUtils; import com.bonait.bnframework.common.http.GsonConvert; import com.bonait.bnframework.common.http.exception.TokenException; -import com.bonait.bnframework.common.model.BaseCodeJson; -import com.bonait.bnframework.common.model.BaseJson; -import com.bonait.bnframework.common.model.SimpleBaseJson; -import com.bonait.bnframework.common.model.SimpleCodeJson; +import com.bonait.bnframework.common.model.mode.BaseCodeJson; +import com.bonait.bnframework.common.model.mode.BaseJson; +import com.bonait.bnframework.common.model.mode.SimpleBaseJson; +import com.bonait.bnframework.common.model.mode.SimpleCodeJson; import com.google.gson.stream.JsonReader; import com.lzy.okgo.convert.Converter; diff --git a/app/src/main/java/com/bonait/bnframework/common/model/PageAPI.java b/app/src/main/java/com/bonait/bnframework/common/model/PageAPI.java new file mode 100644 index 00000000..261ca2ac --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/PageAPI.java @@ -0,0 +1,7 @@ +package com.bonait.bnframework.common.model; + + +public class PageAPI { + public int total; + public T data; +} \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/common/model/PageListAPI.java b/app/src/main/java/com/bonait/bnframework/common/model/PageListAPI.java new file mode 100644 index 00000000..48d9f463 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/PageListAPI.java @@ -0,0 +1,9 @@ +package com.bonait.bnframework.common.model; + + +import java.util.List; + +public class PageListAPI { + public int total; + public List data; +} \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/common/model/ResAPI.java b/app/src/main/java/com/bonait/bnframework/common/model/ResAPI.java new file mode 100644 index 00000000..eee7de60 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/ResAPI.java @@ -0,0 +1,7 @@ +package com.bonait.bnframework.common.model; + +public class ResAPI { + public boolean succeeded; + public boolean isSuccess; + public T data; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/ResListAPI.java b/app/src/main/java/com/bonait/bnframework/common/model/ResListAPI.java new file mode 100644 index 00000000..e0c2121d --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/ResListAPI.java @@ -0,0 +1,10 @@ +package com.bonait.bnframework.common.model; + + +import java.util.List; + +public class ResListAPI { + public boolean isSuccess; + public boolean succeeded; + public List data; +} \ No newline at end of file diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/ActionTypeEnum.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/ActionTypeEnum.java new file mode 100644 index 00000000..5d56e83b --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/ActionTypeEnum.java @@ -0,0 +1,12 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 枚举 + */ +public enum ActionTypeEnum { + text, + select, + textarea, + digit, + _switch, +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/BaseCodeJson.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/BaseCodeJson.java similarity index 95% rename from app/src/main/java/com/bonait/bnframework/common/model/BaseCodeJson.java rename to app/src/main/java/com/bonait/bnframework/common/model/mode/BaseCodeJson.java index f4b4c0c3..0d6b11ac 100644 --- a/app/src/main/java/com/bonait/bnframework/common/model/BaseCodeJson.java +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/BaseCodeJson.java @@ -1,4 +1,4 @@ -package com.bonait.bnframework.common.model; +package com.bonait.bnframework.common.model.mode; import com.google.gson.annotations.SerializedName; diff --git a/app/src/main/java/com/bonait/bnframework/common/model/BaseJson.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/BaseJson.java similarity index 95% rename from app/src/main/java/com/bonait/bnframework/common/model/BaseJson.java rename to app/src/main/java/com/bonait/bnframework/common/model/mode/BaseJson.java index 6a31b954..ea03cb84 100644 --- a/app/src/main/java/com/bonait/bnframework/common/model/BaseJson.java +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/BaseJson.java @@ -1,4 +1,4 @@ -package com.bonait.bnframework.common.model; +package com.bonait.bnframework.common.model.mode; import com.google.gson.annotations.SerializedName; diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/BatchingInfo.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/BatchingInfo.java new file mode 100644 index 00000000..c9567561 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/BatchingInfo.java @@ -0,0 +1,24 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 物料数据 + */ +public class BatchingInfo { + public String code; + public int aittribute; + public String batching_Name; + public String batching_Type; + public String typeID; + public String stockUint; + public String specs; + public int price; + public int netrecovery; + public String outstockUint; + public int proportion; + public int autoKey; + public String groupId; + public int status; + public int isDeleted; + public String createAt; + public String id; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/CloudGood.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/CloudGood.java new file mode 100644 index 00000000..36b5720e --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/CloudGood.java @@ -0,0 +1,25 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 云端商品 + */ +public class CloudGood { + public String goods_Name; + public String goods_TypeID; + public String goods_ImgUrl; + public int goods_Sort; + public String code; + public double price; + public String tasteID; + public String parentTypeID; + public double vipPrice; + public String goodsUintId; + public boolean isWeigh; + public int autoKey; + + public String groupId; + public int status; + public int isDeleted; + public String createAt; + public String id; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/DeviceInformation.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/DeviceInformation.java new file mode 100644 index 00000000..e7e0b2e5 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/DeviceInformation.java @@ -0,0 +1,21 @@ +package com.bonait.bnframework.common.model.mode; + +public class DeviceInformation { + public String id; + + public String deviceName;//设备名称 + public String deviceAddr;//设备地址 + + public String deviceLoc;//设备位置 + + public String deviceTypeId; + + public String orgId;//门店id + + public String deviceTypeKey;//MORKT + + public int autoKey;//设备KEY + + public int orgKey;//组织key + +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/DicModel.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/DicModel.java new file mode 100644 index 00000000..28e7f371 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/DicModel.java @@ -0,0 +1,6 @@ +package com.bonait.bnframework.common.model.mode; + +public class DicModel { + public String id; + public String name; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/FoodMenuInfo.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/FoodMenuInfo.java new file mode 100644 index 00000000..c4f2d8a7 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/FoodMenuInfo.java @@ -0,0 +1,15 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 菜谱信息 + */ +public class FoodMenuInfo { + public String code; + public String name; + public int sort; + public String groupId; + public int status; + public int isDeleted; + public String createAt; + public String id; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsParentTypeInfo.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsParentTypeInfo.java new file mode 100644 index 00000000..04dff44f --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsParentTypeInfo.java @@ -0,0 +1,14 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 商品大类 + */ +public class GoodsParentTypeInfo { + public String name; + public int sort; + public String groupId; + public int status; + public int isDeleted; + public String createAt; + public String id; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsTechnology.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsTechnology.java new file mode 100644 index 00000000..0c9ba34a --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsTechnology.java @@ -0,0 +1,13 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 工艺模型信息 + */ +public class GoodsTechnology { + public String name; + public int status; + public String createAt; + public String groupId; + public int isDeleted; + public String id; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsTypeInfo.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsTypeInfo.java new file mode 100644 index 00000000..2f5d02dd --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsTypeInfo.java @@ -0,0 +1,14 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 商品小类 + */ +public class GoodsTypeInfo { + public String goodsType_Name; + public int goodsType_Sort; + public String groupId; + public int status; + public int isDeleted; + public String createAt; + public String id; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsUintInfo.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsUintInfo.java new file mode 100644 index 00000000..51ef9fb3 --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/GoodsUintInfo.java @@ -0,0 +1,11 @@ +package com.bonait.bnframework.common.model.mode; + +public class GoodsUintInfo { + public String goodsType_Name; + public String remark; + public String groupId; + public int status; + public int isDeleted; + public String createAt; + public String id; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/InPage.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/InPage.java new file mode 100644 index 00000000..879a91bd --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/InPage.java @@ -0,0 +1,14 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 分页请求 + */ +public class InPage { + public int current; + public int pageSize; + public InPage() + { + current=1; + pageSize=9999; + } +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/InputDev.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/InputDev.java new file mode 100644 index 00000000..91e46aaa --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/InputDev.java @@ -0,0 +1,10 @@ +package com.bonait.bnframework.common.model.mode; + +public class InputDev { + public String deviceId; + + public InputDev(String _devid) + { + this.deviceId=_devid; + } +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/OrganizeMode.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/OrganizeMode.java new file mode 100644 index 00000000..d6539c1a --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/OrganizeMode.java @@ -0,0 +1,17 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 组织Mode + */ +public class OrganizeMode { + public String id;// 门店编号 + public String store_Name;// 名称 + public String store_Addr;// 地址 + public String logo;// logo + public String store_Loc;//位置 + public int sort;//排序 + public int autoKey;//排序 + public String companyId;//组织id + public String tel;//电话 + public String wechatAppId;//微信id +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java new file mode 100644 index 00000000..d6fccc1e --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java @@ -0,0 +1,37 @@ +package com.bonait.bnframework.common.model.mode; + +import java.util.List; + +/** + * 所有物料信息 获取基础信息(所有物料信息、设备工序模型、菜谱列表、商品小类、商品大类、单位数据) + */ +public class ResALLData { + /** + * 物料集合 + */ + public List batchingInfo; + /** + * 工艺模型 + */ + public List goodsTechnology; + /** + * 工艺模型详细信息 + */ + public List technologyAction; + /** + * 菜谱信息 + */ + public List foodMenuInfo; + /** + * 商品小类 + */ + public List goodsTypeInfo; + /** + * 商品大类 + */ + public List goodsParentTypeInfo; + /** + * 商品单位 + */ + public List goodsUintInfo; +} diff --git a/app/src/main/java/com/bonait/bnframework/common/model/SimpleBaseJson.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/SimpleBaseJson.java similarity index 93% rename from app/src/main/java/com/bonait/bnframework/common/model/SimpleBaseJson.java rename to app/src/main/java/com/bonait/bnframework/common/model/mode/SimpleBaseJson.java index af19b5ff..d0e59e33 100644 --- a/app/src/main/java/com/bonait/bnframework/common/model/SimpleBaseJson.java +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/SimpleBaseJson.java @@ -1,4 +1,4 @@ -package com.bonait.bnframework.common.model; +package com.bonait.bnframework.common.model.mode; import com.google.gson.annotations.SerializedName; diff --git a/app/src/main/java/com/bonait/bnframework/common/model/SimpleCodeJson.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/SimpleCodeJson.java similarity index 93% rename from app/src/main/java/com/bonait/bnframework/common/model/SimpleCodeJson.java rename to app/src/main/java/com/bonait/bnframework/common/model/mode/SimpleCodeJson.java index 624b96c4..fa6c64cf 100644 --- a/app/src/main/java/com/bonait/bnframework/common/model/SimpleCodeJson.java +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/SimpleCodeJson.java @@ -1,4 +1,4 @@ -package com.bonait.bnframework.common.model; +package com.bonait.bnframework.common.model.mode; import com.google.gson.annotations.SerializedName; diff --git a/app/src/main/java/com/bonait/bnframework/common/model/mode/TechnologyAction.java b/app/src/main/java/com/bonait/bnframework/common/model/mode/TechnologyAction.java new file mode 100644 index 00000000..4449dcbf --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/common/model/mode/TechnologyAction.java @@ -0,0 +1,16 @@ +package com.bonait.bnframework.common.model.mode; + +/** + * 工艺模型详细信息 + */ +public class TechnologyAction { + public String goodstechnologyId;//模型id + public String actionName;//搅拌动作 + public String actionType;//动作类型 + public String actionValue;//"[{\"actionValueName\":\"正转反转\"},{\"actionValueName\":\"一直正转\"},{\"actionValueName\":\"一直反转\"}] + public int sort; + public int isDeleted; + public String groupId; + public String createAt; + public String id; +} diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemDeviceinFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemDeviceinFragment.java index 30a2bf9e..398fa325 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemDeviceinFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemDeviceinFragment.java @@ -4,19 +4,42 @@ import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.RecyclerView; + +import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; +import android.widget.EditText; +import android.widget.ImageView; import com.bonait.bnframework.R; import com.bonait.bnframework.common.base.BaseFragment; +import com.bonait.bnframework.common.constant.ConfigName; +import com.bonait.bnframework.common.image.MyBitmapUtils; import com.orhanobut.logger.Logger; +import butterknife.BindView; import butterknife.ButterKnife; public class SystemDeviceinFragment extends BaseFragment { - + @BindView(R.id.edittext1) + EditText edittext1; + @BindView(R.id.edittext2) + EditText edittext2; + @BindView(R.id.edittext3) + EditText edittext3; + @BindView(R.id.edittext4) + EditText edittext4; + @BindView(R.id.edittext5) + EditText edittext5; + @BindView(R.id.edittext6) + EditText edittext6; + @BindView(R.id.edittext7) + EditText edittext7; + @BindView(R.id.image) + ImageView image; private Context context; @Override protected View onCreateView() { @@ -30,8 +53,30 @@ public class SystemDeviceinFragment extends BaseFragment { super.onViewCreated(view, savedInstanceState); Logger.d("我的fragment创建"); context = getContext(); + initdata(); } + /** + * 初始化数据 + */ + public void initdata() + { + if(ConfigName.getInstance().organizeMode !=null && ConfigName.getInstance().deviceInformation!=null) + { + edittext1.setText(ConfigName.getInstance().deviceInformation.id); + edittext2.setText(ConfigName.getInstance().deviceInformation.deviceName); + edittext3.setText(ConfigName.getInstance().deviceInformation.deviceLoc); + edittext4.setText(ConfigName.getInstance().organizeMode.tel); + edittext5.setText(ConfigName.getInstance().deviceInformation.deviceAddr); + edittext6.setText(ConfigName.getInstance().organizeMode.id); + edittext7.setText(ConfigName.getInstance().organizeMode.store_Name); + + if(ConfigName.getInstance().organizeMode.logo!=null) + { + new MyBitmapUtils().disPlay(image,ConfigName.getInstance().organizeMode.logo); + } + } + } @Override public void onDestroy() { super.onDestroy(); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSeasoningsetFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSeasoningsetFragment.java index a71002ec..530d2293 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSeasoningsetFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSeasoningsetFragment.java @@ -3,48 +3,35 @@ package com.bonait.bnframework.modules.home.fragment.from.fragment; import android.content.Context; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.appcompat.app.AppCompatActivity; import android.content.DialogInterface; import android.os.Bundle; import android.text.InputType; import android.view.LayoutInflater; import android.view.View; -import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.Spinner; -import android.widget.TextView; -import com.bin.david.form.core.SmartTable; -import com.bin.david.form.data.column.ColumnInfo; -import com.bin.david.form.listener.OnColumnClickListener; 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.constant.DataBus; -import com.bonait.bnframework.common.constant.MessageName; 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_SILOS; import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; import com.bonait.bnframework.common.db.res.lcMode; import com.bonait.bnframework.common.helper.I.MyClickListener; -import com.bonait.bnframework.common.message.MessageManager; +import com.bonait.bnframework.common.utils.NetworkUtils; import com.bonait.bnframework.common.utils.ToastUtils; -import com.bonait.bnframework.modules.home.adapter.lc_adapter; import com.bonait.bnframework.modules.home.adapter.lcsz_adapter; import com.bonait.bnframework.modules.home.adapter.process_adapter; import com.bonait.bnframework.modules.home.adapter.wl_adapter; -import com.bonait.bnframework.modules.home.fragment.from.CpActivity; -import com.bonait.bnframework.modules.home.fragment.from.DiyActivity; -import com.bonait.bnframework.modules.home.fragment.from.SzActivity; -import com.bonait.bnframework.modules.home.fragment.from.WhActivity; import com.orhanobut.logger.Logger; -import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.dialog.QMUIDialog; import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; @@ -110,7 +97,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL Initdata_gx(); } - @OnClick({R.id.add_wl}) + @OnClick({R.id.add_wl,R.id.synchronous}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.add_wl://增加物料 @@ -138,6 +125,44 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL ToastUtils.info("新增成功"); Initdata_wl(); break; + case R.id.synchronous://同步云端 + + if(NetworkUtils.isNetworkConnected(context)) + { + final QMUIDialog.EditTextDialogBuilder builder = new QMUIDialog.EditTextDialogBuilder(context); + builder.setTitle("密码确认") + .setPlaceholder("在此输入权限密码") + .setInputType(InputType.TYPE_CLASS_TEXT) + .addAction("取消", new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + dialog.dismiss(); + } + }) + .addAction("确定", new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + CharSequence text = builder.getEditText().getText(); + if (text != null && text.length() > 0) { + if(text.toString().equals(ConfigName.getInstance().user.pass)) + { + ConfigData.getInstance().SyncDataInTheCloud(context); + dialog.dismiss(); + }else + { + ToastUtils.info("权限密码不正确!"); + } + } else { + ToastUtils.info("权限密码不正确!"); + } + } + }) + .show(); + }else + { + ToastUtils.warning("无网络,请先连接网络!!!"); + } + break; } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java index edb914de..09f101f6 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java @@ -113,11 +113,11 @@ public class SystemSystemsetFragment extends BaseFragment { edittext2.setText(item.value); break; case 3: - ConfigName.getInstance().ClientId=item.value; + ConfigName.getInstance().ClientAutoKey=item.value; edittext3.setText(item.value); break; case 4: - ConfigName.getInstance().DeviceId=item.value; + ConfigName.getInstance().DeviceAutoKey=item.value; edittext4.setText(item.value); break; } @@ -130,8 +130,8 @@ public class SystemSystemsetFragment extends BaseFragment { case R.id.StartButton://保存按钮 ConfigName.getInstance().Address=edittext1.getText().toString(); ConfigName.getInstance().Post=Integer.parseInt(edittext2.getText().toString()); - ConfigName.getInstance().ClientId=edittext3.getText().toString(); - ConfigName.getInstance().DeviceId=edittext4.getText().toString(); + ConfigName.getInstance().ClientAutoKey=edittext3.getText().toString(); + ConfigName.getInstance().DeviceAutoKey=edittext4.getText().toString(); ConfigName.getInstance().Environment=environment.getSelectedItem().toString(); for (BPA_SYSTEMSET item:bpa_systemsets) diff --git a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java index ed81eb49..03cb3f73 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java @@ -108,6 +108,15 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL initUser(); initEvent(); + initData(); + } + + /** + * 设置 + */ + public void initData() + { + ConfigData.getInstance().GetOrganize(this); } @OnClick({R.id.iv_clean_account, R.id.clean_password, R.id.iv_show_pwd,R.id.forget_password, R.id.btn_login}) diff --git a/app/src/main/java/com/bonait/bnframework/test/TestActivity.java b/app/src/main/java/com/bonait/bnframework/test/TestActivity.java index 51fb6bf3..9a6ec578 100644 --- a/app/src/main/java/com/bonait/bnframework/test/TestActivity.java +++ b/app/src/main/java/com/bonait/bnframework/test/TestActivity.java @@ -13,7 +13,7 @@ import com.bonait.bnframework.common.constant.Constants; import com.bonait.bnframework.common.http.callback.files.FileProgressDialogCallBack; import com.bonait.bnframework.common.http.callback.files2.FileProgressDialogCallBack2; import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; -import com.bonait.bnframework.common.model.BaseCodeJson; +import com.bonait.bnframework.common.model.mode.BaseCodeJson; import com.bonait.bnframework.common.utils.AppUtils; import com.bonait.bnframework.common.utils.ToastUtils; import com.bonait.bnframework.modules.welcome.model.AppLoginPo; diff --git a/app/src/main/res/layout/fragment_system_devicein.xml b/app/src/main/res/layout/fragment_system_devicein.xml index c3d0058b..987ac1ce 100644 --- a/app/src/main/res/layout/fragment_system_devicein.xml +++ b/app/src/main/res/layout/fragment_system_devicein.xml @@ -5,15 +5,236 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".modules.home.fragment.from.fragment.SystemDeviceinFragment"> + - + + + android:layout_marginLeft="@dimen/dp_10" + android:layout_marginTop="@dimen/dp_10" + android:layout_marginRight="@dimen/dp_10"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_system_seasoningset.xml b/app/src/main/res/layout/fragment_system_seasoningset.xml index cad0832f..a47f7368 100644 --- a/app/src/main/res/layout/fragment_system_seasoningset.xml +++ b/app/src/main/res/layout/fragment_system_seasoningset.xml @@ -81,21 +81,37 @@ android:layout_centerVertical="true" /> - + +