Browse Source

修改新建配方

调味吧台
liup 5 months ago
parent
commit
ebbc03060d
22 changed files with 1411 additions and 273 deletions
  1. +10
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/BaseAdapter.java
  2. +127
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/GoodGroupDetailAdapter.java
  3. +130
    -43
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/GoodGroupNameAdapter.java
  4. +15
    -13
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java
  5. +129
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/AddGoodDialog.java
  6. +301
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/CopyRecipeDialog.java
  7. +114
    -10
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/GoodsEditView.java
  8. +17
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java
  9. +39
    -0
      app/src/main/res/anim/anim_scale_in.xml
  10. +23
    -0
      app/src/main/res/anim/anim_scale_out.xml
  11. +32
    -0
      app/src/main/res/drawable/spinner_border_bg.xml
  12. +29
    -10
      app/src/main/res/layout/activity_goodpeifang.xml
  13. +154
    -0
      app/src/main/res/layout/item/layout/dialog_add_good_info.xml
  14. +10
    -9
      app/src/main/res/layout/item/layout/dialog_add_makegood.xml
  15. +1
    -3
      app/src/main/res/layout/item/layout/goods_edit_layout.xml
  16. +69
    -106
      app/src/main/res/layout/item/layout/item_group_detail.xml
  17. +125
    -79
      app/src/main/res/layout/item/layout/item_group_name.xml
  18. +12
    -0
      app/src/main/res/layout/item/layout/spinner_dropdown24_item.xml
  19. +13
    -0
      app/src/main/res/layout/item/layout/spinner_dropdown32_item.xml
  20. +17
    -0
      app/src/main/res/layout/item/layout/spinner_text24_item.xml
  21. +17
    -0
      app/src/main/res/layout/item/layout/spinner_text32_item.xml
  22. +27
    -0
      app/src/main/res/values/styles.xml

+ 10
- 0
app/src/main/java/com/bonait/bnframework/modules/home/adapter/BaseAdapter.java View File

@@ -90,6 +90,16 @@ public abstract class BaseAdapter<T, VH extends RecyclerView.ViewHolder>
notifyItemRangeInserted(mData.size() - newData.size(), newData.size());
}

/**
* 添加数据
*
* @param newData 新数据
*/
public void addData(T newData) {
mData.add(newData);
notifyItemRangeInserted(mData.size() - 1, 1);
}

/**
* 更新数据
*


+ 127
- 0
app/src/main/java/com/bonait/bnframework/modules/home/adapter/GoodGroupDetailAdapter.java View File

@@ -0,0 +1,127 @@
package com.bonait.bnframework.modules.home.adapter;


import android.annotation.SuppressLint;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;

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

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPENAME;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.res.ResGoodsRecipe;
import com.bonait.bnframework.common.db.res.ResMaterilas;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ItemGroupDetailBinding;

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

/**
* @author: liup
* @description: 配方详情
* @date: 2024/6/6 17:30.
*/
public class GoodGroupDetailAdapter extends BaseAdapter<ResGoodsRecipe, GoodGroupDetailAdapter.ViewHolder> {
/**
* 当前物料数据
*/
public List<BPA_MATERIAL> materilasList=new ArrayList<>();

public void setMaterilasList(List<BPA_MATERIAL> materilasList) {
this.materilasList = materilasList;
}

@Override
protected void onItemClick(View v, int position) {

}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(ItemGroupDetailBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, @SuppressLint("RecyclerView") int position) {
if(holder.binding.btnMaterialDelete.getTextSize()>28||holder.binding.btnMaterialDelete.getTextSize()<24){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
holder.binding.btnMaterialDelete.setOnClickListener(view -> {

});
List<String> names = new ArrayList<>();
for(BPA_MATERIAL material : materilasList){
names.add(material.name);
}
ArrayAdapter<String> adapter = new ArrayAdapter<>(holder.binding.spinnerName.getContext(), R.layout.spinner_text24_item, names);
adapter.setDropDownViewResource(R.layout.spinner_dropdown24_item);
holder.binding.spinnerName.setAdapter(adapter);

if(mData.get(position).materialID!=null && !mData.get(position).materialID.isEmpty()){
for(int i=0;i<materilasList.size();i++){
if(materilasList.get(i).id.equals(mData.get(position).materialID)){
holder.binding.spinnerName.setSelection(i);
break;
}
}
}
holder.binding.spinnerName.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int p, long l) {
for(int i=0;i<materilasList.size();i++){
if(materilasList.get(i).name.equals(holder.binding.spinnerName.getSelectedItem().toString())){
mData.get(position).materialID = materilasList.get(i).id;
mData.get(position).materialName = materilasList.get(i).name;
break;
}
}

}

@Override
public void onNothingSelected(AdapterView<?> adapterView) {

}
});
holder.binding.edittextWeight.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void afterTextChanged(Editable editable) {
mData.get(position).value = editable.toString();
}
});

holder.binding.btnMaterialDelete.setOnClickListener(v->{
mData.remove(position);
notifyDataSetChanged();
});

}

public static class ViewHolder extends RecyclerView.ViewHolder {
private ItemGroupDetailBinding binding;

public ViewHolder(ItemGroupDetailBinding view) {
super(view.getRoot());
binding = view;
}
}
}

+ 130
- 43
app/src/main/java/com/bonait/bnframework/modules/home/adapter/GoodGroupNameAdapter.java View File

@@ -1,43 +1,130 @@
//package com.bonait.bnframework.modules.home.adapter;
//
//
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//
//import androidx.annotation.NonNull;
//import androidx.recyclerview.widget.RecyclerView;
//
//import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPENAME;
//
///**
// * @author: liup
// * @description:
// * @date: 2024/6/6 17:30.
// */
//public class GoodGroupNameAdapter extends BaseAdapter<BPA_GOODSRECIPENAME,GoodGroupNameAdapter.ViewHolder> {
// @Override
// protected void onItemClick(View v, int position) {
//
// }
//
// @NonNull
// @Override
// public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
// return new ViewHolder(ItemStepBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
// }
//
// @Override
// public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
//
// }
//
// public static class ViewHolder extends RecyclerView.ViewHolder {
//
//
// public ViewHolder(ItemStepBinding view) {
// super(view.getRoot());
// binding = view;
// }
// }
//}
package com.bonait.bnframework.modules.home.adapter;


