Selaa lähdekoodia

修改校准

detached
liup 5 kuukautta sitten
vanhempi
commit
519a2f4129
17 muutettua tiedostoa jossa 156 lisäystä ja 180 poistoa
  1. +8
    -0
      .idea/deploymentTargetSelector.xml
  2. +0
    -1
      app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java
  3. +37
    -37
      app/src/main/java/com/bonait/bnframework/Service/AnalogConvert.java
  4. +17
    -17
      app/src/main/java/com/bonait/bnframework/Service/ModbusHelper.java
  5. +13
    -22
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/BottomNavigation2Activity.java
  6. +8
    -8
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/BottomNavigationNewActivity.java
  7. +7
    -8
      app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/Home4Fragment.java
  8. +2
    -9
      app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeDeviceFragment.java
  9. +2
    -2
      app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/SystemSeasoningsetFragment.java
  10. +12
    -12
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  11. +5
    -9
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  12. +4
    -4
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SILOS_CALIBRATE.java
  13. +10
    -19
      app/src/main/java/com/bonait/bnframework/common/utils/CookTimeUtils.java
  14. +21
    -26
      app/src/main/java/com/bonait/bnframework/ui/fragment/SilosFragment.java
  15. +8
    -4
      app/src/main/res/layout/dialog_silos_calibrates_edit.xml
  16. +1
    -1
      app/src/main/res/layout/fragment_home4.xml
  17. +1
    -1
      app/src/main/res/layout/fragment_home_device.xml

+ 8
- 0
.idea/deploymentTargetSelector.xml Näytä tiedosto

@@ -4,6 +4,14 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2024-05-22T08:50:34.498213700Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="Default" identifier="serial=10.24.61.120:5555;connection=fa0f3ba7" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>

+ 0
- 1
app/src/main/java/com/bonait/bnframework/HBL/Communication/Modbus/ModbusMaster.java Näytä tiedosto

@@ -128,7 +128,6 @@ public class ModbusMaster implements IRead,IWrite ,IModbusMaster{

}
});
if(!IsReconnection || ConfigName.TEST)break;
if(IsConnected==false) Thread.sleep(5000);
}
if(IsConnected)return OperateResult.CreateSuccess();


+ 37
- 37
app/src/main/java/com/bonait/bnframework/Service/AnalogConvert.java Näytä tiedosto

