From 82d8e4133b38509ab05e6b665a294ba9c7f1d48f Mon Sep 17 00:00:00 2001 From: liup <1454939542@qq.com> Date: Wed, 21 Aug 2024 17:59:01 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/ExecuteTheRecipe.java | 3 +-- .../common/db/util/OrderDetailUtil.java | 6 ++++- .../fragment/main/HomeOrderFragment.java | 26 ++++++++++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) 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 80d924f9..dfec20fc 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -16,7 +16,6 @@ import com.bonait.bnframework.HBL.Interface.IRunT; import com.bonait.bnframework.HBL.Thread.ThreadManager; import com.bonait.bnframework.Model.CheckPositionBean; import com.bonait.bnframework.Model.MyStatus; -import com.bonait.bnframework.Service.ModbusTcpServer; import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; @@ -2205,7 +2204,7 @@ public class ExecuteTheRecipe { long a = System.currentTimeMillis(); RecordManager.getInstance().addLogRecord("订单处理日志",name + ",等待中"); - while (IsComplete[0] && !IsForcedEnd2 && WokModbusTcpServer.get().plcIsConnect&&RobotModbusTcpServer.get().plcIsConnect&& OvenModbusTcpServer.get().plcIsConnect && !ConfigName.TEST) { + while (IsComplete[0] && !IsForcedEnd2 && WokModbusTcpServer.get().plcIsConnect&&RobotModbusTcpServer.get().plcIsConnect&& !ConfigName.TEST) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) { ExecuteTheRecipe.showlog(name + ",异常超时退出!"); break; diff --git a/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java b/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java index b99e373a..cce764e2 100644 --- a/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java +++ b/app/src/main/java/com/bonait/bnframework/common/db/util/OrderDetailUtil.java @@ -91,7 +91,11 @@ public class OrderDetailUtil { ArrayList data = new ArrayList<>(); ArrayList obj = QueryDB.Get(BPA_ORDER_DETAIL.class, where, args, orderby); for (Object k : obj) { - data.add((BPA_ORDER_DETAIL) k); + if(((BPA_ORDER_DETAIL) k).status!=0){ + data.add(0,(BPA_ORDER_DETAIL) k); + }else { + data.add((BPA_ORDER_DETAIL) k); + } } LogUtils.d("OrderDetailUtil getAll data=" + data.toString()); return data; diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java index 5da4f8ac..d65e049f 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java +++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java @@ -404,11 +404,15 @@ public class HomeOrderFragment extends BaseFragment { OrderDetailUtil.deleteById(orderChaoDetails.get(position).id); orderChaoDetails.remove(position); orderAdapter1.setCurrentPosition(-1); + foodInfoList.clear(); + foodInfoAdapter.notifyDataSetChanged(); orderAdapter1.notifyDataSetChanged(); }else { OrderDetailUtil.deleteById(orderKaoDetails.get(position).id); orderKaoDetails.remove(position); orderAdapter2.setCurrentPosition(-1); + foodInfoList.clear(); + foodInfoAdapter.notifyDataSetChanged(); orderAdapter2.notifyDataSetChanged(); } @@ -486,15 +490,23 @@ public class HomeOrderFragment extends BaseFragment { if(type==0){ orderChaoDetails.get(position).status = 1; BPA_ORDER_DETAIL bean = orderChaoDetails.get(position); + bean.createTime = "0"; OrderDetailUtil.update(bean); - orderAdapter1.notifyItemChanged(position); + orderAdapter1.setCurrentPosition(-1); + foodInfoList.clear(); + foodInfoAdapter.notifyDataSetChanged(); + orderAdapter1.notifyDataSetChanged(); startMakingThread(bean); jumpToCook(orderChaoDetails.get(position)); }else { orderKaoDetails.get(position).status = 1; BPA_ORDER_DETAIL bean = orderKaoDetails.get(position); + bean.createTime = "0"; OrderDetailUtil.update(bean); - orderAdapter2.notifyItemChanged(position); + orderAdapter1.setCurrentPosition(-1); + foodInfoList.clear(); + foodInfoAdapter.notifyDataSetChanged(); + orderAdapter1.notifyDataSetChanged(); startMakingThread2(bean); jumpToCook(orderKaoDetails.get(position)); } @@ -537,19 +549,27 @@ public class HomeOrderFragment extends BaseFragment { if(type==0){ orderChaoDetails.get(position).status = 1; BPA_ORDER_DETAIL bean = orderChaoDetails.get(position); + bean.createTime = "0"; OrderDetailUtil.update(bean); orderChaoDetails.clear(); orderChaoDetails.addAll(OrderDetailUtil.getAllByType(type)); + orderAdapter1.setCurrentPosition(-1); + foodInfoList.clear(); + foodInfoAdapter.notifyDataSetChanged(); orderAdapter1.notifyDataSetChanged(); startMakingThread(bean); }else { orderKaoDetails.get(position).status = 1; BPA_ORDER_DETAIL bean = orderKaoDetails.get(position); + bean.createTime = "0"; OrderDetailUtil.update(bean); orderKaoDetails.clear(); orderKaoDetails.addAll(OrderDetailUtil.getAllByType(type)); - orderAdapter2.notifyDataSetChanged(); + orderAdapter1.setCurrentPosition(-1); + foodInfoList.clear(); + foodInfoAdapter.notifyDataSetChanged(); + orderAdapter1.notifyDataSetChanged(); startMakingThread2(bean); } } From 1b0a0d52bf1c26fb185a2c13796f191007d4930b Mon Sep 17 00:00:00 2001 From: liup <1454939542@qq.com> Date: Thu, 22 Aug 2024 14:28:57 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bnframework/business/ConfigData.java | 6 +- .../newui/activity/MainHActivity.java | 2 + .../fragment/setting/SceneSetFragment.java | 79 +++++++++++++++- .../newui/http/UpdateAllDataService.java | 9 +- .../newui/http/UpdateDataService.java | 8 +- .../newui/viewmodel/HomeGoodsViewModel.java | 7 +- .../main/res/layout/fragment_scene_set.xml | 90 +++++++++++++++++-- build.gradle | 4 +- 8 files changed, 180 insertions(+), 25 deletions(-) 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 47a7090c..a4c913fa 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -52,10 +52,8 @@ import com.bonait.bnframework.common.model.mode.UpdateBomInfo; import com.bonait.bnframework.common.model.mode.UpdateCloudGood; import com.bonait.bnframework.common.oss.OssHelper; import com.bonait.bnframework.common.utils.NetworkUtils; -import com.bonait.bnframework.common.utils.PreferenceUtils; import com.bonait.bnframework.common.utils.ToastUtils; import com.bonait.bnframework.common.view.GoodEditDialog; -import com.bonait.bnframework.newui.http.UpdateAllDataService; import com.bonait.bnframework.newui.http.UpdateDataService; import com.google.gson.Gson; import com.lzy.okgo.OkGo; @@ -123,6 +121,10 @@ public class ConfigData { if(systemset.type==-203){ ConfigName.getInstance().Key = systemset.value; UpdateDataService.key = systemset.value; + }else if(systemset.type==-100){ + ConfigName.getInstance().versionSelectionEnum = systemset.value; + }else if(systemset.type==-101){ + ConfigName.getInstance().DeviceAutoKey = systemset.value; } } // for(BPA_SYSTEMSET item:bpa_systemsets) diff --git a/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java b/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java index 6d6bdd8a..84b7482f 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java +++ b/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java @@ -27,6 +27,7 @@ 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_LOG_RECORD; import com.bonait.bnframework.common.db.mode.BPA_ORDER_DETAIL; +import com.bonait.bnframework.common.db.mode.BPA_ORDER_LIST; import com.bonait.bnframework.common.db.mode.BPA_ORDER_RECORD; import com.bonait.bnframework.common.db.mode.BPA_SUBORDER_RECORD; import com.bonait.bnframework.common.db.util.OrderDetailUtil; @@ -137,6 +138,7 @@ public class MainHActivity extends BaseActivity { DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ORDER_RECORD.class,null); DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBORDER_RECORD.class,null); DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ALERTLOG.class,null); + DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ORDER_LIST.class,null); PreferenceUtils.setInt("loginNum",0); }else { PreferenceUtils.setInt("loginNum",loginNum+1); diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java index 9a756b81..b61f3f21 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java +++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java @@ -11,17 +11,26 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.bonait.bnframework.HBL.Thread.ThreadManager; +import com.bonait.bnframework.MainApplication; import com.bonait.bnframework.R; import com.bonait.bnframework.common.base.BaseFragment; import com.bonait.bnframework.common.constant.ConfigName; 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_LOG_RECORD; +import com.bonait.bnframework.common.db.mode.BPA_ORDER_LIST; +import com.bonait.bnframework.common.db.mode.BPA_ORDER_RECORD; +import com.bonait.bnframework.common.db.mode.BPA_SUBORDER_RECORD; import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; +import com.bonait.bnframework.common.utils.AlertDialogUtils; import com.bonait.bnframework.common.utils.DisplayManager; import com.bonait.bnframework.common.utils.PreferenceUtils; +import com.bonait.bnframework.databinding.DialogTipBinding; import com.bonait.bnframework.databinding.FragmentSceneSetBinding; import com.bonait.bnframework.newui.http.UpdateDataService; -import com.bonait.bnframework.newui.widget.NewToastUtil; import com.bonait.bnframework.newui.viewmodel.HomeGoodsViewModel; +import com.bonait.bnframework.newui.widget.NewToastUtil; import java.util.ArrayList; import java.util.List; @@ -34,6 +43,7 @@ import java.util.List; public class SceneSetFragment extends BaseFragment { private FragmentSceneSetBinding viewBinding; private List environmentList = new ArrayList<>(); + private List versionList = new ArrayList<>(); @Override protected View onCreateView() { @@ -59,6 +69,14 @@ public class SceneSetFragment extends BaseFragment { viewBinding.spinnerEnvironment.setSelection(i); } } + ArrayAdapter spinnerAdapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, versionList); + spinnerAdapter2.setDropDownViewResource(R.layout.spinner_dropdown_item); + viewBinding.spinnerVersion.setAdapter(spinnerAdapter2); + for(int i=0;i{ @@ -89,6 +107,14 @@ public class SceneSetFragment extends BaseFragment { PreferenceUtils.setBoolean(ConfigName.rootTip,viewBinding.zijianSwitch.isChecked()); NewToastUtil.getInstance().showToast("保存成功"); + ConfigName.getInstance().DeviceAutoKey = viewBinding.editDeviceNumber.getText().toString(); + BPA_SYSTEMSET set_main2 = new BPA_SYSTEMSET(); + set_main2.type = -101; + set_main2.value = ConfigName.getInstance().DeviceAutoKey; + set_main2.deviceID = ConfigName.getInstance().DeviceId; + set_main2.userID = ConfigName.getInstance().user.userID; + QueryDB.AddSystemset(set_main2); + ConfigName.getInstance().Key = viewBinding.editKey.getText().toString(); UpdateDataService.key = ConfigName.getInstance().Key; BPA_SYSTEMSET set_main4 = new BPA_SYSTEMSET(); @@ -97,6 +123,53 @@ public class SceneSetFragment extends BaseFragment { set_main4.deviceID = ConfigName.getInstance().DeviceId; set_main4.userID = ConfigName.getInstance().user.userID; QueryDB.AddSystemset(set_main4); + + ConfigName.getInstance().versionSelectionEnum = viewBinding.spinnerVersion.getSelectedItem().toString(); + BPA_SYSTEMSET set_main1 = new BPA_SYSTEMSET(); + set_main4.type = -100; + set_main4.value = ConfigName.getInstance().versionSelectionEnum; + set_main4.deviceID = ConfigName.getInstance().DeviceId; + set_main4.userID = ConfigName.getInstance().user.userID; + QueryDB.AddSystemset(set_main1); + }); + + viewBinding.btnClearLog.setOnClickListener(v->{ + AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_tip, (layoutView, xCom) -> { + DialogTipBinding binding = DialogTipBinding.bind(layoutView); + DisplayManager.scaleViewGroup(binding.getRoot()); + binding.title.setText("请确认"); + binding.message.setText("是否清除本地日志记录"); + binding.close.setOnClickListener(view1->{ + xCom.dismissX(); + }); + binding.submit.setOnClickListener(view1 -> { + xCom.dismissX(); + DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_LOG_RECORD.class,null); + DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ALERTLOG.class,null); + PreferenceUtils.setInt("loginNum",0); + NewToastUtil.getInstance().showToast("清除成功"); + }); + }); + + }); + viewBinding.btnClearOrder.setOnClickListener(v->{ + AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_tip, (layoutView, xCom) -> { + DialogTipBinding binding = DialogTipBinding.bind(layoutView); + DisplayManager.scaleViewGroup(binding.getRoot()); + binding.title.setText("请确认"); + binding.message.setText("是否清除本地订单记录"); + binding.close.setOnClickListener(view1->{ + xCom.dismissX(); + }); + binding.submit.setOnClickListener(view1 -> { + xCom.dismissX(); + DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ORDER_RECORD.class,null); + DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBORDER_RECORD.class,null); + DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ORDER_LIST.class,null); + PreferenceUtils.setInt("loginNum",0); + NewToastUtil.getInstance().showToast("清除成功"); + }); + }); }); } @@ -105,5 +178,9 @@ public class SceneSetFragment extends BaseFragment { environmentList.add("开发环境"); environmentList.add("测试环境"); environmentList.add("正式环境"); + + versionList.clear(); + versionList.add("一拖二"); + versionList.add("一拖二不带输送线"); } } diff --git a/app/src/main/java/com/bonait/bnframework/newui/http/UpdateAllDataService.java b/app/src/main/java/com/bonait/bnframework/newui/http/UpdateAllDataService.java index 50a55cbf..22498602 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/http/UpdateAllDataService.java +++ b/app/src/main/java/com/bonait/bnframework/newui/http/UpdateAllDataService.java @@ -5,8 +5,6 @@ import android.os.Environment; import com.apkfuns.logutils.LogUtils; import com.bonait.bnframework.HBL.Result.OperateResult; -import com.bonait.bnframework.HBL.Thread.ThreadManager; -import com.bonait.bnframework.MainApplication; import com.bonait.bnframework.Model.upload.GoodsDataInfo; import com.bonait.bnframework.Model.upload.GoodsProcessDetail; import com.bonait.bnframework.Model.upload.MaterialDataInfo; @@ -18,7 +16,6 @@ import com.bonait.bnframework.Model.upload.UpResData; import com.bonait.bnframework.Model.upload.UploadRes; import com.bonait.bnframework.business.RecordManager; import com.bonait.bnframework.common.constant.ConfigName; -import com.bonait.bnframework.common.db.file.DBHelper; import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; import com.bonait.bnframework.common.db.mode.BPA_GOODS; import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; @@ -110,7 +107,7 @@ public class UpdateAllDataService { HttpHeaders headers = new HttpHeaders(); headers.put("key", key); OkGo.post(url) - .tag(context) + .tag(url) .upRequestBody( RequestBody.create(MediaType.parse("application/json; charset=utf-8"),body)) .headers(headers) .execute(new JsonDialogCallback(context) { @@ -204,7 +201,7 @@ public class UpdateAllDataService { HttpHeaders headers = new HttpHeaders(); headers.put("key", key); OkGo.post(url) - .tag(context) + .tag(url) .upRequestBody( RequestBody.create(MediaType.parse("application/json; charset=utf-8"),body)) .headers(headers) .execute(new JsonDialogCallback(context) { @@ -325,7 +322,7 @@ public class UpdateAllDataService { HttpHeaders headers = new HttpHeaders(); headers.put("key", key); OkGo.>post(url) - .tag(context) + .tag(url) .upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"),new Gson().toJson(data))) .headers(headers) .execute(new JsonDialogCallback>(context) { diff --git a/app/src/main/java/com/bonait/bnframework/newui/http/UpdateDataService.java b/app/src/main/java/com/bonait/bnframework/newui/http/UpdateDataService.java index 28314b08..43da9b56 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/http/UpdateDataService.java +++ b/app/src/main/java/com/bonait/bnframework/newui/http/UpdateDataService.java @@ -5,8 +5,6 @@ import android.os.Environment; import com.apkfuns.logutils.LogUtils; import com.bonait.bnframework.HBL.Result.OperateResult; -import com.bonait.bnframework.HBL.Thread.ThreadManager; -import com.bonait.bnframework.MainApplication; import com.bonait.bnframework.Model.upload.GoodsDataInfo; import com.bonait.bnframework.Model.upload.GoodsProcessDetail; import com.bonait.bnframework.Model.upload.MaterialDataInfo; @@ -18,7 +16,6 @@ import com.bonait.bnframework.Model.upload.UpResData; import com.bonait.bnframework.Model.upload.UploadRes; import com.bonait.bnframework.business.RecordManager; import com.bonait.bnframework.common.constant.ConfigName; -import com.bonait.bnframework.common.db.file.DBHelper; import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; import com.bonait.bnframework.common.db.mode.BPA_GOODS; import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; @@ -49,7 +46,6 @@ import com.lzy.okgo.OkGo; import com.lzy.okgo.model.HttpHeaders; import com.lzy.okgo.model.Response; -import org.greenrobot.eventbus.EventBus; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -115,7 +111,7 @@ public class UpdateDataService { headers.put("key", key); LogUtils.d("downLoadProcessModel url="+url+" headers="+headers.toString()+" params="+params.toString()); OkGo.post(url) - .tag(context) + .tag(url) .upRequestBody( RequestBody.create(MediaType.parse("application/json; charset=utf-8"), body)) @@ -355,7 +351,7 @@ public class UpdateDataService { HttpHeaders headers = new HttpHeaders(); headers.put("key", key); OkGo.>post(url) - .tag(context) + .tag(url) .upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"),new Gson().toJson(data))) .headers(headers) .execute(new JsonDialogCallback>(context) { diff --git a/app/src/main/java/com/bonait/bnframework/newui/viewmodel/HomeGoodsViewModel.java b/app/src/main/java/com/bonait/bnframework/newui/viewmodel/HomeGoodsViewModel.java index 79966334..9549c420 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/viewmodel/HomeGoodsViewModel.java +++ b/app/src/main/java/com/bonait/bnframework/newui/viewmodel/HomeGoodsViewModel.java @@ -75,10 +75,11 @@ public class HomeGoodsViewModel extends ViewModel { GetGoodsInfo(); GetMaterialInfo(); GetMaterialType(); - if(!UpdateDataService.isDownProcessModel){ - UpdateDataService.downLoadProcessModel(null,null); - } + })); + if(!UpdateDataService.isDownProcessModel){ + UpdateDataService.downLoadProcessModel(null,null); + } } } diff --git a/app/src/main/res/layout/fragment_scene_set.xml b/app/src/main/res/layout/fragment_scene_set.xml index abfa37b0..2828f612 100644 --- a/app/src/main/res/layout/fragment_scene_set.xml +++ b/app/src/main/res/layout/fragment_scene_set.xml @@ -11,12 +11,12 @@ android:layout_width="match_parent" android:orientation="vertical" android:padding="40dp" - android:layout_marginTop="40dp" + android:layout_marginTop="20dp" android:layout_height="match_parent"> + + + + + + + + + + +