Browse Source

修改料仓设置

上海闵中
liup 6 months ago
parent
commit
968eda155a
6 changed files with 155 additions and 96 deletions
  1. +49
    -13
      app/src/main/java/com/bonait/bnframework/newui/dialog/SilosInfoDialog.java
  2. +31
    -7
      app/src/main/java/com/bonait/bnframework/newui/fragment/SilosSettingFragment.java
  3. +5
    -6
      app/src/main/java/com/bonait/bnframework/newui/widget/SilosInfoView.java
  4. +2
    -2
      app/src/main/java/com/bonait/bnframework/newui/widget/SilosProcessBarView.java
  5. +59
    -51
      app/src/main/res/layout/item/layout/dialog_silos_message.xml
  6. +9
    -17
      app/src/main/res/layout/new/layout/layout_process_bar_silos.xml

+ 49
- 13
app/src/main/java/com/bonait/bnframework/newui/dialog/SilosInfoDialog.java View File

@@ -13,8 +13,8 @@ import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;

@@ -22,8 +22,10 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL;
@@ -34,6 +36,7 @@ import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.databinding.DialogSilosMessageBinding;
import com.bonait.bnframework.newui.widget.imagebuttom;
import com.bonait.bnframework.ui.widget.NewToastUtil;

import java.util.ArrayList;
import java.util.List;
@@ -51,8 +54,8 @@ public class SilosInfoDialog extends DialogFragment {
private String TAG = " FoodControlDialog =>";
private DialogSilosMessageBinding viewBinding;
//region 界面变量
@BindView(R.id.close_from)
Button close_from;
@BindView(R.id.close)
LinearLayout close;
@BindView(R.id.silosname)
TextView silosname;//
@BindView(R.id.xuhao)
@@ -74,6 +77,11 @@ public class SilosInfoDialog extends DialogFragment {
imagebuttom click_dcqx;

public MyClickListener mListener = null;

public void setmListener(MyClickListener mListener) {
this.mListener = mListener;
}

private View root;
private Context contextMian;

@@ -120,24 +128,32 @@ public class SilosInfoDialog extends DialogFragment {
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
WindowManager.LayoutParams params = window.getAttributes();
params.gravity = Gravity.CENTER;
params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
window.setAttributes(params);
}
setCancelable(false);
AdbCommandUtil.hideStatusBar(true);
initEvent();
initView();
initEvent();
}

private void initView(){

Bundle bundle = getArguments();
assert bundle != null;
int num = bundle.getInt("num");
for (lcMode item : DataBus.getInstance().lcModes) {
if (item.num == num) {
SetData(item);
}
}
}
//region 私有函数
/**
* 初始化事件
*/
private void initEvent() {
close_from.setOnClickListener(new View.OnClickListener() {
close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mListener != null) {
@@ -145,6 +161,7 @@ public class SilosInfoDialog extends DialogFragment {
ExecuteTheRecipe.WritePLC("料仓" + mode.num + "手动开关", false, null);
mListener.clickListener(v, mode);
}
dismiss();
}
});

@@ -169,7 +186,12 @@ public class SilosInfoDialog extends DialogFragment {
*/
private void initData() {
xuhao.setText(GetNum(mode.num)+"");
silosname.setText(mode.materialName+"");
if(mode.num == 4){
silosname.setText("");
}else {
silosname.setText(mode.materialName+"");
}

int bfb=0;
int yl=mode.silosmargin;
int zl=mode.siloszl;
@@ -218,7 +240,7 @@ public class SilosInfoDialog extends DialogFragment {
QueryDB.UpdateSilosBJZ(mode.id,mode.warningValue);
QueryDB.UpdateSilosZL(mode.id,mode.siloszl);
initData();
ToastUtils.info("容量保存成功!");
NewToastUtil.getInstance().showToast("容量保存成功!");
}
break;
case R.id.save_tlbd:
@@ -250,13 +272,14 @@ public class SilosInfoDialog extends DialogFragment {
mode.materialName = material.name;
}
initData();
ToastUtils.info("更换物料成功!");
NewToastUtil.getInstance().showToast("更换物料成功!");
break;
case R.id.click_dcbl:
LogUtils.d("click_dcbl mode="+mode);
QueryDB.UpdateYL(mode.id,mode.siloszl);
mode.silosmargin=mode.siloszl;
initData();
ToastUtils.info("补料成功!");
NewToastUtil.getInstance().showToast("补料成功!");
break;
case R.id.click_lcjz:
ExecuteTheRecipe.WritePLC("校准时间", 50, null);//默认校准时间5秒
@@ -268,7 +291,7 @@ public class SilosInfoDialog extends DialogFragment {
ExecuteTheRecipe.WritePLC("开始校正", false, null);
}
}, 500);
ToastUtils.info("开始校准!");
NewToastUtil.getInstance().showToast("开始校准!");
break;
}
}
@@ -351,6 +374,7 @@ public class SilosInfoDialog extends DialogFragment {
*/
public void SetData(lcMode data) {
try {
LogUtils.d("SetData mode="+mode);
click_dcqx.SetStatus(false);
mode = data;
viewBinding.rlChangeWl.setVisibility(mode.num==4?View.GONE:View.VISIBLE);
@@ -388,4 +412,16 @@ public class SilosInfoDialog extends DialogFragment {
} catch (Exception ex) {
}
}

@Override
public void dismiss() {
super.dismiss();
if (mListener != null) {
if(mode!=null){
ExecuteTheRecipe.WritePLC("料仓" + mode.num + "校准开关", false,null);
ExecuteTheRecipe.WritePLC("料仓" + mode.num + "手动开关", false, null);
}
mListener.clickListener(null, mode);
}
}
}

+ 31
- 7
app/src/main/java/com/bonait/bnframework/newui/fragment/SilosSettingFragment.java View File

@@ -11,12 +11,12 @@ import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.res.lcMode;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.FragmentSilosSettingBinding;
import com.bonait.bnframework.newui.dialog.SilosInfoDialog;
import com.bonait.bnframework.newui.widget.SilosProcessBarView;

import org.greenrobot.eventbus.EventBus;

/**
* @author: liup
* @description:
@@ -28,13 +28,13 @@ public class SilosSettingFragment extends BaseFragment {
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_silos_setting, null);
viewBinding = FragmentSilosSettingBinding.bind(root);
DisplayManager.scaleViewGroup(viewBinding.getRoot());
return root;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
EventBus.getDefault().register(this);
initView();
}

@@ -43,7 +43,10 @@ public class SilosSettingFragment extends BaseFragment {
@Override
public void click(View v, lcMode model) {
SilosInfoDialog dialog = new SilosInfoDialog();
dialog.SetData(model);
dialog.setmListener(mListener);
Bundle bundle = new Bundle();
bundle.putInt("num",1);
dialog.setArguments(bundle);
if(getActivity()!=null){
dialog.show(getActivity().getSupportFragmentManager(),"料仓设置");
}
@@ -53,7 +56,10 @@ public class SilosSettingFragment extends BaseFragment {
@Override
public void click(View v, lcMode model) {
SilosInfoDialog dialog = new SilosInfoDialog();
dialog.SetData(model);
dialog.setmListener(mListener);
Bundle bundle = new Bundle();
bundle.putInt("num",2);
dialog.setArguments(bundle);
if(getActivity()!=null){
dialog.show(getActivity().getSupportFragmentManager(),"料仓设置");
}
@@ -63,7 +69,10 @@ public class SilosSettingFragment extends BaseFragment {
@Override
public void click(View v, lcMode model) {
SilosInfoDialog dialog = new SilosInfoDialog();
dialog.SetData(model);
dialog.setmListener(mListener);
Bundle bundle = new Bundle();
bundle.putInt("num",3);
dialog.setArguments(bundle);
if(getActivity()!=null){
dialog.show(getActivity().getSupportFragmentManager(),"料仓设置");
}
@@ -73,7 +82,10 @@ public class SilosSettingFragment extends BaseFragment {
@Override
public void click(View v, lcMode model) {
SilosInfoDialog dialog = new SilosInfoDialog();
dialog.SetData(model);
dialog.setmListener(mListener);
Bundle bundle = new Bundle();
bundle.putInt("num",4);
dialog.setArguments(bundle);
if(getActivity()!=null){
dialog.show(getActivity().getSupportFragmentManager(),"料仓设置");
}
@@ -82,6 +94,18 @@ public class SilosSettingFragment extends BaseFragment {
updateData();
}

private MyClickListener mListener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
InitData();
}

@Override
public void clickListenerNew(View v, int k, Object data) {
InitData();
}
};

public void updateData(){
InitData();
}


+ 5
- 6
app/src/main/java/com/bonait/bnframework/newui/widget/SilosInfoView.java View File

@@ -7,7 +7,6 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.Spinner;
@@ -34,8 +33,8 @@ import butterknife.OnClick;
public class SilosInfoView extends LinearLayout {

//region 界面变量
@BindView(R.id.close_from)
Button close_from;
@BindView(R.id.close)
LinearLayout close;
@BindView(R.id.silosname)
TextView silosname;//
@BindView(R.id.xuhao)
@@ -76,12 +75,12 @@ public class SilosInfoView extends LinearLayout {
* 初始化事件
*/
private void initEvent() {
close_from.setOnClickListener(new OnClickListener() {
close.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mListener != null) {
ExecuteTheRecipe.WritePLC("料仓" + mode.num + "校准开关", false,null);
ExecuteTheRecipe.WritePLC("料仓" + mode.num + "手动开关", false, null);
// ExecuteTheRecipe.WritePLC("料仓" + mode.num + "校准开关", false,null);
// ExecuteTheRecipe.WritePLC("料仓" + mode.num + "手动开关", false, null);
mListener.clickListener(v, mode);
}
}


+ 2
- 2
app/src/main/java/com/bonait/bnframework/newui/widget/SilosProcessBarView.java View File

@@ -4,8 +4,8 @@ import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;
@@ -19,7 +19,7 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class SilosProcessBarView extends LinearLayout {
public class SilosProcessBarView extends RelativeLayout {
private LayoutProcessBarSilosBinding viewBinding;
@BindView(R.id.t_progressBar)
ProgressBar t_progressBar;


+ 59
- 51
app/src/main/res/layout/item/layout/dialog_silos_message.xml View File

@@ -3,28 +3,20 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dialogbj"
>
xmlns:tools="http://schemas.android.com/tools"
android:layout_gravity="center"
android:gravity="center">

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="tiaoliaobiaoding" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_marginStart="250dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="250dp"
android:layout_marginBottom="20dp"
android:layout_width="700dp"
android:layout_height="760dp"
android:gravity="center"
android:layout_gravity="center"
android:background="@drawable/silosbj">

<LinearLayout
android:id="@+id/close_from"
android:id="@+id/close"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
@@ -49,9 +41,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:layout_marginEnd="20dp"
android:orientation="vertical">

<LinearLayout
@@ -64,7 +56,7 @@
android:id="@+id/xuhao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginStart="5dp"
android:fontFamily="@font/fz2"
android:text="①"
android:textColor="@color/topbj1"
@@ -84,9 +76,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:fontFamily="@font/fz2"
android:text="复合料"
tools:text="复合料"
android:textColor="@color/topbj1"
android:textSize="32sp" />

@@ -94,9 +86,9 @@
android:id="@+id/t_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:fontFamily="@font/zkgdh"
android:text="50%"
tools:text="50%"
android:textColor="@color/topbj1"
android:textSize="30dp"
android:textStyle="bold" />
@@ -113,9 +105,9 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="160dp"
android:layout_marginStart="160dp"
android:layout_marginTop="75dp"
android:layout_marginRight="140dp"
android:layout_marginEnd="140dp"
android:orientation="vertical">

<EditText
@@ -144,14 +136,19 @@
android:textSize="32sp" />
</LinearLayout>

<RelativeLayout
<TextView
android:id="@+id/save_rlsz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentRight="true"
android:layout_marginTop="80dp"
android:layout_marginRight="30dp"
android:background="@mipmap/save22" />
android:layout_marginTop="75dp"
android:layout_marginEnd="25dp"
android:text="保存"
android:gravity="center"
android:textSize="32sp"
android:textColor="@color/white"
android:background="@drawable/bg_round15_yellow_btn"
/>
</RelativeLayout>

<RelativeLayout
@@ -163,7 +160,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="180dp"
android:layout_marginStart="180dp"
android:layout_marginTop="20dp"
android:src="@mipmap/pkbdy" />

@@ -171,26 +168,32 @@
android:id="@+id/tiaoliaobiaoding"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="120dp"
android:layout_marginStart="120dp"
android:layout_marginTop="90dp"
android:layout_marginRight="140dp"
android:layout_marginEnd="140dp"
android:background="@drawable/input_bj"
android:digits="0123456789."
android:hint="请输入制作时长"
android:hint="请输入"
android:inputType="text"
android:maxLines="1"
android:padding="3dp"
android:text="0"
android:textSize="32sp" />

<RelativeLayout
<TextView
android:id="@+id/save_tlbd"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_width="100dp"
android:layout_height="70dp"
android:layout_alignParentRight="true"
android:layout_marginTop="90dp"
android:layout_marginRight="30dp"
android:background="@mipmap/save11" />
android:layout_marginTop="80dp"
android:layout_marginEnd="25dp"
android:text="保存"
android:gravity="center"
android:textSize="32sp"
android:textColor="@color/white"
android:background="@drawable/bg_round15_yellow_btn"
/>

</RelativeLayout>

<RelativeLayout
@@ -205,18 +208,23 @@
style="@style/commonSpinnerStyle"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="160dp"
android:layout_marginStart="160dp"
android:layout_marginTop="90dp"
android:layout_marginRight="140dp" />
android:layout_marginEnd="140dp" />

<RelativeLayout
<TextView
android:id="@+id/save_ghtl"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_width="100dp"
android:layout_height="70dp"
android:layout_alignParentRight="true"
android:layout_marginTop="90dp"
android:layout_marginRight="30dp"
android:background="@mipmap/save11" />
android:layout_marginTop="80dp"
android:layout_marginEnd="25dp"
android:text="保存"
android:gravity="center"
android:textSize="32sp"
android:textColor="@color/white"
android:background="@drawable/bg_round15_yellow_btn"
/>
</RelativeLayout>
</LinearLayout>

@@ -238,7 +246,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="40dp"
android:layout_marginStart="40dp"
app:imagesrc_ks="@mipmap/dcqx_select"
app:imagesrc_tz="@mipmap/dcqx" />

@@ -246,7 +254,7 @@
android:id="@+id/click_lcjz"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="40dp"
android:layout_marginStart="40dp"
android:src="@mipmap/tljz" />
</LinearLayout>
</RelativeLayout>

+ 9
- 17
app/src/main/res/layout/new/layout/layout_process_bar_silos.xml View File

@@ -2,8 +2,8 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="400dp"
android:layout_height="150dp"
android:id="@+id/silos_sz"
>
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/silos_sz">

<RelativeLayout
android:layout_marginTop="16dp"
@@ -31,13 +31,8 @@
android:id="@+id/xuhao"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:fontFamily="@font/fz2"
android:shadowColor="#65000000"
android:shadowDx="0.0"
android:shadowDy="5.0"
android:shadowRadius="2.0"
android:layout_marginLeft="20dp"
android:layout_marginTop="12dp"
android:text="①"
android:textColor="@color/topbj1"
android:textSize="32sp"
@@ -48,22 +43,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:fontFamily="@font/fz2"
android:shadowColor="#65000000"
android:shadowDx="0.0"
android:shadowDy="5.0"
android:shadowRadius="2.0"
android:text="复合料"
android:textStyle="bold"
tools:text="复合料"
android:textColor="@color/topbj1"
android:textSize="32sp" />
android:textSize="36sp" />
<TextView
android:id="@+id/t_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="12dp"
android:layout_marginEnd="20dp"
android:fontFamily="@font/zkgdh"
android:text="50%"
android:textColor="@color/topbj1"


Loading…
Cancel
Save