Browse Source

woshi22322323

master
fyf 1 year ago
parent
commit
b795227c9d
6 changed files with 433 additions and 46 deletions
  1. +1
    -1
      .idea/misc.xml
  2. +2
    -3
      app/src/main/java/com/example/bpa/db/QueryDB.java
  3. +17
    -16
      app/src/main/java/com/example/bpa/view/fragment/SystemSetFragment.java
  4. +170
    -4
      app/src/main/java/com/example/bpa/view/fragment/setting/systemparameter.java
  5. +231
    -4
      app/src/main/res/layout/from/layout/activity_systemparameter.xml
  6. +12
    -18
      app/src/main/res/layout/from/layout/fragment_lcparameter.xml

+ 1
- 1
.idea/misc.xml View File

@@ -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="Android Studio default JDK" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">


+ 2
- 3
app/src/main/java/com/example/bpa/db/QueryDB.java View File

@@ -1140,11 +1140,10 @@ public class QueryDB {
* 删除系统设置
* add fengyoufu 20230413
*
* @param data
* @return 是否成功
*/
public static boolean DeleteSystemset(BPA_SYSTEMSET data) {
return Delete(BPA_SYSTEMSET.class, data.id);
public static boolean DeleteSystemset(String id) {
return Delete(BPA_SYSTEMSET.class, id);
}

/**


+ 17
- 16
app/src/main/java/com/example/bpa/view/fragment/SystemSetFragment.java View File

@@ -22,6 +22,7 @@ import com.example.bpa.db.QueryDB;
import com.example.bpa.db.mode.BPA_LOG;
import com.example.bpa.helper.MessageLog;
import com.example.bpa.view.fragment.setting.Fragment_lcparameter;
import com.example.bpa.view.fragment.setting.systemparameter;

/**
* 系统设置界面
@@ -35,12 +36,13 @@ public class SystemSetFragment extends Fragment implements View.OnClickListener
private Button btn_lc_set;

private Fragment lcparameter;
private Fragment Systemparameter;
private Fragment SelectFragment;

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_system_set, container,false);
view = inflater.inflate(R.layout.fragment_system_set, container, false);
Init();
initEvent();
return view;
@@ -49,6 +51,7 @@ public class SystemSetFragment extends Fragment implements View.OnClickListener

private void Init() {
lcparameter = new Fragment_lcparameter();
Systemparameter = new systemparameter();
btn_system_set = view.findViewById(R.id.stparameter);
btn_lc_set = view.findViewById(R.id.lcparameter);
MessageLog.MsgNotify = new IMessageLogNotify() {
@@ -59,7 +62,7 @@ public class SystemSetFragment extends Fragment implements View.OnClickListener
}

@Override
public void InfoMsg(String msg,String datetime) {
public void InfoMsg(String msg, String datetime) {
BPA_LOG log = new BPA_LOG();
log.userID = ConfigName.getInstance().user.userID;
log.createTime = datetime;
@@ -68,16 +71,18 @@ public class SystemSetFragment extends Fragment implements View.OnClickListener
QueryDB.Addlog(log);
Log.i("Info", msg);
}

@Override
public void WarnMsg(String msg) {
Log.w("Warn", msg);
}
};


//默认打开参数设置界面
ShowFragment(Systemparameter);
}

private void initEvent(){
private void initEvent() {
btn_system_set.setOnClickListener(this);
btn_lc_set.setOnClickListener(this);
}
@@ -86,28 +91,24 @@ public class SystemSetFragment extends Fragment implements View.OnClickListener
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.stparameter://返回按钮
Log.d("页面", "onClick: ");
case R.id.stparameter://系統參數設置
ShowFragment(Systemparameter);
break;
case R.id.lcparameter://料倉設置
ShowFragment(lcparameter);
break;
case R.id.lcparameter://返回按钮
ShowFragment(lcparameter);
break;


}
}


public void ShowFragment(Fragment fragment)
{
public void ShowFragment(Fragment fragment) {
FragmentManager manager = getChildFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
if(SelectFragment!=null)
{
if (SelectFragment != null) {
transaction.remove(SelectFragment);
}
transaction.add(R.id.fragment_container, fragment);
transaction.commit();
SelectFragment=fragment;
SelectFragment = fragment;
}
}

+ 170
- 4
app/src/main/java/com/example/bpa/view/fragment/setting/systemparameter.java View File

@@ -1,16 +1,182 @@
package com.example.bpa.view.fragment.setting;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;

import com.example.bpa.R;
import com.example.bpa.app.DeviceData;
import com.example.bpa.config.ConfigName;
import com.example.bpa.db.QueryDB;
import com.example.bpa.db.mode.BPA_GOODS;
import com.example.bpa.db.mode.BPA_SYSTEMSET;

public class systemparameter extends AppCompatActivity {
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class systemparameter extends Fragment implements View.OnClickListener{

//region 界面变量
/**
* 界面实例
*/
private View view;
/**
* 输入变量
*/
EditText passwayText_1,passwayText_2,passwayText_3,passwayText_4,passwayText_5,passwayText_6,passwayText_7,passwayText_8,passwayText_9,passwayText_10;
/**
* 保存参数设置
*/
Button SaveButton;
/**
* 系统设置参数
*/
ArrayList<BPA_SYSTEMSET> bpa_systemsets=new ArrayList<>();

List<EditText> editTextLists = new ArrayList<EditText>();
//endregion

//region 私有函数
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.activity_systemparameter, container,false);
Init();
initEvents();
Initdata();
return view;
}
//endregion

