@@ -4,10 +4,10 @@ | |||
<selectionStates> | |||
<SelectionState runConfigName="app"> | |||
<option name="selectionMode" value="DROPDOWN" /> | |||
<DropdownSelection timestamp="2024-05-27T07:59:13.622609500Z"> | |||
<DropdownSelection timestamp="2024-05-29T08:06:21.150986500Z"> | |||
<Target type="DEFAULT_BOOT"> | |||
<handle> | |||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=58cd8fd5" /> | |||
<DeviceId pluginId="Default" identifier="serial=192.168.1.7:5555;connection=fd2c211c" /> | |||
</handle> | |||
</Target> | |||
</DropdownSelection> | |||
@@ -46,6 +46,21 @@ | |||
<activity | |||
android:name=".ui.activity.DiyProcessActivity" | |||
android:screenOrientation="portrait" | |||
android:launchMode="singleTask" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ui.activity.RecProcessActivity" | |||
android:screenOrientation="portrait" | |||
android:launchMode="singleTask" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ui.activity.CookingActivity" | |||
android:screenOrientation="portrait" | |||
android:launchMode="singleTask" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ui.activity.ErrorInfoActivity" | |||
android:screenOrientation="portrait" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ViewModel.ActivityViewModel.CookingSimulatedActivity" | |||
@@ -77,6 +92,12 @@ | |||
android:windowSoftInputMode="adjustPan" | |||
android:screenOrientation="portrait" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ui.activity.MainActivity" | |||
android:launchMode="singleTask" | |||
android:windowSoftInputMode="adjustPan" | |||
android:screenOrientation="portrait" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ViewModel.ActivityViewModel.UserActivity" | |||
android:screenOrientation="portrait" | |||
@@ -1,7 +1,11 @@ | |||
package com.bonait.bnframework.HBL.API; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Interface.IRunT; | |||
import com.bonait.bnframework.HBL.Logs.MessageLog; | |||
import com.bonait.bnframework.HBL.Result.OperateResultT; | |||
import com.google.gson.Gson; | |||
import com.google.gson.GsonBuilder; | |||
@@ -411,6 +415,80 @@ public class APIHelper { | |||
} | |||
public static <T> OperateResultT<T> PostT(String url, Object body, String signkey , TypeReference<APIResultT<T>> defaultValue) { | |||
HttpURLConnection connection = null; | |||
InputStream inputStream = null; | |||
BufferedReader reader = null; | |||
StringBuffer buffer = new StringBuffer(); | |||
try { | |||
URL requestUrl = new URL(url); | |||
connection = (HttpURLConnection) requestUrl.openConnection(); | |||
connection.setRequestMethod("POST"); | |||
connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)");// "Fiddler" | |||
connection.setRequestProperty("Content-Type", "application/json"); | |||
connection.setRequestProperty("Charset", "UTF-8"); | |||
connection.setConnectTimeout(5000); | |||
connection.setReadTimeout(5000); | |||
connection.setDoOutput(true); | |||
connection.setDoInput(true); | |||
if(body!=null){ | |||
//获取签名信息 | |||
String sign = GetSign(body,signkey); | |||
//设置请求头 | |||
connection.setRequestProperty("key", signkey); | |||
connection.setRequestProperty("sign", sign); | |||
LogUtils.d("PostT sign="+sign +";key="+key+":url="+url); | |||
//设置请求 body | |||
byte[] bytes = new Gson().toJson(body).getBytes(); | |||
connection.setRequestProperty("Content-Length", Integer.toString(bytes.length)); | |||
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) { | |||
outputStream.write(bytes); | |||
} | |||
} | |||
// 获取响应结果 | |||
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); | |||
} | |||
} else { | |||
return OperateResultT.CreateFailedT("服务器返回错误,状态码:" + statusCode); | |||
} | |||
}catch (Exception e){ | |||
return OperateResultT.CreateFailedT("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.CreateFailedT("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.CreateFailedT("内容解析失败"); | |||
} | |||
}catch(Exception e){ | |||
return OperateResultT.CreateFailedT("POST请求返回值解析异常,"+e.toString()); | |||
} | |||
// return OperateResultT.CreateFailed("无效的请求"); | |||
} | |||
public static <T> void PostT(String url, Object body,String signkey ,IRunT<APIResultT<T>> callback) { | |||
new Thread(()->{ | |||
HttpURLConnection connection = null; | |||
@@ -1,6 +1,7 @@ | |||
package com.bonait.bnframework.HBL.Result; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Interface.IRunT; | |||
import com.bonait.bnframework.HBL.Logs.MessageLog; | |||
@@ -77,11 +78,13 @@ public class OperateResultT<T> extends IResult | |||
public static <T> OperateResultT<T> CreateFailedT(String msg) | |||
{ | |||
MessageLog.ShowError(msg); | |||
LogUtils.d("MessageLog.ShowError(msg); msg="+msg); | |||
return new OperateResultT<T>( msg, ResultCode.Fail); | |||
} | |||
public static <T> OperateResultT<T> CreateFailedT(Exception ex) | |||
{ | |||
LogUtils.d("MessageLog.CreateFailedT(ex); ex="+ex.toString()); | |||
MessageLog.ShowError(ex.toString()); | |||
return new OperateResultT<T>(ex); | |||
} | |||
@@ -109,6 +109,16 @@ public class GoodsClassifyBean { | |||
public static class GoodsInfoListBean { | |||
private String goodsId; | |||
private String goodsName; | |||
private String imgUrl; | |||
public String getImgUrl() { | |||
return imgUrl; | |||
} | |||
public void setImgUrl(String imgUrl) { | |||
this.imgUrl = imgUrl; | |||
} | |||
private List<GoodsTechnologyActionListBean> goodsTechnologyActionList; | |||
public String getGoodsId() { | |||
@@ -0,0 +1,8 @@ | |||
package com.bonait.bnframework.Model; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
public class MaterialData { | |||
public List<MaterialModel> data=new ArrayList<>(); | |||
} |
@@ -0,0 +1,9 @@ | |||
package com.bonait.bnframework.Model; | |||
public class MaterialModel { | |||
public String id; | |||
public String code; | |||
public String name; | |||
public String typeName; | |||
public String uintName; | |||
} |
@@ -0,0 +1,10 @@ | |||
package com.bonait.bnframework.Model; | |||
public class MaterialRequestPar { | |||
public int current=1; | |||
public int pageSize=100; | |||
public MaterialRequestPar(int Current, int PageSize){ | |||
current=Current; | |||
pageSize=PageSize; | |||
} | |||
} |
@@ -44,6 +44,13 @@ public enum ControlAdress { | |||
停止加热,//M26 | |||
加热档位,//D51 0-100 | |||
炒制模式,//M102 | |||
搅拌模式,//D70 | |||
正转时间,//D71 | |||
反转时间,//D72 | |||
上升超时报警,//M104 | |||
下降超时报警,//M105 | |||
升降传感器异常,//M106 | |||
搅拌传感器异常,//M107 | |||
// | |||
// 搅拌检测,//X2 | |||
// 升降检测上限位,//X1 | |||
@@ -83,9 +83,13 @@ public class ModbusHelper extends ModbusMaster { | |||
put(ControlAdress.搅拌停止,new PLCModel("M24",DataType.BOOLEAN,OperationModel.W)); | |||
put(ControlAdress.搅拌档位,new PLCModel("D50",DataType.SHORT,OperationModel.W)); | |||
put(ControlAdress.炒制模式,new PLCModel("M102",DataType.BOOLEAN,OperationModel.W)); | |||
// put(ControlAdress.搅拌档位,new PLCModel("M26",DataType.BOOLEAN,OperationModel.W)); | |||
// put(ControlAdress.升降检测上限位,new PLCModel("X2",DataType.BOOLEAN,OperationModel.W)); | |||
// put(ControlAdress.升降检测下限位,new PLCModel("X4",DataType.BOOLEAN,OperationModel.W)); | |||
put(ControlAdress.搅拌模式,new PLCModel("D70",DataType.BOOLEAN,OperationModel.W)); | |||
put(ControlAdress.正转时间,new PLCModel("D71",DataType.BOOLEAN,OperationModel.W)); | |||
put(ControlAdress.反转时间,new PLCModel("D72",DataType.BOOLEAN,OperationModel.W)); | |||
put(ControlAdress.上升超时报警,new PLCModel("M104",DataType.BOOLEAN,OperationModel.W)); | |||
put(ControlAdress.下降超时报警,new PLCModel("M105",DataType.BOOLEAN,OperationModel.W)); | |||
put(ControlAdress.升降传感器异常,new PLCModel("M106",DataType.BOOLEAN,OperationModel.W)); | |||
put(ControlAdress.搅拌传感器异常,new PLCModel("M107",DataType.BOOLEAN,OperationModel.W)); | |||
}}; | |||
private ConcurrentHashMap<String, BPA_SILOS_CALIBRATE> calibrationParMap=new ConcurrentHashMap<>(); | |||
@@ -159,8 +163,10 @@ public class ModbusHelper extends ModbusMaster { | |||
public boolean readWater(){ | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.加水).PlcAddress); | |||
LogUtils.d(TAG+"加水控制复位读取 readMaterial "+" resultT="+resultT.Content); | |||
return resultT.Content; | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
/** | |||
* 液体料控制 | |||
@@ -263,8 +269,10 @@ public class ModbusHelper extends ModbusMaster { | |||
break; | |||
} | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(controlAdress).PlcAddress); | |||
LogUtils.d(TAG+"液体料复位读取 readMaterial position="+position+" resultT="+resultT.Content); | |||
return resultT.Content; | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
/** | |||
@@ -290,8 +298,10 @@ public class ModbusHelper extends ModbusMaster { | |||
public boolean readThickenWater(){ | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.勾芡).PlcAddress); | |||
LogUtils.d(TAG+"勾芡控制复位读取 readMaterial "+" resultT="+resultT.Content); | |||
return resultT.Content; | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
/** | |||
@@ -348,8 +358,10 @@ public class ModbusHelper extends ModbusMaster { | |||
break; | |||
} | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(controlAdress).PlcAddress); | |||
LogUtils.d(TAG+"液体料复位读取 readMaterial position="+position+" resultT="+resultT.Content); | |||
return resultT.Content; | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
/** | |||
@@ -358,14 +370,33 @@ public class ModbusHelper extends ModbusMaster { | |||
*/ | |||
public void setUpdDownMotor(int status){ | |||
if(status == 2){ | |||
// WriteBool(getPLC(ControlAdress.上升).PlcAddress,false); | |||
WriteBool(getPLC(ControlAdress.下降).PlcAddress,true); | |||
}else { | |||
// WriteBool(getPLC(ControlAdress.下降).PlcAddress,false); | |||
WriteBool(getPLC(ControlAdress.上升).PlcAddress,true); | |||
} | |||
LogUtils.d(TAG+"升降电机控制 setUpdDownMotor status="+status); | |||
} | |||
/** | |||
* 升降电机复位 | |||
* @param status 1 上升 2下降 | |||
*/ | |||
public boolean readUpdDownStop(int status){ | |||
if(status == 2){ | |||
NewToastUtil.getInstance().showToast("工序: 搅拌爪正在下降"); | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.下降).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
}else { | |||
NewToastUtil.getInstance().showToast("工序: 搅拌爪正在上升"); | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.上升).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
} | |||
/** | |||
* 搅拌电机控制 | |||
@@ -373,18 +404,48 @@ public class ModbusHelper extends ModbusMaster { | |||
*/ | |||
public void setStirMotor(int position,int status){ | |||
if(status == 2){ | |||
// WriteBool(getPLC(ControlAdress.搅拌正转).PlcAddress,false); | |||
WriteBool(getPLC(ControlAdress.搅拌停止).PlcAddress,true); | |||
}else { | |||
//TODO 搅拌档位 | |||
WriteShort(getPLC(ControlAdress.搅拌档位).PlcAddress, (short) (position*10)); | |||
WriteBool(getPLC(ControlAdress.搅拌启动).PlcAddress,true); | |||
// WriteBool(getPLC(ControlAdress.搅拌停止).PlcAddress,false); | |||
} | |||
LogUtils.d(TAG+"搅拌电机控制 setStirMotor status="+status); | |||
} | |||
/** | |||
* 搅拌电机控制 | |||
* @param type 1 正转时间 2反转时间 | |||
* @param time | |||
*/ | |||
public void setStirTime(int type,int time){ | |||
if(type == 2){ | |||
WriteShort(getPLC(ControlAdress.正转时间).PlcAddress, (short) time); | |||
}else { | |||
WriteShort(getPLC(ControlAdress.反转时间).PlcAddress, (short) time); | |||
} | |||
LogUtils.d(TAG+"搅拌电机控制 setStirTime type="+";time="+time); | |||
} | |||
/** | |||
* 搅拌模式 | |||
* @param type 0正转 1反转 2正反交替 | |||
*/ | |||
public void setStirModel(int type){ | |||
WriteShort(getPLC(ControlAdress.搅拌模式).PlcAddress, (short) (type)); | |||
LogUtils.d(TAG+"搅拌模式 setStirModel type="+type); | |||
} | |||
/** | |||
* 搅拌停止 | |||
*/ | |||
public boolean setStirStop(){ | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.搅拌模式).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
// LogUtils.d(TAG+"搅拌模式 setStirStop "); | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
public PLCModel getPLC(ControlAdress func){ | |||
if(controlAddress.containsKey(func)){ | |||
@@ -395,8 +456,6 @@ public class ModbusHelper extends ModbusMaster { | |||
} | |||
} | |||
public NotifyPropVar<Boolean> IsRunning=new NotifyPropVar<Boolean>(false); | |||
public int CurrentTime=0; | |||
@@ -454,28 +513,89 @@ public class ModbusHelper extends ModbusMaster { | |||
} | |||
public void reset(){ | |||
Executor.get().runThread(()->{ | |||
try { | |||
Thread.sleep(200); | |||
Heating(0,false); | |||
setStirMotor(0,2); | |||
setUpdDownMotor(1); | |||
setCookStatus(false); | |||
} catch (InterruptedException e) { | |||
throw new RuntimeException(e); | |||
try { | |||
Heating(0,false); | |||
setStirMotor(0,2); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:setStirStop(); | |||
} | |||
}); | |||
setUpdDownMotor(1); | |||
setCookStatus(false); | |||
} catch (InterruptedException e) { | |||
throw new RuntimeException(e); | |||
} | |||
} | |||
/** | |||
* 设置炒制模式 | |||
*/ | |||
public void setCookStatus(boolean isCooking){ | |||
Executor.get().runThread(()->{ | |||
WriteBool(getPLC(ControlAdress.炒制模式).PlcAddress,isCooking); | |||
LogUtils.d(TAG+"炒制模式 Cooking isCooking="+isCooking); | |||
}); | |||
WriteBool(getPLC(ControlAdress.炒制模式).PlcAddress,isCooking); | |||
LogUtils.d(TAG+"炒制模式 Cooking isCooking="+isCooking); | |||
} | |||
/** | |||
* 报警信息复位 | |||
*/ | |||
public void setErrorReset(){ | |||
WriteBool(getPLC(ControlAdress.上升超时报警).PlcAddress,false); | |||
WriteBool(getPLC(ControlAdress.下降超时报警).PlcAddress,false); | |||
WriteBool(getPLC(ControlAdress.升降传感器异常).PlcAddress,false); | |||
WriteBool(getPLC(ControlAdress.搅拌传感器异常).PlcAddress,false); | |||
} | |||
/** | |||
* 上升超时报警 | |||
* @return | |||
*/ | |||
public boolean getUpError(){ | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.上升超时报警).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
/** | |||
* 下降超时报警 | |||
* @return | |||
*/ | |||
public boolean getDownError(){ | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.下降超时报警).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
/** | |||
* 升降传感器异常 | |||
* @return | |||
*/ | |||
public boolean getUpDownError(){ | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.升降传感器异常).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
/** | |||
* 搅拌传感器异常 | |||
* @return | |||
*/ | |||
public boolean getStirError(){ | |||
OperateResultT<Boolean> resultT = ReadBool(getPLC(ControlAdress.搅拌传感器异常).PlcAddress); | |||
if(resultT == null){ | |||
return false; | |||
} | |||
return resultT.Content != null && resultT.Content; | |||
} | |||
/** | |||
@@ -547,6 +667,25 @@ public class ModbusHelper extends ModbusMaster { | |||
public boolean getDisconnect(){ | |||
return isDisconnect; | |||
} | |||
public boolean hasErrorInfo(){ | |||
if(isBtnStop){ | |||
return true; | |||
} | |||
if(ModbusHelper.get().getUpError()){ | |||
return true; | |||
} | |||
if(ModbusHelper.get().getDownError()){ | |||
return true; | |||
} | |||
if(ModbusHelper.get().getUpDownError()){ | |||
return true; | |||
} | |||
if(ModbusHelper.get().getStirError()){ | |||
return true; | |||
} | |||
return false; | |||
} | |||
} | |||
@@ -34,7 +34,6 @@ import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.BottomNavigationBar; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.ui.activity.EditClassifyActivity; | |||
import com.bonait.bnframework.ui.fragment.HomeDevicesFragment; | |||
import com.bonait.bnframework.ui.fragment.HomeFoodsFragment; | |||
import com.bonait.bnframework.ui.fragment.HomeMainFragment; | |||
@@ -512,6 +511,8 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||
// ExecuteTheRecipe.WritePLC("暂停开关",false,null); | |||
if (Status) { | |||
onRecordStart(); | |||
}else { | |||
onRecordStop(); | |||
} | |||
// else { | |||
// onRecordStop(); | |||
@@ -652,9 +653,9 @@ public class BottomNavigationNewActivity extends BaseActivity { | |||
} | |||
} | |||
public void jumpClassifyActivity(){ | |||
Intent intent = new Intent(BottomNavigationNewActivity.this, EditClassifyActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivityForResult(intent,REQUEST_CLASSIFY_ACTIVITY); | |||
} | |||
// public void jumpClassifyActivity(){ | |||
// Intent intent = new Intent(BottomNavigationNewActivity.this, EditClassifyActivity.class); | |||
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
// startActivityForResult(intent,REQUEST_CLASSIFY_ACTIVITY); | |||
// } | |||
} |
@@ -43,36 +43,26 @@ import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.test.TestActivity; | |||
import com.bonait.bnframework.ui.activity.MainActivity; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpParams; | |||
import com.mobsandgeeks.saripaar.ValidationError; | |||
import com.mobsandgeeks.saripaar.Validator; | |||
import com.mobsandgeeks.saripaar.annotation.NotEmpty; | |||
import com.mobsandgeeks.saripaar.annotation.Order; | |||
import com.mobsandgeeks.saripaar.annotation.Password; | |||
import com.qmuiteam.qmui.util.QMUIStatusBarHelper; | |||
import org.litepal.LitePal; | |||
import java.util.List; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
public class LoginActivity extends BaseActivity implements Validator.ValidationListener { | |||
public class LoginActivity extends BaseActivity{ | |||
// @BindView(R.id.logo) | |||
// ImageView mLogo; | |||
@Order(1) | |||
@NotEmpty(message = "用户名不能为空") | |||
@BindView(R.id.et_account) | |||
EditText mEtAccount; | |||
@Order(2) | |||
@NotEmpty(message = "密码不能为空") | |||
@Password(min = 1, scheme = Password.Scheme.ANY,message = "密码不能少于1位") | |||
@BindView(R.id.et_password) | |||
EditText mEtPassword; | |||
@@ -105,7 +95,6 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
private int height = 0; | |||
boolean isCheckBox; | |||
private Validator validator; | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
@@ -116,8 +105,6 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
QMUIStatusBarHelper.setStatusBarLightMode(this); | |||
initView(); | |||
validator = new Validator(this); | |||
validator.setValidationListener(this); | |||
initUser(); | |||
initEvent(); | |||
@@ -172,8 +159,11 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
forgotPassword(); | |||
break; | |||
case R.id.btn_login: | |||
// 登录,启动表单验证,重写方法:onValidationSucceeded | |||
validator.validate(); | |||
if(mEtAccount.getText().toString().isEmpty() || mEtPassword.getText().toString().isEmpty()){ | |||
NewToastUtil.getInstance().showToast("账号或密码不能为空"); | |||
return; | |||
} | |||
attemptLogin(); | |||
break; | |||
} | |||
} | |||
@@ -372,7 +362,8 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
startActivity(intent); | |||
}else | |||
{ | |||
Intent intent = new Intent(LoginActivity.this, BottomNavigationNewActivity.class); | |||
// Intent intent = new Intent(LoginActivity.this, BottomNavigationNewActivity.class); | |||
Intent intent = new Intent(LoginActivity.this, MainActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
@@ -503,27 +494,6 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL | |||
}); | |||
} | |||
@Override | |||
public void onValidationSucceeded() { | |||
// 注解验证全部通过验证,开始后台验证 | |||
attemptLogin(); | |||
} | |||
@Override | |||
public void onValidationFailed(List<ValidationError> errors) { | |||
for (ValidationError error : errors) { | |||
View view = error.getView(); | |||
String message = error.getCollatedErrorMessage(this); | |||
// 显示上面注解中添加的错误提示信息 | |||
if (view instanceof EditText) { | |||
((EditText) view).setError(message); | |||
} else { | |||
ToastUtils.error(message); | |||
} | |||
} | |||
} | |||
/** | |||
* 重写返回键,实现双击退出程序效果 | |||
*/ | |||
@@ -19,6 +19,7 @@ import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ScreenUtils; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.test.TestActivity; | |||
import com.bonait.bnframework.ui.activity.MainActivity; | |||
import com.lzy.okgo.OkGo; | |||
import okhttp3.OkHttpClient; | |||
@@ -65,7 +66,8 @@ public class WelcomeActivity extends BaseActivity { | |||
startActivity(intent1); | |||
}else | |||
{ | |||
Intent intent2 = new Intent(WelcomeActivity.this, BottomNavigationNewActivity.class); | |||
// Intent intent2 = new Intent(WelcomeActivity.this, BottomNavigationNewActivity.class); | |||
Intent intent2 = new Intent(WelcomeActivity.this, MainActivity.class); | |||
intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent2); | |||
} | |||
@@ -14,7 +14,6 @@ import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.BottomNavigationNewActivity; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.DishTestActivity; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.LoginActivity; | |||
import com.bonait.bnframework.ViewModel.CustomView.XComDialog; | |||
@@ -25,6 +24,7 @@ import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.ui.activity.MainActivity; | |||
import com.bonait.bnframework.ui.activity.SetSeasoningActivity; | |||
import com.orhanobut.logger.Logger; | |||
@@ -73,7 +73,8 @@ public class Home4Fragment extends BaseFragment { | |||
switch (view.getId()) { | |||
case R.id.kaishipengren: | |||
// MessageManager.getInstance().sendMessage(MessageName.SelectZY, 0); | |||
((BottomNavigationNewActivity)getActivity()).jumpClassifyActivity(); | |||
// ((BottomNavigationNewActivity)getActivity()).jumpClassifyActivity(); | |||
((MainActivity)getActivity()).jumpClassifyActivity(); | |||
break; | |||
case R.id.shebeikongzhi: | |||
MessageManager.getInstance().sendMessage(MessageName.SelectZY, 2); | |||
@@ -281,7 +281,7 @@ public class HomeDeviceFragment extends BaseFragment { | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(2))); | |||
break; | |||
case R.id.startStir: | |||
ToastUtils.info("开始搅拌 档位:"+progressStir); | |||
ToastUtils.info("启动搅拌 档位:"+progressStir); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(progressStir,1))); | |||
break; | |||
case R.id.stopStir: | |||
@@ -79,7 +79,11 @@ public class ConfigData { | |||
public static synchronized ConfigData getInstance() { //静态同步方法作为唯一的实例对象获取方式 | |||
if (mInstance == null) { | |||
mInstance = new ConfigData(); | |||
synchronized (ConfigData.class){ | |||
if(mInstance == null){ | |||
mInstance = new ConfigData(); | |||
} | |||
} | |||
} | |||
return mInstance; | |||
} | |||
@@ -149,7 +149,7 @@ public class ExecuteTheRecipe { | |||
if (recipe.materialType == 0)//正常物料 | |||
{ | |||
ExecuteOperationSteps(selectpf.processname, selectpf.processvalue); | |||
// ExecuteOperationSteps(selectpf.processname, selectpf.processvalue); | |||
ExecuteMaterialIssuance(recipe.processvalue); | |||
} else if (recipe.materialType == 1)//工序模型 | |||
{ | |||
@@ -282,9 +282,12 @@ public class ExecuteTheRecipe { | |||
if (formulation.size() > 0) { | |||
LogUtils.d("ExecuteOperationSteps 执行工序步骤 processname="+processname+"; formulation="+formulation); | |||
switch (processname) { | |||
case "搅拌": | |||
case "单向搅拌": | |||
Write_PLC_Stir(formulation); | |||
break; | |||
case "双向搅拌": | |||
Write_PLC_Stir2(formulation); | |||
break; | |||
// case "位置": | |||
// Write_PLC_Location(formulation); | |||
// break; | |||
@@ -387,6 +390,7 @@ public class ExecuteTheRecipe { | |||
try { | |||
int val = 0; | |||
int position = 0; | |||
int type = 0; | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
@@ -395,8 +399,13 @@ public class ExecuteTheRecipe { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("搅拌档位")){ | |||
position = Integer.parseInt(value); | |||
}else if(key.contains("正转")){ | |||
type= 0; | |||
}else if(key.contains("反转")){ | |||
type=1; | |||
} | |||
} | |||
ModbusHelper.get().setStirModel(type); | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
@@ -410,6 +419,15 @@ public class ExecuteTheRecipe { | |||
ModbusHelper.get().setStirMotor(position,1); | |||
}else { | |||
ModbusHelper.get().setStirMotor(0,2); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
} | |||
} | |||
} | |||
} | |||
@@ -423,6 +441,65 @@ public class ExecuteTheRecipe { | |||
} | |||
} | |||
private static void Write_PLC_Stir2(HashMap<String, String> data) { | |||
try { | |||
int val = 0; | |||
int position = 0; | |||
int time1 = 0; | |||
int time2 = 0; | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("(秒)")) { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("搅拌档位")){ | |||
position = Integer.parseInt(value); | |||
}else if(key.contains("正转时间")){ | |||
time1= Integer.parseInt(value); | |||
}else if(key.contains("反转时间")){ | |||
time2= Integer.parseInt(value); | |||
} | |||
} | |||
ModbusHelper.get().setStirModel(2); | |||
ModbusHelper.get().setStirTime(1,time1); | |||
ModbusHelper.get().setStirTime(2,time2); | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("搅拌控制")) { | |||
ToastUtils.info("工序:" + key + "," + value); | |||
if (ExecuteCurrentOperation != null) { | |||
ExecuteCurrentOperation.Run("搅拌" + "|" + value); | |||
} | |||
if(value.contains("启动")){ | |||
ModbusHelper.get().setStirMotor(position,1); | |||
}else { | |||
ModbusHelper.get().setStirMotor(0,2); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
} | |||
} | |||
} | |||
} | |||
if (val > 0) { | |||
Thread.sleep(val * 1000); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 写PLC位置 | |||
* | |||
@@ -900,7 +977,19 @@ public class ExecuteTheRecipe { | |||
// } | |||
// Thread.sleep(100);//10 *6 | |||
// } | |||
ModbusHelper.get().Heating(0,false); | |||
ModbusHelper.get().setStirMotor(0,2); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().setStirStop(); | |||
} | |||
ModbusHelper.get().setUpdDownMotor(1); | |||
ModbusHelper.get().setCookStatus(false); | |||
ToastUtils.info("出菜完成,结束制作!"); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -1022,8 +1111,26 @@ public class ExecuteTheRecipe { | |||
}else if(key.contains("升降")){ | |||
if(value.contains("升")){ | |||
ModbusHelper.get().setUpdDownMotor(1); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(1); | |||
} | |||
}else { | |||
ModbusHelper.get().setUpdDownMotor(2); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(2); | |||
} | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,806 @@ | |||
package com.bonait.bnframework.business; | |||
import android.util.Log; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.event.ProcessMakingEvent; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 执行配方 | |||
*/ | |||
public class NewExecuteTheRecipe { | |||
/** | |||
* 液体等待超时时间 | |||
*/ | |||
public static int whileTime = 40; | |||
/** | |||
* 主料等待超时时间 | |||
*/ | |||
public static int whileTimeFood = 10; | |||
/** | |||
* 商品是否强制结束 | |||
*/ | |||
public static boolean IsForcedEnd = false; | |||
/** | |||
* 是否启动 | |||
*/ | |||
public static boolean IsStart = false; | |||
/** | |||
* 是否是模拟 | |||
*/ | |||
public static boolean isTest; | |||
/** | |||
* 设置强制结束 | |||
*/ | |||
public static void setForcedEnd() { | |||
NewToastUtil.getInstance().showToast("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!"); | |||
IsForcedEnd = true; | |||
ModbusHelper.get().reset(); | |||
} | |||
/** | |||
* 停止强制结束 | |||
*/ | |||
public static void StopForcedEnd() { | |||
IsForcedEnd = false; | |||
} | |||
/** | |||
* 执行配方 | |||
* | |||
* @param recipe | |||
* @return | |||
*/ | |||
public static boolean Execute(BPA_GOODS_PROCESS_DETAIL recipe) { | |||
boolean status = false; | |||
try { | |||
if (IsForcedEnd) { | |||
NewToastUtil.getInstance().showToast("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!"); | |||
return false; | |||
} | |||
LogUtils.d("开始执行 "+ recipe.sort + "、" + recipe.processms); | |||
NewToastUtil.getInstance().showToast("开始执行:" + recipe.sort + "、" + recipe.processms); | |||
if (recipe.materialType == 0)//液体料 | |||
{ | |||
ExecuteMaterialIssuance(recipe.processvalue); | |||
} else if (recipe.materialType == 1)//工序模型 | |||
{ | |||
ExecuteOperationSteps(recipe.processname, recipe.processvalue); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
status = false; | |||
} finally { | |||
return status; | |||
} | |||
} | |||
/** | |||
* 液体物料信息-配料 | |||
* | |||
* @param text | |||
*/ | |||
public static void ExecuteMaterialIssuance(String text) { | |||
try { | |||
if (!text.isEmpty()) { | |||
//仓号 值 | |||
HashMap<BPA_SILOS, Integer> formulation = new HashMap<>(); | |||
//region 获取仓号和值 | |||
List<String> data = new ArrayList<>(); | |||
if (text.contains("|")) { | |||
String[] res = text.split("[|]"); | |||
for (int i = 0; i < res.length; i++) { | |||
data.add(res[i]); | |||
} | |||
} else { | |||
data.add(text); | |||
} | |||
for (String item : data) { | |||
if (!item.isEmpty() && item.contains(",")) { | |||
String[] wl = item.split("[,]"); | |||
if (wl != null && wl.length == 2) { | |||
String name = wl[0]; | |||
int val = 0; | |||
if(wl[1].contains(".")){ | |||
val = (int) Math.round((Double.parseDouble(wl[1]))); | |||
}else { | |||
val = Integer.parseInt(wl[1]); | |||
} | |||
List<BPA_SILOS> bpa_silos = QueryDB.GetSolisByMaterialName(name); | |||
if (bpa_silos.size() > 0 && val > 0) { | |||
BPA_SILOS silos = bpa_silos.get(0); | |||
silos.name = name; | |||
formulation.put(silos, val); | |||
} | |||
} | |||
} | |||
} | |||
//endregion | |||
//写入PLC,直接出料,不用等待 | |||
HashMap<Integer,Boolean> recordMap = new HashMap<Integer, Boolean>(); | |||
for (Map.Entry<BPA_SILOS, Integer> entry : formulation.entrySet()) { | |||
BPA_SILOS silos = entry.getKey(); | |||
Integer value = entry.getValue(); | |||
addMaterial(silos, value); | |||
recordMap.put(value,false); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"调料")); | |||
boolean isCHeckSilosEnd = false;//所有液体料是否复位 | |||
long a = System.currentTimeMillis(); | |||
LogUtils.d("wait reset 物料开始时间 "+System.currentTimeMillis()); | |||
while (IsStart && !isCHeckSilosEnd && !isTest){//等待出料完成 | |||
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { | |||
break; | |||
}else { | |||
for (Map.Entry<BPA_SILOS, Integer> entry : formulation.entrySet()) { | |||
BPA_SILOS silos = entry.getKey(); | |||
Integer value = entry.getValue(); | |||
recordMap.put(value,ConfigName.TEST?false:waiteMaterial(silos));//false表示复位了 | |||
} | |||
boolean isEnd = true; | |||
for (HashMap.Entry<Integer,Boolean> entry : recordMap.entrySet()) { | |||
Boolean value = entry.getValue(); | |||
if(value){ | |||
isEnd = false; | |||
} | |||
} | |||
isCHeckSilosEnd = isEnd; | |||
Thread.sleep(50); | |||
} | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"完成")); | |||
LogUtils.d("wait reset 物料结束时间 "+(System.currentTimeMillis()-a)); | |||
NewToastUtil.getInstance().showToast("投料完成"); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 执行工序步骤 | |||
* | |||
* @param text | |||
*/ | |||
public static void ExecuteOperationSteps(String processname, String text) { | |||
try { | |||
if (!text.isEmpty() && !processname.isEmpty()) { | |||
//工序名称和值 | |||
HashMap<String, String> formulation = new HashMap<>(); | |||
//region 获取仓号和值 | |||
List<String> data = new ArrayList<>(); | |||
if (text.contains("|")) { | |||
String[] res = text.split("[|]"); | |||
for (int i = 0; i < res.length; i++) { | |||
data.add(res[i]); | |||
} | |||
} else { | |||
data.add(text); | |||
} | |||
for (String item : data) { | |||
if (!item.isEmpty() && item.contains(",")) { | |||
String[] wl = item.split("[,]"); | |||
if (wl != null && wl.length == 2) { | |||
String name = wl[0]; | |||
String val = wl[1]; | |||
formulation.put(name, val); | |||
} | |||
} | |||
} | |||
//endregion | |||
//写入PLC | |||
if (formulation.size() > 0) { | |||
LogUtils.d("ExecuteOperationSteps 执行工序步骤 processname="+processname+"; formulation="+formulation); | |||
switch (processname) { | |||
case "单向搅拌": | |||
Write_PLC_Stir(formulation); | |||
break; | |||
case "双向搅拌": | |||
Write_PLC_Stir2(formulation); | |||
break; | |||
case "加热": | |||
Write_PLC_Heating(formulation); | |||
break; | |||
case "主料": | |||
Write_PLC_MainFood(formulation); | |||
break; | |||
case "加水": | |||
Write_PLC_Water(formulation); | |||
break; | |||
case "延迟": | |||
Write_PLC_Delay(formulation); | |||
break; | |||
case "勾芡": | |||
Write_PLC_addThickenWater(formulation); | |||
break; | |||
case "升降": | |||
Write_PLC_setUpdDownMotor(formulation); | |||
break; | |||
case "出菜": | |||
Write_PLC_Outdishes(formulation); | |||
break; | |||
} | |||
} | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 添加液体料 | |||
* @param silos | |||
* @param val | |||
*/ | |||
private static void addMaterial(BPA_SILOS silos, int val) { | |||
try { | |||
NewToastUtil.getInstance().showToast("调料:"+silos.num+"号仓," + silos.name + ",重量" + val+"g"); | |||
ModbusHelper.get().addMaterial(val,silos.num,false); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 等待液体料复位 | |||
* @param silos | |||
* @return | |||
*/ | |||
private static boolean waiteMaterial(BPA_SILOS silos){ | |||
boolean isEnd = false; | |||
try { | |||
NewToastUtil.getInstance().showToast("调料:"+silos.name+",正在出调"); | |||
isEnd = ModbusHelper.get().readMaterial(silos.num); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
return isEnd; | |||
} | |||
/** | |||
* 写PLC搅拌 单向 | |||
* | |||
* @param data | |||
*/ | |||
private static void Write_PLC_Stir(HashMap<String, String> data) { | |||
try { | |||
int val = 0; | |||
int position = 0; | |||
int type = 0; | |||
String dang = ""; | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("(秒)")) { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("搅拌档位")){ | |||
dang = value; | |||
if(value.contains("档")){ | |||
position = Integer.parseInt(value.replace("档",""))*10; | |||
}else { | |||
position = Integer.parseInt(value)*10; | |||
} | |||
}else if(key.contains("正转")){ | |||
type= 0; | |||
}else if(key.contains("反转")){ | |||
type=1; | |||
} | |||
} | |||
String tip = type==0?"正转":"反转"; | |||
NewToastUtil.getInstance().showToast("工序:" + "搅拌控制," + tip+";档位,"+dang+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().setStirModel(type); | |||
} | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("搅拌控制")) { | |||
NewToastUtil.getInstance().showToast("工序:" + key + "," + value); | |||
if(value.contains("启动")){ | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"启动搅拌")); | |||
if(!isTest){ | |||
ModbusHelper.get().setStirMotor(position,1); | |||
} | |||
}else { | |||
if(!isTest){ | |||
ModbusHelper.get().setStirMotor(0,2); | |||
} | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop && !isTest){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
Thread.sleep(50); | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"停止搅拌")); | |||
} | |||
} | |||
} | |||
if (val > 0) { | |||
Thread.sleep(val * 1000L); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 双向搅拌 | |||
* @param data | |||
*/ | |||
private static void Write_PLC_Stir2(HashMap<String, String> data) { | |||
try { | |||
int val = 0; | |||
int position = 0; | |||
int time1 = 0; | |||
int time2 = 0; | |||
String dang = ""; | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("(秒)")) { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("搅拌档位")){ | |||
dang = value; | |||
if(value.contains("档")){ | |||
position = Integer.parseInt(value.replace("档",""))*10; | |||
}else { | |||
position = Integer.parseInt(value)*10; | |||
} | |||
}else if(key.contains("正转时间")){ | |||
time1= Integer.parseInt(value); | |||
}else if(key.contains("反转时间")){ | |||
time2= Integer.parseInt(value); | |||
} | |||
} | |||
NewToastUtil.getInstance().showToast("工序:" + "搅拌控制,正反转切换;档位,"+dang+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().setStirModel(2); | |||
ModbusHelper.get().setStirTime(1,time1); | |||
ModbusHelper.get().setStirTime(2,time2); | |||
} | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("搅拌控制")) { | |||
NewToastUtil.getInstance().showToast("工序:" + key + "," + value); | |||
if(value.contains("启动")){ | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"启动搅拌")); | |||
if(!isTest){ | |||
ModbusHelper.get().setStirMotor(position,1); | |||
} | |||
}else { | |||
if(!isTest){ | |||
ModbusHelper.get().setStirMotor(0,2); | |||
} | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop &&!isTest){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
Thread.sleep(50); | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"停止搅拌")); | |||
} | |||
} | |||
} | |||
if (val > 0) { | |||
Thread.sleep(val * 1000L); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 写PLC主料 | |||
* | |||
* @param data | |||
*/ | |||
private static void Write_PLC_MainFood(HashMap<String, String> data) { | |||
try { | |||
//判断是否有烹饪时间 | |||
int val = 0; | |||
int position = 1;//几号位 | |||
String name = "";//主料名称 | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("(秒)")) { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("名称")){ | |||
name = value; | |||
}else if(key.contains("位置")){ | |||
position = Integer.parseInt(value.replace("号位","")); | |||
} | |||
} | |||
NewToastUtil.getInstance().showToast("工序: 投入主料名称:"+name + " 主料位置:" + position); | |||
EventBus.getDefault().post(new ProcessMakingEvent(3,position+"|"+name)); | |||
if(!isTest){ | |||
ModbusHelper.get().addMainFood(position); | |||
} | |||
if (val > 0) { | |||
Thread.sleep(val * 1000L); | |||
} | |||
boolean isCHeckSilosEnd = false;//主料是否复位 | |||
long a = System.currentTimeMillis(); | |||
while (IsStart && !isCHeckSilosEnd && !isTest){ | |||
if ((System.currentTimeMillis() - a) > 1000L * whileTimeFood) { | |||
break; | |||
}else { | |||
isCHeckSilosEnd= ConfigName.TEST?true:Read_MainFood(position); | |||
Thread.sleep(50); | |||
} | |||
} | |||
if(isTest){ | |||
Thread.sleep(1000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(3,"完成")); | |||
Log.d("烹饪时间", "烹饪时间完成了"); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 读取主料是否复位 | |||
* @param position | |||
* @return | |||
*/ | |||
private static boolean Read_MainFood(int position){ | |||
boolean isEnd = false; | |||
try { | |||
isEnd = ModbusHelper.get().readMainFood(position); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
return isEnd; | |||
} | |||
/** | |||
* 写PLC 加热 | |||
* | |||
* @param data | |||
*/ | |||
private static void Write_PLC_Heating(HashMap<String, String> data) { | |||
try { | |||
int val = 0; | |||
int hotNum = 0;//加热档位 | |||
String dang = ""; | |||
boolean startHot = false;//是否启动加热 | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("(秒)")) { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("档位")){ | |||
dang = value; | |||
if(value.contains("档")){ | |||
hotNum = Integer.parseInt(value.replace("档",""))*10; | |||
}else { | |||
hotNum = Integer.parseInt(value)*10; | |||
} | |||
}else { | |||
if(value.contains("启动")){ | |||
startHot = true; | |||
}else { | |||
startHot= false; | |||
} | |||
} | |||
} | |||
String tip = startHot? "启动加热":"停止加热"; | |||
NewToastUtil.getInstance().showToast("工序:" + "加热控制," + tip+";档位,"+dang+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().Heating(hotNum,startHot); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(1,tip+"|"+dang)); | |||
if (val > 0) { | |||
Thread.sleep(val * 1000L); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 写PLC加水 | |||
* | |||
* @param data | |||
*/ | |||
private static void Write_PLC_Water(HashMap<String, String> data) { | |||
try { | |||
int val = 0; | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("(克)")) { | |||
val = Integer.parseInt(value); | |||
} | |||
} | |||
if (val > 0) { | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"加水")); | |||
if(!isTest){ | |||
ModbusHelper.get().addWater(val,false); | |||
} | |||
boolean isCHeckSilosEnd = false;//所有液体料是否复位 | |||
long a = System.currentTimeMillis(); | |||
LogUtils.d("wait reset 开始加水时间 "+System.currentTimeMillis()); | |||
while (IsStart && !isCHeckSilosEnd && !isTest){ | |||
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { | |||
break; | |||
}else { | |||
isCHeckSilosEnd = !Read_Water(); | |||
Thread.sleep(100); | |||
} | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"完成")); | |||
LogUtils.d("wait reset 结束加水时间 "+(System.currentTimeMillis()-a)); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 等待加水复位 | |||
* @return | |||
*/ | |||
private static boolean Read_Water(){ | |||
boolean isEnd = false; | |||
try { | |||
NewToastUtil.getInstance().showToast("液体:" + "正在出水"); | |||
isEnd = ModbusHelper.get().readWater(); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
return isEnd; | |||
} | |||
/** | |||
* 写PLC 延迟 | |||
* | |||
* @param data | |||
*/ | |||
private static void Write_PLC_Delay(HashMap<String, String> data) { | |||
try { | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
NewToastUtil.getInstance().showToast("工序:" + "等待"+value+"秒"); | |||
if (key.contains("(秒)")) { | |||
int val = Integer.parseInt(value); | |||
Thread.sleep(val * 1000); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 写PLC 出菜 | |||
* | |||
* @param data | |||
*/ | |||
private static void Write_PLC_Outdishes(HashMap<String, String> data) { | |||
try { | |||
//先延迟 | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
NewToastUtil.getInstance().showToast("工序: 等待"+value+"秒后出菜"); | |||
if (key.contains("(秒)")) { | |||
int val = Integer.parseInt(value); | |||
Thread.sleep(val * 1000); | |||
} | |||
} | |||
ModbusHelper.get().Heating(0,false); | |||
ModbusHelper.get().setStirMotor(0,2); | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().setStirStop(); | |||
Thread.sleep(100); | |||
} | |||
ModbusHelper.get().setUpdDownMotor(1); | |||
ModbusHelper.get().setCookStatus(false); | |||
NewToastUtil.getInstance().showToast("出菜完成,结束制作!"); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 写PLC 勾芡 | |||
* | |||
* @param data | |||
*/ | |||
private static void Write_PLC_addThickenWater(HashMap<String, String> data) { | |||
try { | |||
//先延迟 | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
NewToastUtil.getInstance().showToast("工序:" + key + "," + value); | |||
if (key.contains("(克)")) { | |||
int val = Integer.parseInt(value); | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"勾芡")); | |||
if(!isTest){ | |||
ModbusHelper.get().addThickenWater(val,false); | |||
} | |||
boolean isCHeckSilosEnd = false;//所有液体料是否复位 | |||
long a = System.currentTimeMillis(); | |||
LogUtils.d("wait reset 开始勾芡时间 "+System.currentTimeMillis()); | |||
while (IsStart && !isCHeckSilosEnd&&!isTest){ | |||
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { | |||
break; | |||
}else { | |||
isCHeckSilosEnd = !Read_ThickenWater(); | |||
Thread.sleep(100); | |||
} | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"完成")); | |||
LogUtils.d("wait reset 结束勾芡时间 "+(System.currentTimeMillis()-a)); | |||
} | |||
} | |||
NewToastUtil.getInstance().showToast("出菜完成,结束制作!"); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 等待勾芡复位 | |||
* @return | |||
*/ | |||
private static boolean Read_ThickenWater(){ | |||
boolean isEnd = false; | |||
try { | |||
NewToastUtil.getInstance().showToast("液体:" + "正在勾芡"); | |||
isEnd = ModbusHelper.get().readThickenWater(); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
return isEnd; | |||
} | |||
/** | |||
* 写PLC 升降 | |||
* | |||
* @param data | |||
*/ | |||
private static void Write_PLC_setUpdDownMotor(HashMap<String, String> data) { | |||
try { | |||
int val = 0; | |||
//先延迟 | |||
for (HashMap.Entry<String, String> entry : data.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (key.contains("(秒)")) { | |||
val = Integer.parseInt(value); | |||
}else if(key.contains("升降")){ | |||
if(value.contains("升")){ | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"上升")); | |||
if(!isTest){ | |||
ModbusHelper.get().setUpdDownMotor(1); | |||
} | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop&&!isTest){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(1); | |||
Thread.sleep(100); | |||
} | |||
if(isTest){ | |||
Thread.sleep(8000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"升降完成")); | |||
}else { | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"下降")); | |||
if(!isTest){ | |||
ModbusHelper.get().setUpdDownMotor(2); | |||
} | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop && !isTest){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(2); | |||
Thread.sleep(100); | |||
} | |||
if(isTest){ | |||
Thread.sleep(8000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"升降完成")); | |||
} | |||
} | |||
} | |||
if(val > 0){ | |||
Thread.sleep(val * 1000L); | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
} |
@@ -832,7 +832,8 @@ public class ConfigName { | |||
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("延迟(秒)"))); | |||
@@ -873,6 +874,8 @@ public class ConfigName { | |||
data = "上升、下降"; | |||
} else if (item.equals("搅拌控制") ) { | |||
data = "启动搅拌、停止搅拌"; | |||
} else if (item.equals("方向选择") ) { | |||
data = "正转、反转"; | |||
} | |||
return data; | |||
@@ -22,7 +22,7 @@ public class BPA_GOODS_PROCESS_DETAIL extends ModeBase{ | |||
/** | |||
* 物料类型 0:正常物料 1:工序模型 2:果糖 代码中判断液体料则为0 | |||
*/ | |||
public int materialType; | |||
public int materialType = 1; | |||
/** | |||
* 模型描述 加热(10,启动加热,10) | |||
*/ | |||
@@ -79,6 +79,20 @@ public class GoodsDBUtil { | |||
return obj.size() > 0 ? (BPA_GOODS) obj.get(0) : null; | |||
} | |||
/** | |||
* 根据商品id获取商品 | |||
* | |||
* @param id | |||
* @return BPA_GOODS | |||
*/ | |||
public static BPA_GOODS getByIdAndClassifyId(String id,String classifyId) { | |||
String orderby = QueryDB.Desc_Sort_Up; | |||
String where = "isDelete=? and id=? and classifyId=?"; | |||
String[] args = new String[]{"0", id,classifyId}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS.class, where, args, orderby); | |||
return obj.size() > 0 ? (BPA_GOODS) obj.get(0) : null; | |||
} | |||
/** | |||
* 根据商品name获取商品 | |||
@@ -94,6 +108,20 @@ public class GoodsDBUtil { | |||
return obj.size() > 0 ? (BPA_GOODS) obj.get(0) : null; | |||
} | |||
/** | |||
* 根据商品name获取商品 | |||
* @param name | |||
* @return BPA_GOODS | |||
*/ | |||
public static BPA_GOODS getByNameAndClassifyId(String name,String classifyId) { | |||
String orderby = QueryDB.Desc_Sort_Up; | |||
String where = "isDelete=? and name=? and classifyId=?"; | |||
String[] args = new String[]{"0", name,classifyId}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS.class, where, args, orderby); | |||
return obj.size() > 0 ? (BPA_GOODS) obj.get(0) : null; | |||
} | |||
/** | |||
* 根据商品分类Id获取商品列表 | |||
@@ -0,0 +1,96 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/29 11:22. | |||
*/ | |||
public class MaterialUtil { | |||
/** | |||
* 获取所有物料信息 | |||
* | |||
* @return | |||
*/ | |||
public static ArrayList<BPA_MATERIAL> GetMaterialALL() { | |||
String orderby = QueryDB.Desc_Time_Up;//出料顺序 | |||
String where = "isDelete=?"; | |||
String[] args = new String[]{"0"}; | |||
ArrayList<BPA_MATERIAL> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_MATERIAL.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data.add((BPA_MATERIAL) k); | |||
} | |||
LogUtils.d("GetMaterialALL 获取所有物料信息 data="+data.toString()); | |||
return data; | |||
} | |||
/** | |||
* 批量新增 | |||
* @param c | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addMaterialList(Class c, List<BPA_MATERIAL> list) { | |||
if(list.isEmpty()){ | |||
return false; | |||
} | |||
QueryDB.lock.lock(); | |||
boolean isSucess = false; | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).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) { | |||
isSucess = false; | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return isSucess; | |||
} | |||
} |
@@ -183,4 +183,31 @@ public class CookTimeUtils { | |||
} | |||
return time>0?time:180; | |||
} | |||
/** | |||
* 将毫秒转化为 分钟:秒 的格式 100* 1000 | |||
* | |||
* @param millisecond 毫秒 | |||
* @return | |||
*/ | |||
public static String formatTime(long millisecond) { | |||
int minute;//分钟 | |||
int second;//秒数 | |||
minute = (int) ((millisecond / 1) / 60); | |||
second = (int) ((millisecond / 1) % 60); | |||
if (minute < 10) { | |||
if (second < 10) { | |||
return "0" + minute + " : " + "0" + second; | |||
} else { | |||
return "0" + minute + " : " + second; | |||
} | |||
} else { | |||
if (second < 10) { | |||
return minute + " : " + "0" + second; | |||
} else { | |||
return minute + " : " + second; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
package com.bonait.bnframework.event; | |||
/** | |||
* @author: liup | |||
* @description: 工序执行步骤事件 | |||
* @date: 2024/5/28 12:46. | |||
*/ | |||
public class ProcessMakingEvent { | |||
/** | |||
* 1加热 2液体 3主料 4搅拌 升降 | |||
*/ | |||
public int type; | |||
public String value; | |||
public ProcessMakingEvent(int type,String value){ | |||
this.type = type; | |||
this.value = value; | |||
} | |||
} |
@@ -1,338 +1,536 @@ | |||
//package com.bonait.bnframework.ui.activity; | |||
// | |||
//import android.app.Activity; | |||
//import android.content.Context; | |||
//import android.content.Intent; | |||
//import android.os.Bundle; | |||
//import android.view.View; | |||
// | |||
//import androidx.annotation.Nullable; | |||
//import androidx.core.content.ContextCompat; | |||
// | |||
//import com.apkfuns.logutils.LogUtils; | |||
//import com.bonait.bnframework.HBL.Interface.IRunT; | |||
//import com.bonait.bnframework.R; | |||
//import com.bonait.bnframework.ViewModel.CustomView.imagebuttom3; | |||
//import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
//import com.bonait.bnframework.common.base.BaseActivity; | |||
//import com.bonait.bnframework.common.constant.MessageName; | |||
//import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
//import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
//import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
//import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
//import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
//import com.bonait.bnframework.common.message.MessageManager; | |||
//import com.bonait.bnframework.common.utils.ToastUtils; | |||
//import com.bonait.bnframework.databinding.ActivityCookBinding; | |||
// | |||
//import butterknife.ButterKnife; | |||
//import butterknife.OnClick; | |||
// | |||
//public class CookingActivity extends BaseActivity { | |||
// | |||
// private ActivityCookBinding viewBinding; | |||
// | |||
// private Context contextMian; | |||
// private View root; | |||
// private StringBuffer stringBuffer1 = new StringBuffer(); | |||
// /** | |||
// * 商品id | |||
// */ | |||
// private String goodId = ""; | |||
// /** | |||
// * 子属性组合id 属性组合名称 | |||
// */ | |||
// private String subAttributeGroupId = ""; | |||
// private String subAttributeGroupName = ""; | |||
// private BPA_GOODS goods; | |||
// private BPA_GOODS_SUBATTRIBUTE_GROUP goodsSubattributeGroup; | |||
// | |||
// | |||
// @Override | |||
// protected void onCreate(@Nullable Bundle savedInstanceState) { | |||
// super.onCreate(savedInstanceState); | |||
// | |||
// viewBinding = ActivityCookBinding.inflate(getLayoutInflater()); | |||
// setContentView(viewBinding.getRoot()); | |||
// ButterKnife.bind(this); | |||
// initTopBar(); | |||
// SxUIThread(); | |||
// Intent intent = new Intent(); | |||
// goodId = intent.getStringExtra("goodId"); | |||
// subAttributeGroupId = intent.getStringExtra("subAttributeGroupId"); | |||
// subAttributeGroupName = intent.getStringExtra("subAttributeGroupName"); | |||
// goods = GoodsDBUtil.getById(goodId); | |||
// goodsSubattributeGroup = SubAttributeGroupDBUtil.getByGoodIdAndListId(goodId,subAttributeGroupId); | |||
// initData(); | |||
// } | |||
// | |||
// //region 公共方法 | |||
// | |||
// /** | |||
// * 初始化数据 | |||
// */ | |||
// public void initData( MyClickListener listener) { | |||
// String name = subAttributeGroupName.isEmpty()?goods.name:(goods.name+"-"+subAttributeGroupName); | |||
// viewBinding.goodname.setText(name); | |||
// viewBinding.startGoodmake.mListener = listener; | |||
// SetReset(); | |||
// SetRest1(); | |||
// SetProcess(goods.maketime, 0); | |||
// SetMiaoShu("等待开始..."); | |||
// LogUtils.d("制作时长goods.maketime="+goods.maketime); | |||
// viewBinding.runtime.setText(formatTime(goods.maketime)); | |||
// | |||
//// if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { | |||
//// touliao_k.setVisibility(View.GONE); | |||
//// touliao_m.setVisibility(View.GONE); | |||
//// device_image.setImageResource(R.mipmap.device00); | |||
//// }else | |||
//// { | |||
//// touliao_k.setVisibility(View.VISIBLE); | |||
//// touliao_m.setVisibility(View.VISIBLE); | |||
//// device_image.setImageResource(R.mipmap.device1); | |||
//// } | |||
// } | |||
// | |||
// /** | |||
// * 设置描述 | |||
// * | |||
// * @param text | |||
// */ | |||
// public void SetMiaoShu(String text) { | |||
// gongxumiaoshu.setText(text + ""); | |||
// stringBuffer1.append(" \n工序:"+text); | |||
// text1.setText(stringBuffer1+""); | |||
// } | |||
// | |||
// /** | |||
// * 设置进度条 | |||
// * | |||
// * @param | |||
// */ | |||
// public void SetProcess(int alltime, int usertime) { | |||
// try { | |||
// if(alltime!=0){ | |||
// t_jindu.SetValue((usertime * 100) / alltime); | |||
// } | |||
// runtime.setText(formatTime((alltime - usertime))); | |||
// } catch (Exception ex) { | |||
// LogUtils.d("异常信息:" + ex.getMessage()); | |||
// ToastUtils.error("异常信息:" + ex.getMessage()); | |||
// } | |||
// } | |||
// | |||
// /** | |||
// * 复位 | |||
// */ | |||
// public void SetReset() { | |||
// SetMiaoShu("等待开始..."); | |||
// stringBuffer1 = new StringBuffer(); | |||
//// zanting_goodmake.SetStatus(false); | |||
//// zanting_goodmake.setVisibility(View.GONE); | |||
// } | |||
// | |||
// /** | |||
// * 复位 | |||
// */ | |||
// public void SetZanTing(boolean data) { | |||
//// zanting_goodmake.setVisibility(data ? View.VISIBLE : View.GONE); | |||
// } | |||
// | |||
// public void SetRest1() { | |||
// stringBuffer1 = new StringBuffer(); | |||
// start_goodmake.SetStatus(false); | |||
// if(flicker_buttom!=null) | |||
// { | |||
// flicker_buttom.setVisibility(View.VISIBLE); | |||
// flicker_buttom.SetStatusKK(false); | |||
// flicker_buttom=null; | |||
// } | |||
//// huoli.SetLevel(0); | |||
// } | |||
// //endregion | |||
// | |||
// //region 私有方法 | |||
// | |||
// /** | |||
// * 将毫秒转化为 分钟:秒 的格式 100* 1000 | |||
// * | |||
// * @param millisecond 毫秒 | |||
// * @return | |||
// */ | |||
// public String formatTime(long millisecond) { | |||
// int minute;//分钟 | |||
// int second;//秒数 | |||
// minute = (int) ((millisecond / 1) / 60); | |||
// second = (int) ((millisecond / 1) % 60); | |||
// if (minute < 10) { | |||
// if (second < 10) { | |||
// return "0" + minute + " : " + "0" + second; | |||
// } else { | |||
// return "0" + minute + " : " + second; | |||
// } | |||
// } else { | |||
// if (second < 10) { | |||
// return minute + " : " + "0" + second; | |||
// } else { | |||
// return minute + " : " + second; | |||
// } | |||
// } | |||
// } | |||
// | |||
// /** | |||
// * 初始化顶部弹框 | |||
// */ | |||
// private void initTopBar() { | |||
// mTopBar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.topbj1)); | |||
// mTopBar.setTitle("菜谱烹饪"); | |||
// mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new OnClickListener() { | |||
// @Override | |||
// public void onClick(View view) { | |||
// if (ExecuteTheRecipe.IsStart) { | |||
// ToastUtils.warning("请等待制作完成后退出..."); | |||
// return; | |||
// } | |||
// setVisibility(View.GONE); | |||
// } | |||
// }); | |||
// } | |||
// | |||
// /** | |||
// * 点击事件 | |||
// * | |||
// * @param view | |||
// */ | |||
// @OnClick({R.id.kancaipu}) | |||
// public void onViewClicked(View view) { | |||
// switch (view.getId()) { | |||
// case R.id.kancaipu://看菜谱 | |||
// MessageManager.getInstance().sendMessage(MessageName.SelectZY, 0); | |||
// break; | |||
// } | |||
// } | |||
// | |||
// /** | |||
// * 闪烁buttom | |||
// */ | |||
// public imagebuttom3 flicker_buttom=null; | |||
// /** | |||
// * 刷新UI界面 | |||
// */ | |||
// public void SxUIThread() { | |||
// new Thread(new Runnable() { | |||
// @Override | |||
// public void run() { | |||
// | |||
// while (true) { | |||
// try { | |||
// if (activity != null && getVisibility() == View.VISIBLE) { | |||
// activity.runOnUiThread(new Runnable() { | |||
// @Override | |||
// public void run() { | |||
// Object val_wd = ExecuteTheRecipe.getListingValue("当前锅底温度"); | |||
// if (val_wd != null) { | |||
//// chaoguo_wendu.setText(val_wd + "°C"); | |||
// } else { | |||
//// chaoguo_wendu.setText("??°C"); | |||
// } | |||
// | |||
// //闪烁 | |||
// if (flicker_buttom != null) { | |||
// flicker_buttom.setVisibility(flicker_buttom.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE); | |||
// } | |||
// } | |||
// }); | |||
// } | |||
// Thread.sleep(1000); | |||
// } catch (InterruptedException e) { | |||
// LogUtils.d("异常信息:" + e.getMessage()); | |||
// ToastUtils.info("异常信息:" + e.getMessage()); | |||
// } | |||
// } | |||
// } | |||
// }).start(); | |||
// | |||
// ExecuteTheRecipe.ExecuteCurrentOperation=new IRunT() { | |||
// @Override | |||
// public void Run(Object o) { | |||
// String data=(String)o; | |||
// if (activity != null && getVisibility() == View.VISIBLE) { | |||
// activity.runOnUiThread(new Runnable() { | |||
// @Override | |||
// public void run() { | |||
// if(data.contains("|")) | |||
// { | |||
// String[] K= data.split("[|]"); | |||
// if (K.length>=2) | |||
// { | |||
// String name=K[0]; | |||
// String val=K[1]; | |||
// if(flicker_buttom!=null) | |||
// { | |||
// flicker_buttom.setVisibility(View.VISIBLE); | |||
// flicker_buttom.SetStatusKK(false); | |||
// } | |||
// flicker_buttom=null; | |||
//// switch (name) { | |||
//// case "搅拌": | |||
//// flicker_buttom=fanchaoshudu; | |||
//// flicker_buttom.SetStatusKK(true); | |||
//// break; | |||
//// case "位置": | |||
//// flicker_buttom=guokoucaoxiang; | |||
//// flicker_buttom.SetStatusKK(true); | |||
//// break; | |||
//// case "加热": | |||
//// huoli.SetLevel(Integer.parseInt(val)); | |||
//// break; | |||
//// case "主料": | |||
//// if(val.equals("1号位")) | |||
//// { | |||
//// flicker_buttom=touliao1; | |||
//// }else if(val.equals("2号位")) | |||
//// { | |||
//// flicker_buttom=touliao2; | |||
//// }else if(val.equals("3号位")) | |||
//// { | |||
//// flicker_buttom=touliao3; | |||
//// }else if(val.equals("4号位")) | |||
//// { | |||
//// flicker_buttom=touliao4; | |||
//// } | |||
//// flicker_buttom.SetStatusKK(true); | |||
//// break; | |||
//// case "加水": | |||
//// flicker_buttom=chushui; | |||
//// flicker_buttom.SetStatusKK(true); | |||
//// break; | |||
//// case "液体料": | |||
//// if(val.equals("1")) | |||
//// { | |||
//// flicker_buttom=yeliao1; | |||
//// flicker_buttom.SetStatusKK(true); | |||
//// }else if(val.equals("2")) | |||
//// { | |||
//// flicker_buttom=yeliao2; | |||
//// flicker_buttom.SetStatusKK(true); | |||
//// }else if(val.equals("3")) | |||
//// { | |||
//// flicker_buttom=yeliao3; | |||
//// flicker_buttom.SetStatusKK(true); | |||
//// } | |||
//// break; | |||
//// } | |||
// } | |||
// } | |||
// } | |||
// }); | |||
// } | |||
// } | |||
// }; | |||
// } | |||
// //endregion | |||
// | |||
// //region 外部调用 | |||
// //endregion | |||
// | |||
//} | |||
package com.bonait.bnframework.ui.activity; | |||
import android.content.Intent; | |||
import android.graphics.drawable.AnimationDrawable; | |||
import android.os.Bundle; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.os.Message; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.constraintlayout.widget.ConstraintLayout; | |||
import androidx.core.content.ContextCompat; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.business.NewExecuteTheRecipe; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
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.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.helper.CountDownTimerExt; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.CookTimeUtils; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.ActivityCookBinding; | |||
import com.bonait.bnframework.event.ProcessMakingEvent; | |||
import com.bonait.bnframework.ui.adapter.StepAdapter; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import org.greenrobot.eventbus.Subscribe; | |||
import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
public class CookingActivity extends BaseActivity { | |||
private final String TAG = "CookingActivity==>"; | |||
private ActivityCookBinding viewBinding; | |||
/** | |||
* 商品id | |||
*/ | |||
private String goodId = ""; | |||
/** | |||
* 子属性组合id 属性组合名称 | |||
*/ | |||
private String subAttributeGroupId = ""; | |||
private String subAttributeGroupName = ""; | |||
private BPA_GOODS_SUBATTRIBUTE_GROUP goodsSubattributeGroup; | |||
private boolean isMaking = false; | |||
private int stepIndex;//当前步骤 | |||
/** | |||
* 步骤列表 | |||
*/ | |||
private StepAdapter stepAdapter; | |||
private List<BPA_GOODS_PROCESS_DETAIL> stepList = new ArrayList<>(); | |||
/** | |||
* 是否是模拟炒制 | |||
*/ | |||
private boolean isTest = false; | |||
private CountDownTimerExt countDownTimer = null;//计时器 | |||
private final int MSG_Fresh_Step = 1000; | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
@Override | |||
public void handleMessage(@NonNull Message msg) { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case MSG_Fresh_Step: | |||
int position = msg.arg1; | |||
stepIndex = position; | |||
if(position<stepList.size()){ | |||
int last = stepAdapter.getCurrentPosition(); | |||
stepAdapter.setCurrentPosition(position); | |||
stepAdapter.notifyItemChanged(last); | |||
stepAdapter.notifyItemChanged(position); | |||
viewBinding.recycleStep.smoothScrollToPosition(position); | |||
} | |||
break; | |||
} | |||
} | |||
}; | |||
@Override | |||
protected void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
viewBinding = ActivityCookBinding.inflate(getLayoutInflater()); | |||
setContentView(viewBinding.getRoot()); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
EventBus.getDefault().register(this); | |||
initTopBar(); | |||
initData(); | |||
initView(); | |||
} | |||
private void initData(){ | |||
Intent intent = getIntent(); | |||
goodId = intent.getStringExtra("goodId"); | |||
subAttributeGroupId = intent.getStringExtra("subAttributeGroupId"); | |||
subAttributeGroupName = intent.getStringExtra("subAttributeGroupName"); | |||
if(subAttributeGroupName == null){ | |||
subAttributeGroupName = ""; | |||
} | |||
isTest = intent.getBooleanExtra("isTest",false); | |||
NewExecuteTheRecipe.isTest = isTest; | |||
goodsSubattributeGroup = SubAttributeGroupDBUtil.getById(subAttributeGroupId); | |||
stepList.clear(); | |||
stepList.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId)); | |||
} | |||
private void initView(){ | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodId); | |||
LogUtils.d(TAG+"initView goodId= "+goodId +" goods="+goods); | |||
if(goods!=null){ | |||
String name = subAttributeGroupName.isEmpty()?goods.name:(goods.name+"-"+subAttributeGroupName); | |||
viewBinding.goodname.setText(name); | |||
} | |||
viewBinding.startGoodmake.setOnClickListener(v->{ | |||
if (ConfigName.getInstance().isFastClick()) { | |||
NewToastUtil.getInstance().showToast("点击太快了,请重试"); | |||
return; | |||
} | |||
if(!isMaking){ | |||
onRecordStart(); | |||
}else { | |||
onRecordStop(); | |||
NewExecuteTheRecipe.IsForcedEnd = false; | |||
setReset(); | |||
} | |||
}); | |||
SetProcess(goodsSubattributeGroup.maketime, 0); | |||
LogUtils.d("制作时长goods.maketime="+goodsSubattributeGroup.maketime); | |||
viewBinding.runtime.setText(CookTimeUtils.formatTime(goodsSubattributeGroup.maketime)); | |||
stepAdapter = new StepAdapter(); | |||
stepAdapter.setNewData(stepList); | |||
stepAdapter.setCurrentPosition(-1); | |||
viewBinding.recycleStep.setItemAnimator(null); | |||
viewBinding.recycleStep.setHasFixedSize(true); | |||
viewBinding.recycleStep.setAdapter(stepAdapter); | |||
} | |||
/** | |||
* 复位 | |||
*/ | |||
private void setReset() { | |||
if(!isTest){ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
ModbusHelper.get().reset(); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addWater(0f,true); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addThickenWater(0f,true); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
for(int i =1;i<=9;i++){ | |||
ModbusHelper.get().addMaterial(0f,i,true); | |||
} | |||
})); | |||
} | |||
stepAdapter.setCurrentPosition(-1); | |||
stepAdapter.notifyDataSetChanged(); | |||
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
viewBinding.device.fireView.SetLevel(0); | |||
isFire = false; | |||
isUp = true; | |||
isStir = false; | |||
changeDevicePic(); | |||
} | |||
/** | |||
* 启动 | |||
*/ | |||
private void onRecordStart() { | |||
if (goodsSubattributeGroup != null && !NewExecuteTheRecipe.IsStart) { | |||
viewBinding.startGoodmake.setImageResource(R.mipmap.zhizuo_js); | |||
setReset(); | |||
int time = goodsSubattributeGroup.maketime; | |||
SetProcess(time, 0); | |||
if (countDownTimer == null) { | |||
countDownTimer = new CountDownTimerExt(time * 1000L, 1000) { | |||
@Override | |||
public void onTimerTick(long value) { | |||
int overtime = (int) ((value) / 1000);//剩余时间 | |||
SetProcess(time, time - overtime); | |||
} | |||
@Override | |||
public void onTimerFinish() { | |||
SetProcess(time, time); | |||
} | |||
}; | |||
} | |||
countDownTimer.start(); | |||
NewExecuteTheRecipe.IsStart = true; | |||
startMakingThread(); | |||
} | |||
} | |||
/** | |||
* 制作线程 | |||
*/ | |||
private void startMakingThread(){ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
if (NewExecuteTheRecipe.IsStart && goodsSubattributeGroup != null) { | |||
long startTime= System.currentTimeMillis(); //起始时间 | |||
boolean isError = false; | |||
try { | |||
//获取工艺 | |||
ArrayList<BPA_GOODS_PROCESS_DETAIL> goodsrecipes = GoodsProcessDetailDBUtil.getByGroupId(goodsSubattributeGroup.id); | |||
LogUtils.d("制作线程 MakeThread 启动 ==》 菜品配方 goodsrecipes="+goodsrecipes.toString()); | |||
int position = 0; | |||
if(!isTest){ | |||
ModbusHelper.get().setCookStatus(true); | |||
} | |||
for (BPA_GOODS_PROCESS_DETAIL item : goodsrecipes) { | |||
Message message = new Message(); | |||
message.what = MSG_Fresh_Step; | |||
message.arg1 = position; | |||
handler.sendMessage(message); | |||
if(!isTest){ | |||
if(ModbusHelper.get().isBtnStop()){ | |||
NewToastUtil.getInstance().showToast("设备已急停,请关闭急停按钮再调试!"); | |||
isError = true; | |||
break; | |||
} | |||
if(ModbusHelper.get().hasErrorInfo()){ | |||
String tip = ModbusHelper.get().isBtnStop()?"设备已急停,请关闭急停按钮再调试!":"设备有报警,请前往设备故障页检查!"; | |||
NewToastUtil.getInstance().showToast(tip); | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
onErrorDialog(); | |||
} | |||
}); | |||
isError = true; | |||
break; | |||
} | |||
} | |||
if( !NewExecuteTheRecipe.IsStart){ | |||
ToastUtils.info("客官,当前菜品已停止炒制!!!"); | |||
break; | |||
} | |||
boolean status = NewExecuteTheRecipe.Execute(item); | |||
position++; | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); | |||
} finally { | |||
NewExecuteTheRecipe.IsStart = false; | |||
if (!NewExecuteTheRecipe.IsForcedEnd && !isError && !isTest){ | |||
long endTime = System.currentTimeMillis(); //结束时间 | |||
int time=(int) ((endTime-startTime)/1000); | |||
LogUtils.d("运行时长 "+String.format("方法使用时间 %d s",time)); | |||
SubAttributeGroupDBUtil.updateMakeTime(goodsSubattributeGroup.id,time); | |||
goodsSubattributeGroup.maketime = time; | |||
} | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
setReset(); | |||
if(!isTest){ | |||
ModbusHelper.get().setCookStatus(false); | |||
} | |||
onRecordStop(); | |||
if (NewExecuteTheRecipe.IsForcedEnd)//强制结束 | |||
{ | |||
NewToastUtil.getInstance().showToast("客官,当前菜品已强制结束!!!"); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
})); | |||
} | |||
/** | |||
* 故障提示 | |||
*/ | |||
private void onErrorDialog(){ | |||
String tip = ModbusHelper.get().isBtnStop()?"设备已急停,请关闭急停按钮再调试!":"设备有报警,请前往设备故障页检查!"; | |||
AlertDialogUtils.showTipDialog(this, "报警", tip, new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
if(!ModbusHelper.get().isBtnStop()){ | |||
Intent intent = new Intent(CookingActivity.this,ErrorInfoActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
} | |||
@Override | |||
public void onCancel() { | |||
} | |||
}); | |||
} | |||
/** | |||
* 停止 | |||
*/ | |||
public void onRecordStop() { | |||
viewBinding.startGoodmake.setImageResource(R.mipmap.zhizuo_ks); | |||
if (goodsSubattributeGroup != null) { | |||
SetProcess(goodsSubattributeGroup.maketime, 0); | |||
if (countDownTimer != null) { | |||
countDownTimer.stop(); | |||
countDownTimer = null; | |||
} | |||
NewExecuteTheRecipe.IsStart = false; | |||
} | |||
} | |||
/*UI 变化*/ | |||
/** | |||
* 设置进度条 | |||
* | |||
* @param | |||
*/ | |||
private void SetProcess(int alltime, int usertime) { | |||
try { | |||
if(alltime!=0){ | |||
viewBinding.progress.SetValue((usertime * 100) / alltime); | |||
} | |||
viewBinding.runtime.setText(CookTimeUtils.formatTime((alltime - usertime))); | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
ToastUtils.error("异常信息:" + ex.getMessage()); | |||
} | |||
} | |||
/** | |||
* 改变设备图片 | |||
*/ | |||
private boolean isFire; | |||
private boolean isStir; | |||
private boolean isUp; | |||
private void changeDevicePic(){ | |||
if(isFire){ | |||
if(isStir){ | |||
if(isUp){ | |||
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_up); | |||
}else { | |||
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_down); | |||
} | |||
}else{ | |||
if(isUp){ | |||
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_up); | |||
}else { | |||
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_down); | |||
} | |||
} | |||
}else { | |||
if(isStir){ | |||
if(isUp){ | |||
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_up); | |||
}else { | |||
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_down); | |||
} | |||
}else{ | |||
if(isUp){ | |||
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_up); | |||
}else { | |||
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_down); | |||
} | |||
} | |||
} | |||
} | |||
/** | |||
* 初始化顶部弹框 | |||
*/ | |||
private void initTopBar() { | |||
viewBinding.topbar.setBackgroundColor(ContextCompat.getColor(this, R.color.topbj1)); | |||
viewBinding.topbar.setTitle("菜品烹饪"); | |||
viewBinding.back.setOnClickListener(v->{ | |||
AlertDialogUtils.showTipDialog(this, "温馨提示!", "是否停止制作?", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
setReset(); | |||
onRecordStop(); | |||
finish(); | |||
} | |||
@Override | |||
public void onCancel() { | |||
} | |||
}); | |||
}); | |||
} | |||
@Override | |||
protected void onResume() { | |||
super.onResume(); | |||
} | |||
@Override | |||
protected void onPause() { | |||
super.onPause(); | |||
} | |||
@Override | |||
protected void onDestroy() { | |||
if(!isTest){ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
ModbusHelper.get().reset(); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addWater(0f,true); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addThickenWater(0f,true); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
for(int i =1;i<=9;i++){ | |||
ModbusHelper.get().addMaterial(0f,i,true); | |||
} | |||
})); | |||
} | |||
super.onDestroy(); | |||
EventBus.getDefault().unregister(this); | |||
} | |||
//接收工序执行步骤 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onProcessMakingEvent(ProcessMakingEvent event){ | |||
String value = event.value; | |||
switch (event.type){ | |||
case 1: | |||
if(value.contains("启动加热")){ | |||
isFire = true; | |||
String[] res = value.split("\\|"); | |||
if(res[1].equals("0")){ | |||
isFire=false; | |||
viewBinding.device.fireView.SetLevel(0); | |||
}else { | |||
viewBinding.device.fireView.SetLevel(Integer.parseInt(res[1])); | |||
} | |||
}else if(value.contains("停止加热")){ | |||
isFire=false; | |||
viewBinding.device.fireView.SetLevel(0); | |||
} | |||
changeDevicePic(); | |||
break; | |||
case 2: | |||
if(value.contains("完成")){ | |||
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
}else { | |||
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); | |||
((AnimationDrawable)viewBinding.device.btnSilos.getBackground()).start(); | |||
} | |||
break; | |||
case 3: | |||
if(value.contains("完成")){ | |||
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
}else { | |||
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); | |||
((AnimationDrawable)viewBinding.device.btnMainFood.getBackground()).start(); | |||
} | |||
break; | |||
case 4: | |||
switch (value){ | |||
case "启动搅拌": | |||
isStir=true; | |||
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); | |||
((AnimationDrawable)viewBinding.device.btnStir.getBackground()).start(); | |||
break; | |||
case "停止搅拌": | |||
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
isStir=false; | |||
break; | |||
case "下降": | |||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); | |||
params.topMargin = DimensUtil.getDimens(250); | |||
viewBinding.device.btnUpDown.setLayoutParams(params); | |||
ConstraintLayout.LayoutParams paramsFood = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams(); | |||
paramsFood.topMargin = DimensUtil.getDimens(200); | |||
viewBinding.device.btnMainFood.setLayoutParams(paramsFood); | |||
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); | |||
((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start(); | |||
isUp=false; | |||
break; | |||
case "上升": | |||
ConstraintLayout.LayoutParams params2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); | |||
params2.topMargin = DimensUtil.getDimens(150); | |||
viewBinding.device.btnUpDown.setLayoutParams(params2); | |||
ConstraintLayout.LayoutParams paramsFood2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams(); | |||
paramsFood2.topMargin = DimensUtil.getDimens(20); | |||
viewBinding.device.btnMainFood.setLayoutParams(paramsFood2); | |||
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); | |||
((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start(); | |||
isUp=true; | |||
break; | |||
case "升降完成": | |||
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn); | |||
break; | |||
} | |||
changeDevicePic(); | |||
break; | |||
} | |||
} | |||
@Override | |||
protected void doOnBackPressed() { | |||
AlertDialogUtils.showTipDialog(this, "温馨提示!", "是否停止制作?", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
setReset(); | |||
onRecordStop(); | |||
finish(); | |||
} | |||
@Override | |||
public void onCancel() { | |||
} | |||
}); | |||
} | |||
} |
@@ -26,7 +26,6 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.CookTimeUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ProcessValueUtil; | |||
@@ -106,6 +105,9 @@ public class DiyProcessActivity extends BaseActivity { | |||
goodId = intent.getStringExtra("goodId"); | |||
subAttributeGroupId = intent.getStringExtra("subAttributeGroupId"); | |||
subAttributeGroupName = intent.getStringExtra("subAttributeGroupName"); | |||
if(subAttributeGroupName == null){ | |||
subAttributeGroupName = ""; | |||
} | |||
} | |||
if(mainFoods.isEmpty()){ | |||
mainFoods.add(""); | |||
@@ -204,11 +206,23 @@ public class DiyProcessActivity extends BaseActivity { | |||
}); | |||
//模拟炒制 | |||
viewBinding.btnSimulation.setOnClickListener(view -> { | |||
AlertDialogUtils.showTipDialog(this,"温馨提示!","正在开发,功能暂未开通哦...",null); | |||
Intent intent = new Intent(DiyProcessActivity.this, CookingActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
intent.putExtra("subAttributeGroupId",subAttributeGroupId); | |||
intent.putExtra("isTest",true); | |||
intent.putExtra("subAttributeGroupName",subAttributeGroupName); | |||
intent.putExtra("goodId",goodId); | |||
startActivity(intent); | |||
}); | |||
//录制工序 | |||
viewBinding.btnJumpRecordProcess.setOnClickListener(view -> { | |||
AlertDialogUtils.showTipDialog(this,"温馨提示!","正在开发,功能暂未开通哦...",null); | |||
Intent intent = new Intent(DiyProcessActivity.this, RecProcessActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
intent.putExtra("subAttributeGroupId",subAttributeGroupId); | |||
intent.putExtra("subAttributeGroupName",subAttributeGroupName); | |||
intent.putExtra("goodId",goodId); | |||
intent.putStringArrayListExtra("mainFoods",mainFoods); | |||
startActivityForResult(intent,REQUEST_RECORD_ACTIVITY); | |||
}); | |||
viewBinding.llInsert.setVisibility(View.GONE); | |||
viewBinding.btnInsert.setOnClickListener(view -> { | |||
@@ -368,7 +382,7 @@ public class DiyProcessActivity extends BaseActivity { | |||
BPA_GOODS_PROCESS_DETAIL obj_update = (BPA_GOODS_PROCESS_DETAIL) processDetails.get(index_update); | |||
String selectname = viewBinding.spinnerProcess.getSelectedItem().toString(); | |||
if (!obj_update.processname.equals(selectname)) { | |||
NewToastUtil.getInstance().showToast("请先选择步骤!"); | |||
NewToastUtil.getInstance().showToast("修改失败,选中步骤名称不相同!"); | |||
return; | |||
} | |||
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue(); | |||
@@ -584,6 +598,9 @@ public class DiyProcessActivity extends BaseActivity { | |||
if(processValueView.model.name.equals("主料名称")){ | |||
processValueView.setMainFoodName(mainFoods.get(0)); | |||
} | |||
if(processValueView.model.name.contains("正转时间")||processValueView.model.name.contains("反转时间")){ | |||
processValueView.SetValues("3"); | |||
} | |||
} | |||
} | |||
@@ -604,6 +621,7 @@ public class DiyProcessActivity extends BaseActivity { | |||
if (data!=null && data.getBooleanExtra("update",false)){ | |||
processDetails.clear(); | |||
processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId)); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.notifyDataSetChanged(); | |||
} | |||
} | |||
@@ -611,7 +629,6 @@ public class DiyProcessActivity extends BaseActivity { | |||
@Override | |||
protected void onPause() { | |||
super.onPause(); | |||
LogUtils.d(TAG+" onPause1"); | |||
List<BPA_GOODS_PROCESS_DETAIL> processDetails1 = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId); | |||
GoodsProcessDetailDBUtil.removeList(processDetails1); | |||
@@ -622,5 +639,6 @@ public class DiyProcessActivity extends BaseActivity { | |||
GoodsProcessDetailDBUtil.addList(processDetails); | |||
SubAttributeGroupDBUtil.updateMakeTime(subAttributeGroupId, CookTimeUtils.measureCookingTime(processDetails)); | |||
LogUtils.d(TAG+" onPause2"); | |||
super.onPause(); | |||
} | |||
} |
@@ -28,10 +28,13 @@ import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.ActivityEditClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogAddClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.adapter.classify.AttributeAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.SubattributeAdapter; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import java.util.ArrayList; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
@@ -473,7 +476,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
private void initTopBar(){ | |||
viewBinding.topbar.setTitle("编辑分类"); | |||
viewBinding.back.setOnClickListener(v->{ | |||
finish(); | |||
finishActivity(); | |||
}); | |||
} | |||
@@ -485,6 +488,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
private void finishActivity(){ | |||
setResult(RESULT_OK, null); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
finish(); | |||
} | |||
@@ -16,11 +16,14 @@ import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.databinding.FragmentHomeFoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.fragment.goods.CloudGoodsFragment; | |||
import com.bonait.bnframework.ui.fragment.goods.LocalGoodsFragment; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
@@ -53,7 +56,6 @@ public class EditGoodsActivity extends BaseActivity { | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initTopBar(); | |||
SelectTab(1); | |||
requestData(); | |||
} | |||
@@ -167,6 +169,7 @@ public class EditGoodsActivity extends BaseActivity { | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
} | |||
} |
@@ -0,0 +1,152 @@ | |||
package com.bonait.bnframework.ui.activity; | |||
import static com.bonait.bnframework.MainApplication.getContext; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.os.Message; | |||
import android.text.Spannable; | |||
import android.text.SpannableStringBuilder; | |||
import android.text.style.ForegroundColorSpan; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.content.ContextCompat; | |||
import com.bonait.bnframework.HBL.DataUtil.ErrorCodeManager; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.Model.ErrorCodeBean; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ActivityErrorInfoBinding; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/28 9:39. | |||
*/ | |||
public class ErrorInfoActivity extends BaseActivity { | |||
private ActivityErrorInfoBinding viewBinding; | |||
private boolean upError = false; | |||
private boolean downError = false; | |||
private boolean upDownError = false; | |||
private boolean stirError = false; | |||
private boolean stopError = false; | |||
private final int MSG_FRESH = 1000; | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
@Override | |||
public void handleMessage(@NonNull Message msg) { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case MSG_FRESH: | |||
freshView(); | |||
ThreadManager.get().execute(new Thread(()->{ | |||
upError = ModbusHelper.get().getUpError(); | |||
downError = ModbusHelper.get().getDownError(); | |||
upDownError = ModbusHelper.get().getUpDownError(); | |||
stirError = ModbusHelper.get().getStirError(); | |||
stopError = ModbusHelper.get().isBtnStop(); | |||
})); | |||
handler.sendEmptyMessageDelayed(MSG_FRESH,500); | |||
break; | |||
} | |||
} | |||
}; | |||
@Override | |||
protected void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
viewBinding = ActivityErrorInfoBinding.inflate(getLayoutInflater()); | |||
setContentView(viewBinding.getRoot()); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initView(); | |||
initTopBar(); | |||
handler.sendEmptyMessage(MSG_FRESH); | |||
} | |||
private void initView(){ | |||
viewBinding.btnReset.setOnClickListener(v->{ | |||
AlertDialogUtils.showTipDialog(this, "温馨提示!", "请观察升降台和搅拌爪情况再点击复位哦!", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().setErrorReset(); | |||
})); | |||
} | |||
@Override | |||
public void onCancel() { | |||
} | |||
}); | |||
}); | |||
} | |||
private void freshView(){ | |||
viewBinding.imgUp.setImageResource(upError?R.mipmap.ic_device_up_error:R.mipmap.ic_device_up); | |||
viewBinding.tvUp.setText(upError?"上升超时报警(异常)":"上升超时报警(正常)"); | |||
viewBinding.tvUp.setTextColor(upError?ContextCompat.getColor(this, R.color.red_primary):ContextCompat.getColor(this, R.color.black)); | |||
viewBinding.imgDown.setImageResource(downError?R.mipmap.ic_device_down_error:R.mipmap.ic_device_up); | |||
viewBinding.tvDown.setText(downError?"下降超时报警(异常)":"下降超时报警(正常)"); | |||
viewBinding.tvDown.setTextColor(downError?ContextCompat.getColor(this, R.color.red_primary):ContextCompat.getColor(this, R.color.black)); | |||
viewBinding.imgUpdown.setImageResource(upDownError?R.mipmap.ic_device_updown_error:R.mipmap.ic_device_updown); | |||
viewBinding.tvUpdown.setText(upDownError?"升降传感器(异常)":"升降传感器(正常)"); | |||
viewBinding.tvUpdown.setTextColor(upDownError?ContextCompat.getColor(this, R.color.red_primary):ContextCompat.getColor(this, R.color.black)); | |||
viewBinding.imgStir.setImageResource(stirError?R.mipmap.ic_device_updown_error:R.mipmap.ic_device_updown); | |||
viewBinding.tvStatus.setText(stirError?"搅拌传感器(异常)":"搅拌传感器(正常)"); | |||
viewBinding.tvStatus.setTextColor(stirError?ContextCompat.getColor(this, R.color.red_primary):ContextCompat.getColor(this, R.color.black)); | |||
viewBinding.imgStop.setImageResource(stopError?R.mipmap.ic_device_stop_on:R.mipmap.ic_device_stop); | |||
viewBinding.tvStop.setText(stopError?"急停按钮(已急停)":"急停按钮(正常)"); | |||
viewBinding.tvStop.setTextColor(stopError?ContextCompat.getColor(this, R.color.red_primary):ContextCompat.getColor(this, R.color.black)); | |||
for(ErrorCodeBean bean : ErrorCodeManager.getInstance().getDataBeans()){ | |||
if(bean.getCode() == ModbusHelper.get().getDeviceErrorCode()){ | |||
changeTextDeviceStatus(1,bean.getName()+" "+bean.getDescription()); | |||
} | |||
} | |||
changeTextDeviceStatus(2,ModbusHelper.get().getConnected()?"在线":"掉线"); | |||
} | |||
/** | |||
* 设备状态更新 | |||
* @param position | |||
* @param desc | |||
*/ | |||
private void changeTextDeviceStatus(int position,String desc){ | |||
if(position == 1){ | |||
String content = "设备信息: "+desc; | |||
SpannableStringBuilder spannable = new SpannableStringBuilder(content); | |||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor("#795548")), 6, content.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括 | |||
viewBinding.tvInfo.setText(spannable); | |||
}else { | |||
String content = "设备状态: "+desc; | |||
SpannableStringBuilder spannable = new SpannableStringBuilder(content); | |||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor("#795548")), 5, content.length(), Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括 | |||
viewBinding.tvStatus.setText(spannable); | |||
} | |||
} | |||
private void initTopBar(){ | |||
viewBinding.topbar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.topbj1)); | |||
viewBinding.topbar.setTitle("设备异常信息"); | |||
viewBinding.back.setOnClickListener(v->{ | |||
finish(); | |||
}); | |||
} | |||
@Override | |||
protected void onPause() { | |||
super.onPause(); | |||
if(handler!=null){ | |||
handler.removeCallbacksAndMessages(null); | |||
handler = null; | |||
} | |||
finish(); | |||
} | |||
} |
@@ -0,0 +1,195 @@ | |||
package com.bonait.bnframework.ui.activity; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.view.KeyEvent; | |||
import android.view.View; | |||
import androidx.annotation.Nullable; | |||
import androidx.viewpager.widget.ViewPager; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.ViewModel.Adapter.FragmentAdapter; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.ActivityMainBinding; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.ui.fragment.HomeDevicesFragment; | |||
import com.bonait.bnframework.ui.fragment.HomeFoodsFragment; | |||
import com.bonait.bnframework.ui.fragment.HomeMainFragment; | |||
import com.lzy.okgo.OkGo; | |||
public class MainActivity extends BaseActivity { | |||
private static final String TAG= "MainActivity ==>"; | |||
private HomeFoodsFragment homeFoodsFragment; | |||
private ActivityMainBinding viewBinding; | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
viewBinding = ActivityMainBinding.inflate(getLayoutInflater()); | |||
setContentView(viewBinding.getRoot()); | |||
View decorView = getWindow().getDecorView(); | |||
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | |||
| View.SYSTEM_UI_FLAG_FULLSCREEN; | |||
decorView.setSystemUiVisibility(uiOptions); | |||
Init(); | |||
initFragment(); | |||
initView(); | |||
} | |||
private void initView(){ | |||
viewBinding.viewpager.addOnPageChangeListener(pageChangeListener); | |||
// 设置viewPager缓存多少个fragment | |||
viewBinding.viewpager.setOffscreenPageLimit(3); | |||
viewBinding.navigation.mListener = new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
int index = (int) data; | |||
viewBinding.viewpager.setCurrentItem(index); | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
} | |||
}; | |||
viewBinding.viewpager.setCurrentItem(1); | |||
} | |||
@Override | |||
protected void onDestroy() { | |||
ExecuteTheRecipe.IsStart = false; | |||
ModbusHelper.get().setCookStatus(false); | |||
ConfigData.getInstance().ColsePLC(); | |||
MessageManager.getInstance().unRegisterMessageReceiver(this); | |||
ThreadManager.get().Stop("Modbus变量状态"); | |||
super.onDestroy(); | |||
} | |||
@Override | |||
protected boolean canDragBack() { | |||
return viewBinding.viewpager.getCurrentItem() == 0; | |||
} | |||
//endregion | |||
//region 私有函数 | |||
/** | |||
* viewPager里添加fragment | |||
*/ | |||
private void initFragment() { | |||
homeFoodsFragment = new HomeFoodsFragment(); | |||
FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | |||
fragmentAdapter.addFragment(homeFoodsFragment); | |||
// fragmentAdapter.addFragment(new HomeFragmentPR()); | |||
// fragmentAdapter.addFragment(new Home4Fragment()); | |||
fragmentAdapter.addFragment(new HomeMainFragment()); | |||
// fragmentAdapter.addFragment(new HomeFragmentSBKZ()); | |||
// fragmentAdapter.addFragment(new HomeDeviceFragment()); | |||
fragmentAdapter.addFragment(new HomeDevicesFragment()); | |||
viewBinding.viewpager.setAdapter(fragmentAdapter); | |||
} | |||
/** | |||
* 配置ViewPager监听器,手指滑动监听 | |||
*/ | |||
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() { | |||
@Override | |||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
} | |||
@Override | |||
public void onPageSelected(int position) { | |||
viewBinding.navigation.SelectIndexTab(position); | |||
} | |||
@Override | |||
public void onPageScrollStateChanged(int state) { | |||
} | |||
}; | |||
private long exitTime = 0; | |||
/** | |||
* 重写返回键,实现双击退出程序效果 | |||
*/ | |||
@Override | |||
public boolean onKeyDown(int keyCode, KeyEvent event) { | |||
if (keyCode == KeyEvent.KEYCODE_BACK) { | |||
if (System.currentTimeMillis() - exitTime > 2000) { | |||
ToastUtils.normal("再按一次退出程序"); | |||
exitTime = System.currentTimeMillis(); | |||
} else { | |||
OkGo.getInstance().cancelAll(); | |||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); | |||
ActivityLifecycleManager.get().appExit(); | |||
} | |||
return true; | |||
} | |||
return super.onKeyDown(keyCode, event); | |||
} | |||
/** | |||
* 初始化 | |||
*/ | |||
public void Init() { | |||
//1.同步时间 | |||
NetworkUtils.SynchronizationTime(); | |||
//主持 | |||
// ConfigData.getInstance().GetOrganize(this); | |||
//判断连接环境 | |||
ConfigData.getInstance().ToggleEnvironment(); | |||
// //2.初始化PLC | |||
// ReconnectModbus(); | |||
//初始化modbus | |||
ModbusHelper.get().RtuInit("/dev/ttyCOM0",9600); | |||
//初始化阿里云连接 | |||
//AliyunIOTManager.getInstance().OpenDev(this); | |||
} | |||
public static final int REQUEST_CLASSIFY_ACTIVITY = 1000; | |||
public static final int REQUEST_GOODS_ACTIVITY = 1001; | |||
@Override | |||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { | |||
super.onActivityResult(requestCode, resultCode, data); | |||
LogUtils.d(TAG+" onActivityResult requestCode="+requestCode+" resultCode="+resultCode+" data="+data); | |||
if (requestCode == REQUEST_CLASSIFY_ACTIVITY && resultCode==RESULT_OK) { | |||
if(homeFoodsFragment!=null){ | |||
homeFoodsFragment.updateLocalData(); | |||
} | |||
} | |||
if (requestCode == REQUEST_GOODS_ACTIVITY && resultCode==RESULT_OK) { | |||
if(homeFoodsFragment!=null){ | |||
homeFoodsFragment.updateLocalData(); | |||
} | |||
} | |||
} | |||
public void jumpClassifyActivity(){ | |||
Intent intent = new Intent(MainActivity.this, EditClassifyActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivityForResult(intent,REQUEST_CLASSIFY_ACTIVITY); | |||
} | |||
public void jumpGoodsActivity(){ | |||
Intent intent = new Intent(MainActivity.this, EditGoodsActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivityForResult(intent,REQUEST_GOODS_ACTIVITY); | |||
} | |||
} |
@@ -15,7 +15,7 @@ import com.bonait.bnframework.databinding.ItemStepBinding; | |||
/** | |||
* @author: liup | |||
* @description: 商品列表 | |||
* @description: 步骤列表 | |||
* @date: 2024/5/8 15:36. | |||
*/ | |||
public abstract class DiyStepAdapter extends BaseAdapter<BPA_GOODS_PROCESS_DETAIL, DiyStepAdapter.ViewHolder> { | |||
@@ -0,0 +1,72 @@ | |||
package com.bonait.bnframework.ui.adapter; | |||
import android.annotation.SuppressLint; | |||
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.base.BaseAdapter; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ItemStepDescBinding; | |||
/** | |||
* @author: liup | |||
* @description: 步骤列表 | |||
* @date: 2024/5/8 15:36. | |||
*/ | |||
public class StepAdapter extends BaseAdapter<BPA_GOODS_PROCESS_DETAIL, StepAdapter.ViewHolder> { | |||
@NonNull | |||
@Override | |||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
return new ViewHolder(ItemStepDescBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | |||
} | |||
@Override | |||
public void onBindViewHolder(@NonNull ViewHolder holder, @SuppressLint("RecyclerView") int position) { | |||
try { | |||
if(DisplayManager.shouldScale(holder.binding.name)){ | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} | |||
holder.binding.root.setSelected(mCurrentPosition == position); | |||
String name = mData.get(position).processms;//mData.get(position).processname +" "+ | |||
holder.binding.name.setText((position+1)+"."+name); | |||
holder.binding.root.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
// int last = mCurrentPosition; | |||
// mCurrentPosition = position; | |||
// notifyItemChanged(last); | |||
// notifyItemChanged(mCurrentPosition); | |||
// onItemClick(view,position); | |||
} | |||
}); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
} | |||
public static class ViewHolder extends RecyclerView.ViewHolder { | |||
private ItemStepDescBinding binding; | |||
public ViewHolder(ItemStepDescBinding view) { | |||
super(view.getRoot()); | |||
binding = view; | |||
} | |||
} | |||
} | |||
@@ -60,7 +60,8 @@ public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> { | |||
List<BPA_SUBATTRIBUTE> subattributeList = SubAttributeDBUtil.getByParentAttributeId(bean.id); | |||
SelectSubAttributeAdapter adapter = new SelectSubAttributeAdapter(); | |||
adapter.setNewData(subattributeList); | |||
adapter.setCurrentPosition(-1); | |||
adapter.setListener(listener); | |||
adapter.setCurrentPosition(0); | |||
recyclerView.setAdapter(adapter); | |||
LogUtils.d(" SelectAttributeListAdapter getView position="+position); | |||
if(position == subAttributeAdapters.size()){ | |||
@@ -115,4 +116,14 @@ public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> { | |||
LogUtils.d(" getSubAttributeIdList groupids="+groupName); | |||
return groupName; | |||
} | |||
private CallBackListener listener; | |||
public void setListener(CallBackListener listener) { | |||
this.listener = listener; | |||
} | |||
public interface CallBackListener{ | |||
void onClick(); | |||
} | |||
} |
@@ -20,6 +20,11 @@ import com.bonait.bnframework.databinding.ItemSelectSubattributeBinding; | |||
*/ | |||
public class SelectSubAttributeAdapter extends BaseAdapter<BPA_SUBATTRIBUTE,SelectSubAttributeAdapter.ViewHolder> { | |||
private SelectAttributeListAdapter.CallBackListener listener; | |||
public void setListener(SelectAttributeListAdapter.CallBackListener listener) { | |||
this.listener = listener; | |||
} | |||
@NonNull | |||
@Override | |||
@@ -44,6 +49,9 @@ public class SelectSubAttributeAdapter extends BaseAdapter<BPA_SUBATTRIBUTE,Sele | |||
mCurrentPosition = position; | |||
notifyItemChanged(last); | |||
notifyItemChanged(mCurrentPosition); | |||
if(listener!=null){ | |||
listener.onClick(); | |||
} | |||
} | |||
}); | |||
} catch (Exception e) { | |||
@@ -50,7 +50,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||
holder.binding.image.setImageResource(R.mipmap.loading123); | |||
} | |||
if(GoodsDBUtil.getByName(goods.name)!=null){ | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goods.classifyId)!=null){ | |||
holder.binding.downLoad.setVisibility(View.GONE); | |||
}else { | |||
holder.binding.downLoad.setVisibility(View.VISIBLE); | |||
@@ -29,7 +29,7 @@ import com.bonait.bnframework.common.glide.GlideUtil; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogAddGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.event.FreshLocalGoodPicEvent; | |||
import com.bonait.bnframework.event.ImageSelectEvent; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifySpinnerAdapter; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
@@ -198,7 +198,7 @@ public class AddGoodsDialog extends DialogFragment { | |||
goods.url = picUrl; | |||
GoodsDBUtil.add(goods); | |||
dismiss(); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
EventBus.getDefault().post(new FreshLocalGoodPicEvent()); | |||
} | |||
@@ -26,6 +26,7 @@ import com.bonait.bnframework.Service.ControlAdress; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE; | |||
@@ -65,6 +66,7 @@ public class DeviceControlDialog extends DialogFragment { | |||
* 料仓列表 | |||
*/ | |||
private List<String> seasoningList = new ArrayList<>(); | |||
private List<String> materialList = new ArrayList<>(); | |||
/** | |||
* 主料仓名称列表 | |||
*/ | |||
@@ -122,17 +124,21 @@ public class DeviceControlDialog extends DialogFragment { | |||
private void initData(){ | |||
seasoningList = new ArrayList<>(); | |||
materialList = new ArrayList<>(); | |||
for(BPA_SILOS silos: QueryDB.GetSilosALL()){ | |||
List<BPA_MATERIAL> materials = QueryDB.GetMaterialBySilosID(silos.id); | |||
if(!materials.isEmpty()){ | |||
String name = QueryDB.GetMaterialBySilosID(silos.id).get(0).name; | |||
if(name!=null && !name.isEmpty()){ | |||
seasoningList.add("液体"+silos.num+"("+name+")"); | |||
materialList.add(name); | |||
}else { | |||
seasoningList.add("液体"+silos.num+"(未设置)"); | |||
materialList.add(""); | |||
} | |||
}else { | |||
seasoningList.add("液体"+silos.num+"(未设置)"); | |||
materialList.add(""); | |||
} | |||
} | |||
} | |||
@@ -142,13 +148,21 @@ public class DeviceControlDialog extends DialogFragment { | |||
*/ | |||
private void initFire(){ | |||
viewBinding.layoutFire.btnClose1.setOnClickListener(v->{ | |||
if (ConfigName.getInstance().isFastClick()){ | |||
return; | |||
} | |||
dismiss(); | |||
}); | |||
//开始加热 | |||
viewBinding.layoutFire.btnStartFire.setOnClickListener(view->{ | |||
NewToastUtil.getInstance().showToast("启动加热 档位:"+progressFire); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(progressFire,true))); | |||
deviceCallBack.onClickEvent(type,"启动加热|"+progressFire,0); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(progressFire*10,true))); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "加热"; | |||
detail.materialType = 1; | |||
detail.processvalue = "加热档位,"+progressFire*10+"|加热控制,启动加热|延迟(秒),0"; | |||
detail.processms = "加热("+progressFire*10+",启动加热,0)"; | |||
deviceCallBack.onClickEvent(type,"启动加热|"+progressFire,0,detail); | |||
}); | |||
//停止加热 | |||
viewBinding.layoutFire.btnStopFire.setOnClickListener(view->{ | |||
@@ -156,7 +170,12 @@ public class DeviceControlDialog extends DialogFragment { | |||
viewBinding.layoutFire.fireProgress.setValue(0,true); | |||
NewToastUtil.getInstance().showToast("停止加热"); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(0,false))); | |||
deviceCallBack.onClickEvent(type,"停止加热",0); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "加热"; | |||
detail.materialType = 1; | |||
detail.processvalue = "加热档位,"+progressFire*10+"|加热控制,停止加热|延迟(秒),0"; | |||
detail.processms = "加热("+progressFire*10+",启动加热,0)"; | |||
deviceCallBack.onClickEvent(type,"停止加热",0,detail); | |||
}); | |||
//档位条加减 | |||
viewBinding.layoutFire.btnFireUp.setOnClickListener(view->{ | |||
@@ -206,7 +225,12 @@ public class DeviceControlDialog extends DialogFragment { | |||
time = AnalogConvert.Scale( Float.parseFloat(waterValue), bean.inputWightMax, bean.inputWightMin, | |||
bean.outputTimeMax, bean.outputTimeMin); | |||
} | |||
deviceCallBack.onClickEvent(type,"开始加水",time * 10L); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "加水"; | |||
detail.materialType = 1; | |||
detail.processvalue = "重量(克),"+waterValue; | |||
detail.processms = "加水("+waterValue+")"; | |||
deviceCallBack.onClickEvent(type,"开始加水",time * 10L,detail); | |||
}else { | |||
NewToastUtil.getInstance().showToast("值不能为空!"); | |||
} | |||
@@ -225,7 +249,12 @@ public class DeviceControlDialog extends DialogFragment { | |||
time = AnalogConvert.Scale( Float.parseFloat(value), bean.inputWightMax, bean.inputWightMin, | |||
bean.outputTimeMax, bean.outputTimeMin); | |||
} | |||
deviceCallBack.onClickEvent(type,"开始勾芡",time * 10L); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "勾芡"; | |||
detail.materialType = 1; | |||
detail.processvalue = "重量(克),"+value; | |||
detail.processms = "勾芡("+value+")"; | |||
deviceCallBack.onClickEvent(type,"开始勾芡",time * 10L,detail); | |||
}else { | |||
NewToastUtil.getInstance().showToast("值不能为空!"); | |||
} | |||
@@ -235,6 +264,10 @@ public class DeviceControlDialog extends DialogFragment { | |||
String value2 = viewBinding.layoutSilos.editSeasoningWater.getText().toString(); | |||
if(seasoningPos>=0){ | |||
if(!value2.isEmpty()){ | |||
if(seasoningList.get(seasoningPos).contains("未设置")){ | |||
NewToastUtil.getInstance().showToast("执行失败,该仓号未匹配调料!"); | |||
return; | |||
} | |||
NewToastUtil.getInstance().showToast("添加"+seasoningList.get(seasoningPos)+";"+value2+"g"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addMaterial(Float.parseFloat(value2),(seasoningPos+1),false); | |||
@@ -276,7 +309,12 @@ public class DeviceControlDialog extends DialogFragment { | |||
time = AnalogConvert.Scale( Float.parseFloat(value2), bean.inputWightMax, bean.inputWightMin, | |||
bean.outputTimeMax, bean.outputTimeMin); | |||
} | |||
deviceCallBack.onClickEvent(type,seasoningList.get(seasoningPos),time * 10L); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "液体料"; | |||
detail.materialType = 0; | |||
detail.processvalue = materialList.get(seasoningPos)+","+value2; | |||
detail.processms = "液体料("+value2+")"; | |||
deviceCallBack.onClickEvent(type,seasoningList.get(seasoningPos),time * 10L,detail); | |||
}else { | |||
NewToastUtil.getInstance().showToast("值不能为空!"); | |||
} | |||
@@ -330,42 +368,74 @@ public class DeviceControlDialog extends DialogFragment { | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addMainFood((1)); | |||
})); | |||
deviceCallBack.onClickEvent(type,"主料1号仓",1500); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.materialType = 1; | |||
detail.processname = "主料"; | |||
detail.processvalue = "主料名称,"+viewBinding.layoutFood.tvFood1.getText().toString()+"|主料位置,1号位|延迟(秒),0"; | |||
detail.processms = "主料("+viewBinding.layoutFood.tvFood1.getText().toString()+",1号位,0)"; | |||
deviceCallBack.onClickEvent(type,"主料1号仓",1500,detail); | |||
}); | |||
viewBinding.layoutFood.btnFood2.setOnClickListener(v->{ | |||
NewToastUtil.getInstance().showToast("倒入主料2号仓"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addMainFood((2)); | |||
})); | |||
deviceCallBack.onClickEvent(type,"主料2号仓",1000); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.materialType = 1; | |||
detail.processname = "主料"; | |||
detail.processvalue = "主料名称,"+viewBinding.layoutFood.tvFood2.getText().toString()+"|主料位置,2号位|延迟(秒),0"; | |||
detail.processms = "主料("+viewBinding.layoutFood.tvFood2.getText().toString()+",2号位,0)"; | |||
deviceCallBack.onClickEvent(type,"主料2号仓",1000,detail); | |||
}); | |||
viewBinding.layoutFood.btnFood3.setOnClickListener(v->{ | |||
NewToastUtil.getInstance().showToast("倒入主料3号仓"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addMainFood((3)); | |||
})); | |||
deviceCallBack.onClickEvent(type,"主料3号仓",1000); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "主料"; | |||
detail.materialType = 1; | |||
detail.processvalue = "主料名称,"+viewBinding.layoutFood.tvFood3.getText().toString()+"|主料位置,3号位|延迟(秒),0"; | |||
detail.processms = "主料("+viewBinding.layoutFood.tvFood3.getText().toString()+",3号位,0)"; | |||
deviceCallBack.onClickEvent(type,"主料3号仓",1000,detail); | |||
}); | |||
viewBinding.layoutFood.btnFood4.setOnClickListener(v->{ | |||
NewToastUtil.getInstance().showToast("倒入主料4号仓"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addMainFood((4)); | |||
})); | |||
deviceCallBack.onClickEvent(type,"主料4号仓",1000); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "主料"; | |||
detail.materialType = 1; | |||
detail.processvalue = "主料名称,"+viewBinding.layoutFood.tvFood4.getText().toString()+"|主料位置,4号位|延迟(秒),0"; | |||
detail.processms = "主料("+viewBinding.layoutFood.tvFood4.getText().toString()+",4号位,0)"; | |||
deviceCallBack.onClickEvent(type,"主料4号仓",1000,detail); | |||
}); | |||
viewBinding.layoutFood.btnFood5.setOnClickListener(v->{ | |||
NewToastUtil.getInstance().showToast("倒入主料5号仓"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addMainFood((5)); | |||
})); | |||
deviceCallBack.onClickEvent(type,"主料5号仓",1000); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "主料"; | |||
detail.materialType = 1; | |||
detail.processvalue = "主料名称,"+viewBinding.layoutFood.tvFood5.getText().toString()+"|主料位置,5号位|延迟(秒),0"; | |||
detail.processms = "主料("+viewBinding.layoutFood.tvFood5.getText().toString()+",5号位,0)"; | |||
deviceCallBack.onClickEvent(type,"主料5号仓",1000,detail); | |||
}); | |||
viewBinding.layoutFood.btnFood6.setOnClickListener(v->{ | |||
NewToastUtil.getInstance().showToast("倒入主料6号仓"); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addMainFood((6)); | |||
})); | |||
deviceCallBack.onClickEvent(type,"主料6号仓",1000); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "主料"; | |||
detail.materialType = 1; | |||
detail.processvalue = "主料名称,"+viewBinding.layoutFood.tvFood6.getText().toString()+"|主料位置,6号位|延迟(秒),0"; | |||
detail.processms = "主料("+viewBinding.layoutFood.tvFood6.getText().toString()+",6号位,0)"; | |||
deviceCallBack.onClickEvent(type,"主料6号仓",1000,detail); | |||
}); | |||
} | |||
@@ -396,31 +466,51 @@ public class DeviceControlDialog extends DialogFragment { | |||
viewBinding.layoutStir.stirProgress.setValue(progressStir,true); | |||
}); | |||
viewBinding.layoutStir.btnStirStart.setOnClickListener(v->{ | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "双向搅拌"; | |||
detail.materialType = 1; | |||
detail.processvalue = "搅拌档位,"+progressStir*10+"|搅拌控制,启动搅拌|正转时间,3|反转时间,3|延迟(秒),0"; | |||
detail.processms = "双向搅拌("+progressStir*10+",启动搅拌,3,3,0)"; | |||
if(progressStir==0){ | |||
NewToastUtil.getInstance().showToast("搅拌 档位:0"); | |||
deviceCallBack.onClickEvent(type,"停止搅拌",0); | |||
deviceCallBack.onClickEvent(type,"停止搅拌",0,detail); | |||
return; | |||
} | |||
NewToastUtil.getInstance().showToast("开始搅拌 档位:"+progressStir); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(progressStir,1))); | |||
deviceCallBack.onClickEvent(type,"开始搅拌",0); | |||
NewToastUtil.getInstance().showToast("启动搅拌 档位:"+progressStir); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(progressStir*10,1))); | |||
deviceCallBack.onClickEvent(type,"启动搅拌",0,detail); | |||
}); | |||
viewBinding.layoutStir.btnStirStop.setOnClickListener(v->{ | |||
progressStir = 0; | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "双向搅拌"; | |||
detail.materialType = 1; | |||
detail.processvalue = "搅拌档位,"+progressStir*10+"|搅拌控制,停止搅拌|正转时间,3|反转时间,3|延迟(秒),0"; | |||
detail.processms = "双向搅拌("+progressStir*10+",停止搅拌,3,3,0)"; | |||
viewBinding.layoutStir.stirProgress.setValue(0,true); | |||
NewToastUtil.getInstance().showToast("停止搅拌"); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(0,2))); | |||
deviceCallBack.onClickEvent(type,"停止搅拌",0); | |||
deviceCallBack.onClickEvent(type,"停止搅拌",1000,detail); | |||
}); | |||
viewBinding.layoutStir.btnStirDown.setOnClickListener(v->{ | |||
NewToastUtil.getInstance().showToast("电机下降"); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(2))); | |||
deviceCallBack.onClickEvent(type,"电机下降",5000); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "升降"; | |||
detail.materialType = 1; | |||
detail.processvalue = "升降控制,下降|延迟(秒),0"; | |||
detail.processms = "升降(下降,0)"; | |||
deviceCallBack.onClickEvent(type,"下降",8000,detail); | |||
}); | |||
viewBinding.layoutStir.btnStirUp.setOnClickListener(v->{ | |||
NewToastUtil.getInstance().showToast("电机上升"); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(1))); | |||
deviceCallBack.onClickEvent(type,"电机上升",5000); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "升降"; | |||
detail.materialType = 1; | |||
detail.processvalue = "升降控制,上升|延迟(秒),0"; | |||
detail.processms = "升降(上升,0)"; | |||
deviceCallBack.onClickEvent(type,"上升",8000,detail); | |||
}); | |||
} | |||
@@ -449,7 +539,7 @@ public class DeviceControlDialog extends DialogFragment { | |||
} | |||
public interface DeviceCallBack{ | |||
void onClickEvent(int type,String value,long time); | |||
void onClickEvent(int type, String value, long time, BPA_GOODS_PROCESS_DETAIL detail); | |||
void onClickDismiss(); | |||
} | |||
@@ -33,9 +33,11 @@ import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ProcessValueUtil; | |||
import com.bonait.bnframework.databinding.DialogEditGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.event.FreshLocalGoodPicEvent; | |||
import com.bonait.bnframework.event.ImageSelectEvent; | |||
import com.bonait.bnframework.ui.activity.CookingActivity; | |||
import com.bonait.bnframework.ui.activity.DiyProcessActivity; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifySpinnerAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.SelectAttributeListAdapter; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
@@ -63,6 +65,12 @@ public class EditGoodsDialog extends DialogFragment { | |||
private String goodId = ""; | |||
private BPA_GOODS goods; | |||
public boolean isDismiss = false; | |||
private ClassifySpinnerAdapter spinnerAdapter;//属性组合列表 | |||
private List<String> groupList =new ArrayList<>(); | |||
/** | |||
* 可编辑 | |||
*/ | |||
private boolean isEdit = false; | |||
/** | |||
* 属性列表 | |||
*/ | |||
@@ -83,6 +91,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
setStyle(STYLE_NORMAL, R.style.DialogScale); | |||
if(getArguments()!=null){ | |||
goodId = getArguments().getString("goodId"); | |||
isEdit = getArguments().getBoolean("isEdit"); | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if(goods!=null){ | |||
@@ -112,7 +121,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
params.height = ViewGroup.LayoutParams.MATCH_PARENT; | |||
window.setAttributes(params); | |||
} | |||
updateNameLayout(); | |||
initView(); | |||
updateAttributeData(); | |||
} | |||
@@ -128,7 +137,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
*/ | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_close1, R.id.btn_close2,R.id.btn_close3, | |||
R.id.btn_next1,R.id.btn_next2,R.id.btn_to_cook,R.id.btn_last1,R.id.btn_edit_process, | |||
R.id.btn_next1,R.id.btn_next2,R.id.btn_to_cook,R.id.btn_last1,R.id.btn_last3,R.id.btn_edit_process, | |||
R.id.good_image,R.id.btn_last2}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
@@ -150,7 +159,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
goods.name = viewBinding.layoutName.editName.getText().toString(); | |||
goods.url = picUrl; | |||
GoodsDBUtil.update(goods); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
EventBus.getDefault().post(new FreshLocalGoodPicEvent()); | |||
if(attributeList.isEmpty()){ | |||
changePage(3); | |||
@@ -165,7 +174,11 @@ public class EditGoodsDialog extends DialogFragment { | |||
} | |||
return; | |||
} | |||
changePage(3); | |||
if(!hasGroup().isEmpty()){ | |||
changePage(3); | |||
}else { | |||
NewToastUtil.getInstance().showToast("不存在该组合"); | |||
} | |||
break; | |||
case R.id.btn_to_cook: | |||
jumpToCook(); | |||
@@ -176,6 +189,13 @@ public class EditGoodsDialog extends DialogFragment { | |||
case R.id.btn_last2: | |||
changePage(1); | |||
break; | |||
case R.id.btn_last3: | |||
if(attributeList.isEmpty()){ | |||
changePage(1); | |||
}else { | |||
changePage(2); | |||
} | |||
break; | |||
case R.id.good_image: | |||
Intent intent = new Intent(getContext(), ImageChooseActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
@@ -184,6 +204,47 @@ public class EditGoodsDialog extends DialogFragment { | |||
} | |||
} | |||
/** | |||
* 判断是否存在该组合 | |||
*/ | |||
private String hasGroup(){ | |||
String groupId = ""; | |||
String idList = selectAttributeListAdapter.getSubAttributeIdList(); | |||
for(BPA_GOODS_SUBATTRIBUTE_GROUP bean : SubAttributeGroupDBUtil.getByGoodsId(goods.id)){ | |||
if(bean.subAttributeIdList.equals(idList)){ | |||
subattributeGroup = bean; | |||
groupId = bean.id; | |||
break; | |||
}else if(bean.subAttributeIdList.contains(",")&&idList.contains(",")){ | |||
String[] res = bean.subAttributeIdList.split(","); | |||
String[] res2 = idList.split(","); | |||
if (res.length == res2.length) { | |||
boolean xx = true; | |||
for (String s : res) { | |||
if (!idList.contains(s)) { | |||
xx = false; | |||
break; | |||
} | |||
} | |||
if (xx) { | |||
groupId = bean.id; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
LogUtils.d(TAG+"hasGroup groupId="+groupId); | |||
if(!isEdit){ | |||
if(groupId.isEmpty()){ | |||
return ""; | |||
} | |||
// if(GoodsProcessDetailDBUtil.getByGroupId(groupId).isEmpty()){ | |||
// return groupId; | |||
// } | |||
} | |||
return groupId; | |||
} | |||
/** | |||
* 上一步 下一步切换 | |||
* @param pos | |||
@@ -197,21 +258,19 @@ public class EditGoodsDialog extends DialogFragment { | |||
viewBinding.layoutAttribute.getRoot().setVisibility(View.GONE); | |||
break; | |||
case 2: | |||
viewBinding.layoutName.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutMainfoods.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutAttribute.getRoot().setVisibility(View.VISIBLE); | |||
break; | |||
case 3: | |||
addAttributeGroup(); | |||
updateMainFoodsName(); | |||
LogUtils.d(TAG+" submit mainFoods="+ mainFoods); | |||
viewBinding.layoutName.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutAttribute.getRoot().setVisibility(View.GONE); | |||
viewBinding.layoutMainfoods.getRoot().setVisibility(View.VISIBLE); | |||
viewBinding.layoutMainfoods.title3.setText(goods.name+"-"+selectAttributeListAdapter.getSubAttributeNameList()); | |||
String name = selectAttributeListAdapter.getSubAttributeNameList(); | |||
viewBinding.layoutMainfoods.title3.setText(name.isEmpty()?goods.name:(goods.name+"-"+name)); | |||
break; | |||
} | |||
} | |||
@@ -320,7 +379,14 @@ public class EditGoodsDialog extends DialogFragment { | |||
* 跳转去烹饪页面 | |||
*/ | |||
private void jumpToCook(){ | |||
//TODO | |||
LogUtils.d(" jumpToCook subAttributeGroupName="+subattributeGroup.name+";subAttributeGroupId="+subattributeGroup.id+";goodI="+goodId); | |||
Intent intent = new Intent(getContext(), CookingActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
intent.putExtra("subAttributeGroupId",subattributeGroup.id); | |||
intent.putExtra("isTest",false); | |||
intent.putExtra("subAttributeGroupName",subattributeGroup.name); | |||
intent.putExtra("goodId",goodId); | |||
startActivity(intent); | |||
dismiss(); | |||
} | |||
@@ -348,8 +414,32 @@ public class EditGoodsDialog extends DialogFragment { | |||
/** | |||
* 更新名称 | |||
*/ | |||
private void updateNameLayout(){ | |||
private void initView(){ | |||
viewBinding.layoutName.editName.setText(Objects.requireNonNull(GoodsDBUtil.getById(goodId)).name); | |||
if(!isEdit){ | |||
viewBinding.layoutName.editName.setEnabled(false); | |||
viewBinding.layoutName.editName.setFocusable(false); | |||
viewBinding.layoutName.editName.setFocusableInTouchMode(false); | |||
viewBinding.layoutMainfoods.editName1.setEnabled(false); | |||
viewBinding.layoutMainfoods.editName1.setFocusable(false); | |||
viewBinding.layoutMainfoods.editName1.setFocusableInTouchMode(false); | |||
viewBinding.layoutMainfoods.editName2.setEnabled(false); | |||
viewBinding.layoutMainfoods.editName2.setFocusable(false); | |||
viewBinding.layoutMainfoods.editName2.setFocusableInTouchMode(false); | |||
viewBinding.layoutMainfoods.editName3.setEnabled(false); | |||
viewBinding.layoutMainfoods.editName3.setFocusable(false); | |||
viewBinding.layoutMainfoods.editName3.setFocusableInTouchMode(false); | |||
viewBinding.layoutMainfoods.editName4.setEnabled(false); | |||
viewBinding.layoutMainfoods.editName4.setFocusable(false); | |||
viewBinding.layoutMainfoods.editName4.setFocusableInTouchMode(false); | |||
viewBinding.layoutMainfoods.editName5.setEnabled(false); | |||
viewBinding.layoutMainfoods.editName5.setFocusable(false); | |||
viewBinding.layoutMainfoods.editName5.setFocusableInTouchMode(false); | |||
viewBinding.layoutMainfoods.editName6.setEnabled(false); | |||
viewBinding.layoutMainfoods.editName6.setFocusable(false); | |||
viewBinding.layoutMainfoods.editName6.setFocusableInTouchMode(false); | |||
viewBinding.layoutMainfoods.btnEditProcess.setVisibility(View.GONE); | |||
} | |||
} | |||
/** | |||
@@ -357,7 +447,38 @@ public class EditGoodsDialog extends DialogFragment { | |||
*/ | |||
public void updateAttributeData(){ | |||
LogUtils.d(TAG+" updateAttributeData"); | |||
groupList.clear(); | |||
groupList.add("未选择"); | |||
for (BPA_GOODS_SUBATTRIBUTE_GROUP group : SubAttributeGroupDBUtil.getByGoodsId(goodId)){ | |||
groupList.add(group.name); | |||
} | |||
int pos = 0; | |||
for(int i =0;i<groupList.size();i++){ | |||
if(groupList.get(i).equals(selectAttributeListAdapter.getSubAttributeNameList())){ | |||
pos = i+1; | |||
} | |||
} | |||
spinnerAdapter = new ClassifySpinnerAdapter(getContext(), groupList); | |||
viewBinding.layoutAttribute.spinnerList.setAdapter(spinnerAdapter); | |||
viewBinding.layoutAttribute.spinnerList.setSelection(pos); | |||
selectAttributeListAdapter = new SelectAttributeListAdapter(getContext(), R.layout.item_select_attribute_list,attributeList); | |||
selectAttributeListAdapter.setListener(new SelectAttributeListAdapter.CallBackListener() { | |||
@Override | |||
public void onClick() { | |||
if(!hasGroup().isEmpty()){ | |||
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); | |||
int pos = 0; | |||
for(int i =0;i<groupList.size();i++){ | |||
if(groupList.get(i).equals(selectAttributeListAdapter.getSubAttributeNameList())){ | |||
pos = i+1; | |||
} | |||
} | |||
viewBinding.layoutAttribute.spinnerList.setSelection(pos); | |||
}else{ | |||
viewBinding.layoutAttribute.groupDesc.setText("不存在选中组合"); | |||
} | |||
} | |||
}); | |||
viewBinding.layoutAttribute.listAttribute.setAdapter(selectAttributeListAdapter); | |||
} | |||
@@ -26,6 +26,7 @@ import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.FragmentHomeDevicesBinding; | |||
@@ -144,6 +145,9 @@ public class HomeDevicesFragment extends BaseFragment { | |||
viewBinding.device.btnFire.setOnClickListener(view->{ | |||
showControlDialog(1); | |||
}); | |||
if(ConfigName.getInstance().user.name.contains("一般用户")){ | |||
viewBinding.reset.setVisibility(View.GONE); | |||
} | |||
viewBinding.reset.setOnClickListener(v->{ | |||
if(ConfigName.getInstance().isFastClick()){ | |||
return; | |||
@@ -155,7 +159,7 @@ public class HomeDevicesFragment extends BaseFragment { | |||
private DeviceControlDialog.DeviceCallBack deviceCallBack = new DeviceControlDialog.DeviceCallBack() { | |||
@Override | |||
public void onClickEvent(int type, String value,long time) { | |||
public void onClickEvent(int type, String value, long time, BPA_GOODS_PROCESS_DETAIL detail) { | |||
switch (type){ | |||
case 1: | |||
if(value.contains("启动加热")){ | |||
@@ -187,7 +191,7 @@ public class HomeDevicesFragment extends BaseFragment { | |||
break; | |||
case 4: | |||
switch (value){ | |||
case "开始搅拌": | |||
case "启动搅拌": | |||
isStir=true; | |||
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_btn_run_anim_looper); | |||
((AnimationDrawable)viewBinding.device.btnStir.getBackground()).start(); | |||
@@ -199,7 +203,7 @@ public class HomeDevicesFragment extends BaseFragment { | |||
handler.removeMessages(MSG_STOP_SILOS); | |||
isStir=false; | |||
break; | |||
case "电机下降": | |||
case "下降": | |||
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); | |||
params.topMargin = DimensUtil.getDimens(250); | |||
viewBinding.device.btnUpDown.setLayoutParams(params); | |||
@@ -214,7 +218,7 @@ public class HomeDevicesFragment extends BaseFragment { | |||
handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time); | |||
isUp=false; | |||
break; | |||
case "电机上升": | |||
case "上升": | |||
ConstraintLayout.LayoutParams params2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams(); | |||
params2.topMargin = DimensUtil.getDimens(150); | |||
viewBinding.device.btnUpDown.setLayoutParams(params2); | |||
@@ -240,8 +244,9 @@ public class HomeDevicesFragment extends BaseFragment { | |||
} | |||
}; | |||
/** | |||
* 改变设备图片 | |||
*/ | |||
private void changeDevicePic(){ | |||
if(isFire){ | |||
if(isStir){ | |||
@@ -279,6 +284,9 @@ public class HomeDevicesFragment extends BaseFragment { | |||
* @param type 1加热 2液体 3主料 4搅拌 | |||
*/ | |||
private void showControlDialog(int type){ | |||
if(ConfigName.getInstance().user.name.contains("一般用户")){ | |||
return; | |||
} | |||
if(ConfigName.getInstance().isFastClick()){ | |||
return; | |||
} | |||
@@ -286,7 +294,7 @@ public class HomeDevicesFragment extends BaseFragment { | |||
NewToastUtil.getInstance().showToast("设备已急停,请关闭急停按钮再调试!"); | |||
return; | |||
} | |||
if(getActivity()!=null && !ConfigName.getInstance().user.name.contains("一般用户")){ | |||
if(getActivity()!=null){ | |||
if(deviceControlDialog == null){ | |||
deviceControlDialog = new DeviceControlDialog(); | |||
} | |||
@@ -374,5 +382,19 @@ public class HomeDevicesFragment extends BaseFragment { | |||
handler = null; | |||
} | |||
deviceCallBack = null; | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(0,2))); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(1))); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(0,false))); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addWater(0f,true); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().addThickenWater(0f,true); | |||
})); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
for(int i =1;i<=9;i++){ | |||
ModbusHelper.get().addMaterial(0f,i,true); | |||
} | |||
})); | |||
} | |||
} |
@@ -20,11 +20,11 @@ import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.FragmentHomeFoodsBinding; | |||
import com.bonait.bnframework.ui.fragment.goods.CloudGoodsFragment; | |||
import com.bonait.bnframework.ui.fragment.goods.LocalGoodsFragment; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import com.orhanobut.logger.Logger; | |||
import butterknife.ButterKnife; | |||
@@ -90,7 +90,6 @@ public class HomeFoodsFragment extends BaseFragment { | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initTopBar(); | |||
SelectTab(1); | |||
requestData(); | |||
} | |||
/** | |||
@@ -129,11 +128,11 @@ public class HomeFoodsFragment extends BaseFragment { | |||
private void requestData(){ | |||
if (NetworkUtils.checkNetworkAvailable(context)) { | |||
if(!viewModel.hasData){ | |||
ToastUtils.info("正在请求云端数据"); | |||
NewToastUtil.getInstance().showToast("正在请求云端数据"); | |||
viewModel.fetchCloudData(context); | |||
} | |||
} else { | |||
ToastUtils.warning("无网络,请先连接网络!!!"); | |||
NewToastUtil.getInstance().showToastError("无网络,请先连接网络!!!"); | |||
} | |||
} | |||
@@ -12,8 +12,6 @@ import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.BottomNavigationNewActivity; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.DishTestActivity; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.LoginActivity; | |||
import com.bonait.bnframework.ViewModel.CustomView.XComDialog; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
@@ -23,8 +21,10 @@ import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogWithCancelConfirmBinding; | |||
import com.bonait.bnframework.databinding.FragmentHomeMainBinding; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.ui.activity.EditGoodsActivity; | |||
import com.bonait.bnframework.ui.activity.ErrorInfoActivity; | |||
import com.bonait.bnframework.ui.activity.MainActivity; | |||
import com.bonait.bnframework.ui.activity.SetSeasoningActivity; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import com.orhanobut.logger.Logger; | |||
/** | |||
@@ -53,26 +53,41 @@ public class HomeMainFragment extends BaseFragment { | |||
LogUtils.d("Home4Fragment onViewCreated"); | |||
} | |||
private boolean isManagerUser(){ | |||
if(ConfigName.getInstance().user.userID.equals("研发用户")){ | |||
return true; | |||
} | |||
NewToastUtil.getInstance().showToast("对不起,当前账号暂无权限"); | |||
return false; | |||
} | |||
/** | |||
* 初始化 | |||
*/ | |||
private void initView() { | |||
if (ConfigName.getInstance().user.userID.equals("研发用户")) { | |||
binding.yauserGn.setVisibility(View.VISIBLE); | |||
} else { | |||
binding.yauserGn.setVisibility(View.GONE); | |||
} | |||
binding.llClassify.setOnClickListener(v->{ | |||
((BottomNavigationNewActivity)getActivity()).jumpClassifyActivity(); | |||
if(!isManagerUser()){ | |||
return; | |||
} | |||
if(getActivity()!=null){ | |||
((MainActivity)getActivity()).jumpClassifyActivity(); | |||
} | |||
}); | |||
binding.llGoods.setOnClickListener(v->{ | |||
OpenActivity(EditGoodsActivity.class); | |||
binding.llYanfa.setOnClickListener(v->{ | |||
if(!isManagerUser()){ | |||
return; | |||
} | |||
if(getActivity()!=null){ | |||
((MainActivity)getActivity()).jumpGoodsActivity(); | |||
} | |||
}); | |||
binding.llSilos.setOnClickListener(v->{ | |||
if(!isManagerUser()){ | |||
return; | |||
} | |||
OpenActivity(SetSeasoningActivity.class); | |||
}); | |||
binding.llYanfa.setOnClickListener(v->{ | |||
OpenActivity(DishTestActivity.class); | |||
binding.llError.setOnClickListener(v->{ | |||
OpenActivity(ErrorInfoActivity.class); | |||
}); | |||
binding.logout.setOnClickListener(v->{ | |||
String title = "温馨提示!"; | |||
@@ -10,7 +10,6 @@ import android.view.View; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.lifecycle.ViewModelProvider; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
@@ -23,9 +22,10 @@ import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.FragmentCloudGoodsBinding; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.CloudGoodsAdapter; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import java.util.ArrayList; | |||
import java.util.Objects; | |||
@@ -72,7 +72,6 @@ public class CloudGoodsFragment extends BaseFragment { | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
viewModel = new ViewModelProvider(getActivity()).get(HomeGoodsViewModel.class); | |||
initView(); | |||
initData(); | |||
updateData(); | |||
@@ -92,7 +91,14 @@ public class CloudGoodsFragment extends BaseFragment { | |||
@SuppressLint("NotifyDataSetChanged") | |||
private void initView(){ | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
viewBinding.btnFresh.setOnClickListener(v->{ | |||
if (ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
NewToastUtil.getInstance().showToast("正在请求云端数据"); | |||
viewModel.fetchCloudData(getContext()); | |||
}); | |||
goodsAdapter = new CloudGoodsAdapter(){ | |||
@Override | |||
@@ -136,6 +142,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
classifyList.add(goodsClassify); | |||
} | |||
} | |||
classifyAdapter.setCurrentPosition(0); | |||
classifyAdapter.setNewData(classifyList); | |||
} | |||
@@ -143,15 +150,18 @@ public class CloudGoodsFragment extends BaseFragment { | |||
goodsList.clear(); | |||
if(!classifyList.isEmpty()){ | |||
String goodsId = classifyList.get(position).id; | |||
for (GoodsClassifyBean bean : ConfigName.getInstance().cloudGoodsList){ | |||
if(goodsId.equals(bean.getGoodsTypeId())){ | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = goodsInfoListBean.getGoodsName(); | |||
goods.id = goodsInfoListBean.getGoodsId(); | |||
goodsList.add(goods); | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
for (GoodsClassifyBean bean : viewModel.cloudGoodsList.getValue()){ | |||
if(goodsId.equals(bean.getGoodsTypeId())){ | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = goodsInfoListBean.getGoodsName(); | |||
goods.id = goodsInfoListBean.getGoodsId(); | |||
goods.classifyId = bean.getGoodsTypeId(); | |||
goodsList.add(goods); | |||
} | |||
break; | |||
} | |||
break; | |||
} | |||
} | |||
} | |||
@@ -186,7 +196,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
private boolean downLoadCloudGoods(int pos){ | |||
BPA_GOODS goods = goodsAdapter.getData().get(pos); | |||
BPA_GOODS_CLASSIFY goodsClassify = classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()); | |||
if(GoodsDBUtil.getById(goods.id)!=null){ | |||
if(GoodsDBUtil.getByIdAndClassifyId(goods.id,goodsClassify.id)!=null){ | |||
ToastUtils.warning("请勿重复下载,本地商品已存在!!!"); | |||
return false; | |||
}else { | |||
@@ -16,7 +16,6 @@ import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.BottomNavigationNewActivity; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
@@ -30,9 +29,11 @@ import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.databinding.FragmentLocalGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodPicEvent; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.activity.EditClassifyActivity; | |||
import com.bonait.bnframework.ui.activity.EditGoodsActivity; | |||
import com.bonait.bnframework.ui.activity.MainActivity; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.LocalGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.AddGoodsDialog; | |||
@@ -101,6 +102,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
context = getContext(); | |||
initView(); | |||
updateData(); | |||
EventBus.getDefault().register(this); | |||
} | |||
@SuppressLint("NotifyDataSetChanged") | |||
@@ -122,6 +124,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
} | |||
Bundle bundle = new Bundle(); | |||
bundle.putString("goodId",mData.get(position).id); | |||
bundle.putBoolean("isEdit",isEdit); | |||
editGoodsDialog.setArguments(bundle); | |||
if(getActivity()!=null){ | |||
editGoodsDialog.show(getActivity().getSupportFragmentManager(),"editGoods"); | |||
@@ -199,8 +202,8 @@ public class LocalGoodsFragment extends BaseFragment { | |||
} | |||
private void jumpClassify(){ | |||
if(getActivity() instanceof BottomNavigationNewActivity){ | |||
((BottomNavigationNewActivity)getActivity()).jumpClassifyActivity(); | |||
if(getActivity() instanceof MainActivity){ | |||
((MainActivity)getActivity()).jumpClassifyActivity(); | |||
}else if (getActivity() instanceof EditGoodsActivity){ | |||
Intent intent = new Intent(getContext(), EditClassifyActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
@@ -233,7 +236,6 @@ public class LocalGoodsFragment extends BaseFragment { | |||
public void onPause() { | |||
super.onPause(); | |||
LogUtils.d("LocalGoodsFragment onPause"); | |||
EventBus.getDefault().unregister(this); | |||
if(addGoodsDialog!=null && addGoodsDialog.isDismiss){ | |||
addGoodsDialog.onDestroy(); | |||
addGoodsDialog = null; | |||
@@ -248,13 +250,13 @@ public class LocalGoodsFragment extends BaseFragment { | |||
public void onResume() { | |||
super.onResume(); | |||
LogUtils.d("LocalGoodsFragment onResume"); | |||
EventBus.getDefault().register(this); | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
LogUtils.d("LocalGoodsFragment onDestroy"); | |||
EventBus.getDefault().unregister(this); | |||
if(goodsList!=null){ | |||
goodsList.clear(); | |||
classifyList.clear(); | |||
@@ -281,10 +283,16 @@ public class LocalGoodsFragment extends BaseFragment { | |||
//接收图片选择事件 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onImageSelectEvent(FreshLocalGoodsEvent event){ | |||
public void onImageSelectEvent(FreshLocalGoodPicEvent event){ | |||
if(handler!=null){ | |||
handler.removeMessages(MSG_FRESH_GOODS); | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,FRESH_DELAY_TIME);//避免快速点击 | |||
} | |||
} | |||
//接收图片选择事件 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onGoodsChangeEvent(FreshLocalGoodsEvent event){ | |||
updateData(); | |||
} | |||
} |
@@ -1,12 +1,20 @@ | |||
package com.bonait.bnframework.ui.viewmodel; | |||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; | |||
import android.content.Context; | |||
import androidx.lifecycle.MutableLiveData; | |||
import androidx.lifecycle.ViewModel; | |||
import com.alibaba.fastjson.TypeReference; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.API.APIHelper; | |||
import com.bonait.bnframework.HBL.API.APIResultT; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
import com.bonait.bnframework.Model.MaterialData; | |||
import com.bonait.bnframework.Model.MaterialRequestPar; | |||
import com.bonait.bnframework.Model.ProcessValueUtil; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
@@ -14,19 +22,17 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
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_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.util.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.MaterialUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.model.ResListAPI; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
import com.lzy.okgo.model.Response; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
@@ -45,28 +51,83 @@ public class HomeGoodsViewModel extends ViewModel { | |||
public void fetchCloudData(Context context){ | |||
if (NetworkUtils.checkNetworkAvailable(context)) { | |||
if (ConfigName.getInstance().organizeMode == null) { | |||
return; | |||
} | |||
OkGo.<ResListAPI<GoodsClassifyBean>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoods, | |||
ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceId)) | |||
.tag(context) | |||
.headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)) | |||
.execute(new JsonDialogCallback<ResListAPI<GoodsClassifyBean>>(context) { | |||
@Override | |||
public void onSuccess(Response<ResListAPI<GoodsClassifyBean>> response) { | |||
ResListAPI<GoodsClassifyBean> allDataResAPI = response.body(); | |||
if (allDataResAPI.succeeded && allDataResAPI.data != null && allDataResAPI.data.size() > 0) { | |||
// ConfigName.getInstance().cloudGoodsList.clear(); | |||
// ConfigName.getInstance().cloudGoodsList.addAll(allDataResAPI.data); | |||
cloudGoodsList.setValue(allDataResAPI.data); | |||
hasData = true; | |||
} | |||
} | |||
}); | |||
ThreadManager.get().execute(new Thread(()->{ | |||
GetGoodsInfo(); | |||
GetMaterialInfo(); | |||
})); | |||
// if (ConfigName.getInstance().organizeMode == null) { | |||
// return; | |||
// } | |||
// OkGo.<ResListAPI<GoodsClassifyBean>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoods, | |||
// ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceId)) | |||
// .tag(context) | |||
// .headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)) | |||
// .execute(new JsonDialogCallback<ResListAPI<GoodsClassifyBean>>(context) { | |||
// @Override | |||
// public void onSuccess(Response<ResListAPI<GoodsClassifyBean>> response) { | |||
// ResListAPI<GoodsClassifyBean> allDataResAPI = response.body(); | |||
// | |||
// if (allDataResAPI.succeeded && allDataResAPI.data != null && allDataResAPI.data.size() > 0) { | |||
//// ConfigName.getInstance().cloudGoodsList.clear(); | |||
//// ConfigName.getInstance().cloudGoodsList.addAll(allDataResAPI.data); | |||
// cloudGoodsList.setValue(allDataResAPI.data); | |||
// hasData = true; | |||
// } | |||
// } | |||
// }); | |||
} | |||
} | |||
public void GetGoodsInfo(){ | |||
String autoKey = ConfigName.getInstance().DeviceAutoKey; | |||
String url = "https://cfv.black-pa.com/kitchbase/api/goods/Getdevicegoods?deviceId=257"; | |||
LogUtils.d("GetGoodsInfo url="+url); | |||
APIHelper.PostT(url,null,null,new TypeReference<APIResultT<List<GoodsClassifyBean>>>(){}).OnSource(s->{ | |||
LogUtils.d("GetGoodsInfo s.Content="+s.Content); | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
cloudGoodsList.setValue(s.Content); | |||
} | |||
}); | |||
hasData = true; | |||
}); | |||
} | |||
private static void GetMaterialInfo(){ | |||
String url = "https://cfv.black-pa.com/saasbase/api/ExternalPlatform/Material/GetMaterialPageList"; | |||
LogUtils.d("GetMaterialInfo url="+url); | |||
String key ="2c39bc05-25c2-46c4-b5c6-dba349058492"; | |||
APIHelper.PostT(url,new MaterialRequestPar(1,100),key,new TypeReference<APIResultT<MaterialData>>(){}).OnSource(s->{ | |||
UpdateLocalMaterial(s.Content); | |||
}); | |||
} | |||
private static void UpdateLocalMaterial(MaterialData materialModels){ | |||
List<BPA_MATERIAL> datas = new ArrayList<>(); | |||
ArrayList<BPA_MATERIAL> materials = MaterialUtil.GetMaterialALL(); | |||
for(int i = 0;i<materialModels.data.size();i++){ | |||
if(materialModels.data.get(i).name!=null){ | |||
boolean isExit = false; | |||
for(BPA_MATERIAL bean : materials){ | |||
if (bean.name.equals(materialModels.data.get(i).name)) { | |||
isExit = true; | |||
break; | |||
} | |||
} | |||
if(!isExit){ | |||
BPA_MATERIAL bpa_material =new BPA_MATERIAL(); | |||
bpa_material.name = materialModels.data.get(i).name; | |||
bpa_material.id = materialModels.data.get(i).id; | |||
datas.add(bpa_material); | |||
} | |||
} | |||
} | |||
LogUtils.d("UpdateLocalMaterial datas.size="+datas); | |||
if(!datas.isEmpty()){ | |||
MaterialUtil.addMaterialList(BPA_MATERIAL.class,datas); | |||
NewToastUtil.getInstance().showToast("已同步云端物料信息"); | |||
} | |||
} | |||
@@ -137,7 +198,6 @@ public class HomeGoodsViewModel extends ViewModel { | |||
processDetail.processname = goodsTechnologyActionListBean.getStepName(); | |||
processDetail.processvalue = value; | |||
GoodsProcessDetailDBUtil.add(processDetail); | |||
} | |||
} | |||
break; | |||
@@ -1,6 +1,8 @@ | |||
package com.bonait.bnframework.ui.widget; | |||
import android.content.Context; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.text.SpannableStringBuilder; | |||
import android.text.Spanned; | |||
import android.text.style.ForegroundColorSpan; | |||
@@ -17,6 +19,7 @@ import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ViewLayoutToastBinding; | |||
/** | |||
* @author: liup | |||
* @description: | |||
@@ -26,6 +29,9 @@ public class NewToastUtil { | |||
private static NewToastUtil instance; | |||
private Toast toast; | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
}; | |||
public static synchronized NewToastUtil getInstance(){ | |||
if(instance == null){ | |||
@@ -39,43 +45,45 @@ public class NewToastUtil { | |||
} | |||
public void showToast(String message){ | |||
if(toast != null){ | |||
toast.cancel(); | |||
} | |||
toast = new Toast(MainApplication.getContext()); | |||
// toast.cancel(); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(MainApplication.getContext()).inflate(R.layout.view_layout_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(100)); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
handler.post(() -> { | |||
if(toast != null){ | |||
toast.cancel(); | |||
} | |||
toast = new Toast(MainApplication.getContext()); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(MainApplication.getContext()).inflate(R.layout.view_layout_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(100)); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
}); | |||
} | |||
public void showToastError(String message){ | |||
if(toast != null){ | |||
toast.cancel(); | |||
} | |||
toast = new Toast(MainApplication.getContext()); | |||
// toast.cancel(); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(MainApplication.getContext()).inflate(R.layout.view_layout_error_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(180)); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
handler.post(() -> { | |||
if(toast != null){ | |||
toast.cancel(); | |||
} | |||
toast = new Toast(MainApplication.getContext()); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(MainApplication.getContext()).inflate(R.layout.view_layout_error_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(180)); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
}); | |||
} | |||
@@ -86,26 +94,28 @@ public class NewToastUtil { | |||
* @param colorText | |||
*/ | |||
public void showToastRedColor(Context context,String message,String colorText){ | |||
if(toast == null){ | |||
toast = new Toast(MainApplication.getContext()); | |||
} | |||
toast.cancel(); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(context).inflate(R.layout.view_layout_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(content); | |||
int index = colorText==null?0:content.indexOf(colorText); | |||
if(index>0){ | |||
spannableStringBuilder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.red_primary)),index,index+colorText.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); | |||
} | |||
binding.toastText.setText(spannableStringBuilder); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(180)); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
handler.post(() -> { | |||
if(toast == null){ | |||
toast = new Toast(MainApplication.getContext()); | |||
} | |||
toast.cancel(); | |||
String content = message; | |||
if(message.length() > 50){ | |||
content = message.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(context).inflate(R.layout.view_layout_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(content); | |||
int index = colorText==null?0:content.indexOf(colorText); | |||
if(index>0){ | |||
spannableStringBuilder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.red_primary)),index,index+colorText.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); | |||
} | |||
binding.toastText.setText(spannableStringBuilder); | |||
toast.setGravity(Gravity.BOTTOM,0,DimensUtil.getDimens(180)); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
}); | |||
} | |||
} |
@@ -9,6 +9,7 @@ import androidx.recyclerview.widget.LinearSmoothScroller; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
/** | |||
* @author: liup | |||
@@ -36,7 +37,7 @@ public class SmoothLayoutManager extends LinearLayoutManager { | |||
@Override | |||
public int calculateDtToFit(int viewStart, int viewEnd, int boxStart, int boxEnd, | |||
int snapPreference) { | |||
return boxStart - viewStart + context.getResources().getDimensionPixelSize(R.dimen.dp_50); | |||
return (int) (boxStart - viewStart + DisplayManager.getWidthScaleRate()*context.getResources().getDimensionPixelSize(R.dimen.dp_100)); | |||
} | |||
// @Override | |||
@@ -0,0 +1,13 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<corners | |||
android:topLeftRadius="@dimen/dp_5" | |||
android:topRightRadius="@dimen/dp_5" | |||
android:bottomLeftRadius="@dimen/dp_5" | |||
android:bottomRightRadius="@dimen/dp_5"/> | |||
<solid android:color="#C6D7ED"/> | |||
<stroke android:color="@color/gray" android:width="@dimen/dp_1"/> | |||
</shape> |
@@ -9,7 +9,7 @@ | |||
</item> | |||
<item > | |||
<shape > | |||
<solid android:color="@color/white"/> | |||
<solid android:color="@color/transparent"/> | |||
</shape> | |||
</item> | |||
</selector> |
@@ -71,7 +71,7 @@ | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:clickable="true"> | |||
<RelativeLayout | |||
android:layout_width="wrap_content" | |||
@@ -9,163 +9,113 @@ | |||
android:orientation="vertical" | |||
tools:context=".ViewModel.ActivityViewModel.CookingNewActivity"> | |||
<RelativeLayout | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical" | |||
android:layout_marginTop="?attr/qmui_topbar_height" | |||
android:background="@color/qmui_config_color_white"> | |||
<!-- 其他 --> | |||
<LinearLayout | |||
<RelativeLayout | |||
android:id="@+id/top" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_height="@dimen/dp_400" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
> | |||
<TextView | |||
android:id="@+id/goodname" | |||
android:layout_width="340dp" | |||
android:layout_height="wrap_content" | |||
android:fontFamily="@font/fz2" | |||
android:shadowColor="#65000000" | |||
android:shadowDx="0.0" | |||
android:shadowDy="10.0" | |||
android:shadowRadius="6.0" | |||
android:text="爆炒鱼香肉丝" | |||
android:textColor="@color/black" | |||
android:textSize="45dp" /> | |||
<TextView | |||
android:id="@+id/runtime" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:fontFamily="@font/ziti0" | |||
android:text="00 : 00" | |||
android:layout_below="@id/goodname" | |||
android:textColor="@color/black" | |||
android:textSize="50dp" | |||
android:textStyle="bold" /> | |||
<com.bonait.bnframework.ViewModel.CustomView.jingdutiao | |||
android:id="@+id/progress" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
android:layout_marginLeft="20dp" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginRight="20dp" | |||
android:layout_weight="1.2"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical"> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical"> | |||
<TextView | |||
android:id="@+id/goodname" | |||
android:layout_width="340dp" | |||
android:layout_height="wrap_content" | |||
android:fontFamily="@font/fz2" | |||
android:shadowColor="#65000000" | |||
android:shadowDx="0.0" | |||
android:shadowDy="10.0" | |||
android:shadowRadius="6.0" | |||
android:text="爆炒鱼香肉丝" | |||
android:textColor="@color/black" | |||
android:textSize="45dp" /> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="@dimen/dp_10"> | |||
<TextView | |||
android:id="@+id/runtime" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:fontFamily="@font/ziti0" | |||
android:text="00 : 00" | |||
android:textColor="@color/black" | |||
android:textSize="50dp" | |||
android:textStyle="bold" /> | |||
<com.bonait.bnframework.ViewModel.CustomView.imagebuttom | |||
android:id="@+id/zanting_goodmake" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:contentDescription="111" | |||
android:visibility="gone" | |||
app:imagesrc_ks="@mipmap/zhizuo_zt" | |||
app:imagesrc_tz="@mipmap/zhizuo_jx" /> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="5dp"> | |||
<com.bonait.bnframework.ViewModel.CustomView.jingdutiao | |||
android:id="@+id/t_jindu" | |||
android:layout_width="match_parent" | |||
android:layout_height="45dp" /> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
<TextView | |||
android:id="@+id/gongxumiaoshu" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="步骤1 加油50g" | |||
android:textColor="#797373" | |||
android:layout_alignParentBottom="true" | |||
android:layout_marginRight="@dimen/dp_110" | |||
android:textSize="32sp" /> | |||
<com.bonait.bnframework.ViewModel.CustomView.imagebuttom | |||
android:id="@+id/start_goodmake" | |||
android:layout_width="wrap_content" | |||
android:layout_height="110dp" | |||
android:layout_alignParentRight="true" | |||
android:layout_marginTop="5dp" | |||
app:imagesrc_ks="@mipmap/zhizuo_ks" | |||
app:imagesrc_tz="@mipmap/zhizuo_js" /> | |||
<ImageView | |||
android:id="@+id/kancaipu" | |||
android:layout_width="190dp" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_alignParentBottom="true" | |||
android:layout_marginBottom="@dimen/dp_50" | |||
android:layout_marginRight="-80dp" | |||
android:src="@mipmap/yy_h1" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_marginTop="@dimen/dp_5" | |||
android:layout_below="@id/start_goodmake" | |||
android:layout_height="@dimen/dp_45" /> | |||
<ImageView | |||
android:id="@+id/start_goodmake" | |||
android:layout_width="@dimen/dp_110" | |||
android:layout_height="@dimen/dp_110" | |||
android:layout_alignParentEnd="true" | |||
android:layout_marginTop="@dimen/dp_5" | |||
android:src="@mipmap/zhizuo_ks" | |||
/> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/recycle_step" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
android:layout_weight="2"> | |||
<ImageView | |||
android:id="@+id/device_image" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:scaleType="fitCenter" | |||
android:scaleY="1.5" | |||
android:scaleX="1.5" | |||
android:src="@mipmap/device_normal" /> | |||
<TextView | |||
android:id="@+id/test1" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentBottom="true" | |||
tools:text="88888888" | |||
android:ellipsize="start" | |||
android:textSize="@dimen/sp_24" | |||
/> | |||
<TextView | |||
android:id="@+id/test2" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_above="@id/test1" | |||
tools:text="88888888\nsssssssssss\ns" | |||
android:ellipsize="start" | |||
android:textColor="@color/color3" | |||
android:textSize="@dimen/sp_24" | |||
/> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="@dimen/dp_175" | |||
android:orientation="vertical" | |||
android:paddingStart="@dimen/dp_5" | |||
android:paddingEnd="@dimen/dp_5" | |||
android:paddingTop="@dimen/dp_5" | |||
android:paddingBottom="@dimen/dp_5" | |||
android:background="@drawable/bg_step_bord" | |||
app:layoutManager="com.bonait.bnframework.ui.widget.SmoothLayoutManager" | |||
/> | |||
</RelativeLayout> | |||
<!-- <ImageView--> | |||
<!-- android:id="@+id/look_goods"--> | |||
<!-- android:layout_width="@dimen/dp_190"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:layout_alignParentEnd="true"--> | |||
<!-- android:layout_marginTop="@dimen/dp_350"--> | |||
<!-- android:layout_marginEnd="@dimen/_dp_80"--> | |||
<!-- android:src="@mipmap/yy_h1" />--> | |||
<include | |||
android:id="@+id/device" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
layout="@layout/view_device_control" | |||
/> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
<com.qmuiteam.qmui.widget.QMUITopBarLayout | |||
android:id="@+id/topbar" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:background="@color/app_color_blue" /> | |||
android:layout_height="wrap_content" > | |||
<TextView | |||
android:id="@+id/back" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/sp_32" | |||
android:text="返回" | |||
android:drawableLeft="@mipmap/fanhui" | |||
android:gravity="center" | |||
android:paddingLeft="@dimen/dp_5" | |||
android:drawablePadding="@dimen/dp_5" | |||
/> | |||
</com.qmuiteam.qmui.widget.QMUITopBarLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -68,7 +68,7 @@ | |||
app:layout_constraintTop_toBottomOf="@id/line1" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_320" | |||
android:layout_marginLeft="@dimen/dp_330" | |||
android:background="@color/color3" | |||
/> | |||
@@ -102,7 +102,7 @@ | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/recycle_step" | |||
android:layout_width="@dimen/dp_300" | |||
android:layout_width="@dimen/dp_310" | |||
android:layout_height="0dp" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginTop="@dimen/dp_10" | |||
@@ -0,0 +1,217 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:card_view="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:fitsSystemWindows="true" | |||
android:id="@+id/root" | |||
android:orientation="vertical" | |||
> | |||
<com.qmuiteam.qmui.widget.QMUITopBarLayout | |||
android:id="@+id/topbar" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" > | |||
<TextView | |||
android:id="@+id/back" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/sp_32" | |||
android:text="返回" | |||
android:drawableLeft="@mipmap/fanhui" | |||
android:gravity="center" | |||
android:paddingLeft="@dimen/dp_5" | |||
android:drawablePadding="@dimen/dp_5" | |||
/> | |||
</com.qmuiteam.qmui.widget.QMUITopBarLayout> | |||
<ScrollView | |||
android:layout_width="match_parent" | |||
android:layout_marginTop="?attr/qmui_topbar_height" | |||
android:layout_height="match_parent"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:orientation="vertical" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:id="@+id/tv_info" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_100" | |||
android:textColor="@color/black" | |||
android:text="设备信息:正常" | |||
android:textSize="@dimen/sp_42" | |||
android:gravity="center_vertical" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_status" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_100" | |||
android:textColor="@color/black" | |||
android:text="设备状态:未连接" | |||
android:textSize="@dimen/sp_42" | |||
android:gravity="center_vertical" | |||
/> | |||
<View | |||
android:layout_width="match_parent" | |||
android:background="@color/color3" | |||
android:layout_height="@dimen/dp_2" | |||
/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:gravity="center_vertical" | |||
android:layout_height="@dimen/dp_140"> | |||
<ImageView | |||
android:id="@+id/img_up" | |||
android:layout_width="@dimen/dp_100" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:layout_height="@dimen/dp_100" | |||
android:src="@mipmap/ic_device_up" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_up" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:textColor="@color/black" | |||
android:text="上升超时报警(正常)" | |||
android:textSize="@dimen/sp_42" | |||
android:gravity="center_vertical" | |||
/> | |||
</LinearLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:background="@color/color3" | |||
android:layout_height="@dimen/dp_2" | |||
/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:gravity="center_vertical" | |||
android:layout_height="@dimen/dp_140"> | |||
<ImageView | |||
android:id="@+id/img_down" | |||
android:layout_width="@dimen/dp_100" | |||
android:layout_height="@dimen/dp_100" | |||
android:src="@mipmap/ic_device_down" | |||
android:layout_marginStart="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_down" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/black" | |||
android:text="下降超时报警(正常)" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:textSize="@dimen/sp_42" | |||
android:gravity="center_vertical" | |||
/> | |||
</LinearLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:background="@color/color3" | |||
android:layout_height="@dimen/dp_2" | |||
/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:gravity="center_vertical" | |||
android:layout_height="@dimen/dp_140"> | |||
<ImageView | |||
android:id="@+id/img_updown" | |||
android:layout_width="@dimen/dp_100" | |||
android:layout_height="@dimen/dp_100" | |||
android:src="@mipmap/ic_device_updown" | |||
android:layout_marginStart="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_updown" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/black" | |||
android:text="升降传感器(正常)" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:textSize="@dimen/sp_42" | |||
android:gravity="center_vertical" | |||
/> | |||
</LinearLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:background="@color/color3" | |||
android:layout_height="@dimen/dp_2" | |||
/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:gravity="center_vertical" | |||
android:layout_height="@dimen/dp_140"> | |||
<ImageView | |||
android:id="@+id/img_stir" | |||
android:layout_width="@dimen/dp_100" | |||
android:layout_height="@dimen/dp_100" | |||
android:src="@mipmap/ic_device_stir" | |||
android:layout_marginStart="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_stir" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/black" | |||
android:text="搅拌传感器(正常)" | |||
android:textSize="@dimen/sp_42" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:gravity="center_vertical" | |||
/> | |||
</LinearLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:background="@color/color3" | |||
android:layout_height="@dimen/dp_2" | |||
/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:gravity="center_vertical" | |||
android:layout_height="@dimen/dp_140"> | |||
<ImageView | |||
android:id="@+id/img_stop" | |||
android:layout_width="@dimen/dp_100" | |||
android:layout_height="@dimen/dp_100" | |||
android:src="@mipmap/ic_device_stop" | |||
android:layout_marginStart="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_stop" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/black" | |||
android:text="急停按钮(正常)" | |||
android:textSize="@dimen/sp_42" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:gravity="center_vertical" | |||
/> | |||
</LinearLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:background="@color/color3" | |||
android:layout_height="@dimen/dp_2" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_reset" | |||
android:layout_width="@dimen/dp_250" | |||
style="@style/TextView_btn_normal" | |||
android:layout_height="@dimen/dp_100" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toLeftOf="@id/line2" | |||
android:layout_marginBottom="@dimen/dp_25" | |||
android:text="一键复位" | |||
android:textSize="@dimen/sp_42" | |||
android:background="@drawable/bg_round50_red_btn" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:layout_gravity="center" | |||
/> | |||
</LinearLayout> | |||
</ScrollView> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,84 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:fitsSystemWindows="true" | |||
android:background="@color/white"> | |||
<com.qmuiteam.qmui.widget.QMUIViewPager | |||
android:id="@+id/viewpager" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:fitsSystemWindows="true" | |||
> | |||
<!-- <com.bonait.bnframework.common.watermark.WaterMarkView--> | |||
<!-- android:id="@+id/wm"--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:singleLine="false"--> | |||
<!-- app:water_mark_align="CENTER"--> | |||
<!-- app:water_mark_degree="-30"--> | |||
<!-- app:water_mark_dx="300px"--> | |||
<!-- app:water_mark_dy="340px"--> | |||
<!-- app:water_mark_sync="true"--> | |||
<!-- app:water_mark_text="黑菠萝技术部"--> | |||
<!-- app:water_mark_textBold="true"--> | |||
<!-- app:water_mark_textColor="@color/watermarkcolor"--> | |||
<!-- app:water_mark_textSize="14px" />--> | |||
</com.qmuiteam.qmui.widget.QMUIViewPager> | |||
<com.bonait.bnframework.common.view.BottomNavigationBar | |||
android:id="@+id/navigation" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:clipChildren="false" | |||
android:layout_gravity="bottom"> | |||
</com.bonait.bnframework.common.view.BottomNavigationBar> | |||
<!-- <LinearLayout--> | |||
<!-- android:id="@+id/penrenzhong"--> | |||
<!-- android:layout_gravity="right|bottom"--> | |||
<!-- android:layout_marginBottom="80dp"--> | |||
<!-- android:layout_marginRight="@dimen/dp_10"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:orientation="vertical"--> | |||
<!-- android:visibility="gone"--> | |||
<!-- tools:visibility="visible"--> | |||
<!-- android:clickable="true">--> | |||
<!-- <RelativeLayout--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="wrap_content">--> | |||
<!-- <ImageView--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:src="@mipmap/penrenzhong"/>--> | |||
<!-- <TextView--> | |||
<!-- android:id="@+id/penrenzhongtext"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:layout_centerInParent="true"--> | |||
<!-- android:layout_marginTop="@dimen/dp_10"--> | |||
<!-- android:text="01:00"--> | |||
<!-- android:textAlignment="center"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="20dp"--> | |||
<!-- android:textStyle="bold" />--> | |||
<!-- <TextView--> | |||
<!-- android:layout_centerHorizontal="true"--> | |||
<!-- android:layout_marginTop="38dp"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:text="烹饪中"--> | |||
<!-- android:textAlignment="center"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="12dp"--> | |||
<!-- android:textStyle="bold" />--> | |||
<!-- </RelativeLayout>--> | |||
<!-- </LinearLayout>--> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -98,8 +98,8 @@ | |||
<com.bonait.bnframework.ViewModel.CustomView.imagebuttom | |||
android:id="@+id/start_goodmake" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_150" | |||
android:layout_centerInParent="true" | |||
app:imagesrc_ks="@mipmap/zhizuo_ks2" | |||
android:layout_gravity="right" | |||
@@ -119,15 +119,25 @@ | |||
app:imagesrc_tz="@mipmap/zhizuo_jx1" /> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/recycleView" | |||
android:id="@+id/recycleStep" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_200" | |||
android:layout_gravity="bottom" | |||
android:background="#C6D7ED" | |||
android:paddingEnd="@dimen/dp_150" | |||
android:paddingStart="@dimen/dp_5" | |||
android:paddingTop="@dimen/dp_5" | |||
android:paddingBottom="@dimen/dp_5" | |||
android:orientation="vertical" | |||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> | |||
<include | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
layout="@layout/dialog_rec_save_process" | |||
android:id="@+id/save" | |||
android:visibility="gone" | |||
/> | |||
</FrameLayout> | |||
@@ -0,0 +1,56 @@ | |||
<?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" | |||
android:background="#7f000000" | |||
android:focusable="true" | |||
android:focusableInTouchMode="true" | |||
android:clickable="true" | |||
xmlns:app="http://schemas.android.com/apk/res-auto"> | |||
<LinearLayout | |||
android:layout_width="@dimen/dp_700" | |||
android:layout_height="@dimen/dp_1050" | |||
android:padding="20dp" | |||
android:background="@drawable/silosbj" | |||
android:layout_gravity="center" | |||
android:orientation="vertical"> | |||
<ImageView | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
android:layout_gravity="center_horizontal" | |||
android:src="@mipmap/jl1"/> | |||
<TextView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:text="工艺步骤记录" | |||
android:textAlignment="center" | |||
android:background="@drawable/gongyi_bj" | |||
android:textColor="@color/white" | |||
android:padding="@dimen/dp_5" | |||
android:textSize="@dimen/sp_32" /> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/recycleStepSave" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_750" | |||
android:layout_gravity="bottom" | |||
android:paddingStart="@dimen/dp_10" | |||
android:background="#C6D7ED" | |||
android:paddingEnd="@dimen/dp_10" | |||
android:orientation="vertical" | |||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" /> | |||
<ImageView | |||
android:id="@+id/btn_save" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_100" | |||
android:layout_gravity="center_horizontal" | |||
android:scaleType="fitCenter" | |||
android:src="@mipmap/queding2" /> | |||
</LinearLayout> | |||
</FrameLayout> |
@@ -5,34 +5,131 @@ | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="@drawable/bg_round25_white"> | |||
<TextView | |||
android:id="@+id/title3" | |||
style="@style/TextView_btn_dialog" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:background="@drawable/bg_round25_top_yellow" | |||
android:paddingRight="@dimen/dp_80" | |||
android:paddingLeft="@dimen/dp_80" | |||
android:ellipsize="start" | |||
android:lines="1" | |||
android:paddingLeft="@dimen/dp_80" | |||
android:paddingRight="@dimen/dp_80" | |||
android:singleLine="true" | |||
android:ellipsize="start" | |||
style="@style/TextView_btn_dialog" | |||
android:text="按编号填写主料名称" | |||
/> | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" /> | |||
<ImageView | |||
android:id="@+id/img_mainfood" | |||
android:layout_width="@dimen/dp_400" | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/cl_mainfood" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_400" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/title3" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:src="@mipmap/device_mainfood_position" | |||
/> | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
> | |||
<ImageView | |||
android:id="@+id/img_mainfood" | |||
android:layout_width="@dimen/dp_600" | |||
android:layout_height="@dimen/dp_400" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
android:scaleType="fitXY" | |||
android:src="@mipmap/device_mainfood_position" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food4" | |||
android:layout_width="@dimen/dp_170" | |||
android:layout_height="@dimen/dp_150" | |||
android:text="④" | |||
android:textSize="@dimen/sp_54" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textStyle="bold" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:background="@drawable/bg_main_food_position_btn" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food5" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_110" | |||
android:text="⑤" | |||
android:textSize="@dimen/sp_54" | |||
android:paddingBottom="@dimen/dp_20" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_200" | |||
android:background="@drawable/bg_main_food_position_btn" | |||
android:textColor="@color/white" | |||
android:textStyle="bold" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food6" | |||
android:layout_width="@dimen/dp_170" | |||
android:layout_height="@dimen/dp_150" | |||
android:text="⑥" | |||
android:textSize="@dimen/sp_54" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintTop_toTopOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_430" | |||
android:background="@drawable/bg_main_food_position_btn" | |||
android:textColor="@color/white" | |||
android:textStyle="bold" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food1" | |||
android:layout_width="@dimen/dp_170" | |||
android:layout_height="@dimen/dp_150" | |||
android:text="①" | |||
android:textSize="@dimen/sp_54" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintBottom_toBottomOf="@id/img_mainfood" | |||
android:background="@drawable/bg_main_food_position_btn" | |||
android:textColor="@color/white" | |||
android:textStyle="bold" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food2" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_110" | |||
android:text="②" | |||
android:textSize="@dimen/sp_54" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
app:layout_constraintBottom_toBottomOf="@id/img_mainfood" | |||
android:layout_marginLeft="@dimen/dp_200" | |||
android:background="@drawable/bg_main_food_position_btn" | |||
android:textColor="@color/white" | |||
android:textStyle="bold" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food3" | |||
android:layout_width="@dimen/dp_170" | |||
android:layout_height="@dimen/dp_150" | |||
android:text="③" | |||
android:textSize="@dimen/sp_54" | |||
android:gravity="center" | |||
app:layout_constraintRight_toRightOf="@id/img_mainfood" | |||
app:layout_constraintBottom_toBottomOf="@id/img_mainfood" | |||
android:background="@drawable/bg_main_food_position_btn" | |||
android:textColor="@color/white" | |||
android:textStyle="bold" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
@@ -40,7 +137,7 @@ | |||
android:id="@+id/ll1" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/img_mainfood" | |||
app:layout_constraintTop_toBottomOf="@id/cl_mainfood" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:orientation="horizontal" | |||
android:gravity="center" | |||
@@ -240,7 +337,6 @@ | |||
android:layout_width="@dimen/dp_255" | |||
android:layout_height="@dimen/dp_120" | |||
android:layout_marginLeft="@dimen/dp_80" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_48" | |||
android:textColor="@color/white" | |||
@@ -260,4 +356,22 @@ | |||
android:background="@mipmap/ic_clear_white_48dp" | |||
/> | |||
<FrameLayout | |||
android:id="@+id/btn_last3" | |||
android:layout_width="@dimen/dp_80" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent"> | |||
<ImageView | |||
android:layout_width="@dimen/dp_50" | |||
android:layout_height="@dimen/dp_50" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:background="@mipmap/fanhui" | |||
android:scaleType="fitXY" | |||
android:layout_gravity="center" | |||
/> | |||
</FrameLayout> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -17,17 +17,58 @@ | |||
android:text="选择属性" | |||
/> | |||
<TextView | |||
android:id="@+id/desc1" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_90" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_20" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:layout_marginTop="@dimen/dp_100" | |||
android:text="已有组合:" | |||
style="@style/TextView_desc" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinner_list" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_460" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc1" | |||
app:layout_constraintTop_toTopOf="@id/desc1" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<ListView | |||
android:id="@+id/list_attribute" | |||
android:layout_width="@dimen/dp_620" | |||
android:layout_height="wrap_content" | |||
app:layout_constraintTop_toBottomOf="@id/title2" | |||
app:layout_constraintTop_toBottomOf="@id/desc1" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_margin="@dimen/dp_20" | |||
android:divider="#00000000" | |||
tools:layout_height="300dp" | |||
android:orientation="vertical" | |||
/> | |||
<TextView | |||
android:id="@+id/group_desc" | |||
android:layout_width="wrap_content" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_height="@dimen/dp_80" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintRight_toRightOf="parent" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_30" | |||
android:textColor="@color/blue" | |||
android:text="存在选中组合" | |||
android:gravity="center" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_next2" | |||
android:layout_width="@dimen/dp_155" | |||
@@ -45,10 +45,10 @@ | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food1" | |||
android:id="@+id/btn_food4" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_200" | |||
android:text="①" | |||
android:text="④" | |||
android:textSize="@dimen/sp_54" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
@@ -76,10 +76,10 @@ | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food2" | |||
android:id="@+id/btn_food5" | |||
android:layout_width="@dimen/dp_240" | |||
android:layout_height="@dimen/dp_110" | |||
android:text="②" | |||
android:text="⑤" | |||
android:textSize="@dimen/sp_54" | |||
android:paddingBottom="@dimen/dp_20" | |||
android:gravity="center" | |||
@@ -109,10 +109,10 @@ | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food3" | |||
android:id="@+id/btn_food6" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_200" | |||
android:text="③" | |||
android:text="⑥" | |||
android:textSize="@dimen/sp_54" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
@@ -141,10 +141,10 @@ | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food4" | |||
android:id="@+id/btn_food1" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_200" | |||
android:text="④" | |||
android:text="①" | |||
android:textSize="@dimen/sp_54" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="@id/img_mainfood" | |||
@@ -174,10 +174,10 @@ | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food5" | |||
android:id="@+id/btn_food2" | |||
android:layout_width="@dimen/dp_240" | |||
android:layout_height="@dimen/dp_110" | |||
android:text="⑤" | |||
android:text="②" | |||
android:paddingBottom="@dimen/dp_20" | |||
android:textSize="@dimen/sp_54" | |||
android:gravity="center" | |||
@@ -207,10 +207,10 @@ | |||
/> | |||
<TextView | |||
android:id="@+id/btn_food6" | |||
android:id="@+id/btn_food3" | |||
android:layout_width="@dimen/dp_200" | |||
android:layout_height="@dimen/dp_200" | |||
android:text="⑥" | |||
android:text="③" | |||
android:textSize="@dimen/sp_54" | |||
android:gravity="center" | |||
app:layout_constraintRight_toRightOf="@id/img_mainfood" | |||
@@ -12,11 +12,24 @@ | |||
android:id="@+id/recycler_classify" | |||
android:layout_width="@dimen/dp_140" | |||
android:orientation="vertical" | |||
android:layout_marginBottom="@dimen/dp_95" | |||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<Button | |||
android:id="@+id/btn_fresh" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_70" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/white" | |||
android:text="刷新" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:layout_alignParentBottom="true" | |||
android:layout_alignParentEnd="true" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
/> | |||
<TextView | |||
android:id="@+id/line1" | |||
android:layout_width="@dimen/dp_1" | |||
@@ -36,7 +49,6 @@ | |||
android:layout_marginLeft="@dimen/dp_161" | |||
android:id="@+id/recycler_goods" | |||
android:layout_width="match_parent" | |||
android:layout_marginBottom="@dimen/dp_95" | |||
android:orientation="vertical" | |||
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager" | |||
app:spanCount="3" | |||
@@ -72,6 +72,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_below="@id/tab" | |||
android:paddingBottom="@dimen/dp_95" | |||
/> | |||
</RelativeLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -53,9 +53,8 @@ | |||
/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:id="@+id/ll_goods" | |||
android:id="@+id/ll_yanfa" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1" | |||
@@ -64,17 +63,18 @@ | |||
<ImageView | |||
android:layout_width="match_parent" | |||
android:layout_height="130dp" | |||
android:src="@mipmap/home_goods_ic" /> | |||
android:src="@mipmap/home_caiping_ic" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:textSize="32sp" | |||
android:text="菜品管理" | |||
android:text="菜品研发" | |||
android:layout_gravity="center" | |||
android:textColor="#FE8733" | |||
android:textColor="#5C6A7C" | |||
android:textStyle="bold" | |||
/> | |||
</LinearLayout> | |||
</LinearLayout> | |||
<LinearLayout | |||
@@ -108,7 +108,7 @@ | |||
</LinearLayout> | |||
<LinearLayout | |||
android:id="@+id/ll_yanfa" | |||
android:id="@+id/ll_error" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1" | |||
@@ -117,14 +117,14 @@ | |||
<ImageView | |||
android:layout_width="match_parent" | |||
android:layout_height="130dp" | |||
android:src="@mipmap/home_caiping_ic" /> | |||
android:src="@mipmap/home_error" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:textSize="32sp" | |||
android:text="菜品研发" | |||
android:text="报警信息" | |||
android:layout_gravity="center" | |||
android:textColor="#5C6A7C" | |||
android:textColor="#D4237A" | |||
android:textStyle="bold" | |||
/> | |||
</LinearLayout> | |||
@@ -110,11 +110,12 @@ | |||
<ListView | |||
android:id="@+id/list_view" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_height="0dp" | |||
android:layout_marginTop="@dimen/dp_3" | |||
android:divider="#00000000" | |||
android:dividerHeight="@dimen/dp_3" | |||
app:layout_constraintTop_toBottomOf="@+id/tab_title" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_25" | |||
android:layout_marginRight="@dimen/dp_25" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
@@ -69,11 +69,12 @@ | |||
<ListView | |||
android:id="@+id/list_view" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_height="0dp" | |||
android:layout_marginTop="@dimen/dp_3" | |||
android:divider="#00000000" | |||
android:dividerHeight="@dimen/dp_3" | |||
app:layout_constraintTop_toBottomOf="@+id/tab_title" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:layout_marginLeft="@dimen/dp_25" | |||
android:layout_marginRight="@dimen/dp_25" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
@@ -36,41 +36,35 @@ | |||
android:textStyle="bold" | |||
android:background="#99FFFFFF" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toTopOf="@id/edit" | |||
app:layout_constraintBottom_toTopOf="@id/downLoad" | |||
/> | |||
<LinearLayout | |||
android:id="@+id/edit" | |||
<RelativeLayout | |||
android:id="@+id/downLoad" | |||
android:layout_width="match_parent" | |||
android:orientation="horizontal" | |||
android:gravity="center" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:background="#ddFFFFFF" | |||
android:layout_height="@dimen/dp_60"> | |||
<RelativeLayout | |||
android:id="@+id/downLoad" | |||
android:layout_width="match_parent" | |||
android:orientation="horizontal" | |||
android:gravity="center" | |||
android:layout_height="match_parent"> | |||
<ImageView | |||
android:id="@+id/img3" | |||
android:layout_width="35dp" | |||
android:layout_height="35dp" | |||
android:layout_centerVertical="true" | |||
android:src="@mipmap/yxz" /> | |||
<ImageView | |||
android:id="@+id/img3" | |||
android:layout_width="35dp" | |||
android:layout_height="35dp" | |||
android:layout_centerVertical="true" | |||
android:src="@mipmap/yxz" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="下载" | |||
android:layout_toRightOf="@id/img3" | |||
android:layout_centerVertical="true" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/sp_24" /> | |||
</RelativeLayout> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="下载" | |||
android:layout_toRightOf="@id/img3" | |||
android:layout_centerVertical="true" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/sp_24" /> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
<FrameLayout | |||
android:id="@+id/add" | |||
@@ -1,7 +1,7 @@ | |||
<?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="@dimen/dp_50" | |||
android:layout_height="wrap_content" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<TextView | |||
android:id="@+id/name" | |||
@@ -1,6 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="@dimen/dp_300" | |||
android:layout_width="@dimen/dp_310" | |||
android:layout_height="wrap_content" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
@@ -14,13 +14,13 @@ | |||
android:layout_height="@dimen/dp_70"> | |||
<TextView | |||
android:id="@+id/name" | |||
android:layout_width="@dimen/dp_140" | |||
android:layout_width="@dimen/dp_160" | |||
android:layout_height="@dimen/dp_70" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:textColor="@drawable/selector_select_step_text_color" | |||
android:background="@drawable/selector_select_step_text_bg" | |||
tools:text="1.液体料" | |||
tools:text="1.双向搅拌" | |||
android:textSize="@dimen/sp_32" | |||
android:gravity="center_vertical" | |||
android:duplicateParentState="true" | |||
@@ -31,14 +31,14 @@ | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:src="@mipmap/ll5" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginLeft="@dimen/dp_5" | |||
/> | |||
<ImageView | |||
android:id="@+id/remove_down" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:src="@mipmap/ll6" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginLeft="@dimen/dp_5" | |||
/> | |||
</LinearLayout> | |||
@@ -0,0 +1,29 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:id="@+id/root" | |||
android:orientation="vertical" | |||
> | |||
<TextView | |||
android:id="@+id/name" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_50" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:maxLines="1" | |||
android:singleLine="true" | |||
android:ellipsize="end" | |||
app:layout_constraintTop_toTopOf="parent" | |||
android:textColor="@drawable/selector_select_step_text_color" | |||
android:background="@drawable/selector_select_step_text_bg" | |||
tools:text="1.液体料" | |||
android:textSize="@dimen/sp_32" | |||
android:gravity="center_vertical" | |||
android:duplicateParentState="true" | |||
tools:background="@color/textbg_green" | |||
/> | |||
</LinearLayout> |
@@ -219,6 +219,7 @@ | |||
<dimen name="dp_78">78dp</dimen> | |||
<dimen name="dp_79">79dp</dimen> | |||
<dimen name="dp_80">80dp</dimen> | |||
<dimen name="_dp_80">-80dp</dimen> | |||
<dimen name="dp_81">81dp</dimen> | |||
<dimen name="dp_82">82dp</dimen> | |||
<dimen name="dp_83">83dp</dimen> | |||