Browse Source

下单动态选择位置

上海闵中
liup 5 months ago
parent
commit
44821b586d
18 changed files with 640 additions and 73 deletions
  1. +16
    -3
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +5
    -4
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  3. +33
    -0
      app/src/main/java/com/bonait/bnframework/common/utils/ProcessValueUtil.java
  4. +3
    -2
      app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java
  5. +16
    -1
      app/src/main/java/com/bonait/bnframework/newui/adapter/OrderInfoAdapter.java
  6. +153
    -0
      app/src/main/java/com/bonait/bnframework/newui/dialog/FoodPosSetDialog.java
  7. +109
    -58
      app/src/main/java/com/bonait/bnframework/newui/fragment/HomeOrderFragment.java
  8. +149
    -0
      app/src/main/java/com/bonait/bnframework/newui/widget/FoodPosSetView.java
  9. +3
    -0
      app/src/main/java/com/bonait/bnframework/newui/widget/ProcessValueView.java
  10. +3
    -1
      app/src/main/java/com/bonait/bnframework/ui/adapter/step/StepAdapter.java
  11. +2
    -0
      app/src/main/java/com/bonait/bnframework/ui/fragment/setting/DeviceSetFragment.java
  12. +5
    -1
      app/src/main/java/com/bonait/bnframework/ui/fragment/setting/SceneSetFragment.java
  13. +1
    -1
      app/src/main/res/layout/dialog/layout/dialog_add_goods.xml
  14. +23
    -0
      app/src/main/res/layout/fragment_scene_set.xml
  15. +1
    -0
      app/src/main/res/layout/item/layout/view_process_value.xml
  16. +71
    -0
      app/src/main/res/layout/new/layout/dialog_food_pos_set.xml
  17. +12
    -2
      app/src/main/res/layout/new/layout/fragment_home_order.xml
  18. +35
    -0
      app/src/main/res/layout/new/layout/view_food_pos_set.xml