//region 公有函数

/**
* 初始化
*/
public void Init()
{
passwayText_1 = view.findViewById(R.id.passwayText_1);
passwayText_2 = view.findViewById(R.id.passwayText_2);
passwayText_3 = view.findViewById(R.id.passwayText_3);
passwayText_4 = view.findViewById(R.id.passwayText_4);
passwayText_5 = view.findViewById(R.id.passwayText_5);
passwayText_6 = view.findViewById(R.id.passwayText_6);
passwayText_7 = view.findViewById(R.id.passwayText_7);
passwayText_8 = view.findViewById(R.id.passwayText_8);
passwayText_9 = view.findViewById(R.id.passwayText_9);
editTextLists = Arrays.asList(passwayText_1,passwayText_2,passwayText_3,passwayText_4,passwayText_5,passwayText_6,passwayText_7,passwayText_8,passwayText_9);
//保存按钮
SaveButton = view.findViewById(R.id.StartButton);
}
/**
* 初始化按钮事件
*/
private void initEvents()
{
SaveButton.setOnClickListener(this);
}

/**
* 初始化数据加载
*/
public void Initdata() {
bpa_systemsets=QueryDB.GetSystemsetALL();
for (BPA_SYSTEMSET item:bpa_systemsets)
{
switch (item.type)
{
case 1:
ConfigName.getInstance().OrderPushTime=Integer.parseInt(item.value);
passwayText_1.setText(item.value);
break;
case 2:
ConfigName.getInstance().SilosValuePushTime=Integer.parseInt(item.value);
passwayText_2.setText(item.value);
break;
case 3:
ConfigName.getInstance().OtherValuePushTime=Integer.parseInt(item.value);
passwayText_3.setText(item.value);

break;
case 4:
ConfigName.getInstance().PipeDrainCycleTime=Integer.parseInt(item.value);
passwayText_4.setText(item.value);
break;
case 5:
ConfigName.getInstance().OrderTimeout=Integer.parseInt(item.value);
passwayText_5.setText(item.value);
break;
case 6:
ConfigName.getInstance().SiloFeedThreshold=Integer.parseInt(item.value);
passwayText_6.setText(item.value);
break;
case 7:
ConfigName.getInstance().SiloAlarmThreshold=Integer.parseInt(item.value);
passwayText_7.setText(item.value);
break;
case 8:
ConfigName.getInstance().AICleanTime=Integer.parseInt(item.value);
passwayText_8.setText(item.value);
break;
case 9:
ConfigName.getInstance().AutKey=item.value;
passwayText_9.setText(item.value);
break;
case 10:
break;
case 11:
break;

}

}
}
//endregion

