Переглянути джерело

增加修改功能-配方

调味吧台
fyf 1 рік тому
джерело
коміт
f9d20db8e3
19 змінених файлів з 328 додано та 37 видалено
  1. +1
    -1
      app/src/main/java/com/example/bpa/MainActivity.java
  2. +15
    -2
      app/src/main/java/com/example/bpa/config/DataBus.java
  3. +11
    -3
      app/src/main/java/com/example/bpa/db/QueryDB.java
  4. +61
    -0
      app/src/main/java/com/example/bpa/view/adapter/MyAdapter.java
  5. +1
    -1
      app/src/main/java/com/example/bpa/view/control/clsf_control.java
  6. +75
    -8
      app/src/main/java/com/example/bpa/view/fragment/HomeFragment.java
  7. +80
    -0
      app/src/main/java/com/example/bpa/view/from/lsjy_activity.java
  8. +1
    -1
      app/src/main/java/com/example/bpa/view/from/pflb_activity.java
  9. +30
    -0
      app/src/main/res/layout/from/layout/activity_lsjy.xml
  10. +32
    -13
      app/src/main/res/layout/from/layout/fragment_home.xml
  11. +1
    -0
      app/src/main/res/layout/item/layout/lc_item.xml
  12. +12
    -0
      app/src/main/res/layout/item/layout/listview_item.xml
  13. +8
    -8
      app/src/main/res/layout/item/layout/maingoods.xml
  14. BIN
     
  15. BIN
     
  16. BIN
     
  17. BIN
     
  18. BIN
     
  19. BIN
     

+ 1
- 1
app/src/main/java/com/example/bpa/MainActivity.java Переглянути файл

@@ -148,7 +148,7 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen
clist_title.setText(ConfigName.getInstance().Shop_Name);
version.setText(ConfigName.getInstance().Version);
ShowFragment(homeFragment, "系统主页");
DataBus.getInstance().UpdateMainGoods();
DataBus.getInstance().UpdateMainGoods("");
mUpdateManager = new UpdateManager(MainActivity.this,this);
ConfigName.getInstance().activity=this;
Speech.initTTS(this);


+ 15
- 2
app/src/main/java/com/example/bpa/config/DataBus.java Переглянути файл

