Browse Source

页面开发

桌面小炒机
liup 7 months ago
parent
commit
1aa979f6e3
34 changed files with 1191 additions and 343 deletions
  1. +15
    -1
      app/src/main/AndroidManifest.xml
  2. +1
    -5
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/DiyUpdate1Activity.java
  3. +25
    -18
      app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/WelcomeActivity.java
  4. +2
    -0
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  5. +3
    -1
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODSRECIPE.java
  6. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODS_PROCESS_DETAIL.java
  7. +2
    -1
      app/src/main/java/com/bonait/bnframework/common/db/mode/ModeBase.java
  8. +24
    -0
      app/src/main/java/com/bonait/bnframework/common/db/util/AttributeDBUtil.java
  9. +14
    -4
      app/src/main/java/com/bonait/bnframework/common/db/util/GoodsClassifyDBUtil.java
  10. +23
    -3
      app/src/main/java/com/bonait/bnframework/common/db/util/GoodsDBUtil.java
  11. +8
    -22
      app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java
  12. +45
    -3
      app/src/main/java/com/bonait/bnframework/common/db/util/SubAttributeDBUtil.java
  13. +67
    -4
      app/src/main/java/com/bonait/bnframework/common/db/util/SubAttributeGroupDBUtil.java
  14. +8
    -9
      app/src/main/java/com/bonait/bnframework/manager/ActivityLifecycleManager.java
  15. +233
    -0
      app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java
  16. +261
    -145
      app/src/main/java/com/bonait/bnframework/ui/activity/EditClassifyActivity.java
  17. +0
    -9
      app/src/main/java/com/bonait/bnframework/ui/activity/EditProcessActivity.java
  18. +18
    -3
      app/src/main/java/com/bonait/bnframework/ui/adapter/SelectAttributeListAdapter.java
  19. +48
    -32
      app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java
  20. +2
    -0
      app/src/main/java/com/bonait/bnframework/ui/fragment/HomeFoodsFragment.java
  21. +21
    -1
      app/src/main/java/com/bonait/bnframework/ui/viewmodel/HomeGoodsViewModel.java
  22. +7
    -0
      app/src/main/res/drawable/bg_round50_left_green.xml
  23. +1
    -1
      app/src/main/res/drawable/bg_round50_red_btn.xml
  24. +7
    -0
      app/src/main/res/drawable/bg_round50_right_green.xml
  25. +22
    -6
      app/src/main/res/layout/activity_edit_classify.xml
  26. +224
    -0
      app/src/main/res/layout/activity_edit_process.xml
  27. +41
    -25
      app/src/main/res/layout/activity_welcome.xml
  28. +36
    -32
      app/src/main/res/layout/dialog/layout/layout_add_goods_mainfood.xml
  29. +4
    -4
      app/src/main/res/layout/dialog/layout/layout_add_goods_name.xml
  30. +4
    -4
      app/src/main/res/layout/dialog/layout/layout_add_goods_sel_classify.xml
  31. +4
    -4
      app/src/main/res/layout/dialog/layout/layout_edit_goods_name.xml
  32. +4
    -4
      app/src/main/res/layout/dialog/layout/layout_edit_goods_sub_attribute.xml
  33. +1
    -0
      app/src/main/res/layout/fragment_local_goods.xml
  34. +15
    -1
      app/src/main/res/values/styles.xml

+ 15
- 1
app/src/main/AndroidManifest.xml View File

@@ -37,6 +37,11 @@
android:name=".ViewModel.ActivityViewModel.DiyUpdate1Activity"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".ui.activity.DiyProcessActivity"
android:windowSoftInputMode="adjustPan"
android:screenOrientation="portrait"
android:exported="false" />
<activity
android:name=".ViewModel.ActivityViewModel.CookingSimulatedActivity"
android:screenOrientation="portrait"
@@ -183,11 +188,19 @@
android:name=".ViewModel.ActivityViewModel.WelcomeActivity"
android:exported="true"
android:screenOrientation="portrait"
android:launchMode="singleTask"
android:theme="@style/AppTheme.Launcher">


<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- <action android:name="android.intent.action.MAIN" />-->

<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</activity>
<activity android:name=".ViewModel.ActivityViewModel.LoginActivity"
@@ -211,6 +224,7 @@
-->
</activity>
<activity android:name=".ViewModel.ActivityViewModel.BottomNavigation2Activity"
android:launchMode="singleTask"
android:screenOrientation="portrait"/>

<receiver


+ 1
- 5
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/DiyUpdate1Activity.java View File

@@ -23,7 +23,6 @@ import android.widget.TextView;
import androidx.core.content.ContextCompat;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Logs.MessageLog;
import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter;
import com.bonait.bnframework.ViewModel.CustomView.XComDialog;
@@ -33,8 +32,8 @@ import com.bonait.bnframework.common.base.BaseActivity;
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.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.mode.BPA_PROCESS;
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
@@ -223,17 +222,14 @@ public class DiyUpdate1Activity extends BaseActivity {
}
});

//图标选择
MessageManager.getInstance().registerMessageReceiver(this, MessageName.DIY, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
MessageLog.ShowInfo("onMessage 图标选择 msg="+msg);
if (msg != null) {
bpa_goodsrecipes.clear();
for (BPA_GOODSRECIPE item : DataBus.getInstance().bpa_goodsrecipes) {
bpa_goodsrecipes.add(item);
}
LogUtils.e("图标选择 bpa_goodsrecipes="+bpa_goodsrecipes.toString());
zzsc.setText(DataBus.getInstance().TimeOut + "");
gxbz_adapter.notifyDataSetChanged();
}


+ 25
- 18
app/src/main/java/com/bonait/bnframework/ViewModel/ActivityViewModel/WelcomeActivity.java View File

@@ -4,16 +4,12 @@ import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

import androidx.annotation.NonNull;

import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.DataUtil.ErrorCodeManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.MainInit;
import com.bonait.bnframework.common.base.BaseActivity;
@@ -24,11 +20,7 @@ import com.bonait.bnframework.common.utils.ScreenUtils;
import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.test.TestActivity;
import com.lzy.okgo.OkGo;
import com.qmuiteam.qmui.widget.QMUILoadingView;

import org.w3c.dom.Text;

import butterknife.BindView;
import okhttp3.OkHttpClient;
import pub.devrel.easypermissions.EasyPermissions;

@@ -43,16 +35,12 @@ public class WelcomeActivity extends BaseActivity {
private final static int SELECT_MODE = 2;
private OkHttpClient.Builder builder;

@BindView(R.id.loading)
QMUILoadingView loading;
@BindView(R.id.desc)
TextView desc;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);

DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int miDisplayWidth = dm.widthPixels;
@@ -66,9 +54,28 @@ public class WelcomeActivity extends BaseActivity {
initWelcome();
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if(ConfigName.getInstance().user!=null){
if(ConfigName.getInstance().user.name.equals("admin") || ConfigName.getInstance().user.account.equals("admin") || ConfigName.getInstance().user.userID.equals("超级管理员"))
{
Intent intent1 = new Intent(WelcomeActivity.this, BottomNavigation2Activity.class);
intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent1);
}else
{
Intent intent2 = new Intent(WelcomeActivity.this, BottomNavigationNewActivity.class);
intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent2);
}
}else {
skipToLoginActivity();
}
}

private void initView(){
DisplayManager.scaleView(loading);
DisplayManager.scaleView(desc);
DisplayManager.scaleViewGroup(findViewById(R.id.root));
}

