@@ -1,7 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project version="4"> | |||
<component name="ExternalStorageConfigurationManager" enabled="true" /> | |||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="JDK" project-jdk-type="JavaSDK"> | |||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK"> | |||
<output url="file://$PROJECT_DIR$/build/classes" /> | |||
</component> | |||
<component name="ProjectType"> | |||
@@ -4,6 +4,8 @@ | |||
android:revisionCode="1" | |||
android:versionName="1.0"> | |||
<uses-sdk tools:overrideLibrary="com.aliyun.iot.breeze.biz,com.aliyun.iot.breeze.ota, com.aliyun.iot.breeze.sdk,com.aliyun.iot.ble,com.aliyun.alink.linksdk.tmp" /> | |||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> | |||
<uses-permission android:name="android.permission.INTERNET" /> | |||
<uses-permission android:name="android.permission.VIBRATE" /> | |||
@@ -15,12 +17,8 @@ | |||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> | |||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> | |||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | |||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | |||
<uses-sdk tools:overrideLibrary="com.aliyun.iot.breeze.biz,com.aliyun.iot.breeze.ota, | |||
com.aliyun.iot.breeze.sdk,com.aliyun.iot.ble,com.aliyun.alink.linksdk.tmp" /> | |||
<application | |||
android:name=".app.ICSApp" | |||
android:allowBackup="true" | |||
@@ -33,6 +31,9 @@ | |||
android:theme="@style/AppTheme" | |||
tools:replace="android:icon" | |||
tools:targetApi="31"> | |||
<activity | |||
android:name=".view.from.dzcjy_new_activity" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".view.from.pflb_activity" | |||
android:exported="false" /> | |||
@@ -138,14 +139,17 @@ | |||
android:exported="false" | |||
android:windowSoftInputMode="adjustPan|stateHidden" /> <!-- Mqtt Service --> | |||
<service android:name="org.eclipse.paho.android.service.MqttService" /> | |||
<receiver | |||
android:name=".app.BootReceiver" | |||
android:exported="true"> | |||
<intent-filter> | |||
<action android:name="android.intent.action.BOOT_COMPLETED" /> | |||
<category android:name="android.intent.category.LAUNCHER" /> | |||
</intent-filter> | |||
</receiver> | |||
<provider | |||
android:name="androidx.core.content.FileProvider" | |||
android:authorities="${applicationId}.fileprovider" | |||
@@ -155,8 +159,6 @@ | |||
android:name="android.support.FILE_PROVIDER_PATHS" | |||
android:resource="@xml/fileproviderpath" /> | |||
</provider> | |||
</application> | |||
</manifest> |
@@ -14,6 +14,7 @@ import android.widget.RelativeLayout; | |||
import android.widget.TextView; | |||
import com.example.bpa.R; | |||
import com.example.bpa.view.from.dzcjy_new_activity; | |||
import com.example.bpa.view.from.sdkz_activity; | |||
import com.example.bpa.view.from.ddgl_activity; | |||
import com.example.bpa.helper.T; | |||
@@ -75,6 +76,7 @@ public class SystemCapabilitiesFragment extends Fragment { | |||
menuModes.add(new MenuMode("温度管理", R.mipmap.wdkz)); | |||
menuModes.add(new MenuMode("电子秤校验", R.mipmap.dzcjy)); | |||
menuModes.add(new MenuMode("流速校验", R.mipmap.lsjy)); | |||
menuModes.add(new MenuMode("自动清洗", R.mipmap.zdqx)); | |||
@@ -104,8 +106,11 @@ public class SystemCapabilitiesFragment extends Fragment { | |||
intent = new Intent(view.getContext(), lcsz_activity.class); | |||
break; | |||
case "电子秤校验": | |||
intent = new Intent(view.getContext(), dzcjy_activity.class); | |||
intent = new Intent(view.getContext(), dzcjy_new_activity.class); | |||
break; | |||
// case "电子秤校验新": | |||
// intent = new Intent(view.getContext(), dzcjy_new_activity.class); | |||
// break; | |||
case "流速校验": | |||
intent = new Intent(view.getContext(), lsjy_activity.class); | |||
break; | |||
@@ -0,0 +1,151 @@ | |||
package com.example.bpa.view.from; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.widget.Button; | |||
import android.widget.EditText; | |||
import android.widget.ImageView; | |||
import android.widget.TextView; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.R; | |||
import com.example.bpa.helper.ActiveMax; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.service.DeviceData; | |||
public class dzcjy_new_activity extends AppCompatActivity implements View.OnClickListener{ | |||
//region 变量 | |||
/** | |||
* 返回按钮 | |||
*/ | |||
ImageView gongneng_fanhui; | |||
/** | |||
* 标题设置 | |||
*/ | |||
TextView gongneng_title; | |||
Button ldjz_button, jzzl_button; | |||
EditText outweight_edit; | |||
//endregion | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setContentView(R.layout.activity_dzcjy_new); | |||
ActiveMax.MaxFrom(this);//最大化 | |||
Init(); | |||
initEvents(); | |||
} | |||
@Override | |||
protected void onDestroy() { | |||
ClosePLC(); | |||
super.onDestroy(); | |||
} | |||
//region 公共函数 | |||
/** | |||
* 初始化 | |||
*/ | |||
private void Init() { | |||
gongneng_fanhui = this.findViewById(R.id.gongneng_fanhui); | |||
gongneng_title = this.findViewById(R.id.gongneng_title); | |||
//通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据 | |||
String msg = getIntent().getStringExtra("data"); | |||
gongneng_title.setText(msg); | |||
//edittext 砝码重量 | |||
outweight_edit = this.findViewById(R.id.outweight_edit); | |||
ldjz_button= this.findViewById(R.id.ldjz_button); | |||
jzzl_button= this.findViewById(R.id.jzzl_button); | |||
StartPLC(); | |||
} | |||
/** | |||
* 初始化按钮事件 | |||
*/ | |||
private void initEvents() { | |||
gongneng_fanhui.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
dzcjy_new_activity.this.finish(); | |||
} | |||
}); | |||
ldjz_button.setOnClickListener(this); | |||
jzzl_button.setOnClickListener(this); | |||
outweight_edit.setText("0"); | |||
} | |||
public void StartPLC() | |||
{ | |||
//设置砝码校准模式false | |||
DeviceData.Get().setWeightCalibrationMode(true, null); | |||
//关闭写保护 | |||
DeviceData.Get().setCloseWriteProtect(null); | |||
} | |||
public void ClosePLC() | |||
{ | |||
//设置砝码校准模式false | |||
DeviceData.Get().setWeightCalibrationMode(false, null); | |||
//打开写保护 | |||
DeviceData.Get().setOpenWriteProtect(null); | |||
} | |||
//endregion | |||
//region 点击事件 | |||
/** | |||
* 本页面需要写入plc的点击事件监听 | |||
* 开启新线程,防止阻塞UI线程 | |||
* | |||
* @param v | |||
*/ | |||
@Override | |||
public void onClick(View v) { | |||
switch (v.getId()) { | |||
case R.id.jzzl_button://出口砝码值写入 | |||
String outres = outweight_edit.getText().toString().trim(); | |||
if (!outres.equals("")) { | |||
DeviceData.Get().setCalibrationWeight9(Short.parseShort(outres), new IWriteCallBack() { | |||
@Override | |||
public void onSuccess() { | |||
DeviceData.Get().setWeightValueWrite(null); | |||
T.show(dzcjy_new_activity.this, "校正重量成功!"); | |||
} | |||
@Override | |||
public void onFailure(String ErrorMsg) { | |||
T.show(dzcjy_new_activity.this, "校正重量失败!"); | |||
} | |||
}); | |||
}else | |||
{ | |||
T.show(dzcjy_new_activity.this, "砝码值不能为空!"); | |||
} | |||
break; | |||
case R.id.ldjz_button://零点校准 | |||
DeviceData.Get().setZeroPointCalibration(new IWriteCallBack() { | |||
@Override | |||
public void onSuccess() { | |||
T.show(dzcjy_new_activity.this, "开启零点校正成功!"); | |||
} | |||
@Override | |||
public void onFailure(String ErrorMsg) { | |||
T.show(dzcjy_new_activity.this, "开启零点校正失败!"); | |||
} | |||
}); | |||
break; | |||
} | |||
} | |||
//endregion | |||
} |
@@ -0,0 +1,169 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout 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:orientation="vertical" | |||
android:background="@mipmap/dpbj" | |||
tools:context=".view.from.dzcjy_new_activity"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="45dp" | |||
android:background="@color/test"> | |||
<ImageView | |||
android:id="@+id/gongneng_fanhui" | |||
android:layout_width="45dp" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
android:textSize="@dimen/TitleSize" | |||
android:textColor="@color/titleforeground" | |||
android:src="@mipmap/zj" | |||
/> | |||
<RelativeLayout | |||
android:layout_centerInParent="true" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:id="@+id/gongneng_title" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/textTitleSize" | |||
android:textStyle="bold" /> | |||
<ImageView | |||
android:layout_width="400dp" | |||
android:layout_height="22dp" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/tittle" | |||
android:layout_marginLeft="5dp" | |||
/> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:layout_height="1dp" | |||
android:background="#FF03668F" /> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_margin="5dp"> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_alignParentTop="true" | |||
android:src="@mipmap/zs"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/zx"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_alignParentTop="true" | |||
android:src="@mipmap/ys"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/yx"/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_margin="10dp" | |||
android:orientation="vertical"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="电子秤校正步骤:" | |||
android:textSize="30dp" | |||
android:textColor="@color/qmui_config_color_red" | |||
></TextView> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="①:清空秤盘 **(保证秤盘上无物品后下一步)**\n②:点击零点校正\n③:放上校正砝码 **(输入砝码重量,注意!如果砝码是100G,数值应输入1000 原数值放大10倍)**\n④:点击校正重量" | |||
android:textSize="16dp" | |||
android:textColor="@color/foreground" | |||
></TextView> | |||
<LinearLayout | |||
android:layout_marginTop="50dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<Button | |||
android:layout_centerInParent="true" | |||
android:id="@+id/ldjz_button" | |||
android:layout_width="220dp" | |||
android:layout_height="40dp" | |||
android:background="@drawable/btn_greenblue" | |||
android:text="零点校正" | |||
android:textSize="20dp" | |||
android:layout_margin="5dp"/> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<LinearLayout | |||
android:layout_centerInParent="true" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center_horizontal" | |||
> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:textColor="@color/white" | |||
android:text="砝码重量:" | |||
android:textSize="20dp" | |||
android:layout_margin="5dp"/> | |||
<EditText | |||
android:id="@+id/outweight_edit" | |||
android:layout_width="100dp" | |||
android:layout_height="wrap_content" | |||
android:minWidth="60dp" | |||
android:textColor="@color/white" | |||
android:backgroundTint="@color/colorAccent" | |||
android:inputType="number" | |||
android:theme="@style/MyEditText_num" | |||
android:maxLines="1" | |||
android:singleLine="true" | |||
android:layout_margin="5dp"/> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<Button | |||
android:layout_centerInParent="true" | |||
android:id="@+id/jzzl_button" | |||
android:layout_width="220dp" | |||
android:layout_height="40dp" | |||
android:background="@drawable/btn_greenblue" | |||
android:text="校正重量" | |||
android:textSize="20dp" | |||
android:layout_margin="5dp"/> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</LinearLayout> |