Browse Source

更新plc日志。

master
fyf 11 months ago
parent
commit
d62a80da21
7 changed files with 268 additions and 333 deletions
  1. +4
    -0
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  2. +191
    -329
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +7
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  4. +5
    -3
      app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpServer.java
  5. +33
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java
  6. +15
    -1
      app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java
  7. +13
    -0
      app/src/main/res/layout/fragment_system_systemset.xml

+ 4
- 0
app/src/main/java/com/bonait/bnframework/business/ConfigData.java View File

@@ -292,6 +292,8 @@ public class ConfigData {
ConfigName.getInstance().Version = ConfigUtil.read(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version);
ConfigName.getInstance().HuoLi = ConfigUtil.read(ConfigName.getInstance().dishesCon, "HuoLi", ConfigName.getInstance().HuoLi);
ConfigName.getInstance().MaxTemp = ConfigUtil.read(ConfigName.getInstance().dishesCon, "MaxTemp", ConfigName.getInstance().MaxTemp);
ConfigName.getInstance().WhetherManualFeedingSuspended = ConfigUtil.read(ConfigName.getInstance().dishesCon, "WhetherManualFeedingSuspended", ConfigName.getInstance().WhetherManualFeedingSuspended);


ConfigName.getInstance().gkcxCount = ConfigUtil.read(ConfigName.getInstance().dishesCon, "gkcxCount", ConfigName.getInstance().gkcxCount );
ConfigName.getInstance().jiaobanCount = ConfigUtil.read(ConfigName.getInstance().dishesCon, "jiaobanCount", ConfigName.getInstance().jiaobanCount );
@@ -319,6 +321,8 @@ public class ConfigData {
ConfigUtil.write(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version);
ConfigUtil.write(ConfigName.getInstance().dishesCon, "HuoLi", ConfigName.getInstance().HuoLi);
ConfigUtil.write(ConfigName.getInstance().dishesCon, "MaxTemp", ConfigName.getInstance().MaxTemp);
ConfigUtil.write(ConfigName.getInstance().dishesCon, "WhetherManualFeedingSuspended", ConfigName.getInstance().WhetherManualFeedingSuspended);


ConfigUtil.write(ConfigName.getInstance().dishesCon, "gkcxCount", ConfigName.getInstance().gkcxCount );
ConfigUtil.write(ConfigName.getInstance().dishesCon, "jiaobanCount", ConfigName.getInstance().jiaobanCount );


+ 191
- 329
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
File diff suppressed because it is too large
View File


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

@@ -1374,6 +1374,13 @@ public class ConfigName {

//endregion

//region
/**
* 手动投料是否关闭火力
*/
public String WhetherManualFeedingSuspended="否";
//endregion

//region 计数累计
/**
* 锅口朝向次数


+ 5
- 3
app/src/main/java/com/bonait/bnframework/common/modbus/ModbusTcpServer.java View File

@@ -466,7 +466,7 @@ public class ModbusTcpServer {
int add = GetAddress(Address);
if (add < 0) return;
try {
ReadHoldingRegistersResponse res = ModbusTcpHelper.get().syncReadHoldingRegisters(1, add, length);
ReadHoldingRegistersResponse res = ModbusTcpHelper.get().syncReadHoldingRegisters(1, add, length*2);
byte[] data = res.getData();
float[] tempValues = new float[length];
for (int i = 0; i < length; i++) {
@@ -474,7 +474,7 @@ public class ModbusTcpServer {
for (int m = 0; m < 4; m++) {
tempData[m] = data[i * 4 + m];
}
tempValues[i] = BytesToFloat(tempData, DataFormat.ABCD);
tempValues[i] = BytesToFloat(tempData, DataFormat.BADC);
}
if (tempValues.length == length) {
if (callback != null) callback.onSuccess(tempValues);
@@ -587,7 +587,9 @@ public class ModbusTcpServer {
int add = GetAddress(Address);
if (add < 0) return;
int intBits = Float.floatToRawIntBits(Value);
short[] send = new short[]{(short) ((intBits >> 16) & 0xffff), (short) (intBits & 0xffff)};

short[] send = IntToShorts(intBits);
// short[] send = new short[]{(short) ((intBits >> 16) & 0xffff), (short) (intBits & 0xffff)};
try {
ModbusTcpHelper.get().syncWriteRegisters(1, add, send);



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

@@ -59,10 +59,16 @@ public class SystemSystemsetFragment extends BaseFragment {
@BindView(R.id.HuoLi)
Spinner HuoLi;

@BindView(R.id.isStop)
Spinner isStop;


@BindView(R.id.edittext_wd)
EditText edittext_wd;

ArrayList<EditText> editTextLists = new ArrayList<>();

Map<String, Integer> material_map_yes_no = new LinkedHashMap<>();
Map<String, Integer> material_map = new LinkedHashMap<>();
Map<String, Integer> material_map_vis = new LinkedHashMap<>();

@@ -118,6 +124,10 @@ public class SystemSystemsetFragment extends BaseFragment {
material_map.put("测试环境", 1);
material_map.put("正式环境", 2);

material_map_yes_no.put("是", 0);
material_map_yes_no.put("否", 1);


for (int i = 0; i < ConfigName.getInstance().versionSelectionValues.length; i++) {
material_map_vis.put(ConfigName.getInstance().versionSelectionValues[i], i);
}
@@ -131,6 +141,11 @@ public class SystemSystemsetFragment extends BaseFragment {
adapter1.setDropDownViewResource(R.layout.spinner_dropdown_item);
versionselection.setAdapter(adapter1);

ArrayAdapter<String> adapter11 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(material_map_yes_no.keySet()));
adapter11.setDropDownViewResource(R.layout.spinner_dropdown_item);
isStop.setAdapter(adapter11);
isStop.setSelection(material_map_yes_no.get(ConfigName.getInstance().WhetherManualFeedingSuspended));


ArrayAdapter<String> adapter2 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(ConfigName.getInstance().HeatingGearL.keySet()));
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item);
@@ -203,6 +218,22 @@ public class SystemSystemsetFragment extends BaseFragment {
}
});

isStop.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {
@Override
/*public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

}*/
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
ConfigName.getInstance().WhetherManualFeedingSuspended=isStop.getSelectedItem().toString();
ConfigData.getInstance().SavePZ();
}

@Override
public void onNothingSelected(AdapterView<?> parent) {

}
});

}