import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

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

import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPENAME;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.res.ResGoodsRecipe;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.databinding.ItemGroupNameBinding;

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

/**
* @author: liup
* @description: 配方名称+配方详情
* @date: 2024/6/6 17:30.
*/
public abstract class GoodGroupNameAdapter extends BaseAdapter<BPA_GOODSRECIPENAME,GoodGroupNameAdapter.ViewHolder> {
/**
* 当前物料数据
*/
public List<BPA_MATERIAL> materilasList=new ArrayList<>();

public void setMaterilasList(List<BPA_MATERIAL> materilasList) {
this.materilasList = materilasList;
}

@Override
protected void onItemClick(View v, int position) {

}

protected abstract void onDelete(int position,BPA_GOODSRECIPENAME bean);
protected abstract void onCopy(int position,BPA_GOODSRECIPENAME bean);

@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(ItemGroupNameBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
}

@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
if(holder.binding.groupName.getTextSize()>28||holder.binding.groupName.getTextSize()<24){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
holder.binding.groupName.setText(mData.get(position).name+"");
holder.binding.btnCopy.setOnClickListener(v->{
onCopy(position,mData.get(position));
});
holder.binding.btnDelete.setOnClickListener(v->{
onDelete(position,mData.get(position));
});
if(holder.binding.tvExpand.getText().toString().equals("收起")){
holder.binding.recycleDetail.setVisibility(View.VISIBLE);
}else {
holder.binding.recycleDetail.setVisibility(View.GONE);
}
GoodGroupDetailAdapter detailAdapter = new GoodGroupDetailAdapter();
detailAdapter.setMaterilasList(materilasList);
detailAdapter.setNewData(QueryDB.GetGoodsSrecipeList(mData.get(position).id));
holder.binding.recycleDetail.setAdapter(detailAdapter);
holder.binding.btnSave.setOnClickListener(v->{
ArrayList<ResGoodsRecipe> re= QueryDB.GetGoodsSreciperecipeList(mData.get(position).id);
for(ResGoodsRecipe item:re)
{
QueryDB.DeleteGoodsSrecipe(item.id);
}

for (ResGoodsRecipe i: detailAdapter.getData())
{
BPA_GOODSRECIPE good=new BPA_GOODSRECIPE();
good.materialID=i.materialID;
good.recipeID=mData.get(position).id;
good.goodsID=mData.get(position).goodsID;
good.value=i.value;
good.sort=0;
QueryDB.AddGoodsSrecipe(good);
}
ToastUtils.info("保存成功");
});
holder.binding.btnAdd.setOnClickListener(v->{
ResGoodsRecipe bean = new ResGoodsRecipe();
bean.sort = 0;
bean.value = "0";
bean.materialName = "未设置";
detailAdapter.addData(bean);
detailAdapter.notifyDataSetChanged();
});

holder.binding.llArrow.setOnClickListener(v->{
if(holder.binding.tvExpand.getText().toString().equals("展开")){
holder.binding.tvExpand.setText("展开");
holder.binding.recycleDetail.setVisibility(View.VISIBLE);
}else {
holder.binding.tvExpand.setText("收起");
holder.binding.recycleDetail.setVisibility(View.GONE);
}
});
holder.binding.root.setOnClickListener(v->{
if(holder.binding.tvExpand.getText().toString().equals("展开")){
holder.binding.tvExpand.setText("收起");
holder.binding.recycleDetail.setVisibility(View.VISIBLE);
}else {
holder.binding.tvExpand.setText("展开");
holder.binding.recycleDetail.setVisibility(View.GONE);
}
});
}

public static class ViewHolder extends RecyclerView.ViewHolder {
private ItemGroupNameBinding binding;

public ViewHolder(ItemGroupNameBinding view) {
super(view.getRoot());
binding = view;
}
}
}

+ 15
- 13
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/GoodPeiFangActivity.java View File

@@ -123,17 +123,17 @@ public class GoodPeiFangActivity extends BaseActivity {
@BindView(R.id.add_good)
add_good_control add_good;

/**
* 增加配方选择页
*/
@BindView(R.id.add_pf_home)
add_pf_home_control add_pf_home;
/**
* 增加配方
*/
@BindView(R.id.add_pf)
add_pf_control add_pf;
// /**
// * 增加配方选择页
// */
// @BindView(R.id.add_pf_home)
// add_pf_home_control add_pf_home;
//
// /**
// * 增加配方
// */
// @BindView(R.id.add_pf)
// add_pf_control add_pf;

/**
* 商品类型
@@ -245,7 +245,6 @@ public class GoodPeiFangActivity extends BaseActivity {
if (k == 0) {
add_good.setVisibility(View.GONE);
} else if (k == 1) {
// Initdata();
BPA_GOODSTYPE bpaGoodstype = goodstypes.get(typePos);
ArrayList<BPA_GOODS> goodsm = QueryDB.GetGoodsTypeId(bpaGoodstype.id);
Fdata.set(typePos,new LinkMode(bpaGoodstype, Arrays.asList(goodsm.toArray()), false));
@@ -253,7 +252,6 @@ public class GoodPeiFangActivity extends BaseActivity {
ToastUtils.info("执行成功!!!");
add_good.setVisibility(View.GONE);
} else if (k == 2) { //保存并新建配方
// Initdata();
BPA_GOODSTYPE bpaGoodstype = goodstypes.get(typePos);
ArrayList<BPA_GOODS> goodsm = QueryDB.GetGoodsTypeId(bpaGoodstype.id);
Fdata.set(typePos,new LinkMode(bpaGoodstype, Arrays.asList(goodsm.toArray()), false));
@@ -450,6 +448,10 @@ public class GoodPeiFangActivity extends BaseActivity {
.show();
break;
case R.id.add_sp://增加商品
if(goodstypes.isEmpty()){
ToastUtils.info("请先创建至少一个分类");
return;
}
add_good.setData("保存", null, goodstypes, activity);
add_good.setVisibility(View.VISIBLE);
break;


+ 129
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/AddGoodDialog.java View File

@@ -0,0 +1,129 @@
package com.bonait.bnframework.modules.home.fragment.mode;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.databinding.DialogAddGoodInfoBinding;

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

import butterknife.ButterKnife;

/**
* @author: liup
* @description: 添加商品
* @date: 2024/6/7 16:02.
*/
public class AddGoodDialog extends DialogFragment {

private DialogAddGoodInfoBinding viewBinding;

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NORMAL, R.style.DialogScale);
}

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
viewBinding = DialogAddGoodInfoBinding.inflate(inflater,container,false);
ButterKnife.bind(this, viewBinding.getRoot());
DisplayManager.scaleViewGroup(viewBinding.getRoot());
return viewBinding.getRoot();
}



