Browse Source

修改配方模版

master-new-炒锅
liup 1 month ago
parent
commit
740a5b8300
48 changed files with 1075 additions and 668 deletions
  1. +2
    -2
      .idea/deploymentTargetSelector.xml
  2. +10
    -0
      app/build.gradle
  3. +1
    -1
      app/release/output-metadata.json
  4. +3
    -0
      app/src/main/java/com/bonait/bnframework/MainApplication.java
  5. +13
    -31
      app/src/main/java/com/bonait/bnframework/api/Api.java
  6. +22
    -28
      app/src/main/java/com/bonait/bnframework/api/BaseResponse.java
  7. +130
    -0
      app/src/main/java/com/bonait/bnframework/api/BaseUpResponse.java
  8. +40
    -0
      app/src/main/java/com/bonait/bnframework/api/Constant.java
  9. +1
    -1
      app/src/main/java/com/bonait/bnframework/api/IHttpCallBack.java
  10. +79
    -31
      app/src/main/java/com/bonait/bnframework/api/ServerManager.java
  11. +0
    -51
      app/src/main/java/com/bonait/bnframework/api/interceptor/AccountSNInterceptor.kt
  12. +0
    -21
      app/src/main/java/com/bonait/bnframework/api/interceptor/RequestInterceptor.java
  13. +0
    -73
      app/src/main/java/com/bonait/bnframework/api/interceptor/StbInfoInterceptor.java
  14. +4
    -8
      app/src/main/java/com/bonait/bnframework/api/net/HttpUtil.java
  15. +7
    -7
      app/src/main/java/com/bonait/bnframework/api/net/interceptor/ConnectRetryInterceptor.java
  16. +24
    -0
      app/src/main/java/com/bonait/bnframework/api/net/interceptor/RequestInterceptor.java
  17. +56
    -226
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  18. +15
    -8
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  19. +36
    -49
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  20. +1
    -0
      app/src/main/java/com/bonait/bnframework/common/db/util/GoodsDBUtil.java
  21. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java
  22. +24
    -32
      app/src/main/java/com/bonait/bnframework/common/helper/AuthorizeHelper.java
  23. +2
    -1
      app/src/main/java/com/bonait/bnframework/common/helper/CrashHandler.java
  24. +13
    -13
      app/src/main/java/com/bonait/bnframework/common/helper/HttpServer.java
  25. +5
    -1
      app/src/main/java/com/bonait/bnframework/common/utils/ProcessValueUtil.java
  26. +77
    -0
      app/src/main/java/com/bonait/bnframework/model/ProcessModelIdBean.java
  27. +66
    -0
      app/src/main/java/com/bonait/bnframework/model/ResResult.java
  28. +45
    -0
      app/src/main/java/com/bonait/bnframework/model/UploadTData.java
  29. +4
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java
  30. +4
    -13
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java
  31. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java
  32. +5
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/LogRecordActivity.java
  33. +9
    -1
      app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java
  34. +5
    -5
      app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java
  35. +8
    -4
      app/src/main/java/com/bonait/bnframework/ui/adapter/goods/CloudGoodsAdapter.java
  36. +9
    -7
      app/src/main/java/com/bonait/bnframework/ui/adapter/goods/LocalGoodsAdapter.java
  37. +2
    -2
      app/src/main/java/com/bonait/bnframework/ui/fragment/goods/CloudGoodsFragment.java
  38. +1
    -1
      app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java
  39. +123
    -0
      app/src/main/java/com/bonait/bnframework/ui/util/LogLongUtil.java
  40. +8
    -2
      app/src/main/java/com/bonait/bnframework/ui/viewmodel/HomeGoodsViewModel.java
  41. +104
    -22
      app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateAllDataService.java
  42. +94
    -16
      app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateDataService.java
  43. +3
    -1
      app/src/main/java/com/bonait/bnframework/ui/widget/ProcessValueView.java
  44. +15
    -2
      app/src/main/res/layout/activity_log_record.xml
  45. +1
    -1
      app/src/main/res/layout/item/layout/dialog_with_cancel_confirm.xml
  46. +1
    -2
      app/src/main/res/layout/item/layout/item_cloud_goods.xml
  47. +1
    -2
      app/src/main/res/layout/item/layout/item_local_goods.xml
  48. BIN
     

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

@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-09-29T02:30:16.584496100Z">
<DropdownSelection timestamp="2024-11-13T06:44:01.611004100Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="Default" identifier="serial=192.168.1.6:5555;connection=26244323" />
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=ca7fdfd1" />
</handle>
</Target>
</DropdownSelection>


+ 10
- 0
app/build.gradle View File

@@ -211,4 +211,14 @@ dependencies {

//选择器 时间
implementation 'com.contrarywind:Android-PickerView:3.2.6'


//retrofit2网络请求
api 'com.squareup.retrofit2:converter-gson:2.5.0'
api "com.squareup.retrofit2:retrofit:2.5.0"
api "com.squareup.retrofit2:adapter-rxjava2:2.5.0"
api "com.squareup.retrofit2:converter-scalars:2.5.0"

//调试okhttp请求(建议debug使用)
api 'com.localebro:okhttpprofiler:1.0.8'
}

+ 1
- 1
app/release/output-metadata.json View File

@@ -13,7 +13,7 @@
"attributes": [],
"versionCode": 111,
"versionName": "1.1.1",
"outputFile": "boluo-xiaochao-v111-202411091521-release.apk"
"outputFile": "boluo-xiaochao-v111-202411121114-release.apk"
}
],
"elementType": "File"

+ 3
- 0
app/src/main/java/com/bonait/bnframework/MainApplication.java View File

@@ -13,6 +13,8 @@ import android.util.Log;

import androidx.core.content.ContextCompat;

import com.bonait.bnframework.api.ServerManager;
import com.bonait.bnframework.api.net.HttpUtil;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
@@ -97,5 +99,6 @@ public class MainApplication extends Application {
put(4, "444");
}};
ThreadManager.get().inti();
HttpUtil.init(ServerManager.mainUrl);
}
}

+ 13
- 31
app/src/main/java/com/bonait/bnframework/api/Api.java View File

@@ -1,46 +1,28 @@
package com.bonait.bnframework.api;


import com.bonait.bnframework.common.API.APIResultT;
import com.bonait.bnframework.common.model.GoodsData;


import com.bonait.bnframework.model.ResResult;
import com.bonait.bnframework.model.UploadTData;

import java.util.ArrayList;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Url;

/**
* 接口服务
*/
public interface Api {

// /**
// * 上报日志文件
// *
// * @param url
// * @param account 账号
// * @param device 设备
// * @param faultCode 故障代码
// * @param sceneCode 场景code
// * @param serialNo 序列号
// * @param file 文件
// * @return
// */
// @Multipart
// @POST
// Call<BaseResp<String>> upLoadLogFile(@Url String url,
// @Query("account") String account,
// @Query("device") String device,
// @Query("faultCode") String faultCode,
// @Query("sceneCode") String sceneCode,
// @Query("serialNo") String serialNo,
// @Part MultipartBody.Part file);
/**
* 获取搜索关键字
*
* @param url
* @return
* 上传上传设备日志文件
*/
@GET
Call<APIResultT<GoodsData>> getGoodsData(@Url String url);
@POST
Call<ResResult<ArrayList<UploadTData>>> uploadDeviceLog(@Url String url,
@Body RequestBody body);

}

app/src/main/java/com/bonait/bnframework/api/CommonResponse.java → app/src/main/java/com/bonait/bnframework/api/BaseResponse.java View File

@@ -1,5 +1,9 @@
package com.bonait.bnframework.api;


import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.model.ResResult;

import java.net.SocketTimeoutException;

import retrofit2.Call;
@@ -7,53 +11,42 @@ import retrofit2.Callback;
import retrofit2.Response;

