@@ -1,3 +0,0 @@ | |||
# Default ignored files | |||
/shelf/ | |||
/workspace.xml |
@@ -7,7 +7,7 @@ | |||
<option name="testRunner" value="GRADLE" /> | |||
<option name="distributionType" value="DEFAULT_WRAPPED" /> | |||
<option name="externalProjectPath" value="$PROJECT_DIR$" /> | |||
<option name="gradleJvm" value="Android Studio default JDK" /> | |||
<option name="gradleJvm" value="corretto-11" /> | |||
<option name="modules"> | |||
<set> | |||
<option value="$PROJECT_DIR$" /> | |||
@@ -11,6 +11,11 @@ | |||
<option name="name" value="JBoss Community repository" /> | |||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> | |||
</remote-repository> | |||
<remote-repository> | |||
<option name="id" value="maven2" /> | |||
<option name="name" value="maven2" /> | |||
<option name="url" value="https://maven.aliyun.com/nexus/content/repositories/releases/" /> | |||
</remote-repository> | |||
<remote-repository> | |||
<option name="id" value="BintrayJCenter" /> | |||
<option name="name" value="BintrayJCenter" /> | |||
@@ -26,15 +31,5 @@ | |||
<option name="name" value="Google" /> | |||
<option name="url" value="https://dl.google.com/dl/android/maven2/" /> | |||
</remote-repository> | |||
<remote-repository> | |||
<option name="id" value="MavenRepo" /> | |||
<option name="name" value="MavenRepo" /> | |||
<option name="url" value="https://repo.maven.apache.org/maven2/" /> | |||
</remote-repository> | |||
<remote-repository> | |||
<option name="id" value="maven2" /> | |||
<option name="name" value="maven2" /> | |||
<option name="url" value="https://maven.aliyun.com/nexus/content/repositories/releases/" /> | |||
</remote-repository> | |||
</component> | |||
</project> |
@@ -1,4 +1,4 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project version="4"> | |||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK" /> | |||
<component name="ExternalStorageConfigurationManager" enabled="true" /> | |||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="corretto-11" project-jdk-type="JavaSDK" /> | |||
</project> |
@@ -39,6 +39,11 @@ android { | |||
} | |||
buildToolsVersion rootProject.ext.buildToolsVersion | |||
packagingOptions{ | |||
exclude("META-INF/LICENSE.md") | |||
exclude("META-INF/LICENSE-notice.md") | |||
} | |||
sourceSets { | |||
main { | |||
res.srcDirs = [ | |||
@@ -54,6 +59,7 @@ android { | |||
dependencies { | |||
implementation fileTree(include: ['*.jar'], dir: 'libs') | |||
implementation 'org.junit.jupiter:junit-jupiter:5.8.1' | |||
//测试相关 | |||
testImplementation 'junit:junit:4.13-beta-2' | |||
@@ -28,15 +28,11 @@ import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.image.utils.LocalCacheUtils; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.modbus.ModbusBasis; | |||
import com.bonait.bnframework.common.modbus.ModbusClient; | |||
import com.bonait.bnframework.common.model.ResAPI; | |||
import com.bonait.bnframework.common.model.mode.ActionJsonMode; | |||
import com.bonait.bnframework.common.model.mode.BatchingInfo; | |||
import com.bonait.bnframework.common.model.mode.BomTechnologyActionInfo; | |||
import com.bonait.bnframework.common.model.mode.BomTypeInfo; | |||
import com.bonait.bnframework.common.model.mode.ResGoodProcess; | |||
import com.bonait.bnframework.common.model.mode.ResSilosModel; | |||
import com.bonait.bnframework.common.model.mode.TechnologyValueMode; | |||
import com.bonait.bnframework.common.model.mode.BatchingInfo; | |||
import com.bonait.bnframework.common.model.mode.CloudGood; | |||
import com.bonait.bnframework.common.model.mode.DeviceInformation; | |||
import com.bonait.bnframework.common.model.mode.FoodMenuInfo; | |||
@@ -46,7 +42,10 @@ import com.bonait.bnframework.common.model.mode.GoodsTypeInfo; | |||
import com.bonait.bnframework.common.model.mode.GoodsUintInfo; | |||
import com.bonait.bnframework.common.model.mode.OrganizeMode; | |||
import com.bonait.bnframework.common.model.mode.ResALLData; | |||
import com.bonait.bnframework.common.model.mode.ResGoodProcess; | |||
import com.bonait.bnframework.common.model.mode.ResSilosModel; | |||
import com.bonait.bnframework.common.model.mode.TechnologyAction; | |||
import com.bonait.bnframework.common.model.mode.TechnologyValueMode; | |||
import com.bonait.bnframework.common.model.mode.UpdateBomInfo; | |||
import com.bonait.bnframework.common.model.mode.UpdateCloudGood; | |||
import com.bonait.bnframework.common.oss.OssHelper; | |||
@@ -894,7 +893,7 @@ public class ConfigData { | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("配料吧台")) { | |||
plcaddresses = ConfigName.getInstance().PLCAddress_调味吧台; | |||
plcaddresses = ConfigName.getInstance().PlcAddress_配料吧台; | |||
// plcaddresses = ConfigName.getInstance().PlcAddress_配料吧台; | |||
resSilosModels=ConfigName.getInstance().Silos_配料吧台; | |||
}else if (ConfigName.getInstance().versionSelectionEnum.equals("奶茶机")) | |||
@@ -903,10 +902,11 @@ public class ConfigData { | |||
resSilosModels=ConfigName.getInstance().Silos_奶茶机; | |||
}else if (ConfigName.getInstance().versionSelectionEnum.equals("味魔方")) | |||
{ | |||
plcaddresses = ConfigName.getInstance().PlcAddress_味魔方; | |||
resSilosModels=ConfigName.getInstance().Silos_味魔方; | |||
}else if(ConfigName.getInstance().versionSelectionEnum.equals("调味吧台")){ | |||
plcaddresses = ConfigName.getInstance().PlcAddress_调味吧台; | |||
resSilosModels=ConfigName.getInstance().Silos_调味吧台; | |||
} | |||
//region 恢复PLC | |||
@@ -0,0 +1,55 @@ | |||
package com.bonait.bnframework.business.deviceControl; | |||
import com.bonait.bnframework.common.helper.I.IReadCallBack; | |||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
/**设备主控模块接口,如PLC*/ | |||
public interface ControllerAble { | |||
void Inital(IWriteCallBack callBack); | |||
/**读取PLC指定地址的值 | |||
* @param address 设备寄存器的modbus地址。 | |||
* */ | |||
<TDataType> TDataType ReadPLC(String address,IReadCallBack callBack); | |||
/**写入PLC指定地址的值 | |||
* @param address 设备寄存器的modbus地址。 | |||
* */ | |||
<TDataType> void WritePLC(String address,TDataType value,IWriteCallBack callBack); | |||
/**打开电机,指定时间后关闭 | |||
* @param index 料仓编号位置索引。 | |||
* @param delayTime 关闭延迟时间,单位:ms | |||
* */ | |||
void openMotorAndClose(int index,int delayTime,IWriteCallBack callBack); | |||
/**打开电机 | |||
* @param index 料仓编号位置索引 | |||
* */ | |||
void openMotor(int index, IWriteCallBack callBack); | |||
/**关闭电机 | |||
* @param index 料仓编号位置索引 | |||
* */ | |||
void closeMotor(int index, IWriteCallBack callBack); | |||
/**打开电机,指定时间后关闭 | |||
* @param name 变量名称。 | |||
* @param delayTime 关闭延迟时间,单位:ms | |||
* */ | |||
void openMotorAndClose(String name,int delayTime,IWriteCallBack callBack); | |||
/**打开电机 | |||
* @param name 变量名称。 | |||
* */ | |||
void openMotor(String name, IWriteCallBack callBack); | |||
/**关闭电机 | |||
* @param name 变量名称。 | |||
* */ | |||
void closeMotor(String name, IWriteCallBack callBack); | |||
/**复位心跳*/ | |||
void clrHeartbeat(IWriteCallBack callBack); | |||
/**读取是否超时*/ | |||
boolean isTimeOut(IReadCallBack callBack); | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.bonait.bnframework.business.deviceControl; | |||
public class DeviceManager { | |||
//region 单例模式 | |||
private static volatile DeviceManager instance = null; | |||
public static DeviceManager get() { | |||
DeviceManager manager = instance; | |||
if (manager == null) { | |||
synchronized (DeviceManager.class) { | |||
manager = instance; | |||
if (manager == null) { | |||
manager = new DeviceManager(); | |||
instance = manager; | |||
} | |||
} | |||
} | |||
return manager; | |||
} | |||
//endregion | |||
} |
@@ -0,0 +1,10 @@ | |||
package com.bonait.bnframework.business.deviceControl; | |||
class PLCControllerTest { | |||
@org.junit.jupiter.api.Test | |||
void writePLC() { | |||
//PLCController controller=new PLCController(); | |||
//controller.WritePLC("300",122.2f,null); | |||
} | |||
} |
@@ -0,0 +1,10 @@ | |||
package com.bonait.bnframework.business.deviceControl; | |||
public enum PLCType { | |||
/**步科PLC*/ | |||
Kinco, | |||
/**三菱系列PLC*/ | |||
MELSEC | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.bonait.bnframework.business.deviceControl; | |||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
/**电子秤设备接口*/ | |||
public interface ScaleAble { | |||
/**设备初始化*/ | |||
void Inital(IWriteCallBack callBack); | |||
/**获取当前重量*/ | |||
int getCurrentWeight(); | |||
void writeCounterWeight(short counterWeight, IWriteCallBack callBack); | |||
/**去皮*/ | |||
void tare(IWriteCallBack callBack); | |||
/**恢复去皮*/ | |||
void cancelTare(IWriteCallBack callBack); | |||
/**零点校准,写入前需要先关闭写保护*/ | |||
void zeroScale(IWriteCallBack callBack); | |||
/**恢复出厂设置,写入前需要先关闭写保护*/ | |||
void factoryReset(IWriteCallBack callBack); | |||
/**打开写保护*/ | |||
void openWriteProtect(IWriteCallBack callBack); | |||
/**关闭写保护,零点校准、写入砝码重量、恢复出厂设置都需要先执行此操作*/ | |||
void closeWriteProtect(IWriteCallBack callBack); | |||
} |
@@ -0,0 +1,229 @@ | |||
package com.bonait.bnframework.business.deviceControl.seasonBar; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import com.bonait.bnframework.business.deviceControl.PLCType; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.helper.I.IReadCallBack; | |||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
import com.bonait.bnframework.common.modbus.ModbusMaster; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
/**PLC控制类*/ | |||
public class PLCController{ | |||
//region 单例模式 | |||
private static volatile PLCController instance = null; | |||
public static PLCController get() { | |||
PLCController manager = instance; | |||
if (manager == null) { | |||
synchronized (PLCController.class) { | |||
manager = instance; | |||
if (manager == null) { | |||
manager = new PLCController(); | |||
instance = manager; | |||
} | |||
} | |||
} | |||
return manager; | |||
} | |||
private PLCController(){}; | |||
//endregion | |||
//region 私有变量 | |||
/**设备的从站ID*/ | |||
private final int slaveId=1; | |||
/**PLC类型是三菱的*/ | |||
private final PLCType plcType=PLCType.MELSEC; | |||
//endregion | |||
public void Inital(IWriteCallBack callBack) { | |||
//TODO:确定初始化逻辑再写。 | |||
} | |||
public <TDataType> TDataType readPLC(String address,Class<TDataType> dataType, IReadCallBack callBack) { | |||
if (Boolean.class.equals(dataType)) { | |||
return dataType.cast(true); | |||
} else if (Short.class.equals(dataType)) { | |||
return dataType.cast((short) 0); | |||
} else if (Integer.class.equals(dataType)) { | |||
return dataType.cast(0); | |||
} else if (Float.class.equals(dataType)) { | |||
return dataType.cast(0.0f); | |||
} else { | |||
// 其他类型的处理逻辑 | |||
return null; // 默认返回 null | |||
} | |||
} | |||
public <TDataType> void writePLC(String address,TDataType value, IWriteCallBack callBack) { | |||
if (ModbusMaster.get().IsConnected && ConfigName.PLC_Address.containsKey(address)){ | |||
String addr=ConfigName.PLC_Address.get(address).address; | |||
if (!addr.isEmpty()&&getModAddr(addr)!=-1){ | |||
try{ | |||
String startAddr=String.valueOf(getModAddr(addr)); | |||
//String startAddr=address; | |||
if (value instanceof Boolean){ | |||
ModbusMaster.get().WriteBool(startAddr,(boolean)value,slaveId,callBack); | |||
} else if (value instanceof boolean[]) { | |||
ModbusMaster.get().WriteBool(startAddr,(boolean[])value,slaveId,callBack); | |||
} else if (value instanceof Integer) { | |||
ModbusMaster.get().WriteInt(startAddr,(int) value,slaveId,callBack); | |||
}else if (value instanceof int[]) { | |||
ModbusMaster.get().WriteInt(startAddr,(int[]) value,slaveId,callBack); | |||
}else if (value instanceof Short) { | |||
ModbusMaster.get().WriteShort(startAddr,(short) value,slaveId,callBack); | |||
}else if (value instanceof short[]) { | |||
ModbusMaster.get().WriteShort(startAddr,(short[])value,slaveId,callBack ); | |||
}else if (value instanceof Float) { | |||
ModbusMaster.get().WriteFloat(startAddr,(float)value,slaveId,callBack ); | |||
}else if (value instanceof Float[]) { | |||
ModbusMaster.get().WriteFloat(startAddr,(float[]) value,slaveId,callBack ); | |||
} | |||
}catch (Exception ex){ | |||
ToastUtils.error("Write PLC error:"+ex.getMessage()); | |||
} | |||
} | |||
} | |||
} | |||
/**适用于普通仓 | |||
* @param index 仓位编号。 | |||
* @param delayTime 开启时间。 | |||
* */ | |||
public void openMotorAndClose(int index, int delayTime, IWriteCallBack callBack) { | |||
try { | |||
openMotor(index, new IWriteCallBack() { | |||
@Override | |||
public void onSuccess() { | |||
new Handler(Looper.getMainLooper()).postDelayed(()->{ | |||
closeMotor(index, new IWriteCallBack() { | |||
@Override | |||
public void onSuccess() { | |||
callBack.onSuccess(); | |||
} | |||
@Override | |||
public void onFailure(String ErrorMsg) { | |||
callBack.onFailure(ErrorMsg); | |||
} | |||
}); | |||
},delayTime); | |||
} | |||
@Override | |||
public void onFailure(String ErrorMsg) { | |||
callBack.onFailure(ErrorMsg); | |||
} | |||
}); | |||
} catch (Exception ex) { | |||
ToastUtils.error("OpenMotorAndClose Exception:" + ex.getMessage()); | |||
} | |||
} | |||
public void openMotor(int index, IWriteCallBack callBack) { | |||
} | |||
public void closeMotor(int index, IWriteCallBack callBack) { | |||
} | |||
/**适用于普通仓(打开后即可关闭,不需要反转)。 | |||
* @param name 仓位名称 | |||
* @param delayTime 打开时间 | |||
* */ | |||
public void openMotorAndClose(String name, int delayTime, IWriteCallBack callBack) { | |||
} | |||
/**打开电机并反转,最后关闭 | |||
* @param name 仓位名称。 | |||
* @param delayTime 开启时间。 | |||
* @param reverseTime 反转时间。 | |||
* */ | |||
public void openAndReverse(String name,int delayTime,int reverseTime,IWriteCallBack callBack){ | |||
} | |||
public void openMotor(String name, IWriteCallBack callBack) { | |||
writePLC(name,true,callBack); | |||
} | |||
public void reverseMotor(String name, IWriteCallBack callBack) { | |||
writePLC(name,false,callBack); | |||
} | |||
public void closeMotor(String name, IWriteCallBack callBack) { | |||
} | |||
public void clrHeartbeat(IWriteCallBack callBack) { | |||
writePLC("心跳时间",(short)0,callBack); | |||
} | |||
public boolean isTimeOut() { | |||
final boolean[] result = {true}; | |||
if (ModbusMaster.get().IsConnected && ConfigName.PLC_Address.containsKey("断线标志")) { | |||
String addr = ConfigName.PLC_Address.get("断线标志").address; | |||
try { | |||
int startAddr=getModAddr(addr); | |||
if (!addr.isEmpty()&& startAddr!= -1) { | |||
ModbusMaster.get().ReadBool(String.valueOf(startAddr), 1, slaveId, val->{ | |||
result[0]=val[0]; | |||
}); | |||
} | |||
} catch (Exception ex) { | |||
ToastUtils.error("Exception message:" + ex.getMessage()); | |||
} | |||
} | |||
return result[0]; | |||
} | |||
/**适用于三菱PLC,只有X,Y,M,D区*/ | |||
private int getModAddr(String address){ | |||
if (address == null) return -1; | |||
address = address.toUpperCase().trim(); | |||
try { | |||
if (address.length() < 2) return Integer.parseInt(address); | |||
String res = address.substring(1); | |||
if (res == null) return -1; | |||
int startAddress=Integer.parseInt(res) ; | |||
//如果是M区地址。 | |||
if (address.contains("M")) { | |||
return startAddress + 4000; | |||
} else if (address.contains("D")) { | |||
return startAddress; | |||
}else if(address.contains("X")){ | |||
return Integer.parseInt(res,8); | |||
}else if(address.contains("Y")){ | |||
return Integer.parseInt(res,8)+300; | |||
}else{ | |||
return Integer.parseInt(address); | |||
} | |||
} catch (Exception e) { | |||
return -1; | |||
} | |||
} | |||
} |
@@ -0,0 +1,112 @@ | |||
package com.bonait.bnframework.business.deviceControl.seasonBar; | |||
import com.bonait.bnframework.business.deviceControl.ScaleAble; | |||
import com.bonait.bnframework.common.helper.DataFormat; | |||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
import com.bonait.bnframework.common.modbus.ModbusMaster; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
/**电子秤实现类*/ | |||
public class ScaleDevice implements ScaleAble { | |||
//region 单例模式 | |||
private static volatile ScaleDevice instance = null; | |||
public static ScaleDevice get() { | |||
ScaleDevice manager = instance; | |||
if (manager == null) { | |||
synchronized (ScaleDevice.class) { | |||
manager = instance; | |||
if (manager == null) { | |||
manager = new ScaleDevice(); | |||
instance = manager; | |||
} | |||
} | |||
} | |||
return manager; | |||
} | |||
private ScaleDevice(){} | |||
//endregion | |||
private final int slaveId=2; | |||
@Override | |||
public void Inital(IWriteCallBack callBack) { | |||
} | |||
@Override | |||
public int getCurrentWeight() { | |||
int[] result=new int[]{0}; | |||
try { | |||
ModbusMaster.get().ReadInt("0",1,2, DataFormat.BADC,val->{ | |||
result[0]=val[0]; | |||
}); | |||
}catch (Exception ex){ | |||
ToastUtils.error("GetCurrentWeight error:" + ex.getMessage()); | |||
} | |||
return result[0]; | |||
} | |||
@Override | |||
public void writeCounterWeight(short counterWeight, IWriteCallBack callBack) { | |||
try { | |||
ModbusMaster.get().WriteShort("6",counterWeight,slaveId,callBack); | |||
}catch (Exception ex){ | |||
ToastUtils.error("Exception message:" + ex.getMessage()); | |||
} | |||
} | |||
@Override | |||
public void tare(IWriteCallBack callBack) { | |||
try { | |||
ModbusMaster.get().WriteShort("21",(short) 1,slaveId,callBack); | |||
}catch (Exception ex){ | |||
ToastUtils.error("Exception message:" + ex.getMessage()); | |||
} | |||
} | |||
@Override | |||
public void cancelTare(IWriteCallBack callBack) { | |||
try { | |||
ModbusMaster.get().WriteShort("21",(short) 2,slaveId,callBack); | |||
}catch (Exception ex){ | |||
ToastUtils.error("Exception message:" + ex.getMessage()); | |||
} | |||
} | |||
@Override | |||
public void zeroScale(IWriteCallBack callBack) { | |||
try { | |||
ModbusMaster.get().WriteShort("22",(short) 1,slaveId,callBack); | |||
}catch (Exception ex){ | |||
ToastUtils.error("Exception message:" + ex.getMessage()); | |||
} | |||
} | |||
@Override | |||
public void factoryReset(IWriteCallBack callBack) { | |||
try { | |||
ModbusMaster.get().WriteShort("22",(short) 9,slaveId,callBack); | |||
}catch (Exception ex){ | |||
ToastUtils.error("Exception message:" + ex.getMessage()); | |||
} | |||
} | |||
@Override | |||
public void openWriteProtect(IWriteCallBack callBack) { | |||
try { | |||
ModbusMaster.get().WriteShort("23",(short) 0,slaveId,callBack); | |||
}catch (Exception ex){ | |||
ToastUtils.error("Exception message:" + ex.getMessage()); | |||
} | |||
} | |||
@Override | |||
public void closeWriteProtect(IWriteCallBack callBack) { | |||
try { | |||
ModbusMaster.get().WriteShort("23",(short) 1,slaveId,callBack); | |||
}catch (Exception ex){ | |||
ToastUtils.error("Exception message:" + ex.getMessage()); | |||
} | |||
} | |||
} |
@@ -3,41 +3,20 @@ package com.bonait.bnframework.common.constant; | |||
import android.app.Application; | |||
import android.content.Context; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.fragment.app.FragmentManager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_USER; | |||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1; | |||
import com.bonait.bnframework.common.db.res.Res_ZDSF; | |||
import com.bonait.bnframework.common.db.res.StatusMode; | |||
import com.bonait.bnframework.common.model.AddrType; | |||
import com.bonait.bnframework.common.model.mode.CloudGood; | |||
import com.bonait.bnframework.common.model.mode.DeviceInformation; | |||
import com.bonait.bnframework.common.model.mode.OrganizeMode; | |||
import com.bonait.bnframework.common.model.mode.ProcessT; | |||
import com.bonait.bnframework.common.model.mode.ResALLData; | |||
import com.bonait.bnframework.common.model.mode.ResSilosModel; | |||
import com.bonait.bnframework.common.model.mode.VersionSelectionEnum; | |||
import com.bonait.bnframework.common.utils.ScreenUtils; | |||
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter; | |||
import com.bonait.bnframework.modules.home.fragment.DingDanfragment; | |||
import com.bonait.bnframework.modules.home.fragment.GongnengFragment; | |||
import com.bonait.bnframework.modules.home.fragment.GuanLifragment; | |||
import com.bonait.bnframework.modules.home.fragment.JiaoYanFragment; | |||
import com.bonait.bnframework.modules.home.fragment.MakeGoodFragment; | |||
import com.bonait.bnframework.modules.home.fragment.SheZhifragment; | |||
import com.bonait.bnframework.modules.mine.fragment.MyFragment; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
@@ -215,7 +194,7 @@ public class ConfigName { | |||
* PLC地址,从数据库-->内存 | |||
*/ | |||
public static ConcurrentHashMap<String, BPA_PLCADDRESS> PLC_Address = new ConcurrentHashMap<String, BPA_PLCADDRESS>(); | |||
//region 味魔方 | |||
/** | |||
* 奶茶机基础PLC模型 | |||
*/ | |||
@@ -259,7 +238,9 @@ public class ConfigName { | |||
}}; | |||
//endreion | |||
//region 奶茶机 | |||
/** | |||
* 奶茶机基础PLC模型 | |||
*/ | |||
@@ -557,7 +538,9 @@ public class ConfigName { | |||
}}; | |||
//endregion | |||
//region 配料吧台 | |||
/** | |||
@@ -879,11 +862,13 @@ public class ConfigName { | |||
// add(new Res_ZDSF("外置通道(十)","VW194.9","VW162","VW62","VW186")); | |||
}}; | |||
//endregion | |||
//region 新版调味吧台 | |||
/** | |||
* 新版调味吧台 | |||
*/ | |||
public List<Res_PLCADDRESS> PLCAddress_调味吧台 = new ArrayList<Res_PLCADDRESS>() {{ | |||
public List<Res_PLCADDRESS> PlcAddress_调味吧台 = new ArrayList<Res_PLCADDRESS>() {{ | |||
add(new Res_PLCADDRESS("心跳时间","D0",1 , 1 )); | |||
add(new Res_PLCADDRESS("外置仓正转1","D1",1 , 1 )); | |||
add(new Res_PLCADDRESS("外置仓正转2","D2",1 , 1 )); | |||
@@ -908,20 +893,47 @@ public class ConfigName { | |||
add(new Res_PLCADDRESS("粉料仓5","D21",1, 1)); | |||
add(new Res_PLCADDRESS("粉料仓6","D22",1, 1)); | |||
add(new Res_PLCADDRESS("普通液体仓1","D23",1, 1)); | |||
add(new Res_PLCADDRESS("普通液体仓2","D23",1, 1)); | |||
add(new Res_PLCADDRESS("普通液体仓2","D24",1, 1)); | |||
add(new Res_PLCADDRESS("进水阀","D40",1, 1)); | |||
add(new Res_PLCADDRESS("排水阀","D41",1, 1)); | |||
add(new Res_PLCADDRESS("加热仓管道1","D42",1, 1)); | |||
add(new Res_PLCADDRESS("加热仓管道2","D43",1, 1)); | |||
add(new Res_PLCADDRESS("三色灯红","D44",1, 1)); | |||
add(new Res_PLCADDRESS("山色灯绿","D45",1, 1)); | |||
add(new Res_PLCADDRESS("山色灯黄","D46",1, 1)); | |||
add(new Res_PLCADDRESS("三色灯绿","D45",1, 1)); | |||
add(new Res_PLCADDRESS("三色灯黄","D46",1, 1)); | |||
add(new Res_PLCADDRESS("清洗加热","D47",1, 1)); | |||
add(new Res_PLCADDRESS("清洗温度","D85",1, 1)); | |||
add(new Res_PLCADDRESS("断线标志","M0",1, 0)); | |||
add(new Res_PLCADDRESS("按钮启动","M1",1, 1)); | |||
add(new Res_PLCADDRESS("清洗液位","M2",1, 1)); | |||
}}; | |||
/** | |||
* 新版调味吧台料仓模型 | |||
*/ | |||
public List<ResSilosModel> Silos_调味吧台 = new ArrayList<ResSilosModel>() {{ | |||
add(new ResSilosModel("外置仓",1 , 1 )); | |||
add(new ResSilosModel("外置仓",2 , 2 )); | |||
add(new ResSilosModel("外置仓",3 , 3 )); | |||
add(new ResSilosModel("外置仓",4 , 4 )); | |||
add(new ResSilosModel("外置仓",5 , 5 )); | |||
add(new ResSilosModel("外置仓",6 , 6 )); | |||
add(new ResSilosModel("加热仓",7 , 7 )); | |||
add(new ResSilosModel("加热仓",8 , 8 )); | |||
add(new ResSilosModel("粉料仓",9 , 9 )); | |||
add(new ResSilosModel("粉料仓",10, 10)); | |||
add(new ResSilosModel("粉料仓",11, 11)); | |||
add(new ResSilosModel("粉料仓",12, 12)); | |||
add(new ResSilosModel("粉料仓",13, 13)); | |||
add(new ResSilosModel("粉料仓",14, 14)); | |||
add(new ResSilosModel("液体仓",15, 15)); | |||
add(new ResSilosModel("液体仓",16, 16)); | |||
}}; | |||
//endregion | |||
/** | |||
@@ -993,12 +1005,12 @@ public class ConfigName { | |||
/** | |||
* 版本信息 | |||
*/ | |||
public String[] versionSelectionValues = new String[]{"奶茶机", "配料吧台","味魔方"}; | |||
public String[] versionSelectionValues = new String[]{"奶茶机", "配料吧台","味魔方","调味吧台"}; | |||
/** | |||
* 选配版本信息 | |||
*/ | |||
public String versionSelectionEnum = "奶茶机"; | |||
public String versionSelectionEnum = "调味吧台"; | |||
//endregion | |||
//region 主页 | |||
@@ -10,6 +10,7 @@ import android.widget.EditText; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.business.deviceControl.seasonBar.ScaleDevice; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.helper.I.IWriteCallBack; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
@@ -83,13 +84,25 @@ public class DzcjyActivity extends BaseActivity { | |||
String outres = edittext_zl.getText().toString().trim(); | |||
if (!outres.equals("")) { | |||
ExecuteTheRecipe.WritePLC("砝码值", Short.parseShort(outres), new IWriteCallBack() { | |||
//region 旧代码 | |||
// ExecuteTheRecipe.WritePLC("砝码值", Short.parseShort(outres), new IWriteCallBack() { | |||
// @Override | |||
// public void onSuccess() { | |||
// ExecuteTheRecipe.WritePLC("砝码值写入",true,null); | |||
// ToastUtils.info("校正重量成功!"); | |||
// } | |||
// | |||
// @Override | |||
// public void onFailure(String ErrorMsg) { | |||
// ToastUtils.error("校正重量失败!"); | |||
// } | |||
// }); | |||
//endregion | |||
ScaleDevice.get().writeCounterWeight(Short.parseShort(outres), new IWriteCallBack(){ | |||
@Override | |||
public void onSuccess() { | |||
ExecuteTheRecipe.WritePLC("砝码值写入",true,null); | |||
ToastUtils.info("校正重量成功!"); | |||
} | |||
@Override | |||
public void onFailure(String ErrorMsg) { | |||
ToastUtils.error("校正重量失败!"); | |||
@@ -60,5 +60,5 @@ ext { // 统一版本入口 | |||
// 调味吧 | |||
// 设置applicationId(这里很重要,两个相同applicationId的apk不同同时安装在同一台Android手机中) | |||
// applicationId= "com.bonait.twb" | |||
// applicationId= "com.bonait.twb" | |||
} |