@Override
public void onStart() {
super.onStart();
if(getDialog()!=null){
Window window = getDialog().getWindow();
assert window != null;
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
WindowManager.LayoutParams params = window.getAttributes();
params.gravity = Gravity.CENTER;
params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
window.setAttributes(params);
}
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initView();
initData();
}

public String url="";

private void initView(){
viewBinding.closeFrom.setOnClickListener(v->{
dismiss();
});
viewBinding.save.setOnClickListener(v->{
String name = viewBinding.edittextName.getText().toString();
if(name.isEmpty()){
ToastUtils.info("名称不能为空");
return;
}
ArrayList<BPA_GOODS> goods = QueryDB.GetGoodsALL();
boolean isSucess = QueryDB.GetGoodsIs(name);
if(isSucess)
{
ToastUtils.info("菜谱名称已存在!");
return;
}
BPA_GOODS Data=new BPA_GOODS();
Data.name = name;
Data.status = 1;
Data.sort = goods.size() + 1;
Data.maketime = 180;
Data.issc = 1;
Data.url = url;
Data.foreignKeyRe=viewBinding.edittextFk.getText().toString();
Data.goodtype=mapTypes.get(viewBinding.spinner.getSelectedItem().toString());
QueryDB.AddGoods(Data);
});
}

Map<String,String> mapTypes = new LinkedHashMap<>();
private void initData(){
for (BPA_GOODSTYPE item:QueryDB.GetGoodsTypeALL())
{
mapTypes.put(item.name,item.id);
}
initSpinner();
}


private void initSpinner()
{
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(mapTypes.keySet()));
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinner.setAdapter(adapter);
}
}

+ 301
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/CopyRecipeDialog.java View File

@@ -0,0 +1,301 @@
package com.bonait.bnframework.modules.home.fragment.mode;

import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODPROPERTY;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPENAME;
import com.bonait.bnframework.common.db.mode.BPA_ORDER;
import com.bonait.bnframework.common.db.mode.BPA_SUBORDER;
import com.bonait.bnframework.common.db.res.ResGoodProperty;
import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.databinding.DialogAddMakegoodBinding;
import com.bonait.bnframework.modules.home.adapter.pfsx_adapter;

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

import butterknife.ButterKnife;

/**
* @author: liup
* @description: 复制配方
* @date: 2024/6/7 13:56.
*/
public class CopyRecipeDialog extends DialogFragment {
private DialogAddMakegoodBinding viewBinding;
private BPA_GOODS Good;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NORMAL, R.style.DialogScale);
if(getArguments()!=null){
String goodId = getArguments().getString("goodId");
Good = QueryDB.GetGoodsId(goodId);
}
}

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
viewBinding = DialogAddMakegoodBinding.inflate(inflater,container,false);
ButterKnife.bind(this, viewBinding.getRoot());
DisplayManager.scaleViewGroup(viewBinding.getRoot());
return viewBinding.getRoot();
}



@Override
public void onStart() {
super.onStart();
if(getDialog()!=null){
Window window = getDialog().getWindow();
assert window != null;
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
WindowManager.LayoutParams params = window.getAttributes();
params.gravity = Gravity.CENTER;
params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
window.setAttributes(params);
}
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initView();
}

ArrayList<ResGoodProperty> bpa_goodproperties = new ArrayList<>();
private pfsx_adapter sxadapter;

private void initView() {
viewBinding.quzhizuo.setText("复制");
viewBinding.makegoodtitle.setText(Good.name+"");
//2.填充规则数据,查询所有属性大类
viewBinding.datatabMakesx.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL,false));

ArrayList<BPA_GOODSRECIPENAME> goodsrecipenames = QueryDB.GetGoodsRecipeNameGoodId(Good.id);
assert goodsrecipenames != null;
LogUtils.d("add_makegood_control goodsrecipenames = "+goodsrecipenames.size());
List<String> attributeNameList = new ArrayList<>();
for(BPA_GOODSRECIPENAME goodsrecipename1 : goodsrecipenames){
if(goodsrecipename1.design.contains(",")){
String[] res = goodsrecipename1.design.split(",");
attributeNameList.addAll(Arrays.asList(res));
}else {
attributeNameList.add(goodsrecipename1.design);
}
}