/**
* @author Nov
* @date 19.11.25
*/
public class CommonResponse<T> implements Callback<T> {
/**
* 服务器请求失败
*/
public static final int APP_NET_ERROR = 99999;

/**
* 服务器请求成功,但是数据返回为空
*/
public static final int APP_DATA_NULL = 99998;
public class BaseResponse implements Callback<ResResult> {

/**
* 服务器请求成功,但是数据返回错误
*/
public static final int APP_DATA_ERROR = 99997;
/**
* 回调
*/
private IHttpCallBack callback;


public CommonResponse(IHttpCallBack callback) {
public BaseResponse(IHttpCallBack callback) {
this.callback = callback;
}


@Override
public void onResponse(Call<T> call, Response<T> response) {
T data = response.body();
public void onResponse(Call<ResResult> call, Response<ResResult> response) {
ResResult body = response.body();
if (null == response) {
callError("response=null", APP_DATA_ERROR, "response =null");
callError("response=null", Constant.APP_DATA_ERROR, "response =null");
return;
}
if (null == data) {
callError("data=null", APP_DATA_ERROR, response.message());
if (null == body) {
callError("body=null", Constant.APP_DATA_ERROR, response.message());
return;
}
callSuccess(data);
if (body.getStatusCode() != Constant.CMS_STATUS_OK) {
callError("code!=200", body.getStatusCode(), body.getErrors());
return;
}
callSuccess( body.getData());
}

@Override
public void onFailure(Call<T> call, Throwable t) {
//LogUtils.d("接口出错....."+t.getMessage() + " "+call.request().url());
callFail(APP_NET_ERROR, t);
public void onFailure(Call<ResResult> call, Throwable t) {
LogUtils.d("接口出错....."+t.getMessage() + " "+call.request().url());
callFail(Constant.APP_NET_ERROR, t);

}

@@ -64,13 +57,14 @@ public class CommonResponse<T> implements Callback<T> {
* @param e
*/
private void callFail(final int code, final Throwable e) {

if (null == callback) {
return;
}
if (e instanceof SocketTimeoutException) {
callback.onFailed(code, e, "请求超时");
} else {
callback.onFailed(code, e, "接口请求错误");
callback.onFailed(code, e, "接口请求错误,请检查网络");
}

e.printStackTrace();
@@ -88,7 +82,7 @@ public class CommonResponse<T> implements Callback<T> {
return;
}
//LogUtils.d("请求数据处理错误.....");
callback.onError(code);
callback.onError(code,msg);
reportErrorInfo(code + "", msg);
}


+ 130
- 0
app/src/main/java/com/bonait/bnframework/api/BaseUpResponse.java View File

@@ -0,0 +1,130 @@
package com.bonait.bnframework.api;


import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.model.ResResult;
import com.bonait.bnframework.model.UploadTData;

import java.net.SocketTimeoutException;
import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
*/
public class BaseUpResponse implements Callback<ResResult> {

/**
* 回调
*/
private IHttpCallBack callback;


public BaseUpResponse(IHttpCallBack callback) {
this.callback = callback;
}


@Override
public void onResponse(Call<ResResult> call, Response<ResResult> response) {
ResResult body = response.body();
if (null == response) {
callError("response=null", Constant.APP_DATA_ERROR, "response =null");
return;
}
if (null == body) {
callError("body=null", Constant.APP_DATA_ERROR, response.message());
return;
}
if (body.getStatusCode() != Constant.CMS_STATUS_OK) {
callError("code!=200", body.getStatusCode(), body.getErrors());
return;
}


if(body.getData()!=null){
List<UploadTData> data = (List<UploadTData>) body.getData();
StringBuilder desc = new StringBuilder();
if(data!=null && !data.isEmpty()){
for(UploadTData bean:data){
if(bean.code!=30000){
desc.append("{").append(bean.getCode()).append(bean.getMessage()).append("[").append(bean.getName()).append("]}");
}
}
if(desc.length()>0){
callError("",body.statusCode,desc.toString());
return;
}
}
}
callSuccess( body.getData());
}

@Override
public void onFailure(Call<ResResult> call, Throwable t) {
LogUtils.d("接口出错....."+t.getMessage() + " "+call.request().url());
callFail(Constant.APP_NET_ERROR, t);

}

/**
* 回调失败
*
* @param code
* @param e
*/
private void callFail(final int code, final Throwable e) {

if (null == callback) {
return;
}
if (e instanceof SocketTimeoutException) {
callback.onFailed(code, e, "请求超时");
} else {
callback.onFailed(code, e, "接口请求错误,请检查网络");
}

e.printStackTrace();
reportErrorInfo(code + "", e.getMessage());

}

/**
* 回调错误
*
* @param code
*/
private void callError(String type, final int code, String msg) {
if (null == callback) {
return;
}
//LogUtils.d("请求数据处理错误.....");
callback.onError(code,msg);
reportErrorInfo(code + "", msg);
}

/**
* 回调成功
*
* @param t
*/
private void callSuccess(final Object t) {
if (null == callback) {
return;
}
callback.onSuccess(t);
}

/**
* 上报错误信息
*
* @param code
* @param description
*/
private void reportErrorInfo(String code, String description) {

}

}

+ 40
- 0
app/src/main/java/com/bonait/bnframework/api/Constant.java View File

@@ -0,0 +1,40 @@
package com.bonait.bnframework.api;

/**
* @author Nov
* @date 19.11.25
* 常量类
*/
public class Constant {

/**
* 服务器请求失败
*/
public static final int APP_NET_ERROR = 99999;

/**
* 服务器请求成功,但是数据返回为空
*/
public static final int APP_DATA_NULL = 99998;

/**
* 服务器请求成功,但是数据返回错误
*/
public static final int APP_DATA_ERROR = 99997;

/**
* 服务器请求成功,但是HTTP响应状态码异常
*/
public static final int APP_HTTP_STATUS_CODE_EXCEPTION = 99996;

/*******************桌面平台******************/
public static final int DP_STATUS_OK = 1;

/*******************cms******************/
/**
* 操作成功
*/
public static final int CMS_STATUS_OK = 200;


}

+ 1
- 1
app/src/main/java/com/bonait/bnframework/api/IHttpCallBack.java View File

@@ -17,7 +17,7 @@ public interface IHttpCallBack<T> {
*
* @param failCode 失败原因Code 非法请求:ServerUtil.CODE_FAIL_ILLEGAL;其它失败:ServerUtil.CODE_FAIL; 等
*/
public void onError(int failCode);
public void onError(int failCode,String msg);

/**
* Http请求失败


+ 79
- 31
app/src/main/java/com/bonait/bnframework/api/ServerManager.java View File

@@ -1,12 +1,21 @@
package com.bonait.bnframework.api;

import android.content.Context;

import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.api.net.HttpUtil;
import com.bonait.bnframework.business.RecordManager;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.model.GoodsData;
import com.bonait.bnframework.common.model.upload.UploadRes;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG;
import com.bonait.bnframework.common.db.mode.BPA_LOG_RECORD;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.ui.widget.NewToastUtil;
import com.bonait.bnframework.ui.widget.WaitProcessUtil;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
@@ -15,42 +24,81 @@ import retrofit2.Call;

public class ServerManager {

public static final String mainUrl = "https://cfv.black-pa.com/";

/**
* 热搜
*
* @param callback
* 上传日志文件
*/
public static void getGoodsData(IHttpCallBack<GoodsData> callback) {
String url = "https://cfv.black-pa.com/kitchbase"+"/api/goods/Getdevicegoods?deviceId="+ ConfigName.getInstance().DeviceAutoKey;
Call call = HttpUtil.getService(Api.class).getGoodsData(url);
comEnqueue(call, callback);
public static void uploadDeviceLog(File file,IHttpCallBack<Object> callback) {
String url = mainUrl + "saasbase/api/ExternalPlatform/Device/uploadDeviceLog";
RecordManager.getInstance().addLogRecord("上传日志","上传日志文件"+url+" filename:"+file.getName());
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("formFile", ConfigName.getInstance().versionSelectionEnum+"-"+
ConfigName.getInstance().DeviceAutoKey+"-"+file.getName()+"-"+
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()),
RequestBody.create(MediaType.parse("application/octet-stream"),file))
.build();
Call call = HttpUtil.getService(Api.class).uploadDeviceLog(url,body);
resUpEnqueue(call, callback);
}

public static void uploadDeviceLog(Context context ,File file,boolean showTip){
if(!file.exists()){
NewToastUtil.getInstance().showToastError("日志文件不存在!");
return;
}
if(showTip && context!=null){
WaitProcessUtil.getInstance().show(context,"请稍等","正在上传文件,请耐心等待...");
}
ServerManager.uploadDeviceLog(file,new IHttpCallBack<Object>() {
@Override
public void onSuccess(Object responseData) {
PreferenceUtils.setInt(ConfigName.SHARE_KEY_loginNum,1);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_LOG_RECORD.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ALERTLOG.class,null);
NewToastUtil.getInstance().showToast("上传文件成功");
RecordManager.getInstance().addLogRecord("上传日志","上传文件成功");
if(showTip){
WaitProcessUtil.getInstance().dismiss();
}
}

@Override
public void onError(int failCode,String msg) {
NewToastUtil.getInstance().showToast("上传文件失败 "+msg);
RecordManager.getInstance().addLogRecord("上传日志","上传文件失败 "+failCode+" "+msg);
if(showTip){
WaitProcessUtil.getInstance().dismiss();
}
}

@Override
public void onFailed(int failCode, Throwable throwable, String message) {
NewToastUtil.getInstance().showToast("上传文件失败");
RecordManager.getInstance().addLogRecord("上传日志","上传文件失败 "+failCode+" "+message);
if(showTip){
WaitProcessUtil.getInstance().dismiss();
}
}
});
}


/**
* 获取消息数据
*
* @param device 设备
* @param faultCode 故障代码
* @param sceneCode 场景code
* @param file 文件
* @param callback
* @param call
* @param callBack
*/
public static void upLoadLogFile(String device, String faultCode, String sceneCode, MultipartBody.Part file, IHttpCallBack<UploadRes<String>> callback) {
// String url = "/logfile/upload";
// Call<UploadRes<String>> call = HttpUtil.getService(Api.class).upLoadLogFile(url, itvName, device, faultCode, sceneCode, serialNo, file);
// CommonResponse<UploadRes<String>> response = new CommonResponse<>(callback);
// call.enqueue(response);
private static void resUpEnqueue(Call call, IHttpCallBack callBack) {
BaseUpResponse response = new BaseUpResponse(callBack);
call.enqueue(response);
}

/**
* >>>>>>> .merge_file_a00276
* cms同步请求
*
* @param call
* @param callBack
*/
private static void comEnqueue(Call call, IHttpCallBack callBack) {
CommonResponse hrh = new CommonResponse(callBack);
call.enqueue(hrh);
private static void resEnqueue(Call call, IHttpCallBack callBack) {
BaseResponse response = new BaseResponse(callBack);
call.enqueue(response);
}

}

+ 0
- 51
app/src/main/java/com/bonait/bnframework/api/interceptor/AccountSNInterceptor.kt View File

@@ -1,51 +0,0 @@
//package com.amt.module_common.net.interceptor
//
//import okhttp3.*
//
///**
// * @author Nov
// * @date 23.11.23
// */
//class AccountSNInterceptor : Interceptor {
// override fun intercept(chain: Interceptor.Chain): Response {
// val request = addAccountSN(chain.request())
// return chain.proceed(request)
// }
//
// /**
// * 添加公共字段
// */
// private fun addAccountSN(request: Request): Request {
// val oldRequest: Request = request //旧连接LoginActivity
// var newRequest: Request //添加公共参数后的新连接
// val method = oldRequest.method()
// if (method.equals("GET")) {
// var httpUrl = oldRequest.url()
// httpUrl = httpUrl.newBuilder()
//// .addEncodedQueryParameter("publicParamsSN", LocalDataManager.sn())
// .build()
// newRequest = oldRequest.newBuilder().url(httpUrl).build()
// } else if (method.equals("POST")) {
// val oldBody = oldRequest.body()
// newRequest = oldRequest
// oldBody?.let {
// newRequest = if (it is FormBody) {
// val newBody = FormBody.Builder()
//// newBody.addEncoded("publicParamsAccount", LocalDataManager.userId())
// if (it.contentLength() > 0) {
// val formBody1 = it
// for (i in 0 until formBody1.size()) {
// newBody.addEncoded(formBody1.encodedName(i), formBody1.encodedValue(i))
// }
// }
// oldRequest.newBuilder().post(newBody.build()).build()
// } else {
// oldRequest
// }
// }
// } else {
// newRequest = oldRequest
// }
// return newRequest
// }
//}

+ 0
- 21
app/src/main/java/com/bonait/bnframework/api/interceptor/RequestInterceptor.java View File

@@ -1,21 +0,0 @@
package com.bonait.bnframework.api.interceptor;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
* 请求拦截器,修改请求header
*
* @author: wx
* @date: 2022/12/21
*/
public class RequestInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request().newBuilder().addHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8").build();
return chain.proceed(request);
}
}

+ 0
- 73
app/src/main/java/com/bonait/bnframework/api/interceptor/StbInfoInterceptor.java View File

@@ -1,73 +0,0 @@
package com.bonait.bnframework.api.interceptor;

import android.text.TextUtils;
import android.util.Base64;

import com.google.gson.JsonObject;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
* 系统属性
*
* @author: wx
* @date: 2023/2/23
*/
public class StbInfoInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
JsonObject jb = new JsonObject();
// try {
// if (DataSaveUtil.Companion.getInstance().decodeBoolean(SpConfig.SP_KEY_USER_IS_LOGIN)) {
// jb.addProperty("account", LocalDataManager.INSTANCE.userId());
// }else {
// jb.addProperty("account", "");
// }
// jb.addProperty("areaCode", LocalDataManager.INSTANCE.areaId());
// jb.addProperty("groupCode", LocalDataManager.INSTANCE.userGroup());
// jb.addProperty("liveGroup", LocalDataManager.INSTANCE.liveGroup());
// jb.addProperty("manufacturer", LocalDataManager.INSTANCE.manufacturer());
// jb.addProperty("model", LocalDataManager.INSTANCE.model());
// jb.addProperty("mac", LocalDataManager.INSTANCE.mac());
// jb.addProperty("softVersion", LocalDataManager.INSTANCE.softVersion());
// jb.addProperty("hardVersion", LocalDataManager.INSTANCE.hardware());
// jb.addProperty("apkVersion", AppUtil.INSTANCE.getVersionCode());
// LogUtil.d("stbInfo:" + jb);
// } catch (Exception e) {
// e.printStackTrace();
// }
byte[] datas = jb.toString().getBytes("UTF-8");
String base64String = Base64.encodeToString(datas, Base64.DEFAULT);
String base64String1 = encodeHeadInfo(base64String);
Request request = chain.request().newBuilder()
// .addHeader("stbInfo", base64String1)
.build();
return chain.proceed(request);
}

/**
* 过滤特殊符号
*
* @param headInfo
* @return
*/
private String encodeHeadInfo(String headInfo) {
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0, length = headInfo.length(); i < length; i++) {
char c = headInfo.charAt(i);
if (c <= '\u001f' || c >= '\u007f') {
stringBuffer.append(String.format("", (int) c));
} else {
stringBuffer.append(c);
}
}
return stringBuffer.toString();
}

}

app/src/main/java/com/bonait/bnframework/api/HttpUtil.java → app/src/main/java/com/bonait/bnframework/api/net/HttpUtil.java View File

@@ -1,9 +1,8 @@
package com.bonait.bnframework.api;
package com.bonait.bnframework.api.net;

import com.bonait.bnframework.BuildConfig;
import com.bonait.bnframework.api.interceptor.ConnectRetryInterceptor;
import com.bonait.bnframework.api.interceptor.RequestInterceptor;
import com.bonait.bnframework.api.interceptor.StbInfoInterceptor;
import com.bonait.bnframework.api.net.interceptor.ConnectRetryInterceptor;
import com.bonait.bnframework.api.net.interceptor.RequestInterceptor;
import com.google.gson.GsonBuilder;
import com.localebro.okhttpprofiler.OkHttpProfilerInterceptor;

@@ -42,8 +41,7 @@ public class HttpUtil {
.readTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS);

//过多的打印会导致盒子io异常
builderOk.addInterceptor(new RequestInterceptor());
builderOk.addInterceptor(new RequestInterceptor());
// if (Config.isShowHttpLog) {
builderOk.addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY));
// } else {
@@ -54,8 +52,6 @@ public class HttpUtil {
builderOk.addInterceptor(new OkHttpProfilerInterceptor());
}
builderOk.addInterceptor(new ConnectRetryInterceptor(3));
// builderOk.addInterceptor(new StbInfoInterceptor());
// builderOk.addInterceptor(new AccountSNInterceptor());
OkHttpClient okHttpClient = builderOk.connectionPool(new ConnectionPool()).build();
builder.client(okHttpClient);
mRetrofit = builder.build();

app/src/main/java/com/bonait/bnframework/api/interceptor/ConnectRetryInterceptor.java → app/src/main/java/com/bonait/bnframework/api/net/interceptor/ConnectRetryInterceptor.java View File

@@ -1,7 +1,9 @@
package com.bonait.bnframework.api.interceptor;
package com.bonait.bnframework.api.net.interceptor;


import org.greenrobot.eventbus.EventBus;

import com.bonait.bnframework.ui.widget.NewToastUtil;

import org.jetbrains.annotations.NotNull;

import java.io.IOException;
@@ -15,9 +17,6 @@ import okhttp3.Response;

/**
* 网络请求重试拦截器
*
* @author: wx
* @date: 2022/12/21
*/
public class ConnectRetryInterceptor implements Interceptor {
// 最大重试次数
@@ -61,9 +60,10 @@ public class ConnectRetryInterceptor implements Interceptor {
}
}
//连续3次请求错误
// if(failTimeList.size() >=3){
if(failTimeList.size() >=3){
// EventBus.getDefault().post(new EventBusMessage(EventBusType.FETCH_FAULT_DETECT,0));
// }
// NewToastUtil.getInstance().showToastError("接口连接失败");
}
} else {
failTimeList.add(curTimeMillis);
}