@@ -9,6 +9,7 @@ import com.example.bpa.Model.OrderStatusChange;
import com.example.bpa.Model.ResultA;
import com.example.bpa.R;
import com.example.bpa.app.Main;
import com.example.bpa.db.mode.BPA_MENU;
import com.example.bpa.db.mode.BPA_SUBORDER;
import com.example.bpa.helper.MessageLog;
import com.example.bpa.message.MessageManager;
@@ -359,9 +360,21 @@ public class DataBus {
/**
* 更新商品主界面商品列表
*/
public void UpdateMainGoods(){
public void UpdateMainGoods(String lx){
mainGoods.clear();
ArrayList<BPA_GOODS> res = QueryDB.GetGoodsStateALL();
if(lx.isEmpty())
{
ArrayList<BPA_MENU> foodTypes= QueryDB.GetMenuALL();
if(foodTypes.size()>0)
{
lx=foodTypes.get(0).name;
}else
{
lx="其他";
}
}

ArrayList<BPA_GOODS> res = QueryDB.GetGoodsStateALL(lx);
if (res.size()>0){
for (BPA_GOODS good:res){
mainGoods newgood = new mainGoods();


+ 11
- 3
app/src/main/java/com/example/bpa/db/QueryDB.java Переглянути файл

@@ -578,10 +578,18 @@ public class QueryDB {
*
* @return
*/
public static ArrayList<BPA_GOODS> GetGoodsStateALL() {
public static ArrayList<BPA_GOODS> GetGoodsStateALL(String lx) {
String orderby = Desc_Sort_Up + ',' + Desc_Time_Up;//先按排序 创建时间倒序
String where = "isDelete=? and status=?";
String[] args = new String[]{"0", "1"};
String where="";
if(lx.equals("其他"))
{
where = "isDelete=? and status=? and (exp=? or exp is null)";

}else
{
where = "isDelete=? and status=? and exp=?";
}
String[] args = new String[]{"0", "1",lx};
ArrayList<BPA_GOODS> data = new ArrayList<>();
ArrayList<Object> obj = Get(BPA_GOODS.class, where, args, orderby);
for (Object k : obj) {


+ 61
- 0
app/src/main/java/com/example/bpa/view/adapter/MyAdapter.java Переглянути файл

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

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.bpa.R;
import com.example.bpa.view.fragment.HomeFragment;

public class MyAdapter extends BaseAdapter {

private Context context;
private String[] strings;
public static int mPosition;

public MyAdapter(Context context, String[] strings){
this.context =context;
this.strings = strings;
}

@Override
public int getCount() {
// TODO Auto-generated method stub
return strings.length;
}

@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return strings[position];
}

@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
convertView = LayoutInflater.from(context).inflate(R.layout.listview_item, null);
TextView tv = (TextView) convertView.findViewById(R.id.tv_zcd);
mPosition = position;
tv.setText(strings[position]);
if (position == HomeFragment.mPosition) {
//convertView.setBackgroundColor(Color.parseColor("#FF074B92"));

convertView.setBackgroundResource(R.mipmap.selectk);
} else {
//convertView.setBackgroundColor(Color.parseColor("#8f723c"));

convertView.setBackgroundResource(R.mipmap.noselectk);
}
return convertView;
}
}

+ 1
- 1
app/src/main/java/com/example/bpa/view/control/clsf_control.java Переглянути файл

@@ -160,7 +160,7 @@ public class clsf_control extends LinearLayout {

double finalZl = zl;
//将其余料仓出料设置为0,重置
for (int k = 1; k <= 12; k++) {
for (int k = 1; k <= 13; k++) {
if (k!=index) {
DeviceData.Get().setDemandValue((short) 0, k,null);
}


+ 75
- 8
app/src/main/java/com/example/bpa/view/fragment/HomeFragment.java Переглянути файл

@@ -17,8 +17,10 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.capton.colorfulprogressbar.ColorfulProgressbar;
@@ -32,12 +34,14 @@ 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_GOODS;
import com.example.bpa.db.mode.BPA_MENU;
import com.example.bpa.db.mode.BPA_SUBORDER;
import com.example.bpa.helper.T;
import com.example.bpa.helper.WrapContentLinearLayoutManager;
import com.example.bpa.message.MessageLooper;
import com.example.bpa.message.MessageManager;
import com.example.bpa.service.DeviceData;
import com.example.bpa.view.adapter.MyAdapter;
import com.example.bpa.view.adapter.maingoods_adapter;
import com.example.bpa.view.adapter.makegood_adapter;
import com.example.bpa.view.adapter.order_adapter;
@@ -67,6 +71,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl
* 商品制作列表
*/
RecyclerView MakeGood;
public ListView foods_types_name;//导航
/**
* 自动控制按钮
*/
@@ -79,6 +84,18 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl
* 界面实例
*/
public View view;

/**
* 商品类型集合
*/
public List<BPA_MENU> foodTypes=new ArrayList<>();
/**
* 当前菜品集合
*/
public List<String> types_key;

public static int mPosition;
private MyAdapter adapter;
//endregion

//region 私有函数
@@ -96,7 +113,7 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl
* 初始化
*/
private void Init(){
foods_types_name= view.findViewById(R.id.tv_typename);
good_recyclerView = view.findViewById(R.id.good_recyclerView);
makesp=view.findViewById(R.id.makesp);
nohelp=view.findViewById(R.id.nohelp);
@@ -146,17 +163,30 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl
try{
if( ConfigName.getInstance().IsUserDownOrder)
{
MyLayoutManager layout = new MyLayoutManager();
layout.setAutoMeasureEnabled(true);
good_recyclerView.setLayoutManager(layout);
foodTypes= QueryDB.GetMenuALL();
types_key=new ArrayList<>();
for (BPA_MENU type:foodTypes)
{
types_key.add(type.name);
}

types_key.add("其他");

adapter = new MyAdapter(this.getContext(), types_key.toArray(new String[0]));
foods_types_name.setAdapter(adapter);
foods_types_name.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
ItemClick(adapterView,view,i,l);
}
});
ItemClick(null,null,0,0);

goodadapter = new maingoods_adapter( getContext());
good_recyclerView.setAdapter(goodadapter);
DataBus.getInstance().UpdateMainGoods();//更新商品
}



}

// MakeGood.setLayoutManager(new WrapContentLinearLayoutManager(view.getContext(), LinearLayoutManager.HORIZONTAL,false));
// DataBus.getInstance().goodmakeadapter = new makegood_adapter(getContext());
// MakeGood.setAdapter(DataBus.getInstance().goodmakeadapter);
@@ -167,6 +197,43 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl
//endregion

//region 点击事件
/**
* Item 点击事件
* @param adapterView
* @param view
* @param position
* @param id
*/
public void ItemClick(AdapterView<?> adapterView, View view, int position, long id) {
//即使刷新adapter
mPosition=position;
String str="";
adapter.notifyDataSetChanged();
if(view==null)
{
String[] key= types_key.toArray(new String[0]);
if(types_key.size()>0)
{
str=key[0];
}
}else
{
TextView _text=view.findViewById(R.id.tv_zcd);
if(_text!=null && !_text.getText().toString().isEmpty())
str=_text.getText().toString();
}

if(!str.isEmpty())
{
MyLayoutManager layout = new MyLayoutManager();
layout.setAutoMeasureEnabled(true);
good_recyclerView.setLayoutManager(layout);

goodadapter = new maingoods_adapter( getContext());
good_recyclerView.setAdapter(goodadapter);
DataBus.getInstance().UpdateMainGoods(str);//更新商品
}
}
/**
* 本页面点击事件监听22
*


+ 80
- 0
app/src/main/java/com/example/bpa/view/from/lsjy_activity.java Переглянути файл

@@ -61,6 +61,10 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
Button savecanshu;
//重量
TextView zhongliang;

EditText bc_text4;
Button cl_botton;

//endregion

//region 私有函数
@@ -142,6 +146,9 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList

ClearText = findViewById(R.id.ClearText);
zhongliang = findViewById(R.id.zhongliang);

bc_text4=this.findViewById(R.id.bc_text4);
cl_botton=this.findViewById(R.id.cl_botton);
}

/**
@@ -153,6 +160,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
SaveButton.setOnClickListener(this);
ClearText.setOnClickListener(this);
savecanshu.setOnClickListener(this);
cl_botton.setOnClickListener(this);
}

/**
@@ -240,6 +248,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
if (!isClicked) {
isClicked = true;
StartButton.setEnabled(false); // 禁用按钮防止重复点击
DeviceData.Get().setHandOrAutoSwitch(false, null);

// 在2秒后执行按钮操作
new Handler().postDelayed(new Runnable() {
@@ -366,6 +375,77 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
}, 500);
}
break;
case R.id.cl_botton:
String zltext = bc_text4.getText().toString();
if (zltext.equals("")) {
T.show(lsjy_activity.this, "出料重量不能为空!");
return;
}
double zl = 0;
try {
zl = Double.parseDouble(zltext);
} catch (Exception e) {
T.show(lsjy_activity.this, "出料重量获取异常!" + e.getMessage());
return;
}

if(zl<=1)
{
T.show(lsjy_activity.this, "出料重量至少大于1g!");
return;
}

int index=-1;
for (int i = 0; i < 13; i++) {
if (switchLists.get(i).isChecked() == true)//校准开关打开后,允许校准
{
if(index<=-1)
{
index=i+1;
}
}
}

if (index<=0)
{
T.show(lsjy_activity.this, "请打开通道开关!");
return;
}
DeviceData.Get().setHandOrAutoSwitch(true, null);

double finalZl = zl;
//将其余料仓出料设置为0,重置
for (int k = 1; k <= 13; k++) {
if (k!=index) {
DeviceData.Get().setDemandValue((short) 0, k,null);
}
}
DeviceData.Get().setDemandValue((short) ((int)(zl*10)), index, new IWriteCallBack() {
@Override
public void onSuccess() {

MessageLog.ShowInfo( "模拟物料下发成功!克数:"+ finalZl +"g");
T.show(lsjy_activity.this, "模拟物料下发成功!克数:"+ finalZl +"g");
DeviceData.Get().setChargeMixtureStart(new IWriteCallBack() {
@Override
public void onSuccess() {
MessageLog.ShowInfo( "开始出料!克数:"+ finalZl +"g");
T.show(lsjy_activity.this, "开始出料!克数:"+ finalZl +"g");
}
@Override
public void onFailure(String ErrorMsg) {
MessageLog.ShowInfo( "出料失败!克数:"+ finalZl +"g");
T.show(lsjy_activity.this, "出料失败!克数:"+ finalZl +"g");
}
});
}

@Override
public void onFailure(String ErrorMsg) {
MessageLog.ShowInfo( "模拟物料下发失败!");
}
});
break;
}
}
//endregion


+ 1
- 1
app/src/main/java/com/example/bpa/view/from/pflb_activity.java Переглянути файл

@@ -80,7 +80,7 @@ public class pflb_activity extends AppCompatActivity implements View.OnClickList
datatab= this.findViewById(R.id.datatab);
//通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据
String msg=getIntent().getStringExtra("data");
gongneng_title.setText(msg);
gongneng_title.setText("配方分组");
Initdata();
}



+ 30
- 0
app/src/main/res/layout/from/layout/activity_lsjy.xml Переглянути файл

@@ -504,6 +504,36 @@
android:track="@drawable/switch_custom_track_selector"/>



<TextView
android:layout_marginRight="15dp"
android:text="模拟出料:"
android:textColor="@color/white"
android:textStyle="bold"/>
<EditText
android:id="@+id/bc_text4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="60dp"
android:layout_marginRight="15dp"
android:inputType="number|numberDecimal"
android:theme="@style/MyEditText_num"
android:maxLines="1"
android:text="0"
android:singleLine="true"
android:textColor="@color/white"
android:backgroundTint="@color/colorAccent"/>
<Button
android:id="@+id/cl_botton"
android:layout_marginTop="10dp"
android:layout_height="30dp"
android:layout_width="match_parent"
android:background="@drawable/btn_greenblue"
android:text="出料"
android:layout_margin="5dp"
/>


</TableRow>




+ 32
- 13
app/src/main/res/layout/from/layout/fragment_home.xml Переглянути файл

@@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
>
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="24dp"-->
@@ -38,20 +38,38 @@
<!-- android:textColor="@color/titleforeground">-->
<!-- </TextView>-->
<!-- </LinearLayout>-->
<ScrollView
android:layout_height="0dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="40dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1.7"
android:fadingEdge="vertical"
tools:ignore="Suspicious0dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/good_recyclerView"
android:layout_height="match_parent"
android:orientation="horizontal">
<ListView
android:id="@+id/tv_typename"
android:layout_width="100dp"
android:layout_marginTop="5dp"
android:layout_height="match_parent"
android:layout_marginBottom="40dp"
android:scrollbars="none">
</ListView>
<!-- <View-->
<!-- android:layout_width="1dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:background="#cdcdcd" />-->
<ScrollView
android:layout_height="match_parent"
android:layout_marginTop="0dp"
android:layout_marginBottom="40dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>
</ScrollView>
android:fadingEdge="vertical"
tools:ignore="Suspicious0dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/good_recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</androidx.recyclerview.widget.RecyclerView>

</ScrollView>
</LinearLayout>

<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="24dp"-->
@@ -85,6 +103,7 @@
</LinearLayout>

<LinearLayout
android:visibility="gone"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:id="@+id/nohelp"


+ 1
- 0
app/src/main/res/layout/item/layout/lc_item.xml Переглянути файл

@@ -41,6 +41,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="55dp"
android:layout_marginLeft="3dp"
android:visibility="gone"
android:text="外置仓"
android:textColor="#6C01AF"
android:textSize="14dp" />


+ 12
- 0
app/src/main/res/layout/item/layout/listview_item.xml Переглянути файл

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp">
<TextView
android:id="@+id/tv_zcd"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/textTitleSize"
android:textColor="@color/white"/>
</RelativeLayout>

+ 8
- 8
app/src/main/res/layout/item/layout/maingoods.xml Переглянути файл

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="266dp"
android:layout_height="142dp"
android:layout_width="236dp"
android:layout_height="132dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/bg_f2"
android:background="@mipmap/goodbj"
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
@@ -23,6 +23,7 @@
android:layout_marginBottom="8dp">
<ImageView
android:id="@+id/good_pic"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
@@ -33,17 +34,16 @@
<RelativeLayout
android:layout_margin="0dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/bg_f1">
android:layout_height="match_parent">

<TextView
android:id="@+id/goodname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="28dp"
android:layout_marginTop="22dp"
android:layout_marginTop="10dp"
android:text="原味奶茶"
android:textColor="@color/colorPrimaryDark"
android:textColor="@color/white"
android:textSize="@dimen/TitleSize"
android:textStyle="bold"
android:typeface="serif" />
@@ -57,7 +57,7 @@
android:layout_alignParentRight="true"
android:layout_marginLeft="38dp"
android:layout_marginRight="38dp"
android:layout_marginBottom="20dp"
android:layout_marginBottom="5dp"
android:textColor="@color/foreground"
android:background="@drawable/ripple_goods"
android:text="开始配料" />








Завантаження…
Відмінити
Зберегти