@@ -4,10 +4,10 @@ | |||
<selectionStates> | |||
<SelectionState runConfigName="app"> | |||
<option name="selectionMode" value="DROPDOWN" /> | |||
<DropdownSelection timestamp="2024-05-30T03:09:49.889046200Z"> | |||
<DropdownSelection timestamp="2024-05-30T07:26:51.182873700Z"> | |||
<Target type="DEFAULT_BOOT"> | |||
<handle> | |||
<DeviceId pluginId="Default" identifier="serial=192.168.1.7:5555;connection=fbc1a4ca" /> | |||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=c8bf86d2" /> | |||
</handle> | |||
</Target> | |||
</DropdownSelection> | |||
@@ -419,9 +419,9 @@ public class ModbusHelper extends ModbusMaster { | |||
*/ | |||
public void setStirTime(int type,int time){ | |||
if(type == 2){ | |||
WriteShort(getPLC(ControlAdress.正转时间).PlcAddress, (short) time); | |||
WriteShort(getPLC(ControlAdress.正转时间).PlcAddress, (short) ( time*100)); | |||
}else { | |||
WriteShort(getPLC(ControlAdress.反转时间).PlcAddress, (short) time); | |||
WriteShort(getPLC(ControlAdress.反转时间).PlcAddress, (short) ( time*100)); | |||
} | |||
LogUtils.d(TAG+"搅拌电机控制 setStirTime type="+";time="+time); | |||
} | |||
@@ -1,8 +1,5 @@ | |||
package com.bonait.bnframework.ViewModel.ActivityViewModel; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.content.ContextCompat; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.util.AttributeSet; | |||
@@ -12,9 +9,16 @@ import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.TextView; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.content.ContextCompat; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Interface.IRunT; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom3; | |||
import com.bonait.bnframework.ViewModel.CustomView.jingdutiao; | |||
import com.bonait.bnframework.ViewModel.CustomView.newhuoli_control; | |||
import com.bonait.bnframework.business.ExecuteTheRecipe; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
@@ -23,10 +27,6 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom3; | |||
import com.bonait.bnframework.ViewModel.CustomView.jingdutiao; | |||
import com.bonait.bnframework.ViewModel.CustomView.newhuoli_control; | |||
import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
@@ -164,12 +164,12 @@ public class CookingActivity extends LinearLayout { | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { | |||
touliao_k.setVisibility(View.GONE); | |||
touliao_m.setVisibility(View.GONE); | |||
device_image.setImageResource(R.mipmap.device00); | |||
// device_image.setImageResource(R.mipmap.device00); | |||
}else | |||
{ | |||
touliao_k.setVisibility(View.VISIBLE); | |||
touliao_m.setVisibility(View.VISIBLE); | |||
device_image.setImageResource(R.mipmap.device1); | |||
// device_image.setImageResource(R.mipmap.device1); | |||
} | |||
} | |||
@@ -134,12 +134,12 @@ public class CookingSimulatedActivity extends BaseActivity { | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { | |||
touliao_k.setVisibility(View.GONE); | |||
touliao_m.setVisibility(View.GONE); | |||
device_image.setImageResource(R.mipmap.device00); | |||
// device_image.setImageResource(R.mipmap.device00); | |||
}else | |||
{ | |||
touliao_k.setVisibility(View.VISIBLE); | |||
touliao_m.setVisibility(View.VISIBLE); | |||
device_image.setImageResource(R.mipmap.device1); | |||
// device_image.setImageResource(R.mipmap.device1); | |||
} | |||
yeliao1.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(1) + ""); | |||
@@ -2,8 +2,6 @@ package com.bonait.bnframework.ViewModel.ActivityViewModel; | |||
import static com.bonait.bnframework.MainApplication.getContext; | |||
import androidx.core.content.ContextCompat; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
@@ -19,26 +17,28 @@ import android.widget.ListView; | |||
import android.widget.RelativeLayout; | |||
import android.widget.TextView; | |||
import androidx.core.content.ContextCompat; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter1; | |||
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter2; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom3; | |||
import com.bonait.bnframework.ViewModel.CustomView.newhuoli_control; | |||
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.constant.DataBus; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.model.mode.SpeedEnum; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter1; | |||
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter2; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom; | |||
import com.bonait.bnframework.ViewModel.CustomView.imagebuttom3; | |||
import com.bonait.bnframework.ViewModel.CustomView.newhuoli_control; | |||
import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
@@ -258,12 +258,12 @@ public class DishTestActivity extends BaseActivity { | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { | |||
touliao_k.setVisibility(View.GONE); | |||
touliao_m.setVisibility(View.GONE); | |||
device_image.setImageResource(R.mipmap.device00); | |||
// device_image.setImageResource(R.mipmap.device00); | |||
}else | |||
{ | |||
touliao_k.setVisibility(View.VISIBLE); | |||
touliao_m.setVisibility(View.VISIBLE); | |||
device_image.setImageResource(R.mipmap.device1); | |||
// device_image.setImageResource(R.mipmap.device1); | |||
} | |||
DataBus.getInstance().ShowGoodName = ""; | |||
@@ -37,7 +37,6 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.image.MyBitmapUtils; | |||
import com.bonait.bnframework.common.message.MessageLooper; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
@@ -217,7 +216,7 @@ public class DiyUpdate1Activity extends BaseActivity { | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
picUrl = (String) msg; | |||
new MyBitmapUtils().disPlay(cpfm, picUrl); | |||
// new MyBitmapUtils().disPlay(cpfm, picUrl); | |||
} | |||
} | |||
}); | |||
@@ -316,7 +315,7 @@ public class DiyUpdate1Activity extends BaseActivity { | |||
check.setChecked(good.issc == 1); | |||
zzsc.setText(good.maketime + ""); | |||
gxbz_adapter.notifyDataSetChanged();//刷新商品配方 | |||
new MyBitmapUtils().disPlay(cpfm, picUrl); | |||
// new MyBitmapUtils().disPlay(cpfm, picUrl); | |||
} | |||
} | |||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); | |||
@@ -41,6 +41,7 @@ import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.KeyboardToolUtils; | |||
import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.utils.UpdateAppUtils; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.test.TestActivity; | |||
import com.bonait.bnframework.ui.activity.MainActivity; | |||
@@ -114,6 +115,7 @@ public class LoginActivity extends BaseActivity{ | |||
@Override | |||
protected void onResume() { | |||
super.onResume(); | |||
UpdateAppUtils.updateApp(this,false); | |||
} | |||
/** | |||
@@ -1,13 +1,5 @@ | |||
package com.bonait.bnframework.ViewModel.ActivityViewModel; | |||
import androidx.annotation.NonNull; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.google.android.material.bottomnavigation.BottomNavigationView; | |||
import androidx.viewpager.widget.ViewPager; | |||
import android.os.Bundle; | |||
import android.view.MenuItem; | |||
import android.view.View; | |||
@@ -15,13 +7,20 @@ import android.widget.Button; | |||
import android.widget.EditText; | |||
import android.widget.RelativeLayout; | |||
import androidx.annotation.NonNull; | |||
import androidx.viewpager.widget.ViewPager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.ViewModel.Adapter.FragmentAdapter; | |||
import com.bonait.bnframework.ViewModel.FragmentViewModel.SystemDeviceinFragment; | |||
import com.bonait.bnframework.ViewModel.FragmentViewModel.SystemSeasoningsetFragment; | |||
import com.bonait.bnframework.ViewModel.FragmentViewModel.SystemSystemsetFragment; | |||
import com.bonait.bnframework.ViewModel.FragmentViewModel.systeminternetfragment; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.google.android.material.bottomnavigation.BottomNavigationView; | |||
import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
import com.qmuiteam.qmui.widget.QMUIViewPager; | |||
@@ -129,9 +128,9 @@ public class SzActivity extends BaseActivity { | |||
case R.id.bottom_navigation_3: | |||
viewPager.setCurrentItem(2); | |||
return true; | |||
case R.id.bottom_navigation_4: | |||
viewPager.setCurrentItem(3); | |||
return true; | |||
// case R.id.bottom_navigation_4: | |||
// viewPager.setCurrentItem(3); | |||
// return true; | |||
} | |||
return false; | |||
} | |||
@@ -222,12 +222,12 @@ public class HomeFragmentSBKZ extends BaseFragment { | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { | |||
touliao_k.setVisibility(View.GONE); | |||
touliao_m.setVisibility(View.GONE); | |||
device_image.setImageResource(R.mipmap.device00); | |||
// device_image.setImageResource(R.mipmap.device00); | |||
}else | |||
{ | |||
touliao_k.setVisibility(View.VISIBLE); | |||
touliao_m.setVisibility(View.VISIBLE); | |||
device_image.setImageResource(R.mipmap.device1); | |||
// device_image.setImageResource(R.mipmap.device1); | |||
} | |||
} | |||
@@ -379,7 +379,7 @@ public class MyFragment extends BaseFragment { | |||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |||
checkInstallPermission(); | |||
} else { | |||
UpdateAppUtils.updateApp(context); | |||
UpdateAppUtils.updateApp(context,true); | |||
} | |||
} else { | |||
//未获取权限 | |||
@@ -397,7 +397,7 @@ public class MyFragment extends BaseFragment { | |||
if (haveInstallPermission) { | |||
//已经打开权限,直接启动版本更新 | |||
UpdateAppUtils.updateApp(context); | |||
UpdateAppUtils.updateApp(context,true); | |||
} else { | |||
AlertDialogUtils.showDialog(getContext(), | |||
"请打开未知来源应用权限", | |||
@@ -1,12 +1,6 @@ | |||
package com.bonait.bnframework.ViewModel.FragmentViewModel; | |||
import android.content.Context; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.recyclerview.widget.LinearLayoutManager; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import android.content.Intent; | |||
import android.graphics.Bitmap; | |||
import android.graphics.BitmapFactory; | |||
@@ -16,7 +10,14 @@ import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.widget.Button; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.recyclerview.widget.LinearLayoutManager; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.FileActivity; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.Constants; | |||
import com.bonait.bnframework.common.filepicker.PickerManager; | |||
@@ -25,12 +26,12 @@ import com.bonait.bnframework.common.filepicker.adapter.OnFileItemClickListener; | |||
import com.bonait.bnframework.common.filepicker.model.FileEntity; | |||
import com.bonait.bnframework.common.filepicker.model.FileType; | |||
import com.bonait.bnframework.common.image.utils.LocalCacheUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.ViewModel.ActivityViewModel.FileActivity; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import com.orhanobut.logger.Logger; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.text.DecimalFormat; | |||
import java.util.ArrayList; | |||
import butterknife.BindView; | |||
@@ -47,6 +48,8 @@ public class systeminternetfragment extends BaseFragment { | |||
RecyclerView rl_yx_file; | |||
@BindView(R.id.baocunbendi) | |||
Button baocunbendi; | |||
@BindView(R.id.delete_all) | |||
Button delete_all; | |||
private Context context; | |||
@Override | |||
@@ -64,7 +67,7 @@ public class systeminternetfragment extends BaseFragment { | |||
FlushedImage(); | |||
} | |||
@OnClick({R.id.xuanzhewenjian, R.id.baocunbendi}) | |||
@OnClick({R.id.xuanzhewenjian, R.id.baocunbendi,R.id.delete_all}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()) { | |||
case R.id.xuanzhewenjian://保存按钮 | |||
@@ -82,7 +85,25 @@ public class systeminternetfragment extends BaseFragment { | |||
} catch (Exception e) { | |||
} | |||
} | |||
ToastUtils.info("添加成功!"); | |||
NewToastUtil.getInstance().showToast("添加成功!"); | |||
FlushedImage(); | |||
break; | |||
case R.id.delete_all: | |||
LogUtils.d(" yx_files="+yx_files.toString()); | |||
if(!yx_files.isEmpty()){ | |||
for (int i =0;i<yx_files.size();i++){ | |||
File file= yx_files.get(i).getFile(); | |||
if (file.exists() && file.isFile()) | |||
{ | |||
file.delete(); | |||
} | |||
} | |||
yx_files.clear(); | |||
if(rl_yx_file!=null&& rl_yx_file.getAdapter()!=null){ | |||
rl_yx_file.getAdapter().notifyDataSetChanged(); | |||
} | |||
} | |||
delete_all.setText("删除所有缓存图片"); | |||
break; | |||
} | |||
} | |||
@@ -90,7 +111,7 @@ public class systeminternetfragment extends BaseFragment { | |||
ArrayList<FileEntity> yx_files = new ArrayList<>(); | |||
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblxiaochaodb/WebImage"; | |||
public void FlushedImage() { | |||
private void FlushedImage() { | |||
File path = new File(CACHE_PATH);// 获得路径 | |||
File[] files = path.listFiles();// 读取文件 | |||
yx_files.clear(); | |||
@@ -127,6 +148,40 @@ public class systeminternetfragment extends BaseFragment { | |||
// startActivity(intent); | |||
} | |||
}); | |||
delete_all.setText("已缓存:"+getCacheSize()+"\n删除所有缓存图片"); | |||
} | |||
private String getCacheSize(){ | |||
String sizeString = ""; | |||
try { | |||
File folder = new File(CACHE_PATH); // 替换为你的文件夹路径 | |||
long folderSize = getFolderSize(folder); | |||
sizeString = formatSize(folderSize); // 将大小转换为可读的格式(可选) | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
} | |||
return sizeString; | |||
} | |||
private long getFolderSize(File dir) { | |||
long size = 0; | |||
if (dir != null && dir.isDirectory()) { | |||
File[] files = dir.listFiles(); | |||
for (File file : files) { | |||
if (file.isFile()) { | |||
size += file.length(); | |||
} else if (file.isDirectory()) { | |||
size += getFolderSize(file); // 递归调用以获取子文件夹的大小 | |||
} | |||
} | |||
} | |||
return size; | |||
} | |||
private String formatSize(long size) { | |||
if (size <= 0) return "0 Bytes"; | |||
final String[] units = {"Bytes", "KB", "MB", "GB", "TB"}; | |||
int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); | |||
return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; | |||
} | |||
private static boolean checkExits(String path) { | |||
@@ -14,13 +14,19 @@ import com.bonait.bnframework.common.constant.Constants; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_USER; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.helper.CrashHandler; | |||
import com.bonait.bnframework.common.helper.SdCart; | |||
import com.bonait.bnframework.common.notification.MainNotification; | |||
@@ -282,10 +288,22 @@ public class MainInit { | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SILOS.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SILOSANDMATERIAL.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SILOS_CALIBRATE.class,null); | |||
GoodsClassifyDBUtil.deleteAllGoodsData(); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_MATERIAL.class,"id"); | |||
clearGoodsInfo(); | |||
InitDBdata(); | |||
} | |||
public static void clearGoodsInfo(){ | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODSRECIPE.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_CLASSIFY.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ATTRIBUTE.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBATTRIBUTE.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_SUBATTRIBUTE_GROUP.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_OLD.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_PROCESS_DETAIL.class,null); | |||
} | |||
/** | |||
* 初始化消息日志接收打印 | |||
*/ | |||
@@ -170,8 +170,8 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(50); | |||
} | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
if(isTest&& IsStart){ | |||
Thread.sleep(1000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"完成")); | |||
LogUtils.d("wait reset 物料结束时间 "+(System.currentTimeMillis()-a)); | |||
@@ -304,9 +304,9 @@ public class NewExecuteTheRecipe { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("搅拌档位")){ | |||
if(value.contains("档")){ | |||
position = Integer.parseInt(value.replace("档",""))*10; | |||
position = Integer.parseInt(value.replace("档","")); | |||
}else { | |||
position = Integer.parseInt(value)*10; | |||
position = Integer.parseInt(value); | |||
} | |||
}else if(key.contains("正转")){ | |||
type= 0; | |||
@@ -315,7 +315,7 @@ public class NewExecuteTheRecipe { | |||
} | |||
} | |||
String tip = type==0?"正转":"反转"; | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "搅拌控制," + tip+";档位,"+position/10+"档"); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "搅拌控制," + tip+";档位,"+position+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().setStirModel(type); | |||
} | |||
@@ -337,23 +337,28 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop && !isTest){ | |||
while (IsStart&&isStop && !isTest){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
Thread.sleep(50); | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
if(isTest && IsStart){ | |||
Thread.sleep(1000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"停止搅拌")); | |||
} | |||
} | |||
} | |||
if (val > 0) { | |||
Thread.sleep(val * 1000L); | |||
if (val > 0 && IsStart) { | |||
for(int i = 0;i<val*2 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
Thread.sleep(500L); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -378,9 +383,9 @@ public class NewExecuteTheRecipe { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("搅拌档位")){ | |||
if(value.contains("档")){ | |||
position = Integer.parseInt(value.replace("档",""))*10; | |||
position = Integer.parseInt(value.replace("档","")); | |||
}else { | |||
position = Integer.parseInt(value)*10; | |||
position = Integer.parseInt(value); | |||
} | |||
}else if(key.contains("正转时间")){ | |||
time1= Integer.parseInt(value); | |||
@@ -388,7 +393,7 @@ public class NewExecuteTheRecipe { | |||
time2= Integer.parseInt(value); | |||
} | |||
} | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "搅拌控制,正反转切换;档位,"+position/10+"档"); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "搅拌控制,正反转切换;档位,"+position+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().setStirModel(2); | |||
ModbusHelper.get().setStirTime(1,time1); | |||
@@ -412,23 +417,28 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop &&!isTest){ | |||
while (IsStart&&isStop &&!isTest){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | |||
Thread.sleep(50); | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
if(IsStart && isTest){ | |||
Thread.sleep(1000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"停止搅拌")); | |||
} | |||
} | |||
} | |||
if (val > 0) { | |||
Thread.sleep(val * 1000L); | |||
if (val > 0 && IsStart) { | |||
for(int i = 0;i<val*2 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
Thread.sleep(500L); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -464,9 +474,6 @@ public class NewExecuteTheRecipe { | |||
if(!isTest){ | |||
ModbusHelper.get().addMainFood(position); | |||
} | |||
if (val > 0) { | |||
Thread.sleep(val * 1000L); | |||
} | |||
boolean isCHeckSilosEnd = false;//主料是否复位 | |||
long a = System.currentTimeMillis(); | |||
@@ -478,12 +485,19 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(50); | |||
} | |||
} | |||
if(isTest){ | |||
if(IsStart && isTest){ | |||
Thread.sleep(1000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(3,"完成")); | |||
Log.d("烹饪时间", "烹饪时间完成了"); | |||
if (val > 0 && IsStart) { | |||
for(int i = 0;i<val*2 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
Thread.sleep(500L); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -524,9 +538,9 @@ public class NewExecuteTheRecipe { | |||
val = Integer.parseInt(value); | |||
} else if(key.contains("档位")){ | |||
if(value.contains("档")){ | |||
hotNum = Integer.parseInt(value.replace("档",""))*10; | |||
hotNum = Integer.parseInt(value.replace("档","")); | |||
}else { | |||
hotNum = Integer.parseInt(value)*10; | |||
hotNum = Integer.parseInt(value); | |||
} | |||
}else { | |||
if(value.contains("启动")){ | |||
@@ -537,15 +551,20 @@ public class NewExecuteTheRecipe { | |||
} | |||
} | |||
String tip = startHot? "启动加热":"停止加热"; | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "加热控制," + tip+";档位,"+hotNum/10+"档"); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "加热控制," + tip+";档位,"+hotNum+"档"); | |||
if(!isTest){ | |||
ModbusHelper.get().Heating(hotNum,startHot); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(1,tip+"|"+hotNum/10)); | |||
EventBus.getDefault().post(new ProcessMakingEvent(1,tip+"|"+hotNum)); | |||
if (val > 0) { | |||
Thread.sleep(val * 1000L); | |||
if (val > 0 && IsStart) { | |||
for(int i = 0;i<val*2 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
Thread.sleep(500L); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
@@ -585,8 +604,8 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(100); | |||
} | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
if(IsStart && isTest){ | |||
Thread.sleep(1000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"完成")); | |||
LogUtils.d("wait reset 结束加水时间 "+(System.currentTimeMillis()-a)); | |||
@@ -624,9 +643,16 @@ public class NewExecuteTheRecipe { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
NewToastUtil.getInstance().showToastBottom("工序:" + "等待"+value+"秒"); | |||
if (key.contains("(秒)")) { | |||
if (IsStart && key.contains("(秒)")) { | |||
int val = Integer.parseInt(value); | |||
Thread.sleep(val * 1000); | |||
if (val > 0 && IsStart) { | |||
for(int i = 0;i<val*2 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
Thread.sleep(500L); | |||
} | |||
} | |||
} | |||
} | |||
} catch (Exception ex) { | |||
@@ -647,7 +673,7 @@ public class NewExecuteTheRecipe { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
NewToastUtil.getInstance().showToastBottom("工序: 等待"+value+"秒后出菜"); | |||
if (key.contains("(秒)")) { | |||
if (IsStart && key.contains("(秒)")) { | |||
int val = Integer.parseInt(value); | |||
Thread.sleep(val * 1000); | |||
} | |||
@@ -657,7 +683,7 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop){ | |||
while (IsStart && isStop){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
@@ -704,8 +730,8 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(100); | |||
} | |||
} | |||
if(isTest){ | |||
Thread.sleep(2000); | |||
if(IsStart && isTest){ | |||
Thread.sleep(1000); | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(2,"完成")); | |||
LogUtils.d("wait reset 结束勾芡时间 "+(System.currentTimeMillis()-a)); | |||
@@ -757,15 +783,20 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop&&!isTest){ | |||
while (IsStart && isStop&&!isTest){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(1); | |||
Thread.sleep(100); | |||
} | |||
if(isTest){ | |||
Thread.sleep(8000); | |||
if(IsStart && isTest){ | |||
for(int i = 0;i<16 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
Thread.sleep(500L); | |||
} | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"升降完成")); | |||
}else { | |||
@@ -776,22 +807,32 @@ public class NewExecuteTheRecipe { | |||
Thread.sleep(50); | |||
boolean isStop = true; | |||
long lastTime = System.currentTimeMillis(); | |||
while (isStop && !isTest){ | |||
while (IsStart && isStop && !isTest){ | |||
if(System.currentTimeMillis() - lastTime > 30*1000){ | |||
break; | |||
} | |||
isStop = ConfigName.TEST?false: ModbusHelper.get().readUpdDownStop(2); | |||
Thread.sleep(100); | |||
} | |||
if(isTest){ | |||
Thread.sleep(8000); | |||
if(IsStart && isTest){ | |||
for(int i = 0;i<16 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
Thread.sleep(500L); | |||
} | |||
} | |||
EventBus.getDefault().post(new ProcessMakingEvent(4,"升降完成")); | |||
} | |||
} | |||
} | |||
if(val > 0){ | |||
Thread.sleep(val * 1000L); | |||
if (val > 0 && IsStart) { | |||
for(int i = 0;i<val*2 ;i++){ | |||
if(!IsStart){ | |||
break; | |||
} | |||
Thread.sleep(500L); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
LogUtils.d("异常信息:" + ex.getMessage()); | |||
@@ -55,7 +55,7 @@ public class ConfigName { | |||
public boolean isFastClick(){ | |||
long curTime = System.currentTimeMillis(); | |||
if(curTime - lastTime < 250){ | |||
if(curTime - lastTime < 350){ | |||
return true; | |||
} | |||
lastTime = curTime; | |||
@@ -1,5 +1,6 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import com.apkfuns.logutils.LogUtils; | |||
@@ -7,8 +8,11 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
@@ -29,6 +33,61 @@ public class AttributeDBUtil { | |||
return QueryDB.Add(BPA_ATTRIBUTE.class, data); | |||
} | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addList( List<BPA_ATTRIBUTE> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
try { | |||
long insert=-1; | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
ContentValues cv = new ContentValues(); | |||
Map<String, Object> map = Tools.getObjValue(list.get(i)); | |||
if (map.get("id").toString().isEmpty()) | |||
return false; | |||
for (String key : map.keySet()) { | |||
Object value = map.get(key); | |||
if (value instanceof String) { | |||
cv.put(key, (String) value); | |||
} else if (value instanceof Integer) { | |||
cv.put(key, ((Integer) value).intValue()); | |||
} else if (value instanceof Double) { | |||
cv.put(key, ((Double) value).doubleValue()); | |||
} else if (value instanceof Float) { | |||
cv.put(key, ((Float) value).floatValue()); | |||
} else if (value instanceof Long) { | |||
cv.put(key, ((Long) value).longValue()); | |||
} else if (value instanceof Boolean) { | |||
cv.put(key, ((Boolean) value).booleanValue()); | |||
} | |||
} | |||
insert = db.insertOrThrow(BPA_ATTRIBUTE.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 修改属性数据 | |||
* add fengyoufu 20230413 | |||
@@ -1,11 +1,19 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import android.util.Log; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
@@ -23,7 +31,60 @@ public class GoodsClassifyDBUtil { | |||
return QueryDB.Add(BPA_GOODS_CLASSIFY.class, data); | |||
} | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addList( List<BPA_GOODS_CLASSIFY> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
try { | |||
long insert=-1; | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
ContentValues cv = new ContentValues(); | |||
Map<String, Object> map = Tools.getObjValue(list.get(i)); | |||
if (map.get("id").toString().isEmpty()) | |||
return false; | |||
for (String key : map.keySet()) { | |||
Object value = map.get(key); | |||
if (value instanceof String) { | |||
cv.put(key, (String) value); | |||
} else if (value instanceof Integer) { | |||
cv.put(key, ((Integer) value).intValue()); | |||
} else if (value instanceof Double) { | |||
cv.put(key, ((Double) value).doubleValue()); | |||
} else if (value instanceof Float) { | |||
cv.put(key, ((Float) value).floatValue()); | |||
} else if (value instanceof Long) { | |||
cv.put(key, ((Long) value).longValue()); | |||
} else if (value instanceof Boolean) { | |||
cv.put(key, ((Boolean) value).booleanValue()); | |||
} | |||
} | |||
insert = db.insertOrThrow(BPA_GOODS_CLASSIFY.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 修改商品分类数据 | |||
* | |||
@@ -43,6 +104,41 @@ public class GoodsClassifyDBUtil { | |||
return QueryDB.Delete(BPA_GOODS_CLASSIFY.class, data.id); | |||
} | |||
/** | |||
* 删除 | |||
* | |||
* @return | |||
*/ | |||
public static boolean DeleteList(List<BPA_GOODS_CLASSIFY> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
boolean isSucess = true; | |||
try { | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
if(!list.get(i).id.isEmpty()){ | |||
long delete = db.delete(BPA_GOODS_CLASSIFY.class.getSimpleName(), "id = ?", | |||
new String[]{list.get(i).id}); | |||
if(delete<=0){ | |||
isSucess = false; | |||
} | |||
} | |||
} | |||
db.setTransactionSuccessful(); | |||
return isSucess; | |||
} catch (Exception e) { | |||
Log.d("删除异常", "删除异常: " + e.getMessage()); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 删除商品分类数据 | |||
* | |||
@@ -88,6 +184,26 @@ public class GoodsClassifyDBUtil { | |||
} | |||
/** | |||
* 根据商品分类name获取商品分类 | |||
* | |||
* @param name | |||
* @return BPA_GOODS_CLASSIFY | |||
*/ | |||
public static ArrayList<BPA_GOODS_CLASSIFY> getListByName(String name) { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and name=?"; | |||
String[] args = new String[]{"0", name}; | |||
ArrayList<BPA_GOODS_CLASSIFY> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_CLASSIFY.class, where, args, orderby); | |||
for(Object bean : obj){ | |||
data.add((BPA_GOODS_CLASSIFY) bean); | |||
} | |||
return data; | |||
} | |||
/** | |||
* 根据分类classifyId获取商品分类列表 | |||
* | |||
@@ -1,5 +1,6 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import com.apkfuns.logutils.LogUtils; | |||
@@ -7,8 +8,11 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
@@ -27,6 +31,61 @@ public class GoodsDBUtil { | |||
return QueryDB.Add(BPA_GOODS.class, data); | |||
} | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addList( List<BPA_GOODS> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
try { | |||
long insert=-1; | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
ContentValues cv = new ContentValues(); | |||
Map<String, Object> map = Tools.getObjValue(list.get(i)); | |||
if (map.get("id").toString().isEmpty()) | |||
return false; | |||
for (String key : map.keySet()) { | |||
Object value = map.get(key); | |||
if (value instanceof String) { | |||
cv.put(key, (String) value); | |||
} else if (value instanceof Integer) { | |||
cv.put(key, ((Integer) value).intValue()); | |||
} else if (value instanceof Double) { | |||
cv.put(key, ((Double) value).doubleValue()); | |||
} else if (value instanceof Float) { | |||
cv.put(key, ((Float) value).floatValue()); | |||
} else if (value instanceof Long) { | |||
cv.put(key, ((Long) value).longValue()); | |||
} else if (value instanceof Boolean) { | |||
cv.put(key, ((Boolean) value).booleanValue()); | |||
} | |||
} | |||
insert = db.insertOrThrow(BPA_GOODS.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 修改商品数据 | |||
* | |||
@@ -1,5 +1,6 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import com.apkfuns.logutils.LogUtils; | |||
@@ -8,9 +9,11 @@ import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
@@ -31,6 +34,62 @@ public class SubAttributeDBUtil { | |||
return QueryDB.Add(BPA_SUBATTRIBUTE.class, data); | |||
} | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addList( List<BPA_SUBATTRIBUTE> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
try { | |||
long insert=-1; | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
ContentValues cv = new ContentValues(); | |||
Map<String, Object> map = Tools.getObjValue(list.get(i)); | |||
if (map.get("id").toString().isEmpty()) | |||
return false; | |||
for (String key : map.keySet()) { | |||
Object value = map.get(key); | |||
if (value instanceof String) { | |||
cv.put(key, (String) value); | |||
} else if (value instanceof Integer) { | |||
cv.put(key, ((Integer) value).intValue()); | |||
} else if (value instanceof Double) { | |||
cv.put(key, ((Double) value).doubleValue()); | |||
} else if (value instanceof Float) { | |||
cv.put(key, ((Float) value).floatValue()); | |||
} else if (value instanceof Long) { | |||
cv.put(key, ((Long) value).longValue()); | |||
} else if (value instanceof Boolean) { | |||
cv.put(key, ((Boolean) value).booleanValue()); | |||
} | |||
} | |||
insert = db.insertOrThrow(BPA_SUBATTRIBUTE.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 修改子属性数据 | |||
@@ -1,5 +1,6 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import com.apkfuns.logutils.LogUtils; | |||
@@ -8,9 +9,11 @@ import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
@@ -30,6 +33,61 @@ public class SubAttributeGroupDBUtil { | |||
return QueryDB.Add(BPA_GOODS_SUBATTRIBUTE_GROUP.class, data); | |||
} | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addList( List<BPA_GOODS_SUBATTRIBUTE_GROUP> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
try { | |||
long insert=-1; | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
ContentValues cv = new ContentValues(); | |||
Map<String, Object> map = Tools.getObjValue(list.get(i)); | |||
if (map.get("id").toString().isEmpty()) | |||
return false; | |||
for (String key : map.keySet()) { | |||
Object value = map.get(key); | |||
if (value instanceof String) { | |||
cv.put(key, (String) value); | |||
} else if (value instanceof Integer) { | |||
cv.put(key, ((Integer) value).intValue()); | |||
} else if (value instanceof Double) { | |||
cv.put(key, ((Double) value).doubleValue()); | |||
} else if (value instanceof Float) { | |||
cv.put(key, ((Float) value).floatValue()); | |||
} else if (value instanceof Long) { | |||
cv.put(key, ((Long) value).longValue()); | |||
} else if (value instanceof Boolean) { | |||
cv.put(key, ((Boolean) value).booleanValue()); | |||
} | |||
} | |||
insert = db.insertOrThrow(BPA_GOODS_SUBATTRIBUTE_GROUP.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 修改子属性组合数据 | |||
@@ -13,6 +13,7 @@ import android.os.SystemClock; | |||
import android.util.Log; | |||
import android.widget.Toast; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import java.io.File; | |||
@@ -193,6 +194,7 @@ public class CrashHandler implements UncaughtExceptionHandler { | |||
String fileName = "crash-" + time + ".log"; | |||
if (FileUtil.hasSdcard()) { | |||
String path = getGlobalpath(); | |||
LogUtils.d("writeFile path="+path); | |||
File dir = new File(path); | |||
if (!dir.exists()) | |||
dir.mkdirs(); | |||
@@ -1,15 +1,10 @@ | |||
package com.bonait.bnframework.common.image; | |||
import android.graphics.Bitmap; | |||
import android.widget.ImageView; | |||
import com.bin.david.form.data.form.IForm; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.image.utils.LocalCacheUtils; | |||
import com.bonait.bnframework.common.image.utils.MemoryCacheUtils; | |||
import com.bonait.bnframework.common.image.utils.NetCacheUtils; | |||
import com.bonait.bnframework.common.view.CircleImageView; | |||
import com.qmuiteam.qmui.widget.QMUIRadiusImageView2; | |||
import java.util.regex.Matcher; | |||
import java.util.regex.Pattern; | |||
@@ -19,17 +14,14 @@ import java.util.regex.Pattern; | |||
*/ | |||
public class MyBitmapUtils { | |||
private NetCacheUtils mNetCacheUtils; | |||
private LocalCacheUtils mLocalCacheUtils; | |||
private MemoryCacheUtils mMemoryCacheUtils; | |||
public MyBitmapUtils(){ | |||
mMemoryCacheUtils=new MemoryCacheUtils(); | |||
mLocalCacheUtils=new LocalCacheUtils(); | |||
mNetCacheUtils=new NetCacheUtils(mLocalCacheUtils,mMemoryCacheUtils); | |||
mNetCacheUtils=new NetCacheUtils(); | |||
} | |||
public void disPlay(ImageView ivPic, String url) { | |||
ivPic.setImageResource(R.mipmap.loading123); | |||
Bitmap bitmap; | |||
ivPic.setImageResource(R.mipmap.loading2); | |||
//内存缓存 | |||
String name=""; | |||
//https://hbl-1305371387.cos.ap-chengdu.myqcloud.com/Franchisee/jccy@163.com/goods/133381212328681942.jpg | |||
@@ -41,65 +33,20 @@ public class MyBitmapUtils { | |||
name=url; | |||
} | |||
bitmap=mMemoryCacheUtils.getBitmapFromMemory(name); | |||
if (bitmap!=null){ | |||
ivPic.setImageBitmap(bitmap); | |||
System.out.println("从内存获取图片啦....."); | |||
return; | |||
} | |||
//本地缓存 | |||
bitmap = mLocalCacheUtils.getBitmapFromLocal(name); | |||
if(bitmap !=null){ | |||
ivPic.setImageBitmap(bitmap); | |||
System.out.println("从本地获取图片啦....."); | |||
//从本地获取图片后,保存至内存中 | |||
mMemoryCacheUtils.setBitmapToMemory(name,bitmap); | |||
return; | |||
} | |||
//网络缓存 | |||
if(url.contains("http")) | |||
{ | |||
mNetCacheUtils.getBitmapFromNet(ivPic,url); | |||
} | |||
} | |||
public void disPlay(CircleImageView ivPic, String url) { | |||
ivPic.setImageResource(R.mipmap.loading123); | |||
Bitmap bitmap; | |||
//内存缓存 | |||
String name=""; | |||
//https://hbl-1305371387.cos.ap-chengdu.myqcloud.com/Franchisee/jccy@163.com/goods/133381212328681942.jpg | |||
if(url.contains("http")) | |||
if(url!=null && !url.isEmpty()) | |||
{ | |||
name=url.substring(url.lastIndexOf('/')+1); | |||
}else | |||
{ | |||
name=url; | |||
} | |||
bitmap=mMemoryCacheUtils.getBitmapFromMemory(name); | |||
if (bitmap!=null){ | |||
ivPic.setImageBitmap(bitmap); | |||
System.out.println("从内存获取图片啦....."); | |||
return; | |||
} | |||
if(LocalCacheUtils.Get().SetBitmapFile(ivPic,name,url)){ | |||
return; | |||
} | |||
//本地缓存 | |||
bitmap = mLocalCacheUtils.getBitmapFromLocal(name); | |||
if(bitmap !=null){ | |||
ivPic.setImageBitmap(bitmap); | |||
System.out.println("从本地获取图片啦....."); | |||
//从本地获取图片后,保存至内存中 | |||
mMemoryCacheUtils.setBitmapToMemory(name,bitmap); | |||
return; | |||
} | |||
//网络缓存 | |||
if(url.contains("http")) | |||
{ | |||
mNetCacheUtils.getBitmapFromNet(ivPic,url); | |||
//网络缓存 | |||
if(url.contains("http")) | |||
{ | |||
mNetCacheUtils.getBitmapFromNet(ivPic,url); | |||
} | |||
} | |||
} | |||
/** | |||
* 判断字符串是否为URL | |||
* | |||
@@ -3,9 +3,16 @@ package com.bonait.bnframework.common.image.utils; | |||
import android.graphics.Bitmap; | |||
import android.graphics.BitmapFactory; | |||
import android.os.Environment; | |||
import android.widget.ImageView; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.helper.AES; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.NetworkUtils; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.glide.transform.FitXYRoundRadiusTransform; | |||
import com.bumptech.glide.Glide; | |||
import com.bumptech.glide.load.engine.DiskCacheStrategy; | |||
import com.bumptech.glide.request.RequestOptions; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
@@ -18,6 +25,55 @@ public class LocalCacheUtils { | |||
private static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblxiaochaodb/WebImage"; | |||
//region 私有单例 | |||
private static volatile LocalCacheUtils _instance; | |||
public static LocalCacheUtils Get() { | |||
if (_instance == null) | |||
_instance = new LocalCacheUtils(); | |||
return _instance; | |||
} | |||
/** | |||
* 设置Image图片 | |||
* | |||
* @param ivPic | |||
* @param name | |||
* @param url | |||
* @return | |||
*/ | |||
public boolean SetBitmapFile(ImageView ivPic, String name, String url) { | |||
File file = new File(CACHE_PATH, name); | |||
String imgUrl = null; | |||
if(url!=null && url.startsWith("http")){ | |||
if(NetworkUtils.isNetworkConnected(MainApplication.getContext())){ | |||
imgUrl = url; | |||
} | |||
} | |||
if (null != file && file.exists()) { | |||
try { | |||
LogUtils.d("加载图片"); | |||
Glide.with(ivPic.getContext()).load(imgUrl==null?file:imgUrl) | |||
//.override(width, height) | |||
// .thumbnail(0.1f) // 加载原始图片的10%作为缩略图 | |||
.fitCenter() // 缩放图片以适应ImageView的尺寸 | |||
// .override(150, 75) // 设置目标图片的宽度和高度 | |||
.placeholder(R.mipmap.loading3) | |||
// .error(R.mipmap.loadingerror) | |||
.skipMemoryCache(true) // 禁用内存缓存 | |||
.diskCacheStrategy(DiskCacheStrategy.NONE) | |||
.apply(new RequestOptions().transform(new FitXYRoundRadiusTransform(10))) | |||
//.diskCacheStrategy(DiskCacheStrategy.ALL) // 缓存所有版本的图片 | |||
.into(ivPic); | |||
System.out.println("从本地获取图片啦....."); | |||
return true; | |||
} catch (OutOfMemoryError e) { | |||
e.printStackTrace(); | |||
} catch (IllegalArgumentException ex) { | |||
System.out.println("界面已经销毁....."); | |||
} | |||
} | |||
return false; | |||
} | |||
/** | |||
* 从本地读取图片 | |||
* @param url | |||
@@ -40,30 +96,36 @@ public class LocalCacheUtils { | |||
return null; | |||
} | |||
/** | |||
* 从网络获取图片后,保存至本地缓存 | |||
* | |||
* @param url | |||
* @param bitmap | |||
*/ | |||
public void setBitmapToLocal(String url,Bitmap bitmap){ | |||
public String setBitmapToLocal(String url, Bitmap bitmap) { | |||
try { | |||
String fileName = url.substring(url.lastIndexOf('/')+1);;//MD5Encoder.encode(url);;//AES.Encrypt(url);//;MD5Encoder.encode(url);//把图片的url当做文件名,并进行MD5加密 | |||
File file=new File(CACHE_PATH,fileName); | |||
String fileName = url.substring(url.lastIndexOf('/') + 1); | |||
;//MD5Encoder.encode(url);;//AES.Encrypt(url);//;MD5Encoder.encode(url);//把图片的url当做文件名,并进行MD5加密 | |||
File file = new File(CACHE_PATH, fileName); | |||
//通过得到文件的父文件,判断父文件是否存在 | |||
File parentFile = file.getParentFile(); | |||
if (!parentFile.exists()){ | |||
if (!parentFile.exists()) { | |||
parentFile.mkdirs(); | |||
} | |||
if(!file.exists())//文件不存在 | |||
if (!file.exists())//文件不存在 | |||
{ | |||
//把图片保存至本地 | |||
bitmap.compress(Bitmap.CompressFormat.JPEG,100,new FileOutputStream(file)); | |||
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, new FileOutputStream(file)); | |||
} | |||
return fileName; | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
return ""; | |||
} | |||
} |
@@ -15,12 +15,9 @@ import java.net.URL; | |||
*/ | |||
public class NetCacheUtils { | |||
private LocalCacheUtils mLocalCacheUtils; | |||
private MemoryCacheUtils mMemoryCacheUtils; | |||
public NetCacheUtils(LocalCacheUtils localCacheUtils, MemoryCacheUtils memoryCacheUtils) { | |||
mLocalCacheUtils = localCacheUtils; | |||
mMemoryCacheUtils = memoryCacheUtils; | |||
public NetCacheUtils( ) { | |||
} | |||
/** | |||
@@ -73,14 +70,14 @@ public class NetCacheUtils { | |||
@Override | |||
protected void onPostExecute(Bitmap result) { | |||
if (result != null) { | |||
ivPic.setImageBitmap(result); | |||
System.out.println("从网络缓存图片啦....."); | |||
//从网络获取图片后,保存至本地缓存 | |||
mLocalCacheUtils.setBitmapToLocal(url, result); | |||
//保存至内存中 | |||
mMemoryCacheUtils.setBitmapToMemory(url, result); | |||
String filename= LocalCacheUtils.Get().setBitmapToLocal(url, result); | |||
//设置图片显示,用新版的获取更小的资源 | |||
LocalCacheUtils.Get().SetBitmapFile(ivPic,filename,null); | |||
} | |||
} | |||
} | |||
@@ -102,8 +99,12 @@ public class NetCacheUtils { | |||
if (responseCode == 200) { | |||
//图片压缩 | |||
BitmapFactory.Options options = new BitmapFactory.Options(); | |||
//options.inSampleSize=2;//宽高压缩为原来的1/2 | |||
options.inPreferredConfig=Bitmap.Config.RGB_565; | |||
options.inSampleSize=2;//宽高压缩为原来的1/2 | |||
options.inPreferredConfig=Bitmap.Config.ARGB_4444; | |||
// 设置是否深拷贝,与inPurgeable结合使用 | |||
options.inInputShareable = true; | |||
// 设置为True时,表示系统内存不足时可以被回 收,设置为False时,表示不能被回收。 | |||
options.inPurgeable = true; | |||
Bitmap bitmap = BitmapFactory.decodeStream(conn.getInputStream(),null,options); | |||
return bitmap; | |||
} | |||
@@ -22,9 +22,10 @@ public class AdbCommandUtil { | |||
public static void hideStatusBar(boolean hide) { | |||
ThreadManager.get().execute(new Thread(()->{ | |||
DataOutputStream dataOutputStream = null; | |||
Process process = null; | |||
try { | |||
// 申请su权限 | |||
Process process = Runtime.getRuntime().exec("su"); | |||
process = Runtime.getRuntime().exec("su"); | |||
dataOutputStream = new DataOutputStream(process.getOutputStream()); | |||
// 执行命令 | |||
String command = hide?"am broadcast -a action.HIDE_STATUSBAR":"am broadcast -a action.SHOW_STATUSBAR"; | |||
@@ -40,10 +41,46 @@ public class AdbCommandUtil { | |||
if (dataOutputStream != null) { | |||
dataOutputStream.close(); | |||
} | |||
if(process!=null){ | |||
process.destroy(); | |||
} | |||
} catch (IOException e) { | |||
Log.e("hideStatusBar", e.getMessage(), e); | |||
} | |||
} | |||
})); | |||
} | |||
public static void exec3(String... cmds) { | |||
StringBuffer command = new StringBuffer(); | |||
if (cmds.length <= 0) { | |||
return; | |||
} | |||
for (String cmd : cmds) { | |||
command.append(cmd).append("\n"); | |||
} | |||
Process process = null; | |||
DataOutputStream os = null; | |||
try { | |||
process = Runtime.getRuntime().exec("su"); | |||
// process = Runtime.getRuntime().exec("system/bin/su"); | |||
os = new DataOutputStream(process.getOutputStream()); | |||
os.write(command.toString().getBytes()); | |||
os.writeBytes("exit\n"); | |||
os.flush(); | |||
process.waitFor(); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
Log.e("eeee",""+e.toString()); | |||
} finally { | |||
try { | |||
os.close(); | |||
} catch (Exception e) { | |||
e.printStackTrace(); | |||
} | |||
if(process!=null){ | |||
process.destroy(); | |||
} | |||
} | |||
} | |||
} |
@@ -7,6 +7,7 @@ import android.os.Build; | |||
import androidx.core.content.FileProvider; | |||
import com.bonait.bnframework.BuildConfig; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.helper.Json; | |||
@@ -14,6 +15,7 @@ import com.bonait.bnframework.common.helper.mode.ResVersion; | |||
import com.bonait.bnframework.common.helper.mode.VersionMode; | |||
import com.bonait.bnframework.common.http.callback.files.FileProgressDialogCallBack; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.Response; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
@@ -50,44 +52,24 @@ public class UpdateAppUtils { | |||
*/ | |||
private static String description = ""; | |||
private static Context context; | |||
/** | |||
* 更新APP版本入口 | |||
*/ | |||
public static void updateApp(Context _context) { | |||
context=_context; | |||
public static void updateApp(Context _context,boolean showToast) { | |||
//获取当前app版本号 | |||
myVersionCode = ConfigName.getInstance().Version;//AppUtils.getVersionCode(context); | |||
myVersionCode = BuildConfig.VERSION_NAME;;//AppUtils.getVersionCode(context); | |||
//获取json转成Gson,并获取版本等信息 | |||
doPost(_context); | |||
doPost(_context,showToast); | |||
} | |||
/** | |||
* 请求后台服务器,检查apk版本 | |||
*/ | |||
private static void doPost(final Context context) { | |||
private static void doPost(final Context context,boolean showToast) { | |||
VersionMode mode=new VersionMode(); | |||
//大炒 | |||
// mode.productCode="1679306986915368960"; | |||
// mode.moduleCode="dcdjbbd"; | |||
// mode.serverCode="1680766359592243200"; | |||
// mode.branchCode="1679308856555737089"; | |||
//小炒网络v版本 | |||
// mode.productCode="1679306986915368960"; | |||
// mode.moduleCode="xcapp"; | |||
// mode.serverCode="1680766359592243200"; | |||
// mode.branchCode="1679307408505835521"; | |||
//小炒单击 | |||
mode.productCode="1679306986915368960"; | |||
mode.moduleCode="xcdjbbd"; | |||
mode.serverCode="1680766359592243200"; | |||
mode.branchCode="1679308917918404609"; | |||
// mode.productCode="1769564215952125952"; | |||
// mode.moduleCode="desktopplbt"; | |||
// mode.serverCode="1769564338190921728";//服务器 | |||
// mode.branchCode="1789857238682284033"; | |||
mode.productCode="1769564215952125952"; | |||
mode.moduleCode="disktopxcj"; | |||
mode.serverCode="1769564338190921728";//服务器 | |||
mode.branchCode="1789857112609894401"; | |||
String msg= new Json<VersionMode>().objectToJson(VersionMode.class, mode); | |||
String getNewVersionUrl =ConfigName.getInstance().UpdateVersion; | |||
@@ -106,16 +88,24 @@ public class UpdateAppUtils { | |||
//获取apk下载地址 | |||
downloadUrl = version.data.downloadLink; | |||
// 判断Apk是否是最新版本 | |||
if (compareVersions(serviceVersionCode, myVersionCode))//需要更新 | |||
serviceVersionCode = serviceVersionCode.replace(".",""); | |||
int serviceCode = Integer.parseInt(serviceVersionCode); | |||
int curCode = BuildConfig.VERSION_CODE; | |||
// if (compareVersions(serviceVersionCode, myVersionCode))//需要更新 | |||
if (serviceCode > curCode)//需要更新 | |||
{ | |||
showUpdateDialog(context); | |||
} else { | |||
ToastUtils.info("当前版本已是最新版本"); | |||
if(showToast){ | |||
NewToastUtil.getInstance().showToastBottom("当前版本已是最新版本"); | |||
} | |||
} | |||
}else | |||
{ | |||
ToastUtils.info("服务器没有版本"); | |||
if(showToast){ | |||
NewToastUtil.getInstance().showToastBottom("服务器没有版本"); | |||
} | |||
} | |||
} | |||
}); | |||
@@ -18,7 +18,6 @@ import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.Service.ModbusHelper; | |||
import com.bonait.bnframework.business.NewExecuteTheRecipe; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
@@ -34,6 +33,7 @@ import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.ActivityCookBinding; | |||
import com.bonait.bnframework.event.ProcessMakingEvent; | |||
import com.bonait.bnframework.ui.adapter.StepAdapter; | |||
import com.bonait.bnframework.ui.dialog.WaiteProgressDialog; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
@@ -71,6 +71,7 @@ public class CookingActivity extends BaseActivity { | |||
private CountDownTimerExt countDownTimer = null;//计时器 | |||
private final int MSG_Fresh_Step = 1000; | |||
private WaiteProgressDialog progressDialog; | |||
private Handler handler = new Handler(Looper.getMainLooper()){ | |||
@Override | |||
public void handleMessage(@NonNull Message msg) { | |||
@@ -99,8 +100,8 @@ public class CookingActivity extends BaseActivity { | |||
setContentView(viewBinding.getRoot()); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
EventBus.getDefault().register(this); | |||
initTopBar(); | |||
initData(); | |||
initTopBar(); | |||
initView(); | |||
} | |||
@@ -127,15 +128,26 @@ public class CookingActivity extends BaseActivity { | |||
viewBinding.goodname.setText(name); | |||
} | |||
viewBinding.startGoodmake.setOnClickListener(v->{ | |||
if (ConfigName.getInstance().isFastClick()) { | |||
NewToastUtil.getInstance().showToastBottom("点击太快了,请重试"); | |||
return; | |||
} | |||
if(!isMaking){ | |||
if (isFastClick()) { | |||
NewToastUtil.getInstance().showToastBottom("点击太快了,请重试"); | |||
return; | |||
} | |||
isMaking = true; | |||
NewExecuteTheRecipe.IsForcedEnd = false; | |||
onRecordStart(); | |||
}else { | |||
if(NewExecuteTheRecipe.IsStart){ | |||
if(progressDialog ==null){ | |||
progressDialog = new WaiteProgressDialog(this); | |||
}else { | |||
progressDialog.dismiss(); | |||
} | |||
progressDialog.setTitleAndMessage("烹饪中","正在停止制作,请耐心稍等..."); | |||
progressDialog.setCancelable(false); | |||
progressDialog.show(); | |||
} | |||
lastTime = System.currentTimeMillis(); | |||
isMaking = false; | |||
NewExecuteTheRecipe.IsForcedEnd = true; | |||
NewExecuteTheRecipe.IsStart = false; | |||
@@ -154,6 +166,17 @@ public class CookingActivity extends BaseActivity { | |||
viewBinding.recycleStep.setAdapter(stepAdapter); | |||
} | |||
private long lastTime; | |||
private boolean isFastClick(){ | |||
long curTime = System.currentTimeMillis(); | |||
if(curTime - lastTime < 3000){ | |||
return true; | |||
} | |||
lastTime = curTime; | |||
return false; | |||
} | |||
/** | |||
* 复位 | |||
*/ | |||
@@ -247,10 +270,13 @@ public class CookingActivity extends BaseActivity { | |||
break; | |||
} | |||
} | |||
Message message = new Message(); | |||
message.what = MSG_Fresh_Step; | |||
message.arg1 = position; | |||
handler.sendMessage(message); | |||
if(handler!=null){ | |||
Message message = new Message(); | |||
message.what = MSG_Fresh_Step; | |||
message.arg1 = position; | |||
handler.sendMessage(message); | |||
} | |||
boolean status = NewExecuteTheRecipe.Execute(item); | |||
position++; | |||
} | |||
@@ -268,22 +294,30 @@ public class CookingActivity extends BaseActivity { | |||
SubAttributeGroupDBUtil.updateMakeTime(goodsSubattributeGroup.id,time); | |||
goodsSubattributeGroup.maketime = time; | |||
} | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
setReset(); | |||
if(!isTest){ | |||
ModbusHelper.get().setCookStatus(false); | |||
} | |||
onRecordStop(); | |||
if (NewExecuteTheRecipe.IsForcedEnd)//强制结束 | |||
{ | |||
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已强制结束!!!"); | |||
}else{ | |||
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已制作完成!!!"); | |||
boolean finalIsError = isError; | |||
if(handler!=null){ | |||
handler.post(new Runnable() { | |||
@Override | |||
public void run() { | |||
setReset(); | |||
if(!isTest){ | |||
ModbusHelper.get().setCookStatus(false); | |||
} | |||
onRecordStop(); | |||
if (NewExecuteTheRecipe.IsForcedEnd)//强制结束 | |||
{ | |||
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已强制结束!!!"); | |||
}else{ | |||
if(!finalIsError){ | |||
NewToastUtil.getInstance().showToastBottom("客官,当前菜品已制作完成!!!"); | |||
} | |||
} | |||
if(progressDialog !=null){ | |||
progressDialog.dismiss(); | |||
} | |||
} | |||
} | |||
}); | |||
}); | |||
} | |||
} | |||
} | |||
})); | |||
@@ -316,13 +350,13 @@ public class CookingActivity extends BaseActivity { | |||
*/ | |||
public void onRecordStop() { | |||
viewBinding.startGoodmake.setImageResource(R.mipmap.zhizuo_ks); | |||
NewExecuteTheRecipe.IsStart = false; | |||
if (goodsSubattributeGroup != null) { | |||
SetProcess(goodsSubattributeGroup.maketime, 0); | |||
if (countDownTimer != null) { | |||
countDownTimer.stop(); | |||
countDownTimer = null; | |||
} | |||
NewExecuteTheRecipe.IsStart = false; | |||
} | |||
} | |||
@@ -388,7 +422,7 @@ public class CookingActivity extends BaseActivity { | |||
*/ | |||
private void initTopBar() { | |||
viewBinding.topbar.setBackgroundColor(ContextCompat.getColor(this, R.color.topbj1)); | |||
viewBinding.topbar.setTitle("菜品烹饪"); | |||
viewBinding.topbar.setTitle(isTest?"模拟烹饪":"菜品烹饪"); | |||
viewBinding.back.setOnClickListener(v->{ | |||
AlertDialogUtils.showTipDialog(this, "温馨提示!", "是否停止制作?", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
@@ -416,6 +450,10 @@ public class CookingActivity extends BaseActivity { | |||
@Override | |||
protected void onDestroy() { | |||
if(progressDialog !=null){ | |||
progressDialog.dismiss(); | |||
} | |||
progressDialog = null; | |||
if(!isTest){ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
ModbusHelper.get().reset(); | |||
@@ -432,6 +470,18 @@ public class CookingActivity extends BaseActivity { | |||
super.onDestroy(); | |||
EventBus.getDefault().unregister(this); | |||
if(stepList!=null){ | |||
stepList.clear(); | |||
stepList = null; | |||
} | |||
if(countDownTimer!=null){ | |||
countDownTimer.stop(); | |||
countDownTimer = null; | |||
} | |||
if(handler!=null){ | |||
handler.removeCallbacksAndMessages(null); | |||
handler = null; | |||
} | |||
} | |||
//接收工序执行步骤 | |||
@@ -257,6 +257,7 @@ public class DiyProcessActivity extends BaseActivity { | |||
attributeSelectDialog.setListener(new AttributeSelectDialog.DialogCallBack() { | |||
@Override | |||
public void submit() { | |||
processDetails.clear(); | |||
processDetails = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.setNewData(processDetails); | |||
@@ -618,6 +619,9 @@ public class DiyProcessActivity extends BaseActivity { | |||
processDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId)); | |||
stepAdapter.setCurrentPosition(0); | |||
stepAdapter.notifyDataSetChanged(); | |||
if(!processDetails.isEmpty()){ | |||
updateProcessSpinner(processDetails.get(0)); | |||
} | |||
} | |||
isFirst = false; | |||
} | |||
@@ -223,7 +223,8 @@ public class EditClassifyActivity extends BaseActivity { | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_add_classify,R.id.btn_update_attribute,R.id.btn_update_classify,R.id.btn_add_attribute,R.id.btn_delete_attribute,R.id.btn_add_subattribute,R.id.btn_delete_classify}) | |||
@OnClick({R.id.btn_add_classify,R.id.btn_update_attribute,R.id.btn_update_classify,R.id.btn_add_attribute, | |||
R.id.btn_delete_attribute,R.id.btn_add_subattribute,R.id.btn_delete_classify}) | |||
public void onViewClicked(View view) { | |||
switch (view.getId()){ | |||
@@ -351,6 +352,7 @@ public class EditClassifyActivity extends BaseActivity { | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(GoodsClassifyDBUtil.deleteById(classifyId)){ | |||
GoodsClassifyDBUtil.DeleteList(GoodsClassifyDBUtil.getListByName(classifyName)); | |||
AttributeDBUtil.deleteByClassifyId(classifyId); | |||
GoodsDBUtil.deleteByClassifyId(classifyId); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(classifyId); | |||
@@ -4,6 +4,7 @@ import android.content.Context; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.widget.FrameLayout; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.content.ContextCompat; | |||
@@ -63,6 +64,9 @@ public class EditGoodsActivity extends BaseActivity { | |||
* 初始化TopBar | |||
*/ | |||
private void initTopBar() { | |||
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) viewBinding.frame.getLayoutParams(); | |||
params.bottomMargin = 0; | |||
viewBinding.frame.setLayoutParams(params); | |||
viewBinding.topbar.setBackgroundColor(ContextCompat.getColor(this, R.color.topbj1)); | |||
viewBinding.topbar.setTitle("菜品管理"); | |||
viewBinding.back.setOnClickListener(v->{ | |||
@@ -132,7 +136,7 @@ public class EditGoodsActivity extends BaseActivity { | |||
if(index == 1){ | |||
fragment = LocalGoodsFragment.newInstance(true); | |||
}else { | |||
fragment = CloudGoodsFragment.newInstance(viewModel); | |||
fragment = CloudGoodsFragment.newInstance(viewModel,true); | |||
} | |||
getSupportFragmentManager().beginTransaction() | |||
.replace(R.id.frame, fragment) | |||
@@ -0,0 +1,136 @@ | |||
package com.bonait.bnframework.ui.activity; | |||
import android.os.Bundle; | |||
import android.view.MenuItem; | |||
import android.view.View; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.viewpager.widget.ViewPager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.ViewModel.Adapter.FragmentAdapter; | |||
import com.bonait.bnframework.ViewModel.FragmentViewModel.SystemDeviceinFragment; | |||
import com.bonait.bnframework.ViewModel.FragmentViewModel.SystemSeasoningsetFragment; | |||
import com.bonait.bnframework.ViewModel.FragmentViewModel.SystemSystemsetFragment; | |||
import com.bonait.bnframework.ViewModel.FragmentViewModel.systeminternetfragment; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.ActivitySystemSetBinding; | |||
import com.google.android.material.bottomnavigation.BottomNavigationView; | |||
/** | |||
* @author: liup | |||
* @description: 系统设置 | |||
* @date: 2024/5/30 15:31. | |||
*/ | |||
public class SystemSetActivity extends BaseActivity { | |||
private ActivitySystemSetBinding viewBinding; | |||
@Override | |||
protected void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
viewBinding = ActivitySystemSetBinding.inflate(getLayoutInflater()); | |||
setContentView(viewBinding.getRoot()); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initTopBar(); | |||
initView(); | |||
} | |||
private void initView(){ | |||
initFragment(); | |||
viewBinding.viewpager.addOnPageChangeListener(pageChangeListener); | |||
// 设置viewPager缓存多少个fragment | |||
viewBinding.viewpager.setOffscreenPageLimit(3); | |||
viewBinding.navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); | |||
} | |||
private void initTopBar(){ | |||
viewBinding.topbar.setTitle("系统设置"); | |||
viewBinding.back.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
finish(); | |||
} | |||
}); | |||
viewBinding.btnSubmit.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
String s=viewBinding.edittextQuanxian.getText().toString(); | |||
if (s==null ||s.isEmpty()) | |||
{ | |||
ToastUtils.warning("权限密码不能为空!"); | |||
}else | |||
{ | |||
if(s.equals(ConfigName.getInstance().user.pass)) | |||
{ | |||
viewBinding.rlQuanxian.setVisibility(View.GONE); | |||
viewBinding.viewpager.setVisibility(View.VISIBLE); | |||
}else | |||
{ | |||
ToastUtils.warning("权限密码不正确!"); | |||
} | |||
} | |||
} | |||
}); | |||
} | |||
/** | |||
* viewPager里添加fragment | |||
*/ | |||
private void initFragment() { | |||
FragmentAdapter fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | |||
fragmentAdapter.addFragment(new systeminternetfragment()); | |||
fragmentAdapter.addFragment(new SystemDeviceinFragment()); | |||
fragmentAdapter.addFragment(new SystemSystemsetFragment()); | |||
fragmentAdapter.addFragment(new SystemSeasoningsetFragment()); | |||
viewBinding.viewpager.setAdapter(fragmentAdapter); | |||
} | |||
/** | |||
* 配置bottom底部菜单栏监听器,手指点击底部菜单监听 | |||
*/ | |||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener | |||
= new BottomNavigationView.OnNavigationItemSelectedListener() { | |||
@Override | |||
public boolean onNavigationItemSelected(@NonNull MenuItem item) { | |||
switch (item.getItemId()) { | |||
case R.id.bottom_navigation_1: | |||
viewBinding.viewpager.setCurrentItem(0); | |||
return true; | |||
case R.id.bottom_navigation_2: | |||
viewBinding.viewpager.setCurrentItem(1); | |||
return true; | |||
case R.id.bottom_navigation_3: | |||
viewBinding.viewpager.setCurrentItem(2); | |||
return true; | |||
} | |||
return false; | |||
} | |||
}; | |||
/** | |||
* 配置ViewPager监听器,手指滑动监听 | |||
*/ | |||
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() { | |||
@Override | |||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
// MenuItem menuItem = viewBinding.navigation.getMenu().getItem(position); | |||
} | |||
@Override | |||
public void onPageSelected(int position) { | |||
viewBinding.navigation.getMenu().getItem(position).setChecked(true); | |||
} | |||
@Override | |||
public void onPageScrollStateChanged(int state) { | |||
} | |||
}; | |||
} |
@@ -13,6 +13,7 @@ import com.bonait.bnframework.common.base.BaseAdapter; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.glide.GlideUtil; | |||
import com.bonait.bnframework.common.image.MyBitmapUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.ItemCloudGoodsBinding; | |||
@@ -23,7 +24,8 @@ import com.bonait.bnframework.databinding.ItemCloudGoodsBinding; | |||
* @date: 2024/5/8 15:36. | |||
*/ | |||
public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoodsAdapter.GoodsViewHolder> { | |||
//图标 | |||
private MyBitmapUtils myBitmapUtils = new MyBitmapUtils(); | |||
@NonNull | |||
@Override | |||
@@ -46,6 +48,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||
if(url!=null && !url.isEmpty() &&!url.equals("未知")) | |||
{ | |||
GlideUtil.showImage(holder.binding.image.getContext(),url,holder.binding.image,R.mipmap.loading123); | |||
myBitmapUtils.disPlay(holder.binding.image,url); | |||
}else { | |||
holder.binding.image.setImageResource(R.mipmap.loading123); | |||
} | |||
@@ -162,18 +162,12 @@ public class AttributeSelectDialog extends DialogFragment { | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
for (BPA_GOODS_PROCESS_DETAIL bean: list){ | |||
BPA_GOODS_PROCESS_DETAIL newBean = new BPA_GOODS_PROCESS_DETAIL(); | |||
newBean.goodsSubAttributeGroupId = groupId; | |||
newBean.materialID = bean.materialID; | |||
newBean.processms = bean.processms; | |||
newBean.processname = bean.processname; | |||
newBean.processvalue = bean.processvalue; | |||
newBean.materialType = bean.materialType; | |||
newBean.value = bean.value; | |||
newBean.sort = bean.sort; | |||
GoodsProcessDetailDBUtil.add(newBean); | |||
GoodsProcessDetailDBUtil.removeList(GoodsProcessDetailDBUtil.getByGroupId(groupId)); | |||
for (int i=0;i<list.size();i++){ | |||
list.get(i).goodsSubAttributeGroupId = groupId; | |||
list.get(i).sort = i+1; | |||
} | |||
GoodsProcessDetailDBUtil.addList(list); | |||
xCom.dismissX(); | |||
dismiss(); | |||
if(listener!=null){ | |||
@@ -54,11 +54,11 @@ public class DeviceControlDialog extends DialogFragment { | |||
/** | |||
* 火力档位 | |||
*/ | |||
private int progressFire; | |||
private int progressFire = 0; | |||
/** | |||
* 搅拌档位 | |||
*/ | |||
private int progressStir; | |||
private int progressStir = 0; | |||
/** | |||
* 料仓号 | |||
*/ | |||
@@ -158,7 +158,7 @@ public class DeviceControlDialog extends DialogFragment { | |||
//开始加热 | |||
viewBinding.layoutFire.btnStartFire.setOnClickListener(view->{ | |||
NewToastUtil.getInstance().showToast("启动加热 档位:"+progressFire); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(progressFire*10,true))); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(progressFire,true))); | |||
BPA_GOODS_PROCESS_DETAIL detail = new BPA_GOODS_PROCESS_DETAIL(); | |||
detail.processname = "加热"; | |||
detail.materialType = 1; | |||
@@ -192,7 +192,8 @@ public class DeviceControlDialog extends DialogFragment { | |||
} | |||
viewBinding.layoutFire.fireProgress.setValue(progressFire,true); | |||
}); | |||
viewBinding.layoutFire.fireProgress.setValue(0,false); | |||
viewBinding.layoutFire.fireProgress.setValue(progressFire,false); | |||
viewBinding.layoutFire.fireProgress.setThumbText(progressFire+ ""); | |||
//档位条 | |||
viewBinding.layoutFire.fireProgress.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() { | |||
@Override | |||
@@ -448,6 +449,8 @@ public class DeviceControlDialog extends DialogFragment { | |||
viewBinding.layoutStir.btnClose1.setOnClickListener(v->{ | |||
dismiss(); | |||
}); | |||
viewBinding.layoutStir.stirProgress.setValue(progressStir,false); | |||
viewBinding.layoutStir.stirProgress.setThumbText(progressStir+ ""); | |||
viewBinding.layoutStir.stirProgress.setOnValueChangeListener(new NiftySlider.OnValueChangeListener() { | |||
@Override | |||
public void onValueChange(@NonNull NiftySlider niftySlider, float v, boolean b) { | |||
@@ -479,7 +482,12 @@ public class DeviceControlDialog extends DialogFragment { | |||
return; | |||
} | |||
NewToastUtil.getInstance().showToast("启动搅拌 档位:"+progressStir); | |||
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(progressStir*10,1))); | |||
ThreadManager.get().execute(new Thread(() -> { | |||
ModbusHelper.get().setStirModel(2); | |||
ModbusHelper.get().setStirTime(1,3); | |||
ModbusHelper.get().setStirTime(2,3); | |||
ModbusHelper.get().setStirMotor(progressStir,1); | |||
})); | |||
deviceCallBack.onClickEvent(type,"启动搅拌",0,detail); | |||
}); | |||
viewBinding.layoutStir.btnStirStop.setOnClickListener(v->{ | |||
@@ -166,7 +166,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
goods.url = picUrl; | |||
GoodsDBUtil.update(goods); | |||
EventBus.getDefault().post(new FreshLocalGoodPicEvent()); | |||
LogUtils.d(" btn_next1 attributeList="+attributeList); | |||
if(attributeList.isEmpty()){ | |||
changePage(3); | |||
}else { | |||
@@ -204,9 +204,11 @@ public class EditGoodsDialog extends DialogFragment { | |||
} | |||
break; | |||
case R.id.good_image: | |||
Intent intent = new Intent(getContext(), ImageChooseActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
if(isEdit){ | |||
Intent intent = new Intent(getContext(), ImageChooseActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
break; | |||
} | |||
} | |||
@@ -422,6 +424,9 @@ public class EditGoodsDialog extends DialogFragment { | |||
* 更新名称 | |||
*/ | |||
private void initView(){ | |||
if(goods!=null){ | |||
updateImage(picUrl); | |||
} | |||
viewBinding.layoutName.editName.setText(Objects.requireNonNull(GoodsDBUtil.getById(goodId)).name); | |||
if(!isEdit){ | |||
viewBinding.layoutName.editName.setEnabled(false); | |||
@@ -0,0 +1,63 @@ | |||
package com.bonait.bnframework.ui.dialog; | |||
import android.app.ProgressDialog; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.WindowManager; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogProgressWaiteBinding; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/5/31 0:33. | |||
*/ | |||
public class WaiteProgressDialog extends ProgressDialog { | |||
private DialogProgressWaiteBinding binding; | |||
private String title = ""; | |||
private String message = ""; | |||
public WaiteProgressDialog(Context context) { | |||
super(context); | |||
} | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
initView(); | |||
} | |||
private void initView(){ | |||
setCancelable(false); | |||
setCanceledOnTouchOutside(false); | |||
binding = DialogProgressWaiteBinding.inflate(getLayoutInflater()); | |||
setContentView(binding.getRoot()); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
WindowManager.LayoutParams params = getWindow().getAttributes(); | |||
params.width = WindowManager.LayoutParams.WRAP_CONTENT; | |||
params.height = WindowManager.LayoutParams.WRAP_CONTENT; | |||
getWindow().setAttributes(params); | |||
binding.title.setText(title); | |||
binding.message.setText(message); | |||
} | |||
public void setTitleAndMessage(String title,String message){ | |||
if(binding!=null){ | |||
binding.title.setText(title); | |||
binding.message.setText(message); | |||
} | |||
this.title = title; | |||
this.message = message; | |||
} | |||
@Override | |||
public void show() { | |||
super.show(); | |||
} | |||
@Override | |||
public void dismiss() { | |||
super.dismiss(); | |||
} | |||
} |
@@ -56,13 +56,10 @@ public class HomeFoodsFragment extends BaseFragment { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case 1: | |||
if(connect != ModbusHelper.get().getConnected() ){ | |||
viewBinding.topbar.removeAllRightViews(); | |||
if(ModbusHelper.get().getConnected()){ | |||
viewBinding.topbar.addRightTextButton("设备状态:未连接",R.id.status_image); | |||
}else { | |||
viewBinding.topbar.addRightTextButton("设备状态:已连接",R.id.status_image); | |||
} | |||
if(ModbusHelper.get().getConnected()){ | |||
viewBinding.tvConnect.setText("设备状态:未连接"); | |||
}else { | |||
viewBinding.tvConnect.setText("设备状态:已连接"); | |||
} | |||
if(hasMessages(1)){ | |||
removeMessages(1); | |||
@@ -98,7 +95,6 @@ public class HomeFoodsFragment extends BaseFragment { | |||
private void initTopBar() { | |||
viewBinding.topbar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.topbj1)); | |||
viewBinding.topbar.setTitle("菜谱"); | |||
viewBinding.topbar.addRightTextButton("设备状态:"+ (ModbusHelper.get().getConnected() ? "已连接" : "未连接"),R.id.status_image); | |||
viewBinding.back.setVisibility(View.GONE); | |||
handler.sendEmptyMessageDelayed(1,1000L); | |||
@@ -166,7 +162,7 @@ public class HomeFoodsFragment extends BaseFragment { | |||
if(index == 1){ | |||
fragment = LocalGoodsFragment.newInstance(false); | |||
}else { | |||
fragment = CloudGoodsFragment.newInstance(viewModel); | |||
fragment = CloudGoodsFragment.newInstance(viewModel,false); | |||
} | |||
getChildFragmentManager().beginTransaction() | |||
.replace(R.id.frame, fragment) | |||
@@ -10,23 +10,32 @@ import android.view.View; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.MainInit; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.databinding.FragmentCloudGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.CloudGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.WaiteProgressDialog; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import org.greenrobot.eventbus.Subscribe; | |||
import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
import java.util.Objects; | |||
@@ -43,10 +52,13 @@ public class CloudGoodsFragment extends BaseFragment { | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private static final int MSG_FRESH_GOODS= 1; | |||
private HomeGoodsViewModel viewModel; | |||
private WaiteProgressDialog progressDialog; | |||
private boolean isEdit = false; | |||
public static CloudGoodsFragment newInstance(HomeGoodsViewModel viewModel){ | |||
public static CloudGoodsFragment newInstance(HomeGoodsViewModel viewModel,boolean isEdit){ | |||
CloudGoodsFragment fragment = new CloudGoodsFragment(); | |||
fragment.viewModel = viewModel; | |||
fragment.isEdit = isEdit; | |||
return fragment; | |||
}; | |||
@@ -72,6 +84,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
EventBus.getDefault().register(this); | |||
initView(); | |||
initData(); | |||
updateData(); | |||
@@ -91,6 +104,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
@SuppressLint("NotifyDataSetChanged") | |||
private void initView(){ | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
viewBinding.btnSynchronizedData.setVisibility(isEdit?View.VISIBLE:View.GONE); | |||
viewBinding.btnFresh.setOnClickListener(v->{ | |||
if (ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
@@ -99,6 +113,31 @@ public class CloudGoodsFragment extends BaseFragment { | |||
NewToastUtil.getInstance().showToast("正在请求云端数据"); | |||
viewModel.fetchCloudData(getContext()); | |||
}); | |||
viewBinding.btnSynchronizedData.setOnClickListener(v->{ | |||
if (ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "数据同步", "下载云端所有菜品到本地,拥有相同的分类将会被覆盖,请确认?", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
if(progressDialog ==null){ | |||
progressDialog = new WaiteProgressDialog(getContext()); | |||
}else { | |||
progressDialog.dismiss(); | |||
} | |||
progressDialog.setTitleAndMessage("数据同步","正在同步数据,请耐心稍等..."); | |||
progressDialog.setCancelable(false); | |||
progressDialog.show(); | |||
viewModel.synchronizedCloudData(); | |||
} | |||
@Override | |||
public void onCancel() { | |||
} | |||
}); | |||
}); | |||
goodsAdapter = new CloudGoodsAdapter(){ | |||
@Override | |||
@@ -158,6 +197,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
goods.name = goodsInfoListBean.getGoodsName(); | |||
goods.id = goodsInfoListBean.getGoodsId(); | |||
goods.classifyId = bean.getGoodsTypeId(); | |||
goods.url = goodsInfoListBean.getImgUrl(); | |||
goodsList.add(goods); | |||
} | |||
break; | |||
@@ -171,6 +211,11 @@ public class CloudGoodsFragment extends BaseFragment { | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
if(progressDialog!=null){ | |||
progressDialog.dismiss(); | |||
} | |||
progressDialog = null; | |||
EventBus.getDefault().unregister(this); | |||
if(goodsList!=null){ | |||
goodsList.clear(); | |||
classifyList.clear(); | |||
@@ -205,5 +250,12 @@ public class CloudGoodsFragment extends BaseFragment { | |||
return true; | |||
} | |||
//同步成功 取消弹窗 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onGoodsChangeEvent(FreshLocalGoodsEvent event){ | |||
if(progressDialog!=null){ | |||
progressDialog.dismiss(); | |||
} | |||
updateData(); | |||
} | |||
} |
@@ -1,7 +1,6 @@ | |||
package com.bonait.bnframework.ui.fragment.goods; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.os.Handler; | |||
@@ -16,6 +15,7 @@ import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.MainInit; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
@@ -53,7 +53,6 @@ import java.util.ArrayList; | |||
*/ | |||
public class LocalGoodsFragment extends BaseFragment { | |||
private FragmentLocalGoodsBinding viewBinding; | |||
private Context context; | |||
private LocalGoodsAdapter goodsAdapter; | |||
private ClassifyAdapter classifyAdapter; | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
@@ -99,7 +98,6 @@ public class LocalGoodsFragment extends BaseFragment { | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context = getContext(); | |||
initView(); | |||
updateData(); | |||
EventBus.getDefault().register(this); | |||
@@ -113,6 +111,21 @@ public class LocalGoodsFragment extends BaseFragment { | |||
viewBinding.addClassify.setOnClickListener(view -> { | |||
jumpClassify(); | |||
}); | |||
viewBinding.deleteAll.setVisibility(isEdit?View.VISIBLE:View.GONE); | |||
viewBinding.deleteAll.setOnClickListener(v->{ | |||
AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "请确认", "确认删除所有商品信息?", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
MainInit.clearGoodsInfo(); | |||
updateData(); | |||
} | |||
@Override | |||
public void onCancel() { | |||
} | |||
}); | |||
}); | |||
goodsAdapter = new LocalGoodsAdapter(){ | |||
@@ -223,12 +236,15 @@ public class LocalGoodsFragment extends BaseFragment { | |||
classifyList.addAll(GoodsClassifyDBUtil.getAll()); | |||
if(!classifyList.isEmpty()){ | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList.get(0).id)); | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, classifyList.size()-1); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList.get(last2).id)); | |||
} | |||
goodsAdapter.setNewData(goodsList); | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
classifyAdapter.setCurrentPosition(last); | |||
int last2 = Math.min(last, classifyList.size()-1); | |||
classifyAdapter.setCurrentPosition(last2); | |||
classifyAdapter.setNewData(classifyList); | |||
} | |||
@@ -291,7 +307,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
} | |||
} | |||
//接收图片选择事件 | |||
//刷新数据 | |||
@Subscribe(threadMode = ThreadMode.MAIN) | |||
public void onGoodsChangeEvent(FreshLocalGoodsEvent event){ | |||
updateData(); | |||
@@ -32,8 +32,11 @@ import com.bonait.bnframework.common.db.util.MaterialUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
@@ -94,13 +97,19 @@ public class HomeGoodsViewModel extends ViewModel { | |||
}); | |||
} | |||
private static void GetMaterialInfo(){ | |||
private void GetMaterialInfo(){ | |||
String url = "https://cfv.black-pa.com/saasbase/api/ExternalPlatform/Material/GetMaterialPageList"; | |||
LogUtils.d("GetMaterialInfo url="+url); | |||
String key ="2c39bc05-25c2-46c4-b5c6-dba349058492"; | |||
long curTime5 = System.currentTimeMillis(); | |||
LogUtils.d(" GetMaterialInfo1 usetime="+(curTime5-lastTime)); | |||
lastTime = curTime5; | |||
APIHelper.PostT(url,new MaterialRequestPar(1,100),key,new TypeReference<APIResultT<MaterialData>>(){}).OnSource(s->{ | |||
UpdateLocalMaterial(s.Content); | |||
}); | |||
long curTime6 = System.currentTimeMillis(); | |||
LogUtils.d(" GetMaterialInfo2 usetime="+(curTime6-lastTime)); | |||
lastTime = curTime6; | |||
} | |||
private static void UpdateLocalMaterial(MaterialData materialModels){ | |||
@@ -132,16 +141,33 @@ public class HomeGoodsViewModel extends ViewModel { | |||
public void downLoadCloudGoods(BPA_GOODS goods, BPA_GOODS_CLASSIFY goodsClassify){ | |||
long curTime6 = System.currentTimeMillis(); | |||
LogUtils.d(" downLoadCloudGoods usetime="+(curTime6-lastTime)); | |||
lastTime = curTime6; | |||
//商品不存在情况 | |||
//判断分类是否存在 | |||
if(GoodsClassifyDBUtil.getByName(goodsClassify.name)==null){ | |||
if(GoodsClassifyDBUtil.getById(goodsClassify.id)==null){ | |||
GoodsClassifyDBUtil.add(goodsClassify); | |||
} | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goodsClassify.id)!=null){ | |||
NewToastUtil.getInstance().showToast("已有该商品,请先删除再【"+goods.name+"】,再下载"); | |||
return; | |||
} | |||
//添加商品 | |||
GoodsProcessDetailDBUtil.deleteByGoodsId(goods.id); | |||
SubAttributeGroupDBUtil.deleteByGoodsId(goods.id); | |||
GoodsDBUtil.add(goods); | |||
if(cloudGoodsList.getValue()==null){ | |||
return; | |||
} | |||
//添加属性 | |||
for (GoodsClassifyBean bean : ConfigName.getInstance().cloudGoodsList){ | |||
for (GoodsClassifyBean bean : cloudGoodsList.getValue()){ | |||
if(goodsClassify.id.equals(bean.getGoodsTypeId())){ | |||
if(AttributeDBUtil.getByClassify(goodsClassify.id).size() != bean.getGoodsAttributeList().size()){ | |||
NewToastUtil.getInstance().showToast("与本地【"+goodsClassify.name+"】分类的父属性数量不匹配,无法下载"); | |||
return; | |||
} | |||
Map<String ,String> subAttributeMap = new HashMap<>(); | |||
for(GoodsClassifyBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList() ){ | |||
//判断是否已有属性 不存在则添加 | |||
@@ -156,7 +182,8 @@ public class HomeGoodsViewModel extends ViewModel { | |||
LogUtils.d(" 已存在属性 "+goodsAttributeListBean.getGoodsAttributeName()); | |||
} | |||
//添加子属性 | |||
for(GoodsClassifyBean.GoodsAttributeListBean.GoodsAttributeValueListBean goodsAttributeValueListBean :goodsAttributeListBean.getGoodsAttributeValueList() ){ | |||
for(GoodsClassifyBean.GoodsAttributeListBean.GoodsAttributeValueListBean goodsAttributeValueListBean : | |||
goodsAttributeListBean.getGoodsAttributeValueList() ){ | |||
//判断是否已有子属性 不存在则添加 | |||
if(!SubAttributeDBUtil.isExist(goodsAttributeListBean.getGoodsAttributeId(),goodsAttributeValueListBean.getAttributeValue())){ | |||
BPA_SUBATTRIBUTE subattribute = new BPA_SUBATTRIBUTE(); | |||
@@ -172,26 +199,25 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
} | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
if(goodsInfoListBean.getGoodsName().equals(goods.name)){ | |||
List<String> groupList = new ArrayList<>(); | |||
GoodsProcessDetailDBUtil.deleteByGoodsId(goods.id); | |||
for (GoodsClassifyBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean:goodsInfoListBean.getGoodsTechnologyActionList()){ | |||
//添加子属性组合 | |||
//TODO 需确定getGoodsAttributeId 是用id列表还是name组合 app上新增的id和云端的肯定不匹配 建议用name组合 | |||
if(!groupList.contains(goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
if(!SubAttributeGroupDBUtil.isExist(goods.id,goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
group.name = goodsTechnologyActionListBean.getGoodsAttributeId();// | |||
group.goodsId = goods.id; | |||
groupList.add(goodsTechnologyActionListBean.getGoodsAttributeId()); | |||
SubAttributeGroupDBUtil.add(group); | |||
} | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
group.id = goodsTechnologyActionListBean.getGoodsAttributeId()==null?"xxxxx123":goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
group.name = GetRecipeName(goodsTechnologyActionListBean.getGoodsAttributeId(),bean.getGoodsAttributeList());// | |||
group.subAttributeIdList = goodsTechnologyActionListBean.getGoodsAttributeId()==null?"":goodsTechnologyActionListBean.getGoodsAttributeId();// | |||
group.goodsId = goods.id; | |||
groupList.add(goodsTechnologyActionListBean.getGoodsAttributeId()); | |||
SubAttributeGroupDBUtil.add(group); | |||
} | |||
//添加所有工序 | |||
BPA_GOODS_PROCESS_DETAIL processDetail = new BPA_GOODS_PROCESS_DETAIL(); | |||
processDetail.goodsSubAttributeGroupId = goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
processDetail.goodsSubAttributeGroupId = goodsTechnologyActionListBean.getGoodsAttributeId()==null?"xxxxx123":goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
processDetail.materialType = goodsTechnologyActionListBean.getStepName().contains("液体")?0:1; | |||
String value = ProcessValueUtil.dealProcessJsonToValue(goodsTechnologyActionListBean.getActionJson()); | |||
processDetail.processms = ""; | |||
@@ -205,21 +231,226 @@ public class HomeGoodsViewModel extends ViewModel { | |||
break; | |||
} | |||
} | |||
long curTime7 = System.currentTimeMillis(); | |||
LogUtils.d(" downLoadCloudGoods2 usetime="+(curTime7-lastTime)); | |||
lastTime = curTime7; | |||
} | |||
private long lastTime = System.currentTimeMillis(); | |||
public void synchronizedCloudData(){ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
try{ | |||
long curTime = System.currentTimeMillis(); | |||
LogUtils.d(" synchronizedCloudData1 usetime="+(curTime-lastTime)); | |||
lastTime = curTime; | |||
GoodTypeSynchronous(); | |||
long curTime2 = System.currentTimeMillis(); | |||
LogUtils.d(" synchronizedCloudData2 usetime="+(curTime2-lastTime)); | |||
lastTime = curTime2; | |||
GoodPropSynchronous(); | |||
long curTime3 = System.currentTimeMillis(); | |||
LogUtils.d(" synchronizedCloudData3 usetime="+(curTime3-lastTime)); | |||
lastTime = curTime3; | |||
GoodInfoSynchronous(); | |||
long curTime4 = System.currentTimeMillis(); | |||
LogUtils.d(" synchronizedCloudData3 usetime="+(curTime4-lastTime)); | |||
lastTime = curTime4; | |||
GoodRecipeSynchronous(); | |||
long curTime5 = System.currentTimeMillis(); | |||
LogUtils.d(" synchronizedCloudData3 usetime="+(curTime5-lastTime)); | |||
lastTime = curTime5; | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
NewToastUtil.getInstance().showToast("云端数据同步成功"); | |||
}catch (Exception e){ | |||
NewToastUtil.getInstance().showToast("云端数据同步失败"); | |||
e.printStackTrace(); | |||
} | |||
})); | |||
} | |||
/** | |||
* 同步云端商品分类到本地 | |||
*/ | |||
private void GoodTypeSynchronous(){ | |||
if(cloudGoodsList.getValue()==null){ | |||
return; | |||
} | |||
LogUtils.d("GoodTypeSynchronous1"); | |||
List<BPA_GOODS_CLASSIFY> datas = new ArrayList<>(); | |||
List<BPA_GOODS_CLASSIFY> dataHas = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
BPA_GOODS_CLASSIFY bpa_goodstype = new BPA_GOODS_CLASSIFY(); | |||
bpa_goodstype.name = item.getGoodsTypeName(); | |||
bpa_goodstype.id = item.getGoodsTypeId(); | |||
bpa_goodstype.userID="超级管理员"; | |||
datas.add(bpa_goodstype); | |||
if(item.getGoodsTypeName()!=null){ | |||
List<BPA_GOODS_CLASSIFY> bean = GoodsClassifyDBUtil.getListByName(item.getGoodsTypeName()); | |||
if(!bean.isEmpty()){ | |||
dataHas.addAll(bean); | |||
} | |||
} | |||
} | |||
//删除重复的分类 | |||
GoodsClassifyDBUtil.DeleteList(dataHas); | |||
for(BPA_GOODS_CLASSIFY bean : dataHas){ | |||
AttributeDBUtil.deleteByClassifyId(bean.id); | |||
GoodsDBUtil.deleteByClassifyId(bean.id); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(bean.id); | |||
SubAttributeDBUtil.deleteByClassifyId(bean.id); | |||
} | |||
//批量添加 | |||
GoodsClassifyDBUtil.addList(datas); | |||
} | |||
/** | |||
* 同步云端商品属性到本地 | |||
*/ | |||
private void GoodPropSynchronous(){ | |||
if(cloudGoodsList.getValue()==null){ | |||
return; | |||
} | |||
LogUtils.d("GoodPropSynchronous"); | |||
List<BPA_ATTRIBUTE> datas = new ArrayList<>(); | |||
List<BPA_SUBATTRIBUTE> dataSub = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
if(item.getGoodsAttributeList()!=null){ | |||
for(int n=0;n<item.getGoodsAttributeList().size();n++){ | |||
//属性添加 | |||
BPA_ATTRIBUTE bpa_goodproperty = new BPA_ATTRIBUTE(); | |||
bpa_goodproperty.name = item.getGoodsAttributeList().get(n).getGoodsAttributeName(); | |||
bpa_goodproperty.sort =n+1; | |||
bpa_goodproperty.id = item.getGoodsAttributeList().get(n).getGoodsAttributeId(); | |||
bpa_goodproperty.userID="超级管理员"; | |||
bpa_goodproperty.classifyId=item.getGoodsTypeId(); | |||
datas.add(bpa_goodproperty); | |||
//子属性添加 | |||
if(item.getGoodsAttributeList().get(n).getGoodsAttributeValueList()!=null){ | |||
for(int i=0;i<item.getGoodsAttributeList().get(n).getGoodsAttributeValueList().size();i++){ | |||
if(!SubAttributeDBUtil.isExist(item.getGoodsAttributeList().get(n).getGoodsAttributeValueList().get(i).getGoodsAttributeId(), | |||
item.getGoodsAttributeList().get(n).getGoodsAttributeValueList().get(i).getAttributeValue())){ | |||
BPA_SUBATTRIBUTE bpa_goodpropertySub = new BPA_SUBATTRIBUTE(); | |||
bpa_goodpropertySub.name = item.getGoodsAttributeList().get(n).getGoodsAttributeValueList().get(i).getAttributeValue(); | |||
bpa_goodpropertySub.parentAttributeId = item.getGoodsAttributeList().get(n).getGoodsAttributeId(); | |||
bpa_goodpropertySub.id = item.getGoodsAttributeList().get(n).getGoodsAttributeValueList().get(i).getGoodsAttributeId(); | |||
bpa_goodpropertySub.sort = i+1; | |||
bpa_goodpropertySub.userID="超级管理员"; | |||
dataSub.add(bpa_goodpropertySub); | |||
} | |||
} | |||
} | |||
} | |||
} | |||
} | |||
AttributeDBUtil.addList(datas); | |||
SubAttributeDBUtil.addList(dataSub); | |||
} | |||
/** | |||
* 同步云端商品信息到本地 | |||
*/ | |||
private void GoodInfoSynchronous(){ | |||
if(cloudGoodsList.getValue()==null){ | |||
return; | |||
} | |||
LogUtils.d("GoodInfoSynchronous"); | |||
List<BPA_GOODS> datas = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
if(item.getGoodsInfoList()!=null){ | |||
for(int i=0;i<item.getGoodsInfoList().size();i++){ | |||
BPA_GOODS bpa_goods =new BPA_GOODS(); | |||
bpa_goods.id = item.getGoodsInfoList().get(i).getGoodsId(); | |||
bpa_goods.name = item.getGoodsInfoList().get(i).getGoodsName(); | |||
bpa_goods.classifyId=item.getGoodsTypeId(); | |||
bpa_goods.status=1; | |||
bpa_goods.url=item.getGoodsInfoList().get(i).getImgUrl()==null?"":item.getGoodsInfoList().get(i).getImgUrl(); | |||
bpa_goods.sort= i+1; | |||
datas.add(bpa_goods); | |||
} | |||
} | |||
} | |||
GoodsDBUtil.addList(datas); | |||
} | |||
/** | |||
* 同步云端配方详细信息到本地 | |||
*/ | |||
private void GoodRecipeSynchronous() { | |||
if(cloudGoodsList.getValue()==null){ | |||
return; | |||
} | |||
LogUtils.d("GoodRecipeSynchronous"); | |||
List<BPA_GOODS_PROCESS_DETAIL> datas1 = new ArrayList<>(); | |||
List<BPA_GOODS_SUBATTRIBUTE_GROUP> datas2 = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
if(item.getGoodsInfoList()!=null){ | |||
item.getGoodsInfoList().forEach(goodinfo->{ | |||
try { | |||
List<String> groupList = new ArrayList<>(); | |||
for (GoodsClassifyBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean:goodinfo.getGoodsTechnologyActionList()){ | |||
//添加子属性组合 | |||
if(!groupList.contains(goodsTechnologyActionListBean.getGoodsAttributeId())){ | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
group.id = goodsTechnologyActionListBean.getGoodsAttributeId()==null?"xxxxx123":goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
group.name = GetRecipeName(goodsTechnologyActionListBean.getGoodsAttributeId(),item.getGoodsAttributeList());// | |||
group.subAttributeIdList = goodsTechnologyActionListBean.getGoodsAttributeId()==null?"":goodsTechnologyActionListBean.getGoodsAttributeId();// | |||
group.goodsId = goodinfo.getGoodsId(); | |||
groupList.add(goodsTechnologyActionListBean.getGoodsAttributeId()); | |||
datas2.add(group); | |||
} | |||
//添加所有工序 | |||
BPA_GOODS_PROCESS_DETAIL processDetail = new BPA_GOODS_PROCESS_DETAIL(); | |||
processDetail.goodsSubAttributeGroupId = goodsTechnologyActionListBean.getGoodsAttributeId()==null?"xxxxx123":goodsTechnologyActionListBean.getGoodsAttributeId(); | |||
processDetail.materialType = goodsTechnologyActionListBean.getStepName().contains("液体")?0:1; | |||
String value = ProcessValueUtil.dealProcessJsonToValue(goodsTechnologyActionListBean.getActionJson()); | |||
processDetail.processms = ""; | |||
processDetail.processname = goodsTechnologyActionListBean.getStepName(); | |||
processDetail.processvalue = value; | |||
datas1.add(processDetail); | |||
} | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
} | |||
}); | |||
} | |||
} | |||
GoodsProcessDetailDBUtil.addList(datas1); | |||
SubAttributeGroupDBUtil.addList(datas2); | |||
} | |||
/** | |||
* 获取子商品名称 | |||
* @param goodsAttributeId | |||
* @return | |||
*/ | |||
private static String GetRecipeName(String goodsAttributeId, List<GoodsClassifyBean.GoodsAttributeListBean> attributes){ | |||
String[] props = goodsAttributeId.split("[,]"); | |||
StringBuffer recpipeNameTemp = new StringBuffer(); | |||
try{ | |||
for(int i=0;i<props.length;i++){ | |||
String id = props[i]; | |||
for(GoodsClassifyBean.GoodsAttributeListBean bean : attributes){ | |||
for(GoodsClassifyBean.GoodsAttributeListBean.GoodsAttributeValueListBean sub:bean.getGoodsAttributeValueList()){ | |||
if(sub!=null && sub.getGoodsAttributeId().equals(id)){ | |||
recpipeNameTemp.append(sub.getAttributeValue()).append("-"); | |||
} | |||
} | |||
} | |||
} | |||
}catch (Exception e){ | |||
LogUtils.d(" GetRecipeName goodsAttributeId="+goodsAttributeId); | |||
} | |||
if(recpipeNameTemp.toString().isEmpty()){ | |||
return ""; | |||
} | |||
return recpipeNameTemp.toString().substring(0, recpipeNameTemp.length() - 1); | |||
} | |||
// /** | |||
// * 将子属性组合转换为name | |||
// * @param attributeIds | |||
// * @return | |||
// */ | |||
// private String dealAttributeGroup(Map<String,String> map,String attributeIds){ | |||
// String subAttributeName= map.get(attributeIds); | |||
// StringBuilder stringBuilder = new StringBuilder(); | |||
// if(attributeIds.contains(",")){ | |||
// String[] split = attributeIds.split(","); | |||
// for(String id : split){ | |||
// stringBuilder.append(map.get(attributeIds)); | |||
// } | |||
// } | |||
// } | |||
} |
@@ -64,7 +64,7 @@ | |||
android:layout_height="match_parent" | |||
android:layout_alignParentBottom="true" | |||
android:scaleType="fitStart" | |||
android:src="@mipmap/device2" /> | |||
/> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
@@ -129,7 +129,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:scaleType="fitCenter" | |||
android:src="@mipmap/device1" /> | |||
/> | |||
<!-- 翻炒速度 --> | |||
<LinearLayout | |||
@@ -111,7 +111,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:scaleType="fitCenter" | |||
android:src="@mipmap/device1" /> | |||
/> | |||
<!-- 翻炒速度 --> | |||
<LinearLayout | |||
@@ -63,7 +63,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:scaleType="fitCenter" | |||
android:src="@mipmap/device1" /> | |||
/> | |||
<!-- 翻炒速度 --> | |||
<LinearLayout | |||
@@ -655,7 +655,7 @@ | |||
android:layout_centerInParent="true" | |||
android:layout_marginLeft="40dp" | |||
android:layout_marginRight="40dp" | |||
android:src="@mipmap/newsilos1" /> | |||
/> | |||
<LinearLayout | |||
android:layout_marginTop="50dp" | |||
@@ -0,0 +1,100 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
android:background="@color/app_color_blue" | |||
xmlns:tools="http://schemas.android.com/tools"> | |||
<com.qmuiteam.qmui.widget.QMUITopBarLayout | |||
android:id="@+id/topbar" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" > | |||
<TextView | |||
android:id="@+id/back" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/sp_32" | |||
android:text="返回" | |||
android:drawableLeft="@mipmap/fanhui" | |||
android:gravity="center" | |||
android:paddingLeft="@dimen/dp_5" | |||
android:drawablePadding="@dimen/dp_5" | |||
/> | |||
</com.qmuiteam.qmui.widget.QMUITopBarLayout> | |||
<com.google.android.material.bottomnavigation.BottomNavigationView | |||
android:id="@+id/navigation" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_56" | |||
android:layout_gravity="top" | |||
app:layout_constraintTop_toBottomOf="@id/topbar" | |||
android:background="@drawable/qmui_list_item_bg_with_border_bottom" | |||
app:itemHorizontalTranslationEnabled="false" | |||
app:labelVisibilityMode="labeled" | |||
style="@style/BottomNavigationTextStyle" | |||
app:menu="@menu/system" | |||
android:fitsSystemWindows="true"/> | |||
<com.qmuiteam.qmui.widget.QMUIViewPager | |||
android:id="@+id/viewpager" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/navigation" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:visibility="gone" | |||
android:background="?attr/app_content_bg_color" /> | |||
<RelativeLayout | |||
android:id="@+id/rl_quanxian" | |||
android:layout_gravity="top" | |||
app:layout_constraintTop_toBottomOf="@id/topbar" | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
android:focusable="true" | |||
android:clickable="true" | |||
android:focusableInTouchMode="true" | |||
android:background="#65000000"> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerHorizontal="true" | |||
android:orientation="vertical"> | |||
<EditText | |||
android:id="@+id/edittext_quanxian" | |||
android:layout_width="@dimen/dp_400" | |||
android:layout_marginTop="@dimen/dp_300" | |||
android:layout_height="@dimen/dp_90" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入权限密码" | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="@dimen/dp_3" | |||
android:textSize="@dimen/sp_32" /> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:visibility="gone" | |||
android:layout_height="wrap_content" | |||
android:text="密码提示:12****" | |||
android:textColor="@color/colorAccent" | |||
android:textSize="8dp" | |||
android:layout_centerVertical="true" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_alignParentRight="true"/> | |||
<Button | |||
android:id="@+id/btn_submit" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_marginTop="20dp" | |||
android:layout_alignParentRight="true" | |||
android:background="@drawable/button1" | |||
android:text="确认" | |||
android:textColor="@color/black" | |||
android:layout_gravity="right" | |||
android:textSize="@dimen/sp_32" /> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</androidx.constraintlayout.widget.ConstraintLayout> |
@@ -0,0 +1,41 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:background="#7f000000"> | |||
<LinearLayout | |||
android:layout_width="@dimen/dp_600" | |||
android:layout_height="wrap_content" | |||
android:background="@color/white" | |||
android:layout_gravity="center" | |||
android:orientation="vertical" | |||
> | |||
<TextView | |||
android:id="@+id/title" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/dp_20" | |||
tools:text="烹饪中" | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/sp_38" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:textStyle="bold" | |||
/> | |||
<TextView | |||
android:id="@+id/message" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
tools:text="正在停止制作,请耐心稍等..." | |||
android:textColor="@color/black" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_marginTop="@dimen/dp_30" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
android:layout_marginBottom="@dimen/dp_50" | |||
/> | |||
</LinearLayout> | |||
</FrameLayout> |
@@ -8,15 +8,49 @@ | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<Button | |||
android:id="@+id/btn_fresh" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="@dimen/dp_70" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/white" | |||
android:text="刷 新" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:layout_alignParentEnd="true" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_10" | |||
/> | |||
<Button | |||
android:id="@+id/btn_synchronized_data" | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="@dimen/dp_70" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/white" | |||
android:text="下载所有商品" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginStart="@dimen/dp_20" | |||
android:layout_marginTop="@dimen/dp_10" | |||
/> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/recycler_classify" | |||
android:layout_width="@dimen/dp_140" | |||
android:layout_marginTop="@dimen/dp_90" | |||
android:orientation="vertical" | |||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<TextView | |||
android:id="@+id/line3" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_1" | |||
android:background="@color/color3" | |||
android:layout_marginTop="@dimen/dp_90" | |||
/> | |||
<TextView | |||
android:id="@+id/line1" | |||
@@ -24,6 +58,7 @@ | |||
android:layout_height="match_parent" | |||
android:background="@color/color3" | |||
android:layout_marginLeft="@dimen/dp_140" | |||
android:layout_marginTop="@dimen/dp_90" | |||
/> | |||
<TextView | |||
@@ -37,25 +72,14 @@ | |||
android:layout_marginLeft="@dimen/dp_161" | |||
android:id="@+id/recycler_goods" | |||
android:layout_width="match_parent" | |||
android:layout_marginTop="@dimen/dp_90" | |||
android:orientation="vertical" | |||
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager" | |||
app:spanCount="3" | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<Button | |||
android:id="@+id/btn_fresh" | |||
android:layout_width="@dimen/dp_150" | |||
android:layout_height="@dimen/dp_70" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="@color/white" | |||
android:text="刷新" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:layout_alignParentBottom="true" | |||
android:layout_alignParentEnd="true" | |||
android:layout_marginEnd="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_20" | |||
/> | |||
</RelativeLayout> | |||
@@ -19,6 +19,16 @@ | |||
android:paddingLeft="@dimen/dp_5" | |||
android:drawablePadding="@dimen/dp_5" | |||
/> | |||
<TextView | |||
android:id="@+id/tv_connect" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:text="设备状态:未连接" | |||
android:layout_gravity="end" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/sp_28" | |||
android:gravity="center" | |||
/> | |||
</com.qmuiteam.qmui.widget.QMUITopBarLayout> | |||
<RelativeLayout | |||
@@ -173,7 +173,7 @@ | |||
android:paddingLeft="@dimen/dp_70" | |||
android:background="@drawable/bg_round50_yellow_btn" | |||
android:drawablePadding="@dimen/dp_5" | |||
android:elevation="@dimen/dp_25"/> | |||
/> | |||
<ImageView | |||
android:layout_width="@dimen/dp_50" | |||
@@ -185,7 +185,6 @@ | |||
android:layout_alignLeft="@id/logout" | |||
android:layout_alignTop="@id/logout" | |||
android:layout_marginBottom="@dimen/dp_150" | |||
android:elevation="@dimen/dp_25" | |||
/> | |||
</RelativeLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -54,7 +54,7 @@ | |||
android:layout_margin="@dimen/dp_10" | |||
android:antialias="true" | |||
android:scaleType="fitXY" | |||
android:src="@mipmap/device1" /> | |||
/> | |||
<!-- 温度 --> | |||
<LinearLayout | |||
@@ -36,6 +36,26 @@ | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<TextView | |||
android:id="@+id/delete_all" | |||
android:layout_width="wrap_content" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:layout_height="@dimen/dp_90" | |||
android:paddingTop="@dimen/dp_25" | |||
android:paddingBottom="@dimen/dp_25" | |||
android:paddingStart="@dimen/dp_25" | |||
android:paddingEnd="@dimen/dp_25" | |||
android:layout_marginBottom="2dp" | |||
android:layout_alignParentEnd="true" | |||
android:ellipsize="middle" | |||
android:textSize="@dimen/sp_32" | |||
android:text="删除所有商品" | |||
android:textColor="#823E17" | |||
android:gravity="center" | |||
android:layout_alignParentBottom="true" | |||
android:background="@drawable/bg_round25_yellow_btn"/> | |||
<TextView | |||
android:id="@+id/line1" | |||
android:layout_width="@dimen/dp_1" | |||
@@ -24,12 +24,23 @@ | |||
android:layout_marginBottom="@dimen/dp_10"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
android:layout_height="@dimen/dp_70"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_height="match_parent" | |||
android:text="已有图片列表" | |||
android:textSize="@dimen/text_size_16" | |||
android:textSize="@dimen/sp_32" | |||
android:gravity="center_vertical" | |||
/> | |||
<Button | |||
android:id="@+id/delete_all" | |||
android:layout_width="300dp" | |||
android:layout_alignParentRight="true" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/bg_btn_login_selected" | |||
android:text="删除所有缓存图片" | |||
android:textColor="@color/white" | |||
android:textSize="22sp" | |||
/> | |||
</RelativeLayout> | |||
@@ -64,7 +75,7 @@ | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:textSize="@dimen/text_size_16" | |||
android:textSize="@dimen/sp_32" | |||
android:text="选择图片列表"/> | |||
</RelativeLayout> | |||
@@ -86,24 +97,26 @@ | |||
<LinearLayout | |||
android:layout_margin="@dimen/dp_10" | |||
android:layout_width="match_parent" | |||
android:layout_height="34dp" | |||
android:layout_height="@dimen/dp_70" | |||
android:gravity="center_vertical" | |||
android:orientation="horizontal"> | |||
<Button | |||
android:id="@+id/xuanzhewenjian" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/bg_btn_login_selected" | |||
android:text="选择文件" | |||
android:layout_weight="1" | |||
style="@style/TextView_btn_normal" | |||
/> | |||
<Button | |||
android:id="@+id/baocunbendi" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/button1" | |||
android:text="保存本地" | |||
android:layout_weight="1" | |||
style="@style/TextView_btn_normal" | |||
/> | |||
</LinearLayout> | |||
@@ -55,6 +55,7 @@ | |||
android:layout_height="match_parent" | |||
android:layout_weight="1" | |||
android:gravity="center" | |||
android:visibility="gone" | |||
android:layout_centerHorizontal="true"> | |||
<ImageView | |||
@@ -16,8 +16,8 @@ | |||
android:icon="@drawable/icon_systemsettings" | |||
android:title="@string/SystemSettings" /> | |||
<item | |||
android:id="@+id/bottom_navigation_4" | |||
android:icon="@drawable/icon_seasoningsettings" | |||
android:title="@string/SeasoningSettings" /> | |||
<!-- <item--> | |||
<!-- android:id="@+id/bottom_navigation_4"--> | |||
<!-- android:icon="@drawable/icon_seasoningsettings"--> | |||
<!-- android:title="@string/SeasoningSettings" />--> | |||
</menu> |
@@ -35,8 +35,8 @@ task clean(type: Delete) { | |||
ext { // 统一版本入口 | |||
//App版本号 | |||
versionCode = 1 | |||
versionName = "1.0.0" | |||
versionCode = 204 | |||
versionName = "2.0.4" | |||
// 支持Android版本 | |||
buildToolsVersion = "33.0.0" | |||