+ 24
- 0
app/src/main/java/com/bonait/bnframework/api/net/interceptor/RequestInterceptor.java View File

@@ -0,0 +1,24 @@
package com.bonait.bnframework.api.net.interceptor;


import com.bonait.bnframework.ui.viewmodel.UpdateDataService;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

/**
* 请求拦截器,修改请求header
*/
public class RequestInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request().newBuilder()
.addHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8")
.addHeader("key", UpdateDataService.key)
.build();
return chain.proceed(request);
}
}

+ 56
- 226
app/src/main/java/com/bonait/bnframework/business/ConfigData.java View File

@@ -422,62 +422,62 @@ public class ConfigData {
}
}

public void GetMainConsoleData(){
String url = "http://" + ConfigName.getInstance().MainAddress+":35000/api/GetMainConsoleData";
OkGo.<String>post(url).tag(this).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
ConfigData.getInstance().GoodsSync(response.body());
}
@Override
public void onError(Response<String> val){
ToastUtils.info("获取主控数据失败!","Failed to obtain the main control data!");
}
});
}
public boolean GoodsSync(String goods){
try{
ReceiveData rd = new Gson().fromJson(goods, ReceiveData.class);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null);
DBListDataUtil.addGOODSList(rd.goods);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_CLASSIFY.class,null);
PropClassifyDBUtil.addList(rd.classifies);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ATTRIBUTE.class,null);
AttributeDBUtil.addList(rd.attributes);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBATTRIBUTE.class,null);
SubAttributeDBUtil.addList(rd.subattributes);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_SUBATTRIBUTE_GROUP.class,null);
SubAttributeGroupDBUtil.addList(rd.groups);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_MATERIAL.class,"id");
DBListDataUtil.addMATERIALList(rd.material);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_PROCESS_DETAIL.class,null);
GoodsProcessDetailDBUtil.addList(rd.goodsrecipes);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESS.class,null);
DBListDataUtil.addPROCESSList(rd.processes);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESSModel.class,null);
DBListDataUtil.addPROCESSModelList(rd.processModels);
ToastUtils.info("接收主控数据成功!","The master control data is received successfully!");
EventBus.getDefault().post(new DownGoodsEvent());
return true;
}catch (Exception ex){
// MessageLog.ShowError("解析数据失败!,"+ex.getMessage());
ToastUtils.info("解析数据失败!,"+ex.getMessage(),"Parsing failure!,"+ex.getMessage());
return false;
}
}
// public void GetMainConsoleData(){
// String url = "http://" + ConfigName.getInstance().MainAddress+":35000/api/GetMainConsoleData";
// OkGo.<String>post(url).tag(this).execute(new StringCallback() {
// @Override
// public void onSuccess(Response<String> response) {
// ConfigData.getInstance().GoodsSync(response.body());
// }
//
// @Override
// public void onError(Response<String> val){
// ToastUtils.info("获取主控数据失败!","Failed to obtain the main control data!");
// }
// });
// }
//
// public boolean GoodsSync(String goods){
// try{
// ReceiveData rd = new Gson().fromJson(goods, ReceiveData.class);
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null);
// DBListDataUtil.addGOODSList(rd.goods);
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_CLASSIFY.class,null);
// PropClassifyDBUtil.addList(rd.classifies);
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ATTRIBUTE.class,null);
// AttributeDBUtil.addList(rd.attributes);
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBATTRIBUTE.class,null);
// SubAttributeDBUtil.addList(rd.subattributes);
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_SUBATTRIBUTE_GROUP.class,null);
// SubAttributeGroupDBUtil.addList(rd.groups);
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_MATERIAL.class,"id");
// DBListDataUtil.addMATERIALList(rd.material);
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_PROCESS_DETAIL.class,null);
// GoodsProcessDetailDBUtil.addList(rd.goodsrecipes);
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESS.class,null);
// DBListDataUtil.addPROCESSList(rd.processes);
//
//
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESSModel.class,null);
// DBListDataUtil.addPROCESSModelList(rd.processModels);
//
// ToastUtils.info("接收主控数据成功!","The master control data is received successfully!");
// EventBus.getDefault().post(new DownGoodsEvent());
// return true;
// }catch (Exception ex){
//// MessageLog.ShowError("解析数据失败!,"+ex.getMessage());
// ToastUtils.info("解析数据失败!,"+ex.getMessage(),"Parsing failure!,"+ex.getMessage());
// return false;
// }
// }

/**
* 获取组织信息
@@ -520,176 +520,6 @@ public class ConfigData {
}*/
}

/**
* 同步云端数据
*/
public void SyncDataInTheCloud(Context context, Handler mHandler) {
if (NetworkUtils.checkNetworkAvailable(context)) {
//region 拉取物料数据
if (ConfigName.getInstance().organizeMode == null) {
return;
}
OkGo.<ResAPI<ResALLData>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetBaseDataModel, ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceAutoKey)).tag(context).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<ResALLData>>(context) {
@Override
public void onSuccess(Response<ResAPI<ResALLData>> response) {
ResAPI<ResALLData> allDataResAPI = response.body();
if (allDataResAPI.succeeded && allDataResAPI.data != null) {
BPA_CLOUDDATA data = new BPA_CLOUDDATA();
ConfigName.getInstance().cloudData = allDataResAPI.data;
ArrayList<BPA_CLOUDDATA> cloudList = new ArrayList<>();
ArrayList<BPA_MATERIAL> materials = new ArrayList<>();

DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_MATERIAL.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_CLOUDDATA.class,null);

//region 物料管理
List<BatchingInfo> bayc = allDataResAPI.data.batchingInfo;
if (allDataResAPI.data.batchingInfo != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "物料集合";
data.text = new Gson().toJson(bayc);
cloudList.add(data);
Integer I = 0;
for (BatchingInfo item : bayc) {
BPA_MATERIAL bpa_material = new BPA_MATERIAL();
bpa_material.id = item.id;
bpa_material.name = item.batching_Name;
bpa_material.imgUrl = "";
bpa_material.createTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(new Date().getTime() + I * 1000));
bpa_material.deviceID = ConfigName.getInstance().DeviceId;
bpa_material.userID = ConfigName.getInstance().user.userID;
materials.add(bpa_material);
I++;
}
}
DBListDataUtil.addMATERIALList(materials);
//endregion

//region 工艺模型
if (allDataResAPI.data.goodsTechnology != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "工艺模型";
data.text = new Gson().toJson(allDataResAPI.data.goodsTechnology);
cloudList.add(data);

DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESS.class,null);
List<BPA_PROCESS> processes = new ArrayList<>();
Integer I = 0;
for (GoodsTechnology item : allDataResAPI.data.goodsTechnology) {
BPA_PROCESS bpa_process = new BPA_PROCESS();
bpa_process.id = item.id;
bpa_process.name = item.name;
bpa_process.createTime = item.createAt;
bpa_process.sort = I;
processes.add(bpa_process);
I++;
}
DBListDataUtil.addPROCESSList(processes);
}