/**
@@ -235,7 +242,7 @@ public class WelcomeActivity extends BaseActivity {

// 跳转到登录页面
Intent intent = new Intent(WelcomeActivity.this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
// 结束所有Activity


+ 2
- 0
app/src/main/java/com/bonait/bnframework/business/MainInit.java View File

@@ -20,6 +20,7 @@ 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_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;
@@ -281,6 +282,7 @@ 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();
InitDBdata();
}



+ 3
- 1
app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_GOODSRECIPE.java View File

@@ -1,10 +1,12 @@
package com.bonait.bnframework.common.db.mode;

import java.io.Serializable;

/**
* BPA_GOODSRECIPE[商品配方明细表] [工艺详情表]
* 创建人:fengyoufu add 20230412
*/
public class BPA_GOODSRECIPE extends ModeBase {
public class BPA_GOODSRECIPE extends ModeBase implements Serializable {
//商品ID
public String goodsID;
//物料ID 或者 工序模型id


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

@@ -7,7 +7,7 @@ package com.bonait.bnframework.common.db.mode;
*/
public class BPA_GOODS_PROCESS_DETAIL extends ModeBase{
/**
* 商品属性组合名称 a-b
* 商品属性组合id
*/
public String goodsSubAttributeGroupId;
/**


+ 2
- 1
app/src/main/java/com/bonait/bnframework/common/db/mode/ModeBase.java View File

@@ -1,5 +1,6 @@
package com.bonait.bnframework.common.db.mode;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

@@ -7,7 +8,7 @@ import java.util.Date;
* 数据库基类
* 创建人:fengyoufu add 20230412
*/
public class ModeBase {
public class ModeBase implements Serializable {
//ID 号
public String id;
//创建时间 统一用text存储


+ 24
- 0
app/src/main/java/com/bonait/bnframework/common/db/util/AttributeDBUtil.java View File

@@ -1,7 +1,11 @@
package com.bonait.bnframework.common.db.util;

import android.database.sqlite.SQLiteDatabase;

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_ATTRIBUTE;

import java.util.ArrayList;
@@ -46,6 +50,26 @@ public class AttributeDBUtil {
return QueryDB.Delete(BPA_ATTRIBUTE.class, data.id);
}

/**
* 删除属性数据
* add fengyoufu 20230413
*
* @param classifyId
* @return 是否成功
*/
public static boolean deleteByClassifyId(String classifyId) {
boolean result = true;
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase();
long delete = db.delete(BPA_ATTRIBUTE.class.getSimpleName(), "classifyId=?",
new String[]{classifyId});
if(delete <= 0){
result = false;
}
db.close();
LogUtils.d("deleteByClassifyId 删除属性数据 result=" + result);
return result;
}

/**
* 根据属性id获取属性
*


+ 14
- 4
app/src/main/java/com/bonait/bnframework/common/db/util/GoodsClassifyDBUtil.java View File

@@ -5,6 +5,7 @@ import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY;

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

/**
* @author: liup
@@ -14,7 +15,6 @@ import java.util.ArrayList;
public class GoodsClassifyDBUtil {
/**
* 新增商品分类数据
* add fengyoufu 20230413
*
* @param data 商品分类数据
* @return 是否成功
@@ -26,7 +26,6 @@ public class GoodsClassifyDBUtil {

/**
* 修改商品分类数据
* add fengyoufu 20230413
*
* @param data
*/
@@ -36,7 +35,6 @@ public class GoodsClassifyDBUtil {

/**
* 删除商品分类数据
* add fengyoufu 20230413
*
* @param data 商品分类数据
* @return 是否成功
@@ -47,7 +45,6 @@ public class GoodsClassifyDBUtil {

/**
* 删除商品分类数据
* add fengyoufu 20230413
*
* @param id 商品分类id
* @return 是否成功
@@ -108,4 +105,17 @@ public class GoodsClassifyDBUtil {
LogUtils.d("getAll 根据分类classifyId获取商品分类列表 data=" + data.toString());
return data;
}

/**
* 删除所有商品相关的数据
*/
public static void deleteAllGoodsData(){
List<BPA_GOODS_CLASSIFY> classifyList = getAll();
for(BPA_GOODS_CLASSIFY classify :classifyList){
AttributeDBUtil.deleteByClassifyId(classify.id);
GoodsDBUtil.deleteByClassifyId(classify.id);
SubAttributeGroupDBUtil.deleteByClassifyId(classify.id);
SubAttributeDBUtil.deleteByClassifyId(classify.id);
}
}
}

+ 23
- 3
app/src/main/java/com/bonait/bnframework/common/db/util/GoodsDBUtil.java View File

@@ -1,7 +1,11 @@
package com.bonait.bnframework.common.db.util;

import android.database.sqlite.SQLiteDatabase;

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;

import java.util.ArrayList;
@@ -14,7 +18,6 @@ import java.util.ArrayList;
public class GoodsDBUtil {
/**
* 新增商品数据
* add fengyoufu 20230413
*
* @param data 商品数据
* @return 是否成功
@@ -26,7 +29,6 @@ public class GoodsDBUtil {

/**
* 修改商品数据
* add fengyoufu 20230413
*
* @param data
*/
@@ -36,7 +38,6 @@ public class GoodsDBUtil {

/**
* 删除商品数据
* add fengyoufu 20230413
*
* @param data 商品数据
* @return 是否成功
@@ -45,6 +46,25 @@ public class GoodsDBUtil {
return QueryDB.Delete(BPA_GOODS.class, data.id);
}

/**
* 删除商品数据
*
* @param classifyId
* @return 是否成功
*/
public static boolean deleteByClassifyId(String classifyId) {
boolean result = true;
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase();
long delete = db.delete(BPA_GOODS.class.getSimpleName(), "classifyId=?",
new String[]{classifyId});
if(delete <= 0){
result = false;
}
db.close();
LogUtils.d("deleteByClassifyId 删除属性数据 result=" + result);
return result;
}

/**
* 根据商品id获取商品
*


+ 8
- 22
app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java View File

@@ -19,7 +19,7 @@ import java.util.ArrayList;
public class GoodsProcessDetailDBUtil {
/**
* 新增商品工艺详情数据
* add fengyoufu 20230413
*
* @param data 商品工艺详情数据
* @return 是否成功
@@ -31,7 +31,7 @@ public class GoodsProcessDetailDBUtil {

/**
* 修改商品工艺详情数据
* add fengyoufu 20230413
*
* @param data
*/
@@ -41,7 +41,7 @@ public class GoodsProcessDetailDBUtil {

/**
* 删除商品工艺详情数据
* add fengyoufu 20230413
*
* @param data 商品工艺详情数据
* @return 是否成功
@@ -65,37 +65,23 @@ public class GoodsProcessDetailDBUtil {
return obj.size() > 0 ? (BPA_GOODS_PROCESS_DETAIL) obj.get(0) : null;
}

/**
* 根据商品工艺详情name获取商品工艺详情
* @param name
* @return BPA_GOODS_PROCESS_DETAIL
*/
public static BPA_GOODS_PROCESS_DETAIL getByName(String name) {
String orderby = QueryDB.Desc_Sort_Up;
String where = "isDelete=? and name=?";
String[] args = new String[]{"0", name};
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_PROCESS_DETAIL.class, where, args, orderby);

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

/**
* 根据商品属性组合查询旗下的工序列表
*
* @param name
* @param groupId
* @return
*/
public static ArrayList<BPA_GOODS_PROCESS_DETAIL> getByGoodsSubAttributeGroupName(String name) {
public static ArrayList<BPA_GOODS_PROCESS_DETAIL> getByGroupId(String groupId) {
String orderby = QueryDB.Desc_Sort_Up + ',' + QueryDB.Desc_Time_Up;
String where = "isDelete=? and goodsSubAttributeGroupId=?";
String[] args = new String[]{"0", name};
String where = "goodsSubAttributeGroupId=?";
String[] args = new String[]{"0", groupId};
ArrayList<BPA_GOODS_PROCESS_DETAIL> data = new ArrayList<>();
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_PROCESS_DETAIL.class, where, args, orderby);
for (Object item : obj) {
BPA_GOODS_PROCESS_DETAIL k = (BPA_GOODS_PROCESS_DETAIL) item;
data.add(k);
}
LogUtils.d("getByGoodsSubAttributeGroupId 根据商品组合id查询配方信息 data=" + data.toString());
LogUtils.d("getByGroupId 根据商品属性组合查询旗下的工序列表 data=" + data.toString());
return data;
}



+ 45
- 3
app/src/main/java/com/bonait/bnframework/common/db/util/SubAttributeDBUtil.java View File

@@ -1,10 +1,16 @@
package com.bonait.bnframework.common.db.util;

import android.database.sqlite.SQLiteDatabase;

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_ATTRIBUTE;
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE;

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

/**
* @author: liup
@@ -15,7 +21,7 @@ public class SubAttributeDBUtil {

/**
* 新增子属性数据
* add fengyoufu 20230413
*
* @param data 子属性数据
* @return 是否成功
@@ -27,7 +33,7 @@ public class SubAttributeDBUtil {

/**
* 修改子属性数据
* add fengyoufu 20230413
*
* @param data
*/
@@ -37,7 +43,7 @@ public class SubAttributeDBUtil {

/**
* 删除子属性数据
* add fengyoufu 20230413
*
* @param data 子属性数据
* @return 是否成功
@@ -46,6 +52,42 @@ public class SubAttributeDBUtil {
return QueryDB.Delete(BPA_SUBATTRIBUTE.class, data.id);
}

/**
* 删除子属性数据
*
* @param parentId
* @return 是否成功
*/
public static boolean deleteByParentId(String parentId) {
boolean result = true;
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase();
long delete = db.delete(BPA_SUBATTRIBUTE.class.getSimpleName(), "parentAttributeId=?",
new String[]{parentId});
if(delete <= 0){
result = false;
}
db.close();
LogUtils.d("deleteByGoodsId 删除子属性组合数据 result=" + result);
return result;
}

/**
* 删除子属性数据
*
* @param classifyId
* @return 是否成功
*/
public static boolean deleteByClassifyId(String classifyId) {
boolean result = true;
List<BPA_ATTRIBUTE> attributeList = AttributeDBUtil.getByClassify(classifyId);
for (BPA_ATTRIBUTE bean : attributeList){
if(!deleteByParentId(bean.id)){
result = false;
}
}
return result;
}

/**
* 根据子属性id获取子属性
*


+ 67
- 4
app/src/main/java/com/bonait/bnframework/common/db/util/SubAttributeGroupDBUtil.java View File

@@ -6,9 +6,11 @@ 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;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP;

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

/**
* @author: liup
@@ -18,7 +20,7 @@ import java.util.ArrayList;
public class SubAttributeGroupDBUtil {
/**
* 新增子属性组合数据
* add fengyoufu 20230413
*
* @param data 子属性组合数据
* @return 是否成功
@@ -30,7 +32,7 @@ public class SubAttributeGroupDBUtil {

/**
* 修改子属性组合数据
* add fengyoufu 20230413
*
* @param data
*/
@@ -40,7 +42,7 @@ public class SubAttributeGroupDBUtil {

/**
* 删除子属性组合数据
* add fengyoufu 20230413
*
* @param data 子属性组合数据
* @return 是否成功
@@ -51,7 +53,23 @@ public class SubAttributeGroupDBUtil {

/**
* 删除子属性组合数据
* add fengyoufu 20230413
*
* @param classifyId
* @return 是否成功
*/
public static boolean deleteByClassifyId(String classifyId) {
boolean result = true;
List<BPA_GOODS> goods = GoodsDBUtil.getByClassifyId(classifyId);
for (BPA_GOODS bean : goods){
if(!deleteByGoodsId(bean.id)){
result = false;
}
}
return result;
}

/**
* 删除子属性组合数据
*
* @param goodsId
* @return 是否成功
@@ -98,6 +116,20 @@ public class SubAttributeGroupDBUtil {
return obj.size() > 0 ? (BPA_GOODS_SUBATTRIBUTE_GROUP) obj.get(0) : null;
}

/**
* 根据子属性组合name获取子属性组合
* @param subAttributeIdList
* @return BPA_GOODS_SUBATTRIBUTE_GROUP
*/
public static BPA_GOODS_SUBATTRIBUTE_GROUP getByGoodIdAndListId(String goodsId,String subAttributeIdList) {
String orderby = QueryDB.Desc_Sort_Up;
String where = "isDelete=? and goodsId=? and subAttributeIdList=?";
String[] args = new String[]{"0",goodsId, subAttributeIdList};
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS_SUBATTRIBUTE_GROUP.class, where, args, orderby);

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


/**
* 根据商品Id获取子属性组合列表
@@ -146,4 +178,35 @@ public class SubAttributeGroupDBUtil {
}
return false;
}
/**
* 判断子属性是否已绑定
* @param goodsId
* @param subAttributeName
* @return
*/
public static boolean isInclude(String goodsId,String subAttributeName){
for(BPA_GOODS_SUBATTRIBUTE_GROUP subattribute : getByGoodsId(goodsId)){
if(subattribute.name.contains(subAttributeName)){
return true;
}
}
return false;
}

/**
* 判断子属性是否已绑定
* @param classifyId
* @param subAttributeName
* @return
*/
public static String isIncludeByClassify(String classifyId,String subAttributeName){
List<BPA_GOODS> goods = GoodsDBUtil.getByClassifyId(classifyId);
for (BPA_GOODS good : goods){
if(isInclude(good.id,subAttributeName)){
return good.name;
}
}
return "";
}

}

+ 8
- 9
app/src/main/java/com/bonait/bnframework/manager/ActivityLifecycleManager.java View File

@@ -2,7 +2,6 @@ package com.bonait.bnframework.manager;

import android.app.Activity;
import android.app.Application;
import android.content.pm.ActivityInfo;
import android.os.Bundle;

import java.util.Collections;
@@ -156,13 +155,13 @@ public class ActivityLifecycleManager implements Application.ActivityLifecycleCa
* 结束所有Activity
*/
public void finishAllActivity() {
if (activityList == null) {
return;
}
for (Activity activity : activityList) {
activity.finish();
}
activityList.clear();
// if (activityList == null) {
// return;
// }
// for (Activity activity : activityList) {
// activity.finish();
// }
// activityList.clear();
}

/**
@@ -170,7 +169,7 @@ public class ActivityLifecycleManager implements Application.ActivityLifecycleCa
*/
public void appExit() {
try {
finishAllActivity();
// finishAllActivity();
System.exit(0);
} catch (Exception e) {
e.getStackTrace();


+ 233
- 0
app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java View File

@@ -0,0 +1,233 @@
package com.bonait.bnframework.ui.activity;

import static com.bonait.bnframework.MainApplication.getContext;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;

import androidx.annotation.Nullable;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.CustomView.fragment_gx;
import com.bonait.bnframework.ViewModel.CustomView.item_gx;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.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.db.util.GoodsDBUtil;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ActivityEditProcessBinding;
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding;

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

import butterknife.ButterKnife;

/**
* @author: liup
* @description:
* @date: 2024/5/15 17:26.
*/
public class DiyProcessActivity extends BaseActivity {

private String TAG = "DiyProcessActivity==>";
private ActivityEditProcessBinding viewBinding;
/**
* 1-6个主料仓名称
*/
ArrayList<String> mainFoods = new ArrayList<>();

/**
* 商品id
*/
private String goodId = "";
/**
* 子属性组合id 属性组合名称
*/
private String subAttributeGroupId = "";
private String subAttributeGroupName = "";

/**
* 工序数据
*/
Map<String, String> processMap = new LinkedHashMap<>();
/**
* 工序坐标
*/
Map<String, Integer> processMapIndex = new LinkedHashMap<>();
/**
* 工序步骤
*/
public ArrayList<BPA_GOODSRECIPE> goodsRecipes = new ArrayList<>();


@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivityEditProcessBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
ButterKnife.bind(this);
DisplayManager.scaleViewGroup(viewBinding.getRoot());
Intent intent = getIntent();
if(intent != null){
mainFoods = intent.getStringArrayListExtra("mainFoods");
goodId = intent.getStringExtra("goodId");
subAttributeGroupId = intent.getStringExtra("subAttributeGroupId");
subAttributeGroupName = intent.getStringExtra("subAttributeGroupName");
}
initView();
initData();
initTopBar();
}


private void initData(){
//初始化工序
ArrayList<BPA_PROCESS> data = QueryDB.GetProcessALL();
int i = 0;
String id = "";
for (BPA_PROCESS item : data) {
processMap.put(item.name, item.id);
processMapIndex.put(item.name, i);
if (i == 0) {
id = item.id;
}
i++;
}
ArrayAdapter<String> adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(processMap.keySet()));
adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinnerProcess.setAdapter(adapter_kk);

viewBinding.spinnerProcess.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
String id = processMap.get(viewBinding.spinnerProcess.getSelectedItem().toString());
SelectItemFrom(id);
}

@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});
SelectItemFrom(id);

//3.工序步骤
// gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item1, (List<BPA_GOODSRECIPE>) bpa_goodsrecipes, null);
// datatab_gxbz.setAdapter(gxbz_adapter);
// datatab_gxbz.setOnItemClickListener(new AdapterView.OnItemClickListener() {
// @Override
// public void onItemClick(AdapterView<?> parent, View view, int position, long l) {
// // TODO Auto-generated method stub
// gxbz_adapter.setSelectedPosition(position);
// gxbz_adapter.notifyDataSetInvalidated();
//
// SetSelectGX(bpa_goodsrecipes.get(position));//单击工序行,显示变量
// }
// });
}

private void initView(){
// SubAttributeGroupDBUtil.getByGoodIdAndListId(goodId,subAttributeGroupId);
BPA_GOODS goods = GoodsDBUtil.getById(goodId);
viewBinding.title.setText(goods==null?(subAttributeGroupName+""):(goods.name+subAttributeGroupName));

}

private void initTopBar(){

}

/**
* 根据选中工序id显示集合
*
* @param id
*/
public void SelectItemFrom(String id) {
try {
viewBinding.llProcessValue.removeAllViews();
ArrayList<BPA_PROCESSModel> mode = QueryDB.GetProcessModelProcessID(id);
if (!mode.isEmpty())//工序
{
for (BPA_PROCESSModel item : mode) {
item_gx gx = new item_gx();
gx.datatype = item.datatype;
gx.name = item.name;
gx.data = item.data;
gx.IsWL = false;
fragment_gx gongxu = new fragment_gx(this, null, gx);
LogUtils.d("SelectItemFrom gx="+gx.toString());
viewBinding.llProcessValue.addView(gongxu);
}
} else //物料
{
ArrayList<BPA_MATERIAL> materials = QueryDB.GetMaterialALL();
for (BPA_MATERIAL item2 : materials) {
item_gx gx = new item_gx();
gx.datatype = 0;//液体料都是数字
gx.name = item2.name;
gx.IsWL = true;
fragment_gx gongxu = new fragment_gx(this, null, gx);
LogUtils.d("SelectItemFrom gx="+gx.toString());
viewBinding.llProcessValue.addView(gongxu);
}
}
} catch (Exception ex) {
}
}


public static final int REQUEST_RECORD_ACTIVITY = 1001;
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
LogUtils.d(TAG+" onActivityResult requestCode="+requestCode+" resultCode="+resultCode+" data="+data);
if (requestCode == REQUEST_RECORD_ACTIVITY&& resultCode==RESULT_OK) {
if(data!=null){

if(data.getSerializableExtra("goodsRecipes")!=null){
goodsRecipes.clear();
try {
goodsRecipes =(ArrayList<BPA_GOODSRECIPE>) data.getSerializableExtra("goodsRecipes");
}catch (Exception e){
e.printStackTrace();
}
}
}
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_delete_classify, (layoutView, xCom) -> {
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("修改工序");
binding.edit.setText("是否删除所有工序,并替换为录制的工序?");
binding.submit.setOnClickListener(view1 -> {
// if(GoodsClassifyDBUtil.deleteById(classifyId)){
// AttributeDBUtil.deleteByClassifyId(classifyId);
// GoodsDBUtil.deleteByClassifyId(classifyId);
// SubAttributeGroupDBUtil.deleteByClassifyId(classifyId);
// SubAttributeDBUtil.deleteByClassifyId(classifyId);
//
// classifyList.remove(classifyName);
// classifyNameList.clear();
// classifyNameList.addAll(classifyList.keySet());
// spinnerAdapter.notifyDataSetChanged();
// selectClassify(classifyPosition-1);//更新数据
// ToastUtils.info("删除["+classifyName+"]成功!");
// xCom.dismissX();
// }else {
// ToastUtils.info("删除["+classifyName+"]失败!");
// }
// gxbz_adapter.notifyDataSetChanged();
});
});
}
}
}

+ 261
- 145
app/src/main/java/com/bonait/bnframework/ui/activity/EditClassifyActivity.java View File

@@ -7,6 +7,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Toast;

import androidx.annotation.Nullable;

@@ -18,7 +19,9 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY;
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE;
import com.bonait.bnframework.common.db.util.AttributeDBUtil;
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil;
import com.bonait.bnframework.common.db.util.GoodsDBUtil;
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil;
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
@@ -28,6 +31,7 @@ import com.bonait.bnframework.databinding.DialogAddClassifyBinding;
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding;
import com.bonait.bnframework.ui.adapter.AttributeAdapter;
import com.bonait.bnframework.ui.adapter.SubattributeAdapter;
import com.bonait.bnframework.ui.widget.NewToastUtil;

import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -50,20 +54,20 @@ public class EditClassifyActivity extends BaseActivity {
* 父属性列表
*/
private AttributeAdapter attributeAdapter;
private List<BPA_ATTRIBUTE> attributeList = new ArrayList<>();
private final List<BPA_ATTRIBUTE> attributeList = new ArrayList<>();

/**
* 子属性列表
*/
private SubattributeAdapter subattributeAdapter;
private List<BPA_SUBATTRIBUTE> subattributeList = new ArrayList<>();
private final List<BPA_SUBATTRIBUTE> subattributeList = new ArrayList<>();

/**
* 下拉列表
*/
private ArrayAdapter<String> spinnerAdapter;//
private Map<String, String> classifyList = new LinkedHashMap<>();
private List<String> classifyNameList = new ArrayList<>();
private final Map<String, String> classifyList = new LinkedHashMap<>();
private final List<String> classifyNameList = new ArrayList<>();
private boolean isUserClicked = false;
private int attributePosition = 0;//属性选中位置
private int classifyPosition = 0;//属性选中位置
@@ -151,10 +155,8 @@ public class EditClassifyActivity extends BaseActivity {
@Override
public void clickListenerNew(View v, int k, Object data) {
//删除
BPA_SUBATTRIBUTE bean = (BPA_SUBATTRIBUTE) data;
SubAttributeDBUtil.delete(bean);
subattributeList.remove(k);
subattributeAdapter.notifyDataSetChanged();

removeSubAttribute(k,data);
}
});
viewBinding.listSubattribute.setAdapter(subattributeAdapter);
@@ -164,6 +166,7 @@ public class EditClassifyActivity extends BaseActivity {
classifyNameList.clear();
classifyNameList.addAll(classifyList.keySet());
spinnerAdapter = new ArrayAdapter<>(context, R.layout.spinner_text_item, classifyNameList);
LogUtils.d(" initView classifyNameList="+classifyNameList);
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinnerClassify.setAdapter(spinnerAdapter);
viewBinding.spinnerClassify.setOnTouchListener(new View.OnTouchListener() {
@@ -193,163 +196,276 @@ public class EditClassifyActivity extends BaseActivity {


@SuppressLint("NonConstantResourceId")
@OnClick({R.id.btn_add_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_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()){
case R.id.btn_add_classify://添加分类
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> {
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("新增分类名称");
binding.edit.setHint("请输入分类名称");
binding.submit.setOnClickListener(view1 -> {
String input = String.valueOf(binding.edit.getText());
if(!input.isEmpty()){
for (Map.Entry<String, String> entry : classifyList.entrySet()) {
if(entry.getKey().equals(input)){
ToastUtils.info("已有该分类,请换一个名称!");
return;
}
}

BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY();
goodsClassify.name = input;
if(GoodsClassifyDBUtil.add(goodsClassify)){
classifyList.put(input,goodsClassify.id);
classifyNameList.clear();
classifyNameList.addAll(classifyList.keySet());
spinnerAdapter.notifyDataSetChanged();

selectClassify(classifyList.size()-1);//更新数据
ToastUtils.info("添加["+input+"]成功!");
}else {
ToastUtils.info("添加["+input+"]失败!");
}
xCom.dismissX();
}else {
ToastUtils.info("名称不能为空!");
}
});
});
addClassify();
break;
case R.id.btn_update_classify://修改分类
updateClassify();
break;
case R.id.btn_delete_classify://删除分类
if(classifyPosition>0){
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_delete_classify, (layoutView, xCom) -> {
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView);
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString());
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString();
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("删除分类名称");
binding.edit.setText("是否删除["+classifyName+"]?");
binding.submit.setOnClickListener(view1 -> {
if(GoodsClassifyDBUtil.deleteById(classifyId)){
classifyList.remove(classifyName);
classifyNameList.clear();
classifyNameList.addAll(classifyList.keySet());
spinnerAdapter.notifyDataSetChanged();
selectClassify(classifyPosition-1);//更新数据
ToastUtils.info("删除["+classifyName+"]成功!");
xCom.dismissX();
}else {
ToastUtils.info("删除["+classifyName+"]失败!");
}
});
});
}

removeClassify();
break;
case R.id.btn_add_attribute://添加属性
if(classifyPosition==0){
return;
}
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> {
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("新增属性名称");
binding.edit.setHint("请输入属性名称");
binding.submit.setOnClickListener(view1 -> {
String input = String.valueOf(binding.edit.getText());
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString());
if(!input.isEmpty()){
for(BPA_ATTRIBUTE bean:attributeList){
if(bean.name.equals(input)){
ToastUtils.info("已有该属性,请换一个名称!");
return;
}
}
BPA_ATTRIBUTE attribute = new BPA_ATTRIBUTE();
attribute.name = input;
attribute.classifyId = classifyId;
AttributeDBUtil.add(attribute);
xCom.dismissX();
attributeList.add(attribute);
attributePosition = attributeList.size()-1;
attributeAdapter.setSelectPosition(attributeList.size()-1);
attributeAdapter.notifyDataSetChanged();
subattributeList.clear();
subattributeAdapter.notifyDataSetChanged();
}else {
ToastUtils.info("名称不能为空!");
}
});
});
addAttribute();
break;
case R.id.btn_delete_attribute://删除属性
if(classifyPosition==0){
return;
removeAttribute();
break;
case R.id.btn_add_subattribute://添加子属性
addSubAttribute();
break;
}
}

/**
* 添加分类
*/
private void addClassify(){
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> {
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("新增分类名称");
binding.edit.setHint("请输入分类名称");
binding.submit.setOnClickListener(view1 -> {
String input = String.valueOf(binding.edit.getText());
if(!input.isEmpty()){
for (Map.Entry<String, String> entry : classifyList.entrySet()) {
if(entry.getKey().equals(input)){
ToastUtils.info("已有该分类,请换一个名称!");
return;
}
}

BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY();
goodsClassify.name = input;
if(GoodsClassifyDBUtil.add(goodsClassify)){
classifyList.put(input,goodsClassify.id);
classifyNameList.clear();
classifyNameList.addAll(classifyList.keySet());
spinnerAdapter.notifyDataSetChanged();

selectClassify(classifyList.size()-1);//更新数据
ToastUtils.info("添加["+input+"]成功!");
}else {
ToastUtils.info("添加["+input+"]失败!");
}
xCom.dismissX();
}else {
ToastUtils.info("名称不能为空!");
}
if(attributePosition>=0&&attributePosition<attributeList.size()){
BPA_ATTRIBUTE attribute = attributeList.get(attributePosition);
AttributeDBUtil.delete(attribute);

if(attributePosition-1>=0){
attributeList.remove(attributePosition);
attributePosition = attributePosition-1;
attributeAdapter.setSelectPosition(attributePosition);
subattributeList.clear();
subattributeList.addAll(SubAttributeDBUtil.getByParentAttributeId(attributeList.get(attributePosition).id));
});
});
}

/**
* 修改分类
*/
private void updateClassify(){
if(classifyPosition == 0){
return;
}
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> {
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString());
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString();
binding.title.setText("修改分类名称");
binding.edit.setText(classifyName);
binding.submit.setOnClickListener(view1 -> {
String input = String.valueOf(binding.edit.getText());
if(!input.isEmpty()){
for (Map.Entry<String, String> entry : classifyList.entrySet()) {
if(entry.getKey().equals(input)){
ToastUtils.info("已有该分类,请换一个名称!");
return;
}
}

BPA_GOODS_CLASSIFY goodsClassify = GoodsClassifyDBUtil.getById(classifyId);
goodsClassify.name = input;
GoodsClassifyDBUtil.update(goodsClassify);

classifyList.remove(classifyName);
classifyList.put(input,classifyId);
classifyNameList.clear();
classifyNameList.addAll(classifyList.keySet());
spinnerAdapter.notifyDataSetChanged();
selectClassify(classifyList.size()-1);//更新数据

xCom.dismissX();
}else {
ToastUtils.info("名称不能为空!");
}
});
});
}

/**
* 删除分类
*/
private void removeClassify(){
if(classifyPosition>0){
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_delete_classify, (layoutView, xCom) -> {
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView);
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString());
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString();
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("删除分类名称");
binding.edit.setText("是否删除["+classifyName+"]分类下所有商品及属性?");
binding.submit.setOnClickListener(view1 -> {
if(GoodsClassifyDBUtil.deleteById(classifyId)){
AttributeDBUtil.deleteByClassifyId(classifyId);
GoodsDBUtil.deleteByClassifyId(classifyId);
SubAttributeGroupDBUtil.deleteByClassifyId(classifyId);
SubAttributeDBUtil.deleteByClassifyId(classifyId);

classifyList.remove(classifyName);
classifyNameList.clear();
classifyNameList.addAll(classifyList.keySet());
spinnerAdapter.notifyDataSetChanged();
selectClassify(classifyPosition-1);//更新数据
ToastUtils.info("删除["+classifyName+"]成功!");
xCom.dismissX();
}else {
attributeList.clear();
subattributeList.clear();
ToastUtils.info("删除["+classifyName+"]失败!");
}
});
});
}

}