//region 界面点击事件
/**
* 本页面点击事件监听22
*
* @param v
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_systemparameter);
public void onClick(View v) {
switch (v.getId()) {
case R.id.StartButton://保存参数
ConfigName.getInstance().OrderPushTime=Integer.parseInt(passwayText_1.getText().toString());
ConfigName.getInstance().SilosValuePushTime=Integer.parseInt(passwayText_2.getText().toString());
ConfigName.getInstance().OtherValuePushTime=Integer.parseInt(passwayText_3.getText().toString());
ConfigName.getInstance().PipeDrainCycleTime=Integer.parseInt(passwayText_4.getText().toString());
ConfigName.getInstance().OrderTimeout=Integer.parseInt(passwayText_5.getText().toString());
ConfigName.getInstance().SiloFeedThreshold=Integer.parseInt(passwayText_6.getText().toString());
ConfigName.getInstance().SiloAlarmThreshold=Integer.parseInt(passwayText_7.getText().toString());
ConfigName.getInstance().AICleanTime=Integer.parseInt(passwayText_8.getText().toString());
ConfigName.getInstance().AutKey=passwayText_9.getText().toString();
for (BPA_SYSTEMSET item:bpa_systemsets)
{
QueryDB.DeleteSystemset(item.id);
}
for (int i = 0; i <editTextLists.size();i++){
BPA_SYSTEMSET set=new BPA_SYSTEMSET();
set.type=i;
set.value=editTextLists.get(i).getText().toString();
set.deviceID = ConfigName.getInstance().DeviceId;
set.userID = ConfigName.getInstance().user.userID;
QueryDB.AddSystemset(set);
}
break;
}
}
//endregion
}

+ 231
- 4
app/src/main/res/layout/from/layout/activity_systemparameter.xml View File

@@ -1,11 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout 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.add_pf_activity">
tools:context=".view.fragment.setting.systemparameter">
<RelativeLayout
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableLayout
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- Table1-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="订单上报周期:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_1"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:text="0"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="料仓余量上报周期:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:minWidth="60dp"
android:text="0"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
</TableRow>

</LinearLayout>
<!-- Table2-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="其他传感器上报周期:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_3"
android:minWidth="60dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:text="0"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="管道排空周期:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="60dp"
android:layout_marginRight="15dp"
android:text="0"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
</TableRow>

<!-- Table3-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="订单未制作超时规则:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_5"
android:minWidth="60dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="料仓补料阈值:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="60dp"
android:text="0"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
</TableRow>

<!-- Table4-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="料仓告警阈值:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_7"
android:minWidth="60dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:text="0"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="自动清洗时间:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="60dp"
android:text="0"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
</TableRow>

<!-- Table5-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<TextView
android:layout_width="150dp"
android:gravity="right"
android:layout_marginRight="15dp"
android:text="店铺号:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/passwayText_9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="60dp"
android:text="0"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:layout_weight="2"
android:backgroundTint="@color/colorAccent"/>
</TableRow>

<!-- Table6-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2">
<Button
android:id="@+id/StartButton"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:layout_centerInParent="true"
android:background="@drawable/bt_circular"
android:textColor="@color/white"
android:text="保存参数"
android:textSize="16dp"/>
</RelativeLayout>

</TableRow>

</TableLayout>
</RelativeLayout>
</RelativeLayout>

+ 12
- 18
app/src/main/res/layout/from/layout/fragment_lcparameter.xml View File

@@ -6,8 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"

tools:context=".view.from.add_pf_activity">
tools:context=".view.fragment.setting.Fragment_lcparameter">
<TableLayout
android:layout_gravity="center"
android:layout_width="wrap_content"
@@ -29,7 +28,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -51,7 +50,7 @@
android:layout_height="wrap_content"
android:minWidth="60dp"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -79,7 +78,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -101,7 +100,7 @@
android:layout_height="wrap_content"
android:minWidth="60dp"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -129,7 +128,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -151,7 +150,7 @@
android:layout_height="wrap_content"
android:minWidth="60dp"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -179,7 +178,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -201,7 +200,7 @@
android:layout_height="wrap_content"
android:minWidth="60dp"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -229,7 +228,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -251,7 +250,7 @@
android:layout_height="wrap_content"
android:minWidth="60dp"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Switch
@@ -311,6 +310,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:inputType="number|numberDecimal"
android:backgroundTint="@color/colorAccent"/>
<Button
android:id="@+id/savetime"
@@ -321,11 +321,5 @@
android:background="@drawable/btn_button"/>
</TableRow>
</TableLayout>



</RelativeLayout>



</LinearLayout>

Loading…
Cancel
Save