@@ -526,6 +526,7 @@ public class ModbusHelper extends ModbusMaster { | |||||
stirStop = ConfigName.TEST?false:setStirStop(); | stirStop = ConfigName.TEST?false:setStirStop(); | ||||
Thread.sleep(10); | Thread.sleep(10); | ||||
} | } | ||||
Thread.sleep(100); | |||||
setUpdDownMotor(1); | setUpdDownMotor(1); | ||||
long t = System.currentTimeMillis(); | long t = System.currentTimeMillis(); | ||||
boolean upStop = true; | boolean upStop = true; | ||||
@@ -14,10 +14,8 @@ import com.bonait.bnframework.common.constant.Constants; | |||||
import com.bonait.bnframework.common.constant.DataBus; | import com.bonait.bnframework.common.constant.DataBus; | ||||
import com.bonait.bnframework.common.db.QueryDB; | import com.bonait.bnframework.common.db.QueryDB; | ||||
import com.bonait.bnframework.common.db.file.DBHelper; | 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_GOODS; | 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_GOODSRECIPE; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | import com.bonait.bnframework.common.db.mode.BPA_GOODS_OLD; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | ||||
@@ -25,7 +23,6 @@ import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | import com.bonait.bnframework.common.db.mode.BPA_SILOS; | ||||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | 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_SILOS_CALIBRATE; | ||||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||||
import com.bonait.bnframework.common.db.mode.BPA_USER; | import com.bonait.bnframework.common.db.mode.BPA_USER; | ||||
import com.bonait.bnframework.common.helper.CrashHandler; | import com.bonait.bnframework.common.helper.CrashHandler; | ||||
import com.bonait.bnframework.common.helper.SdCart; | import com.bonait.bnframework.common.helper.SdCart; | ||||
@@ -296,11 +293,11 @@ public class MainInit { | |||||
public static void clearGoodsInfo(){ | public static void clearGoodsInfo(){ | ||||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null); | DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null); | ||||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODSRECIPE.class,null); | DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODSRECIPE.class,null); | ||||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_CLASSIFY.class,null); | |||||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ATTRIBUTE.class,null); | |||||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBATTRIBUTE.class,null); | |||||
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_CLASSIFY.class,null); | |||||
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_ATTRIBUTE.class,null); | |||||
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SUBATTRIBUTE.class,null); | |||||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_SUBATTRIBUTE_GROUP.class,null); | DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_SUBATTRIBUTE_GROUP.class,null); | ||||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_OLD.class,null); | |||||
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_OLD.class,null); | |||||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_PROCESS_DETAIL.class,null); | DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS_PROCESS_DETAIL.class,null); | ||||
} | } | ||||
@@ -343,6 +343,7 @@ public class NewExecuteTheRecipe { | |||||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | ||||
Thread.sleep(10); | Thread.sleep(10); | ||||
} | } | ||||
Thread.sleep(50); | |||||
if(isTest && IsStart){ | if(isTest && IsStart){ | ||||
Thread.sleep(1000); | Thread.sleep(1000); | ||||
} | } | ||||
@@ -422,6 +423,7 @@ public class NewExecuteTheRecipe { | |||||
isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | isStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | ||||
Thread.sleep(10); | Thread.sleep(10); | ||||
} | } | ||||
Thread.sleep(50); | |||||
if(IsStart && isTest){ | if(IsStart && isTest){ | ||||
Thread.sleep(1000); | Thread.sleep(1000); | ||||
} | } | ||||
@@ -687,6 +689,7 @@ public class NewExecuteTheRecipe { | |||||
isStop = ConfigName.TEST?false: ModbusHelper.get().setStirStop(); | isStop = ConfigName.TEST?false: ModbusHelper.get().setStirStop(); | ||||
Thread.sleep(10); | Thread.sleep(10); | ||||
} | } | ||||
Thread.sleep(50); | |||||
ModbusHelper.get().setUpdDownMotor(1); | ModbusHelper.get().setUpdDownMotor(1); | ||||
ModbusHelper.get().setCookStatus(false); | ModbusHelper.get().setCookStatus(false); | ||||
NewToastUtil.getInstance().showToastBottom("出菜完成,结束制作!"); | NewToastUtil.getInstance().showToastBottom("出菜完成,结束制作!"); | ||||
@@ -788,6 +791,7 @@ public class NewExecuteTheRecipe { | |||||
stirStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | stirStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | ||||
Thread.sleep(10); | Thread.sleep(10); | ||||
} | } | ||||
Thread.sleep(50); | |||||
EventBus.getDefault().post(new ProcessMakingEvent(4,"停止搅拌")); | EventBus.getDefault().post(new ProcessMakingEvent(4,"停止搅拌")); | ||||
boolean isStop = true; | boolean isStop = true; | ||||
long lastTime = System.currentTimeMillis(); | long lastTime = System.currentTimeMillis(); | ||||
@@ -138,6 +138,22 @@ public class GoodsDBUtil { | |||||
return obj.size() > 0 ? (BPA_GOODS) obj.get(0) : null; | return obj.size() > 0 ? (BPA_GOODS) obj.get(0) : null; | ||||
} | } | ||||
/** | |||||
* 根据商品id获取商品 | |||||
* | |||||
* @param classifyId | |||||
* @return BPA_GOODS | |||||
*/ | |||||
public static BPA_GOODS getClassifyId(String classifyId) { | |||||
String orderby = QueryDB.Desc_Sort_Up; | |||||
String where = "isDelete=? and classifyId=?"; | |||||
String[] args = new String[]{"0", classifyId}; | |||||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS.class, where, args, orderby); | |||||
return obj.size() > 0 ? (BPA_GOODS) obj.get(0) : null; | |||||
} | |||||
/** | /** | ||||
* 根据商品id获取商品 | * 根据商品id获取商品 | ||||
* | * | ||||
@@ -71,7 +71,7 @@ public class EditClassifyActivity extends BaseActivity { | |||||
private final List<String> classifyNameList = new ArrayList<>(); | private final List<String> classifyNameList = new ArrayList<>(); | ||||
private boolean isUserClicked = false; | private boolean isUserClicked = false; | ||||
private int attributePosition = 0;//属性选中位置 | private int attributePosition = 0;//属性选中位置 | ||||
private int classifyPosition = 0;//属性选中位置 | |||||
private int classifyPosition = 0;//选中位置 | |||||
@Override | @Override | ||||
@@ -385,6 +385,20 @@ public class EditClassifyActivity extends BaseActivity { | |||||
if(classifyPosition==0){ | if(classifyPosition==0){ | ||||
return; | return; | ||||
} | } | ||||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||||
if(GoodsDBUtil.getClassifyId(classifyId)!=null){ | |||||
AlertDialogUtils.showTipDialog(this, "注意", "添加属性将会影响当前分类下所有菜品,请确保该分类下没有商品再操作", | |||||
new AlertDialogUtils.DialogClickListener() { | |||||
@Override | |||||
public void onConfirm() { | |||||
} | |||||
@Override | |||||
public void onCancel() { | |||||
} | |||||
}); | |||||
return; | |||||
} | |||||
AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | AlertDialogUtils.showCancelAndConfirmDialog(this, R.layout.dialog_add_classify, (layoutView, xCom) -> { | ||||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | ||||
DisplayManager.scaleViewGroup(binding.getRoot()); | DisplayManager.scaleViewGroup(binding.getRoot()); | ||||
@@ -392,7 +406,6 @@ public class EditClassifyActivity extends BaseActivity { | |||||
binding.edit.setHint("请输入属性名称"); | binding.edit.setHint("请输入属性名称"); | ||||
binding.submit.setOnClickListener(view1 -> { | binding.submit.setOnClickListener(view1 -> { | ||||
String input = String.valueOf(binding.edit.getText()); | String input = String.valueOf(binding.edit.getText()); | ||||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||||
if(!input.isEmpty()){ | if(!input.isEmpty()){ | ||||
for(BPA_ATTRIBUTE bean:attributeList){ | for(BPA_ATTRIBUTE bean:attributeList){ | ||||
if(bean.name.equals(input)){ | if(bean.name.equals(input)){ | ||||
@@ -426,32 +439,46 @@ public class EditClassifyActivity extends BaseActivity { | |||||
if(classifyPosition==0){ | if(classifyPosition==0){ | ||||
return; | 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.getInstance().showToast("商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品"); | |||||
return; | |||||
} | |||||
} | |||||
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(); | |||||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||||
if(GoodsDBUtil.getClassifyId(classifyId)!=null){ | |||||
AlertDialogUtils.showTipDialog(this, "警告", "删除属性将会影响当前分类下所有菜品,请确保该分类下没有商品再操作", | |||||
new AlertDialogUtils.DialogClickListener() { | |||||
@Override | |||||
public void onConfirm() { | |||||
} | |||||
@Override | |||||
public void onCancel() { | |||||
} | |||||
}); | |||||
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.getInstance().showToast("商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品"); | |||||
// return; | |||||
// } | |||||
// } | |||||
// 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(); | |||||
// } | |||||
} | } | ||||
/** | /** | ||||
@@ -8,6 +8,7 @@ import android.view.ViewGroup; | |||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import androidx.recyclerview.widget.RecyclerView; | import androidx.recyclerview.widget.RecyclerView; | ||||
import com.apkfuns.logutils.LogUtils; | |||||
import com.bonait.bnframework.R; | import com.bonait.bnframework.R; | ||||
import com.bonait.bnframework.common.base.BaseAdapter; | import com.bonait.bnframework.common.base.BaseAdapter; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | import com.bonait.bnframework.common.db.mode.BPA_GOODS; | ||||
@@ -36,6 +37,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||||
@Override | @Override | ||||
public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) { | public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) { | ||||
try { | try { | ||||
LogUtils.d(" holder.binding.name.getTextSize()="+holder.binding.name.getTextSize()); | |||||
if(holder.binding.name.getTextSize()>34||holder.binding.name.getTextSize()<30){ | if(holder.binding.name.getTextSize()>34||holder.binding.name.getTextSize()<30){ | ||||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | DisplayManager.scaleViewGroup(holder.binding.getRoot()); | ||||
} | } | ||||
@@ -526,6 +526,7 @@ public class DeviceControlDialog extends DialogFragment { | |||||
stirStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | stirStop = ConfigName.TEST?false:ModbusHelper.get().setStirStop(); | ||||
Thread.sleep(50); | Thread.sleep(50); | ||||
} | } | ||||
Thread.sleep(100); | |||||
NewToastUtil.getInstance().showToast("电机上升"); | NewToastUtil.getInstance().showToast("电机上升"); | ||||
ModbusHelper.get().setUpdDownMotor(1); | ModbusHelper.get().setUpdDownMotor(1); | ||||
}catch (Exception e){ | }catch (Exception e){ | ||||
@@ -127,6 +127,16 @@ public class EditGoodsDialog extends DialogFragment { | |||||
} | } | ||||
AdbCommandUtil.hideStatusBar(true); | AdbCommandUtil.hideStatusBar(true); | ||||
initView(); | initView(); | ||||
if(!isEdit){ | |||||
if(attributeList.isEmpty()){ | |||||
subattributeGroup = SubAttributeGroupDBUtil.getById(goodId); | |||||
changePage(3); | |||||
viewBinding.layoutMainfoods.btnLast3.setVisibility(View.INVISIBLE); | |||||
}else { | |||||
changePage(2); | |||||
} | |||||
viewBinding.layoutAttribute.btnLast2.setVisibility(View.INVISIBLE); | |||||
} | |||||
updateAttributeData(""); | updateAttributeData(""); | ||||
groupSpinnerView(); | groupSpinnerView(); | ||||
} | } | ||||
@@ -174,21 +184,45 @@ public class EditGoodsDialog extends DialogFragment { | |||||
} | } | ||||
break; | break; | ||||
case R.id.btn_next2: | case R.id.btn_next2: | ||||
// if(!selectAttributeListAdapter.isAllSelected()){ | |||||
// if(getContext()!=null){ | |||||
// NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||||
// } | |||||
// return; | |||||
// } | |||||
if(!selectAttributeListAdapter.isAllSelected()){ | |||||
if(getContext()!=null){ | |||||
NewToastUtil.getInstance().showToast("请选择每行对应的子属性"); | |||||
} | |||||
return; | |||||
} | |||||
// if(!hasGroup().isEmpty()){ | // if(!hasGroup().isEmpty()){ | ||||
if(viewBinding.layoutAttribute.groupDesc.getText().toString().equals("存在选中组合") || isEdit){ | |||||
hasGroup(); | |||||
if(isEdit){ | |||||
changePage(3); | changePage(3); | ||||
}else { | |||||
return; | |||||
} | |||||
if(viewBinding.layoutAttribute.groupDesc.getText().toString().contains("不存在选中组合")){ | |||||
NewToastUtil.getInstance().showToast("不存在该组合"); | NewToastUtil.getInstance().showToast("不存在该组合"); | ||||
}else { | |||||
if(subattributeGroup!=null){ | |||||
if(!isEdit){ | |||||
if(GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id).isEmpty()){ | |||||
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合(没有工序)"); | |||||
NewToastUtil.getInstance().showToast("该组合没有工序,请前往菜品管理中编辑"); | |||||
return; | |||||
} | |||||
} | |||||
changePage(3); | |||||
}else { | |||||
NewToastUtil.getInstance().showToast("数据为空"); | |||||
} | |||||
} | } | ||||
break; | break; | ||||
case R.id.btn_to_cook: | case R.id.btn_to_cook: | ||||
jumpToCook(); | |||||
if(subattributeGroup == null){ | |||||
NewToastUtil.getInstance().showToast("数据为空"); | |||||
}else { | |||||
if(GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id).isEmpty()){ | |||||
NewToastUtil.getInstance().showToast("当前组合没有编辑工序,请前往菜品管理编辑"); | |||||
return; | |||||
} | |||||
jumpToCook(); | |||||
} | |||||
break; | break; | ||||
case R.id.btn_edit_process: | case R.id.btn_edit_process: | ||||
jumpToEdit(); | jumpToEdit(); | ||||
@@ -244,14 +278,7 @@ public class EditGoodsDialog extends DialogFragment { | |||||
} | } | ||||
} | } | ||||
LogUtils.d(TAG+"hasGroup groupId="+groupId); | LogUtils.d(TAG+"hasGroup groupId="+groupId); | ||||
if(!isEdit){ | |||||
if(groupId.isEmpty()){ | |||||
return ""; | |||||
} | |||||
// if(GoodsProcessDetailDBUtil.getByGroupId(groupId).isEmpty()){ | |||||
// return groupId; | |||||
// } | |||||
} | |||||
subattributeGroup = SubAttributeGroupDBUtil.getById(groupId); | |||||
return groupId; | return groupId; | ||||
} | } | ||||
@@ -292,6 +319,18 @@ public class EditGoodsDialog extends DialogFragment { | |||||
if(!isEdit){ | if(!isEdit){ | ||||
return; | return; | ||||
} | } | ||||
if(attributeList.isEmpty()){ | |||||
subattributeGroup = SubAttributeGroupDBUtil.getById(goodId); | |||||
if(subattributeGroup==null){ | |||||
subattributeGroup = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||||
subattributeGroup.goodsId = goods.id; | |||||
subattributeGroup.maketime = 0; | |||||
subattributeGroup.name = goodId; | |||||
subattributeGroup.subAttributeIdList = goodId; | |||||
} | |||||
NewToastUtil.getInstance().showToast("创建配方成功"); | |||||
return; | |||||
} | |||||
if(subattributeGroup==null){ | if(subattributeGroup==null){ | ||||
subattributeGroup = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | subattributeGroup = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | ||||
subattributeGroup.goodsId = goods.id; | subattributeGroup.goodsId = goods.id; | ||||
@@ -303,10 +342,11 @@ public class EditGoodsDialog extends DialogFragment { | |||||
subattributeGroup.subAttributeIdList = selectAttributeListAdapter.getSubAttributeIdList(); | subattributeGroup.subAttributeIdList = selectAttributeListAdapter.getSubAttributeIdList(); | ||||
} | } | ||||
SubAttributeGroupDBUtil.add(subattributeGroup); | SubAttributeGroupDBUtil.add(subattributeGroup); | ||||
NewToastUtil.getInstance().showToast("创建组合【"+subattributeGroup.name+"】成功"); | |||||
}else { | }else { | ||||
if(selectAttributeListAdapter != null && selectAttributeListAdapter.datas!=null && !selectAttributeListAdapter.datas.isEmpty()){ | if(selectAttributeListAdapter != null && selectAttributeListAdapter.datas!=null && !selectAttributeListAdapter.datas.isEmpty()){ | ||||
subattributeGroup.name = selectAttributeListAdapter.getSubAttributeNameList(); | subattributeGroup.name = selectAttributeListAdapter.getSubAttributeNameList(); | ||||
subattributeGroup.subAttributeIdList = selectAttributeListAdapter.getSubAttributeIdList(); | |||||
// subattributeGroup.subAttributeIdList = selectAttributeListAdapter.getSubAttributeIdList(); | |||||
} | } | ||||
SubAttributeGroupDBUtil.update(subattributeGroup); | SubAttributeGroupDBUtil.update(subattributeGroup); | ||||
} | } | ||||
@@ -462,6 +502,9 @@ public class EditGoodsDialog extends DialogFragment { | |||||
public void onClick() { | public void onClick() { | ||||
if(!hasGroup().isEmpty()){ | if(!hasGroup().isEmpty()){ | ||||
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); | viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); | ||||
if(GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id).isEmpty()){ | |||||
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合(没有工序)"); | |||||
} | |||||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_yellow_btn); | viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_yellow_btn); | ||||
int pos = 0; | int pos = 0; | ||||
String nameList = selectAttributeListAdapter.getSubAttributeNameList(); | String nameList = selectAttributeListAdapter.getSubAttributeNameList(); | ||||
@@ -497,14 +540,12 @@ public class EditGoodsDialog extends DialogFragment { | |||||
} | } | ||||
}); | }); | ||||
viewBinding.layoutAttribute.listAttribute.setAdapter(selectAttributeListAdapter); | viewBinding.layoutAttribute.listAttribute.setAdapter(selectAttributeListAdapter); | ||||
} | } | ||||
private boolean isUserClicked = false; | private boolean isUserClicked = false; | ||||
private void groupSpinnerView(){ | private void groupSpinnerView(){ | ||||
groupList.clear(); | groupList.clear(); | ||||
groupList.add("未选择"); | |||||
groupList.add("未匹配"); | |||||
for (BPA_GOODS_SUBATTRIBUTE_GROUP group : SubAttributeGroupDBUtil.getByGoodsId(goodId)){ | for (BPA_GOODS_SUBATTRIBUTE_GROUP group : SubAttributeGroupDBUtil.getByGoodsId(goodId)){ | ||||
if(group.name!=null&&!group.name.isEmpty()){ | if(group.name!=null&&!group.name.isEmpty()){ | ||||
groupList.add(group.name); | groupList.add(group.name); | ||||
@@ -544,6 +585,15 @@ public class EditGoodsDialog extends DialogFragment { | |||||
updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); | updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); | ||||
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); | viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); | ||||
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_yellow_btn); | viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_yellow_btn); | ||||
viewBinding.layoutAttribute.groupDesc.postDelayed(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
hasGroup(); | |||||
if(GoodsProcessDetailDBUtil.getByGroupId(subattributeGroup.id).isEmpty()){ | |||||
viewBinding.layoutAttribute.groupDesc.setText("存在选中组合(没有工序)"); | |||||
} | |||||
} | |||||
},300); | |||||
} | } | ||||
isUserClicked = false; | isUserClicked = false; | ||||
} | } | ||||
@@ -1,6 +1,7 @@ | |||||
package com.bonait.bnframework.ui.fragment.goods; | package com.bonait.bnframework.ui.fragment.goods; | ||||
import android.annotation.SuppressLint; | import android.annotation.SuppressLint; | ||||
import android.graphics.Rect; | |||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.os.Handler; | import android.os.Handler; | ||||
import android.os.Looper; | import android.os.Looper; | ||||
@@ -11,17 +12,18 @@ import android.view.View; | |||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import androidx.annotation.Nullable; | import androidx.annotation.Nullable; | ||||
import androidx.appcompat.app.AppCompatActivity; | import androidx.appcompat.app.AppCompatActivity; | ||||
import androidx.recyclerview.widget.RecyclerView; | |||||
import com.apkfuns.logutils.LogUtils; | import com.apkfuns.logutils.LogUtils; | ||||
import com.bonait.bnframework.Model.GoodsClassifyBean; | import com.bonait.bnframework.Model.GoodsClassifyBean; | ||||
import com.bonait.bnframework.R; | import com.bonait.bnframework.R; | ||||
import com.bonait.bnframework.business.MainInit; | |||||
import com.bonait.bnframework.common.base.BaseFragment; | import com.bonait.bnframework.common.base.BaseFragment; | ||||
import com.bonait.bnframework.common.constant.ConfigName; | import com.bonait.bnframework.common.constant.ConfigName; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | import com.bonait.bnframework.common.db.mode.BPA_GOODS; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | ||||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | import com.bonait.bnframework.common.db.util.GoodsDBUtil; | ||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | import com.bonait.bnframework.common.utils.AlertDialogUtils; | ||||
import com.bonait.bnframework.common.utils.DimensUtil; | |||||
import com.bonait.bnframework.common.utils.DisplayManager; | import com.bonait.bnframework.common.utils.DisplayManager; | ||||
import com.bonait.bnframework.common.utils.ToastUtils; | import com.bonait.bnframework.common.utils.ToastUtils; | ||||
import com.bonait.bnframework.databinding.FragmentCloudGoodsBinding; | import com.bonait.bnframework.databinding.FragmentCloudGoodsBinding; | ||||
@@ -150,6 +152,14 @@ public class CloudGoodsFragment extends BaseFragment { | |||||
return downLoadCloudGoods(position); | return downLoadCloudGoods(position); | ||||
} | } | ||||
}; | }; | ||||
viewBinding.recyclerGoods.addItemDecoration(new RecyclerView.ItemDecoration() { | |||||
@Override | |||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { | |||||
super.getItemOffsets(outRect, view, parent, state); | |||||
outRect.top = DimensUtil.getDimens(0); | |||||
outRect.bottom = DimensUtil.getDimens(15); | |||||
} | |||||
}); | |||||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | viewBinding.recyclerGoods.setAdapter(goodsAdapter); | ||||
classifyAdapter =new ClassifyAdapter() { | classifyAdapter =new ClassifyAdapter() { | ||||
@@ -2,6 +2,7 @@ package com.bonait.bnframework.ui.fragment.goods; | |||||
import android.annotation.SuppressLint; | import android.annotation.SuppressLint; | ||||
import android.content.Intent; | import android.content.Intent; | ||||
import android.graphics.Rect; | |||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.os.Handler; | import android.os.Handler; | ||||
import android.os.Looper; | import android.os.Looper; | ||||
@@ -12,6 +13,7 @@ import android.view.View; | |||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import androidx.annotation.Nullable; | import androidx.annotation.Nullable; | ||||
import androidx.appcompat.app.AppCompatActivity; | import androidx.appcompat.app.AppCompatActivity; | ||||
import androidx.recyclerview.widget.RecyclerView; | |||||
import com.apkfuns.logutils.LogUtils; | import com.apkfuns.logutils.LogUtils; | ||||
import com.bonait.bnframework.R; | import com.bonait.bnframework.R; | ||||
@@ -25,6 +27,7 @@ import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||||
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil; | ||||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | ||||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | import com.bonait.bnframework.common.utils.AlertDialogUtils; | ||||
import com.bonait.bnframework.common.utils.DimensUtil; | |||||
import com.bonait.bnframework.common.utils.DisplayManager; | import com.bonait.bnframework.common.utils.DisplayManager; | ||||
import com.bonait.bnframework.common.utils.ToastUtils; | import com.bonait.bnframework.common.utils.ToastUtils; | ||||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | ||||
@@ -181,6 +184,14 @@ public class LocalGoodsFragment extends BaseFragment { | |||||
} | } | ||||
}; | }; | ||||
goodsAdapter.setEdit(isEdit); | goodsAdapter.setEdit(isEdit); | ||||
viewBinding.recyclerGoods.addItemDecoration(new RecyclerView.ItemDecoration() { | |||||
@Override | |||||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { | |||||
super.getItemOffsets(outRect, view, parent, state); | |||||
outRect.top = DimensUtil.getDimens(0); | |||||
outRect.bottom = DimensUtil.getDimens(15); | |||||
} | |||||
}); | |||||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | viewBinding.recyclerGoods.setAdapter(goodsAdapter); | ||||
classifyAdapter =new ClassifyAdapter() { | classifyAdapter =new ClassifyAdapter() { | ||||
@@ -148,6 +148,15 @@ public class HomeGoodsViewModel extends ViewModel { | |||||
//判断分类是否存在 | //判断分类是否存在 | ||||
if(GoodsClassifyDBUtil.getById(goodsClassify.id)==null){ | if(GoodsClassifyDBUtil.getById(goodsClassify.id)==null){ | ||||
GoodsClassifyDBUtil.add(goodsClassify); | GoodsClassifyDBUtil.add(goodsClassify); | ||||
}else { | |||||
for (GoodsClassifyBean bean : cloudGoodsList.getValue()) { | |||||
if (goodsClassify.id.equals(bean.getGoodsTypeId())) { | |||||
if(AttributeDBUtil.getByClassify(goodsClassify.id).size() != bean.getGoodsAttributeList().size()){ | |||||
NewToastUtil.getInstance().showToast("与本地【"+goodsClassify.name+"】分类的父属性数量不匹配,无法下载"); | |||||
return; | |||||
} | |||||
} | |||||
} | |||||
} | } | ||||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goodsClassify.id)!=null){ | if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goodsClassify.id)!=null){ | ||||
NewToastUtil.getInstance().showToast("已有该商品,请先删除再【"+goods.name+"】,再下载"); | NewToastUtil.getInstance().showToast("已有该商品,请先删除再【"+goods.name+"】,再下载"); | ||||
@@ -163,10 +172,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||||
//添加属性 | //添加属性 | ||||
for (GoodsClassifyBean bean : cloudGoodsList.getValue()){ | for (GoodsClassifyBean bean : cloudGoodsList.getValue()){ | ||||
if(goodsClassify.id.equals(bean.getGoodsTypeId())){ | if(goodsClassify.id.equals(bean.getGoodsTypeId())){ | ||||
if(AttributeDBUtil.getByClassify(goodsClassify.id).size() != bean.getGoodsAttributeList().size()){ | |||||
NewToastUtil.getInstance().showToast("与本地【"+goodsClassify.name+"】分类的父属性数量不匹配,无法下载"); | |||||
return; | |||||
} | |||||
Map<String ,String> subAttributeMap = new HashMap<>(); | Map<String ,String> subAttributeMap = new HashMap<>(); | ||||
for(GoodsClassifyBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList() ){ | for(GoodsClassifyBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList() ){ | ||||
@@ -2,14 +2,13 @@ | |||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||
xmlns:app="http://schemas.android.com/apk/res-auto" | xmlns:app="http://schemas.android.com/apk/res-auto" | ||||
xmlns:tools="http://schemas.android.com/tools" | xmlns:tools="http://schemas.android.com/tools" | ||||
android:layout_width="@dimen/dp_185" | |||||
android:layout_height="@dimen/dp_215" | |||||
android:paddingBottom="@dimen/dp_30" | |||||
android:layout_width="@dimen/dp_200" | |||||
android:layout_height="@dimen/dp_200" | |||||
> | > | ||||
<androidx.constraintlayout.widget.ConstraintLayout | <androidx.constraintlayout.widget.ConstraintLayout | ||||
android:layout_width="match_parent" | |||||
android:layout_height="match_parent" | |||||
android:layout_width="@dimen/dp_200" | |||||
android:layout_height="@dimen/dp_200" | |||||
> | > | ||||
<ImageView | <ImageView | ||||