+ 16
- 3
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -1172,7 +1172,7 @@ public class ExecuteTheRecipe {
try {

int dangwei = 1;
int wendu = 1;
int wendu = 60;
int time = 0;

for (HashMap.Entry<String, String> entry : data.entrySet()) {
@@ -1200,14 +1200,25 @@ public class ExecuteTheRecipe {
break;
}
}else if (key.contains("烤箱温度")) {
wendu = Integer.parseInt(value.substring(0,1));
wendu = Integer.parseInt(value);
}
}
if(dangwei==0){
wendu = 0;//todo
}else {
if(wendu<60){
wendu = 60;
}else if(wendu>300){
wendu = 300;
}
}
ExecuteTheRecipe.WritePLC("档位选择", dangwei, null);
ExecuteTheRecipe.WritePLC("档位选择触发", true, null);
ThreadWhile2("模式旋钮在档位"+dangwei);
Thread.sleep(100);
ExecuteTheRecipe.WritePLC("温度选择", wendu, null);
ThreadWhile2("温度旋钮在档位"+wendu);
ExecuteTheRecipe.WritePLC("温度选择触发", true, null);
// ThreadWhile2("温度旋钮在档位"+wendu);

long startTime = System.currentTimeMillis();
while ((System.currentTimeMillis() - startTime) <= (time * 1000) && !IsForcedEnd2) {
@@ -1257,9 +1268,11 @@ public class ExecuteTheRecipe {
}

ExecuteTheRecipe.WritePLC("档位选择", 0, null);
ExecuteTheRecipe.WritePLC("档位选择触发", true, null);
ThreadWhile2("模式旋钮在档位"+0);
Thread.sleep(100);
ExecuteTheRecipe.WritePLC("温度选择", 0, null);
ExecuteTheRecipe.WritePLC("温度选择触发", true, null);
ThreadWhile2("温度旋钮在档位"+0);
final boolean[] IsComplete = {true};
long a = System.currentTimeMillis();


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

@@ -469,6 +469,7 @@ public class ConfigName {
public final static String storesName="storesName";
public final static String deviceLocationDetail="deviceLocationDetail";
public final static String storesNum="storesNum";
public final static String rootTip="rootTip";

/**
* 手动投料是否关闭火力
@@ -693,7 +694,7 @@ public class ConfigName {
*/
public List<ProcessT> Process_烤箱 = new ArrayList<ProcessT>() {{
add(new ProcessT("放入烤盘", Arrays.asList("烤盘位置")));
add(new ProcessT("烤箱设置", Arrays.asList("烤箱工作模式","烤箱温度", "等待时间")));
add(new ProcessT("烤箱设置", Arrays.asList("烤箱工作模式","烤箱温度(°C)", "等待时间")));
add(new ProcessT("取出烤盘", Arrays.asList("等待时间")));
}};

@@ -795,9 +796,9 @@ public class ConfigName {
case "烤箱工作模式":
data = "关闭、蒸、烤、蒸烤、其他";
break;
case "烤箱温度":
data = "0档0°C、1档50°C、2档100°C、3档150°C、4档200°C";
break;
// case "烤箱温度":
// data = "0档0°C、1档50°C、2档100°C、3档150°C、4档200°C";
// break;
}
return data;



+ 33
- 0
app/src/main/java/com/bonait/bnframework/common/utils/ProcessValueUtil.java View File

@@ -36,4 +36,37 @@ public class ProcessValueUtil {

return formulation;
}

public static String getProcessSms(String value){
StringBuilder stringBuilder = new StringBuilder();

if(!value.isEmpty()){
stringBuilder.append("(");
List<String> data = new ArrayList<>();
if (value.contains("|")) {
String[] res = value.split("[|]");
data.addAll(Arrays.asList(res));
} else {
data.add(value);
}
for (String item : data) {
if (item.contains(",")) {
String[] wl = item.split("[,]");
if (wl.length == 2) {
String name = wl[0];
String val = wl[1];
if(name.equals("等待时间")){
int time = Integer.parseInt(wl[1]);
val = time/60+"分"+time%60+"秒";
}else if(name.equals("烤箱温度")){
val = val+"°C";
}
stringBuilder.append(val);
}
}
}
stringBuilder.append(")");
}
return stringBuilder.toString();
}
}

+ 3
- 2
app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java View File

@@ -22,6 +22,7 @@ import com.bonait.bnframework.MainApplication;
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.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG;
import com.bonait.bnframework.common.db.mode.BPA_LOG_RECORD;
@@ -309,10 +310,10 @@ public class MainHActivity extends BaseActivity {
}
if(isFirst){
isFirst = false;
// if(!ConfigName.TEST){
if(PreferenceUtils.getBoolean(ConfigName.rootTip,true)){
RootTipDialog dialog = new RootTipDialog();
dialog.show(getSupportFragmentManager(),"开机自检");
// }
}
}
}



+ 16
- 1
app/src/main/java/com/bonait/bnframework/newui/adapter/OrderInfoAdapter.java View File

@@ -70,6 +70,21 @@ public abstract class OrderInfoAdapter extends BaseAdapter<BPA_ORDER_DETAIL,Orde
holder.binding.goodsName.setText(bean.goodsName+"");
holder.binding.groupName.setText(bean.groupName==null?"":bean.groupName);
holder.binding.contentBg.setSelected(mCurrentPosition == position);
holder.binding.cancel.setVisibility(View.VISIBLE);
if(bean.status == 0){
if(mCurrentPosition == position){
holder.binding.cancel.setVisibility(View.VISIBLE);
holder.binding.making.setVisibility(View.VISIBLE);
}else {
holder.binding.cancel.setVisibility(View.GONE);
holder.binding.making.setVisibility(View.GONE);
}
}else {
holder.binding.cancel.setVisibility(View.VISIBLE);
holder.binding.making.setVisibility(View.VISIBLE);
}


holder.binding.contentBg.setOnClickListener(v->{
mCurrentPosition = position;
notifyDataSetChanged();
@@ -81,7 +96,7 @@ public abstract class OrderInfoAdapter extends BaseAdapter<BPA_ORDER_DETAIL,Orde
holder.binding.making.setOnClickListener(v->{
onMakingClick(v,position);
});
holder.binding.cancel.setVisibility(View.VISIBLE);
switch (bean.status){
case 0:
holder.binding.making.setText("制作");


+ 153
- 0
app/src/main/java/com/bonait/bnframework/newui/dialog/FoodPosSetDialog.java View File

@@ -0,0 +1,153 @@
package com.bonait.bnframework.newui.dialog;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

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.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.db.mode.BPA_ORDER_DETAIL;
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil;
import com.bonait.bnframework.common.db.util.OrderDetailUtil;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.AdbCommandUtil;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.DialogFoodInfoBinding;
import com.bonait.bnframework.databinding.DialogFoodPosSetBinding;
import com.bonait.bnframework.newui.widget.FoodPosSetView;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

/**
* @author: liup
* @description: 配料位置设置
* @date: 2024/6/3 17:59.
*/
public class FoodPosSetDialog extends DialogFragment {
private String TAG = " FoodPosSetDialog =>";
private DialogFoodPosSetBinding viewBinding;
private String orderId = "";
private List<BPA_GOODS_PROCESS_DETAIL> data1 = new ArrayList<>();
private List<BPA_GOODS_PROCESS_DETAIL> data2 = new ArrayList<>();


@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NORMAL, R.style.DialogScale);
}

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
viewBinding = DialogFoodPosSetBinding.inflate(inflater, container, false);
DisplayManager.scaleViewGroup(viewBinding.getRoot());
return viewBinding.getRoot();
}
private void fullScreen(Window window){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。
// 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果
window.getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
} else {
// 全屏显示,隐藏状态栏
window.getDecorView().setSystemUiVisibility(View.INVISIBLE);
}
}
}
@Override
public void onStart() {
super.onStart();
setCancelable(false);
if (getDialog() != null) {
Window window = getDialog().getWindow();
assert window != null;
fullScreen(window);
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;
window.setAttributes(params);
}
AdbCommandUtil.hideStatusBar(true);
if (getArguments() != null) {
orderId = getArguments().getString("orderId");
}
initView();
}