@@ -51,7 +51,7 @@ public class AnalogConvert {
*/
public static short et_Pressure_Lower_Limit=0;

public static short Scale(short InputValue, short InputMax, short InputMin, short OutMax, short OutMin){
public static int Scale(float InputValue, float InputMax, float InputMin, float OutMax, float OutMin){
try{
LogUtils.d("AnalogConvert measureCookTime InputValue="+InputValue+" InputMax="+InputMax+";InputMin="+InputMin+";OutMax="+OutMax+";OutMin="+OutMin);

@@ -65,7 +65,7 @@ public class AnalogConvert {
if(tempValue<=0){
tempValue = 0;
}
short num =(short)tempValue;
int num =(int)(tempValue*100);
// if (num > OutMax) return OutMax;
// if (num < OutMin) return OutMin;
return num;
@@ -76,41 +76,41 @@ public class AnalogConvert {
}

/**
* 获取当前实际压力值
* @param InputValue 当前实际压力的模拟量值
* @return 当前实际压力值
*/
public static short getCurrentPressure(short InputValue){
return Scale(InputValue,et_Pressure_Analog_Upper_Limit,et_Pressure_Analog_Lower_Limit,et_Pressure_Upper_Limit,et_Pressure_Lower_Limit);
}
/**
* 获取当前实际压力的模拟量值
* @param InputValue 当前实际压力值
* @return 对应的模拟量值
*/
public static short getCurrentPressureAnalog(short InputValue){
return Scale(InputValue,et_Pressure_Upper_Limit,et_Pressure_Lower_Limit,et_Pressure_Analog_Upper_Limit,et_Pressure_Analog_Lower_Limit);
}
/**
* 获取当前实际温度值
* @param InputValue 当前实际温度的模拟量值
* @return 当前实际温度值
*/
public static short getCurrentTemperature(short InputValue){
return Scale(InputValue,et_Temperature_Analog_Upper_Limit,et_Temperature_Analog_Lower_Limit,et_Temperature_Upper_Limit,et_Temperature_Lower_Limit);
}
/**
* 获取当前实际温度的模拟量值
* @param InputValue 当前实际压力值
* @return 对应的模拟量值
*/
public static short getCurrentTemperatureAnalog(short InputValue){
return Scale(InputValue,et_Temperature_Upper_Limit,et_Temperature_Lower_Limit,et_Temperature_Analog_Upper_Limit,et_Temperature_Analog_Lower_Limit);
}
// * 获取当前实际压力值
// * @param InputValue 当前实际压力的模拟量值
// * @return 当前实际压力值
// */
// public static short getCurrentPressure(short InputValue){
// return Scale(InputValue,et_Pressure_Analog_Upper_Limit,et_Pressure_Analog_Lower_Limit,et_Pressure_Upper_Limit,et_Pressure_Lower_Limit);
// }
//
// /**
// * 获取当前实际压力的模拟量值
// * @param InputValue 当前实际压力值
// * @return 对应的模拟量值
// */
// public static short getCurrentPressureAnalog(short InputValue){
// return Scale(InputValue,et_Pressure_Upper_Limit,et_Pressure_Lower_Limit,et_Pressure_Analog_Upper_Limit,et_Pressure_Analog_Lower_Limit);
// }
//
//
// /**
// * 获取当前实际温度值
// * @param InputValue 当前实际温度的模拟量值
// * @return 当前实际温度值
// */
// public static short getCurrentTemperature(short InputValue){
// return Scale(InputValue,et_Temperature_Analog_Upper_Limit,et_Temperature_Analog_Lower_Limit,et_Temperature_Upper_Limit,et_Temperature_Lower_Limit);
// }
//
// /**
// * 获取当前实际温度的模拟量值
// * @param InputValue 当前实际压力值
// * @return 对应的模拟量值
// */
// public static short getCurrentTemperatureAnalog(short InputValue){
// return Scale(InputValue,et_Temperature_Upper_Limit,et_Temperature_Lower_Limit,et_Temperature_Analog_Upper_Limit,et_Temperature_Analog_Lower_Limit);
// }

public static void SaveConfig(){
Context dishesCon = ConfigName.getInstance().dishesCon;


+ 17
- 17
app/src/main/java/com/bonait/bnframework/Service/ModbusHelper.java Näytä tiedosto

@@ -2,7 +2,6 @@ package com.bonait.bnframework.Service;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Communication.Modbus.ModbusMaster;
import com.bonait.bnframework.HBL.DataUtil.DataConvertLib;
import com.bonait.bnframework.HBL.DataUtil.DataType;
import com.bonait.bnframework.HBL.DataUtil.NotifyPropVar;
import com.bonait.bnframework.HBL.Executor;
@@ -129,18 +128,18 @@ public class ModbusHelper extends ModbusMaster {
* @param value
* @param isCalibration 是否是校准
*/
public void addWater(int value,boolean isCalibration){
public void addWater(float value,boolean isCalibration){
LogUtils.d(TAG+"加水控制 addSeason ");
getCalibrationPar(ControlAdress.加水.toString()).OnSource(item->{
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE)item.Content;
short valueDeal;
if(isCalibration){
valueDeal = (short) value;
valueDeal = (short) (value*100);
}else {
valueDeal = AnalogConvert.Scale((short) value, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin);
valueDeal = (short) AnalogConvert.Scale( value, bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
}
WriteShort(getPLC(ControlAdress.加水时间).PlcAddress, (short) (valueDeal*100));
WriteShort(getPLC(ControlAdress.加水时间).PlcAddress, (short) (valueDeal));
WriteBool(getPLC(ControlAdress.加水).PlcAddress,true);
readWater();
LogUtils.d(TAG+TAG+"加水控制 addSeason value="+value + "valueDeal="+valueDeal);
@@ -158,7 +157,7 @@ public class ModbusHelper extends ModbusMaster {
* @param position 几号仓
* @param isCalibration 是否是校准
*/
public void addMaterial(int value, int position,boolean isCalibration){
public void addMaterial(float value, int position,boolean isCalibration){
ControlAdress controlAdress = ControlAdress.液体1;
ControlAdress controlTimeAdress = ControlAdress.液体时间1;
switch (position){
@@ -207,12 +206,12 @@ public class ModbusHelper extends ModbusMaster {
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE)item.Content;
short valueDeal ;
if(isCalibration){
valueDeal = (short) value;
valueDeal = (short) (value*100);
}else {
valueDeal = AnalogConvert.Scale((short) value, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin);
valueDeal = (short) AnalogConvert.Scale(value, bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
}
WriteShort(getPLC(finalControlTimeAdress).PlcAddress, (short) (valueDeal*100));
WriteShort(getPLC(finalControlTimeAdress).PlcAddress, (short) (valueDeal));
WriteBool(getPLC(finalControlAdress).PlcAddress,true);
LogUtils.d(TAG+"液体料控制 addSeason value="+value+" ;valueDeal="+valueDeal+";position="+position+"-->>");
}) ;
@@ -262,17 +261,17 @@ public class ModbusHelper extends ModbusMaster {
* @param value
* * @param isCalibration 是否是校准
*/
public void addThickenWater(int value,boolean isCalibration){
public void addThickenWater(float value,boolean isCalibration){
getCalibrationPar(ControlAdress.勾芡.toString()).OnSource(item->{
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE)item.Content;
short scale;
if(isCalibration){
scale = (short) value;
scale = (short) (value*100);
}else{
scale = AnalogConvert.Scale((short) value, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin);
scale = (short) AnalogConvert.Scale( value, bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
}
WriteShort(getPLC(ControlAdress.勾芡时间).PlcAddress, (short) (scale*100));
WriteShort(getPLC(ControlAdress.勾芡时间).PlcAddress, (short) (scale));
WriteBool(getPLC(ControlAdress.勾芡).PlcAddress,true);
LogUtils.d(TAG+"勾芡控制 addThickenWater value="+value+"scale="+scale);
}) ;
@@ -472,6 +471,7 @@ public class ModbusHelper extends ModbusMaster {
* 循环心跳
*/
private void GetLooperStatus(){
LogUtils.d(" 启动线程 Modbus变量状态 ");
ThreadManager.get().StartLong("Modbus变量状态",true,()->{


@@ -520,7 +520,7 @@ public class ModbusHelper extends ModbusMaster {
}


Thread.sleep(ConfigName.TEST?2000:200);
Thread.sleep(ConfigName.TEST?500:200);
});
}
}


+ 13
- 22
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/BottomNavigation2Activity.java Näytä tiedosto

@@ -1,37 +1,28 @@
package com.bonait.bnframework.ViewModel.ActivityViewModel;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MenuItem;

import androidx.annotation.NonNull;
import androidx.viewpager.widget.ViewPager;

import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.HBL.Thread.IThread;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.Service.ModbusHelper;
import com.bonait.bnframework.ViewModel.Adapter.FragmentAdapter;
import com.bonait.bnframework.ViewModel.FragmentViewModel.Home2Fragment;
import com.bonait.bnframework.ViewModel.FragmentViewModel.HomeDeviceFragment;
import com.bonait.bnframework.ViewModel.FragmentViewModel.MyFragment;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.google.android.material.bottomnavigation.BottomNavigationView;

import androidx.viewpager.widget.ViewPager;

import android.util.Log;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.message.MessageLooper;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.ViewModel.FragmentViewModel.Home1Fragment;
import com.bonait.bnframework.ViewModel.FragmentViewModel.Home2Fragment;
import com.bonait.bnframework.ViewModel.Adapter.FragmentAdapter;
import com.bonait.bnframework.ViewModel.FragmentViewModel.MyFragment;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.lzy.okgo.OkGo;
import com.qmuiteam.qmui.widget.QMUIViewPager;

@@ -190,9 +181,9 @@ public class BottomNavigation2Activity extends BaseActivity {
//判断连接环境
ConfigData.getInstance().ToggleEnvironment();
//初始化modbus
if(!ModbusHelper.get().getConnected()){
// if(!ModbusHelper.get().getConnected()){
ModbusHelper.get().RtuInit("/dev/ttyCOM0",9600);
}
// }
//初始化阿里云连接
//AliyunIOTManager.getInstance().OpenDev(this);
}


+ 8
- 8
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/BottomNavigationNewActivity.java Näytä tiedosto

@@ -1,7 +1,5 @@
package com.bonait.bnframework.ViewModel.ActivityViewModel;

import androidx.viewpager.widget.ViewPager;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
@@ -9,21 +7,26 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.viewpager.widget.ViewPager;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.HBL.Thread.IThread;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.Service.ModbusHelper;
import com.bonait.bnframework.ViewModel.Adapter.FragmentAdapter;
import com.bonait.bnframework.ViewModel.FragmentViewModel.Home4Fragment;
import com.bonait.bnframework.ViewModel.FragmentViewModel.HomeDeviceFragment;
import com.bonait.bnframework.ViewModel.FragmentViewModel.HomeFragmentPR;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD;
import com.bonait.bnframework.common.helper.CountDownTimerExt;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.message.MessageLooper;
@@ -32,9 +35,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.ViewModel.Adapter.FragmentAdapter;
import com.bonait.bnframework.ViewModel.FragmentViewModel.Home4Fragment;
import com.bonait.bnframework.ViewModel.FragmentViewModel.HomeFragmentPR;
import com.lzy.okgo.OkGo;
import com.qmuiteam.qmui.widget.QMUIViewPager;

@@ -244,9 +244,9 @@ public class BottomNavigationNewActivity extends BaseActivity {
// //2.初始化PLC
// ReconnectModbus();
//初始化modbus
if(!ModbusHelper.get().getConnected()){
// if(!ModbusHelper.get().getConnected()){
ModbusHelper.get().RtuInit("/dev/ttyCOM0",9600);
}
// }
//制作线程
MakeThread();
//初始化阿里云连接


+ 7
- 8
app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/Home4Fragment.java Näytä tiedosto

@@ -14,7 +14,7 @@ import androidx.appcompat.app.AppCompatActivity;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.ActivityViewModel.DishTestActivity;
import com.bonait.bnframework.ViewModel.ActivityViewModel.DiyUpdate1Activity;
import com.bonait.bnframework.ViewModel.ActivityViewModel.LoginActivity;
import com.bonait.bnframework.ViewModel.CustomView.XComDialog;
import com.bonait.bnframework.common.base.BaseFragment;
@@ -24,7 +24,6 @@ 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.EditClassifyActivity;
import com.bonait.bnframework.ui.activity.SetSeasoningActivity;
import com.orhanobut.logger.Logger;

@@ -71,8 +70,8 @@ public class Home4Fragment extends BaseFragment {
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.kaishipengren:
// MessageManager.getInstance().sendMessage(MessageName.SelectZY, 0);
OpenActivity(EditClassifyActivity.class);
MessageManager.getInstance().sendMessage(MessageName.SelectZY, 0);
// OpenActivity(EditClassifyActivity.class);
break;
case R.id.shebeikongzhi:
MessageManager.getInstance().sendMessage(MessageName.SelectZY, 2);
@@ -82,10 +81,10 @@ public class Home4Fragment extends BaseFragment {
// OpenActivity(BunkerSetupActivity.class);
break;
case R.id.caipinyanfa:
// Intent intent = new Intent(getContext(), DiyUpdate1Activity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// startActivity(intent);
OpenActivity(DishTestActivity.class);
Intent intent = new Intent(getContext(), DiyUpdate1Activity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
// OpenActivity(DishTestActivity.class);
break;
case R.id.zhuxiaodenglu:
String title = "温馨提示!";


+ 2
- 9
app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeDeviceFragment.java Näytä tiedosto

@@ -1,8 +1,5 @@
package com.bonait.bnframework.ViewModel.FragmentViewModel;

import static com.bonait.bnframework.MainApplication.getContext;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Bundle;
@@ -20,7 +17,6 @@ import android.widget.ArrayAdapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.DataUtil.DataConvertLib;
@@ -95,10 +91,7 @@ public class HomeDeviceFragment extends BaseFragment {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
DisplayManager.scaleView(viewBinding.clContent);
for (int i = 0; i < viewBinding.clContent.getChildCount(); i++) {
DisplayManager.scaleView(viewBinding.clContent.getChildAt(i));
}
DisplayManager.scaleViewGroup(viewBinding.getRoot());
initData();
initView();
}
@@ -327,7 +320,7 @@ public class HomeDeviceFragment extends BaseFragment {
if(!value.isEmpty()){
ToastUtils.info("开始勾芡 "+value+"g");
ThreadManager.get().execute(new Thread(() -> {
ModbusHelper.get().addThickenWater(Integer.parseInt(viewBinding.editQianWater.getText().toString()), false);
ModbusHelper.get().addThickenWater(Float.parseFloat(viewBinding.editQianWater.getText().toString()), false);
}));
}else {
ToastUtils.info("值不能为空!");


+ 2
- 2
app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/SystemSeasoningsetFragment.java Näytä tiedosto

@@ -356,7 +356,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL
}
}

private void startCalibration(int value,int position){
private void startCalibration(float value,int position){
ThreadManager.get().execute(new Runnable() {
@Override
public void run() {
@@ -381,7 +381,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL
break;

}
Thread.sleep(value * 1000L);
Thread.sleep((long) (value * 1000L));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}


+ 12
- 12
app/src/main/java/com/bonait/bnframework/business/MainInit.java Näytä tiedosto

@@ -244,27 +244,27 @@ public class MainInit {
BPA_SILOS_CALIBRATE silo = new BPA_SILOS_CALIBRATE();
silo.name = "液体"+i;
silo.num = i;
silo.outputTimeMax = 5;
silo.outputTimeMin = 2;
silo.inputWightMax = 50;
silo.inputWightMin = 20;
silo.outputTimeMax = 5.00f;
silo.outputTimeMin = 2.00f;
silo.inputWightMax = 50.00f;
silo.inputWightMin = 20.00f;
QueryDB.AddSilosCalibrate(silo);
}
BPA_SILOS_CALIBRATE silo = new BPA_SILOS_CALIBRATE();
silo.name = ControlAdress.加水.toString();
silo.num = 10;
silo.outputTimeMax = 5;
silo.outputTimeMin = 2;
silo.inputWightMax = 50;
silo.inputWightMin = 20;
silo.outputTimeMax = 5.00f;
silo.outputTimeMin = 2.00f;
silo.inputWightMax = 50.0f;
silo.inputWightMin = 20.00f;
QueryDB.AddSilosCalibrate(silo);
BPA_SILOS_CALIBRATE silo2 = new BPA_SILOS_CALIBRATE();
silo2.name = ControlAdress.勾芡.toString();
silo2.num = 11;
silo2.outputTimeMax = 5;
silo2.outputTimeMin = 2;
silo2.inputWightMax = 50;
silo2.inputWightMin = 20;
silo2.outputTimeMax = 5.00f;
silo2.outputTimeMin = 2.00f;
silo2.inputWightMax = 50.00f;
silo2.inputWightMin = 20.00f;
QueryDB.AddSilosCalibrate(silo2);
LogUtils.d(" 首次创建 料仓校准 silo2="+silo2.toString()+QueryDB.GetSilosCalibrateAll());
}


+ 5
- 9
app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java Näytä tiedosto

@@ -2603,12 +2603,8 @@ public class QueryDB {
* 修改料仓校准
*
* @param id
* @param outputMax
* @param outputMin
* @param inputMax
* @param inputMin
*/
public static void UpdateSilosCalibrate(String id, int outputMax,int outputMin,int inputMax,int inputMin) {
public static void UpdateSilosCalibrate(String id, float outputMax,float outputMin,float inputMax,float inputMin) {
BPA_SILOS_CALIBRATE silos = GetSilosCalibrate(id);
if (silos != null) {
if(outputMax>=0){
@@ -3033,10 +3029,10 @@ public class QueryDB {
//私有
((BPA_SILOS_CALIBRATE) data).name = cursor.getString((int) cursor.getColumnIndex("name"));
((BPA_SILOS_CALIBRATE) data).num = cursor.getInt((int) cursor.getColumnIndex("num"));
((BPA_SILOS_CALIBRATE) data).outputTimeMax = cursor.getInt((int) cursor.getColumnIndex("outputTimeMax"));
((BPA_SILOS_CALIBRATE) data).outputTimeMin = cursor.getInt((int) cursor.getColumnIndex("outputTimeMin"));
((BPA_SILOS_CALIBRATE) data).inputWightMin = cursor.getInt((int) cursor.getColumnIndex("inputWightMin"));
((BPA_SILOS_CALIBRATE) data).inputWightMax = cursor.getInt((int) cursor.getColumnIndex("inputWightMax"));
((BPA_SILOS_CALIBRATE) data).outputTimeMax = cursor.getFloat((int) cursor.getColumnIndex("outputTimeMax"));
((BPA_SILOS_CALIBRATE) data).outputTimeMin = cursor.getFloat((int) cursor.getColumnIndex("outputTimeMin"));
((BPA_SILOS_CALIBRATE) data).inputWightMin = cursor.getFloat((int) cursor.getColumnIndex("inputWightMin"));
((BPA_SILOS_CALIBRATE) data).inputWightMax = cursor.getFloat((int) cursor.getColumnIndex("inputWightMax"));
break;
case "BPA_ATTRIBUTE":
data = new BPA_ATTRIBUTE();


+ 4
- 4
app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SILOS_CALIBRATE.java Näytä tiedosto

@@ -10,13 +10,13 @@ public class BPA_SILOS_CALIBRATE extends ModeBase {
//料仓编号
public int num;
//输出时间最大值:s
public int outputTimeMax;
public float outputTimeMax;
//输出时间最小值:s
public int outputTimeMin;
public float outputTimeMin;
//输入重量最大值: g
public int inputWightMax;
public float inputWightMax;
//输入重量最小值: g
public int inputWightMin;
public float inputWightMin;


@Override


+ 10
- 19
app/src/main/java/com/bonait/bnframework/common/utils/CookTimeUtils.java Näytä tiedosto

@@ -3,7 +3,6 @@ package com.bonait.bnframework.common.utils;
import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.Service.AnalogConvert;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;
@@ -38,20 +37,16 @@ public class CookTimeUtils {
if (value !=null && value.contains(",")) {
String[] wl = value.split("[,]");
if (wl.length == 2) {
int val;
float val;
String name = wl[0];
if(wl[1].contains(".")){
val = (int) Math.round((Double.parseDouble(wl[1])));
}else {
val = Integer.parseInt(wl[1]);
}
val = Float.parseFloat(wl[1]);

// 根据名称查询料仓号 重量需根据校准值换算成时间
List<BPA_SILOS> silos = QueryDB.GetSolisByMaterialName(name);
if(!silos.isEmpty()){
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE) QueryDB.GetSilosCalibrateByNum( silos.get(0).num);
short valueDeal = AnalogConvert.Scale((short) val, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin);
short valueDeal = (short) AnalogConvert.Scale( val, bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
time += valueDeal;
LogUtils.d("measureCookTime name="+name+";重量="+val+";换算时间="+valueDeal);
}
@@ -74,23 +69,19 @@ public class CookTimeUtils {
}else if(value!=null && value.contains("(克),")){
String[] res = value.split("克");
if(res.length==2){
int val = 0;
if(res[1].contains(".")){
val = (int) Math.round((Double.parseDouble(res[1].substring(2))));
}else {
val = Integer.parseInt(res[1].substring(2));
}
float val = 0;
val = Float.parseFloat(res[1].substring(2));
//1
if(item.processname.contains("加水")){
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE) QueryDB.GetSilosCalibrateByNum(10);
short valueDeal = AnalogConvert.Scale((short) val, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin);
short valueDeal = (short) AnalogConvert.Scale( val, (short) bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
LogUtils.d("measureCookTime 加水重量="+val+";换算加水时间="+valueDeal);
time += valueDeal;
}else if(item.processname.contains("勾芡")){
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE) QueryDB.GetSilosCalibrateByNum(11);
short valueDeal = AnalogConvert.Scale((short) val, (short) bean.inputWightMax, (short) bean.inputWightMin,
(short) bean.outputTimeMax, (short) bean.outputTimeMin);
short valueDeal = (short) AnalogConvert.Scale( val, bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
LogUtils.d("measureCookTime 加水重量="+val+";换算加水时间="+valueDeal);
time += valueDeal;
}


+ 21
- 26
app/src/main/java/com/bonait/bnframework/ui/fragment/SilosFragment.java Näytä tiedosto

@@ -161,47 +161,42 @@ public class SilosFragment extends BaseFragment {
tvConfirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CharSequence outMax = editOutMax.getText();
CharSequence outMin = editOutMin.getText();
CharSequence inMax = editInMax.getText();
CharSequence inMin = editInMin.getText();

if (outMax != null && outMax.length() > 0 &&
outMin != null && outMin.length() > 0 &&
inMax != null && inMax.length() > 0&&
inMin != null && inMin.length() > 0) {
LogUtils.d(bean.id+" outMax"+outMax +"outMin="+outMin+"inMax="+inMax+"inMin="+inMin);
QueryDB.UpdateSilosCalibrate(bean.id, Integer.parseInt(outMax.toString()),Integer.parseInt(outMin.toString()),
Integer.parseInt(inMax.toString()),Integer.parseInt(inMin.toString()));
xCom.dismissX();
} else {
if(editOutMax.getText().toString().isEmpty()||editOutMax.getText().toString().isEmpty()||
editInMax.getText().toString().isEmpty()||editInMax.getText().toString().isEmpty()){
ToastUtils.info("值不能为空!");
return;
}
float outMax = Float.parseFloat(editOutMax.getText().toString());
float outMin = Float.parseFloat(editOutMin.getText().toString());
float inMax = Float.parseFloat(editInMax.getText().toString());
float inMin = Float.parseFloat(editInMin.getText().toString());

LogUtils.d(bean.id+" outMax"+outMax +"outMin="+outMin+"inMax="+inMax+"inMin="+inMin);
QueryDB.UpdateSilosCalibrate(bean.id, outMax,outMin,inMax,inMin);
xCom.dismissX();
}
});

tvMaxCalibration.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CharSequence outMax = editOutMax.getText();
if (outMax != null && outMax.length() > 0){
startCalibration(Integer.parseInt(outMax.toString()),position+1);
}else {
if(editOutMax.getText().toString().isEmpty()){
ToastUtils.info("值不能为空!");
return;
}

float outMax = Float.parseFloat(editOutMax.getText().toString());
startCalibration(outMax,position+1);
}
});
tvMinCalibration.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CharSequence outMin = editOutMin.getText();
if (outMin != null && outMin.length() > 0){
startCalibration(Integer.parseInt(outMin.toString()),position+1);
}else {
if(editOutMin.getText().toString().isEmpty()){
ToastUtils.info("值不能为空!");
return;
}

float outMin = Float.parseFloat(editOutMin.getText().toString());
startCalibration(outMin,position+1);
}
});
}
@@ -220,7 +215,7 @@ public class SilosFragment extends BaseFragment {
* @param value 出料时间
* @param position 仓号
*/
private void startCalibration(int value,int position){
private void startCalibration(float value,int position){
ThreadManager.get().execute(new Runnable() {
@Override
public void run() {
@@ -245,7 +240,7 @@ public class SilosFragment extends BaseFragment {
break;

}
Thread.sleep(value * 1000L);
Thread.sleep((long) (value * 1000L));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}


+ 8
- 4
app/src/main/res/layout/dialog_silos_calibrates_edit.xml Näytä tiedosto

@@ -64,7 +64,8 @@
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint=""
android:inputType="number"
android:digits="0123456789."
android:inputType="text"
android:maxLines="1"
android:padding="3dp"
android:layout_gravity="center_vertical"
@@ -100,7 +101,8 @@
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint=""
android:inputType="number"
android:digits="0123456789."
android:inputType="text"
android:maxLines="1"
android:padding="3dp"
android:layout_gravity="center_vertical"
@@ -132,7 +134,8 @@
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint=""
android:inputType="number"
android:digits="0123456789."
android:inputType="text"
android:maxLines="1"
android:padding="3dp"

@@ -166,7 +169,8 @@
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint=""
android:inputType="number"
android:digits="0123456789."
android:inputType="text"
android:maxLines="1"
android:padding="3dp"
android:layout_gravity="center_vertical"


+ 1
- 1
app/src/main/res/layout/fragment_home4.xml Näytä tiedosto

@@ -49,7 +49,7 @@
<ImageView
android:layout_width="match_parent"
android:layout_height="130dp"
android:src="@mipmap/home_classify_ic" />
android:src="@mipmap/home_kspr" />

</LinearLayout>



+ 1
- 1
app/src/main/res/layout/fragment_home_device.xml Näytä tiedosto

@@ -91,7 +91,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
app:layout_constraintTop_toBottomOf="@id/deviceErrorCode"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintLeft_toLeftOf="parent"
android:textSize="@dimen/sp_32"
android:textColor="@color/black"


Ladataan…
Peruuta
Tallenna