bpa_goodproperties.clear();
ArrayList<BPA_GOODPROPERTY> parentAttributes = QueryDB.GetGoodsPropertyByTypeId(Good.goodtype);
for(BPA_GOODPROPERTY bpaGoodproperty : parentAttributes ){
ArrayList<BPA_GOODPROPERTY> zsx= QueryDB.GetGoodsPropertyALL(bpaGoodproperty.id);
ArrayList<ResGoodProperty> childList = new ArrayList<>();
for(BPA_GOODPROPERTY bean:zsx){
if(attributeNameList.contains(bean.id)){
ResGoodProperty child = new ResGoodProperty();
child.id = bean.id;
child.name = bean.name;
child.foreignKeyRe = bean.foreignKeyRe;
child.parentid = bpaGoodproperty.id;
child.sort = bean.sort;
child.GoodsTypeId = bean.GoodsTypeId;
child.isSelect = false;
childList.add(child);
}
}
if(!childList.isEmpty()){
ResGoodProperty resGoodProperty = new ResGoodProperty();
resGoodProperty.id = bpaGoodproperty.id;
resGoodProperty.name = bpaGoodproperty.name;
resGoodProperty.foreignKeyRe = bpaGoodproperty.foreignKeyRe;
resGoodProperty.parentid = "";
resGoodProperty.sort = bpaGoodproperty.sort;
resGoodProperty.GoodsTypeId = bpaGoodproperty.GoodsTypeId;
resGoodProperty.isSelect = false;
resGoodProperty.child = new ArrayList<>(childList);
bpa_goodproperties.add(resGoodProperty);
}

}

List<String> idList = new ArrayList<>();
for (ResGoodProperty item:bpa_goodproperties)
{
int i = 0;
for (ResGoodProperty c : item.child) {
c.isSelect = i == 0;
if(i==0){
idList.add(c.id);
}
i++;
}
}
LogUtils.d("idList = "+idList);
sxadapter = new pfsx_adapter(getContext(),bpa_goodproperties);
// sxadapter.setIdList(idList);
// sxadapter.setGoodId(Good.id);
sxadapter.setClickCallBack(new pfsx_adapter.ItemClickCallBack() {
@Override
public void onClickItem(View view, int position, String attributeId) {
// idList.set(position,attributeId);
// for(int i=0;i<bpa_goodproperties.size();i++){
// if(i!=position){
// sxadapter.setIdList(idList);
// sxadapter.notifyItemChanged(i);
// }
// }
if(DataValidation()){
viewBinding.quzhizuo.setText("确定复制");
viewBinding.quzhizuo.setBackgroundDrawable(getResources().getDrawable(R.drawable.button3));
}else {
viewBinding.quzhizuo.setText("不存在配方,无法复制");
viewBinding.quzhizuo.setBackgroundDrawable(getResources().getDrawable(R.drawable.button4));
}
String title = Good.name;
if(!names.isEmpty()){
title = Good.name+"—"+names;
}
viewBinding.makegoodtitle.setText(title);
}
});
viewBinding.datatabMakesx.setAdapter(sxadapter);
viewBinding.datatabMakesx.postDelayed(new Runnable() {
@Override
public void run() {
if(DataValidation()){
viewBinding.quzhizuo.setText("确定复制");
viewBinding.quzhizuo.setBackgroundDrawable(getResources().getDrawable(R.drawable.button3));
}else {
viewBinding.quzhizuo.setText("不存在配方,无法复制");
viewBinding.quzhizuo.setBackgroundDrawable(getResources().getDrawable(R.drawable.button4));
}
String title = Good.name;
if(!names.isEmpty()){
title = Good.name+"—"+names;
}
viewBinding.makegoodtitle.setText(title);
}
},100);
initEvent();
}

private void initEvent() {
viewBinding.quzhizuo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!DataBus.getInstance().doubleClick()) {
if (mListener != null && SaveData()) {
mListener.onSubmit(goodsrecipename);
}
}
}
});
viewBinding.closeFromGood.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}

/**
* 保存数据
*/
private boolean SaveData() {
if (DataValidation()) {

BPA_ORDER order = new BPA_ORDER();
order.thirdPartyID = "手动下单";
order.status = 0;
order.deviceID = ConfigName.getInstance().DeviceId;
order.userID = ConfigName.getInstance().user.userID;
QueryDB.AddOrder(order);

BPA_SUBORDER suborder = new BPA_SUBORDER();
suborder.deviceID = ConfigName.getInstance().DeviceId;
suborder.userID = ConfigName.getInstance().user.userID;
suborder.orderID = order.id;
suborder.goodsID = ((BPA_GOODS) Good).id;
suborder.recipeID=goodsrecipename.id;
suborder.number = 1;
suborder.status = 0;
suborder.exp=names;
QueryDB.AddSubOrder(suborder);

DataBus.getInstance().AddGoodsMake(suborder);
ToastUtils.info("商品:"+Good.name+",加入队列中...");
return true;
}else
{
ToastUtils.info("没有查询到配方,不能制作!");
return false;
}
}

BPA_GOODSRECIPENAME goodsrecipename = null;
String ggids = "";//规格id集合
String names="";
/**
* 数据验证
*/
private boolean DataValidation() {
//1.数据名称不能为空
ggids = "";names="";
for (ResGoodProperty item : bpa_goodproperties) {
for (ResGoodProperty k : item.child) {
if (k.isSelect) {
ggids += k.id + ",";
names+="/"+k.name;
}
}
}
if(!names.isEmpty()&& names.length()>1){
names = names.substring(1);
}

if (!ggids.isEmpty()) {
ggids = ggids.substring(0, ggids.length() - 1);
}

goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids,Good.id);
if (goodsrecipename == null) {
// ToastUtils.info("没有查询到配方,不能制作!");
return false;
}
return true;
}
private ClickCallBack mListener;

public void setmListener(ClickCallBack mListener) {
this.mListener = mListener;
}

public interface ClickCallBack{
void onSubmit(BPA_GOODSRECIPENAME copyGoodsRecipe);
}
}

+ 114
- 10
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/GoodsEditView.java View File