//endregion

//region 工艺模型详细信息
if (allDataResAPI.data.technologyAction != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "工艺模型详细信息";
data.text = new Gson().toJson(allDataResAPI.data.technologyAction);
cloudList.add(data);


DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESSModel.class,null);
List<BPA_PROCESSModel> models = new ArrayList<>();
for (TechnologyAction item : allDataResAPI.data.technologyAction) {
BPA_PROCESSModel bpa_process = new BPA_PROCESSModel();
bpa_process.id = item.id;
bpa_process.processid = item.goodstechnologyId;
bpa_process.name = item.actionName;
bpa_process.createTime = item.createAt;
bpa_process.sort = item.sort;
bpa_process.datatype = (item.actionType.equals("digit") ? 0 : ((item.actionType.equals("text") || item.actionType.equals("textarea") || item.actionType.equals("switch")) ? 1 : 2));
bpa_process.data = "";
if(item.actionType!=null && item.actionValue!=null){
if (item.actionType.equals("select") && !item.actionValue.isEmpty()) {
List<TechnologyValueMode> val = new Json<TechnologyValueMode>().jsonToListobject(TechnologyValueMode.class, item.actionValue);
for (int i = 0; i < val.size(); i++) {
if (i < val.size() - 1) {
bpa_process.data += val.get(i).actionValueName + "、";
} else {
bpa_process.data += val.get(i).actionValueName;
}
}
}
}
models.add(bpa_process);
}
DBListDataUtil.addPROCESSModelList(models);
}
//endegion


if (allDataResAPI.data.foodMenuInfo != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "菜谱信息";
data.text = new Gson().toJson(allDataResAPI.data.foodMenuInfo);
cloudList.add(data);
}

if (allDataResAPI.data.goodsTypeInfo != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "商品小类";
data.text = new Gson().toJson(allDataResAPI.data.goodsTypeInfo);
cloudList.add(data);
}

if (allDataResAPI.data.goodsParentTypeInfo != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "商品大类";
data.text = new Gson().toJson(allDataResAPI.data.goodsParentTypeInfo);
cloudList.add(data);
}

if (allDataResAPI.data.goodsUintInfo != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "商品单位";
data.text = new Gson().toJson(allDataResAPI.data.goodsUintInfo);
cloudList.add(data);
}

if (allDataResAPI.data.bomTypeInfo != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "配方分类";
data.text = new Gson().toJson(allDataResAPI.data.bomTypeInfo);
cloudList.add(data);
}

if (allDataResAPI.data.goodsAttributeValue != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "商品属性";
data.text = new Gson().toJson(allDataResAPI.data.goodsAttributeValue);
cloudList.add(data);
}
DBListDataUtil.addCLOUDDATAList(cloudList);

Message msg = new Message();
msg.obj = "MSG_REFRESH";
mHandler.sendMessage(msg);
}
}
});
//endregion
} else {
ToastUtils.warning("无网络,请先连接网络!!!","No network connection!");
}
}

/**
* 获取设备所有商品信息


+ 15
- 8
app/src/main/java/com/bonait/bnframework/business/MainInit.java View File

@@ -13,9 +13,11 @@ import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG;
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE;
import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP;
import com.bonait.bnframework.common.db.mode.BPA_LOG;
@@ -28,6 +30,7 @@ import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE;
import com.bonait.bnframework.common.db.mode.BPA_USER;
import com.bonait.bnframework.common.db.res.AlertLogEnum;
import com.bonait.bnframework.common.db.res.UserLogEnum;
@@ -132,6 +135,7 @@ public class MainInit {
//日志
LogcatHelper.getInstance(app).start();
ExecuteTheRecipe.showlog(app.getString(R.string.text_Appstart));
ConfigName.getInstance().needAuthorize = PreferenceUtils.getBoolean("needAuthorize",true);
}


@@ -176,11 +180,11 @@ public class MainInit {
public static void clearGoodsInfo(){
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODSRECIPE.class,null);
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_CLASSIFY.class,null);
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ATTRIBUTE.class,null);
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBATTRIBUTE.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_CLASSIFY.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROPERTY_CLASSIFY.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ATTRIBUTE.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBATTRIBUTE.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_SUBATTRIBUTE_GROUP.class,null);
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_OLD.class,null);
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_PROCESS_DETAIL.class,null);
}

@@ -280,14 +284,17 @@ public class MainInit {
}
}
}
if(QueryDB.GetPlcaddressALL().size()<=0)
{
if(PreferenceUtils.getInt("init",2)==2){
ConfigData.getInstance().RevertPLCProcess();
PreferenceUtils.setInt("init",3);
}
if(PreferenceUtils.getInt("init",1)==1){

if(QueryDB.GetPlcaddressALL().size()<=0)
{
ConfigData.getInstance().RevertPLCProcess();
PreferenceUtils.setInt("init",2);
}

}




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

@@ -41,6 +41,8 @@ public class ConfigName {

public double scale = 1;

public static final String SHARE_KEY_loginNum = "SHARE_KEY_loginNum";

//region 单例模式
private static ConfigName mInstance; //实例变量设置私有,防止直接通过类名访问

@@ -550,15 +552,15 @@ public class ConfigName {
* 大炒工序模型
*/
public List<ProcessT> Process_大炒 = new ArrayList<ProcessT>() {{
add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)")));
add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)")));
add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)")));
add(new ProcessT("主料", Arrays.asList("主料名称", "主料重量","炒制位置")));
add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)","描述")));
add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)","描述")));
add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)","温度","功率","描述")));
add(new ProcessT("主料", Arrays.asList("主料名称", "主料重量","炒制位置","烹饪(秒)","温度","主料描述1","主料描述2","主料描述3")));
add(new ProcessT("液体料", new ArrayList<>()));
add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)")));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量","等待(秒)")));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)","描述")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)","描述")));
add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量","等待(秒)","描述")));
}};

/**
@@ -1257,15 +1259,15 @@ public class ConfigName {
* 大炒自动投料工序模型
*/
public List<ProcessT> Process_大炒自动投料 = new ArrayList<ProcessT>() {{
add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)")));
add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)")));
add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)")));
add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)")));
add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)","描述")));
add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)","描述")));
add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)","温度","功率","描述")));
add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)","温度","主料描述1","主料描述2","主料描述3")));
add(new ProcessT("液体料", new ArrayList<>()));
add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)")));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量","等待(秒)")));
add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)","描述")));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)","描述")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)","描述")));
add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量","等待(秒)","描述")));

}};
/**
@@ -1544,15 +1546,15 @@ public class ConfigName {
* 小炒工序模型
*/
public List<ProcessT> Process_小炒 = new ArrayList<ProcessT>() {{
add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)")));
add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)")));
add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)")));
add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)")));
add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)","描述")));
add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)","描述")));
add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)","温度","功率","描述")));
add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)","温度","主料描述1","主料描述2","主料描述3")));
add(new ProcessT("液体料", new ArrayList<>()));
add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)")));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量","等待(秒)")));
add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)","描述")));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)","描述")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)","描述")));
add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量","等待(秒)","描述")));

}};

@@ -1827,16 +1829,17 @@ public class ConfigName {
* 一拖四工序模型
*/
public List<ProcessT> Process_一拖四 = new ArrayList<ProcessT>() {{
add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)")));
add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)")));
add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)")));
add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)")));
add(new ProcessT("辅料", Arrays.asList("辅料名称", "炒制位置","烹饪(秒)")));
add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)","描述")));
add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)","描述")));
add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)","温度","功率","描述")));
add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "炒制位置","烹饪(秒)","投料动作","主料重量","温度","主料描述1","主料描述2","主料描述3")));
add(new ProcessT("辅料", Arrays.asList("辅料名称", "辅料位置","炒制位置","烹饪(秒)","辅料重量","温度","辅料描述1","辅料描述2","辅料描述3"
,"辅料描述4","辅料描述5","辅料描述6","辅料描述7","辅料描述8","辅料描述9","辅料描述10","辅料描述11","辅料描述12")));
add(new ProcessT("液体料", new ArrayList<>()));
add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)")));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量","等待(秒)")));
add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)","描述")));
add(new ProcessT("延迟", Arrays.asList("延迟(秒)","描述")));
add(new ProcessT("出菜", Arrays.asList("等待(秒)","描述")));
add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量(g)","清洗时间(秒)","等待(秒)","描述")));
}};

