Browse Source

增加网络图片25553232

tags/old_version_1
fyf 1 year ago
parent
commit
c8e0237c04
6 changed files with 569 additions and 90 deletions
  1. +361
    -0
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +42
    -1
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  3. +140
    -72
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java
  4. +2
    -4
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java
  5. +19
    -12
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java
  6. +5
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java

+ 361
- 0
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -0,0 +1,361 @@
package com.bonait.bnframework.business;

import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.utils.ToastUtils;

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

/**
* 执行配方
*/
public class ExecuteTheRecipe {
/**
* 执行配方
*
* @param recipe
* @return
*/
public static boolean Execute(BPA_GOODSRECIPE recipe) {
boolean status = false;
try {
ToastUtils.info("开始执行:" + recipe.sort + "、" + recipe.processms);
//1.解析
if (recipe.materialType == 0)//正常物料
{
ExecuteMaterialIssuance(recipe.processvalue);
} else if (recipe.materialType == 1)//工序模型
{
ExecuteOperationSteps(recipe.processname,recipe.processvalue);
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
status = false;
} finally {
return status;
}
}

/**
* 液体物料信息-配料
*
* @param text
*/
private static void ExecuteMaterialIssuance(String text) {
try {
if(!text.isEmpty())
{
//仓号 值
Map<Integer,Integer> formulation=new IdentityHashMap<>();
//region 获取仓号和值
List<String> data=new ArrayList<>();
if(text.contains("|"))
{
String[] res= text.split("[|]");
for (int i=0;i<res.length;i++)
{
data.add(res[i]);
}
}else
{
data.add(text);
}
for(String item:data)
{
if(!item.isEmpty() && item.contains(","))
{
String[] wl= item.split("[,]");
if (wl != null && wl.length == 2)
{
String name=wl[0];
int val=Integer.parseInt(wl[1]);
List<BPA_SILOS> bpa_silos= QueryDB.GetSolisByMaterialName(name);
if(bpa_silos.size()>0 && val>0)
{
BPA_SILOS silos= bpa_silos.get(0);
formulation.put(silos.num,val);
}
}
}
}
//endregion
//写入PLC
for (Map.Entry<Integer, Integer> entry : formulation.entrySet()) {
Integer key = entry.getKey();
Integer value = entry.getValue();
Write_PLC_Material(key,value);
}
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 执行工序步骤
*
* @param text
*/
private static void ExecuteOperationSteps(String processname, String text) {
try {
if(!text.isEmpty() && !processname.isEmpty())
{
//工序名称和值
Map<String,String> formulation=new IdentityHashMap<>();
//region 获取仓号和值
List<String> data=new ArrayList<>();
if(text.contains("|"))
{
String[] res= text.split("[|]");
for (int i=0;i<res.length;i++)
{
data.add(res[i]);
}
}else
{
data.add(text);
}
for(String item:data)
{
if(!item.isEmpty() && item.contains(","))
{
String[] wl= item.split("[,]");
if (wl != null && wl.length == 2)
{
String name=wl[0];
String val=wl[1];
formulation.put(name,val);
}
}
}
//endregion
//写入PLC
if(formulation.size()>0)
{
switch (processname)
{
case "搅拌":
Write_PLC_Stir(formulation);
break;
case "热油":
Write_PLC_Hotoil(formulation);
break;
case "主料":
Write_PLC_Ingredients(formulation);
break;
case "加热":
Write_PLC_Heating(formulation);
break;
case "延迟":
Write_PLC_Delay(formulation);
break;
case "勾芡":
Write_PLC_Gouqiu(formulation);
break;
case "出菜":
Write_PLC_Outdishes(formulation);
break;
case "热锅":
Write_PLC_Hotpan(formulation);
break;
}
}
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

//region 物料PLC控制
/**
* 写入仓号需求值
* @param num
* @param val
*/
private static void Write_PLC_Material(int num,int val)
{
try
{
ToastUtils.info("写入PLC仓号需求:" + num+","+val);
Thread.sleep(1000);
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}
//endregion

//region 写PLC工序

/**
* 写PLC搅拌
* @param data
*/
private static void Write_PLC_Stir(Map<String,String> data)
{
try
{
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("写入PLC工序需求:" + key+","+value);
Thread.sleep(1000);
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC热油
* @param data
*/
private static void Write_PLC_Hotoil(Map<String,String> data)
{
try
{
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("写入PLC工序需求:" + key+","+value);
Thread.sleep(1000);
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC主料
* @param data
*/
private static void Write_PLC_Ingredients(Map<String,String> data)
{
try
{
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("写入PLC工序需求:" + key+","+value);
Thread.sleep(1000);
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC 加热
* @param data
*/
private static void Write_PLC_Heating(Map<String,String> data)
{
try
{
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("写入PLC工序需求:" + key+","+value);
Thread.sleep(1000);
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC 延迟
* @param data
*/
private static void Write_PLC_Delay(Map<String,String> data)
{
try
{
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if(key.contains("延迟"))
{
int val=Integer.parseInt(value);
ToastUtils.info("延迟:"+value+"s");
Thread.sleep(val*1000);
}
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC 勾芡
* @param data
*/
private static void Write_PLC_Gouqiu(Map<String,String> data)
{
try
{
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("写入PLC工序需求:" + key+","+value);
Thread.sleep(1000);
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC 出菜
* @param data
*/
private static void Write_PLC_Outdishes(Map<String,String> data)
{
try
{
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
int val=Integer.parseInt(value);
ToastUtils.info("出菜延迟:"+value+"s");
Thread.sleep(val*1000);
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 写PLC 热锅
* @param data
*/
private static void Write_PLC_Hotpan(Map<String,String> data)
{
try
{
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
ToastUtils.info("写入PLC工序需求:" + key+","+value);
Thread.sleep(1000);
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}
}
//endregion

}

+ 42
- 1
app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java View File

@@ -36,6 +36,7 @@ import com.bonait.bnframework.common.db.res.ResLog;
import com.bonait.bnframework.common.db.res.ResSilosMode;
import com.bonait.bnframework.common.db.res.ResSubOrder;
import com.bonait.bnframework.common.helper.Tools;
import com.bonait.bnframework.common.utils.PreferenceUtils;

import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
@@ -178,7 +179,23 @@ public class QueryDB {

return obj.size() > 0 ? (BPA_MATERIAL) obj.get(0) : null;
}

/**
* 根据物料名称获取物料
*
* @param name
* @return
*/
public static BPA_MATERIAL GetMaterialName(String name) {
String orderby = Desc_Time_Up;//出料顺序
String where = "isDelete=? and name=?";
String[] args = new String[]{"0", name};
ArrayList<BPA_MATERIAL> data = new ArrayList<>();
ArrayList<Object> obj = Get(BPA_MATERIAL.class, where, args, orderby);
for (Object k : obj) {
data.add((BPA_MATERIAL) k);
}
return data.size() > 0?data.get(0):null;
}

/**
* 判断物料数据是否存在
@@ -595,6 +612,30 @@ public class QueryDB {
return data;

}

/**
* 根据物料名称查询料仓
* @return
*/
public static List<BPA_SILOS> GetSolisByMaterialName(String name) {
List<BPA_SILOS> data = new ArrayList<>();
BPA_MATERIAL material= GetMaterialName(name);
if(material==null)
{
return data;
}
List<String> solisids = GetSilosLIst(material.id);
if (solisids.size() == 0) {
return data;
}
for (String s : solisids) {
BPA_SILOS silos = GetSilosID(s);
if (silos != null) {
data.add(silos);
}
}
return data;
}
//endregion

//region BPA_GOODS 商品表


+ 140
- 72
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java View File

@@ -4,6 +4,7 @@ package com.bonait.bnframework.modules.home.fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@@ -17,14 +18,18 @@ import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.helper.ByteHelper;
import com.bonait.bnframework.common.helper.I.IThread;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.ThreadManager;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.MyLayoutManager;
@@ -66,11 +71,11 @@ public class Home1Fragment extends BaseFragment {
huoli_control huoli;//火力控件
@BindView(R.id.startbutton)
ImageView startbutton;//启动安
public boolean Status=false;
public boolean Status = false;
/**
* 当前制作商品信息
*/
BPA_GOODS good=null;
BPA_GOODS good = null;
private Context context;

public Home1Fragment() {
@@ -80,6 +85,7 @@ public class Home1Fragment extends BaseFragment {
protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home1, null);
ButterKnife.bind(this, root);

return root;
}

@@ -90,6 +96,7 @@ public class Home1Fragment extends BaseFragment {
initTopBar();
initData();
HuoLiClicked();
MakeThread();
}

/**
@@ -103,7 +110,7 @@ public class Home1Fragment extends BaseFragment {
caipumingcheng.setText("");
shengyushijian.setText("预计剩余时间:0s");
startbutton.setImageResource(R.mipmap.qdzz);
Status=false;
Status = false;

mTopBar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.app_color_theme_4));
mTopBar.setTitle("菜谱烹饪");
@@ -114,28 +121,27 @@ public class Home1Fragment extends BaseFragment {
* 初始化显示数据
*/
private void initData() {
try{
try {
DataBus.getInstance().GetLc();
MyLayoutManager layout = new MyLayoutManager();
layout.setAutoMeasureEnabled(true);
recyclerView.setLayoutManager(layout);

DataBus.getInstance().lcadapter = new lc_adapter( getContext());
DataBus.getInstance().lcadapter = new lc_adapter(getContext());
recyclerView.setAdapter(DataBus.getInstance().lcadapter);
}catch(Exception e){
ToastUtils.info("异常信息:"+e.getMessage());
} catch (Exception e) {
ToastUtils.info("异常信息:" + e.getMessage());
}
}

/**
* 火力按钮点击
*/
public void HuoLiClicked()
{
huoli.mListener=new MyClickListener() {
public void HuoLiClicked() {
huoli.mListener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
ToastUtils.info("火力按钮点击,当前级别:"+data);
ToastUtils.info("火力按钮点击,当前级别:" + data);
}

@Override
@@ -144,12 +150,13 @@ public class Home1Fragment extends BaseFragment {
}
};

DataBus.getInstance().mListener=new MyClickListener() {
DataBus.getInstance().mListener = new MyClickListener() {
@Override
public void clickListener(View v, Object data) {
good=(BPA_GOODS)data;
good = (BPA_GOODS) data;
SetBottonStatus(false);
caipumingcheng.setText(good.name);
shengyushijian.setText("预计剩余时间:"+good.maketime+"s");
SetProcesssUI(good.maketime, 0);
}

@Override
@@ -161,46 +168,124 @@ public class Home1Fragment extends BaseFragment {
}

/**
* 制作商品
* 商品制作线程
*/
private CountDownTimer countDownTimer=null;
public void MakeGood()
public void MakeThread()
{
try
{
shengyushijian.setText("预计剩余时间:"+good.maketime+"s");
//获取工艺
ArrayList<BPA_GOODSRECIPE> goodsrecipes= QueryDB.GetGoodsSrecipeID(good.id);
countDownTimer= new CountDownTimer(good.maketime*1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
int ms=(int)((millisUntilFinished)/1000);
int syTime=(int) (((good.maketime-ms)*100)/good.maketime);
jingdu.setProgress(syTime);
jingdu.setSecondProgress(syTime);
shengyushijian.setText("预计剩余时间:"+ms+"s");
}
@Override
public void onFinish() {
Status=false;
startbutton.setImageResource(R.mipmap.qdzz);
jingdu.setProgress(0);
jingdu.setSecondProgress(0);
shengyushijian.setText("预计剩余时间:"+good.maketime+"s");
ToastUtils.info(good.name+",商品制作完成!");
cancel();
ThreadManager.Get().StartLong("商品制作线程-2023", true, new IThread() {
@Override
public void Run() throws InterruptedException {
if(Status && good!=null)
{
try
{
//获取工艺
ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
for(BPA_GOODSRECIPE item:goodsrecipes)
{
ExecuteTheRecipe.Execute(item);
}
}catch (Exception ex)
{
ToastUtils.error("异常信息:" + ex.getMessage());
}finally {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
SetBottonStatus(false);
}
});
}
}
};
Thread.sleep(1000);
}
@Override
public void RunComplete() throws InterruptedException {
}
});
}

/**
* 设置进度条百分比
*
* @param alltime
* @param usertime 使用时间
*/
public void SetProcesssUI(int alltime, int usertime) {
try {
jingdu.setProgress((usertime * 100) / alltime);
jingdu.setSecondProgress((usertime * 100) / alltime);
shengyushijian.setText("预计剩余时间:" + (alltime-usertime) + "s");
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

/**
* 设置button状态
*
* @param status
*/
public void SetBottonStatus(boolean status) {
try {
Status = status;
if (status) {
startbutton.setImageResource(R.mipmap.tzzz);
TimerCount(good.maketime,true);//开始计时器,记录进度条
} else {
startbutton.setImageResource(R.mipmap.qdzz);
TimerCount(0,false);//停止计时器
}
if (good != null) {
SetProcesssUI(good.maketime, 0);
}
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
}
}

private CountDownTimer countDownTimer = null;//计时器

/**
* 计时器
* @param alltime
* @param status
*/
public void TimerCount(int alltime, boolean status) {
if(status)
{
if(countDownTimer==null)
{
countDownTimer = new CountDownTimer(alltime * 1000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
int overtime = (int) ((millisUntilFinished) / 1000);//剩余时间
SetProcesssUI(alltime,alltime-overtime);
}
@Override
public void onFinish() {
SetProcesssUI(alltime,alltime);//进度条100%
}
};
}
countDownTimer.start();
}catch (Exception ex)
}else
{

if(countDownTimer!=null)
{
countDownTimer.cancel();
countDownTimer=null;
}
}
}

@OnClick({R.id.xzcp,R.id.startbutton,R.id.qdjb,R.id.ztjb,R.id.tzjb
,R.id.ccw,R.id.chucw,R.id.dsw,R.id.yaoqian,R.id.tingyao})
/**
* 点击事件
*
* @param view
*/
@OnClick({R.id.xzcp, R.id.startbutton, R.id.qdjb, R.id.ztjb, R.id.tzjb
, R.id.ccw, R.id.chucw, R.id.dsw, R.id.yaoqian, R.id.tingyao})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.xzcp://选择菜谱按钮点击
@@ -208,35 +293,19 @@ public class Home1Fragment extends BaseFragment {
ToastUtils.info("打开菜谱选择界面");
break;
case R.id.startbutton:
if (Status)
{
if (Status) {
//按钮点击
String title = "停止操作提示!";
String message = "请问客官确定要停止制作吗,小菠萝会生气的,啊啊啊啊啊啊啊...我的饭饭?";
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
startbutton.setImageResource(R.mipmap.qdzz);
Status=false;
if(countDownTimer!=null)
{
countDownTimer.cancel();
countDownTimer=null;
}

if(good!=null)
{
shengyushijian.setText("预计剩余时间:"+good.maketime+"s");
jingdu.setProgress(0);
jingdu.setSecondProgress(0);
}
SetBottonStatus(false);
dialog.dismiss();
}
});
}else
{
if(good==null)
{
} else {
if (good == null) {
ToastUtils.info("请先选择一个商品");
return;
}
@@ -246,9 +315,8 @@ public class Home1Fragment extends BaseFragment {
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
startbutton.setImageResource(R.mipmap.tzzz);
Status=true;
MakeGood();
SetBottonStatus(true);

dialog.dismiss();
}
});
@@ -301,11 +369,11 @@ public class Home1Fragment extends BaseFragment {
* 当在activity设置viewPager + BottomNavigation + fragment时,
* 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题,
* 必须加上此方法,禁止fragment左滑返回上一界面。
*
* <p>
* 切记!切记!切记!否则会闪退!
*
* <p>
* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。
* */
*/
@Override
protected boolean canDragBack() {
return false;


+ 2
- 4
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java View File

@@ -107,14 +107,13 @@ public class CpActivity extends BaseActivity {
});

/**
* 收藏菜品
* 刷新菜品
*/
MessageManager.getInstance().registerMessageReceiver(this, MessageName.ScGood, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
if (msg != null) {
SectionItem item=(SectionItem)msg;
QueryDB.UpdateGoodsSC(item.getAccount(),item.getIsSC()?1:0);
mAdapter.setData(new ArrayList<QMUISection<SectionHeader, SectionItem>>());
mAdapter.setData(getList());
}
}
@@ -129,7 +128,6 @@ public class CpActivity extends BaseActivity {
if (msg != null) {
SectionItem item=(SectionItem)msg;
String goodid=item.getAccount();//商品id
// 跳转到登录页面
Intent intent = new Intent(getContext(), DiyUpdateActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("id",goodid);


+ 19
- 12
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java View File

@@ -165,6 +165,8 @@ public class DiyUpdateActivity extends BaseActivity {
bpa_goodsrecipes.add(item);
}
edittext.setText(good.name);
check.setChecked(good.issc==1);
zzsc.setText(good.maketime+"");
gxbz_adapter.notifyDataSetChanged();//刷新商品配方
new MyBitmapUtils().disPlay(cpfm,good.url);
}
@@ -425,29 +427,32 @@ public class DiyUpdateActivity extends BaseActivity {
}

ArrayList<BPA_GOODS> goods=QueryDB.GetGoodsALL();
BPA_GOODS good=new BPA_GOODS();
good.name=name1;
good.status=1;
good.sort=goods.size()+1;
good.maketime=sc;
good.issc=check.isChecked()?1:0;
good.url=good.url;
QueryDB.AddGoods(good);
BPA_GOODS good1=new BPA_GOODS();
good1.name=name1;
good1.status=1;
good1.sort=goods.size()+1;
good1.maketime=sc;
good1.issc=check.isChecked()?1:0;
good1.url=good.url;
QueryDB.AddGoods(good1);
for (int k=0;k<bpa_goodsrecipes.size();k++)
{
BPA_GOODSRECIPE item=bpa_goodsrecipes.get(k);
item.goodsID=good.id;
item.id=java.util.UUID.randomUUID().toString();
item.goodsID=good1.id;
item.sort=k+1;
QueryDB.AddGoodsSrecipe(item);
}
ToastUtils.info("菜谱生成成功!");
ToastUtils.info("菜谱复刻成功!");
dialog.dismiss();
MessageManager.getInstance().sendMessage(MessageName.ScGood,"Good");
finish();
}
});

}
break;
case R.id.shengchengcaipu://生成菜谱
case R.id.shengchengcaipu://修改菜谱
String name=edittext.getText().toString();
if(name.isEmpty())
{
@@ -488,8 +493,10 @@ public class DiyUpdateActivity extends BaseActivity {
item.sort=k+1;
QueryDB.AddGoodsSrecipe(item);
}
ToastUtils.info("菜谱保存成功!");
ToastUtils.info("菜谱修改成功!");
dialog.dismiss();
MessageManager.getInstance().sendMessage(MessageName.ScGood,"Good");
finish();
}
});



+ 5
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java View File

@@ -12,6 +12,7 @@ import android.widget.TextView;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.image.MyBitmapUtils;
import com.bonait.bnframework.common.message.MessageManager;
@@ -123,7 +124,10 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter {
((SectionItem)section.getItemAt(itemIndex)).SetIsSC(IsSC);
SetImage(sc_image,IsSC);
notifyDataSetChanged();
MessageManager.getInstance().sendMessage(MessageName.ScGood,((SectionItem)section.getItemAt(itemIndex)));

SectionItem item=((SectionItem)section.getItemAt(itemIndex));
QueryDB.UpdateGoodsSC(item.getAccount(),item.getIsSC()?1:0);
MessageManager.getInstance().sendMessage(MessageName.ScGood,"Good");
dialog.dismiss();
}
});


Loading…
Cancel
Save