Browse Source

系统下单功能

调味吧台
liup 1 month ago
parent
commit
385da7a6fc
53 changed files with 2466 additions and 433 deletions
  1. +1
    -0
      .gitignore
  2. +2
    -2
      .idea/deploymentTargetSelector.xml
  3. +46
    -26
      app/src/main/java/com/bonait/bnframework/HBL/API/APIHelper.java
  4. +24
    -1
      app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java
  5. +18
    -12
      app/src/main/java/com/bonait/bnframework/MainApplication.java
  6. +4
    -1
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  7. +9
    -7
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  8. +2
    -2
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  9. +7
    -2
      app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java
  10. +13
    -2
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  11. +2
    -0
      app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java
  12. +32
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_ORDER_CLOUD.java
  13. +114
    -0
      app/src/main/java/com/bonait/bnframework/common/db/res/ResOrderCloudList.java
  14. +116
    -0
      app/src/main/java/com/bonait/bnframework/common/db/util/CloudGoodsUtil.java
  15. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/glide/GlideUtil.java
  16. +8
    -0
      app/src/main/java/com/bonait/bnframework/common/helper/MQTT.java
  17. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/helper/SdCart.java
  18. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java
  19. +10
    -0
      app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpServer.java
  20. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/oss/OssHelper.java
  21. +3
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
  22. +65
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/CloudOrderAdapter.java
  23. +69
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/CloudOrderGoodsAdapter.java
  24. +45
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/FragmentTabAdapter.java
  25. +6
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java
  26. +233
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/CloudOrderFragment.java
  27. +166
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/MainTabFragment.java
  28. +235
    -284
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java
  29. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java
  30. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageSourceActivity.java
  31. +39
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java
  32. +456
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/LookOrderGoodsDialog.java
  33. +65
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/WaiteProgressDialog.java
  34. +66
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/util/WaitProcessUtil.java
  35. +3
    -0
      app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java
  36. +18
    -0
      app/src/main/res/drawable/bg_blue_round20_btn.xml
  37. +18
    -0
      app/src/main/res/drawable/bg_red_round20_btn.xml
  38. +17
    -0
      app/src/main/res/drawable/bg_tab.xml
  39. +6
    -0
      app/src/main/res/drawable/color_text_tab.xml
  40. +7
    -0
      app/src/main/res/drawable/item_bg_left_round_blue.xml
  41. +6
    -0
      app/src/main/res/drawable/item_bg_round_white.xml
  42. +3
    -3
      app/src/main/res/layout/activity_log.xml
  43. +32
    -0
      app/src/main/res/layout/activity_systemparameter.xml
  44. +8
    -6
      app/src/main/res/layout/datatab/layout/yjrz_item.xml
  45. +116
    -0
      app/src/main/res/layout/fragment_main_tab.xml
  46. +70
    -71
      app/src/main/res/layout/fragment_make_good.xml
  47. +18
    -0
      app/src/main/res/layout/fragment_make_order.xml
  48. +2
    -2
      app/src/main/res/layout/item/layout/dialog_add_makegood.xml
  49. +58
    -0
      app/src/main/res/layout/item/layout/dialog_look_order_goods.xml
  50. +41
    -0
      app/src/main/res/layout/item/layout/dialog_progress_waite.xml
  51. +126
    -0
      app/src/main/res/layout/item/layout/item_cloud_order.xml
  52. +53
    -0
      app/src/main/res/layout/item/layout/item_order_goods.xml
  53. +2
    -2
      build.gradle

+ 1
- 0
.gitignore View File

@@ -17,3 +17,4 @@
/app/release/output-metadata.json
/app/src/main/res/mipmap-xxxhdpi/yxz.png
app/release/boluo-peiliaobatai-v17-202410311049-unsigned-release.apk
*.apk

+ 2
- 2
.idea/deploymentTargetSelector.xml View File

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-06-17T03:40:11.626864500Z">
<DropdownSelection timestamp="2024-11-12T07:11:38.605676100Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=36578987" />
<DeviceId pluginId="Default" identifier="serial=192.168.1.23:5555;connection=ae08e53f" />
</handle>
</Target>
</DropdownSelection>


+ 46
- 26
app/src/main/java/com/bonait/bnframework/HBL/API/APIHelper.java View File

@@ -558,34 +558,54 @@ public class APIHelper {
}