@@ -3,6 +3,7 @@ package com.bonait.bnframework.modules.home.fragment.mode;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
@@ -13,14 +14,17 @@ import androidx.recyclerview.widget.LinearLayoutManager;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
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_GOODPROPERTY;
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_GOODSRECIPENAME;
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
import com.bonait.bnframework.common.db.res.ResGoodProperty;
import com.bonait.bnframework.common.db.res.ResGoodsRecipe;
import com.bonait.bnframework.common.db.res.ResMaterilas;
import com.bonait.bnframework.common.glide.GlideUtil;
import com.bonait.bnframework.common.helper.I.MyClickListener;
@@ -28,12 +32,19 @@ import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
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;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.KeyboardUtil;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.MyLayoutManager;
import com.bonait.bnframework.databinding.GoodsEditLayoutBinding;
import com.bonait.bnframework.modules.home.adapter.GoodGroupNameAdapter;
import com.bonait.bnframework.modules.home.adapter.newmeatrilselect_adapter;
import com.bonait.bnframework.modules.home.adapter.pfsx_adapter;
import com.bonait.bnframework.modules.home.fragment.from.GoodPeiFangActivity;
import com.bonait.bnframework.modules.home.fragment.from.ImageChooseActivity;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;

import java.util.ArrayList;
import java.util.Arrays;
@@ -48,7 +59,7 @@ import java.util.Map;
public class GoodsEditView extends LinearLayout {

private GoodsEditLayoutBinding viewBinding;
private Activity activity;
private GoodPeiFangActivity activity;
private String url;//图片地址
/**
* 点击事件
@@ -58,15 +69,12 @@ public class GoodsEditView extends LinearLayout {
* 商品
*/
public BPA_GOODS goodsData=null;
/**
* 当前物料数据
*/
public ArrayList<ResMaterilas> resMaterilas=new ArrayList<>();
public GoodsEditView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
View root = LayoutInflater.from(context).inflate(R.layout.goods_edit_layout, this);
viewBinding = GoodsEditLayoutBinding.bind(root);
DisplayManager.scaleViewGroup(viewBinding.getRoot());
initView();
}

