Browse Source

现场改动,增加高汤仓

调味吧台
fyf 1 year ago
parent
commit
6c3fd07040
4 changed files with 99 additions and 14 deletions
  1. +40
    -1
      app/src/main/java/com/example/bpa/app/BootInit.java
  2. +7
    -3
      app/src/main/java/com/example/bpa/service/DeviceData.java
  3. +10
    -8
      app/src/main/java/com/example/bpa/view/from/lsjy_activity.java
  4. +42
    -2
      app/src/main/res/layout/from/layout/activity_lsjy.xml

+ 40
- 1
app/src/main/java/com/example/bpa/app/BootInit.java View File

@@ -25,6 +25,8 @@ import com.example.bpa.service.BusinessServer;
import com.example.bpa.view.mode.AlertLogEnum;
import com.example.bpa.view.mode.UserLogEnum;

import java.util.ArrayList;

import pub.devrel.easypermissions.EasyPermissions;

public class BootInit {
@@ -153,7 +155,7 @@ public class BootInit {
QueryDB.AddUser(user);
//10个料仓+ 11 12 两个果糖料仓
if (QueryDB.GetSilosALL().size() == 0) {
for (int i = 0; i < 12; i++) {
for (int i = 0; i < 13; i++) {
BPA_SILOS silo = new BPA_SILOS();
silo.id = java.util.UUID.randomUUID().toString();
silo.num = i + 1;
@@ -172,6 +174,8 @@ public class BootInit {
silo.name="酱油仓";
}else if (i==11) {
silo.name="猪油仓";
}else if (i==12) {
silo.name="高汤仓";
}
QueryDB.AddSilos(silo);
QueryDB.AddSilosAndMaterial(sm);
@@ -180,6 +184,41 @@ public class BootInit {
}
}

public static void DeleteSilos()
{
ArrayList<BPA_SILOS> sol= QueryDB.GetSilosALL();
for (BPA_SILOS item:sol)
{
QueryDB.DeleteSilos(item);
QueryDB.DeleteSilosAndMaterial(item.id);
}
for (int i = 0; i < 13; i++) {
BPA_SILOS silo = new BPA_SILOS();
silo.id = java.util.UUID.randomUUID().toString();
silo.num = i + 1;
silo.thrsoleValue=ConfigName.getInstance().SiloAlarmThreshold;
silo.warningValue=ConfigName.getInstance().SiloFeedThreshold;
BPA_SILOSANDMATERIAL sm = new BPA_SILOSANDMATERIAL();
sm.silosID = silo.id;
sm.materialID = "";

if(i<6)
{
silo.name="外置仓";
} else if (i>=6 && i<10) {
silo.name="粉料仓";
}else if (i==10) {
silo.name="酱油仓";
}else if (i==11) {
silo.name="猪油仓";
}else if (i==12) {
silo.name="高汤仓";
}
QueryDB.AddSilos(silo);
QueryDB.AddSilosAndMaterial(sm);
}
}

/**
* 删除子订单表-重新生成新表
*/


+ 7
- 3
app/src/main/java/com/example/bpa/service/DeviceData.java View File

@@ -182,7 +182,7 @@ public class DeviceData {
* @param ch 需要写入的通道编号,1--10
*/
public void setCalibrationValue(short value, int ch, IWriteCallBack callback) {
if (ch >= 1 && ch <= 12) {
if (ch >= 1 && ch <= 13) {
String add = "VW" + (-2 + ch * 2);
ModbusTcpServer.get().WriteShort(add, value, callback);
}
@@ -213,7 +213,7 @@ public class DeviceData {
* @param ch 需要写入的通道编号,1--10
*/
public void setDemandValue(short value, int ch, IWriteCallBack callback) {
if (ch >= 1 && ch <= 12) {
if (ch >= 1 && ch <= 13) {
String add = "VW" + (298 + ch * 2);
ModbusTcpServer.get().WriteShort(add, value, callback);
}
@@ -227,7 +227,7 @@ public class DeviceData {
* @param ch 需要写入的通道编号,1--10
*/
public void setChCalibrationSwitch(boolean value, int ch, IWriteCallBack callback) {
if (ch >= 1 && ch <= 12) {
if (ch >= 1 && ch <= 13) {
String add="";
if(ch==9)
{
@@ -241,6 +241,10 @@ public class DeviceData {
}else if(ch==12)
{
add="M3.3";
}
else if(ch==13)
{
add="M3.4";
}else
{
add = ModbusTcpServer.get().getBitSingleAdd("M", 2, ch);


+ 10
- 8
app/src/main/java/com/example/bpa/view/from/lsjy_activity.java View File

@@ -39,12 +39,12 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
*/
TextView gongneng_title;
//通道校准值
EditText passwayText_1, passwayText_2, passwayText_3, passwayText_4, passwayText_5, passwayText_6, passwayText_7, passwayText_8, passwayText_9, passwayText_10, passwayText_11, passwayText_12;
EditText passwayText_1, passwayText_2, passwayText_3, passwayText_4, passwayText_5, passwayText_6, passwayText_7, passwayText_8, passwayText_9, passwayText_10, passwayText_11, passwayText_12,passwayText_13;
//校准基准时间
EditText timeText;
List<EditText> editTextLists = new ArrayList<EditText>();
//通道校准开关
Switch Switch_1, Switch_2, Switch_3, Switch_4, Switch_5, Switch_6, Switch_7, Switch_8, Switch_9, Switch_10, Switch_11, Switch_12;
Switch Switch_1, Switch_2, Switch_3, Switch_4, Switch_5, Switch_6, Switch_7, Switch_8, Switch_9, Switch_10, Switch_11, Switch_12,Switch_13;
List<Switch> switchLists = new ArrayList<Switch>();
//开始校准
Button StartButton;
@@ -106,8 +106,9 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
passwayText_10 = findViewById(R.id.passwayText_10);
passwayText_11 = findViewById(R.id.passwayText_11);
passwayText_12 = findViewById(R.id.passwayText_12);
passwayText_13 = findViewById(R.id.passwayText_13);

editTextLists = Arrays.asList(passwayText_1, passwayText_2, passwayText_3, passwayText_4, passwayText_5, passwayText_6, passwayText_7, passwayText_8, passwayText_9, passwayText_10, passwayText_11, passwayText_12);
editTextLists = Arrays.asList(passwayText_1, passwayText_2, passwayText_3, passwayText_4, passwayText_5, passwayText_6, passwayText_7, passwayText_8, passwayText_9, passwayText_10, passwayText_11, passwayText_12, passwayText_13);

//校准开关
Switch_1 = findViewById(R.id.Switch_1);
@@ -122,7 +123,8 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
Switch_10 = findViewById(R.id.Switch_10);
Switch_11 = findViewById(R.id.Switch_11);
Switch_12 = findViewById(R.id.Switch_12);
switchLists = Arrays.asList(Switch_1, Switch_2, Switch_3, Switch_4, Switch_5, Switch_6, Switch_7, Switch_8, Switch_9, Switch_10, Switch_11, Switch_12);
Switch_13 = findViewById(R.id.Switch_13);
switchLists = Arrays.asList(Switch_1, Switch_2, Switch_3, Switch_4, Switch_5, Switch_6, Switch_7, Switch_8, Switch_9, Switch_10, Switch_11, Switch_12, Switch_13);

//校准按钮
StartButton = findViewById(R.id.StartButton);
@@ -149,7 +151,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
public void Initdata() {
//初始化标准值数据
try {
for (int i = 0; i < 12; i++) {
for (int i = 0; i < 13; i++) {
String s = String.valueOf(DeviceData.Get().getCalibrationValue(i + 1));
editTextLists.get(i).setText(String.format ("%.1f", (Double.parseDouble(s)/10)));
}
@@ -204,7 +206,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
}
});

for (int i = 0; i < 12; i++) {
for (int i = 0; i < 13; i++) {
if (switchLists.get(i).isChecked() == true)//校准开关打开后,允许校准
{
String value = editTextLists.get(i).getText().toString();
@@ -220,7 +222,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
}
}
//写开关状态 数值
for (int i = 0; i < 12; i++) {
for (int i = 0; i < 13; i++) {
String value = editTextLists.get(i).getText().toString();
Short val = 0;
try {
@@ -241,7 +243,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
break;
case R.id.StartButton://开始校准
//写开关状态 数值
for (int i = 0; i < 12; i++) {
for (int i = 0; i < 13; i++) {
//1.写入开关状态
DeviceData.Get().setChCalibrationSwitch(switchLists.get(i).isChecked(), i + 1, new IWriteCallBack() {
@Override


+ 42
- 2
app/src/main/res/layout/from/layout/activity_lsjy.xml View File

@@ -466,6 +466,45 @@
android:thumb="@drawable/switch_custom_thumb_selector"
android:track="@drawable/switch_custom_track_selector"/>
</TableRow>
<!-- Table7-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<TextView
android:layout_marginRight="15dp"
android:text="高汤仓:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_13"
android:minWidth="60dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:theme="@style/MyEditText_num"
android:maxLines="1"
android:singleLine="true"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
android:id="@+id/Switch_13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="校准开关 "
android:layout_marginRight="40dp"
android:textOff="关"
android:textOn="开"
android:showText="true"
android:switchTextAppearance="@style/myTextAppearance"
android:textColor="@color/white"
android:thumb="@drawable/switch_custom_thumb_selector"
android:track="@drawable/switch_custom_track_selector"/>


</TableRow>


</TableLayout>
@@ -523,7 +562,7 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="校准基准时间():"
android:text="校准基准时间(s):"
android:textColor="@color/white"
android:textStyle="bold"
android:gravity="center"
@@ -550,7 +589,7 @@
android:id="@+id/savetime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="保存"
android:text="保存参数"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:textColor="@color/white"
@@ -559,6 +598,7 @@
android:background="@drawable/settingbutton"/>
</TableRow>
<TableRow
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"


Loading…
Cancel
Save