Explorar el Código

新分支第二次更新

调味吧台(白底)
fyf hace 1 año
padre
commit
d640eebf6a
Se han modificado 15 ficheros con 613 adiciones y 192 borrados
  1. +99
    -37
      app/src/main/java/com/example/bpa/MainActivity.java
  2. +4
    -1
      app/src/main/java/com/example/bpa/Model/SuOrderA.java
  3. +62
    -1
      app/src/main/java/com/example/bpa/config/DataBus.java
  4. +22
    -0
      app/src/main/java/com/example/bpa/db/QueryDB.java
  5. +2
    -0
      app/src/main/java/com/example/bpa/db/mode/BPA_GOODS.java
  6. +4
    -0
      app/src/main/java/com/example/bpa/db/mode/BPA_SUBORDER.java
  7. +5
    -5
      app/src/main/java/com/example/bpa/service/BusinessServer.java
  8. +19
    -19
      app/src/main/java/com/example/bpa/view/adapter/maingoods_adapter.java
  9. +87
    -26
      app/src/main/java/com/example/bpa/view/adapter/order_adapter.java
  10. +187
    -0
      app/src/main/java/com/example/bpa/view/adapter/pflc_adapter.java
  11. +4
    -0
      app/src/main/java/com/example/bpa/view/mode/ResGoodsRecipe.java
  12. +17
    -14
      app/src/main/res/layout/activity_main.xml
  13. +69
    -89
      app/src/main/res/layout/item/layout/order_item.xml
  14. +32
    -0
      app/src/main/res/layout/item/layout/pllc_item.xml
  15. BIN
     

+ 99
- 37
app/src/main/java/com/example/bpa/MainActivity.java Ver fichero

@@ -23,9 +23,14 @@ import androidx.recyclerview.widget.RecyclerView;

import com.example.bpa.Model.OrderA;
import com.example.bpa.Model.ReceiveOrder;
import com.example.bpa.Model.SuOrderA;
import com.example.bpa.app.Main;
import com.example.bpa.config.ConfigName;
import com.example.bpa.config.DataBus;
import com.example.bpa.config.MessageName;
import com.example.bpa.db.QueryDB;
import com.example.bpa.db.mode.BPA_ORDER;
import com.example.bpa.db.mode.BPA_SUBORDER;
import com.example.bpa.helper.Json;
import com.example.bpa.helper.MQTT;
import com.example.bpa.helper.ModbusTcpHelper;
@@ -44,6 +49,9 @@ import com.example.bpa.view.fragment.HomeFragment;
import com.example.bpa.view.fragment.SsjkFragment;
import com.example.bpa.view.fragment.SystemCapabilitiesFragment;
import com.example.bpa.view.fragment.SystemSetFragment;
import com.example.bpa.view.mode.MakeStatus;
import com.example.bpa.view.mode.ResGoodsMake;
import com.example.bpa.view.mode.ResGoodsRecipe;

import java.util.ArrayList;
import java.util.List;
@@ -175,7 +183,8 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen
ShowFragment(systemSetFragment, "系统设置");
break;
case R.id.SystemHelp://系统帮助按钮
ShowFragment(heplerFragment, "系统帮助");
Main.getInstance().GetOrder("");
//ShowFragment(heplerFragment, "系统帮助");
break;
case R.id.HomeMain://主页
ShowFragment(homeFragment, "系统主页");
@@ -237,50 +246,103 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen
ab.show();
}

AlertDialog alg = null;