@@ -79,7 +87,7 @@ public class GoodsEditView extends LinearLayout {
*
* @param data
*/
public void setData(BPA_GOODS data, Activity activity) {
public void setData(BPA_GOODS data, GoodPeiFangActivity activity) {
if(data==null){
ToastUtils.info("数据为空");
return;
@@ -101,6 +109,7 @@ public class GoodsEditView extends LinearLayout {
url=goodsData.url;
//初始化属性信息
initPropertyData();
initGroupDetail();
}

public void setListener(MyClickListener mListener){
@@ -254,7 +263,7 @@ public class GoodsEditView extends LinearLayout {
/**
* 属性信息
*/
ArrayList<ResGoodProperty> bpa_goodproperties = new ArrayList<>();
private ArrayList<ResGoodProperty> bpa_goodproperties = new ArrayList<>();
private pfsx_adapter sxadapter;
private void initPropertyData() {
//2.填充规则数据,查询所有属性大类
@@ -326,6 +335,8 @@ public class GoodsEditView extends LinearLayout {
if(hasGroup()){
viewBinding.tvGroupTip.setText("存在配方");
viewBinding.addGroup.setText("修改名称");
//todo

}else {
viewBinding.tvGroupTip.setText("不存在配方");
viewBinding.addGroup.setText("新建配方");
@@ -349,10 +360,93 @@ public class GoodsEditView extends LinearLayout {
},100);
}

/**
* 当前物料数据
*/
private List<BPA_MATERIAL> materilasList=new ArrayList<>();
private ArrayList<BPA_GOODSRECIPENAME> goodsrecipenames = new ArrayList<>();
/**
* 复制弹窗
*/
private CopyRecipeDialog copyRecipeDialog;
/**
* 配方详情
*/
private GoodGroupNameAdapter groupAdapter;
private void initGroupDetail(){
//物料数据
materilasList.clear();
materilasList= QueryDB.GetMaterialALL();
//商品配方名称
goodsrecipenames.clear();
goodsrecipenames=QueryDB.GetGoodsRecipeNameGoodId(goodsData.id);

groupAdapter = new GoodGroupNameAdapter() {
@Override
protected void onDelete(int position, BPA_GOODSRECIPENAME bean) {
String title = "温馨提示!";
String message = "客官确定要删除配方【"+bean.name+"】吗?";
AlertDialogUtils.showDialog(getContext(), title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {
ArrayList<ResGoodsRecipe> re= QueryDB.GetGoodsSreciperecipeList(bean.id);
for(ResGoodsRecipe item:re)
{
QueryDB.DeleteGoodsSrecipe(item);
}
QueryDB.DeleteGoodsRecipeName(bean);
ToastUtils.info("删除成功");
KeyboardUtil.hideKeyboard(viewBinding.recyclerDetail);
goodsrecipenames.remove(position);
groupAdapter.notifyDataSetChanged();
dialog.dismiss();
}
});
}

@Override
protected void onCopy(int position, BPA_GOODSRECIPENAME bean) {
if(copyRecipeDialog == null){
copyRecipeDialog = new CopyRecipeDialog();
}
Bundle bundle = new Bundle();
bundle.putString("goodId", goodsData.id);
copyRecipeDialog.setArguments(bundle);
copyRecipeDialog.setmListener(new CopyRecipeDialog.ClickCallBack() {
@Override
public void onSubmit(BPA_GOODSRECIPENAME copyGoodsRecipe) {
ArrayList<ResGoodsRecipe> re= QueryDB.GetGoodsSreciperecipeList(bean.id);
for(ResGoodsRecipe item:re)
{
QueryDB.DeleteGoodsSrecipe(item);
}
List<BPA_GOODSRECIPE> data = new ArrayList<>();
ArrayList<ResGoodsRecipe> copys = QueryDB.GetGoodsSreciperecipeList(bean.id);
for(ResGoodsRecipe item:copys){
BPA_GOODSRECIPE bpaGoodsrecipe = new BPA_GOODSRECIPE();
bpaGoodsrecipe.sort = 0;
bpaGoodsrecipe.goodsID = item.goodsID;
bpaGoodsrecipe.recipeID = bean.id;
bpaGoodsrecipe.materialID = item.materialID;
bpaGoodsrecipe.value = item.value;
bpaGoodsrecipe.materialType = item.materialType;
bpaGoodsrecipe.processms = item.processms;
bpaGoodsrecipe.processname = item.processname;
bpaGoodsrecipe.processvalue = item.processvalue;
data.add(bpaGoodsrecipe);
}
QueryDB.AddGoodsSrecipeList(data);
ToastUtils.info("复制成功");
groupAdapter.notifyItemChanged(position);
}
});
copyRecipeDialog.show(activity.getSupportFragmentManager(),"复制配方");
}
};
groupAdapter.setMaterilasList(materilasList);
groupAdapter.setNewData(goodsrecipenames);
viewBinding.recyclerDetail.setAdapter(groupAdapter);
}

/**
* 销毁
@@ -361,11 +455,21 @@ public class GoodsEditView extends LinearLayout {
MessageManager.getInstance().unRegisterMessageReceiver(activity);
goodsData = null;
mListener = null;
resMaterilas.clear();
resMaterilas = null;
bpa_goodproperties.clear();
bpa_goodproperties = null;
materilasList.clear();
materilasList = null;
goodsrecipenames.clear();
goodsrecipenames = null;
viewBinding.recyclerDetail.setAdapter(null);
if(groupAdapter!=null){
groupAdapter = null;
}
url = null;
viewBinding.recyclerProperty.setAdapter(null);
sxadapter = null;
if(sxadapter!=null){
sxadapter = null;
}
activity = null;
}
}

+ 17
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java View File

@@ -171,11 +171,18 @@ public class add_makegood_control extends LinearLayout{
// }
if(DataValidation()){
tvTip.setText("存在配方");
quzhizuo.setText("去制作");
quzhizuo.setBackgroundDrawable(getResources().getDrawable(R.drawable.button3));
}else {
tvTip.setText("不存在配方");
quzhizuo.setText("不存在配方,无法制作");
quzhizuo.setBackgroundDrawable(getResources().getDrawable(R.drawable.button4));
}
String title = Good.name;
if(!names.isEmpty()){
title = Good.name+"—"+names;
}
makegoodtitle.setText(title);
}
});
datatab_makesx.setAdapter(sxadapter);
@@ -184,11 +191,18 @@ public class add_makegood_control extends LinearLayout{
public void run() {
if(DataValidation()){
tvTip.setText("存在配方");
quzhizuo.setText("去制作");
quzhizuo.setBackgroundDrawable(getResources().getDrawable(R.drawable.button3));
}else {
tvTip.setText("不存在配方");
quzhizuo.setText("不存在配方,无法制作");
quzhizuo.setBackgroundDrawable(getResources().getDrawable(R.drawable.button4));
}
String title = Good.name;
if(!names.isEmpty()){
title = Good.name+"—"+names;
}
makegoodtitle.setText(title);
}
},100);
}
@@ -282,6 +296,9 @@ public class add_makegood_control extends LinearLayout{
}
}
}
if(!names.isEmpty()&& names.length()>1){
names = names.substring(1);
}

if (!ggids.isEmpty()) {
ggids = ggids.substring(0, ggids.length() - 1);


+ 39
- 0
app/src/main/res/anim/anim_scale_in.xml View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- android:duration="@android:integer/config_mediumAnimTime" -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >

<scale
android:duration="200"
android:fromXScale="0.0"
android:fromYScale="0.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" >
</scale>

<!-- <translate -->
<!-- android:duration="2000" -->
<!-- android:fromXDelta="0%p" -->
<!-- android:fromYDelta="0%p" -->
<!-- android:interpolator="@android:anim/accelerate_decelerate_interpolator" -->
<!-- android:toXDelta="50%p" -->
<!-- android:toYDelta="50%p" /> -->

<!-- <rotate -->
<!-- android:duration="1500" -->
<!-- android:fromDegrees="0" -->
<!-- android:interpolator="@android:anim/accelerate_decelerate_interpolator" -->
<!-- android:pivotX="50%" -->
<!-- android:pivotY="50%" -->
<!-- android:toDegrees="+359" /> -->

<alpha
android:duration="200"
android:fromAlpha="0.1"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:toAlpha="1.0" />

</set>

+ 23
- 0
app/src/main/res/anim/anim_scale_out.xml View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- android:duration="@android:integer/config_mediumAnimTime" -->
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >

<scale
android:duration="400"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.1"
android:toYScale="0.1" >
</scale>

<alpha
android:duration="400"
android:fromAlpha="1"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:toAlpha="0.0" />

</set>

+ 32
- 0
app/src/main/res/drawable/spinner_border_bg.xml View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 第一组item:设置Spinner背景边框 -->
<item
>
<shape >
<stroke

android:width="1dp"
android:color="@color/color3">
</stroke>
<corners android:radius="0dp" />
<!-- 设置背景颜色 -->
<padding
android:bottom="0dp"
android:left="30dp"
android:right="5dp"
android:top="0dp" >
</padding>
</shape>
<!-- 第二组item:设置spinner箭头图片 -->
</item>


<item>
<bitmap
android:gravity="end"
android:src="@mipmap/spinner_down_2">
</bitmap>

</item>
</layer-list>

+ 29
- 10
app/src/main/res/layout/activity_goodpeifang.xml View File

@@ -104,17 +104,17 @@
android:layout_height="match_parent"
android:visibility="gone"/>

<com.bonait.bnframework.modules.home.fragment.mode.add_pf_home_control
android:id="@+id/add_pf_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
<!-- <com.bonait.bnframework.modules.home.fragment.mode.add_pf_home_control-->
<!-- android:id="@+id/add_pf_home"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:visibility="gone"/>-->

<com.bonait.bnframework.modules.home.fragment.mode.add_pf_control
android:id="@+id/add_pf"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
<!-- <com.bonait.bnframework.modules.home.fragment.mode.add_pf_control-->
<!-- android:id="@+id/add_pf"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:visibility="gone"/>-->
</RelativeLayout>
</LinearLayout>

@@ -127,4 +127,23 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/app_color_blue"/>

<FrameLayout
android:id="@+id/fl_content_goods"
android:layout_width="match_parent"
android:visibility="gone"
tools:visibility="gone"
android:background="@color/white"
android:layout_height="match_parent">

<include
android:layout_height="match_parent"
android:layout_width="match_parent"
layout="@layout/goods_edit_layout"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
/>
</FrameLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 154
- 0
app/src/main/res/layout/item/layout/dialog_add_good_info.xml View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/dialogbj"
android:focusable="true"
android:id="@+id/root"
android:clickable="true">

<RelativeLayout
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_centerInParent="true"
android:background="@drawable/common_bg_with_radius_and_border">

<Button
android:id="@+id/close_from"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:background="@mipmap/close_image"
android:textSize="14dp"
android:textColor="@color/white"/>

<!--菜谱名称行-->
<LinearLayout
android:layout_centerInParent="true"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/color1">

<ImageView
android:id="@+id/image"
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_marginStart="3dp"
android:layout_marginTop="3dp"
android:layout_marginEnd="3dp"
android:layout_marginBottom="3dp"
android:src="@mipmap/loading3" />
</RelativeLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:text="更换商品封面"
android:textSize="32sp"/>
</LinearLayout>

<LinearLayout
android:layout_marginLeft="@dimen/dp_40"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_marginTop="@dimen/dp_10"
android:layout_marginBottom="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品名称:"
android:textSize="32sp"/>
<!--账号输入框-->
<EditText
android:id="@+id/edittext_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="text"
android:maxLines="1"
android:maxLength="30"
android:padding="3dp"
android:textSize="32sp" />
</LinearLayout>

<LinearLayout
android:layout_marginBottom="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品外键:"
android:textSize="32sp"/>
<!--账号输入框-->
<EditText
android:id="@+id/edittext_fk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:background="@drawable/input_bj"
android:hint="请输入"
android:inputType="text"
android:maxLines="1"
android:padding="3dp"
android:textSize="32sp" />
</LinearLayout>

<LinearLayout
android:layout_marginBottom="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="商品分类:"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:textSize="32sp"/>
<!--账号输入框-->
<Spinner
android:id="@+id/spinner"
style="@style/commonSpinnerStyle"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_centerVertical="true"
android:textSize="32sp"/>
</LinearLayout>

</LinearLayout>
</LinearLayout>

<Button
android:id="@+id/save"
android:layout_width="300dp"
android:layout_height="70dp"
android:layout_marginBottom="10dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/bg_btn_login_selected"
android:text="保存"
android:textColor="@color/white"
android:textSize="36sp"/>
</RelativeLayout>
</RelativeLayout>

+ 10
- 9
app/src/main/res/layout/item/layout/dialog_add_makegood.xml View File

@@ -7,10 +7,10 @@
android:background="@color/dialogbj">

<RelativeLayout
android:layout_centerInParent="true"
android:layout_margin="50dp"
android:layout_width="900dp"
android:layout_height="700dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:layout_width="1000dp"
android:layout_height="730dp"
android:background="@drawable/common_bg_with_radius_and_border">

<Button
@@ -41,7 +41,7 @@

<RelativeLayout
android:layout_marginTop="50dp"
android:layout_marginBottom="50dp"
android:layout_marginBottom="95dp"
android:layout_width="match_parent"
android:layout_height="match_parent">

@@ -64,9 +64,9 @@
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="5dp"
android:layout_marginStart="80dp"
android:layout_marginEnd="80dp"
android:background="@color/color3" />

<LinearLayout
@@ -82,7 +82,7 @@
android:id="@+id/datatab_makesx"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"/>
android:layout_marginTop="5dp"/>
</RelativeLayout>

</LinearLayout>
@@ -93,6 +93,7 @@
android:layout_height="wrap_content"
android:layout_gravity="end"
android:gravity="end"
android:visibility="gone"
android:orientation="horizontal">

<TextView


+ 1
- 3
app/src/main/res/layout/item/layout/goods_edit_layout.xml View File

@@ -3,10 +3,8 @@
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white"
android:orientation="vertical"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="20dp"
android:layout_height="match_parent">

<RelativeLayout


+ 69
- 106
app/src/main/res/layout/item/layout/item_group_detail.xml View File

@@ -1,121 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="40dp">
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
android:layout_marginStart="50dp"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
tools:text="未设置"
android:gravity="center"
android:background="@drawable/input_bj"
android:textSize="24sp"
android:textColor="@color/app_color_blue"/>
</LinearLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">

<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
<EditText
android:id="@+id/edittext_zl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/input_bj"
android:hint="请输入重量"
android:inputType="number|numberDecimal"
android:digits="0123456789."
android:gravity="center"
android:maxLines="1"
android:padding="3dp"
android:textSize="24sp"
/>
</RelativeLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<LinearLayout
android:id="@+id/ll_arrow"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="删除"
android:gravity="center"
android:textSize="24sp"
android:background="@drawable/input_bj"
android:textColor="@color/red_primary"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
android:layout_marginEnd="50dp"
/>
</LinearLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
</LinearLayout>
<Spinner
android:layout_marginStart="50dp"
android:id="@+id/spinner_name"
style="@style/commonSpinnerStyle"
android:background="@drawable/spinner_border_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:textSize="26sp"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_marginStart="100dp"
android:layout_marginEnd="100dp"
android:visibility="gone"
android:layout_height="60dp">
<TextView
android:id="@+id/btn_add"
android:layout_width="0dp"
</LinearLayout>

<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
<EditText
android:id="@+id/edittext_weight"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="+添加物料"
android:textSize="24sp"
android:textColor="@color/white"
android:background="@drawable/input_bj"
android:hint="请输入重量"
android:inputType="number|numberDecimal"
android:digits="0123456789."
android:gravity="center"
android:background="@drawable/bg_btn_login_selected"
android:maxLines="1"
android:padding="3dp"
android:textSize="26sp"
/>
<TextView
android:id="@+id/btn_save"
</RelativeLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:id="@+id/btn_material_delete"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="保存配方"
android:textSize="24sp"
android:textColor="@color/white"
android:text="删除"
android:gravity="center"
android:background="@drawable/bg_btn_red_selected"
android:textSize="26sp"
android:background="@drawable/input_bj"
android:textColor="@color/red_primary"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
android:layout_marginEnd="50dp"
/>
</LinearLayout>
</FrameLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>

</LinearLayout>

+ 125
- 79
app/src/main/res/layout/item/layout/item_group_name.xml View File

@@ -2,92 +2,138 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:background="@drawable/input_bj"
android:id="@+id/root"
android:layout_height="40dp">
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
tools:text="名称"
android:gravity="center"
android:textSize="24sp"
android:textColor="@color/black"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
tools:text=""
android:gravity="center"
android:textSize="24sp"
android:textColor="@color/black"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:id="@+id/btn_copy"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="复制"
android:gravity="center"
android:textSize="24sp"
android:textColor="@color/app_color_blue"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="删除"
android:gravity="center"
android:textSize="24sp"
android:textColor="@color/red_primary"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/ll_arrow"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center"
android:layout_weight="1">
android:layout_width="match_parent"
android:orientation="horizontal"
android:background="@drawable/input_bj"
android:id="@+id/root"
android:layout_height="50dp">
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:id="@+id/groupName"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
tools:text="名称"
android:gravity="center"
android:textSize="26sp"
android:textColor="@color/black"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
tools:text=""
android:gravity="center"
android:textSize="26sp"
android:textColor="@color/black"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:id="@+id/btn_copy"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="展开"
android:layout_weight="1"
android:text="复制"
android:gravity="center"
android:textSize="24sp"
android:textSize="26sp"
android:textColor="@color/app_color_blue"/>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@mipmap/ic_arrow_left2"
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:id="@+id/btn_delete"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="删除"
android:gravity="center"
android:textSize="26sp"
android:textColor="@color/red_primary"/>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
<LinearLayout
android:id="@+id/ll_arrow"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center"
android:layout_weight="1">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:id="@+id/tv_expand"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="展开"
android:gravity="center"
android:textSize="26sp"
android:textColor="@color/app_color_blue"/>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@mipmap/ic_arrow_left2"
/>
</LinearLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
/>
</LinearLayout>
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/color3"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
/>

<LinearLayout
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="60dp">
<TextView
android:id="@+id/btn_add"
android:layout_width="400dp"
android:layout_height="match_parent"
android:text="+添加物料"
android:textSize="26sp"
android:textColor="@color/white"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_btn_login_selected"
/>
<TextView
android:id="@+id/btn_save"
android:layout_width="400dp"
android:layout_height="match_parent"
android:text="保 存"
android:textSize="26sp"
android:textColor="@color/white"
android:gravity="center"
android:visibility="gone"
tools:visibility="visible"
android:layout_gravity="center_horizontal"
android:background="@drawable/bg_btn_red_selected"
/>
</LinearLayout>

</LinearLayout>

+ 12
- 0
app/src/main/res/layout/item/layout/spinner_dropdown24_item.xml View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/checkedTextViewCustom_1"
style="?android:attr/spinnerDropDownItemStyle"
android:layout_width="match_parent"
android:layout_height="35dp"
android:background="@color/activity_background"
android:ellipsize="marquee"
android:singleLine="true"
android:text="11111"
android:textAlignment="inherit"
android:textSize="24sp"/>

+ 13
- 0
app/src/main/res/layout/item/layout/spinner_dropdown32_item.xml View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/checkedTextViewCustom_1"
style="?android:attr/spinnerDropDownItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/activity_background"
android:ellipsize="marquee"
android:singleLine="true"
tools:text="11111"
android:textAlignment="inherit"
android:textSize="32sp" />

+ 17
- 0
app/src/main/res/layout/item/layout/spinner_text24_item.xml View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textViewCustom"
style="?android:attr/spinnerItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textAlignment="inherit"
android:gravity="center_vertical"
android:text="请选择"
android:textSize="24sp"
android:textColor="@color/black">
</TextView>




+ 17
- 0
app/src/main/res/layout/item/layout/spinner_text32_item.xml View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textViewCustom"
style="?android:attr/spinnerItemStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
android:textAlignment="inherit"
android:gravity="center_vertical"
android:text="请选择"
android:textSize="32sp"
android:textColor="@color/black">
</TextView>




+ 27
- 0
app/src/main/res/values/styles.xml View File

@@ -219,4 +219,31 @@
<item name="android:backgroundDimAmount">0.3</item>
</style>

<style name="DialogScale" parent="@android:style/Theme.Dialog">
<!-- 背景透明 -->
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<!-- 浮于Activity之上 -->
<item name="android:windowIsFloating">true</item>
<!-- 边框 -->
<item name="android:windowFrame">@null</item>
<!-- Dialog以外的区域模糊效果 -->
<item name="android:backgroundDimEnabled">true</item>
<!-- 无标题 -->
<item name="android:windowNoTitle">true</item>
<!-- 半透明 -->
<item name="android:windowIsTranslucent">true</item>
<!--点击dialog以外区域关闭弹窗-->
<item name="android:windowCloseOnTouchOutside">true</item>
<item name="android:windowFullscreen">true</item>

<!-- Dialog进入及退出动画 -->
<item name="android:windowAnimationStyle">@style/ActionSheetDialogScale</item>
</style>

<!-- ActionSheet进出动画 -->
<style name="ActionSheetDialogScale" parent="@android:style/Animation.Dialog">
<item name="android:windowEnterAnimation">@anim/anim_scale_in</item>
<item name="android:windowExitAnimation">@anim/anim_scale_out</item>
</style>
</resources>

Loading…
Cancel
Save