@OnClick({R.id.StartButton})
@@ -279,6 +310,8 @@ public class SystemSystemsetFragment extends BaseFragment {


ConfigName.getInstance().HuoLi=HuoLi.getSelectedItem().toString();
ConfigName.getInstance().WhetherManualFeedingSuspended=isStop.getSelectedItem().toString();

if(!edittext_wd.getText().toString().isEmpty())
{
ConfigName.getInstance().MaxTemp=Integer.parseInt(edittext_wd.getText().toString());


+ 15
- 1
app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java View File

@@ -20,12 +20,14 @@ import android.widget.TextView;
import com.allen.library.SuperTextView;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.Constants;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_USER;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.utils.UpdateAppUtils;
@@ -125,7 +127,19 @@ public class MyFragment extends BaseFragment {
}
private void initView() {
initData(ConfigName.getInstance().user);
stvUpdate.setRightString(ConfigName.getInstance().Version);
stvUpdate.setRightString(ConfigName.getInstance().Version+"|"+ ExecuteTheRecipe.PlcVersion);

ExecuteTheRecipe.NotifyVersionNumUpdates=new IRun() {
@Override
public void Run() {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
stvUpdate.setRightString(ConfigName.getInstance().Version+"|"+ ExecuteTheRecipe.PlcVersion);
}
});
}
};
/*
* 版本更新,点击事件
* */


+ 13
- 0
app/src/main/res/layout/fragment_system_systemset.xml View File

@@ -241,6 +241,19 @@
android:padding="3dp"
android:textSize="12dp"
android:text="1"/>

<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="手投是否暂停" />
<Spinner
android:id="@+id/isStop"
style="@style/commonSpinnerStyle"
android:layout_width="80dp"
android:layout_height="24dp"
android:layout_centerVertical="true" />
</TableRow>
</TableLayout>



Loading…
Cancel
Save