/**
* 显示订单窗口
*
* @param order
*/
public void showOrderDialog(OrderA order)
{
DataBus.getInstance().OrderSM=order;
final AlertDialog alg = new AlertDialog.Builder(MainActivity.this).create();
alg.show();
Window win = alg.getWindow();
win.setContentView(R.layout.order_dialog);

WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay(); //为获取屏幕宽、高

android.view.WindowManager.LayoutParams p = win.getAttributes(); //获取对话框当前的参数值
p.height = (int) (d.getHeight() * 1); //高度设置为屏幕的0.3
p.width = (int) (d.getWidth() * 1); //宽度设置为屏幕的0.5
win.setAttributes(p); //设置生效





ImageView gongneng_fanhui= win.findViewById(R.id.gongneng_fanhui);
TextView gongneng_title= win.findViewById(R.id.gongneng_title);
RecyclerView Order=win.findViewById(R.id.Order);
gongneng_title.setText("扫码订单详情");


Order.setLayoutManager(new WrapContentLinearLayoutManager(win.getContext(), LinearLayoutManager.HORIZONTAL,false));
order_adapter adapter = new order_adapter(win.getContext());
Order.setAdapter(adapter);

public void showOrderDialog(OrderA order) {
try {
if (order.orderDetail == null || order.orderDetail.size() <= 0) {
T.show(MainActivity.this, "子订单不能为空!");
return;
}

gongneng_fanhui.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alg.dismiss();
if (!QueryDB.GetOrderIs(order.id)) {
BPA_ORDER order1 = new BPA_ORDER();
order1.thirdPartyID = "扫码下单";
order1.status = 0;
order1.deviceID = ConfigName.getInstance().DeviceId;
order1.userID = ConfigName.getInstance().user.userID;
order1.id = order.id;
QueryDB.AddOrder(order1);
for (SuOrderA item : order.orderDetail)//新增子订单
{
BPA_SUBORDER suborder = new BPA_SUBORDER();
suborder.deviceID = ConfigName.getInstance().DeviceId;
suborder.userID = ConfigName.getInstance().user.userID;
suborder.orderID = item.orderInfo_Id;
suborder.goodsID = "2f064965-8d63-4b00-9d14-c8d118791898";//item.goods_Id;
suborder.number = 1;
suborder.status = 0;
suborder.goodImg = item.goodImg;
suborder.originalMoney = item.originalMoney;
suborder.realMoney = item.realMoney;
QueryDB.AddSubOrder(suborder);
}
}
});

//初始化数据
DataBus.getInstance().OrderSM = order;
ArrayList<BPA_SUBORDER> sub = QueryDB.GetSubOrderList(order.id);
DataBus.getInstance().GoodsSMMake.clear();
for (BPA_SUBORDER k : sub) {
ResGoodsMake make = new ResGoodsMake();
make.recipes = QueryDB.GetGoodsSrecipeList(k.goodsID);
make.good = QueryDB.GetGoodsId(k.goodsID);
make.subOrder = k;

make.makeMs = "";
make.makeProcess = 0;
if (k.status == 0) {
make.makeStatus = MakeStatus.等待制作;
} else if (k.status == 1) {
make.makeStatus = MakeStatus.制作中;
} else {
make.makeStatus = MakeStatus.制作完成;
make.makeMs = "";
make.makeProcess = 100;
for (ResGoodsRecipe recipe : make.recipes) {
recipe.makeProcess = 100;
}
}
DataBus.getInstance().GoodsSMMake.add(make);
}

if (alg == null) {
alg = new AlertDialog.Builder(MainActivity.this).create();
}
if (!alg.isShowing())
alg.show();
Window win = alg.getWindow();
win.setContentView(R.layout.order_dialog);

WindowManager m = getWindowManager();
Display d = m.getDefaultDisplay(); //为获取屏幕宽、高

android.view.WindowManager.LayoutParams p = win.getAttributes(); //获取对话框当前的参数值
p.height = (int) (d.getHeight() * 1); //高度设置为屏幕的0.3
p.width = (int) (d.getWidth() * 1); //宽度设置为屏幕的0.5
win.setAttributes(p); //设置生效

ImageView gongneng_fanhui = win.findViewById(R.id.gongneng_fanhui);
TextView gongneng_title = win.findViewById(R.id.gongneng_title);
RecyclerView Order = win.findViewById(R.id.Order);
gongneng_title.setText("扫码订单详情");

Order.setLayoutManager(new WrapContentLinearLayoutManager(win.getContext(), LinearLayoutManager.HORIZONTAL, false));
DataBus.getInstance().orderadapter = new order_adapter(win.getContext());
Order.setAdapter(DataBus.getInstance().orderadapter);
gongneng_fanhui.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
alg.dismiss();
}
});
//初始化数据
} catch (Exception ex) {
}
}
//endregion