public static void get(String urlAdd,Map<String,String> params,IRunT<String> callback) {
new Thread(()->{
try {
String ResponseAdd = BuildUrlWithParams(urlAdd,params);//请求地址和参数
URL url = new URL(ResponseAdd);
HttpURLConnection Connection = (HttpURLConnection) url.openConnection();
Connection.setRequestMethod("GET");
Connection.setConnectTimeout(3000);
Connection.setReadTimeout(3000);
int responseCode = Connection.getResponseCode();
if (responseCode == Connection.HTTP_OK) {
InputStream inputStream = Connection.getInputStream();
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
int length = 0;
while ((length = inputStream.read(bytes)) != -1) {
arrayOutputStream.write(bytes, 0, length);
arrayOutputStream.flush();//强制释放缓冲区
}
String s = arrayOutputStream.toString();
if(callback!=null)callback.Run(s);
} else {
MessageLog.ShowError("get 请求失败");
public static <T> OperateResultT<T> get(String urlAdd,Map<String,String> params, TypeReference<APIResultT<T>> defaultValue) {
HttpURLConnection connection = null;
InputStream inputStream = null;
BufferedReader reader = null;
StringBuffer buffer = new StringBuffer();
try {
String ResponseAdd = BuildUrlWithParams(urlAdd,params);//请求地址和参数
URL url = new URL(ResponseAdd);
HttpURLConnection Connection = (HttpURLConnection) url.openConnection();
Connection.setRequestMethod("GET");
Connection.setConnectTimeout(5000);
Connection.setReadTimeout(5000);

// 获取响应结果
int statusCode = Connection.getResponseCode();
if (statusCode == HttpURLConnection.HTTP_OK) {
inputStream = Connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
buffer.append(line);
}
} catch (Exception e) {
MessageLog.ShowError(e);
} else {
return OperateResultT.CreateFailed("服务器返回错误,状态码:" + statusCode);
}
}).start();
} catch (Exception e){
return OperateResultT.CreateFailed("POST 请求异常:"+e.toString());
}finally {
try{
// 关闭连接和流
if (reader != null) reader.close();
if (inputStream != null) inputStream.close();
if (connection != null) connection.disconnect();
}catch(Exception e){
return OperateResultT.CreateFailed("POST 请求异常:"+e.toString());
}
}
try{

APIResultT<T> res = JSON.parseObject(buffer.toString(),defaultValue);
if(res!=null && res.succeeded.toUpperCase().equals("TRUE")){
return OperateResultT.CreateSuccess(res.data);
}else {
return OperateResultT.CreateFailed("内容解析失败");
}
}catch(Exception e){
return OperateResultT.CreateFailed("GET请求返回值解析异常,"+e.toString());
}
}

public static <T> OperateResultT<T> GetT(String path, Map<String,String> params, TypeReference<APIResultT<T>> defaultValue) {


+ 24
- 1
app/src/main/java/com/bonait/bnframework/HttpModel/APIService.java View File

@@ -17,6 +17,8 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPENAME;
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET;
import com.bonait.bnframework.common.utils.PreferenceUtils;

import java.util.ArrayList;
import java.util.List;
@@ -64,7 +66,7 @@ public class APIService {

private static void GetMaterialInfo(){
String url = "https://cfv.black-pa.com/saasbase/api/ExternalPlatform/Material/GetMaterialPageList";
String key ="2c39bc05-25c2-46c4-b5c6-dba349058492";
String key = PreferenceUtils.getString("headerKey","89774479-6c91-47be-9dc4-7e3931c89fb8");
long curTime = System.currentTimeMillis();
LogUtils.d(" GetMaterialInfo1 usetime="+(curTime-lastTime));
lastTime = curTime;
@@ -80,6 +82,27 @@ public class APIService {
lastTime = curTime;
}

public static interface CallBack{
void success();
}

/**
* 获取平台授权码
*/
public static void GetServiceKey(CallBack listener){
String url = "https://cfv.black-pa.com/saasbase/api/check/auth-key/"+ConfigName.getInstance().DeviceAutoKey;

LogUtils.d("GetServiceKey url="+url);
APIHelper.get(url,null,new TypeReference<APIResultT<String>>(){}).OnSource(s->{
LogUtils.d("GetServiceKey s.Content="+s.Content);
PreferenceUtils.setString("headerKey",s.Content.toString()+"");
if(listener!=null){
listener.success();
}
}).OnFailed(e->{
});
}

private static void CleanData(){
long curTime = System.currentTimeMillis();
LogUtils.d(" CleanData1 usetime="+(curTime-lastTime));


+ 18
- 12
app/src/main/java/com/bonait/bnframework/MainApplication.java View File

@@ -7,6 +7,8 @@ import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;

@@ -52,7 +54,7 @@ import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;
import com.qmuiteam.qmui.arch.QMUISwipeBackActivityManager;
import com.tencent.bugly.crashreport.CrashReport;
//import com.tencent.bugly.crashreport.CrashReport;

import org.litepal.LitePal;

@@ -78,6 +80,10 @@ public class MainApplication extends Application {
@SuppressLint("StaticFieldLeak")
private static Context context;

public static Handler handler = new Handler(Looper.getMainLooper()){

};

public static Context getContext() {
return context;
}
@@ -91,7 +97,7 @@ public class MainApplication extends Application {
ConfigName.getInstance().dishesCon = this;
ConfigName.getInstance().app = this;
// if(ConfigName.TEST){
initBugly();
// initBugly();
// }
ThreadManager.get().inti();
}
@@ -107,16 +113,16 @@ public class MainApplication extends Application {
* 腾讯bugly 异常检测上班
*/
public void initBugly() {
Context context = getApplicationContext();
// 获取当前包名
String packageName = context.getPackageName();
// 获取当前进程名
String processName = getProcessName(android.os.Process.myPid());
// 设置是否为上报进程
CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
strategy.setUploadProcess(processName == null || processName.equals(packageName));
// 初始化Bugly
CrashReport.initCrashReport(getApplicationContext(), "0ccad7391a", true);
// Context context = getApplicationContext();
// // 获取当前包名
// String packageName = context.getPackageName();
// // 获取当前进程名
// String processName = getProcessName(android.os.Process.myPid());
// // 设置是否为上报进程
// CrashReport.UserStrategy strategy = new CrashReport.UserStrategy(context);
// strategy.setUploadProcess(processName == null || processName.equals(packageName));
// // 初始化Bugly
// CrashReport.initCrashReport(getApplicationContext(), "0ccad7391a", true);
}

/**


+ 4
- 1
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -232,6 +232,9 @@ public class ExecuteTheRecipe {


public static void Listening() {
if(ConfigName.TEST2){
return;
}

ConfigName.getInstance().PLC_Address.clear();
ArrayList<BPA_PLCADDRESS> address = QueryDB.GetPlcaddressALL();
@@ -273,7 +276,6 @@ public class ExecuteTheRecipe {
@Override
public void Run() throws InterruptedException {
try {

//状态读取
for (String item : ConfigName.getInstance().PLC_Address.keySet()) {
String key = item;
@@ -521,6 +523,7 @@ public class ExecuteTheRecipe {
IsMakeGood=false;
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
GoodMake=null;
IsMakeGood=false;
}
Thread.sleep(500);


+ 9
- 7
app/src/main/java/com/bonait/bnframework/business/MainInit.java View File

@@ -240,16 +240,17 @@ public class MainInit {
public void UserMsg(UserLogEnum type, String msg) {
BPA_LOG log = new BPA_LOG();
log.userID = ConfigName.getInstance().user.userID;
if(msg.contains("登录")){
ToastUtils.info(msg, Toast.LENGTH_SHORT);
}else {
// toastString.append(msg).append("|");
// ToastUtils.info(toastString.subSequence(0,toastString.length()-1).toString(), Toast.LENGTH_LONG);
ToastUtils.info(msg, Toast.LENGTH_SHORT);
}
// if(msg.contains("登录")){
// ToastUtils.info(msg, Toast.LENGTH_SHORT);
// }else {
//// toastString.append(msg).append("|");
//// ToastUtils.info(toastString.subSequence(0,toastString.length()-1).toString(), Toast.LENGTH_LONG);
// ToastUtils.info(msg, Toast.LENGTH_SHORT);
// }
switch (type.toString())
{
case "登录日志":log.type=1;
ToastUtils.info(msg, Toast.LENGTH_SHORT);
break;
case "角色操作日志":log.type=2;
break;
@@ -258,6 +259,7 @@ public class MainInit {
case "上传日志":log.type=4;
break;
case "订单处理日志":log.type=5;
ToastUtils.info(msg, Toast.LENGTH_SHORT);
break;
}
log.text = msg;


+ 2
- 2
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -46,8 +46,8 @@ import java.util.concurrent.ConcurrentHashMap;
* 配置文件
*/
public class ConfigName {
public static final boolean TEST = false;
public static final boolean TEST2 = false;
public static final boolean TEST = true;
public static final boolean TEST2 = true;
//region 单例模式
private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问



+ 7
- 2
app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java View File

@@ -369,8 +369,13 @@ public class DataBus {
loadinggoodAdapter.Speak(R.raw.plwc);
loadinggoodAdapter.refresh();
}
ExecuteTheRecipe.GoodMake = null;
ExecuteTheRecipe.IsMakeGood = false;
if(ExecuteTheRecipe.GoodMake!=null &&ExecuteTheRecipe.GoodMake.subOrder!=null && ExecuteTheRecipe.GoodMake.subOrder.id!=null){
if(ExecuteTheRecipe.GoodMake.subOrder.id.equals(suborderID))
{
ExecuteTheRecipe.GoodMake = null;
ExecuteTheRecipe.IsMakeGood = false;
}
}
}catch(Exception e){
}
}


+ 13
- 2
app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java View File

@@ -24,6 +24,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_ORDER_CLOUD;
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;
@@ -3283,7 +3284,7 @@ public class QueryDB {
* @param data
* @return
*/
private static boolean Add(Class c, Object data) {
public static boolean Add(Class c, Object data) {
lock.lock();
boolean isSucess = false;
SQLiteDatabase db = helper.getWritableDatabase();
@@ -3389,7 +3390,7 @@ public class QueryDB {
* @param data
* @return
*/
private static boolean Update(Class c, Object data) {
public static boolean Update(Class c, Object data) {
lock.lock();
boolean isSucess = false;
SQLiteDatabase db = helper.getWritableDatabase();
@@ -3756,6 +3757,16 @@ public class QueryDB {
((BPA_SILOS_CALIBRATE) data).outputTimeMax = cursor.getFloat((int) cursor.getColumnIndex("outputTimeMax"));
((BPA_SILOS_CALIBRATE) data).num = cursor.getInt((int) cursor.getColumnIndex("num"));
break;
case "BPA_ORDER_CLOUD":
data = new BPA_ORDER_CLOUD();
//私有
((BPA_ORDER_CLOUD) data).numId = cursor.getString((int) cursor.getColumnIndex("numId"));
((BPA_ORDER_CLOUD) data).attributeIds = cursor.getString((int) cursor.getColumnIndex("attributeIds"));
((BPA_ORDER_CLOUD) data).attributeNames = cursor.getString((int) cursor.getColumnIndex("attributeNames"));
((BPA_ORDER_CLOUD) data).goodsId = cursor.getString((int) cursor.getColumnIndex("goodsId"));
((BPA_ORDER_CLOUD) data).goodsName = cursor.getString((int) cursor.getColumnIndex("goodsName"));
((BPA_ORDER_CLOUD) data).status = cursor.getInt((int) cursor.getColumnIndex("status"));
break;
}
((ModeBase) data).id = cursor.getString((int) cursor.getColumnIndex("id"));
((ModeBase) data).createTime = cursor.getString((int) cursor.getColumnIndex("createTime"));


+ 2
- 0
app/src/main/java/com/bonait/bnframework/common/db/file/DBHelper.java View File

@@ -22,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_ORDER_CLOUD;
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;
@@ -133,6 +134,7 @@ public class DBHelper extends SQLiteOpenHelper {
CreateTablesAll(BPA_PLCADDRESS.class,null);//PLC地址模型表

CreateTablesAll(BPA_SILOS_CALIBRATE.class,null);//料仓校准表
CreateTablesAll(BPA_ORDER_CLOUD.class,null);//料仓校准表

ForeignKeys();
}


+ 32
- 0
app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_ORDER_CLOUD.java View File

@@ -0,0 +1,32 @@
package com.bonait.bnframework.common.db.mode;

import java.io.Serializable;

/**
* @author: liup
* @description:
* @date: 2024/11/22 15:17.
*/
public class BPA_ORDER_CLOUD extends ModeBase implements Serializable {
public String numId;
public String attributeIds;
public String attributeNames;
public String goodsId;
public String goodsName;
/**
* 0等待 1完成 2执行中 3异常 4删除
*/
public int status;

@Override
public String toString() {
return "BPA_ORDER_CLOUD{" +
"numId='" + numId + '\'' +
", attributeIds='" + attributeIds + '\'' +
", attributeNames='" + attributeNames + '\'' +
", goodsId='" + goodsId + '\'' +
", goodsName='" + goodsName + '\'' +
", status=" + status +
'}';
}
}

+ 114
- 0
app/src/main/java/com/bonait/bnframework/common/db/res/ResOrderCloudList.java View File

@@ -0,0 +1,114 @@
package com.bonait.bnframework.common.db.res;

import com.bonait.bnframework.common.db.mode.BPA_ORDER_CLOUD;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
* @author: liup
* @description:
* @date: 2024/11/22 15:33.
*/
public class ResOrderCloudList implements Serializable {
private List<BPA_ORDER_CLOUD> orderList;
private String numId;
private String date;
private String names;
private String desc;

public ResOrderCloudList(){
this.date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
}

public ResOrderCloudList(String names,String desc,String numId){
this.date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
this.names = names;
this.desc = desc;
this.numId = numId;
this.orderList = new ArrayList<>();
BPA_ORDER_CLOUD bean = new BPA_ORDER_CLOUD();
bean.goodsName = "xxx";
bean.attributeNames = "xxx/x/x/x";
bean.status = 2;

BPA_ORDER_CLOUD bean2 = new BPA_ORDER_CLOUD();
bean2.goodsName = "xxx2";
bean2.attributeNames = "xxx2x2/x2";

BPA_ORDER_CLOUD bean3 = new BPA_ORDER_CLOUD();
bean3.goodsName = "红汤抄手";
bean3.attributeNames = "不加蒜/微辣/小小碗";
bean3.status = 1;

BPA_ORDER_CLOUD bean4 = new BPA_ORDER_CLOUD();
bean4.goodsName = "红汤抄手";
bean4.attributeNames = "不加蒜/微辣/小小碗";
bean4.status = 3;

this.orderList.add(bean);
this.orderList.add(bean3);
this.orderList.add(bean3);
this.orderList.add(bean3);
this.orderList.add(bean3);
this.orderList.add(bean3);
this.orderList.add(bean2);
this.orderList.add(bean4);
this.orderList.add(bean3);

}

@Override
public String toString() {
return "ResOrderCloudList{" +
"orderList=" + orderList +
", numId='" + numId + '\'' +
", date='" + date + '\'' +
", names='" + names + '\'' +
", desc='" + desc + '\'' +
'}';
}

public List<BPA_ORDER_CLOUD> getOrderList() {
return orderList;
}

public void setOrderList(List<BPA_ORDER_CLOUD> orderList) {
this.orderList = orderList;
}

public String getNumId() {
return numId;
}

public void setNumId(String numId) {
this.numId = numId;
}

public String getDate() {
return date;
}

public void setDate(String date) {
this.date = date;
}

public String getNames() {
return names;
}

public void setNames(String names) {
this.names = names;
}

public String getDesc() {
return desc;
}

public void setDesc(String desc) {
this.desc = desc;
}
}

+ 116
- 0
app/src/main/java/com/bonait/bnframework/common/db/util/CloudGoodsUtil.java View File

@@ -0,0 +1,116 @@
package com.bonait.bnframework.common.db.util;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;

import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_ORDER_CLOUD;
import com.bonait.bnframework.common.helper.Tools;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* @author: liup
* @description:
* @date: 2024/11/23 11:26.
*/
public class CloudGoodsUtil {

/**
* 新增商品配方明细
* add fengyoufu 20230413
*
* @param data
* @return 是否成功
*/
public static boolean add(BPA_ORDER_CLOUD data) {
return QueryDB.Add(BPA_ORDER_CLOUD.class, data);
}

/**
* 获取所有预警日志
*
* @return
*/
public static ArrayList<BPA_ORDER_CLOUD> GetALL() {
String orderby = QueryDB.Desc_Time_Up;//先按排序 创建时间倒序
String where = "isDelete=? and status != 4";
String[] args = new String[]{"0"};
ArrayList<BPA_ORDER_CLOUD> data = new ArrayList<>();
ArrayList<Object> obj = QueryDB.Get(BPA_ORDER_CLOUD.class, where, args, orderby);
for (Object k : obj) {
data.add((BPA_ORDER_CLOUD) k);
}
return data;
}

public static boolean update(BPA_ORDER_CLOUD data) {
return QueryDB.Update(BPA_ORDER_CLOUD.class, data);
}

public static boolean AddList(List<BPA_ORDER_CLOUD> data) {
return AddGoodsList(BPA_ORDER_CLOUD.class, data);
}

/**
* 批量新增
* @param c
* @param list
* @return
*/
public static boolean AddGoodsList(Class c, List<BPA_ORDER_CLOUD> list) {
if(list.isEmpty()){
return false;
}
QueryDB.lock.lock();
boolean isSucess = false;
SQLiteDatabase db = QueryDB.helper.getWritableDatabase();
try {
long insert=-1;
db.beginTransaction();
for(int i = 0; i < list.size(); i++){
ContentValues cv = new ContentValues();

Map<String, Object> map = Tools.getObjValue(list.get(i));
if (map.get("id").toString().isEmpty())
return false;
for (String key : map.keySet()) {
Object value = map.get(key);
if (value instanceof String) {
cv.put(key, (String) value);
} else if (value instanceof Integer) {
cv.put(key, ((Integer) value).intValue());
} else if (value instanceof Double) {
cv.put(key, ((Double) value).doubleValue());
} else if (value instanceof Float) {
cv.put(key, ((Float) value).floatValue());
} else if (value instanceof Long) {
cv.put(key, ((Long) value).longValue());
} else if (value instanceof Boolean) {
cv.put(key, ((Boolean) value).booleanValue());
}
}
insert = db.insertOrThrow(c.getSimpleName(), null, cv);
if (insert == -1) {
throw new Exception("Failed to insert data at index " + i);
}
}

db.setTransactionSuccessful();

isSucess = insert > 0;
} catch (Exception e) {
// db.close();
isSucess = false;
} finally {
db.endTransaction();
db.close();
QueryDB.lock.unlock();
}
return isSucess;
}
}

+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/glide/GlideUtil.java View File

@@ -56,7 +56,7 @@ public class GlideUtil {
return;
}
if(!path.startsWith("http")){
path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblchayingdb/WebImage/" + path;
path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblchayingdb2/WebImage/" + path;
}
GlideApp.with(context)
.load(path)


+ 8
- 0
app/src/main/java/com/bonait/bnframework/common/helper/MQTT.java View File

@@ -6,6 +6,7 @@ import android.net.NetworkInfo;
import android.util.Log;

import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.res.UserLogEnum;
import com.bonait.bnframework.common.helper.I.IMessage;
import com.bonait.bnframework.common.helper.I.IRun;

@@ -79,6 +80,8 @@ public class MQTT {
} catch (MqttException e) {
e.printStackTrace();
}
MessageLog.ShowUserMessage(UserLogEnum.上传日志, "mqtt Connect userName="+userName+";passWord="+passWord+";host="+host);

options = new MqttConnectOptions();//MQTT的连接设置
options.setCleanSession(true);//设置是否清空session,这里如果设置为false表示服务器会保留客户端的连接记录,这里设置为true表示每次连接到服务器都以新的身份连接
options.setUserName(userName);//设置连接的用户名(自己的服务器没有设置用户名)
@@ -86,6 +89,7 @@ public class MQTT {
mqttClient.setCallback(new MqttCallback() {
@Override//连接丢失后,会执行这里
public void connectionLost(Throwable throwable) {
MessageLog.ShowUserMessage(UserLogEnum.上传日志, "mqtt connectionLost 连接丢失");
IsConnect=false;
MessageLog.ShowInfo("mqtt断开连接,尝试重新连接...");
if(Disconnect!=null)
@@ -98,6 +102,7 @@ public class MQTT {
public void messageArrived(final String ssr, MqttMessage mqttMessage) throws Exception {
final String mqtt_zhuti = ssr;//主题
final String mqtt_message = mqttMessage.toString();//消息
MessageLog.ShowUserMessage(UserLogEnum.上传日志, "mqtt messageArrived message="+mqtt_message);
if(callback!=null)
{
callback.MessageRecive(mqtt_zhuti,mqtt_message);
@@ -189,6 +194,7 @@ public class MQTT {
if (mqttClient.isConnected() == false) {
mqttClient.connect(options);//连接服务器,连接不上会阻塞在这
}
MessageLog.ShowUserMessage(UserLogEnum.上传日志, "mqtt连接成功");
MessageLog.ShowInfo("mqtt连接成功!");
IsConnect=true;
if(ConnectOk!=null)
@@ -249,6 +255,7 @@ public class MQTT {
try {
if(mqttClient.isConnected())
{
MessageLog.ShowUserMessage(UserLogEnum.上传日志, "mqtt publish topic="+topic+" message="+message);
//Log.v("IotMqttService:topic="+topic, "Mqtt发送消息:"+message);
//参数分别为:主题、消息的字节数组、服务质量、是否在服务器保留断开连接后的最后一条消息
mqttClient.publish(topic, message.getBytes(), qos.intValue(), retained.booleanValue());
@@ -312,6 +319,7 @@ public class MQTT {
{
try
{
MessageLog.ShowUserMessage(UserLogEnum.上传日志, "mqtt重连中");
Log.i("MQTT", "mqtt重连中!");
ConnMqttBroken(true);
Thread.sleep(3000);


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/helper/SdCart.java View File

@@ -42,7 +42,7 @@ public class SdCart {
ConfigName.getInstance().sdCardPath = sdDir.toString();
}

ConfigName.getInstance().appResRoot = ConfigName.getInstance().sdCardPath + "/hblchayingdb";
ConfigName.getInstance().appResRoot = ConfigName.getInstance().sdCardPath + "/hblchayingdb2";
ConfigName.getInstance().dbPath = ConfigName.getInstance().appResRoot + "/hbl.db";
File rootFile = new File(ConfigName.getInstance().appResRoot);
if (!rootFile.exists()) //创建目录


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java View File

@@ -39,7 +39,7 @@ import java.util.Map;
*/
public class LocalCacheUtils {

private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblchayingdb/WebImage";
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblchayingdb2/WebImage";

//region 私有单例
private static volatile LocalCacheUtils _instance;


+ 10
- 0
app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpServer.java View File

@@ -136,6 +136,9 @@ public class ModbusTcpServer {
* @return
*/
public static boolean ping2(String address, int pingTimes, int timeOut) {
if(ConfigName.TEST2){
return false;
}
Process process = null;
try {
process = Runtime.getRuntime().exec( "ping " + "-c " + pingTimes + " -w " + timeOut+ " "+address);
@@ -176,6 +179,9 @@ public class ModbusTcpServer {
* 连接
*/
public void Connect() throws InterruptedException {
if(ConfigName.TEST2){
return;
}
boolean status = false;
while (!status) {
try {
@@ -202,6 +208,10 @@ public class ModbusTcpServer {
*/
public static void ConnectPLC()
{
if(ConfigName.TEST2){
ConfigName.getInstance().PlcIsConnect = true;
return;
}
String host=ConfigName.getInstance().Address;
int port=ConfigName.getInstance().Post;
param = TcpParam.create(host, port)


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/oss/OssHelper.java View File

@@ -66,7 +66,7 @@ public class OssHelper {
* 上传完成通知
*/
public IRunT OnCharge;
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblchayingdb/WebImage";
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblchayingdb2/WebImage";

/**
* 上传文件


+ 3
- 1
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java View File

@@ -39,6 +39,7 @@ import com.bonait.bnframework.modules.home.fragment.DingDanfragment;
import com.bonait.bnframework.modules.home.fragment.GongnengFragment;
import com.bonait.bnframework.modules.home.fragment.GuanLifragment;
import com.bonait.bnframework.modules.home.fragment.JiaoYanFragment;
import com.bonait.bnframework.modules.home.fragment.MainTabFragment;
import com.bonait.bnframework.modules.home.fragment.MakeGoodFragment;
import com.bonait.bnframework.modules.home.fragment.SheZhifragment;
import com.bonait.bnframework.modules.home.fragment.mode.SerialInter;
@@ -160,7 +161,8 @@ public class BottomNavigationMainActivity extends BaseActivity{
fragmentList = new ArrayList<>();
fragmentList.add(new GongnengFragment());
fragmentList.add(new DingDanfragment());
fragmentList.add(new MakeGoodFragment(viewPager));
fragmentList.add(new MainTabFragment());
// fragmentList.add(new MakeGoodFragment());
fragmentList.add(new SheZhifragment());
fragmentList.add(new MyFragment());
ConfigName.getInstance().fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), fragmentList);


+ 65
- 0
app/src/main/java/com/bonait/bnframework/modules/home/adapter/CloudOrderAdapter.java View File

@@ -0,0 +1,65 @@
package com.bonait.bnframework.modules.home.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bonait.bnframework.common.db.res.ResOrderCloudList;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ItemCloudOrderBinding;

/**
* @author: liup
* @description:
* @date: 2024/11/22 15:04.
*/
public abstract class CloudOrderAdapter extends BaseAdapter<ResOrderCloudList, CloudOrderAdapter.ViewHolder> {


//GetGoodsRecipeNameDesignId
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new CloudOrderAdapter.ViewHolder(ItemCloudOrderBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
ResOrderCloudList data = mData.get(position);
if(holder.binding.num.getWidth()==0){
if(holder.binding.num.getTextSize()>32||holder.binding.num.getTextSize()<28){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
}
if(data!=null){
holder.binding.date.setText(data.getDate());
holder.binding.num.setText(data.getNumId());
holder.binding.goodsNames.setText(data.getNames());
holder.binding.desc.setText(data.getDesc());
}
holder.binding.sort.setText((position+1)+"");

holder.binding.delete.setOnClickListener(v->{
delete(v,position);
});
holder.binding.getRoot().setOnClickListener(v->{
onItemClick(v,position);
});
holder.binding.look.setOnClickListener(v->{
onItemClick(v,position);
});

}

public static class ViewHolder extends RecyclerView.ViewHolder {
private ItemCloudOrderBinding binding;

public ViewHolder(ItemCloudOrderBinding view) {
super(view.getRoot());
binding = view;
}
}
protected abstract void delete(View v, int position);

}

+ 69
- 0
app/src/main/java/com/bonait/bnframework/modules/home/adapter/CloudOrderGoodsAdapter.java View File

@@ -0,0 +1,69 @@
package com.bonait.bnframework.modules.home.adapter;

import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bonait.bnframework.common.db.mode.BPA_ORDER_CLOUD;
import com.bonait.bnframework.common.db.res.ResOrderCloudList;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ItemCloudOrderBinding;
import com.bonait.bnframework.databinding.ItemOrderGoodsBinding;

/**
* @author: liup
* @description:
* @date: 2024/11/22 15:04.
*/
public abstract class CloudOrderGoodsAdapter extends BaseAdapter<BPA_ORDER_CLOUD, CloudOrderGoodsAdapter.ViewHolder> {

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new CloudOrderGoodsAdapter.ViewHolder(ItemOrderGoodsBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.binding.sort.setText((position+1)+"");
holder.binding.name.setText(mData.get(position).goodsName+"\n"+mData.get(position).attributeNames);
if(holder.binding.name.getWidth()==0){
if(holder.binding.name.getTextSize()>32||holder.binding.name.getTextSize()<28){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
}
int status = mData.get(position).status;
holder.binding.bg.setVisibility(View.GONE);
if(status == 1){
holder.binding.status.setText("已完成");
holder.binding.status.setTextColor(Color.parseColor("#388E3C"));
}else if(status == 2){
holder.binding.status.setText("执行中");
holder.binding.bg.setVisibility(View.VISIBLE);
holder.binding.status.setTextColor(Color.parseColor("#F57C00"));
}else if(status == 3){
holder.binding.status.setText("异常");
holder.binding.status.setTextColor(Color.parseColor("#F44336"));
}else {
holder.binding.status.setText("等待中");
holder.binding.status.setTextColor(Color.parseColor("#03A9F4"));
}
holder.binding.getRoot().setOnClickListener(v->{
onItemClick(v,position);
});
}

public static class ViewHolder extends RecyclerView.ViewHolder {
private ItemOrderGoodsBinding binding;

public ViewHolder(ItemOrderGoodsBinding view) {
super(view.getRoot());
binding = view;
}
}

}

+ 45
- 0
app/src/main/java/com/bonait/bnframework/modules/home/adapter/FragmentTabAdapter.java View File

@@ -0,0 +1,45 @@
package com.bonait.bnframework.modules.home.adapter;

import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
* @author: liup
* @description:
* @date: 2024/11/22 13:35.
*/
public class FragmentTabAdapter extends FragmentPagerAdapter {
private List<Fragment> fragments = new ArrayList<>();

public FragmentTabAdapter(FragmentManager fm) {
super(fm);

}

@Override
public Fragment getItem(int position) {
return fragments.get(position);
}

@Override
public int getCount() {
return fragments.size();
}

public void addFragment(Fragment fragment) {
fragments.add(fragment);
}

@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
return super.instantiateItem(container, position);
}
}

+ 6
- 2
app/src/main/java/com/bonait/bnframework/modules/home/adapter/loadinggood_adapter.java View File

@@ -84,7 +84,7 @@ public class loadinggood_adapter extends RecyclerView.Adapter<RecyclerView.ViewH
MyViewHolder myViewHolder = (MyViewHolder) holder;
ResGoodsMake goodsMake =datas.get(position);
// 设置要显示的图片和文字
myViewHolder.loading_ProgressBar.setProgress(goodsMake.makeProcess);
// myViewHolder.loading_ProgressBar.setProgress(goodsMake.makeProcess);
myViewHolder.loading_name.setText(goodsMake.good.name);
myViewHolder.loading_status.setText(goodsMake.makeStatus.name());
myViewHolder.loading_zuofa.setText(goodsMake.subOrder.exp);
@@ -97,14 +97,18 @@ public class loadinggood_adapter extends RecyclerView.Adapter<RecyclerView.ViewH
case "等待中":
//myViewHolder.quxiaozhizuo.setVisibility(View.GONE);
//myViewHolder.loading_status.setTextColor(conmain.getResources().getColor(R.color.text4));
myViewHolder.loading_status.setTextColor(myViewHolder.loading_status.getContext().getResources().getColor(R.color.blue));
break;
case "制作中":
myViewHolder.loading_ProgressBar.setProgress(50);
// myViewHolder.quxiaozhizuo.setVisibility(View.VISIBLE);//取消制作
myViewHolder.loading_status.setTextColor(myViewHolder.loading_status.getContext().getResources().getColor(R.color.green_primary_dark));
myViewHolder.loading_status.setTextColor(myViewHolder.loading_status.getContext().getResources().getColor(R.color.orange_primary_dark));
break;
case "制作完成":
// myViewHolder.quxiaozhizuo.setVisibility(View.VISIBLE);//取消制作
//myViewHolder.loading_status.setTextColor(conmain.getResources().getColor(R.color.tab_text_normal));
myViewHolder.loading_ProgressBar.setProgress(0);
myViewHolder.loading_status.setTextColor(myViewHolder.loading_status.getContext().getResources().getColor(R.color.green_primary_dark));
break;
}
myViewHolder.loading_main.setOnClickListener(new View.OnClickListener() {


+ 233
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/CloudOrderFragment.java View File

@@ -0,0 +1,233 @@
package com.bonait.bnframework.modules.home.fragment;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.db.mode.BPA_ORDER_CLOUD;
import com.bonait.bnframework.common.db.res.ResGoodsRecipe;
import com.bonait.bnframework.common.db.res.ResOrderCloudList;
import com.bonait.bnframework.common.db.util.CloudGoodsUtil;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.databinding.FragmentMakeOrderBinding;
import com.bonait.bnframework.modules.home.adapter.CloudOrderAdapter;
import com.bonait.bnframework.modules.home.fragment.mode.LookOrderGoodsDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

/**
*
*/
public class CloudOrderFragment extends BaseFragment {

private String TAG="主页面MakeOrderFragment";
private FragmentMakeOrderBinding binding;
private CloudOrderAdapter orderAdapter;
private List<ResOrderCloudList> dataList = new ArrayList<>();

private Handler handler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
if(msg.what == 1){
if(hasMessages(1)){
removeMessages(1);
}
sendEmptyMessageDelayed(1,1000);

if(orderAdapter!=null){
orderAdapter.notifyDataSetChanged();
}
}
}
};

public CloudOrderFragment() {

}

@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if(isVisibleToUser){
handler.sendEmptyMessage(1);
if(orderAdapter!=null){
initData();
orderAdapter.notifyDataSetChanged();
}
}else {
if(handler!=null){
handler.removeCallbacksAndMessages(null);
}
}
}

@Override
public void onDestroy() {
super.onDestroy();
if(handler!=null){
handler.removeCallbacksAndMessages(null);
handler = null;
}
if(dataList!=null){
dataList.clear();
dataList = null;
}
}

@Override
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_make_order, null);
binding = FragmentMakeOrderBinding.bind(root);
DisplayManager.scaleViewGroup(binding.getRoot());
return root;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initData();
initView();
}

private void initView(){
orderAdapter = new CloudOrderAdapter(){
@Override
protected void onItemClick(View v, int position) {
if(getData().get(position).getOrderList()!=null&&!getData().get(position).getOrderList().isEmpty()){
LookOrderGoodsDialog dialog = new LookOrderGoodsDialog();
Bundle bundle = new Bundle();
bundle.putSerializable("orderBean",getData().get(position));
dialog.setArguments(bundle);
dialog.setCallBack(new LookOrderGoodsDialog.CallBack() {
@Override
public void onClose(ResOrderCloudList orderBean) {
boolean hasGoods = false;
for(BPA_ORDER_CLOUD bean : orderBean.getOrderList()){
if(bean.status==0){
hasGoods = true;
}
}
if(hasGoods){
getData().set(position,orderBean);
}else {
getData().remove(position);
}
notifyDataSetChanged();
}
});
dialog.show(getChildFragmentManager(),"LookOrderGoodsDialog");
}else {
ToastUtils.warning("没有商品信息!");
}
}

@Override
protected void delete(View v, int position) {
String title = "温馨提示!";
String message = "确定要删除【"+getData().get(position).getNumId()+"】订单吗?";
String numId = dataList.get(position).getNumId();
AlertDialogUtils.showDialog(getContext(), title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
for(BPA_ORDER_CLOUD bean : mData.get(position).getOrderList()){
bean.status = 4;
CloudGoodsUtil.update(bean);
}
dataList.remove(position);
orderAdapter.notifyDataSetChanged();
dialog.dismiss();
}
});
}
};
orderAdapter.setNewData(dataList);
binding.recyclerView.setAdapter(orderAdapter);
}

private void initData(){
dataList.clear();
// test();
List<BPA_ORDER_CLOUD> list = CloudGoodsUtil.GetALL();
HashMap<String,List<BPA_ORDER_CLOUD>> hashMap = new LinkedHashMap<>();
for(BPA_ORDER_CLOUD bean : list){
if(!hashMap.containsKey(bean.numId)){
List<BPA_ORDER_CLOUD> goodsList = new ArrayList<>();
goodsList.add(bean);
hashMap.put(bean.numId,goodsList);
}else {
hashMap.get(bean.numId).add(bean);
}
}
for (LinkedHashMap.Entry<String, List<BPA_ORDER_CLOUD>> entry : hashMap.entrySet()) {
ResOrderCloudList resOrderCloudList = new ResOrderCloudList();
resOrderCloudList.setNumId(entry.getKey());
List<BPA_ORDER_CLOUD> goodList = new ArrayList<>(entry.getValue());
resOrderCloudList.setOrderList(goodList);

HashMap<String,Integer> nameMap = new LinkedHashMap<>();
int finisNum = 0;
for(BPA_ORDER_CLOUD bean: entry.getValue()){
if(nameMap.containsKey(bean.goodsName)){
int num = nameMap.get(bean.goodsName);
num++;
nameMap.put(bean.goodsName,num);
}else {
nameMap.put(bean.goodsName,1);
}
resOrderCloudList.setDate(bean.createTime);
if(bean.status == 1){
finisNum++;
}
}
resOrderCloudList.setDesc(finisNum+"/"+entry.getValue().size());
List<String> namesList = new ArrayList<>();
for (LinkedHashMap.Entry<String, Integer> map : nameMap.entrySet()) {
if(map.getValue() == 1){
namesList.add(map.getKey());
}else {
namesList.add(map.getKey()+"*"+map.getValue());
}
}
resOrderCloudList.setNames(namesList.toString().replace("[","").replace("]",""));
dataList.add(resOrderCloudList);
}
}

private void test(){
List<BPA_ORDER_CLOUD> list = new ArrayList<>();
for(int i = 0;i<1;i++){
for(int j=1;j<3;j++){
BPA_ORDER_CLOUD bean1 = new BPA_ORDER_CLOUD();
bean1.numId = 60+i+"";
bean1.goodsName = "饵丝"+j;
bean1.status = 0;
bean1.attributeNames = "不要花椒/默认辣度/大碗";
bean1.attributeIds = "6ebfda98-045f-4471-996d-f244b6f47f04";
bean1.goodsId = "75d5a7e1-40a6-4d95-bf34-49a97c4d217d,9eb92fd1-6f53-4c77-98f1-a4b2876db48f,dbd98dad-b0a8-4448-83e5-9eb8a0e16391";
list.add(bean1);
}
}
CloudGoodsUtil.AddList(list);
}

@Override
protected boolean canDragBack() {
return false;
}
}

+ 166
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/MainTabFragment.java View File

@@ -0,0 +1,166 @@
package com.bonait.bnframework.modules.home.fragment;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.databinding.FragmentMainTabBinding;
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter;

import java.util.ArrayList;
import java.util.List;


/**
* @author: liup
* @description:
* @date: 2024/11/22 13:14.
*/
public class MainTabFragment extends BaseFragment {

private FragmentMainTabBinding binding;
private boolean isResume;

@SuppressLint("HandlerLeak")
private Handler handler = new Handler() {
public void handleMessage(Message msg) {
if(isResume){
switch (msg.what) {
case 0:
binding.plcStatus.setText(ConfigName.getInstance().PlcIsConnect ? "正常" : "异常");
binding.plcStatus.setTextColor(ConfigName.getInstance().PlcIsConnect ? Color.parseColor("#4CAF50") : Color.parseColor("#D32F2F"));
binding.dianzichen.setText(String.valueOf((int) ExecuteTheRecipe.OutletWeigh / 10.0) + " g");
if(hasMessages(0)){
removeMessages(0);
}
sendEmptyMessageDelayed(0,500);
break;
}
}
}
};

@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if(isVisibleToUser){
handler.sendEmptyMessage(1);
}else {
if(handler!=null){
handler.removeCallbacksAndMessages(null);
}
}
}

@Override
public void onResume() {
super.onResume();
isResume = true;
}

@Override
public void onPause() {
super.onPause();
isResume = false;
}

@Override
public void onDestroy() {
super.onDestroy();
if(handler!=null){
handler.removeCallbacksAndMessages(null);
handler = null;
}
}

@Override
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_main_tab, null);
binding = FragmentMainTabBinding.bind(root);
DisplayManager.scaleViewGroup(binding.getRoot());
return root;
}

@Override
protected void onViewCreated(@NonNull View rootView) {
super.onViewCreated(rootView);
initView();
}

private void initView(){
binding.chengClear.setOnClickListener(v->{
ExecuteTheRecipe.WritePLC("重量清零", true, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("清零成功!");
handler.sendEmptyMessage(0);
}

@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("清零失败!");
}
});
});
binding.title1.setSelected(true);
binding.title2.setSelected(false);
binding.title1.setOnClickListener(v->{
binding.viewpager.setCurrentItem(0);
binding.title1.setSelected(true);
binding.title2.setSelected(false);
});
binding.title2.setOnClickListener(v->{
binding.viewpager.setCurrentItem(1);
binding.title2.setSelected(true);
binding.title1.setSelected(false);
});

List<Fragment> fragmentList = new ArrayList<>();
fragmentList.add(new MakeGoodFragment());
fragmentList.add(new CloudOrderFragment());
FragmentAdapter fragmentAdapter = new FragmentAdapter(getChildFragmentManager(),fragmentList);

binding.viewpager.setOffscreenPageLimit(2);
binding.viewpager.setAdapter(fragmentAdapter);
binding.viewpager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int i, float v, int i1) {

}

@Override
public void onPageSelected(int i) {
if(i==0){
binding.title1.setSelected(true);
binding.title2.setSelected(false);
}else {
binding.title2.setSelected(true);
binding.title1.setSelected(false);
}
}

@Override
public void onPageScrollStateChanged(int i) {

}
});
}

@Override
protected boolean canDragBack() {
return false;
}
}


+ 235
- 284
app/src/main/java/com/bonait/bnframework/modules/home/fragment/MakeGoodFragment.java View File

@@ -81,6 +81,7 @@ import com.bonait.bnframework.common.message.MessageLooper;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.model.event.SynchronousCloudDataEvent;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.loadinggood_adapter;
import com.bonait.bnframework.modules.home.fragment.mode.add_makegood_control;
@@ -117,11 +118,6 @@ public class MakeGoodFragment extends BaseFragment {

private String TAG="主页面MakeGoodFragment";


private QMUIViewPager viewPager;
// @BindView(R.id.topbar)
// QMUITopBarLayout mTopBar;//顶部标题

/**
* 左边分类
*/
@@ -154,37 +150,30 @@ public class MakeGoodFragment extends BaseFragment {
@BindView(R.id.add_manguan)
add_manguan_control add_manguan;

/**
* 当前温度
*/
@BindView(R.id.wendu1)
TextView wendu1;
// @BindView(R.id.pf_ms)
// TextView pf_ms;
@BindView(R.id.plc_status)
TextView plc_status;
@BindView(R.id.dianzichen)
TextView dianzichen;
@BindView(R.id.loadgoodliebiao)
RelativeLayout loadgoodliebiao;
private loadinggood_adapter loadinggoodAdapter;
// private loadinggood_adapter loadinggoodAdapter;


private Handler handler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
if(msg.what == 1){
if(msg.what == 0){
DataBus.getInstance().loadinggoodAdapter = new loadinggood_adapter(context, myClickListener);
datatab_paiduishangping.setAdapter(DataBus.getInstance().loadinggoodAdapter);
}else if(msg.what == 1){
ToastUtils.warning(message);
}else if(msg.what == 2){
ToastUtils.info(message);
}
}
};

private Context context;

public MakeGoodFragment(QMUIViewPager viewPager) {
this.viewPager = viewPager;
public MakeGoodFragment() {
}

@Override
@@ -246,69 +235,60 @@ public class MakeGoodFragment extends BaseFragment {
*/
public void Initdata() {
if (isAdded()) {
new Thread(new Runnable() {
@Override
public void run() {
try {

getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
//刷新商品属性
DataBus.getInstance().GetMainGoodProperty();
//1.商品类型
goodstypes = QueryDB.GetGoodsTypeALL();

Fdata.clear();

int i = 0;
for (BPA_GOODSTYPE item : goodstypes) {
ArrayList<BPA_GOODS> goodsm = QueryDB.GetGoodsTypeId(item.id);
Fdata.add(new LinkMode(item, Arrays.asList(goodsm.toArray()), i == 0 ? true : false));
i++;
}

LinearLayoutManager manager = (LinearLayoutManager) rv_right.getLayoutManager();
MakeGoodLeftAdapter leftAdapter = new MakeGoodLeftAdapter(R.layout.item_left_makegood, Fdata, getResources(), manager);
MakeGoodRightAdapter rightAdapter = new MakeGoodRightAdapter(R.layout.item_right_lc, Fdata, getResources());
rv_left.setAdapter(leftAdapter);
rv_right.setAdapter(rightAdapter);


//添加分组悬浮效果
List<String> typeListener = new ArrayList<>();
for (LinkMode item : Fdata) {
typeListener.add(((BPA_GOODSTYPE) item.type).name);
}

if (rv_right.getItemDecorationCount() > 0) {
rv_right.removeItemDecorationAt(0);
}
TopItemDecoration top = new TopItemDecoration(context, typeListener);
rv_right.addItemDecoration(top);

//左侧联动
rv_right.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int firstItemPosition = manager.findFirstVisibleItemPosition();
if (firstItemPosition != -1 && dy != 0) {
rv_left.smoothScrollToPosition(firstItemPosition);
leftAdapter.setChoose(firstItemPosition);
}
}
});

LoadingGood();
}
});

} catch (Exception e) {

}
}
}).start();
handler.post(()->{
try {
//刷新商品属性
DataBus.getInstance().GetMainGoodProperty();
//1.商品类型
goodstypes = QueryDB.GetGoodsTypeALL();

Fdata.clear();

int i = 0;
for (BPA_GOODSTYPE item : goodstypes) {
ArrayList<BPA_GOODS> goodsm = QueryDB.GetGoodsTypeId(item.id);
Fdata.add(new LinkMode(item, Arrays.asList(goodsm.toArray()), i == 0 ? true : false));
i++;
}

LinearLayoutManager manager = (LinearLayoutManager) rv_right.getLayoutManager();
MakeGoodLeftAdapter leftAdapter = new MakeGoodLeftAdapter(R.layout.item_left_makegood, Fdata, getResources(), manager);
MakeGoodRightAdapter rightAdapter = new MakeGoodRightAdapter(R.layout.item_right_lc, Fdata, getResources());
rv_left.setAdapter(leftAdapter);
rv_right.setAdapter(rightAdapter);


//添加分组悬浮效果
List<String> typeListener = new ArrayList<>();
for (LinkMode item : Fdata) {
typeListener.add(((BPA_GOODSTYPE) item.type).name);
}

if (rv_right.getItemDecorationCount() > 0) {
rv_right.removeItemDecorationAt(0);
}
TopItemDecoration top = new TopItemDecoration(context, typeListener);
rv_right.addItemDecoration(top);

//左侧联动
rv_right.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int firstItemPosition = manager.findFirstVisibleItemPosition();
if (firstItemPosition != -1 && dy != 0) {
rv_left.smoothScrollToPosition(firstItemPosition);
leftAdapter.setChoose(firstItemPosition);
}
}
});

LoadingGood();

} catch (Exception e) {

}
});
}
}

@@ -319,12 +299,8 @@ public class MakeGoodFragment extends BaseFragment {
// LinearLayoutManager layoutManager = new LinearLayoutManager(context);
// layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
// datatab_paiduishangping.setLayoutManager(layoutManager);


handler.removeMessages(1);
handler.sendEmptyMessageDelayed(1,200);


handler.removeMessages(0);
handler.sendEmptyMessageDelayed(0,200);
}


@@ -367,6 +343,18 @@ public class MakeGoodFragment extends BaseFragment {
}
}

for (int m = 0; m < makegood.recipes.size(); m++) {
ResGoodsRecipe recipe = makegood.recipes.get(m);
LogUtils.d("商品制作线程 recipe = "+recipe);
//获取物料关联的料仓信息
BPA_SILOS silos = null;
List<BPA_SILOS> siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID);
if(siloslist.isEmpty()){
ToastUtils.warning(recipe.materialName+"-物料没有绑定料仓");
return;
}
}

String title = "温馨提示!";
String message = "客官确定要开始制作【" + makegood.good.name + "】吗?";
QMUIDialog dialog = AlertDialogUtils.showDialog111(context, title, message, new QMUIDialogAction.ActionListener() {
@@ -526,26 +514,12 @@ public class MakeGoodFragment extends BaseFragment {

}

@OnClick({R.id.good_gengxin, R.id.cheng_clear, R.id.loadgood})
@OnClick({R.id.good_gengxin, R.id.loadgood})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.good_gengxin://刷新
Initdata();
break;
case R.id.cheng_clear://称重清零
ExecuteTheRecipe.WritePLC("重量清零", true, new IWriteCallBack() {
@Override
public void onSuccess() {
ToastUtils.info("清零成功!");
mHandler.sendEmptyMessage(0);
}

@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("清零失败!");
}
});
break;
case R.id.loadgood://加载数据
if (loadgoodliebiao.getVisibility() == View.VISIBLE) {
loadgoodliebiao.setVisibility(View.GONE);
@@ -559,31 +533,8 @@ public class MakeGoodFragment extends BaseFragment {


String message = "";
@SuppressLint("HandlerLeak")
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
if(isResume){
switch (msg.what) {
case 0:
plc_status.setText(ConfigName.getInstance().PlcIsConnect ? "正常" : "异常");
plc_status.setTextColor(ConfigName.getInstance().PlcIsConnect ? Color.parseColor("#4CAF50") : Color.parseColor("#D32F2F"));
// wendu1.setText(ExecuteTheRecipe.WaterTemp + "°C");
// MessageLog.ShowInfo("重量 ExecuteTheRecipe.OutletWeigh="+ExecuteTheRecipe.OutletWeigh);
dianzichen.setText(String.valueOf((int) ExecuteTheRecipe.OutletWeigh / 10.0) + " g");
break;
case 1:
ToastUtils.warning(message);
break;
case 2:
ToastUtils.info(message);
break;
}
}


}
};

@Override
public void onResume() {
super.onResume();
@@ -636,7 +587,7 @@ public class MakeGoodFragment extends BaseFragment {

if (QueryDB.GetOrderthirdPartyIDIs(orderid)) {
message = "已有订单,重复扫码!";
mHandler.sendEmptyMessage(1);
handler.sendEmptyMessage(1);
return;
}
int num = 1;
@@ -665,7 +616,7 @@ public class MakeGoodFragment extends BaseFragment {
BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid);
if (good == null) {
message = "没有查询到该商品!";
mHandler.sendEmptyMessage(1);
handler.sendEmptyMessage(1);
} else {
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id);
if (goodsrecipename != null) {
@@ -690,20 +641,20 @@ public class MakeGoodFragment extends BaseFragment {
DataBus.getInstance().AddGoodsMake(suborder);
}
message = "加入订单队列成功!";
mHandler.sendEmptyMessage(2);
handler.sendEmptyMessage(2);
} else {
message = "没有查询到该商品配方信息!";
mHandler.sendEmptyMessage(1);
handler.sendEmptyMessage(1);
}
}

} else {
message = "没有查询到该商品!";
mHandler.sendEmptyMessage(1);
handler.sendEmptyMessage(1);
}
} else {
message = "服务器异常,请稍后重试!";
mHandler.sendEmptyMessage(1);
handler.sendEmptyMessage(1);
}
}
});
@@ -713,157 +664,157 @@ public class MakeGoodFragment extends BaseFragment {
*/
public void Run() {

new Thread(new Runnable() {
@Override
public void run() {
while (true && !destroy) {
if(mHandler!=null){
try {
mHandler.sendEmptyMessage(0);
if(time>=5*300) //300秒执行一次
{
ArrayList<lcMode> lcModes = DataBus.getInstance().ResGetLc();
String title="";
for (lcMode item:lcModes)
{
//lcMode.warningValue >= lcMode.silosmargin
//总量大于0 绑定了物料 告警值设置了 告警大于余量 告警
if(item.siloszl>0 && !item.materialId.isEmpty() && item.warningValue>0 && item.warningValue >= item.silosmargin)
{
title+="通道"+item.num+"-"+item.materialName+"|";
}
}

if(!title.isEmpty())
{
String finalTitle = title;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
//0.6 --- 0.9
CookieHelper.Show(activity, finalTitle +"-余量提示","料仓余量不足,请及时补料!若程序预警错误,请及时手动补充原料后,在料仓界面点击《补充原料》");
}
});
}

time=0;
}
Thread.sleep(200);
time++;
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}
}
}
}).start();

//接收扫码信息
ExecuteTheRecipe.OnScanTheCodeInformationT = new IRunT<String>() {
@Override
public void Run(String msg2) {
if(activity!=null){
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
String msg = msg2;

// if(ConfigName.TEST){
// msg = " |03cb1364-8b85-446a-b00b-d3657de1a19f| | ";
// new Thread(new Runnable() {
// @Override
// public void run() {
// while (true && !destroy) {
// if(mHandler!=null){
// try {
// mHandler.sendEmptyMessage(0);
// if(time>=5*300) //300秒执行一次
// {
// ArrayList<lcMode> lcModes = DataBus.getInstance().ResGetLc();
// String title="";
// for (lcMode item:lcModes)
// {
// //lcMode.warningValue >= lcMode.silosmargin
// //总量大于0 绑定了物料 告警值设置了 告警大于余量 告警
// if(item.siloszl>0 && !item.materialId.isEmpty() && item.warningValue>0 && item.warningValue >= item.silosmargin)
// {
// title+="通道"+item.num+"-"+item.materialName+"|";
// }
// }
//
// if(!title.isEmpty())
// {
// String finalTitle = title;
// activity.runOnUiThread(new Runnable() {
// @Override
// public void run() {
// //0.6 --- 0.9
// CookieHelper.Show(activity, finalTitle +"-余量提示","料仓余量不足,请及时补料!若程序预警错误,请及时手动补充原料后,在料仓界面点击《补充原料》");
// }
// });
// }
//
// time=0;
// }
// Thread.sleep(200);
// time++;
// } catch (Exception ex) {
// ToastUtils.error("异常信息:" + ex.getMessage());
// }
if ((msg != null) && (((String) msg).length() > 2) && ((String) msg).contains("|")) {
//拿到扫码数据
//例如 ORD001|P0003|A001,M002,T001|2
// OR001|A001|2,22|1

String[] res = ((String) msg).split("[|]");
if (res.length >= 4) {
String orderid = res[0];//ORD001
String goodid = res[1];//P0003 商品id
String ggid = res[2];//A001,M002,T001 配方ids

String ggids = "";//规格id集合
String names = "";

if (QueryDB.GetOrderthirdPartyIDIs(orderid)) {
message = "已有订单,重复扫码!";
mHandler.sendEmptyMessage(1);
return;
}
int num = 1;
try {
num = Integer.parseInt(res[3]);
for (String item : ggid.split("[,]")) {
for (ResGoodProperty k : DataBus.getInstance().bpa_goodproperties) {
if (k.child != null && k.child.size() > 0) {
for (ResGoodProperty chd : k.child) {
if (chd.foreignKeyRe != null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) {
ggids += chd.id + ",";
names += "/" + chd.name;
}
}
}

}
}
// }
// }
// }
// }).start();

if (!ggids.isEmpty()) {
ggids = ggids.substring(0, ggids.length() - 1);
}
} catch (Exception ex) {
}
BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid);
ConfigName.getInstance();
// if(ConfigName.TEST){
// good = QueryDB.GetGoodsId(goodid);
//接收扫码信息
// ExecuteTheRecipe.OnScanTheCodeInformationT = new IRunT<String>() {
// @Override
// public void Run(String msg2) {
// if(activity!=null){
// activity.runOnUiThread(new Runnable() {
// @Override
// public void run() {
// String msg = msg2;
//
//// if(ConfigName.TEST){
//// msg = " |03cb1364-8b85-446a-b00b-d3657de1a19f| | ";
//// }
// if ((msg != null) && (((String) msg).length() > 2) && ((String) msg).contains("|")) {
// //拿到扫码数据
// //例如 ORD001|P0003|A001,M002,T001|2
// // OR001|A001|2,22|1
//
// String[] res = ((String) msg).split("[|]");
// if (res.length >= 4) {
// String orderid = res[0];//ORD001
// String goodid = res[1];//P0003 商品id
// String ggid = res[2];//A001,M002,T001 配方ids
//
// String ggids = "";//规格id集合
// String names = "";
//
// if (QueryDB.GetOrderthirdPartyIDIs(orderid)) {
// message = "已有订单,重复扫码!";
// handler.sendEmptyMessage(1);
// return;
// }
// int num = 1;
// try {
// num = Integer.parseInt(res[3]);
// for (String item : ggid.split("[,]")) {
// for (ResGoodProperty k : DataBus.getInstance().bpa_goodproperties) {
// if (k.child != null && k.child.size() > 0) {
// for (ResGoodProperty chd : k.child) {
// if (chd.foreignKeyRe != null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) {
// ggids += chd.id + ",";
// names += "/" + chd.name;
// }
// }
// }
//
// }
// }
//
// if (!ggids.isEmpty()) {
// ggids = ggids.substring(0, ggids.length() - 1);
// }
// } catch (Exception ex) {
// }
// BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid);
// ConfigName.getInstance();
//// if(ConfigName.TEST){
//// good = QueryDB.GetGoodsId(goodid);
//// }
// if (good == null) {
// message = "没有查询到该商品!";
// handler.sendEmptyMessage(1);
// } else {
// BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id);
// if (goodsrecipename != null) {
// BPA_ORDER order = new BPA_ORDER();
// order.thirdPartyID = orderid;
// order.status = 0;
// order.deviceID = ConfigName.getInstance().DeviceId;
// order.userID = ConfigName.getInstance().user.userID;
// QueryDB.AddOrder(order);
//
// for (int mm = 0; mm < num; mm++) {
// BPA_SUBORDER suborder = new BPA_SUBORDER();
// suborder.deviceID = ConfigName.getInstance().DeviceId;
// suborder.userID = ConfigName.getInstance().user.userID;
// suborder.orderID = order.id;
// suborder.goodsID = good.id;
// suborder.recipeID = goodsrecipename.id;
// suborder.number = 1;
// suborder.status = 0;
// suborder.exp = names;
// QueryDB.AddSubOrder(suborder);
// DataBus.getInstance().AddGoodsMake(suborder);
// }
// message = "加入订单队列成功!";
// handler.sendEmptyMessage(2);
// } else {
// message = "没有查询到该商品配方信息!";
// handler.sendEmptyMessage(1);
// }
// }
//
// } else {
// message = "没有查询到该商品!";
// handler.sendEmptyMessage(1);
// }
if (good == null) {
message = "没有查询到该商品!";
mHandler.sendEmptyMessage(1);
} else {
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id);
if (goodsrecipename != null) {
BPA_ORDER order = new BPA_ORDER();
order.thirdPartyID = orderid;
order.status = 0;
order.deviceID = ConfigName.getInstance().DeviceId;
order.userID = ConfigName.getInstance().user.userID;
QueryDB.AddOrder(order);

for (int mm = 0; mm < num; mm++) {
BPA_SUBORDER suborder = new BPA_SUBORDER();
suborder.deviceID = ConfigName.getInstance().DeviceId;
suborder.userID = ConfigName.getInstance().user.userID;
suborder.orderID = order.id;
suborder.goodsID = good.id;
suborder.recipeID = goodsrecipename.id;
suborder.number = 1;
suborder.status = 0;
suborder.exp = names;
QueryDB.AddSubOrder(suborder);
DataBus.getInstance().AddGoodsMake(suborder);
}
message = "加入订单队列成功!";
mHandler.sendEmptyMessage(2);
} else {
message = "没有查询到该商品配方信息!";
mHandler.sendEmptyMessage(1);
}
}

} else {
message = "没有查询到该商品!";
mHandler.sendEmptyMessage(1);
}
} else {
message = "服务器异常,请稍后重试!";
mHandler.sendEmptyMessage(1);
}
}
});
}
}
};
// } else {
// message = "服务器异常,请稍后重试!";
// handler.sendEmptyMessage(1);
// }
// }
// });
// }
// }
// };


// ThreadManager.Get().StartLong("商品制作线程1111111", true, new IThread() {
@@ -929,9 +880,9 @@ public class MakeGoodFragment extends BaseFragment {
Glide.get(getContext()).clearMemory();
ExecuteTheRecipe.OnScanTheCodeInformationT = null;
MessageManager.getInstance().unRegisterMessageReceiver(getActivity());
if(mHandler!=null){
mHandler.removeCallbacksAndMessages(null);
mHandler = null;
if(handler!=null){
handler.removeCallbacksAndMessages(null);
handler = null;
}
activity = null;
}


+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageChooseActivity.java View File

@@ -43,7 +43,7 @@ public class ImageChooseActivity extends BaseActivity {
QMUITopBarLayout mTopBar;//顶部标题
@BindView(R.id.recycler_view)
RecyclerView recyclerView;//image列表
public static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblchayingdb/WebImage";
public static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblchayingdb2/WebImage";
List<image_sp> data =new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {


+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/ImageSourceActivity.java View File

@@ -128,7 +128,7 @@ public class ImageSourceActivity extends BaseActivity {
}

ArrayList<FileEntity> yx_files = new ArrayList<>();
public static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblchayingdb/WebImage";
public static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblchayingdb2/WebImage";

public void FlushedImage() {
File path = new File(CACHE_PATH);// 获得路径


+ 39
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java View File

@@ -8,6 +8,9 @@ import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
@@ -15,6 +18,8 @@ import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;

import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.HttpModel.APIService;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.base.BaseActivity;
@@ -22,6 +27,7 @@ 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.mode.BPA_SYSTEMSET;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.fragment.GuanLifragment;
import com.bonait.bnframework.modules.home.fragment.SheZhifragment;
@@ -51,6 +57,8 @@ public class SystemParameterActivity extends BaseActivity {
EditText edittext3;
@BindView(R.id.edittext4)
EditText edittext4;
@BindView(R.id.edittext_key)
EditText edittextKey;
@BindView(R.id.environment)
Spinner environment;

@@ -59,10 +67,17 @@ public class SystemParameterActivity extends BaseActivity {




ArrayList<EditText> editTextLists = new ArrayList<>();
Map<String, Integer> material_map = new LinkedHashMap<>();
Map<String, Integer> material_map_vis = new LinkedHashMap<>();

private Handler handler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
}
};
/**
* 系统设置参数
*/
@@ -77,6 +92,7 @@ public class SystemParameterActivity extends BaseActivity {
initFragment();
initData();
initSelect();

}

private void initTopBar() {
@@ -99,6 +115,7 @@ public class SystemParameterActivity extends BaseActivity {
editTextLists.add(edittext2);
editTextLists.add(edittext3);
editTextLists.add(edittext4);
edittextKey.setText(PreferenceUtils.getString("headerKey","89774479-6c91-47be-9dc4-7e3931c89fb8"));

material_map.put("开发环境", 0);
material_map.put("测试环境", 1);
@@ -163,14 +180,35 @@ public class SystemParameterActivity extends BaseActivity {

}

@OnClick({R.id.StartButton})
@OnClick({R.id.StartButton,R.id.getKey})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.getKey:
ThreadManager.get().execute(new Runnable() {
@Override
public void run() {
APIService.GetServiceKey(new APIService.CallBack() {
@Override
public void success() {
if(handler!=null ){
handler.post(new Runnable() {
@Override
public void run() {
edittextKey.setText(PreferenceUtils.getString("headerKey","89774479-6c91-47be-9dc4-7e3931c89fb8"));
}
});
}
}
});
}
});
break;
case R.id.StartButton://保存按钮
ConfigName.getInstance().Address = edittext1.getText().toString();
ConfigName.getInstance().Post = Integer.parseInt(edittext2.getText().toString());
ConfigName.getInstance().ClientAutoKey = edittext3.getText().toString();
ConfigName.getInstance().DeviceAutoKey = edittext4.getText().toString();
PreferenceUtils.setString("headerKey",edittextKey.getText().toString());

ConfigName.getInstance().Environment = environment.getSelectedItem().toString();



+ 456
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/LookOrderGoodsDialog.java View File

@@ -0,0 +1,456 @@
package com.bonait.bnframework.modules.home.fragment.mode;

import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.recyclerview.widget.RecyclerView;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Dialog.WaitDialog;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.HBL.Unity;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
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.mode.BPA_GOODSRECIPENAME;
import com.bonait.bnframework.common.db.mode.BPA_ORDER_CLOUD;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
import com.bonait.bnframework.common.db.res.AlertLogEnum;
import com.bonait.bnframework.common.db.res.ResGoodsMake;
import com.bonait.bnframework.common.db.res.ResGoodsRecipe;
import com.bonait.bnframework.common.db.res.ResOrderCloudList;
import com.bonait.bnframework.common.db.res.UserLogEnum;
import com.bonait.bnframework.common.db.util.CloudGoodsUtil;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.databinding.DialogAddGoodInfoBinding;
import com.bonait.bnframework.databinding.DialogLookOrderGoodsBinding;
import com.bonait.bnframework.modules.home.adapter.CloudOrderGoodsAdapter;
import com.bonait.bnframework.modules.home.util.WaitProcessUtil;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

import butterknife.ButterKnife;

/**
* @author: liup
* @description:
* @date: 2024/11/22 16:59.
*/
public class LookOrderGoodsDialog extends DialogFragment {
private DialogLookOrderGoodsBinding binding;
private ResOrderCloudList orderBean;
private List<BPA_ORDER_CLOUD> goodsList = new ArrayList<>();
private CloudOrderGoodsAdapter adapter;

private Handler handler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
if(adapter!=null){
freshData();
adapter.notifyDataSetChanged();
}
}
};
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NORMAL, R.style.DialogScale);
}

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
binding = DialogLookOrderGoodsBinding.inflate(inflater,container,false);
ButterKnife.bind(this, binding.getRoot());
DisplayManager.scaleViewGroup(binding.getRoot());
return binding.getRoot();
}

@Override
public void onStart() {
super.onStart();
if(getDialog()!=null){
Window window = getDialog().getWindow();
assert window != null;
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
WindowManager.LayoutParams params = window.getAttributes();
params.gravity = Gravity.CENTER;
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
}
setCancelable(false);
assert getArguments() != null;
orderBean = (ResOrderCloudList) getArguments().getSerializable("orderBean");
if(orderBean!=null && !orderBean.getOrderList().isEmpty()){
goodsList.addAll(orderBean.getOrderList());
}
freshData();
initView();
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}

private void freshData(){
List<BPA_ORDER_CLOUD> newData = new ArrayList<>();
for (int i = goodsList.size() - 1; i >= 0; i--) {
if(goodsList.get(i).status == 0){
newData.add(goodsList.remove(i));
}else if(goodsList.get(i).status == 2){
newData.add(0,goodsList.remove(i));
}else if(goodsList.get(i).status == 3){
newData.add(0,goodsList.remove(i));
}
}
goodsList.addAll(0,newData);
}

@Override
public void onDismiss(@NonNull DialogInterface dialog) {
super.onDismiss(dialog);
if(callBack!=null){
orderBean.setOrderList(goodsList);
String desc;
int finishNum = 0;
for (BPA_ORDER_CLOUD bean : goodsList){
if(bean.status == 1){
finishNum++;
}
}
if(finishNum == goodsList.size() ){
for (BPA_ORDER_CLOUD bean : goodsList){
bean.status = 4;
CloudGoodsUtil.update(bean);
}
}
desc = finishNum+"/"+goodsList.size();
orderBean.setDesc(desc);
callBack.onClose(orderBean);
}
}

private void initView(){
binding.title.setText("订单编号【"+orderBean.getNumId()+"】");
binding.close.setOnClickListener(v->{
dismiss();
});
binding.recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.bottom = 20;
// outRect.right = 20;
}
});

adapter = new CloudOrderGoodsAdapter() {
@Override
protected void onItemClick(View v, int position) {
if(!DataBus.getInstance().doubleClick()){
BPA_ORDER_CLOUD goods = mData.get(position);
if(goods.status != 0){
String title = "温馨提示!";
String message = "确定重新制作【"+getData().get(position).goodsName+"】?";
AlertDialogUtils.showDialog( getContext(), title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
checkGoods(goods);
dialog.dismiss();
}
});
}else {
checkGoods(goods);
}

}
}
};
adapter.setNewData(goodsList);
binding.recyclerView.setAdapter(adapter);
}


private void checkGoods(BPA_ORDER_CLOUD goods){
ArrayList<ResGoodsRecipe> recipes= new ArrayList<>();
if (!ConfigName.TEST){
if (!ConfigName.getInstance().PlcIsConnect && !ConfigName.TEST2) {
ToastUtils.warning("设备已离线,请检查设备...");
return;
}

if (DataBus.getInstance().ZDQX_IsStart) {
ToastUtils.warning("自动清洗中,请等待清洗完成!");
return;
}

if (ExecuteTheRecipe.IsMakeGood) {
ToastUtils.warning("请耐心等待上一商品制作完成...");
return;
}

BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(goods.attributeIds, goods.goodsId);
if(goodsrecipename == null){
ToastUtils.warning("没有相关配方");
return;
}
recipes= QueryDB.GetGoodsSreciperecipeList(goodsrecipename.id);
if(recipes.isEmpty() ){
ToastUtils.warning("没有配方数据");
return;
}
if(isDisable(recipes)){
return;
}

for (int m = 0; m < recipes.size(); m++) {
ResGoodsRecipe recipe = recipes.get(m);
LogUtils.d("商品制作线程 recipe = "+recipe);
//获取物料关联的料仓信息
BPA_SILOS silos = null;
List<BPA_SILOS> siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID);
if(siloslist.isEmpty()){
ToastUtils.warning(recipe.materialName+"-物料没有绑定料仓");
return;
}
}
}


String title = "温馨提示!";
String message = "客官确定要开始制作【" +goods.goodsName + "】吗?";
QMUIDialog dialog = AlertDialogUtils.showDialog111(getContext(), title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
if(!ConfigName.TEST){
new Thread(new Runnable() {
@Override
public void run() {
//设置清洗模式
ExecuteTheRecipe.WritePLC("清洗模式", false, null);
ExecuteTheRecipe.WritePLC("砝码校准模式", false, null);
ExecuteTheRecipe.WritePLC("手自切换", true, null);
}
}).start();
}
ToastUtils.warning("商品:" + goods.goodsName + ",开始制作", Toast.LENGTH_SHORT);

WaitProcessUtil.getInstance().show(getContext(),"出料中","请耐心等待...");
ThreadManager.get().execute(()->{
makeGoods(recipes,goods.goodsName,goods);
});
LogUtils.d(" 商品开始制作 makegood = "+goods.toString());
dialog.dismiss();
}
});
dialog.show();
}

/**
* 是否禁用
* @return
*/
private boolean isDisable(ArrayList<ResGoodsRecipe> recipes){
LinkedHashMap<Integer, List<ResGoodsRecipe>> rgrs = new LinkedHashMap<>();
for (int i = 0; i < recipes.size(); i++) {
if (!rgrs.containsKey(recipes.get(i).sort))
rgrs.put(recipes.get(i).sort, new ArrayList<>());
rgrs.get(recipes.get(i).sort).add(recipes.get(i));
}
for (LinkedHashMap.Entry<Integer, List<ResGoodsRecipe>> entry : rgrs.entrySet()) {
List<ResGoodsRecipe> goodsRecipes = entry.getValue();
//region 当前一次性下发物料集合
for (int m = 0; m < goodsRecipes.size(); m++) {
ResGoodsRecipe recipe = goodsRecipes.get(m);
//获取物料关联的料仓信息
BPA_SILOS silos = null;
List<BPA_SILOS> siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID);
for (BPA_SILOS item : siloslist) {
if(silos==null)
silos = item;
}
if (silos!=null){
if(silos.status == 1){
ToastUtils.info("料仓【"+silos.name+silos.num+"】被禁用,无法制作!");
LogUtils.d("被禁用,无法制作 = "+recipe);
return true;
}
}
}
}
return false;
}

private void makeGoods(ArrayList<ResGoodsRecipe> recipes,String goodName,BPA_ORDER_CLOUD orderCloud){
try {
if (ConfigName.TEST){
orderCloud.status = 2;
CloudGoodsUtil.update(orderCloud);
handler.sendEmptyMessage(0);
Thread.sleep(2000);
orderCloud.status = 1;
CloudGoodsUtil.update(orderCloud);
handler.sendEmptyMessage(0);
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "[" + goodName + "]-订单执行完成,请取餐!");
return;
}
orderCloud.status = 2;
CloudGoodsUtil.update(orderCloud);

if(ExecuteTheRecipe.IsMakeGood && recipes!=null && !recipes.isEmpty())
{
LogUtils.d("商品制作线程 GoodMake = "+recipes.toString());

//region 根据物料配方排序Sort步骤分组
LinkedHashMap<Integer, List<ResGoodsRecipe>> rgrs = new LinkedHashMap<>();
for (int i = 0; i < recipes.size(); i++) {
if (!rgrs.containsKey(recipes.get(i).sort))
rgrs.put(recipes.get(i).sort, new ArrayList<>());
rgrs.get(recipes.get(i).sort).add(recipes.get(i));
}

boolean isError = false;

for (LinkedHashMap.Entry<Integer, List<ResGoodsRecipe>> entry : rgrs.entrySet()) {
ExecuteTheRecipe.WritePLC("配料完成", false,null);

final Integer key = entry.getKey();

List<ResGoodsRecipe> goodsRecipes = entry.getValue();

//region 当前一次性下发物料集合
String RecipesNames = "";
for (ResGoodsRecipe item : goodsRecipes) {
RecipesNames += item.materialName + ",";
}
//等待配料完成,一直等待
final boolean[] IsComplete = {false};
float outValue;
for (int m = 0; m < goodsRecipes.size(); m++) {
ResGoodsRecipe recipe = goodsRecipes.get(m);
LogUtils.d("商品制作线程 recipe = "+recipe);

final String message = "[" + goodName + "]步骤【" + key + "】下发【" + recipe.materialName + "】";

//获取物料关联的料仓信息
BPA_SILOS silos = null;
List<BPA_SILOS> siloslist = QueryDB.GetSolisByMaterialID(recipe.materialID);
for (BPA_SILOS item : siloslist) {
if(silos==null)
silos = item;
}
//等待配料完成,一直等待
if (silos == null) {
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "下发失败!物料没有绑定料仓!");
Thread.sleep(2000);
IsComplete[0] = true;
isError = true;
} else {
float _val = Float.parseFloat(recipe.value);
BPA_SILOS_CALIBRATE res = QueryDB.GetSilosCalibrateByNum(silos.num);
if(res!=null){
String name = silos.name+silos.num+"出料时间";
outValue = Unity.Scale(_val,res.inputWightMax,res.inputWightMin,res.outputTimeMax,res.outputTimeMin);
// MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "写入地址:"+name+"地址值:"+outValue*100);
LogUtils.d("商品制作线程 name="+name+"; outValue="+outValue);
ExecuteTheRecipe.WritePLC(name, (short) (outValue*100), null);
//減去料仓数量
int otherG=silos.silosmargin-(int)(_val);
QueryDB.UpdateYL(silos.id,otherG>=0?otherG:0);
LogUtils.d("商品制作线程 _val="+_val+" ;otherG = "+otherG+";silos.silosmargin="+silos.silosmargin);
}else{
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "下发失败!物料没有对应的校准值!");
Thread.sleep(2000);
IsComplete[0] = true;
isError = true;
}
}
}
//启动配料
ExecuteTheRecipe.WritePLC("配料启动",true,new IWriteCallBack() {
@Override
public void onSuccess() {
}

@Override
public void onFailure(String ErrorMsg) {
MessageLog.ShowInfo("[" + goodName + "]步骤【" + key + "】启动配料失败!");
MessageLog.ShowAlertMessage(AlertLogEnum.异常订单未制作日志, "[" + goodName + "]步骤【" + key + "】启动配料失败!");
IsComplete[0] = true;
}
});

long a = System.currentTimeMillis();
while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * 30) {
break;
}
Thread.sleep(100);//10 *6
}
}