/**
* 添加属性
*/
private void addAttribute(){
if(classifyPosition==0){
return;
}
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> {
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("新增属性名称");
binding.edit.setHint("请输入属性名称");
binding.submit.setOnClickListener(view1 -> {
String input = String.valueOf(binding.edit.getText());
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString());
if(!input.isEmpty()){
for(BPA_ATTRIBUTE bean:attributeList){
if(bean.name.equals(input)){
ToastUtils.info("已有该属性,请换一个名称!");
return;
}
}
BPA_ATTRIBUTE attribute = new BPA_ATTRIBUTE();
attribute.name = input;
attribute.classifyId = classifyId;
AttributeDBUtil.add(attribute);
xCom.dismissX();
attributeList.add(attribute);
attributePosition = attributeList.size()-1;
attributeAdapter.setSelectPosition(attributeList.size()-1);
attributeAdapter.notifyDataSetChanged();
subattributeList.clear();
subattributeAdapter.notifyDataSetChanged();
}else {
ToastUtils.info("名称不能为空!");
}
break;
case R.id.btn_add_subattribute://添加子属性
if(classifyPosition==0){
});
});
}

/**
* 删除属性
*/
private void removeAttribute(){
if(classifyPosition==0){
return;
}
if(attributePosition>=0&&attributePosition<attributeList.size()){
BPA_ATTRIBUTE attribute = attributeList.get(attributePosition);
//判断是否绑定了属性
List<BPA_SUBATTRIBUTE> subattributes = SubAttributeDBUtil.getByParentAttributeId(attribute.id);
for(BPA_SUBATTRIBUTE bean : subattributes){
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString());
String goodName = SubAttributeGroupDBUtil.isIncludeByClassify(classifyId,bean.name);
if(!goodName.isEmpty()){
NewToastUtil.showToast(this,"商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品", Toast.LENGTH_SHORT);
return;
}
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> {
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("新增子属性名称");
binding.edit.setHint("请输入子属性名称");
binding.submit.setOnClickListener(view1 -> {
BPA_ATTRIBUTE attribute = attributeList.get(attributePosition);
String input = String.valueOf(binding.edit.getText());
if(!input.isEmpty()){
for(BPA_SUBATTRIBUTE bean:subattributeList){
if(bean.name.equals(input)){
ToastUtils.info("已有该子属性,请换一个名称!");
return;
}
}
BPA_SUBATTRIBUTE subattribute = new BPA_SUBATTRIBUTE();
subattribute.name = input;
subattribute.parentAttributeId = attribute.id;
SubAttributeDBUtil.add(subattribute);
xCom.dismissX();
subattributeList.add(subattribute);
subattributeAdapter.notifyDataSetChanged();
}else {
ToastUtils.info("名称不能为空!");
}
AttributeDBUtil.delete(attribute);
if(attributePosition-1>=0){
attributeList.remove(attributePosition);
attributePosition = attributePosition-1;
attributeAdapter.setSelectPosition(attributePosition);
subattributeList.clear();
subattributeList.addAll(SubAttributeDBUtil.getByParentAttributeId(attributeList.get(attributePosition).id));
}else {
attributeList.clear();
subattributeList.clear();
}
attributeAdapter.notifyDataSetChanged();
subattributeAdapter.notifyDataSetChanged();
}
}

/**
* 添加子属性
*/
private void addSubAttribute(){
if(classifyPosition==0){
return;
}
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> {
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("新增子属性名称");
binding.edit.setHint("请输入子属性名称");
binding.submit.setOnClickListener(view1 -> {
BPA_ATTRIBUTE attribute = attributeList.get(attributePosition);
String input = String.valueOf(binding.edit.getText());
if(!input.isEmpty()){
for(BPA_SUBATTRIBUTE bean:subattributeList){
if(bean.name.equals(input)){
ToastUtils.info("已有该子属性,请换一个名称!");
return;
}
});
});
break;
}
BPA_SUBATTRIBUTE subattribute = new BPA_SUBATTRIBUTE();
subattribute.name = input;
subattribute.parentAttributeId = attribute.id;
SubAttributeDBUtil.add(subattribute);
xCom.dismissX();
subattributeList.add(subattribute);
subattributeAdapter.notifyDataSetChanged();
}else {
ToastUtils.info("名称不能为空!");
}
});
});
}