private void initView(){
viewBinding.btnClose.setOnClickListener(view -> dismiss());
BPA_ORDER_DETAIL order = OrderDetailUtil.getById(orderId);
if(order==null){
dismiss();
return;
}
data1.clear();
data2.clear();
List<BPA_GOODS_PROCESS_DETAIL> details = GoodsProcessDetailDBUtil.getByGroupId(order.groupId);
for(BPA_GOODS_PROCESS_DETAIL detail:details){
if(detail.processname.equals("主料")||detail.processname.equals("放入烤盘")){
data1.add(detail);
}else if(detail.processname.equals("辅料")){
data2.add(detail);
}
}
updateView();
}

private void updateView(){
viewBinding.llContent1.removeAllViews();
viewBinding.llContent2.removeAllViews();

for (BPA_GOODS_PROCESS_DETAIL bean : data1){
FoodPosSetView view = new FoodPosSetView(viewBinding.llContent1.getContext(), null,bean);
viewBinding.llContent1.addView(view);
}
for (BPA_GOODS_PROCESS_DETAIL bean : data2){
FoodPosSetView view = new FoodPosSetView(viewBinding.llContent1.getContext(), null,bean);
viewBinding.llContent2.addView(view);
}
}

private MyClickListener listener;

public void setListener(MyClickListener listener) {
this.listener = listener;
}

@Override
public void dismiss() {
if(listener!=null){
listener.clickListener(null,null);
}
super.dismiss();
}

}

+ 109
- 58
app/src/main/java/com/bonait/bnframework/newui/fragment/HomeOrderFragment.java View File

@@ -19,8 +19,10 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.db.mode.BPA_ORDER_DETAIL;
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil;
import com.bonait.bnframework.common.db.util.OrderDetailUtil;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ProcessValueUtil;
import com.bonait.bnframework.databinding.DialogOrderBinding;
import com.bonait.bnframework.databinding.FragmentHomeOrderBinding;
import com.bonait.bnframework.event.FreshOrderEvent;
@@ -33,6 +35,7 @@ import com.bonait.bnframework.newui.activity.CookingHActivity;
import com.bonait.bnframework.newui.adapter.FoodInfoAdapter;
import com.bonait.bnframework.newui.adapter.OrderInfoAdapter;
import com.bonait.bnframework.newui.dialog.FoodInfoDialog;
import com.bonait.bnframework.newui.dialog.FoodPosSetDialog;
import com.bonait.bnframework.newui.widget.NewToastUtil;
import com.orhanobut.logger.Logger;