if(isError){
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "[" + goodName + "]-订单执行失败!");
orderCloud.status = 3;
CloudGoodsUtil.update(orderCloud);
handler.sendEmptyMessage(0);
}else {
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "[" + goodName + "]-订单执行完成,请取餐!");
orderCloud.status = 1;
CloudGoodsUtil.update(orderCloud);
handler.sendEmptyMessage(0);
}
}

} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
orderCloud.status = 3;
CloudGoodsUtil.update(orderCloud);
handler.sendEmptyMessage(0);
}finally {
ExecuteTheRecipe.IsMakeGood=false;
WaitProcessUtil.getInstance().dismiss();
}
}
private CallBack callBack;

public void setCallBack(CallBack callBack) {
this.callBack = callBack;
}

public interface CallBack{
void onClose(ResOrderCloudList orderBean);
}

}

+ 65
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/WaiteProgressDialog.java View File

@@ -0,0 +1,65 @@
package com.bonait.bnframework.modules.home.fragment.mode;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.DialogProgressWaiteBinding;

/**
* @author: liup
* @description:
* @date: 2024/5/31 0:33.
*/
public class WaiteProgressDialog extends ProgressDialog {

private DialogProgressWaiteBinding binding;
private String title = "";
private String message = "";
public WaiteProgressDialog(Context context) {
super(context);
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initView();
}

private void initView(){
setCancelable(false);
setCanceledOnTouchOutside(false);
binding = DialogProgressWaiteBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
DisplayManager.scaleViewGroup(binding.getRoot());
WindowManager.LayoutParams params = getWindow().getAttributes();
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
getWindow().setAttributes(params);
binding.title.setText(title);
binding.message.setText(message);
}

public void setTitleAndMessage(String title,String message){
if(binding!=null){
binding.title.setText(title);
binding.message.setText(message);
}
this.title = title;
this.message = message;
}

@Override
public void show() {
super.show();
}

@Override
public void dismiss() {
super.dismiss();
}
}