/**
* 删除子属性
*/
private void removeSubAttribute(int position,Object data){

BPA_SUBATTRIBUTE bean = (BPA_SUBATTRIBUTE) data;
//判断是否绑定了属性
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString());
String goodName = SubAttributeGroupDBUtil.isIncludeByClassify(classifyId,bean.name);
if(!goodName.isEmpty()){
NewToastUtil.showToast(this,"商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品", Toast.LENGTH_SHORT);
return;
}
SubAttributeDBUtil.delete(bean);
subattributeList.remove(position);
subattributeAdapter.notifyDataSetChanged();
}

private void initTopBar(){


+ 0
- 9
app/src/main/java/com/bonait/bnframework/ui/activity/EditProcessActivity.java View File

@@ -1,9 +0,0 @@
package com.bonait.bnframework.ui.activity;

/**
* @author: liup
* @description:
* @date: 2024/5/15 17:26.
*/
public class EditProcessActivity {
}

+ 18
- 3
app/src/main/java/com/bonait/bnframework/ui/adapter/SelectAttributeListAdapter.java View File

@@ -87,16 +87,31 @@ public class SelectAttributeListAdapter extends ArrayAdapter<BPA_ATTRIBUTE> {
}

/**
* 返回选中的子属性组合 “a-b”形式
* 返回选中的子属性name组合 “a-b”形式
*/
public String getSubAttributeList(){
public String getSubAttributeNameList(){
StringBuilder list = new StringBuilder();
for (SelectSubAttributeAdapter adapter:subAttributeAdapters){
if(adapter.getCurrentPosition() >= 0 && adapter.getData().size()>adapter.getCurrentPosition()){
list.append(adapter.getData().get(adapter.getCurrentPosition()).name).append("-");
}
}
String groupName = list.substring(0,list.length()-1);
String groupName = list.length()>0?list.substring(0,list.length()-1):"";
LogUtils.d(" getSubAttributeList groupName="+groupName);
return groupName;
}

/**
* 返回选中的子属性id组合 “a,b”形式
*/
public String getSubAttributeIdList(){
StringBuilder list = new StringBuilder();
for (SelectSubAttributeAdapter adapter:subAttributeAdapters){
if(adapter.getCurrentPosition() >= 0 && adapter.getData().size()>adapter.getCurrentPosition()){
list.append(adapter.getData().get(adapter.getCurrentPosition()).name).append(",");
}
}
String groupName = list.length()>0?list.substring(0,list.length()-1):"";
LogUtils.d(" getSubAttributeList groupName="+groupName);
return groupName;
}


+ 48
- 32
app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java View File

@@ -20,7 +20,6 @@ import androidx.fragment.app.DialogFragment;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.ViewModel.ActivityViewModel.DiyUpdate1Activity;
import com.bonait.bnframework.ViewModel.ActivityViewModel.ImageChooseActivity;
import com.bonait.bnframework.common.db.mode.BPA_ATTRIBUTE;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
@@ -37,6 +36,7 @@ import com.bonait.bnframework.common.utils.ProcessValueUtil;
import com.bonait.bnframework.databinding.DialogEditGoodsBinding;
import com.bonait.bnframework.event.FreshLocalGoodsEvent;
import com.bonait.bnframework.event.ImageSelectEvent;
import com.bonait.bnframework.ui.activity.DiyProcessActivity;
import com.bonait.bnframework.ui.adapter.SelectAttributeListAdapter;
import com.bonait.bnframework.ui.widget.NewToastUtil;

@@ -76,6 +76,7 @@ public class EditGoodsDialog extends DialogFragment {
* 属性组合
*/
private SelectAttributeListAdapter selectAttributeListAdapter;
private BPA_GOODS_SUBATTRIBUTE_GROUP subattributeGroup;

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -205,13 +206,13 @@ public class EditGoodsDialog extends DialogFragment {
case 3:

addAttributeGroup();
updateMainFoodsName(selectAttributeListAdapter.getSubAttributeList());
updateMainFoodsName();

LogUtils.d(TAG+" submit mainFoods="+ mainFoods);
viewBinding.layoutName.getRoot().setVisibility(View.GONE);
viewBinding.layoutAttribute.getRoot().setVisibility(View.GONE);
viewBinding.layoutMainfoods.getRoot().setVisibility(View.VISIBLE);
viewBinding.layoutMainfoods.title3.setText(goods.name+"-"+selectAttributeListAdapter.getSubAttributeList());
viewBinding.layoutMainfoods.title3.setText(goods.name+"-"+selectAttributeListAdapter.getSubAttributeNameList());
break;
}
}
@@ -220,46 +221,60 @@ public class EditGoodsDialog extends DialogFragment {
* 添加属性组
*/
private void addAttributeGroup(){
BPA_GOODS_SUBATTRIBUTE_GROUP subattributeGroup = new BPA_GOODS_SUBATTRIBUTE_GROUP();
subattributeGroup.goodsId = goods.id;
subattributeGroup.maketime = 0;
subattributeGroup.name = "";
if(selectAttributeListAdapter != null && selectAttributeListAdapter.datas!=null && !selectAttributeListAdapter.datas.isEmpty()){
subattributeGroup.name = selectAttributeListAdapter.getSubAttributeList();
boolean isExist = false;
for(BPA_GOODS_SUBATTRIBUTE_GROUP bean : SubAttributeGroupDBUtil.getByGoodsId(goods.id)){
if(bean.name.equals(selectAttributeListAdapter.getSubAttributeNameList())){
isExist = true;
subattributeGroup = bean;
break;
}
}
LogUtils.d(TAG+" addAttributeGroup isExist="+isExist);
if(!isExist){
subattributeGroup = new BPA_GOODS_SUBATTRIBUTE_GROUP();
subattributeGroup.goodsId = goods.id;
subattributeGroup.maketime = 0;
subattributeGroup.name = "";
if(selectAttributeListAdapter != null && selectAttributeListAdapter.datas!=null && !selectAttributeListAdapter.datas.isEmpty()){
subattributeGroup.name = selectAttributeListAdapter.getSubAttributeNameList();
subattributeGroup.subAttributeIdList = selectAttributeListAdapter.getSubAttributeIdList();
}
SubAttributeGroupDBUtil.add(subattributeGroup);
}
SubAttributeGroupDBUtil.add(subattributeGroup);
}

/**
* 将工序里的主料名称读出来
*/
private void updateMainFoodsName(String groupName){
private void updateMainFoodsName(){
viewBinding.layoutMainfoods.editName1.setText("");
viewBinding.layoutMainfoods.editName2.setText("");
viewBinding.layoutMainfoods.editName3.setText("");
viewBinding.layoutMainfoods.editName4.setText("");
viewBinding.layoutMainfoods.editName5.setText("");
viewBinding.layoutMainfoods.editName6.setText("");
ArrayList<BPA_GOODS_PROCESS_DETAIL> list = GoodsProcessDetailDBUtil.getByGoodsSubAttributeGroupName(groupName);
for(BPA_GOODS_PROCESS_DETAIL bean:list ){
String processname = bean.processname;
if(processname.contains("主料")){
String processvalue = bean.processvalue;
if(!processvalue.isEmpty()){
HashMap<String,String> params = ProcessValueUtil.dealProcessValue(processvalue);
if(!params.isEmpty()){
int position = 0;//几号位
String name = "";//主料名称
for (HashMap.Entry<String, String> entry : params.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if(key.contains("名称")){
name = value;
}else if(key.contains("位置")){
position = Integer.parseInt(value.replace("号位",""));
if(subattributeGroup!=null){
ArrayList<BPA_GOODS_PROCESS_DETAIL> list = GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id);
for(BPA_GOODS_PROCESS_DETAIL bean:list ){
String processname = bean.processname;
if(processname.contains("主料")){
String processvalue = bean.processvalue;
if(!processvalue.isEmpty()){
HashMap<String,String> params = ProcessValueUtil.dealProcessValue(processvalue);
if(!params.isEmpty()){
int position = 0;//几号位
String name = "";//主料名称
for (HashMap.Entry<String, String> entry : params.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if(key.contains("名称")){
name = value;
}else if(key.contains("位置")){
position = Integer.parseInt(value.replace("号位",""));
}
}
updateName(position,name);
}
updateName(position,name);
}
}
}
@@ -311,11 +326,12 @@ public class EditGoodsDialog extends DialogFragment {
mainFoods.add(viewBinding.layoutMainfoods.editName4.getText().toString());
mainFoods.add(viewBinding.layoutMainfoods.editName5.getText().toString());
mainFoods.add(viewBinding.layoutMainfoods.editName6.getText().toString());
//TODO
Intent intent = new Intent(getContext(), DiyUpdate1Activity.class);
Intent intent = new Intent(getContext(), DiyProcessActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putStringArrayListExtra("mainFoods",mainFoods);
intent.putExtra("attributeGroupName",selectAttributeListAdapter.getSubAttributeList());
intent.putExtra("goodId",goods.id);
intent.putExtra("subAttributeGroupId",selectAttributeListAdapter.getSubAttributeIdList());
intent.putExtra("subAttributeGroupName",selectAttributeListAdapter.getSubAttributeNameList());
startActivity(intent);
dismiss();
}


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

@@ -118,6 +118,8 @@ public class HomeFoodsFragment extends BaseFragment {
}
}



private void requestData(){
if (NetworkUtils.checkNetworkAvailable(context)) {
if(!viewModel.hasData){


+ 21
- 1
app/src/main/java/com/bonait/bnframework/ui/viewmodel/HomeGoodsViewModel.java View File

@@ -29,7 +29,9 @@ import com.lzy.okgo.model.HttpHeaders;
import com.lzy.okgo.model.Response;

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

/**
* @author: liup
@@ -79,6 +81,7 @@ public class HomeGoodsViewModel extends ViewModel {
//添加属性
for (GoodsClassifyBean bean : ConfigName.getInstance().cloudGoodsList){
if(goodsClassify.id.equals(bean.getGoodsTypeId())){
Map<String ,String> subAttributeMap = new HashMap<>();
for(GoodsClassifyBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList() ){
//判断是否已有属性 不存在则添加
if(!AttributeDBUtil.isExist(goodsClassify.id,goodsAttributeListBean.getGoodsAttributeName())){
@@ -104,6 +107,7 @@ public class HomeGoodsViewModel extends ViewModel {
}else {
LogUtils.d(" 已存在子属性 "+goodsAttributeValueListBean.getAttributeValue());
}
subAttributeMap.put(goodsAttributeValueListBean.getGoodsAttributeValueId(),goodsAttributeValueListBean.getAttributeValue());
}

}
@@ -117,7 +121,7 @@ public class HomeGoodsViewModel extends ViewModel {
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.name = goodsTechnologyActionListBean.getGoodsAttributeId();//
group.id = goodsTechnologyActionListBean.getGoodsAttributeId();
group.goodsId = goods.id;
groupList.add(goodsTechnologyActionListBean.getGoodsAttributeId());
@@ -143,4 +147,20 @@ public class HomeGoodsViewModel extends ViewModel {
}
}
}

// /**
// * 将子属性组合转换为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));
// }
// }
// }
}

+ 7
- 0
app/src/main/res/drawable/bg_round50_left_green.xml View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<corners android:bottomLeftRadius="@dimen/dp_50"
android:topLeftRadius="@dimen/dp_50"/>
<solid android:color="#567722"/>
</shape>

+ 1
- 1
app/src/main/res/drawable/bg_round50_red_btn.xml View File

@@ -11,7 +11,7 @@
<item>
<shape>
<corners android:radius="@dimen/dp_50"/>
<solid android:color="#F21A06"/>
<solid android:color="#DA5A17"/>
</shape>

</item>

+ 7
- 0
app/src/main/res/drawable/bg_round50_right_green.xml View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<corners android:topRightRadius="@dimen/dp_50"
android:bottomRightRadius="@dimen/dp_50"/>
<solid android:color="#567722"/>
</shape>

+ 22
- 6
app/src/main/res/layout/activity_edit_classify.xml View File

@@ -22,7 +22,7 @@
android:gravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_20"
android:textSize="@dimen/sp_32"
android:textColor="#823E17"
@@ -40,23 +40,23 @@

<TextView
android:id="@+id/btn_add_classify"
android:layout_width="@dimen/dp_170"
android:layout_width="@dimen/dp_110"
android:layout_height="@dimen/dp_70"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/bg_round15_yellow_btn"
android:text="新增分类"
android:text="新增"
android:textColor="@color/white"
android:gravity="center"
android:textSize="@dimen/sp_32"
app:layout_constraintLeft_toRightOf="@id/spinner_classify"
app:layout_constraintTop_toTopOf="@id/desc"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginLeft="@dimen/dp_10"
/>

<TextView
android:id="@+id/btn_delete_classify"
android:layout_width="@dimen/dp_130"
android:layout_width="@dimen/dp_110"
android:layout_height="@dimen/dp_70"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
@@ -67,7 +67,23 @@
android:textSize="@dimen/sp_32"
app:layout_constraintLeft_toRightOf="@id/btn_add_classify"
app:layout_constraintTop_toTopOf="@id/desc"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginLeft="@dimen/dp_10"
/>

<TextView
android:id="@+id/btn_update_classify"
android:layout_width="@dimen/dp_110"
android:layout_height="@dimen/dp_70"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/bg_round15_yellow_btn"
android:text="修改"
android:textColor="@color/white"
android:gravity="center"
android:textSize="@dimen/sp_32"
app:layout_constraintLeft_toRightOf="@id/btn_delete_classify"
app:layout_constraintTop_toTopOf="@id/desc"
android:layout_marginLeft="@dimen/dp_10"
/>




+ 224
- 0
app/src/main/res/layout/activity_edit_process.xml View File

@@ -0,0 +1,224 @@
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout 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"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:id="@+id/root"
android:fitsSystemWindows="true">

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/content"
android:layout_marginTop="@dimen/dp_54"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!--顶部-->
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_100"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:paddingLeft="@dimen/dp_160"
android:paddingRight="@dimen/dp_160"
style="@style/TextView_normal_size"
android:textStyle="bold"
android:maxLines="2"
android:textColor="@color/black"
tools:text="海椒炒肉-xxx-xxx"
/>
<TextView
android:id="@+id/btn_jump_record_process"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:text="录制工序"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/line1"
app:layout_constraintLeft_toLeftOf="parent"
android:paddingRight="@dimen/dp_10"
android:background="@drawable/bg_round50_right_green"
/>
<TextView
android:id="@+id/btn_copy_process"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:text="导入工序"
android:paddingLeft="@dimen/dp_10"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/line1"
app:layout_constraintRight_toRightOf="parent"
android:background="@drawable/bg_round50_left_green"
/>
<TextView
android:id="@+id/line1"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="@dimen/dp_100"
android:background="@color/color3"
/>
<TextView
android:id="@+id/line2"
android:layout_width="@dimen/dp_1"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/line1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="@dimen/dp_290"
android:background="@color/color3"
/>

<TextView
android:id="@+id/tv_1"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_70"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/line1"
style="@style/TextView_normal_size"
android:text="步骤:"
android:layout_marginTop="@dimen/dp_10"
android:textColor="#567722"
android:layout_marginLeft="@dimen/dp_20"
/>
<TextView
android:id="@+id/tv_2"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="@dimen/dp_160"
android:layout_height="@dimen/dp_70"
app:layout_constraintLeft_toRightOf="@id/line2"
app:layout_constraintTop_toBottomOf="@id/line1"
style="@style/TextView_normal_size"
android:text="烹饪工序:"
android:textColor="#823E17"
android:layout_marginLeft="@dimen/dp_20"
/>

<!--步骤列表-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_step"
android:layout_width="@dimen/dp_250"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_1"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_110"
/>

<LinearLayout
android:id="@+id/ll_1"
android:layout_width="@dimen/dp_430"
android:layout_height="@dimen/dp_70"
app:layout_constraintLeft_toRightOf="@id/line2"
app:layout_constraintTop_toBottomOf="@id/line1"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_10"
android:gravity="right"
>

<Spinner
android:id="@+id/spinner_process"
style="@style/commonSpinnerStyle"
android:layout_width="@dimen/dp_260"
android:layout_height="@dimen/dp_70"
/>
</LinearLayout>


<ScrollView
android:id="@+id/scrollView"
android:layout_width="@dimen/dp_430"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_15"
app:layout_constraintLeft_toRightOf="@id/line2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/ll_1"
android:layout_marginBottom="@dimen/dp_200"
android:layout_marginLeft="@dimen/dp_20"
>

<LinearLayout
android:id="@+id/ll_process_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</ScrollView>

<!--模拟炒制-->
<TextView
android:id="@+id/btn_simulation"
android:layout_width="@dimen/dp_180"
style="@style/TextView_btn_normal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/line2"
android:layout_marginBottom="@dimen/dp_25"
android:text="模拟炒制"
/>

<LinearLayout
android:layout_width="0dp"
app:layout_constraintLeft_toLeftOf="@id/line2"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_120"
android:gravity="center"
android:layout_height="wrap_content">
<!--添加-->
<TextView
android:id="@+id/btn_add"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:text="+添加"
android:layout_marginRight="@dimen/dp_80"
/>
<!--插入-->
<TextView
android:id="@+id/btn_insert"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:text="插入"
/>
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
app:layout_constraintLeft_toLeftOf="@id/line2"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_25"
android:gravity="center"
android:layout_height="wrap_content">
<!--修改-->
<TextView
android:id="@+id/btn_update"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:background="@drawable/bg_round50_green_btn"
android:text="修改"
android:layout_marginRight="@dimen/dp_80"
/>
<!--删除-->
<TextView
android:id="@+id/btn_delete"
android:layout_width="@dimen/dp_150"
style="@style/TextView_btn_normal"
android:background="@drawable/bg_round50_red_btn"
android:text="删除"
/>
</LinearLayout>


</androidx.constraintlayout.widget.ConstraintLayout>

<com.qmuiteam.qmui.widget.QMUITopBarLayout
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 41
- 25
app/src/main/res/layout/activity_welcome.xml View File

@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:id="@+id/root"
android:layout_height="match_parent"
tools:context=".ViewModel.ActivityViewModel.WelcomeActivity">

@@ -10,33 +11,48 @@
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
<ImageView
android:id="@+id/logo"
android:layout_width="@dimen/dp_500"
android:layout_height="@dimen/dp_500"
android:layout_centerInParent="true"
android:src="@mipmap/login_ico" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.qmuiteam.qmui.widget.QMUILoadingView
android:id="@+id/loading"
android:layout_width="@dimen/dp_150"
android:layout_height="@dimen/dp_150"
android:color="@color/white"
android:visibility="visible"
app:qmui_loading_view_size="@dimen/dp_50"
tools:ignore="MissingConstraints"
android:layout_centerInParent="true"/>
</RelativeLayout>
<TextView
android:id="@+id/desc"
android:layout_marginTop="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="软件初始化,加载中请稍后...."
android:textColor="@color/white"
android:textSize="@dimen/sp_36"/>
</LinearLayout>
android:layout_centerHorizontal="true"
android:layout_below="@id/logo"
android:src="@mipmap/login_name" />

<!-- <LinearLayout-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerInParent="true"-->
<!-- android:visibility="gone"-->
<!-- android:orientation="vertical">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content">-->
<!-- <com.qmuiteam.qmui.widget.QMUILoadingView-->
<!-- android:id="@+id/loading"-->
<!-- android:layout_width="@dimen/dp_150"-->
<!-- android:layout_height="@dimen/dp_150"-->
<!-- android:color="@color/white"-->
<!-- android:visibility="visible"-->
<!-- app:qmui_loading_view_size="@dimen/dp_50"-->
<!-- tools:ignore="MissingConstraints"-->
<!-- android:layout_centerInParent="true"/>-->
<!-- </RelativeLayout>-->
<!-- <TextView-->
<!-- android:id="@+id/desc"-->
<!-- android:layout_marginTop="@dimen/dp_10"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:text="软件初始化,加载中请稍后...."-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="@dimen/sp_36"/>-->
<!-- </LinearLayout>-->

</RelativeLayout>


+ 36
- 32
app/src/main/res/layout/dialog/layout/layout_add_goods_mainfood.xml View File

@@ -18,7 +18,7 @@
android:lines="1"
android:singleLine="true"
android:ellipsize="start"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="按编号填写主料名称"
/>

@@ -57,7 +57,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="未设置"
android:hint="1号位"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -81,7 +81,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="未设置"
android:hint="2号位"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -117,7 +117,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="未设置"
android:hint="3号位"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -141,7 +141,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="未设置"
android:hint="4号位"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -177,7 +177,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="未设置"
android:hint="5号位"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -201,7 +201,7 @@
android:layout_width="@dimen/dp_250"
android:layout_height="match_parent"
android:background="@drawable/input_bj"
android:hint="未设置"
android:hint="6号位"
android:inputType="text"
android:lines="1"
android:padding="@dimen/dp_3"
@@ -215,35 +215,39 @@
</LinearLayout>


<TextView
android:id="@+id/btn_next3"
android:layout_width="@dimen/dp_255"
android:layout_height="@dimen/dp_120"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/dp_350"
android:layout_marginBottom="@dimen/dp_20"
android:gravity="center"
android:textSize="@dimen/sp_48"
android:textColor="@color/white"
android:background="@drawable/bg_round25_green_btn"
android:text="编辑工艺"
/>

<TextView
android:id="@+id/btn_last3"
android:layout_width="@dimen/dp_255"

<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/dp_120"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/dp_50"
android:layout_marginBottom="@dimen/dp_20"
android:gravity="center"
android:textSize="@dimen/sp_48"
android:textColor="@color/white"
android:background="@drawable/bg_round25_yellow_btn"
android:text="去烹饪"
/>
app:layout_constraintLeft_toLeftOf="parent">
<TextView
android:id="@+id/btn_next3"
android:layout_width="@dimen/dp_255"
android:layout_height="@dimen/dp_120"
android:gravity="center"
android:textSize="@dimen/sp_48"
android:textColor="@color/white"
android:background="@drawable/bg_round25_green_btn"
android:text="编辑工艺"
/>
<TextView
android:id="@+id/btn_last3"
android:layout_width="@dimen/dp_255"
android:layout_height="@dimen/dp_120"
android:layout_marginLeft="@dimen/dp_50"
android:gravity="center"
android:textSize="@dimen/sp_48"
android:textColor="@color/white"
android:background="@drawable/bg_round25_yellow_btn"
android:text="去烹饪"
/>

</LinearLayout>


<ImageView
android:id="@+id/btn_close3"
@@ -251,7 +255,7 @@
android:layout_height="@dimen/dp_80"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:background="@mipmap/ic_clear_white_48dp"
/>


+ 4
- 4
app/src/main/res/layout/dialog/layout/layout_add_goods_name.xml View File

@@ -13,7 +13,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="@drawable/bg_round25_top_yellow"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
tools:text="川菜系列"
/>

@@ -81,7 +81,7 @@
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/dp_480"
android:layout_marginBottom="@dimen/dp_20"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="确认"
/>

@@ -93,7 +93,7 @@
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="上一步"
/>

@@ -103,7 +103,7 @@
android:layout_height="@dimen/dp_80"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:background="@mipmap/ic_clear_white_48dp"
/>


+ 4
- 4
app/src/main/res/layout/dialog/layout/layout_add_goods_sel_classify.xml View File

@@ -13,7 +13,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="@drawable/bg_round25_top_yellow"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="选择分类"
/>

@@ -48,7 +48,7 @@
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="取消"
/>

@@ -60,7 +60,7 @@
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/dp_480"
android:layout_marginBottom="@dimen/dp_20"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="下一步"
/>

@@ -70,7 +70,7 @@
android:layout_height="@dimen/dp_80"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:background="@mipmap/ic_clear_white_48dp"
/>


+ 4
- 4
app/src/main/res/layout/dialog/layout/layout_edit_goods_name.xml View File

@@ -13,7 +13,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="@drawable/bg_round25_top_yellow"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="编辑菜品"
/>

@@ -81,7 +81,7 @@
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/dp_480"
android:layout_marginBottom="@dimen/dp_20"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="下一步"
/>

@@ -93,7 +93,7 @@
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="取消"
/>

@@ -103,7 +103,7 @@
android:layout_height="@dimen/dp_80"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:background="@mipmap/ic_clear_white_48dp"
/>


+ 4
- 4
app/src/main/res/layout/dialog/layout/layout_edit_goods_sub_attribute.xml View File

@@ -13,7 +13,7 @@
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="@drawable/bg_round25_top_yellow"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="选择属性"
/>

@@ -38,7 +38,7 @@
android:layout_marginLeft="@dimen/dp_480"
android:layout_marginBottom="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_30"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="下一步"
/>

@@ -52,7 +52,7 @@
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_30"
android:layout_marginBottom="@dimen/dp_20"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:text="上一步"
/>

@@ -62,7 +62,7 @@
android:layout_height="@dimen/dp_80"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
style="@style/TextView_btn"
style="@style/TextView_btn_dialog"
android:background="@mipmap/ic_clear_white_48dp"
/>


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

@@ -53,6 +53,7 @@

<androidx.recyclerview.widget.RecyclerView
android:layout_marginLeft="@dimen/dp_21"
android:layout_marginTop="@dimen/dp_3"
android:id="@+id/recycler_goods"
android:layout_width="match_parent"
android:layout_marginBottom="@dimen/dp_95"


+ 15
- 1
app/src/main/res/values/styles.xml View File

@@ -315,7 +315,21 @@
<item name="android:gravity">center</item>
</style>

<style name="TextView_btn">
<style name="TextView_normal_size">
<item name="android:textSize">@dimen/sp_32</item>
<item name="android:gravity">center</item>
<item name="android:textColor">@color/white</item>
</style>

<style name="TextView_btn_normal">
<item name="android:layout_height">@dimen/dp_70</item>
<item name="android:gravity">center</item>
<item name="android:textSize">@dimen/sp_32</item>
<item name="android:textColor">@color/white</item>
<item name="android:background">@drawable/bg_round50_yellow_btn</item>
</style>

<style name="TextView_btn_dialog">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/sp_32</item>
<item name="android:gravity">center</item>


Loading…
Cancel
Save