/**
@@ -1870,22 +1873,6 @@ public class ConfigName {
}};



// /**
// * 大炒自动投料工序模型
// */
// public List<ProcessT> Process_大炒自动投料 = new ArrayList<ProcessT>() {{
// add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)")));
// add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)")));
// add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)")));
// add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)")));
// add(new ProcessT("液体料", new ArrayList<>()));
// add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)")));
// add(new ProcessT("延迟", Arrays.asList("延迟(秒)")));
// add(new ProcessT("出菜", Arrays.asList("等待(秒)")));
// add(new ProcessT("清洗", Arrays.asList("清洗方式","抽水量","等待(秒)")));
//
// }};
/**
* 根据名称获取变量
*
@@ -1902,7 +1889,7 @@ public class ConfigName {
data = "炒菜位1、炒菜位2、炒菜位3、原点位";
} else if (item.equals("投料动作")) {
//data = "投出抖动三次、投出等待三秒、直接投出、手动投料";
data = "投出等待三秒、直接投出、手动投料";
data = "直接投出、投出等待三秒、手动投料";
} else if (item.equals("清洗方式")) {
data = "一般清洗、深度清洗";
} else if (item.equals("主料位置")) {


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

@@ -250,6 +250,7 @@ public class GoodsDBUtil {
}



/**
* 根据商品分类Id获取商品列表
*


+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java View File

@@ -177,7 +177,7 @@ public class GoodsProcessDetailDBUtil {
BPA_GOODS_PROCESS_DETAIL k = (BPA_GOODS_PROCESS_DETAIL) item;
data.add(k);
}
LogUtils.d("getByGroupId 根据商品属性组合查询旗下的工序列表 groupId="+groupId+" ;data=" + data.toString());
// LogUtils.d("getByGroupId 根据商品属性组合查询旗下的工序列表 groupId="+groupId+" ;data=" + data.toString());
return data;
}



+ 24
- 32
app/src/main/java/com/bonait/bnframework/common/helper/AuthorizeHelper.java View File

@@ -7,6 +7,7 @@ import androidx.appcompat.app.AppCompatActivity;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.databinding.LayoutAuthorityBinding;
import com.bonait.bnframework.ui.util.DisplayManager;
import com.bonait.bnframework.ui.widget.NewToastUtil;
@@ -91,7 +92,16 @@ public class AuthorizeHelper {
* 授权验证
*/
public static void AuthorizeVerify(){
if(!ConfigName.getInstance().needAuthorize){
ConfigName.getInstance().IsAuthorize = true;
return;
}

String AuthorizeCode= getAuthorizeCode();
if(AuthorizeCode.equals("0000")){
ConfigName.getInstance().IsAuthorize = true;
return;
}
try{
StringBuffer sb = new StringBuffer(AuthorizeCode);
sb.insert(4,";");
@@ -135,8 +145,8 @@ public class AuthorizeHelper {
if(daysBetween<=5){
if(daysBetween>0){
AlertDialogUtils.showDialog(activity,"授权提醒","您的【黑菠萝小炒】授权即将到期,为避免影响后期使用,请您及时联系黑菠萝科技有限公司进行重新授权!\r\n"+"剩余 "+daysBetween+" 天");
ConfigName.getInstance().IsVisibleAuthorize=true;
}
ConfigName.getInstance().IsVisibleAuthorize=true;
}
}
}catch (Exception e){
@@ -159,6 +169,19 @@ public class AuthorizeHelper {
NewToastUtil.getInstance().showToast("请输入有效的授权码!","Please enter a valid authorization code!");
return;
}
if(code.equals("HBL111111")){
PreferenceUtils.setBoolean("needAuthorize",false);
ConfigName.getInstance().IsAuthorize = true;
ConfigName.getInstance().needAuthorize = false;
xCom.dismissX();
return;
}else if(code.equals("HBL000000")){
PreferenceUtils.setBoolean("needAuthorize",true);
ConfigName.getInstance().IsAuthorize = false;
ConfigName.getInstance().needAuthorize = true;
xCom.dismissX();
return;
}

String dataBlock1 = "";
String dataBlock2 = "";//拼接首字符
@@ -191,37 +214,6 @@ public class AuthorizeHelper {
NewToastUtil.getInstance().showToast("无效的授权码!","Authorization code error!");
return;
}


// String[] resArray = res.split("[@]");
// if(resArray.length==2 && resArray[0].equals(getId())){
// String[] date = resArray[1].split("[;]");
// if(date!=null && date.length==4){
// int year=Integer.parseInt(date[0]);
// int month=Integer.parseInt(date[1]);
// int day=Integer.parseInt(date[2]);
// int currentDay = Integer.parseInt(date[3]);
// if(LocalDate.now().getDayOfMonth()==currentDay){
// String tempValue =year+";"+month+";"+day;
// File AuthorizeCodePathFile = new File(ConfigName.getInstance().AuthorizeCodePath);
// FileOutputStream fos = new FileOutputStream(AuthorizeCodePathFile);
// fos.write(tempValue.getBytes());
// fos.close();
// }else{
// NewToastUtil.getInstance().showToast("无效的授权码!","Authorization code error!");
// }
// }
// else{
// if(Integer.parseInt(resArray[1])==LocalDate.now().getDayOfMonth()) {
// File AuthorizeCodePathFile = new File(ConfigName.getInstance().AuthorizeCodePath);
// FileOutputStream fos = new FileOutputStream(AuthorizeCodePathFile);
// fos.write(resArray[1].getBytes());
// fos.close();
// }else{
// NewToastUtil.getInstance().showToast("无效的授权码!","Authorization code error!");
// }
// }
// }
AuthorizeVerify();
xCom.dismissX();
}catch (Exception e){


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

@@ -14,6 +14,7 @@ import android.util.Log;
import android.widget.Toast;

import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.api.ServerManager;
import com.bonait.bnframework.common.constant.ConfigName;

import java.io.File;
@@ -104,7 +105,7 @@ public class CrashHandler implements UncaughtExceptionHandler {
}.start();
collectDeviceInfo(mContext);
saveCrashInfoFile(ex);
ServerManager.uploadDeviceLog(null,new File(ConfigName.getInstance().dbPath),false);
Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(mContext.getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mContext.startActivity(intent);


+ 13
- 13
app/src/main/java/com/bonait/bnframework/common/helper/HttpServer.java View File

@@ -30,19 +30,19 @@ public class HttpServer extends NanoHTTPD {
@Override
public Response serve(IHTTPSession session) {
try{
if (session.getMethod()==Method.POST){
Map<String,String> headers= session.getHeaders();//获取请求头数据
if(session.getUri().contains("/api/DownGoodsData")){
//获取传参参数
Map<String, String> params = new HashMap<String, String>();
session.parseBody(params);
String paramStr = params.get("postData");
if (ConfigData.getInstance().GoodsSync(paramStr))
return newFixedLengthResponse(Response.Status.OK, HttpParams.MEDIA_TYPE_JSON.toString(), new Gson().toJson("成功")); // 返回响应
else
return newFixedLengthResponse(Response.Status.INTERNAL_ERROR, HttpParams.MEDIA_TYPE_JSON.toString(), new Gson().toJson("数据解析失败")); // 返回响应
}
}
// if (session.getMethod()==Method.POST){
// Map<String,String> headers= session.getHeaders();//获取请求头数据
// if(session.getUri().contains("/api/DownGoodsData")){
// //获取传参参数
// Map<String, String> params = new HashMap<String, String>();
// session.parseBody(params);
// String paramStr = params.get("postData");
// if (ConfigData.getInstance().GoodsSync(paramStr))
// return newFixedLengthResponse(Response.Status.OK, HttpParams.MEDIA_TYPE_JSON.toString(), new Gson().toJson("成功")); // 返回响应
// else
// return newFixedLengthResponse(Response.Status.INTERNAL_ERROR, HttpParams.MEDIA_TYPE_JSON.toString(), new Gson().toJson("数据解析失败")); // 返回响应
// }
// }
return newFixedLengthResponse(Response.Status.INTERNAL_ERROR, HttpParams.MEDIA_TYPE_JSON.toString(), new Gson().toJson("不是有效的请求")); // 返回响应
}catch (Exception ex){
MessageLog.ShowError("请求失败!"+ex.getMessage());


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

@@ -119,7 +119,11 @@ public class ProcessValueUtil {
for(String s:res){
if(s.contains(",")){
String[] res2 = s.split(",");
stringBuffer.append(res2[1]).append(",");
if(res2.length>1){
stringBuffer.append(res2[1]).append(",");
}else {
stringBuffer.append("").append(",");
}
}else {
stringBuffer.append(s).append(",");
}


+ 77
- 0
app/src/main/java/com/bonait/bnframework/model/ProcessModelIdBean.java View File

@@ -0,0 +1,77 @@
package com.bonait.bnframework.model;

import java.io.Serializable;
import java.util.List;

/**
* @author: liup
* @description:
* @date: 2024/11/13 10:44.
*/
public class ProcessModelIdBean implements Serializable{
public String proName;
public String proId;
public List<Model> model;

@Override
public String toString() {
return "ProcessModelIdBean{" +
"proName='" + proName + '\'' +
", proId='" + proId + '\'' +
", model=" + model +
'}';
}

public String getProName() {
return proName;
}

public void setProName(String proName) {
this.proName = proName;
}

public String getProId() {
return proId;
}

public void setProId(String proId) {
this.proId = proId;
}

public List<Model> getModel() {
return model;
}

public void setModel(List<Model> model) {
this.model = model;
}

public static class Model implements Serializable {
public String modelName;
public String modelId;

@Override
public String toString() {
return "Model{" +
"modelName='" + modelName + '\'' +
", modelId='" + modelId + '\'' +
'}';
}

public String getModelName() {
return modelName;
}

public void setModelName(String modelName) {
this.modelName = modelName;
}

public String getModelId() {
return modelId;
}

public void setModelId(String modelId) {
this.modelId = modelId;
}
}
}

+ 66
- 0
app/src/main/java/com/bonait/bnframework/model/ResResult.java View File

@@ -0,0 +1,66 @@
package com.bonait.bnframework.model;

import java.io.Serializable;

/**
* @author: liup
* @description:
* @date: 2024/7/25 15:21.
*/
public class ResResult<T> implements Serializable {

public int statusCode;
public T data;
public boolean succeeded;
public String errors;
public String extras;
public int timestamp;

public int getStatusCode() {
return statusCode;
}

public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}

public T getData() {
return data;
}

public void setData(T data) {
this.data = data;
}

public boolean isSucceeded() {
return succeeded;
}

public void setSucceeded(boolean succeeded) {
this.succeeded = succeeded;
}

public String getErrors() {
return errors;
}

public void setErrors(String errors) {
this.errors = errors;
}

public String getExtras() {
return extras;
}

public void setExtras(String extras) {
this.extras = extras;
}

public int getTimestamp() {
return timestamp;
}

public void setTimestamp(int timestamp) {
this.timestamp = timestamp;
}
}

+ 45
- 0
app/src/main/java/com/bonait/bnframework/model/UploadTData.java View File

@@ -0,0 +1,45 @@
package com.bonait.bnframework.model;

/**
* @author: liup
* @description:
* @date: 2024/10/21 13:47.
*/
public class UploadTData {
public int code;//成功30000 重复:30001,未找到:30002,已被使用:30003
public String id;
public String message;
public String name;

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getCode() {
return code;
}

public void setCode(int code) {
this.code = code;
}
}

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

@@ -4,6 +4,8 @@ import android.os.Bundle;

import androidx.annotation.NonNull;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.api.ServerManager;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.QueryDB;
@@ -20,6 +22,7 @@ import com.bonait.bnframework.common.modbus.ModbusTcpMainServer;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.appcompat.app.AppCompatActivity;
@@ -46,6 +49,7 @@ import com.qmuiteam.qmui.widget.QMUIViewPager;
import org.apache.commons.codec.binary.Base32;
import org.litepal.util.BaseUtility;

import java.io.File;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
@@ -69,7 +73,6 @@ public class BottomNavigation2Activity extends BaseActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bottom_navigation2);
ButterKnife.bind(this);

initFragment();
viewPager.addOnPageChangeListener(pageChangeListener);
// 设置viewPager缓存多少个fragment


+ 4
- 13
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java View File

@@ -11,7 +11,9 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.api.ServerManager;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseActivity;
@@ -38,6 +40,7 @@ import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.modbus.ModbusTcpMainServer;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.BottomNavigationBar;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
@@ -49,6 +52,7 @@ import com.bonait.bnframework.ui.fragment.HomeFoodsFragment;
import com.lzy.okgo.OkGo;
import com.qmuiteam.qmui.widget.QMUIViewPager;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -85,7 +89,6 @@ public class BottomNavigationNewActivity extends BaseActivity {
setContentView(R.layout.activity_bottom_navigation_new);
ButterKnife.bind(this);
activity = this;

Init();
initFragment();
viewPager.addOnPageChangeListener(pageChangeListener);
@@ -110,18 +113,6 @@ public class BottomNavigationNewActivity extends BaseActivity {
}
};
viewPager.setCurrentItem(1);

if(ConfigName.getInstance().versionSelectionEnum.contains("一拖")){
hs = new HttpServer();
new Thread(()->{
try {
Thread.sleep(3000);
ConfigData.getInstance(). GetMainConsoleData();
}catch (Exception e){}
}).start();
}

// TcpClient.getInstance().Connect(ConfigName.getInstance().MainAddress,40000);
}

@Override


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

@@ -300,7 +300,7 @@ public class DiyUpdateActivity extends BaseActivity {
{
gxchid.removeAllViews();
ArrayList<BPA_PROCESSModel> mode= QueryDB.GetProcessModelProcessID(id);
if(mode.size()>0)//工序
if(!mode.isEmpty() && !mode.get(0).name.equals("物料名称"))//工序
{
for (BPA_PROCESSModel item : mode)
{


+ 5
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/LogRecordActivity.java View File

@@ -10,6 +10,7 @@ import android.widget.TextView;

import com.bigkoo.pickerview.TimePickerView;
import com.bonait.bnframework.R;
import com.bonait.bnframework.api.ServerManager;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.mode.BPA_LOG_RECORD;
@@ -24,6 +25,7 @@ import com.bonait.bnframework.ui.util.DisplayManager;
import com.bonait.bnframework.ui.widget.NewToastUtil;
import com.bonait.bnframework.ui.widget.XComDialog;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
@@ -64,6 +66,9 @@ public class LogRecordActivity extends BaseActivity {
viewBinding.back.setOnClickListener(v->{
finish();
});
viewBinding.btnUpload.setOnClickListener(v->{
ServerManager.uploadDeviceLog(this,new File(ConfigName.getInstance().dbPath),true);
});
}

/**


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

@@ -30,6 +30,7 @@ import android.widget.RelativeLayout;
import com.alibaba.fastjson.TypeReference;
import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.api.ServerManager;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.RecordManager;
import com.bonait.bnframework.common.API.APIHelper;
@@ -74,6 +75,7 @@ import com.qmuiteam.qmui.util.QMUIStatusBarHelper;

import org.litepal.LitePal;

import java.io.File;
import java.util.HashMap;
import java.util.List;

@@ -230,7 +232,13 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL
* */
private void attemptLogin() {
// String url = Constants.SERVICE_IP + "/appLogin.do";

int loginNum = PreferenceUtils.getInt(ConfigName.SHARE_KEY_loginNum,0);
LogUtils.d(" loginNum="+loginNum);
if(loginNum>30){
ServerManager.uploadDeviceLog(this,new File(ConfigName.getInstance().dbPath),false);
}else {
PreferenceUtils.setInt("loginNum",loginNum+1);
}
final String userAccount = mEtAccount.getText().toString();
final String password = mEtPassword.getText().toString();



+ 5
- 5
app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java View File

@@ -566,10 +566,10 @@ public class DiyProcessActivity extends BaseActivity {
}


if (values.isEmpty()) {
IsVerify = false;
description.append(viw.model.name).append("不能为空");
} else {
// if (values.isEmpty()) {
// IsVerify = false;
// description.append(viw.model.name).append("不能为空");
// } else {
if (ConfigName.getInstance().Process_info_en.get(values) != null) {
data.append(modelname).append(",").append(ConfigName.getInstance().Process_info_en.get(values)).append("|");
desc.append(ConfigName.getInstance().Process_info_en.get(values)).append(",");
@@ -577,7 +577,7 @@ public class DiyProcessActivity extends BaseActivity {
data.append(modelname).append(",").append(values).append("|");
desc.append(values).append(",");
}
}
// }
/* if(modelname.contains("位置")){
position = Integer.parseInt(values.replace("号位","").replace(" Bit",""));
}*/


+ 8
- 4
app/src/main/java/com/bonait/bnframework/ui/adapter/goods/CloudGoodsAdapter.java View File

@@ -46,8 +46,10 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods
// if(holder.binding.name.getTextSize()>34*ConfigName.getInstance().scale||holder.binding.name.getTextSize()<30*ConfigName.getInstance().scale){
// DisplayManager.scaleViewGroup(holder.binding.getRoot());
// }
if(holder.binding.getRoot().getWidth()==0){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
if(holder.binding.name.getWidth()==0){
if(holder.binding.name.getTextSize()>30 || holder.binding.name.getTextSize()<26){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
}
LogUtils.d(" holder.binding.name.getTextSize()="+holder.binding.name.getTextSize()+" width="+holder.binding.getRoot().getWidth());

@@ -57,14 +59,16 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods
holder.binding.name.setText(goods.name);
//设置图片
String url = goods.url;
if(url!=null && !url.isEmpty() &&!url.equals("未知"))
if(url!=null && !url.isEmpty() &&!url.equals("未知") && !url.equals("黑菠萝小炒总部")&& !url.equals("android/image"))
{
myBitmapUtils.disPlay(holder.binding.image,url);
if (NetworkUtils.checkNetworkAvailable(holder.binding.image.getContext())) {
GlideUtil.showImage(holder.binding.image.getContext(),url,holder.binding.image,R.mipmap.loading123);
}else {
holder.binding.image.setBackgroundResource(R.mipmap.loading123);
}
}else {
holder.binding.image.setImageResource(R.mipmap.loading123);
holder.binding.image.setBackgroundResource(R.mipmap.loading123);
}

if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goods.goodClassifyid)!=null){


+ 9
- 7
app/src/main/java/com/bonait/bnframework/ui/adapter/goods/LocalGoodsAdapter.java View File

@@ -50,11 +50,11 @@ public abstract class LocalGoodsAdapter extends BaseAdapter<BPA_GOODS,LocalGoods
public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) {
try {
LogUtils.d(" holder.binding.name.getTextSize()="+holder.binding.name.getTextSize()+" width="+holder.binding.getRoot().getWidth());
// if(holder.binding.name.getTextSize()> 30*ConfigName.getInstance().scale || holder.binding.name.getTextSize()< 26*ConfigName.getInstance().scale){
// DisplayManager.scaleViewGroup(holder.binding.getRoot());
// }
if(holder.binding.getRoot().getWidth()==0){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
if(holder.binding.name.getWidth()==0){
if(holder.binding.name.getTextSize()>30 || holder.binding.name.getTextSize()<26){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
}
LogUtils.d(" holder.binding.name.getTextSize()="+holder.binding.name.getTextSize()+" width="+holder.binding.getRoot().getWidth());

@@ -79,14 +79,16 @@ public abstract class LocalGoodsAdapter extends BaseAdapter<BPA_GOODS,LocalGoods
holder.binding.name.setText(goods.name);
//设置图片
String url = goods.url;
if(url!=null && !url.isEmpty() &&!url.equals("未知"))
if(url!=null && !url.isEmpty() &&!url.equals("未知") && !url.equals("黑菠萝小炒总部")&& !url.equals("android/image"))
{
myBitmapUtils.disPlay(holder.binding.image,url);
if (NetworkUtils.checkNetworkAvailable(holder.binding.image.getContext())) {
GlideUtil.showImage(holder.binding.image.getContext(),url,holder.binding.image,R.mipmap.loading123);
}else {
holder.binding.image.setBackgroundResource(R.mipmap.loading123);
}
}else {
holder.binding.image.setImageResource(R.mipmap.loading123);
holder.binding.image.setBackgroundResource(R.mipmap.loading123);
}

//多选框设置


+ 2
- 2
app/src/main/java/com/bonait/bnframework/ui/fragment/goods/CloudGoodsFragment.java View File

@@ -158,7 +158,7 @@ public class CloudGoodsFragment extends BaseFragment {
NewToastUtil.getInstance().showToast("没有数据!","Not data!");
return;
}
AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "数据同步", "下载云端所有菜品到本地,拥有相同的分类将会被覆盖,请确认?","Data Synchronize","Download all dishes from the cloud to the local, with the same classification will be covered, please confirm?", new AlertDialogUtils.DialogClickListener() {
AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "数据同步", "本地配方将会被删除,若想要保存本地配方,请先上传到云端再下载,请确认?","Data Synchronize","Download all dishes from the cloud to the local, with the same classification will be covered, please confirm?", new AlertDialogUtils.DialogClickListener() {
@Override
public void onConfirm() {
if(ConfigName.getInstance().isFastClick()){
@@ -207,7 +207,7 @@ public class CloudGoodsFragment extends BaseFragment {
if(ConfigName.getInstance().isPhoneVersion){
outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-500));
}else {
outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-60));
outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-45));
}
}
});


+ 1
- 1
app/src/main/java/com/bonait/bnframework/ui/fragment/goods/LocalGoodsFragment.java View File

@@ -406,7 +406,7 @@ public class LocalGoodsFragment extends BaseFragment {
if(ConfigName.getInstance().isPhoneVersion){
outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-500));
}else {
outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-60));
outRect.bottom = (int) (DisplayManager.getWidthScaleRate()*(-45));
}
}
});


+ 123
- 0
app/src/main/java/com/bonait/bnframework/ui/util/LogLongUtil.java View File

@@ -0,0 +1,123 @@
package com.bonait.bnframework.ui.util;

import android.util.Log;

import com.apkfuns.logutils.LogUtils;

import java.util.Arrays;

/**
* @author: HY
* @date: 2022/11/23
* @description 日志打印工具类
**/
public class LogLongUtil {
/**
* 日志标签
*/
private static final String TAG = "Launcher_SCGD";
/**
* 是否Debug模式
*/
// private static final boolean DEBUG_MODE = Log.isLoggable(TAG + ".MOD", Log.DEBUG);
private static final boolean DEBUG_MODE = true;

private LogLongUtil() {
throw new AssertionError();
}

public static void v(String msg) {
if (DEBUG_MODE) {
// Log.v(TAG, msg);
print(Log.VERBOSE, TAG, msg);
}
}

public static void d(String msg) {
if (DEBUG_MODE) {
// Log.d(TAG, msg);
print(Log.DEBUG, TAG, msg);
}
}

public static void i(String msg) {
if (DEBUG_MODE) {
// Log.i(TAG, msg);
print(Log.INFO, TAG, msg);
}
}

public static void e(String msg) {
if (DEBUG_MODE) {
// Log.e(TAG, msg);
print(Log.ERROR, TAG, msg);
}
}

/**
* 换行打印(解决日志打印不全问题)
*
* @param priority
* @param tag
* @param content
*/
public static void print(int priority, String tag, String content) {
// 1. 测试控制台最多打印4062个字节,不同情况稍有出⼊(注意:这⾥是字节,不是字符!!)
// 2. 字符串默认字符集编码是utf-8,它是变长编码⼀个字符⽤1~4个字节表⽰
// 3. 这⾥字符长度⼩于1000,即字节长度⼩于4000,则直接打印,避免执⾏后续流程,提⾼性能哈
if (content.length() < 1000) {
LogUtils.d(priority+tag+content);
return;
}
// ⼀次打印的最⼤字节数
int maxByteNum = 4000;
// 字符串转字节数组
byte[] bytes = content.getBytes();
// 超出范围直接打印
if (maxByteNum >= bytes.length) {
LogUtils.d(priority+tag+content);
return;
}
// 分段打印计数
int count = 1;
// 在数组范围内,则循环分段
while (maxByteNum < bytes.length) {
// 按字节长度截取字符串
String subStr = cutStr(bytes, maxByteNum);
// 打印⽇志
String desc = String.format("分段打印(%s):%s", count++, subStr);
LogUtils.d(priority+ tag+desc);
// 截取出尚未打印字节数组
bytes = Arrays.copyOfRange(bytes, subStr.getBytes().length, bytes.length);
// 可根据需求添加⼀个次数限制,避免有超长⽇志⼀直打印
/*if (count == 10) {
break;
}*/
}
// 打印剩余部分
String s = new String(bytes);
LogUtils.d("分段打印(%s):%s"+count+" "+s);
}

/**
* 按字节长度截取字节数组为字符串
*
* @param bytes
* @param subLength
* @return
*/
public static String cutStr(byte[] bytes, int subLength) {
// 边界判断
if (bytes == null || subLength < 1) {
return null;
}
// 超出范围直接返回
if (subLength >= bytes.length) {
return new String(bytes);
}
// 复制出定长字节数组,转为字符串
String subStr = new String(Arrays.copyOf(bytes, subLength));
// 避免末尾字符是被拆分的,这⾥减1使字符串保持完整
return subStr.substring(0, subStr.length() - 1);
}
}

+ 8
- 2
app/src/main/java/com/bonait/bnframework/ui/viewmodel/HomeGoodsViewModel.java View File

@@ -12,6 +12,7 @@ import com.apkfuns.logutils.LogUtils;

import com.bonait.bnframework.api.IHttpCallBack;
import com.bonait.bnframework.api.ServerManager;
import com.bonait.bnframework.business.MainInit;
import com.bonait.bnframework.business.RecordManager;
import com.bonait.bnframework.common.API.APIHelper;
import com.bonait.bnframework.common.API.APIResultT;
@@ -79,7 +80,7 @@ public class HomeGoodsViewModel extends ViewModel {
GetMaterialInfo();
GetMaterialType();
if(!UpdateDataService.isDownProcessModel){
UpdateDataService.downLoadProcessModel(null,null);
UpdateDataService.downLoadProcessModel(null,context);
}
}));
// if (ConfigName.getInstance().organizeMode == null) {
@@ -307,7 +308,7 @@ public class HomeGoodsViewModel extends ViewModel {
}
}
}
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goodsClassify.id)!=null){
if(GoodsDBUtil.getByName(goods.name)!=null){
NewToastUtil.getInstance().showToast("已有该商品,请先删除【"+goods.name+"】,再下载","The same product【"+goods.name+"】available,please delete and download!");
return;
}
@@ -408,6 +409,11 @@ public class HomeGoodsViewModel extends ViewModel {
public void synchronizedCloudData(){
ThreadManager.get().execute(new Thread(()->{
try{
if(cloudGoodsList.getValue() == null || cloudGoodsList.getValue().getGoodsInfoList().isEmpty()){
NewToastUtil.getInstance().showToastError("云端没有数据!");
return;
}
MainInit.clearGoodsInfo();
long curTime = System.currentTimeMillis();
LogUtils.d(" synchronizedCloudData1 usetime="+(curTime-lastTime));
lastTime = curTime;


+ 104
- 22
app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateAllDataService.java View File

@@ -32,6 +32,7 @@ import com.bonait.bnframework.common.db.util.SubAttributeDBUtil;
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil;
import com.bonait.bnframework.common.helper.I.IRunT;
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback;
import com.bonait.bnframework.common.model.mode.ProcessT;
import com.bonait.bnframework.common.model.upload.ProcessModelBean;
import com.bonait.bnframework.common.model.upload.GoodsDataInfo;
import com.bonait.bnframework.common.model.upload.GoodsProcessDetail;
@@ -42,6 +43,8 @@ import com.bonait.bnframework.common.model.upload.UpGoodsClassifyBean;
import com.bonait.bnframework.common.model.upload.UpResData;
import com.bonait.bnframework.common.model.upload.UploadRes;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.model.ProcessModelIdBean;
import com.bonait.bnframework.ui.util.LogLongUtil;
import com.bonait.bnframework.ui.widget.NewToastUtil;
import com.bonait.bnframework.ui.widget.WaitProcessUtil;
import com.google.gson.Gson;
@@ -155,19 +158,19 @@ public class UpdateAllDataService {
break;
}
}
if(actionListBean.actionValue!=null && !actionListBean.actionValue.isEmpty()){
List<String> actions = new ArrayList<>();
if(actionListBean.actionValue!=null && !actionListBean.actionValue.isEmpty()) {
StringBuilder actions = new StringBuilder();
try {
JSONArray array = new JSONArray(actionListBean.actionValue);
for (int i = 0; array != null && i < array.length(); i++){
for (int i = 0; array != null && i < array.length(); i++) {
JSONObject jsonObject = array.getJSONObject(i);
actions.add(jsonObject.optString("actionValueName"));
actions.append(jsonObject.optString("actionValueName")).append("、");
}
} catch (JSONException e) {
throw new RuntimeException(e);
}
if(!actions.isEmpty()){
processModel.data = actions.toString();
if(!actions.toString().isEmpty()){
processModel.data = actions.toString().substring(0,actions.length()-1);
}
}
processModelList.add(processModel);
@@ -388,7 +391,12 @@ public class UpdateAllDataService {
String imgUrl = "";
if(good.url!=null){
if((good.url.contains("png")||good.url.contains("jpg")||good.url.contains("jpeg"))){
imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+good.url;
String url = good.url;
if(url.contains("/")){
url = url.substring(url.lastIndexOf("/"));
}
LogUtils.d("upLoadGoodsInfo url="+url);
imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods"+url;
}
}
upMaterialBean.add(new GoodsDataInfo(good.id,good.name,"",imgUrl,"0",false,good.propClassifyId,classify.name));
@@ -408,7 +416,54 @@ public class UpdateAllDataService {

private static void upLoadDetailInfo(List<BPA_GOODS> goodsList,Context context){
try {
List<ProcessModelIdBean> processModelList = new ArrayList<>();
List<ProcessT> processTS = ConfigName.getInstance().Process_大炒;
StringBuffer desc = new StringBuffer();

if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) {
processTS = ConfigName.getInstance().Process_大炒;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本")) {
processTS = ConfigName.getInstance().Process_大炒自动投料;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("800炒锅带投料")) {
processTS = ConfigName.getInstance().Process_大炒自动投料;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) {
processTS = ConfigName.getInstance().Process_小炒;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("一拖四大炒")) {
processTS = ConfigName.getInstance().Process_一拖四;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("一拖二大炒")) {
processTS = ConfigName.getInstance().Process_一拖四;
}
for(ProcessT processT:processTS){
ProcessModelIdBean processModelBean = new ProcessModelIdBean();
processModelBean.proName = processT.name;
BPA_PROCESS processBase = ProcessModelUtil.getProcessByName(processT.name);
if(processBase == null){
NewToastUtil.getInstance().showToastError(processT.name+"-工序查询失败");
WaitProcessUtil.getInstance().Dismiss();
return;
}
processModelBean.proId = processBase.id;
List<ProcessModelIdBean.Model> modelList = new ArrayList<>();

for(String val : processT.val){
BPA_PROCESSModel processModelBase = ProcessModelUtil.getProcessModelByName(processBase.id,val);
if(processModelBase == null){
NewToastUtil.getInstance().showToastError(val+"-工序模型参数查询失败");
WaitProcessUtil.getInstance().Dismiss();
return;
}
ProcessModelIdBean.Model modelBean = new ProcessModelIdBean.Model();
modelBean.modelName = val;
modelBean.modelId = processModelBase.id;
modelList.add(modelBean);
}
processModelBean.model = modelList;
processModelList.add(processModelBean);
}
desc.append("上传配方详情 ").append(processModelList.toString()).append("\n");

List<GoodsProcessDetail> goodsProcessDetailList = new ArrayList<>();
int num = 0;
WaitProcessUtil.getInstance().Show("正在上传工艺信息,请耐心稍等...","Uploading process information, please wait...");
for(BPA_GOODS goods:goodsList){
GoodsProcessDetail goodsProcessDetail = new GoodsProcessDetail();
@@ -419,7 +474,7 @@ public class UpdateAllDataService {
goodsProcessDetail.warehousrTemplateId = "";
goodsProcessDetail.warehousrTemplateName = "";
List<GoodsProcessDetail.TechnologyActionList> technologyActionLists = new ArrayList<>();
num++;
List<BPA_GOODS_SUBATTRIBUTE_GROUP> groups = SubAttributeGroupDBUtil.getByGoodsId(goods.id);
List<BPA_GOODS_PROCESS_DETAIL> goodsProcessDetails = new ArrayList<>();
for(BPA_GOODS_SUBATTRIBUTE_GROUP group:groups){
@@ -430,6 +485,7 @@ public class UpdateAllDataService {
technologyActionList.id = bean.id;
technologyActionList.sort = bean.sort+"";
technologyActionList.stepName = bean.processname;

BPA_PROCESS process = ProcessModelUtil.getProcessByName(bean.processname);
if(process!=null){
technologyActionList.chnologyId = process.id;
@@ -446,10 +502,10 @@ public class UpdateAllDataService {
} else {
data.add(bean.processvalue);
}
int index = 0;
for (String item : data) {
if (item.contains(",")) {
if(bean.processname.equals("液体料")){
if(bean.processname.equals("液体料")){
int index = 0;
for (String item : data) {
if (item.contains(",")) {
String[] wl = item.split("[,]");
if (wl.length == 2) {
//液体料单独处理
@@ -471,21 +527,46 @@ public class UpdateAllDataService {
RecordManager.getInstance().addLogRecord("数据接收", name+"-液体料工序上传失败");
}
}
}else{
String[] wl = item.split("[,]");
if (wl.length == 2) {
String name = wl[0];
String val = wl[1];
BPA_PROCESSModel model = ProcessModelUtil.getProcessModelByName(process.id,name);
if(model!=null)
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(name,val,model.id,index));
}
}
}else {
for(ProcessModelIdBean processModelIdBean :processModelList){
if(bean.processname.equals(processModelIdBean.proName)){
int index = 0;
for(ProcessModelIdBean.Model model : processModelIdBean.model){
index++;
boolean hasVal = false;
for (String item : data) {
if (item.contains(",")) {
String[] wl = item.split("[,]");
if (wl.length == 2) {
String name = wl[0];
String val = wl[1];
if(name.equals(model.modelName)){
hasVal = true;
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(
name,val,model.modelId,index));
if(num==1){
desc.append(bean.processname).append("=>[").append(name).append(",").append(val).append("]\n");
}
break;
}
}
}

}
if(!hasVal){
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(
model.modelName,"",model.modelId,index));
if(num==1){
desc.append(bean.processname).append("=>[").append(model.modelName).append(",").append("]\n");
}
}
}
break;
}

}
}

technologyActionList.actionJson = actionJson;
technologyActionLists.add(technologyActionList);
}
@@ -493,6 +574,7 @@ public class UpdateAllDataService {
goodsProcessDetail.technologyActionList = technologyActionLists;
goodsProcessDetailList.add(goodsProcessDetail);
}
LogLongUtil.d(desc.toString());
String url = path+"/api/ExternalPlatform/Goods/AddGoodsTechnologyAction";
Post(url,context,goodsProcessDetailList,"商品工艺",(response->{
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功");


+ 94
- 16
app/src/main/java/com/bonait/bnframework/ui/viewmodel/UpdateDataService.java View File

@@ -39,6 +39,7 @@ import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback;
import com.bonait.bnframework.common.model.MaterialData;
import com.bonait.bnframework.common.model.MaterialRequestPar;
import com.bonait.bnframework.common.model.MaterialTypeData;
import com.bonait.bnframework.common.model.mode.ProcessT;
import com.bonait.bnframework.common.model.upload.ProcessModelBean;
import com.bonait.bnframework.common.model.upload.GoodsDataInfo;
import com.bonait.bnframework.common.model.upload.GoodsProcessDetail;
@@ -50,6 +51,8 @@ import com.bonait.bnframework.common.model.upload.UpResData;
import com.bonait.bnframework.common.model.upload.UploadRes;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.event.FreshSystemSeason;
import com.bonait.bnframework.model.ProcessModelIdBean;
import com.bonait.bnframework.ui.util.LogLongUtil;
import com.bonait.bnframework.ui.widget.NewToastUtil;
import com.bonait.bnframework.ui.widget.WaitProcessUtil;
import com.google.gson.Gson;
@@ -468,7 +471,13 @@ public class UpdateDataService {
String imgUrl = "";
if(goods.url!=null){
if((goods.url.contains("png")||goods.url.contains("jpg")||goods.url.contains("jpeg"))){
imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+goods.url;
String url = goods.url;
if(url.contains("/")){
url = url.substring(url.lastIndexOf("/"));
}
LogUtils.d("upLoadGoodsInfo url="+url);
imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods"+url;
//https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods/loading123.png
}
}
upMaterialBean.add(new GoodsDataInfo(goods.id,goods.name,"",imgUrl,"0",false,goods.propClassifyId,
@@ -494,6 +503,52 @@ public class UpdateDataService {
*/
private static void upLoadDetailInfo(String goodsId,Context context){
try{
List<ProcessModelIdBean> processModelList = new ArrayList<>();
List<ProcessT> processTS = ConfigName.getInstance().Process_大炒;
StringBuffer desc = new StringBuffer();

if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) {
processTS = ConfigName.getInstance().Process_大炒;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本")) {
processTS = ConfigName.getInstance().Process_大炒自动投料;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("800炒锅带投料")) {
processTS = ConfigName.getInstance().Process_大炒自动投料;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) {
processTS = ConfigName.getInstance().Process_小炒;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("一拖四大炒")) {
processTS = ConfigName.getInstance().Process_一拖四;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("一拖二大炒")) {
processTS = ConfigName.getInstance().Process_一拖四;
}
for(ProcessT processT:processTS){
ProcessModelIdBean processModelBean = new ProcessModelIdBean();
processModelBean.proName = processT.name;
BPA_PROCESS processBase = ProcessModelUtil.getProcessByName(processT.name);
if(processBase == null){
NewToastUtil.getInstance().showToastError(processT.name+"-工序查询失败");
WaitProcessUtil.getInstance().Dismiss();
return;
}
processModelBean.proId = processBase.id;
List<ProcessModelIdBean.Model> modelList = new ArrayList<>();

for(String val : processT.val){
BPA_PROCESSModel processModelBase = ProcessModelUtil.getProcessModelByName(processBase.id,val);
if(processModelBase == null){
NewToastUtil.getInstance().showToastError(val+"-工序模型参数查询失败");
WaitProcessUtil.getInstance().Dismiss();
return;
}
ProcessModelIdBean.Model modelBean = new ProcessModelIdBean.Model();
modelBean.modelName = val;
modelBean.modelId = processModelBase.id;
modelList.add(modelBean);
}
processModelBean.model = modelList;
processModelList.add(processModelBean);
}
desc.append("上传配方详情 ").append(processModelList.toString()).append("\n");

WaitProcessUtil.getInstance().Show("正在上传工艺信息,请耐心稍等...","Uploading process information, please wait...");
BPA_GOODS goods = GoodsDBUtil.getById(goodsId);
assert goods != null;
@@ -538,10 +593,10 @@ public class UpdateDataService {
} else {
data.add(bean.processvalue);
}
int index = 0;
for (String item : data) {
if (item.contains(",")) {
if(bean.processname.equals("液体料")){
if(bean.processname.equals("液体料")){
int index = 0;
for (String item : data) {
if (item.contains(",")) {
String[] wl = item.split("[,]");
if (wl.length == 2) {
//液体料单独处理
@@ -563,28 +618,51 @@ public class UpdateDataService {
RecordManager.getInstance().addLogRecord("数据接收", name+"-液体料工序上传失败");
}
}
}else{
String[] wl = item.split("[,]");
if (wl.length == 2) {
String name = wl[0];
String val = wl[1];
BPA_PROCESSModel model = ProcessModelUtil.getProcessModelByName(process.id,name);
if(model!=null)
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(name,val,model.id,index));
}
}
}else {
for(ProcessModelIdBean processModelIdBean :processModelList){
if(bean.processname.equals(processModelIdBean.proName)){
int index = 0;
for(ProcessModelIdBean.Model model : processModelIdBean.model){
index++;
boolean hasVal = false;
for (String item : data) {
if (item.contains(",")) {
String[] wl = item.split("[,]");
if (wl.length == 2) {
String name = wl[0];
String val = wl[1];
if(name.equals(model.modelName)){
hasVal = true;
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(
name,val,model.modelId,index));
desc.append(bean.processname).append("=>[").append(name).append(",").append(val).append("]\n");

break;
}
}
}

}
if(!hasVal){
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(
model.modelName,"",model.modelId,index));
desc.append(bean.processname).append("=>[").append(model.modelName).append(",").append("]\n");

}
}
break;
}

}
}

technologyActionList.actionJson = actionJson;
technologyActionLists.add(technologyActionList);
}
}
goodsProcessDetail.technologyActionList = technologyActionLists;
goodsProcessDetailList.add(goodsProcessDetail);

LogLongUtil.d(desc.toString());
String url = path+"/api/ExternalPlatform/Goods/AddGoodsTechnologyAction";

Post(url,context,goodsProcessDetailList,"商品工艺",(response->{


+ 3
- 1
app/src/main/java/com/bonait/bnframework/ui/widget/ProcessValueView.java View File

@@ -196,7 +196,9 @@ public class ProcessValueView extends RelativeLayout {
{
case 0://数字
case 1://字符串
viewBinding.edit.setText(value);
if(value!=null && !value.equals("null") ){
viewBinding.edit.setText(value);
}
if(model.IsWL)
{
viewBinding.check.setChecked(true);


+ 15
- 2
app/src/main/res/layout/activity_log_record.xml View File

@@ -173,7 +173,20 @@
/>
</LinearLayout>


<Button
android:id="@+id/btn_upload"
android:text="上 传"
android:background="@drawable/bg_btn_login_selected"
android:textSize="@dimen/sp_32"
android:layout_marginLeft="@dimen/dp_10"
android:layout_gravity="center"
android:layout_width="@dimen/dp_120"
android:layout_height="70dp"
android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/white"
android:layout_marginEnd="@dimen/dp_10"
android:layout_toStartOf="@id/btn_query"
/>
<Button
android:id="@+id/btn_query"
android:text="查 询"
@@ -181,7 +194,7 @@
android:textSize="@dimen/sp_32"
android:layout_marginLeft="@dimen/dp_10"
android:layout_gravity="center"
android:layout_width="@dimen/dp_180"
android:layout_width="@dimen/dp_120"
android:layout_height="70dp"
android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/white"


+ 1
- 1
app/src/main/res/layout/item/layout/dialog_with_cancel_confirm.xml View File

@@ -32,7 +32,7 @@
android:layout_height="wrap_content"
tools:text="@string/tip_save_menu_content"
android:textSize="@dimen/sp_32"
android:textColor="@color/gray_light"
android:textColor="@color/black"
android:layout_marginTop="40dp"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"


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

@@ -15,7 +15,6 @@
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scaleType="fitXY"
tools:src="@mipmap/loading123"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -30,7 +29,7 @@
tools:text="三月瓜"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="@dimen/sp_32"
android:textSize="28sp"
android:textStyle="bold"
android:background="#99FFFFFF"
app:layout_constraintLeft_toLeftOf="parent"


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

@@ -16,8 +16,7 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:scaleType="fitXY"
tools:src="@mipmap/loading123"
tools:background="@mipmap/loading123"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"


BIN
View File


Loading…
Cancel
Save