+ 66
- 0
app/src/main/java/com/bonait/bnframework/modules/home/util/WaitProcessUtil.java View File

@@ -0,0 +1,66 @@
package com.bonait.bnframework.modules.home.util;

import android.app.ProgressDialog;
import android.content.Context;
import android.util.Log;

import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.modules.home.fragment.mode.WaiteProgressDialog;

/**
* @author: liup
* @description:
* @date: 2024/7/9 9:55.
*/
public class WaitProcessUtil {
private static WaitProcessUtil instance;
private WaiteProgressDialog progressDialog;
public static synchronized WaitProcessUtil getInstance(){
if(instance == null){
synchronized (WaitProcessUtil.class){
if(instance == null){
instance = new WaitProcessUtil();
}
}
}
return instance;
}

public void show(Context context,String title, String message){
MainApplication.handler.post(() -> {
if(progressDialog!=null){
progressDialog.dismiss();
}
progressDialog = new WaiteProgressDialog(context);
progressDialog.setTitleAndMessage(title,message);
progressDialog.setCancelable(false);
progressDialog.show();
});
}


public void dismiss(){
MainApplication.handler.post(()->{
if(progressDialog!=null){
progressDialog.dismiss();
progressDialog = null;
}
});
}

public void dismiss(Context context,String title,String info){
MainApplication.handler.post(()->{
if(progressDialog!=null){
progressDialog.dismiss();
progressDialog = null;
}
AlertDialogUtils.showDialog(context,title,info);
});
}



}