@@ -58,7 +61,10 @@ public class HomeOrderFragment extends BaseFragment {
private List<BPA_ORDER_DETAIL> orderChaoDetails;
private List<BPA_ORDER_DETAIL> orderKaoDetails;
private List<String> foodInfoList = new ArrayList<>();
private int type=0;//0炒菜 1烤箱
/**
* 0炒菜 1烤箱
*/
private int type=0;//
private BPA_ORDER_DETAIL orderDetail;


@@ -147,29 +153,6 @@ public class HomeOrderFragment extends BaseFragment {
viewBinding.recyclerInfo.setAdapter(orderAdapter1);
viewBinding.recyclerInfo2.setAdapter(orderAdapter2);

// viewBinding.tvChaocai.setSelected(true);
// viewBinding.tvKaoxiang.setSelected(false);
// viewBinding.tvChaocai.setOnClickListener(v->{
// viewBinding.tvChaocai.setSelected(true);
// viewBinding.tvKaoxiang.setSelected(false);
// type = 0;
// orderAdapter.setCurrentPosition(-1);
// orderAdapter.setNewData(orderChaoDetails);
// foodInfoList.clear();
// viewBinding.orderName.setText("");
// foodInfoAdapter.notifyDataSetChanged();
// });
// viewBinding.tvKaoxiang.setOnClickListener(v->{
// viewBinding.tvChaocai.setSelected(false);
// viewBinding.tvKaoxiang.setSelected(true);
// type = 1;
// orderAdapter.setCurrentPosition(-1);
// orderAdapter.setNewData(orderKaoDetails);
// foodInfoList.clear();
// viewBinding.orderName.setText("");
// foodInfoAdapter.notifyDataSetChanged();
// });

viewBinding.btnLocationInfo.setOnClickListener(v->{
if(ConfigName.getInstance().isFastClick()){
return;
@@ -185,8 +168,67 @@ public class HomeOrderFragment extends BaseFragment {
foodInfoDialog.show(getActivity().getSupportFragmentManager(),"配料信息");
}
});
viewBinding.btnFoodPosSet.setOnClickListener(v->{
if(ConfigName.getInstance().isFastClick()){
return;
}
if(foodInfoList.isEmpty()){
return;
}
FoodPosSetDialog foodInfoDialog = new FoodPosSetDialog();
Bundle bundle = new Bundle();
bundle.putString("orderId",orderDetail.id);
foodInfoDialog.setArguments(bundle);
if(getActivity()!=null){
foodInfoDialog.show(getActivity().getSupportFragmentManager(),"修改配料位置");
foodInfoDialog.setListener(new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
if (type == 0){
orderChaoDetails.clear();
orderChaoDetails.addAll(OrderDetailUtil.getAllByType(0));
orderAdapter1.notifyDataSetChanged();
if(orderAdapter1.getCurrentPosition()>=0){
orderClick(orderAdapter1.getData().get(orderAdapter1.getCurrentPosition()));
}
}else {
orderKaoDetails.clear();
orderKaoDetails.addAll(OrderDetailUtil.getAllByType(1));
orderAdapter2.notifyDataSetChanged();
if(orderAdapter2.getCurrentPosition()>=0){
orderClick(orderAdapter2.getData().get(orderAdapter2.getCurrentPosition()));
}
}
}

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

}
});
}
});
changeRightBtn();
}

/**
* 隐藏 显示右边位置按钮
*/
private void changeRightBtn(){
if(foodInfoList.isEmpty()){
viewBinding.btnLocationInfo.setVisibility(View.GONE);
viewBinding.btnFoodPosSet.setVisibility(View.GONE);
}else {
viewBinding.btnLocationInfo.setVisibility(View.VISIBLE);
viewBinding.btnFoodPosSet.setVisibility(View.VISIBLE);
}
}