+ 4
- 1
app/src/main/java/com/example/bpa/Model/SuOrderA.java Ver fichero

@@ -1,5 +1,9 @@
package com.example.bpa.Model;

import com.example.bpa.view.mode.ResGoodsRecipe;

import java.util.ArrayList;

public class SuOrderA {
public String id;//di
public String beginCookTime;//开始制作时间
@@ -18,5 +22,4 @@ public class SuOrderA {
public int isVaild;//
public String consumeUnit;//单位
public String remark;//备注

}

+ 62
- 1
app/src/main/java/com/example/bpa/config/DataBus.java Ver fichero

@@ -13,6 +13,7 @@ import com.example.bpa.db.mode.BPA_GOODS;
import com.example.bpa.db.mode.BPA_LOG;
import com.example.bpa.db.mode.BPA_SILOS;
import com.example.bpa.view.adapter.makegood_adapter;
import com.example.bpa.view.adapter.order_adapter;
import com.example.bpa.view.mode.MakeStatus;
import com.example.bpa.view.mode.ResGoodsMake;
import com.example.bpa.view.mode.ResGoodsRecipe;
@@ -59,6 +60,14 @@ public class DataBus {
//endregion

//region 数据中心
/**
* 商品扫码等待制作列表
*/
public List<ResGoodsMake> GoodsSMMake = new ArrayList<ResGoodsMake>();
/**
* 扫码商品订单制作
*/
public order_adapter orderadapter;
/**
* 商品制作列表
*/
@@ -130,6 +139,18 @@ public class DataBus {
make.makeProcess=0;
GoodsMake.add(make);
goodmakeadapter.refresh();

for (ResGoodsMake item:GoodsSMMake)
{
if(item.subOrder.id.equals(suborder.id))
{
item.makeStatus=MakeStatus.等待制作;
item.makeMs="";
item.makeProcess=0;
orderadapter.refresh();
}
}

}catch(Exception e){
}
}
@@ -140,7 +161,7 @@ public class DataBus {
* @param makeMs
* @param count
*/
public void UpdateGoodsMake(String suborderID,String makeMs,int count)
public void UpdateGoodsMake(String suborderID,String makeMs,int count,int key,Boolean bz)
{
try
{
@@ -154,10 +175,38 @@ public class DataBus {
QueryDB.UpdateSubOrder(GoodsMake.get(m).subOrder);
}

//
for (ResGoodsMake item:GoodsSMMake)
{
if(item.subOrder.id.equals(GoodsMake.get(m).subOrder.id))
{
item.makeStatus= MakeStatus.制作中;
item.makeMs=makeMs;
item.makeProcess=(count/ GoodsMake.get(m).recipes.size())*100;

for (ResGoodsRecipe recipe: item.recipes)
{
if(recipe.sort==key)
{
if(bz==false)
{
recipe.makeProcess=20;
}else
{
recipe.makeProcess=100;
}
}
}
orderadapter.refresh();

}
}

GoodsMake.get(m).makeStatus= MakeStatus.制作中;
GoodsMake.get(m).makeMs=makeMs;
GoodsMake.get(m).makeProcess=(count/ GoodsMake.get(m).recipes.size())*100;
goodmakeadapter.refresh();

return;
}
}
@@ -183,8 +232,20 @@ public class DataBus {
QueryDB.UpdateSubOrder(item.subOrder);
good=item;
}
}

for (ResGoodsMake item:GoodsSMMake)
{
if(item.subOrder.id.equals(suborderID))
{
item.makeStatus=MakeStatus.制作完成;
item.makeMs="";
item.makeProcess=100;
item.subOrder.status=2;
}
orderadapter.refresh();
}

if(good!=null)
{
//GoodsMakeOver.add(good);


+ 22
- 0
app/src/main/java/com/example/bpa/db/QueryDB.java Ver fichero

@@ -820,6 +820,24 @@ public class QueryDB {
}
return data;
}

/**
* 判断订单是否存在在
* @param id
* @return
*/
public static boolean GetOrderIs(String id) {
boolean isSucess = false;
String orderby = Desc_Time_Up;//出料顺序
String where = "isDelete=? and id=?";
String[] args = new String[]{"0", id};
ArrayList<BPA_ORDER> data = new ArrayList<>();
ArrayList<Object> obj = Get(BPA_ORDER.class, where, args, orderby);
for (Object k : obj) {
data.add((BPA_ORDER) k);
}
return data.size() > 0;
}
//endregion

//region BPA_SUBORDER 订单子表
@@ -1861,6 +1879,7 @@ public class QueryDB {
((BPA_GOODS) data).name = cursor.getString((int) cursor.getColumnIndex("name"));
((BPA_GOODS) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort"));
((BPA_GOODS) data).status = cursor.getInt((int) cursor.getColumnIndex("status"));
((BPA_GOODS) data).url = cursor.getString((int) cursor.getColumnIndex("url"));
break;
case "BPA_GOODSRECIPE":
data = new BPA_GOODSRECIPE();
@@ -1884,6 +1903,9 @@ public class QueryDB {
((BPA_SUBORDER) data).goodsID = cursor.getString((int) cursor.getColumnIndex("goodsID"));
((BPA_SUBORDER) data).number = cursor.getInt((int) cursor.getColumnIndex("number"));
((BPA_SUBORDER) data).status = cursor.getInt((int) cursor.getColumnIndex("status"));
((BPA_SUBORDER) data).goodImg = cursor.getString((int) cursor.getColumnIndex("goodImg"));
((BPA_SUBORDER) data).originalMoney = cursor.getDouble((int) cursor.getColumnIndex("originalMoney"));
((BPA_SUBORDER) data).realMoney = cursor.getDouble((int) cursor.getColumnIndex("realMoney"));
break;
case "BPA_ALERTLOG":
data = new BPA_ALERTLOG();


+ 2
- 0
app/src/main/java/com/example/bpa/db/mode/BPA_GOODS.java Ver fichero

@@ -7,6 +7,8 @@ package com.example.bpa.db.mode;
public class BPA_GOODS extends ModeBase {
//商品名称
public String name;
//商品Url
public String url;
//排序
public int sort;
//状态:0 禁用 1 启用


+ 4
- 0
app/src/main/java/com/example/bpa/db/mode/BPA_SUBORDER.java Ver fichero

@@ -13,4 +13,8 @@ public class BPA_SUBORDER extends ModeBase{
public int number;
//状态:0 未开始 1 制作中 2 已制作 3 已超时
public int status;
//商品图片
public String goodImg;
public double originalMoney;//原价
public double realMoney;//实际金额
}

+ 5
- 5
app/src/main/java/com/example/bpa/service/BusinessServer.java Ver fichero

@@ -40,7 +40,7 @@ public class BusinessServer {
/**
* 商品制作队列
*/
ConcurrentLinkedQueue<BPA_SUBORDER> Commoditys = new ConcurrentLinkedQueue<BPA_SUBORDER>();
public ConcurrentLinkedQueue<BPA_SUBORDER> Commoditys = new ConcurrentLinkedQueue<BPA_SUBORDER>();

/**
* 增加一个子订单
@@ -101,7 +101,7 @@ public class BusinessServer {
for (ResGoodsRecipe item : goodsRecipes) {
RecipesNames += item.materialName + ",";
}
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】准备下发物料:" + RecipesNames, count);
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】准备下发物料:" + RecipesNames, count,key,false);
ArrayList<Integer> liaochang = new ArrayList<Integer>();
for (int m = 0; m < goodsRecipes.size(); m++) {
ResGoodsRecipe recipe = goodsRecipes.get(m);
@@ -183,7 +183,7 @@ public class BusinessServer {
}
//更新缓存商品制作列表状态
count += goodsRecipes.size();
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】:" + RecipesNames + "-配料完成!", count);
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】:" + RecipesNames + "-配料完成!", count,key,true);
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "[" + good.name + "]步骤【" + key + "】下发" + RecipesNames + "执行完成!");
}
//endregion
@@ -248,7 +248,7 @@ public class BusinessServer {
for (ResGoodsRecipe item : goodsRecipes) {
RecipesNames += item.materialName + ",";
}
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】准备下发物料:" + RecipesNames, count);
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】准备下发物料:" + RecipesNames, count,key,false);
for (int m = 0; m < goodsRecipes.size(); m++) {
ResGoodsRecipe recipe = goodsRecipes.get(m);
int materialType = recipe.materialType;
@@ -314,7 +314,7 @@ public class BusinessServer {
// }
//更新缓存商品制作列表状态
count += goodsRecipes.size();
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】:" + RecipesNames + "-配料完成!", count);
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】:" + RecipesNames + "-配料完成!", count,key,true);
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "[" + good.name + "]步骤【" + key + "】下发" + RecipesNames + "执行完成!");
}
//endregion


+ 19
- 19
app/src/main/java/com/example/bpa/view/adapter/maingoods_adapter.java Ver fichero

@@ -120,25 +120,25 @@ public class maingoods_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol
// return;
// }
// }
Main.getInstance().GetOrder("");
// BPA_ORDER order=new BPA_ORDER();
// order.thirdPartyID="手动下单";
// order.status=0;
// order.deviceID = ConfigName.getInstance().DeviceId;
// order.userID = ConfigName.getInstance().user.userID;
// QueryDB.AddOrder(order);
//
// BPA_SUBORDER suborder=new BPA_SUBORDER();
// suborder.deviceID = ConfigName.getInstance().DeviceId;
// suborder.userID = ConfigName.getInstance().user.userID;
// suborder.orderID = order.id;
// suborder.goodsID = id;
// suborder.number = 1;
// suborder.status=0;
// QueryDB.AddSubOrder(suborder);
// BusinessServer.Get().AddCommodity(suborder);
// T.show(view.getContext(),"开始制作商品:"+goodname.getText().toString());
BPA_ORDER order=new BPA_ORDER();
order.thirdPartyID="手动下单";
order.status=0;
order.deviceID = ConfigName.getInstance().DeviceId;
order.userID = ConfigName.getInstance().user.userID;
QueryDB.AddOrder(order);
BPA_SUBORDER suborder=new BPA_SUBORDER();
suborder.deviceID = ConfigName.getInstance().DeviceId;
suborder.userID = ConfigName.getInstance().user.userID;
suborder.orderID = order.id;
suborder.goodsID = id;
suborder.number = 1;
suborder.status=0;
QueryDB.AddSubOrder(suborder);
BusinessServer.Get().AddCommodity(suborder);
T.show(view.getContext(),"开始制作商品:"+goodname.getText().toString());
}
}
}

+ 87
- 26
app/src/main/java/com/example/bpa/view/adapter/order_adapter.java Ver fichero

@@ -6,16 +6,25 @@ import android.content.ContextWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.bpa.Model.SuOrderA;
import com.example.bpa.R;
import com.example.bpa.config.ConfigName;
import com.example.bpa.config.DataBus;
import com.example.bpa.helper.MyImageView;
import com.example.bpa.helper.T;
import com.example.bpa.helper.WrapContentLinearLayoutManager;
import com.example.bpa.service.BusinessServer;
import com.example.bpa.view.mode.MakeStatus;
import com.example.bpa.view.mode.ResGoodsMake;
import com.example.bpa.view.mode.StatusMode;

import java.util.List;
@@ -29,7 +38,7 @@ public class order_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>

private Context context;

List<SuOrderA> Modes = DataBus.getInstance().OrderSM.orderDetail;
List<ResGoodsMake> Modes = DataBus.getInstance().GoodsSMMake;

public order_adapter(Context context) {
this.context = context;
@@ -40,33 +49,64 @@ public class order_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = mLayoutInflater.inflate(R.layout.order_item, parent, false);
return new devstatus_adapter.MyViewHolder(inflate);
return new order_adapter.MyViewHolder(inflate);

}

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
try {
if (holder instanceof devstatus_adapter.MyViewHolder) {
devstatus_adapter.MyViewHolder myViewHolder = (devstatus_adapter.MyViewHolder) holder;
SuOrderA statusMode= Modes.get(position);
// myViewHolder.title.setText(statusMode.Name);
// if(statusMode.Status)
// {
// myViewHolder.image.setImageResource(statusMode.Url_open);
// myViewHolder.text.setText("打开");
// myViewHolder.text.setTextColor(ConfigName.getInstance().dishesCon.getResources().getColor(R.color.lable_color));
// }else
// {
// myViewHolder.image.setImageResource(statusMode.Url_close);
// myViewHolder.text.setText("关闭");
// myViewHolder.text.setTextColor(ConfigName.getInstance().dishesCon.getResources().getColor(R.color.warm_red));
// }
if (holder instanceof order_adapter.MyViewHolder) {
order_adapter.MyViewHolder myViewHolder = (order_adapter.MyViewHolder) holder;
ResGoodsMake statusMode = Modes.get(position);
myViewHolder.title.setText(statusMode.good.name);
myViewHolder.image.setImageURL(statusMode.subOrder.goodImg);
myViewHolder.goodms.setText(statusMode.makeMs);
myViewHolder.progress_bar.setProgress(statusMode.makeProcess);
;
myViewHolder.goodStatus.setText(statusMode.makeStatus.toString());


myViewHolder.pllc.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
myViewHolder.adapter = new pflc_adapter(context, statusMode.recipes);
myViewHolder.pllc.setAdapter(myViewHolder.adapter);
if (statusMode.makeStatus == MakeStatus.等待制作) {
myViewHolder.goodStatus.setTextColor(ConfigName.getInstance().dishesCon.getResources().getColor(R.color.dd));
} else if (statusMode.makeStatus == MakeStatus.制作中) {
myViewHolder.goodStatus.setTextColor(ConfigName.getInstance().dishesCon.getResources().getColor(R.color.lime));
} else {
myViewHolder.goodStatus.setTextColor(ConfigName.getInstance().dishesCon.getResources().getColor(R.color.white));
}
if (statusMode.makeStatus == MakeStatus.等待制作) {
myViewHolder.start_button.setVisibility(View.VISIBLE);
myViewHolder.goodStatus.setVisibility(View.GONE);
} else {
myViewHolder.start_button.setVisibility(View.GONE);
myViewHolder.goodStatus.setVisibility(View.VISIBLE);
}
myViewHolder.start_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {

// if (!DataBus.getInstance().PlcIsConnect) {
// T.show(view.getContext(), "PLC未连接,不允许下单!");
// return;
// }

if (BusinessServer.Get().Commoditys.size() > 0) {
T.show(view.getContext(), "请等待前一饮品制作完成!");
return;
}
BusinessServer.Get().AddCommodity(statusMode.subOrder);
T.show(view.getContext(), "开始制作商品:" + statusMode.good.name.toString());
}
});
}
} catch (Exception e) {
e.printStackTrace();
}
}

private Activity findActivity(@NonNull Context context) {
if (context instanceof Activity) {
return (Activity) context;
@@ -76,14 +116,15 @@ public class order_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
return null;
}
}

/**
* 刷新
*
* @param
*/
public void refresh(){
Activity activity= findActivity(context);
if(activity!=null)
{
public void refresh() {
Activity activity = findActivity(context);
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
@@ -110,16 +151,36 @@ public class order_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
/**
* 图片
*/
ImageView image;
MyImageView image;
/**
* 开始按钮
*/
Button start_button;
/**
* 显示状态
*/
TextView goodStatus;
/**
* 商品描述
* 当前配置奶茶中..请稍后...
*/
TextView goodms;
/**
* 描述
* 制作进度
*/
TextView text;
ProgressBar progress_bar;
pflc_adapter adapter;
RecyclerView pllc;

public MyViewHolder(View view) {
super(view);
title = (TextView) view.findViewById(R.id.title);
image = (ImageView) view.findViewById(R.id.image);
text=(TextView) view.findViewById(R.id.text);
goodms = (TextView) view.findViewById(R.id.goodms);
progress_bar = (ProgressBar) view.findViewById(R.id.progress_bar);
image = (MyImageView) view.findViewById(R.id.image);
start_button = (Button) view.findViewById(R.id.start_button);
goodStatus = (TextView) view.findViewById(R.id.start_text);
pllc = view.findViewById(R.id.pllc);
}
}
}

+ 187
- 0
app/src/main/java/com/example/bpa/view/adapter/pflc_adapter.java Ver fichero

@@ -0,0 +1,187 @@
package com.example.bpa.view.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.capton.colorfulprogressbar.ColorfulProgressbar;
import com.example.bpa.R;
import com.example.bpa.config.ConfigName;
import com.example.bpa.config.DataBus;
import com.example.bpa.helper.MyImageView;
import com.example.bpa.helper.T;
import com.example.bpa.view.mode.MakeStatus;
import com.example.bpa.view.mode.ResGoodsMake;
import com.example.bpa.view.mode.ResGoodsRecipe;

import java.util.ArrayList;
import java.util.List;


/**
* 配方流程
*/
public class pflc_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

private final LayoutInflater mLayoutInflater;

private Context context;

List<ResGoodsRecipe> Modes = new ArrayList<>() ;

public pflc_adapter(Context context, ArrayList<ResGoodsRecipe> recipes) {
this.context = context;
mLayoutInflater = LayoutInflater.from(context);
Modes=recipes;
}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View inflate = mLayoutInflater.inflate(R.layout.pllc_item, parent, false);
return new pflc_adapter.MyViewHolder(inflate);

}

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
try {
if (holder instanceof pflc_adapter.MyViewHolder) {
pflc_adapter.MyViewHolder myViewHolder = (pflc_adapter.MyViewHolder) holder;
ResGoodsRecipe mode= Modes.get(position);
myViewHolder.title.setText(SortStr(mode.sort)+" "+mode.materialName +"("+mode.value+")");
myViewHolder.progress_bar.setProgress(mode.makeProcess);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private Activity findActivity(@NonNull Context context) {
if (context instanceof Activity) {
return (Activity) context;
} else if (context instanceof ContextWrapper) {
return findActivity(((ContextWrapper) context).getBaseContext());
} else {
return null;
}
}

public String SortStr(int i)
{
if(i==1)
{
return "①";
}else if(i==2)
{
return "②";
}else if(i==3)
{
return "③";
}else if(i==4)
{
return "④";
}else if(i==5)
{
return "⑤";
}else if(i==6)
{
return "⑥";
}else if(i==7)
{
return "⑦";
}else if(i==8)
{
return "⑧";
}else if(i==9)
{
return "⑨";
}else if(i==10)
{
return "⑩";
}else if(i==11)
{
return "⑪";
}else if(i==12)
{
return "⑫";
}else if(i==13)
{
return "⑬";
}else if(i==14)
{
return "⑭";
}else if(i==15)
{
return "⑮";
}else if(i==16)
{
return "⑯";
}else if(i==17)
{
return "⑰";
}else if(i==18)
{
return "⑱";
}else if(i==19)
{
return "⑲";
}else if(i==20)
{
return "⑳";
}else
{
return "①";
}
}

/**
* 刷新
* @param
*/
public void refresh(){
Activity activity= findActivity(context);
if(activity!=null)
{
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
try {
notifyDataSetChanged();
} catch (Exception e) {

}
}
});
}
}

@Override
public int getItemCount() {
return Modes.size();
}

public static class MyViewHolder extends RecyclerView.ViewHolder {
/**
* 标题
*/
TextView title;
/**
* 制作进度
*/
ColorfulProgressbar progress_bar;
public MyViewHolder(View view) {
super(view);
title = (TextView) view.findViewById(R.id.title);
progress_bar=(ColorfulProgressbar) view.findViewById(R.id.progress_bar);
}
}
}

+ 4
- 0
app/src/main/java/com/example/bpa/view/mode/ResGoodsRecipe.java Ver fichero

@@ -24,4 +24,8 @@ public class ResGoodsRecipe extends BPA_GOODSRECIPE {
* 是否运行
*/
public boolean IsRun=false;
/**
* 制作进度
*/
public int makeProcess;
}

+ 17
- 14
app/src/main/res/layout/activity_main.xml Ver fichero

@@ -49,23 +49,33 @@
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">


<ImageView
android:id="@+id/RealTimeMonitoring"
android:id="@+id/HomeMain"
android:layout_width="28dp"
android:layout_height="24dp"
android:layout_marginTop="2dp"
android:layout_height="28dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@mipmap/ssjk1"/>
android:src="@mipmap/zy"/>
<ImageView
android:id="@+id/HomeMain"
android:id="@+id/SystemHelp"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@mipmap/zy"/>
android:src="@mipmap/zzlb"/>
<ImageView
android:id="@+id/RealTimeMonitoring"
android:layout_width="28dp"
android:layout_height="24dp"
android:layout_marginTop="2dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@mipmap/ssjk1"/>
<ImageView
android:id="@+id/CloudUpdates"
android:layout_width="28dp"
@@ -90,14 +100,7 @@
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@mipmap/sz"/>
<ImageView
android:id="@+id/SystemHelp"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@mipmap/bz"/>

<ImageView
android:id="@+id/ColseMain"
android:layout_width="28dp"


+ 69
- 89
app/src/main/res/layout/item/layout/order_item.xml Ver fichero

@@ -12,21 +12,27 @@

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="vertical">

<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginTop="5dp"
android:text="菠萝奶茶"
android:textColor="@color/white"
android:textSize="24dp"
android:textSize="19dp"
android:textStyle="bold" />

<com.example.bpa.helper.MyImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_alignParentLeft="true"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
@@ -37,95 +43,69 @@
android:text="制作流程:"
android:textColor="@color/white" />
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pllc"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="①水:"
android:textColor="@color/foreground" />
<com.capton.colorfulprogressbar.ColorfulProgressbar
app:style="@string/style_colorful"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="140dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_gravity="center"
android:visibility="visible"
android:layout_centerInParent="true"
android:duration="3000"
android:indeterminate="true"
android:max="100"
/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>

android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="①奶:"
android:textColor="@color/foreground" />
<com.capton.colorfulprogressbar.ColorfulProgressbar
app:style="@string/style_colorful"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="140dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_gravity="center"
android:visibility="visible"
android:layout_centerInParent="true"
android:duration="3000"
android:indeterminate="true"
android:max="100"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/goodms"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="当前配置奶茶中..请稍后..."
android:textColor="@color/colorAccent"
android:textSize="10dp"
android:typeface="serif" />
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="visible"
android:duration="3000"
android:progress="0"
android:indeterminate="false"
android:max="100" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_marginBottom="20dp"
android:layout_height="40dp">
<Button
android:id="@+id/start_button"
android:layout_width="200dp"
android:layout_alignParentBottom="true"
android:layout_height="40dp"
android:background="@drawable/btn_greenblue"
android:layout_gravity="center_vertical"
android:layout_centerHorizontal="true"
android:text="开始制作"
/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="60dp"
android:id="@+id/start_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="②菠萝:"
android:textColor="@color/foreground" />
<com.capton.colorfulprogressbar.ColorfulProgressbar
app:style="@string/style_colorful"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="140dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_gravity="center"
android:visibility="visible"
android:layout_centerInParent="true"
android:duration="3000"
android:indeterminate="true"
android:max="100"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="制作完成"
android:textColor="@color/meunSelectForeground"
android:textSize="20dp"
android:textStyle="bold"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="240dp">

</RelativeLayout>

<!-- <com.example.bpa.helper.MyImageView-->
<!-- android:id="@+id/iv_food_pic"-->
<!-- android:background="@color/red"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="300dp"-->
<!-- android:layout_marginTop="60dp"-->
<!-- android:layout_alignParentLeft="true"-->
<!-- android:scaleType="fitXY" />-->
</LinearLayout>
</RelativeLayout>
</LinearLayout>

+ 32
- 0
app/src/main/res/layout/item/layout/pllc_item.xml Ver fichero

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="②菠萝:"
android:textSize="12dp"
android:textColor="@color/foreground" />
<com.capton.colorfulprogressbar.ColorfulProgressbar
app:style="@string/style_colorful"
android:id="@+id/progress_bar"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="120dp"
android:layout_height="20dp"
android:layout_marginLeft="10dp"
android:layout_gravity="center"
android:visibility="visible"
android:layout_centerInParent="true"
android:duration="3000"
android:indeterminate="true"
android:max="100"
/>
</LinearLayout>
</LinearLayout>


Cargando…
Cancelar
Guardar