+ 3
- 0
app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java View File

@@ -24,6 +24,7 @@ import android.widget.RelativeLayout;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.MainInit;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.bg.SnowView;
@@ -229,6 +230,8 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL
* 跳转到主界面
* */
private void skipToMainActivity() {
ExecuteTheRecipe.GoodMake = null;
ExecuteTheRecipe.IsMakeGood = false;
// 隐藏软键盘
KeyboardToolUtils.hideSoftInput(LoginActivity.this);
// 退出界面之前把状态栏还原为白色字体与图标


+ 18
- 0
app/src/main/res/drawable/bg_blue_round20_btn.xml View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true">
<shape>
<corners android:radius="20dp"/>
<solid android:color="#FF9800"/>
</shape>

</item>
<item>
<shape>
<corners android:radius="20dp"/>
<solid android:color="#0087FE"/>
</shape>

</item>
</selector>

+ 18
- 0
app/src/main/res/drawable/bg_red_round20_btn.xml View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true">
<shape>
<corners android:radius="20dp"/>
<solid android:color="#FF9800"/>
</shape>

</item>
<item>
<shape>
<corners android:radius="20dp"/>
<solid android:color="@color/red_primary"/>
</shape>

</item>
</selector>

+ 17
- 0
app/src/main/res/drawable/bg_tab.xml View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_selected="true">
<shape>
<solid android:color="#0087FE"/>
<stroke android:width="1dp" android:color="@color/gray"/>
</shape>
</item>

<item >
<shape>
<solid android:color="@color/white"/>
<stroke android:width="1dp" android:color="@color/gray"/>
</shape>
</item>
</selector>

+ 6
- 0
app/src/main/res/drawable/color_text_tab.xml View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_selected="true" android:color="@color/white"/>
<item android:color="@color/gray"/>
</selector>

+ 7
- 0
app/src/main/res/drawable/item_bg_left_round_blue.xml View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<corners android:topLeftRadius="20dp"
android:bottomLeftRadius="20dp"/>
<solid android:color="@color/blue"/>
</shape>

+ 6
- 0
app/src/main/res/drawable/item_bg_round_white.xml View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<corners android:radius="20dp"/>
<solid android:color="@color/white"/>
</shape>

+ 3
- 3
app/src/main/res/layout/activity_log.xml View File

@@ -138,7 +138,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginLeft="10dp"
android:layout_alignParentLeft="true"
android:text="日志类型"
android:textAlignment="center"
@@ -148,11 +148,11 @@
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
android:layout_weight="1.5">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginLeft="10dp"
android:layout_alignParentLeft="true"
android:text="日志时间"
android:textAlignment="center"


+ 32
- 0
app/src/main/res/layout/activity_systemparameter.xml View File

@@ -24,6 +24,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TableLayout
android:id="@+id/tab"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
@@ -148,6 +149,37 @@


</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_below="@id/tab"
android:gravity="center"
android:layout_height="wrap_content">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="授权key:" />
<EditText
android:id="@+id/edittext_key"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint="请输入设备key"
android:inputType="text"
android:maxLines="1"
android:padding="3dp"
android:textSize="12dp" />
<Button
android:layout_centerHorizontal="true"
android:id="@+id/getKey"
android:layout_width="100dp"
android:layout_height="35dp"
android:background="@drawable/bg_btn_login_selected"
android:text="获取授权码"
android:textColor="@color/white"
/>
</LinearLayout>


</RelativeLayout>


+ 8
- 6
app/src/main/res/layout/datatab/layout/yjrz_item.xml View File

@@ -39,7 +39,7 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"
android:layout_marginLeft="10dp"
android:text="日志类型"
android:textAlignment="center"
android:textColor="@color/black"
@@ -48,7 +48,7 @@
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
android:layout_weight="1.5">

<TextView
android:id="@+id/time"
@@ -56,7 +56,7 @@
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:layout_marginLeft="20dp"
android:layout_marginLeft="10dp"
android:text="日志时间"
android:textAlignment="center"
android:textColor="@color/black"
@@ -64,16 +64,18 @@
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_height="wrap_content"
android:layout_weight="4">
<TextView
android:layout_centerInParent="true"
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_alignParentLeft="true"
android:text="日志描述日志描述"
android:text="日志描述日志"
android:textColor="@color/black"
android:textSize="12dp" />
</RelativeLayout>


+ 116
- 0
app/src/main/res/layout/fragment_main_tab.xml View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:background="@color/main_background"
android:layout_height="match_parent">

<TextView
android:id="@+id/title1"
android:layout_width="200dp"
android:layout_height="60dp"
android:background="@drawable/bg_tab"
android:text="手动下单"
android:gravity="center"
android:textSize="30sp"
android:textColor="@drawable/color_text_tab"
/>

<TextView
android:id="@+id/title2"
android:layout_marginStart="200dp"
android:layout_width="200dp"
android:layout_height="60dp"
android:background="@drawable/bg_tab"
android:text="系统下单"
android:gravity="center"
android:textSize="30sp"
android:textColor="@drawable/color_text_tab"
/>

<com.qmuiteam.qmui.widget.QMUIViewPager
android:id="@+id/viewpager"
android:layout_marginTop="60dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="50dp"
/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:paddingBottom="5dp"
android:text="设备:"
android:textSize="26sp" />

<TextView
android:id="@+id/plc_status"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:paddingBottom="5dp"
android:text="正常"
android:textColor="@color/green_primary"
android:textSize="26sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:paddingBottom="5dp"
android:text="水箱:"
android:visibility="gone"
android:textSize="26sp" />

<TextView
android:id="@+id/wendu1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:paddingBottom="5dp"
android:visibility="gone"
android:text="89.9°C"
android:textColor="@color/green_primary"
android:textSize="26sp" />

<TextView
android:id="@+id/cheng_clear"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:paddingBottom="5dp"
android:text="称(单击清零):"
android:textSize="26sp" />

<TextView
android:id="@+id/dianzichen"
android:layout_width="100dp"
android:layout_height="match_parent"
android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp"
android:paddingBottom="5dp"
android:text="11.9g"
android:textColor="@color/green_primary"
android:textSize="26sp" />


</LinearLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 70
- 71
app/src/main/res/layout/fragment_make_good.xml View File

@@ -19,7 +19,6 @@
<LinearLayout
android:layout_width="90dp"
android:layout_height="match_parent"
android:layout_marginBottom="35dp"
android:background="@color/white"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
@@ -49,14 +48,14 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="35dp"
android:layout_weight="1"
android:orientation="vertical">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_marginBottom="0dp"
app:layout_constraintLeft_toRightOf="@+id/rv_left"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
@@ -90,7 +89,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/datatab_paiduishangping"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:background="@color/main_background"/>
</RelativeLayout>
</LinearLayout>
@@ -115,73 +114,73 @@
android:layout_height="match_parent"
android:visibility="gone"
android:clickable="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="设备:"
android:textSize="@dimen/TitleSize" />
<TextView
android:id="@+id/plc_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="正常"
android:textColor="@color/green_primary"
android:textSize="@dimen/TitleSize" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="水箱:"
android:visibility="gone"
android:textSize="@dimen/TitleSize" />
<TextView
android:id="@+id/wendu1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:visibility="gone"
android:text="89.9°C"
android:textColor="@color/green_primary"
android:textSize="@dimen/TitleSize" />
<TextView
android:id="@+id/cheng_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:paddingTop="15dp"
android:text="称(单击清零):"
android:textSize="@dimen/TitleSize" />
<TextView
android:id="@+id/dianzichen"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="11.9g"
android:textColor="@color/green_primary"
android:textSize="@dimen/TitleSize" />
<!-- <TextView-->
<!-- android:id="@+id/pf_ms"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:paddingLeft="10dp"-->
<!-- android:textColor="#730080"-->
<!-- android:text="信息配方:正在制作过程中..."-->
<!-- android:layout_margin="5dp"/>-->
</LinearLayout>
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:layout_marginLeft="10dp">-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_margin="5dp"-->
<!-- android:text="设备:"-->
<!-- android:textSize="@dimen/TitleSize" />-->
<!-- <TextView-->
<!-- android:id="@+id/plc_status"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_margin="5dp"-->
<!-- android:text="正常"-->
<!-- android:textColor="@color/green_primary"-->
<!-- android:textSize="@dimen/TitleSize" />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_margin="5dp"-->
<!-- android:text="水箱:"-->
<!-- android:visibility="gone"-->
<!-- android:textSize="@dimen/TitleSize" />-->
<!-- <TextView-->
<!-- android:id="@+id/wendu1"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_margin="5dp"-->
<!-- android:visibility="gone"-->
<!-- android:text="89.9°C"-->
<!-- android:textColor="@color/green_primary"-->
<!-- android:textSize="@dimen/TitleSize" />-->
<!-- <TextView-->
<!-- android:id="@+id/cheng_clear"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_margin="5dp"-->
<!-- android:paddingTop="15dp"-->
<!-- android:text="称(单击清零):"-->
<!-- android:textSize="@dimen/TitleSize" />-->
<!-- <TextView-->
<!-- android:id="@+id/dianzichen"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_margin="5dp"-->
<!-- android:text="11.9g"-->
<!-- android:textColor="@color/green_primary"-->
<!-- android:textSize="@dimen/TitleSize" />-->
<!-- &lt;!&ndash; <TextView&ndash;&gt;-->
<!-- &lt;!&ndash; android:id="@+id/pf_ms"&ndash;&gt;-->
<!-- &lt;!&ndash; android:layout_width="match_parent"&ndash;&gt;-->
<!-- &lt;!&ndash; android:layout_height="wrap_content"&ndash;&gt;-->
<!-- &lt;!&ndash; android:paddingLeft="10dp"&ndash;&gt;-->
<!-- &lt;!&ndash; android:textColor="#730080"&ndash;&gt;-->
<!-- &lt;!&ndash; android:text="信息配方:正在制作过程中..."&ndash;&gt;-->
<!-- &lt;!&ndash; android:layout_margin="5dp"/>&ndash;&gt;-->
<!-- </LinearLayout>-->
</RelativeLayout>
<!-- <com.qmuiteam.qmui.widget.QMUITopBarLayout-->
<!-- android:id="@+id/topbar"-->


+ 18
- 0
app/src/main/res/layout/fragment_make_order.xml View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/main_background"
android:layout_height="match_parent">

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>


</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 2
- 2
app/src/main/res/layout/item/layout/dialog_add_makegood.xml View File

@@ -9,8 +9,8 @@
<RelativeLayout
android:layout_centerHorizontal="true"
android:layout_width="1000dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="45dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:layout_height="match_parent"
android:background="@drawable/common_bg_with_radius_and_border">



+ 58
- 0
app/src/main/res/layout/item/layout/dialog_look_order_goods.xml View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#66000000"
android:id="@+id/root">

<RelativeLayout
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_centerInParent="true"
android:background="@drawable/common_bg_with_radius_and_border">

<Button
android:id="@+id/close"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:background="@mipmap/close_image"
android:textSize="14dp"
android:textColor="@color/white"/>

<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="80dp"
android:textSize="32sp"
android:textColor="@color/black"
android:textStyle="bold"
android:text="订单编号【056】"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="120dp"
android:paddingBottom="20dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
app:spanCount="2"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
/>

</RelativeLayout>

</RelativeLayout>

+ 41
- 0
app/src/main/res/layout/item/layout/dialog_progress_waite.xml View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="#00000000">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white"
android:layout_gravity="center"
android:orientation="vertical"
>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
tools:text="烹饪中"
android:textColor="@color/black"
android:textSize="38sp"
android:layout_marginTop="40dp"
android:textStyle="bold"
/>
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp"
tools:text="正在停止制作,请耐心稍等..."
android:textColor="@color/black"
android:textSize="32sp"
android:layout_marginTop="30dp"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginBottom="40dp"
/>
</LinearLayout>
</FrameLayout>

+ 126
- 0
app/src/main/res/layout/item/layout/item_cloud_order.xml View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="10dp"
android:background="@drawable/item_bg_round_white"
tools:layout_width="1208dp"
android:layout_height="110dp">

<TextView
android:id="@+id/sort"
android:layout_width="90dp"
android:layout_height="match_parent"
android:background="@drawable/item_bg_left_round_blue"
android:textColor="@color/black"
android:textSize="30sp"
tools:text="1"
android:gravity="center"
/>

<TextView
android:id="@+id/num"
android:layout_width="100dp"
android:layout_height="match_parent"
android:textColor="@color/black"
android:textSize="30sp"
tools:text="0567"
android:gravity="center"
/>

<TextView
android:layout_width="1dp"
android:layout_height="75dp"
android:textSize="30sp"
android:layout_gravity="center_vertical"
android:background="#33000000"
/>

<TextView
android:id="@+id/date"
android:layout_width="180dp"
android:layout_height="match_parent"
android:textColor="@color/black"
android:textSize="30sp"
tools:text="202411-20 15:39:23"
android:gravity="center"
/>

<TextView
android:layout_width="1dp"
android:layout_height="75dp"
android:textSize="30sp"
android:layout_gravity="center_vertical"
android:background="#33000000"
/>

<TextView
android:id="@+id/goods_names"
android:layout_width="350dp"
android:layout_height="match_parent"
android:textColor="@color/black"
android:textSize="30sp"
tools:text="抄手*2,面条,干拌面,牛肉面,火鸡面*3,螺...鸡面*3,螺..."
android:gravity="center"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:maxLines="2"
android:ellipsize="end"
/>
<TextView
android:layout_width="1dp"
android:layout_height="75dp"
android:textSize="30sp"
android:layout_gravity="center_vertical"
android:background="#33000000"
/>

<TextView
android:id="@+id/desc"
android:layout_width="120dp"
android:layout_height="match_parent"
android:textColor="@color/black"
android:textSize="30sp"
tools:text="0/8"
android:gravity="center"
/>

<TextView
android:layout_width="1dp"
android:layout_height="75dp"
android:textSize="30sp"
android:layout_gravity="center_vertical"
android:background="#33000000"
/>

<Button
android:id="@+id/delete"
android:layout_width="120dp"
android:layout_height="70dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:background="@drawable/bg_red_round20_btn"
android:gravity="center"
android:text="删除"
android:textSize="30sp"
android:textColor="@color/white"
/>

<Button
android:id="@+id/look"
android:layout_width="120dp"
android:layout_height="70dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="20dp"
android:background="@drawable/bg_blue_round20_btn"
android:gravity="center"
android:text="查看"
android:textSize="30sp"
android:textColor="@color/white"
/>

</LinearLayout>

+ 53
- 0
app/src/main/res/layout/item/layout/item_order_goods.xml View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:background="#BFD0DF"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/bg"
android:layout_width="200dp"
android:layout_height="130dp"
android:background="@color/blue"
android:visibility="gone"
tools:visibility="visible"
/>

<LinearLayout
android:layout_width="470dp"
android:layout_height="130dp">
<TextView
android:id="@+id/sort"
android:layout_width="50dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="1"
android:textColor="@color/black"
android:textSize="30sp"
/>

<TextView
android:id="@+id/name"
android:layout_width="300dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="米线\n默认口味/微辣/小碗"
android:textSize="30sp"
android:textColor="@color/black"
android:maxLines="3"
android:ellipsize="end"
/>
<TextView
android:id="@+id/status"
android:layout_width="120dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="等待中"
android:textSize="30sp"
/>
</LinearLayout>



</FrameLayout>

+ 2
- 2
build.gradle View File

@@ -35,8 +35,8 @@ task clean(type: Delete) {

ext { // 统一版本入口
//App版本号
versionCode = 17
versionName = "1.7"
versionCode = 157
versionName = "1.57"

// 支持Android版本
buildToolsVersion = "33.0.0"


Loading…
Cancel
Save