/**
* 制作订单
* @param mData
* @param position
*/
private void orderMaking(List<BPA_ORDER_DETAIL> mData,int position){
if(ConfigName.getInstance().isFastClick()){
return;
@@ -252,40 +294,42 @@ public class HomeOrderFragment extends BaseFragment {
foodInfoList.clear();
List<BPA_GOODS_PROCESS_DETAIL> details = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId);
for(BPA_GOODS_PROCESS_DETAIL detail:details){
if(type==0){
if(detail.processname.equals("主料")||detail.processname.equals("辅料")){
if(!detail.processvalue.isEmpty()){
List<String> data = new ArrayList<>();
if (detail.processvalue.contains("|")) {
String[] res = detail.processvalue.split("[|]");
data.addAll(Arrays.asList(res));
} else {
data.add(detail.processvalue);
}
String foodName = "";
String foodPos = "";
for (String item : data) {
if (item.contains(",")) {
String[] wl = item.split("[,]");
if (wl.length == 2) {
String name = wl[0];
String val = wl[1];
if(name.equals("主料名称")||name.equals("辅料名称")||name.equals("烤菜名称")){
foodName = val;
}else if(name.equals("主料位置")||name.equals("辅料位置")||name.equals("菜盘位置")){
foodPos = val;
}
}
}
}
foodInfoList.add(detail.processname+foodPos+":"+foodName);
}
}
}else {
foodInfoList.add(detail.processname+":"+detail.processvalue);
}
// if(type==0){
// if(detail.processname.equals("主料")||detail.processname.equals("辅料")){
// if(!detail.processvalue.isEmpty()){
// List<String> data = new ArrayList<>();
// if (detail.processvalue.contains("|")) {
// String[] res = detail.processvalue.split("[|]");
// data.addAll(Arrays.asList(res));
// } else {
// data.add(detail.processvalue);
// }
// String foodName = "";
// String foodPos = "";
// for (String item : data) {
// if (item.contains(",")) {
// String[] wl = item.split("[,]");
// if (wl.length == 2) {
// String name = wl[0];
// String val = wl[1];
// if(name.equals("主料名称")||name.equals("辅料名称")||name.equals("烤菜名称")){
// foodName = val;
// }else if(name.equals("主料位置")||name.equals("辅料位置")||name.equals("菜盘位置")){
// foodPos = val;
// }
// }
// }
// }
// foodInfoList.add(detail.processname+foodPos+":"+foodName);
// }
// }
// }else {
// foodInfoList.add(detail.processname+":"+detail.processvalue);
// }
foodInfoList.add(detail.processname+":"+ ProcessValueUtil.getProcessSms(detail.processvalue));
}
foodInfoAdapter.notifyDataSetChanged();
changeRightBtn();
}

private void updateOrderStatus(int type,int value){
@@ -309,7 +353,7 @@ public class HomeOrderFragment extends BaseFragment {
}

/**
* 取消订单
* 取消订单弹窗
* @param status
* @param goodsName
* @param position
@@ -371,7 +415,10 @@ public class HomeOrderFragment extends BaseFragment {
});
});
}

/**
* 制作订单弹窗
*
**/
private void makingOrderDialog(BPA_ORDER_DETAIL orderDetail,int status,String name,String error,int position){

AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_order, (layoutView, xCom) -> {
@@ -442,6 +489,7 @@ public class HomeOrderFragment extends BaseFragment {
orderAdapter1.setCurrentPosition(-1);
foodInfoList.clear();
foodInfoAdapter.notifyDataSetChanged();
changeRightBtn();
}
OrderDetailUtil.deleteById(orderChaoDetails.get(position).id);
orderChaoDetails.remove(position);
@@ -450,6 +498,7 @@ public class HomeOrderFragment extends BaseFragment {
if(position == orderAdapter2.getCurrentPosition()){
orderAdapter2.setCurrentPosition(-1);
foodInfoList.clear();
changeRightBtn();
foodInfoAdapter.notifyDataSetChanged();
}
OrderDetailUtil.deleteById(orderKaoDetails.get(position).id);
@@ -716,6 +765,7 @@ public class HomeOrderFragment extends BaseFragment {
orderAdapter1.setCurrentPosition(-1);
orderAdapter1.notifyDataSetChanged();
foodInfoList.clear();
changeRightBtn();
viewBinding.orderName.setText("");
foodInfoAdapter.notifyDataSetChanged();
}
@@ -723,6 +773,7 @@ public class HomeOrderFragment extends BaseFragment {
orderAdapter2.setCurrentPosition(-1);
orderAdapter2.notifyDataSetChanged();
foodInfoList.clear();
changeRightBtn();
viewBinding.orderName.setText("");
foodInfoAdapter.notifyDataSetChanged();
}


+ 149
- 0
app/src/main/java/com/bonait/bnframework/newui/widget/FoodPosSetView.java View File

@@ -0,0 +1,149 @@
package com.bonait.bnframework.newui.widget;

import android.content.Context;
import android.text.InputType;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ViewFoodPosSetBinding;
import com.bonait.bnframework.databinding.ViewProcessValueBinding;
import com.bonait.bnframework.ui.widget.item_gx;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import butterknife.ButterKnife;

/**
* @author: liup
* @description:
* @date: 2024/5/16 17:53.
*/
public class FoodPosSetView extends FrameLayout {

private ViewFoodPosSetBinding viewBinding;
private BPA_GOODS_PROCESS_DETAIL detail;

public FoodPosSetView(Context context, AttributeSet attrs, BPA_GOODS_PROCESS_DETAIL detail) {
super(context, attrs);
View root= LayoutInflater.from(context).inflate(R.layout.view_food_pos_set, this);
viewBinding = ViewFoodPosSetBinding.bind(root);
DisplayManager.scaleViewGroup(viewBinding.getRoot());
this.detail = detail;
init();
}

private void init(){
if(detail!=null){
if(detail.processname!=null){
if(detail.processname.equals("主料")){
List<String> list = new ArrayList<>();
list.add("Z1");
list.add("Z2");
list.add("Z3");
list.add("Z4");
list.add("Z5");
list.add("Z6");
String value = detail.processvalue;
String[] res = value.split("\\|");
for (String s:res){
if(s.contains("主料名称")){
String[] res2 = s.split(",");
viewBinding.name.setText(res2[1]);
}else if(s.contains("主料位置")){
String[] res2 = s.split(",");
String posInfo = s;
int index = Integer.parseInt(res2[1].replace("Z",""));
ArrayAdapter<String> adapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item,list);
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinner.setAdapter(adapter2);
viewBinding.spinner.setSelection(index-1);
viewBinding.spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
detail.processvalue = detail.processvalue.replace(posInfo,"主料位置,"+viewBinding.spinner.getSelectedItem().toString());
detail.processms = detail.processms.replace(res2[1],viewBinding.spinner.getSelectedItem().toString());
GoodsProcessDetailDBUtil.update(detail);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
}
}else if(detail.processname.equals("放入烤盘")){
viewBinding.name.setText("烤盘位置");
String value = detail.processvalue;
String[] res = value.split(",");
int index = Integer.parseInt(res[1].replace("K",""));
List<String> list = new ArrayList<>();
list.add("K1");
list.add("K2");
ArrayAdapter<String> adapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item,list);
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinner.setAdapter(adapter2);
viewBinding.spinner.setSelection(index-1);
viewBinding.spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
detail.processvalue = "烤盘位置,"+viewBinding.spinner.getSelectedItem().toString();
detail.processms = detail.processms.replace(res[1],viewBinding.spinner.getSelectedItem().toString());
GoodsProcessDetailDBUtil.update(detail);
}

@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}else if(detail.processname.equals("辅料")){
List<String> list = new ArrayList<>();
list.add("F1");
list.add("F2");
list.add("F3");
list.add("F4");
list.add("F5");
list.add("F6");
String value = detail.processvalue;
String[] res = value.split("\\|");
for (String s:res){
if(s.contains("辅料名称")){
String[] res2 = s.split(",");
viewBinding.name.setText(res2[1]);
}else if(s.contains("辅料位置")){
String[] res2 = s.split(",");
String posInfo = s;
int index = Integer.parseInt(res2[1].replace("F",""));
ArrayAdapter<String> adapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item,list);
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinner.setAdapter(adapter2);
viewBinding.spinner.setSelection(index-1);
viewBinding.spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
detail.processvalue = detail.processvalue.replace(posInfo,"辅料位置,"+viewBinding.spinner.getSelectedItem().toString());
detail.processms = detail.processms.replace(res2[1],viewBinding.spinner.getSelectedItem().toString());
GoodsProcessDetailDBUtil.update(detail);
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
}
}
}
}
}
}
}

+ 3
- 0
app/src/main/java/com/bonait/bnframework/newui/widget/ProcessValueView.java View File

@@ -57,6 +57,9 @@ public class ProcessValueView extends RelativeLayout {
public void Init()
{
viewBinding.name.setText(model.name.trim());
if(model.name.contains("烤箱温度")){
viewBinding.edit.setHint("温度范围:60-300");
}
if(model.IsCookTime){
viewBinding.check.setVisibility(View.GONE);
viewBinding.spinner.setVisibility(View.GONE);


+ 3
- 1
app/src/main/java/com/bonait/bnframework/ui/adapter/step/StepAdapter.java View File

@@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bonait.bnframework.common.base.BaseAdapter;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ProcessValueUtil;
import com.bonait.bnframework.databinding.ItemStepDescBinding;

/**
@@ -33,7 +34,8 @@ public class StepAdapter extends BaseAdapter<BPA_GOODS_PROCESS_DETAIL, StepAdapt
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
holder.binding.root.setSelected(mCurrentPosition == position);
String name = mData.get(position).processms;//mData.get(position).processname +" "+
// String name = mData.get(position).processms;//mData.get(position).processname +" "+
String name = mData.get(position).processname+ProcessValueUtil.getProcessSms(mData.get(position).processvalue);//mData.get(position).processname +" "+
holder.binding.name.setText((position+1)+"."+name);

holder.binding.root.setOnClickListener(new View.OnClickListener() {


+ 2
- 0
app/src/main/java/com/bonait/bnframework/ui/fragment/setting/DeviceSetFragment.java View File

@@ -13,6 +13,7 @@ import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.databinding.FragmentSystemDeviceBinding;
import com.bonait.bnframework.newui.widget.NewToastUtil;

/**
* @author: liup
@@ -54,6 +55,7 @@ public class DeviceSetFragment extends BaseFragment {
PreferenceUtils.setString(ConfigName.deviceLocationDetail,viewBinding.editDeviceLocationDetail.getText().toString());
PreferenceUtils.setString(ConfigName.storesNum,viewBinding.editStoresNum.getText().toString());

NewToastUtil.getInstance().showToast("保存成功");
});
}



+ 5
- 1
app/src/main/java/com/bonait/bnframework/ui/fragment/setting/SceneSetFragment.java View File

@@ -12,8 +12,10 @@ import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.databinding.FragmentSceneSetBinding;
import com.bonait.bnframework.newui.widget.NewToastUtil;

import java.util.ArrayList;
import java.util.List;
@@ -53,12 +55,14 @@ public class SceneSetFragment extends BaseFragment {
}
viewBinding.editShopNumber.setText(PreferenceUtils.getString(ConfigName.shopNumber,""));
viewBinding.editDeviceNumber.setText(PreferenceUtils.getString(ConfigName.deviceNumber,""));
viewBinding.zijianSwitch.setChecked(PreferenceUtils.getBoolean(ConfigName.rootTip,true));

viewBinding.btnSave.setOnClickListener(v->{
PreferenceUtils.setString(ConfigName.environment,viewBinding.spinnerEnvironment.getSelectedItem().toString());
PreferenceUtils.setString(ConfigName.shopNumber,viewBinding.editShopNumber.getText().toString());
PreferenceUtils.setString(ConfigName.deviceNumber,viewBinding.editDeviceNumber.getText().toString());

PreferenceUtils.setBoolean(ConfigName.rootTip,viewBinding.zijianSwitch.isChecked());
NewToastUtil.getInstance().showToast("保存成功");
});
}



+ 1
- 1
app/src/main/res/layout/dialog/layout/dialog_add_goods.xml View File

@@ -20,7 +20,7 @@
<!--名称 图片选择-->
<include
android:id="@+id/layout_name"
android:layout_width="@dimen/dp_660"
android:layout_width="@dimen/dp_900"
android:layout_height="@dimen/dp_500"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"


+ 23
- 0
app/src/main/res/layout/fragment_scene_set.xml View File

@@ -95,6 +95,29 @@

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_marginBottom="40dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="250dp"
android:layout_height="70dp"
android:textColor="@color/black"
android:textSize="32sp"
android:text="开机自检弹窗:"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
/>

<com.suke.widget.SwitchButton
android:id="@+id/zijian_switch"
android:layout_width="200dp"
android:layout_height="@dimen/dp_70"
android:layout_centerVertical="true" />

</LinearLayout>

<Button
android:id="@+id/btn_save"
android:layout_width="match_parent"


+ 1
- 0
app/src/main/res/layout/item/layout/view_process_value.xml View File

@@ -45,6 +45,7 @@
android:layout_height="@dimen/dp_90"
android:background="@drawable/input_bj"
android:layout_alignParentRight="true"
android:textColorHint="@color/color3"
android:inputType="text"
android:maxLines="1"
android:paddingStart="10dp"


+ 71
- 0
app/src/main/res/layout/new/layout/dialog_food_pos_set.xml View File

@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_gravity="center"
android:gravity="center"
android:background="@color/transparent"
android:layout_height="wrap_content">

<RelativeLayout
android:layout_width="1400dp"
android:background="@drawable/bg_round25_white"
android:layout_height="wrap_content">

<TextView
android:id="@+id/title1"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:background="@drawable/bg_round25_top_yellow"
style="@style/TextView_btn_dialog"
android:text="菜料位置设置"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
/>

<ImageView
android:id="@+id/btn_close"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
style="@style/TextView_btn_dialog"
android:layout_marginEnd="20dp"
android:layout_alignParentEnd="true"
android:background="@mipmap/ic_clear_white_48dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
<LinearLayout
android:id="@+id/ll_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/ll_content1"
android:layout_width="500dp"
android:orientation="vertical"
android:layout_marginTop="130dp"
android:layout_marginBottom="50dp"
android:layout_marginStart="100dp"
tools:layout_height="130dp"
android:layout_height="wrap_content">

</LinearLayout>

<LinearLayout
android:id="@+id/ll_content2"
android:layout_width="500dp"
android:orientation="vertical"
android:layout_marginTop="130dp"
android:layout_marginBottom="50dp"
android:layout_marginEnd="100dp"
android:layout_alignParentEnd="true"
tools:layout_height="230dp"
android:layout_height="wrap_content">

</LinearLayout>
</LinearLayout>

</RelativeLayout>

</LinearLayout>

+ 12
- 2
app/src/main/res/layout/new/layout/fragment_home_order.xml View File

@@ -113,16 +113,26 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:orientation="vertical"
/>
<TextView
android:id="@+id/btn_food_pos_set"
android:layout_width="280dp"
android:layout_height="80dp"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal|bottom"
style="@style/TextView_btn_blue"
android:text="修改配菜位置"
/>
<TextView
android:id="@+id/btn_location_info"
android:layout_width="250dp"
android:layout_width="280dp"
android:layout_height="80dp"
android:layout_marginTop="10dp"
android:layout_gravity="center_horizontal|bottom"
style="@style/TextView_btn_blue"
android:text="位置详情"
android:text="确认配菜位置"
android:layout_marginBottom="10dp"
/>

</LinearLayout>

</FrameLayout>


+ 35
- 0
app/src/main/res/layout/new/layout/view_food_pos_set.xml View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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="@dimen/dp_500"
android:layout_height="@dimen/dp_130"
android:paddingBottom="20dp"
android:id="@+id/root"
android:paddingTop="20dp"
>

<TextView
android:id="@+id/name"
android:paddingStart="@dimen/dp_5"
android:paddingEnd="@dimen/dp_10"
android:layout_width="@dimen/dp_300"
android:layout_height="match_parent"
tools:text="液体料液体料液体料"
android:textSize="@dimen/sp_36"
android:maxLines="1"
android:maxLength="10"
android:gravity="center_vertical|end"
android:ellipsize="end"
android:textColor="@color/black"
/>
<Spinner
android:id="@+id/spinner"
style="@style/commonSpinnerStyle"
android:layout_width="@dimen/dp_200"
android:layout_height="match_parent"
android:layout_gravity="end"
android:paddingStart="10dp"
/>

</FrameLayout>

Loading…
Cancel
Save