@@ -209,7 +209,7 @@ public class GoodsDBUtil { | |||
*/ | |||
public static BPA_GOODS getByNameAndClassifyId(String name,String classifyId) { | |||
String orderby = QueryDB.Desc_Sort_Up; | |||
String where = "isDelete=? and name=? and classifyId=?"; | |||
String where = "isDelete=? and name=? and goodClassifyid=?"; | |||
String[] args = new String[]{"0", name,classifyId}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS.class, where, args, orderby); | |||
@@ -177,6 +177,9 @@ public class ModbusTcpServer { | |||
*/ | |||
public static void ConnectPLC() | |||
{ | |||
if(ConfigName.isTEST){ | |||
return; | |||
} | |||
String host=ConfigName.getInstance().Address; | |||
int port=ConfigName.getInstance().Post; | |||
param = TcpParam.create(host, port) | |||
@@ -1,5 +1,6 @@ | |||
package com.bonait.bnframework.common.model; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
@@ -7,137 +8,15 @@ import java.util.List; | |||
* @description: 菜谱分类云端数据 | |||
* @date: 2024/5/9 11:19. | |||
*/ | |||
public class GoodsClassifyBean { | |||
public class GoodsClassifyBean implements Serializable { | |||
public String goodsClassifyId; | |||
public String goodsClassifyName; | |||
public List<GoodsList> goodsList; | |||
private String goodsTypeId; | |||
private String goodsTypeName; | |||
private List<GoodsAttributeListBean> goodsAttributeList; | |||
private List<GoodsInfoListBean> goodsInfoList; | |||
public String getGoodsTypeId() { | |||
return goodsTypeId; | |||
} | |||
public void setGoodsTypeId(String goodsTypeId) { | |||
this.goodsTypeId = goodsTypeId; | |||
} | |||
public String getGoodsTypeName() { | |||
return goodsTypeName; | |||
} | |||
public void setGoodsTypeName(String goodsTypeName) { | |||
this.goodsTypeName = goodsTypeName; | |||
} | |||
public List<GoodsAttributeListBean> getGoodsAttributeList() { | |||
return goodsAttributeList; | |||
} | |||
public void setGoodsAttributeList(List<GoodsAttributeListBean> goodsAttributeList) { | |||
this.goodsAttributeList = goodsAttributeList; | |||
} | |||
public List<GoodsInfoListBean> getGoodsInfoList() { | |||
return goodsInfoList; | |||
} | |||
public void setGoodsInfoList(List<GoodsInfoListBean> goodsInfoList) { | |||
this.goodsInfoList = goodsInfoList; | |||
} | |||
public static class GoodsAttributeListBean { | |||
private String goodsAttributeId; | |||
private String goodsAttributeName; | |||
private int sort; | |||
private List<GoodsAttributeValueListBean> goodsAttributeValueList; | |||
public int getSort() { | |||
return sort; | |||
} | |||
public void setSort(int sort) { | |||
this.sort = sort; | |||
} | |||
public String getGoodsAttributeId() { | |||
return goodsAttributeId; | |||
} | |||
public void setGoodsAttributeId(String goodsAttributeId) { | |||
this.goodsAttributeId = goodsAttributeId; | |||
} | |||
public String getGoodsAttributeName() { | |||
return goodsAttributeName; | |||
} | |||
public void setGoodsAttributeName(String goodsAttributeName) { | |||
this.goodsAttributeName = goodsAttributeName; | |||
} | |||
public List<GoodsAttributeValueListBean> getGoodsAttributeValueList() { | |||
return goodsAttributeValueList; | |||
} | |||
public void setGoodsAttributeValueList(List<GoodsAttributeValueListBean> goodsAttributeValueList) { | |||
this.goodsAttributeValueList = goodsAttributeValueList; | |||
} | |||
public static class GoodsAttributeValueListBean { | |||
private String goodsAttributeId; | |||
private String goodsAttributeValueId; | |||
private String attributeValue; | |||
private int sort; | |||
public int getSort() { | |||
return sort; | |||
} | |||
public void setSort(int sort) { | |||
this.sort = sort; | |||
} | |||
public String getGoodsAttributeId() { | |||
return goodsAttributeId; | |||
} | |||
public void setGoodsAttributeId(String goodsAttributeId) { | |||
this.goodsAttributeId = goodsAttributeId; | |||
} | |||
public String getGoodsAttributeValueId() { | |||
return goodsAttributeValueId; | |||
} | |||
public void setGoodsAttributeValueId(String goodsAttributeValueId) { | |||
this.goodsAttributeValueId = goodsAttributeValueId; | |||
} | |||
public String getAttributeValue() { | |||
return attributeValue; | |||
} | |||
public void setAttributeValue(String attributeValue) { | |||
this.attributeValue = attributeValue; | |||
} | |||
} | |||
} | |||
public static class GoodsInfoListBean { | |||
private String goodsId; | |||
private String goodsName; | |||
private String imgUrl; | |||
public String getImgUrl() { | |||
return imgUrl; | |||
} | |||
public void setImgUrl(String imgUrl) { | |||
this.imgUrl = imgUrl; | |||
} | |||
private List<GoodsTechnologyActionListBean> goodsTechnologyActionList; | |||
public static class GoodsList implements Serializable { | |||
public String goodsId; | |||
public String goodsName; | |||
public String imgUrl; | |||
public String getGoodsId() { | |||
return goodsId; | |||
@@ -155,114 +34,36 @@ public class GoodsClassifyBean { | |||
this.goodsName = goodsName; | |||
} | |||
public List<GoodsTechnologyActionListBean> getGoodsTechnologyActionList() { | |||
return goodsTechnologyActionList; | |||
public String getImgUrl() { | |||
return imgUrl; | |||
} | |||
public void setGoodsTechnologyActionList(List<GoodsTechnologyActionListBean> goodsTechnologyActionList) { | |||
this.goodsTechnologyActionList = goodsTechnologyActionList; | |||
public void setImgUrl(String imgUrl) { | |||
this.imgUrl = imgUrl; | |||
} | |||
} | |||
public static class GoodsTechnologyActionListBean { | |||
/** | |||
* 工序名称 | |||
*/ | |||
private String stepName; | |||
/** | |||
* 工序参数 | |||
*/ | |||
private String actionJson; | |||
/** | |||
* 子属性组合 | |||
*/ | |||
private String goodsAttributeId; | |||
private boolean isBatch; | |||
private String chnologyId; | |||
private String groupId; | |||
private int sort; | |||
private String goodsId; | |||
private String deviceId; | |||
private String warehousrTemplateId; | |||
public String getStepName() { | |||
return stepName; | |||
} | |||
public void setStepName(String stepName) { | |||
this.stepName = stepName; | |||
} | |||
public String getActionJson() { | |||
return actionJson; | |||
} | |||
public void setActionJson(String actionJson) { | |||
this.actionJson = actionJson; | |||
} | |||
public String getGoodsAttributeId() { | |||
return goodsAttributeId; | |||
} | |||
public void setGoodsAttributeId(String goodsAttributeId) { | |||
this.goodsAttributeId = goodsAttributeId; | |||
} | |||
public boolean isIsBatch() { | |||
return isBatch; | |||
} | |||
public void setIsBatch(boolean isBatch) { | |||
this.isBatch = isBatch; | |||
} | |||
public String getChnologyId() { | |||
return chnologyId; | |||
} | |||
public void setChnologyId(String chnologyId) { | |||
this.chnologyId = chnologyId; | |||
} | |||
public String getGroupId() { | |||
return groupId; | |||
} | |||
public void setGroupId(String groupId) { | |||
this.groupId = groupId; | |||
} | |||
public int getSort() { | |||
return sort; | |||
} | |||
public void setSort(int sort) { | |||
this.sort = sort; | |||
} | |||
public String getGoodsId() { | |||
return goodsId; | |||
} | |||
public String getGoodsClassifyId() { | |||
return goodsClassifyId; | |||
} | |||
public void setGoodsId(String goodsId) { | |||
this.goodsId = goodsId; | |||
} | |||
public void setGoodsClassifyId(String goodsClassifyId) { | |||
this.goodsClassifyId = goodsClassifyId; | |||
} | |||
public String getDeviceId() { | |||
return deviceId; | |||
} | |||
public String getGoodsClassifyName() { | |||
return goodsClassifyName; | |||
} | |||
public void setDeviceId(String deviceId) { | |||
this.deviceId = deviceId; | |||
} | |||
public void setGoodsClassifyName(String goodsClassifyName) { | |||
this.goodsClassifyName = goodsClassifyName; | |||
} | |||
public String getWarehousrTemplateId() { | |||
return warehousrTemplateId; | |||
} | |||
public List<GoodsList> getGoodsList() { | |||
return goodsList; | |||
} | |||
public void setWarehousrTemplateId(String warehousrTemplateId) { | |||
this.warehousrTemplateId = warehousrTemplateId; | |||
} | |||
} | |||
public void setGoodsList(List<GoodsList> goodsList) { | |||
this.goodsList = goodsList; | |||
} | |||
} |
@@ -8,14 +8,23 @@ import java.util.List; | |||
* @date: 2024/7/9 11:19. | |||
*/ | |||
public class GoodsData { | |||
private List<GoodsClassifyBean> goodsInfoList; | |||
private List<GoodsInfoBean> goodsInfoList; | |||
private List<GoodsClassifyBean> goodsClassifyList; | |||
private List<DeviceInfoBean> deviceInfo; | |||
public List<GoodsClassifyBean> getGoodsInfoList() { | |||
public List<GoodsClassifyBean> getGoodsClassifyList() { | |||
return goodsClassifyList; | |||
} | |||
public void setGoodsClassifyList(List<GoodsClassifyBean> goodsClassifyList) { | |||
this.goodsClassifyList = goodsClassifyList; | |||
} | |||
public List<GoodsInfoBean> getGoodsInfoList() { | |||
return goodsInfoList; | |||
} | |||
public void setGoodsInfoList(List<GoodsClassifyBean> goodsInfoList) { | |||
public void setGoodsInfoList(List<GoodsInfoBean> goodsInfoList) { | |||
this.goodsInfoList = goodsInfoList; | |||
} | |||
@@ -0,0 +1,23 @@ | |||
package com.bonait.bnframework.common.model.upload; | |||
import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/7/25 16:57. | |||
*/ | |||
public class UpGoodsClassifyBean implements Serializable { | |||
public String name; | |||
public int sort; | |||
public String id; | |||
public String remark; | |||
public List<GoodsList> goodsList = new ArrayList<>(); | |||
public static class GoodsList implements Serializable { | |||
public String goodsId; | |||
public String goodsName; | |||
} | |||
} |
@@ -60,7 +60,7 @@ public class ProcessValueUtil { | |||
value = dataJson.optString("actionValue"); | |||
} | |||
} | |||
stringBuffer.append(name).append(",").append(value); | |||
stringBuffer.append(name).append(",").append(value).append("|"); | |||
}else{ | |||
for (int i =0 ;i<array.length();i++){ | |||
HashMap<String,String> map = new HashMap<>(); | |||
@@ -682,8 +682,9 @@ public class DiyProcessActivity extends BaseActivity { | |||
try { | |||
viewBinding.llProcessValue.removeAllViews(); | |||
ArrayList<BPA_PROCESSModel> mode = QueryDB.GetProcessModelProcessID(id); | |||
BPA_PROCESS process = QueryDB.GetProcessID(id); | |||
LogUtils.d(TAG+" selectItemFrom id="+id +" mode="+mode.toString() ); | |||
if (!mode.isEmpty())//工序 | |||
if (!mode.isEmpty() && !process.name.equals("液体料"))//工序 | |||
{ | |||
LogUtils.d("SelectItemFrom 1"); | |||
for (BPA_PROCESSModel item : mode) { | |||
@@ -58,18 +58,27 @@ public class EditClassifyTabActivity extends BaseActivity { | |||
viewBinding.viewpager.addOnPageChangeListener(pageChangeListener); | |||
viewBinding.viewpager.setOffscreenPageLimit(2); // 设置viewPager缓存多少个fragment | |||
viewBinding.navigation.setOnNavigationItemSelectedListener((item)->{ | |||
switch (item.getItemId()) { | |||
case R.id.bottom_device_1: | |||
viewBinding.viewpager.setCurrentItem(0); | |||
return true; | |||
case R.id.bottom_device_2: | |||
viewBinding.viewpager.setCurrentItem(1); | |||
return true; | |||
} | |||
return false; | |||
// viewBinding.navigation.setOnNavigationItemSelectedListener((item)->{ | |||
// switch (item.getItemId()) { | |||
// case R.id.bottom_device_1: | |||
// viewBinding.viewpager.setCurrentItem(0); | |||
// return true; | |||
// case R.id.bottom_device_2: | |||
// viewBinding.viewpager.setCurrentItem(1); | |||
// return true; | |||
// } | |||
// return false; | |||
// }); | |||
viewBinding.tvClassifyGoods.setOnClickListener(v->{ | |||
viewBinding.viewpager.setCurrentItem(1); | |||
viewBinding.tvClassifyGoods.setSelected(true); | |||
viewBinding.tvClassifyProperty.setSelected(false); | |||
}); | |||
viewBinding.tvClassifyProperty.setOnClickListener(v->{ | |||
viewBinding.viewpager.setCurrentItem(0); | |||
viewBinding.tvClassifyGoods.setSelected(false); | |||
viewBinding.tvClassifyProperty.setSelected(true); | |||
}); | |||
} | |||
/** | |||
@@ -78,13 +87,20 @@ public class EditClassifyTabActivity extends BaseActivity { | |||
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() { | |||
@Override | |||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
MenuItem menuItem = viewBinding.navigation.getMenu().getItem(position); | |||
// MenuItem menuItem = viewBinding.navigation.getMenu().getItem(position); | |||
} | |||
@Override | |||
public void onPageSelected(int position) { | |||
menuItem = viewBinding.navigation.getMenu().getItem(position); | |||
menuItem.setChecked(true); | |||
// menuItem = viewBinding.navigation.getMenu().getItem(position); | |||
// menuItem.setChecked(true); | |||
if(position==0){ | |||
viewBinding.tvClassifyGoods.setSelected(false); | |||
viewBinding.tvClassifyProperty.setSelected(true); | |||
}else{ | |||
viewBinding.tvClassifyGoods.setSelected(true); | |||
viewBinding.tvClassifyProperty.setSelected(false); | |||
} | |||
} | |||
@Override | |||
@@ -57,7 +57,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||
holder.binding.image.setImageResource(R.mipmap.loading123); | |||
} | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goods.propClassifyId)!=null){ | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goods.goodClassifyid)!=null){ | |||
holder.binding.downLoad.setVisibility(View.GONE); | |||
}else { | |||
holder.binding.downLoad.setVisibility(View.VISIBLE); | |||
@@ -85,9 +85,12 @@ public abstract class LocalGoodsAdapter extends BaseAdapter<BPA_GOODS,LocalGoods | |||
holder.binding.delete.setEnabled(goods.status>0?false:true); | |||
holder.binding.SelectStatus.setVisibility(goods.status>0? View.VISIBLE:View.GONE); | |||
holder.binding.SelectStatus.setChecked(goods.status==1?true:false); | |||
holder.binding.SelectStatus.setOnCheckedChangeListener((view,value)->{ | |||
selectGoods(view,position,value); | |||
holder.binding.SelectStatus.setOnClickListener(view->{ | |||
selectGoods(view,position,holder.binding.SelectStatus.isChecked()); | |||
}); | |||
// holder.binding.SelectStatus.setOnCheckedChangeListener((view,value)->{ | |||
// selectGoods(view,position,value); | |||
// }); | |||
//上传按钮点击 | |||
holder.binding.upload.setOnClickListener(new View.OnClickListener() { | |||
@@ -21,7 +21,9 @@ import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.model.GoodsClassifyBean; | |||
import com.bonait.bnframework.common.model.GoodsInfoBean; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.databinding.FragmentCloudGoodsBinding; | |||
@@ -193,11 +195,11 @@ public class CloudGoodsFragment extends BaseFragment { | |||
private void dealClassifyData(){ | |||
classifyList.clear(); | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
for (GoodsClassifyBean bean : Objects.requireNonNull(viewModel.cloudGoodsList.getValue())){ | |||
for (GoodsClassifyBean bean : Objects.requireNonNull(viewModel.cloudGoodsList.getValue().getGoodsClassifyList())){ | |||
BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY(); | |||
goodsClassify.id = bean.getGoodsTypeId(); | |||
LogUtils.d("dealClassifyData goodsId="+bean.getGoodsTypeId()); | |||
goodsClassify.name = bean.getGoodsTypeName(); | |||
goodsClassify.id = bean.getGoodsClassifyId(); | |||
LogUtils.d("dealClassifyData goodsId="+bean.getGoodsClassifyId()); | |||
goodsClassify.name = bean.getGoodsClassifyName(); | |||
classifyList.add(goodsClassify); | |||
} | |||
} | |||
@@ -208,20 +210,27 @@ public class CloudGoodsFragment extends BaseFragment { | |||
private void dealGoodsData(int position){ | |||
goodsList.clear(); | |||
if(!classifyList.isEmpty()){ | |||
String goodsId = classifyList.get(position).id; | |||
LogUtils.d("dealGoodsData goodsId="+goodsId+";classifyList.size="+classifyList.size()); | |||
String classifyID = classifyList.get(position).id; | |||
LogUtils.d("dealGoodsData classifyID="+classifyID+";classifyList.size="+classifyList.size()); | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
for (GoodsClassifyBean bean : viewModel.cloudGoodsList.getValue()){ | |||
if(goodsId.equals(bean.getGoodsTypeId())){ | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
for (GoodsClassifyBean bean : viewModel.cloudGoodsList.getValue().getGoodsClassifyList()){ | |||
if(classifyID.equals(bean.getGoodsClassifyId())){ | |||
bean.getGoodsList().forEach(classifyGoods -> { | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = goodsInfoListBean.getGoodsName(); | |||
goods.id = goodsInfoListBean.getGoodsId(); | |||
goods.propClassifyId = bean.getGoodsTypeId(); | |||
goods.url = goodsInfoListBean.getImgUrl(); | |||
goods.name = classifyGoods.getGoodsName(); | |||
goods.id = classifyGoods.getGoodsId(); | |||
goods.goodClassifyid = bean.goodsClassifyId; | |||
goods.url = classifyGoods.getImgUrl(); | |||
for(GoodsInfoBean item : viewModel.cloudGoodsList.getValue().getGoodsInfoList()) { | |||
for(GoodsInfoBean.GoodsInfoListBean goodsInfoListBean:item.getGoodsInfoList()){ | |||
if(goodsInfoListBean.getGoodsId().equals(goods.id)){ | |||
goods.propClassifyId = item.getGoodsTypeId(); | |||
break; | |||
} | |||
} | |||
} | |||
goodsList.add(goods); | |||
} | |||
break; | |||
}); | |||
} | |||
} | |||
} | |||
@@ -261,13 +270,13 @@ public class CloudGoodsFragment extends BaseFragment { | |||
*/ | |||
private boolean downLoadCloudGoods(int pos){ | |||
BPA_GOODS goods = goodsAdapter.getData().get(pos); | |||
// BPA_PROPERTY_CLASSIFY goodsClassify = goodClassifyAdapter.getData().get(goodClassifyAdapter.getCurrentPosition()); | |||
// if(GoodsDBUtil.getByIdAndClassifyId(goods.id,goodsClassify.id)!=null){ | |||
// NewToastUtil.getInstance().showToastError("请勿重复下载,本地商品已存在!!!"); | |||
// return false; | |||
// }else { | |||
// viewModel.downLoadCloudGoods(goods,goodsClassify); | |||
// } | |||
BPA_GOODS_CLASSIFY goodsClassify = goodClassifyAdapter.getData().get(goodClassifyAdapter.getCurrentPosition()); | |||
if(GoodsDBUtil.getByIdAndClassifyId(goods.id,goodsClassify.id)!=null){ | |||
NewToastUtil.getInstance().showToastError("请勿重复下载,本地商品已存在!!!"); | |||
return false; | |||
}else { | |||
viewModel.downLoadCloudGoods(goods,goodsClassify); | |||
} | |||
return true; | |||
} | |||
@@ -17,6 +17,7 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
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_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
@@ -24,6 +25,7 @@ import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
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.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.MaterialUtil; | |||
@@ -31,6 +33,7 @@ import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.model.GoodsClassifyBean; | |||
import com.bonait.bnframework.common.model.GoodsInfoBean; | |||
import com.bonait.bnframework.common.model.GoodsData; | |||
import com.bonait.bnframework.common.model.MaterialData; | |||
import com.bonait.bnframework.common.model.MaterialRequestPar; | |||
@@ -56,7 +59,7 @@ import java.util.Map; | |||
*/ | |||
public class HomeGoodsViewModel extends ViewModel { | |||
public MutableLiveData<List<GoodsClassifyBean>> cloudGoodsList = new MutableLiveData<>(); | |||
public MutableLiveData<GoodsData> cloudGoodsList = new MutableLiveData<>(); | |||
public boolean hasData = false; | |||
public void fetchCloudData(Context context){ | |||
@@ -105,7 +108,8 @@ public class HomeGoodsViewModel extends ViewModel { | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
cloudGoodsList.setValue(s.Content.getGoodsInfoList()); | |||
cloudGoodsList.setValue(s.Content); | |||
} | |||
}); | |||
hasData = true; | |||
@@ -166,30 +170,47 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
public void downLoadCloudGoods(BPA_GOODS goods, BPA_PROPERTY_CLASSIFY goodsClassify){ | |||
/** | |||
* 单个云端商品下载 | |||
* @param goods | |||
* @param goodsClassify | |||
*/ | |||
public void downLoadCloudGoods(BPA_GOODS goods, BPA_GOODS_CLASSIFY goodsClassify){ | |||
goods.goodClassifyid = goodsClassify.id; | |||
RecordManager.getInstance().addLogRecord("角色操作日志",goods.name+"-下载"); | |||
long curTime6 = System.currentTimeMillis(); | |||
LogUtils.d(" downLoadCloudGoods usetime="+(curTime6-lastTime)); | |||
lastTime = curTime6; | |||
//商品不存在情况 | |||
//判断分类是否存在 | |||
if(PropClassifyDBUtil.getById(goodsClassify.id)==null){ | |||
PropClassifyDBUtil.add(goodsClassify); | |||
BPA_PROPERTY_CLASSIFY propertyClassify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
if(GoodsClassifyDBUtil.getById(goodsClassify.id) == null){ | |||
GoodsClassifyDBUtil.add(goodsClassify); | |||
} | |||
if(propertyClassify==null){ | |||
propertyClassify= new BPA_PROPERTY_CLASSIFY(); | |||
propertyClassify.id = goods.propClassifyId; | |||
for (GoodsInfoBean bean : cloudGoodsList.getValue().getGoodsInfoList()) { | |||
if(bean.getGoodsTypeId().equals(goods.propClassifyId)){ | |||
propertyClassify.name = bean.getGoodsTypeName(); | |||
} | |||
} | |||
PropClassifyDBUtil.add(propertyClassify); | |||
}else { | |||
for (GoodsClassifyBean bean : cloudGoodsList.getValue()) { | |||
if (goodsClassify.id.equals(bean.getGoodsTypeId())) { | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(goodsClassify.id); | |||
for (GoodsInfoBean bean : cloudGoodsList.getValue().getGoodsInfoList()) { | |||
if (propertyClassify.id.equals(bean.getGoodsTypeId())) { | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(propertyClassify.id); | |||
if(attributes.size() != bean.getGoodsAttributeList().size()){ | |||
NewToastUtil.getInstance().showToast("与本地【"+goodsClassify.name+"】分类的父属性数量不匹配,无法下载","Does not match the number of parent attributes of the local class【"+goodsClassify.name+"】,unable to download!"); | |||
NewToastUtil.getInstance().showToast("与本地【"+propertyClassify.name+"】属性分类的父属性数量不匹配,无法下载","Does not match the number of parent attributes of the local class【"+goodsClassify.name+"】,unable to download!"); | |||
return; | |||
} | |||
List<String> attributeName = new ArrayList<>(); | |||
for(BPA_ATTRIBUTE attribute :attributes){ | |||
attributeName.add(attribute.id); | |||
} | |||
for(GoodsClassifyBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList()){ | |||
for(GoodsInfoBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList()){ | |||
if(!attributeName.contains(goodsAttributeListBean.getGoodsAttributeId())){ | |||
NewToastUtil.getInstance().showToast("与本地【"+goodsClassify.name+"】分类的父属性id不匹配,无法下载","Does not match the number of parent attributes of the local class id【"+goodsClassify.name+"】,unable to download!"); | |||
NewToastUtil.getInstance().showToast("与本地【"+propertyClassify.name+"】属性分类的父属性id不匹配,无法下载","Does not match the number of parent attributes of the local class id【"+goodsClassify.name+"】,unable to download!"); | |||
return; | |||
} | |||
} | |||
@@ -197,7 +218,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
} | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goodsClassify.id)!=null){ | |||
NewToastUtil.getInstance().showToast("已有该商品,请先删除再【"+goods.name+"】,再下载","The same product【"+goods.name+"】available,please delete and download!"); | |||
NewToastUtil.getInstance().showToast("已有该商品,请先删除【"+goods.name+"】,再下载","The same product【"+goods.name+"】available,please delete and download!"); | |||
return; | |||
} | |||
//添加商品 | |||
@@ -208,25 +229,25 @@ public class HomeGoodsViewModel extends ViewModel { | |||
return; | |||
} | |||
//添加属性 | |||
for (GoodsClassifyBean bean : cloudGoodsList.getValue()){ | |||
if(goodsClassify.id.equals(bean.getGoodsTypeId())){ | |||
for (GoodsInfoBean bean : cloudGoodsList.getValue().getGoodsInfoList()){ | |||
if(propertyClassify.id.equals(bean.getGoodsTypeId())){ | |||
Map<String ,String> subAttributeMap = new HashMap<>(); | |||
for(GoodsClassifyBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList() ){ | |||
for(GoodsInfoBean.GoodsAttributeListBean goodsAttributeListBean: bean.getGoodsAttributeList() ){ | |||
//判断是否已有属性 不存在则添加 | |||
if(!AttributeDBUtil.isExist(goodsClassify.id,goodsAttributeListBean.getGoodsAttributeName())){ | |||
if(!AttributeDBUtil.isExist(propertyClassify.id,goodsAttributeListBean.getGoodsAttributeName())){ | |||
BPA_ATTRIBUTE attribute = new BPA_ATTRIBUTE(); | |||
attribute.name = goodsAttributeListBean.getGoodsAttributeName(); | |||
attribute.id = goodsAttributeListBean.getGoodsAttributeId(); | |||
attribute.sort = goodsAttributeListBean.getSort(); | |||
attribute.classifyId = goodsClassify.id; | |||
attribute.classifyId = propertyClassify.id; | |||
AttributeDBUtil.add(attribute); | |||
LogUtils.d(" 添加属性 成功"+goodsAttributeListBean.getGoodsAttributeName()); | |||
}else { | |||
LogUtils.d(" 已存在属性 "+goodsAttributeListBean.getGoodsAttributeName()); | |||
} | |||
//添加子属性 | |||
for(GoodsClassifyBean.GoodsAttributeListBean.GoodsAttributeValueListBean goodsAttributeValueListBean : | |||
for(GoodsInfoBean.GoodsAttributeListBean.GoodsAttributeValueListBean goodsAttributeValueListBean : | |||
goodsAttributeListBean.getGoodsAttributeValueList() ){ | |||
//判断是否已有子属性 不存在则添加 | |||
if(!SubAttributeDBUtil.isExist(goodsAttributeListBean.getGoodsAttributeId(),goodsAttributeValueListBean.getAttributeValue())){ | |||
@@ -246,10 +267,10 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
List<BPA_GOODS_PROCESS_DETAIL> datas1 = new ArrayList<>(); | |||
List<BPA_GOODS_SUBATTRIBUTE_GROUP> datas2 = new ArrayList<>(); | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
for(GoodsInfoBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
if(goodsInfoListBean.getGoodsName().equals(goods.name)){ | |||
HashMap<String,String> groupList = new HashMap<>(); | |||
for (GoodsClassifyBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean:goodsInfoListBean.getGoodsTechnologyActionList()){ | |||
for (GoodsInfoBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean:goodsInfoListBean.getGoodsTechnologyActionList()){ | |||
//添加子属性组合 | |||
if(groupList.get(goodsTechnologyActionListBean.getGoodsAttributeId())==null){ | |||
BPA_GOODS_SUBATTRIBUTE_GROUP group = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
@@ -271,6 +292,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
processDetail.materialType = goodsTechnologyActionListBean.getStepName().contains("液体")?0:1; | |||
String value = ProcessValueUtil.dealProcessJsonToValue(goodsTechnologyActionListBean.getActionJson()); | |||
LogUtils.d("downLoadCloudGoods value="+value); | |||
processDetail.processms = goodsTechnologyActionListBean.getStepName()+ProcessValueUtil.dealProcessSms(value); | |||
processDetail.sort = goodsTechnologyActionListBean.getSort(); | |||
processDetail.processname = goodsTechnologyActionListBean.getStepName(); | |||
@@ -299,6 +321,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
long curTime = System.currentTimeMillis(); | |||
LogUtils.d(" synchronizedCloudData1 usetime="+(curTime-lastTime)); | |||
lastTime = curTime; | |||
GoodClssifySynchronous(); | |||
GoodTypeSynchronous(); | |||
long curTime2 = System.currentTimeMillis(); | |||
LogUtils.d(" synchronizedCloudData2 usetime="+(curTime2-lastTime)); | |||
@@ -323,9 +346,40 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
})); | |||
} | |||
/** | |||
* 同步云端商品分类到本地 所有商品 | |||
*/ | |||
private void GoodClssifySynchronous(){ | |||
if(cloudGoodsList.getValue()==null){ | |||
return; | |||
} | |||
LogUtils.d("GoodTypeSynchronous1"); | |||
List<BPA_GOODS_CLASSIFY> datas = new ArrayList<>(); | |||
List<BPA_GOODS_CLASSIFY> dataHas = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue().getGoodsClassifyList()){ | |||
BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY(); | |||
goodsClassify.name = item.getGoodsClassifyName(); | |||
goodsClassify.id = item.getGoodsClassifyId(); | |||
goodsClassify.userID="超级管理员"; | |||
datas.add(goodsClassify); | |||
if(item.getGoodsClassifyName()!=null){ | |||
List<BPA_GOODS_CLASSIFY> bean = GoodsClassifyDBUtil.getListByName(item.getGoodsClassifyName()); | |||
if(!bean.isEmpty()){ | |||
dataHas.addAll(bean); | |||
} | |||
} | |||
} | |||
//删除重复的分类 | |||
GoodsClassifyDBUtil.DeleteList(dataHas); | |||
for(BPA_GOODS_CLASSIFY bean : dataHas){ | |||
GoodsDBUtil.deleteByPropClassifyId(bean.id); | |||
} | |||
//批量添加 | |||
GoodsClassifyDBUtil.addList(datas); | |||
} | |||
/** | |||
* 同步云端商品分类到本地 | |||
* 同步云端商品分类到本地 所有商品 | |||
*/ | |||
private void GoodTypeSynchronous(){ | |||
if(cloudGoodsList.getValue()==null){ | |||
@@ -334,7 +388,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
LogUtils.d("GoodTypeSynchronous1"); | |||
List<BPA_PROPERTY_CLASSIFY> datas = new ArrayList<>(); | |||
List<BPA_PROPERTY_CLASSIFY> dataHas = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
for(GoodsInfoBean item : cloudGoodsList.getValue().getGoodsInfoList()){ | |||
BPA_PROPERTY_CLASSIFY bpa_goodstype = new BPA_PROPERTY_CLASSIFY(); | |||
bpa_goodstype.name = item.getGoodsTypeName(); | |||
bpa_goodstype.id = item.getGoodsTypeId(); | |||
@@ -369,7 +423,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
LogUtils.d("GoodPropSynchronous"); | |||
List<BPA_ATTRIBUTE> datas = new ArrayList<>(); | |||
List<BPA_SUBATTRIBUTE> dataSub = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
for(GoodsInfoBean item : cloudGoodsList.getValue().getGoodsInfoList()){ | |||
if(item.getGoodsAttributeList()!=null){ | |||
for(int n=0;n<item.getGoodsAttributeList().size();n++){ | |||
//属性添加 | |||
@@ -414,14 +468,21 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
LogUtils.d("GoodInfoSynchronous"); | |||
List<BPA_GOODS> datas = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
for(GoodsInfoBean item : cloudGoodsList.getValue().getGoodsInfoList()){ | |||
if(item.getGoodsInfoList()!=null){ | |||
for(int i=0;i<item.getGoodsInfoList().size();i++){ | |||
BPA_GOODS bpa_goods =new BPA_GOODS(); | |||
bpa_goods.id = item.getGoodsInfoList().get(i).getGoodsId(); | |||
bpa_goods.name = item.getGoodsInfoList().get(i).getGoodsName(); | |||
bpa_goods.propClassifyId =item.getGoodsTypeId(); | |||
bpa_goods.status=1; | |||
cloudGoodsList.getValue().getGoodsClassifyList().forEach(classify->{ | |||
classify.goodsList.forEach(goodsId->{ | |||
if(goodsId.getGoodsId().equals(bpa_goods.id)){ | |||
bpa_goods.goodClassifyid = classify.goodsClassifyId; | |||
} | |||
}); | |||
}); | |||
bpa_goods.status=0; | |||
bpa_goods.url=item.getGoodsInfoList().get(i).getImgUrl()==null?"":item.getGoodsInfoList().get(i).getImgUrl(); | |||
bpa_goods.sort= i+1; | |||
datas.add(bpa_goods); | |||
@@ -442,12 +503,12 @@ public class HomeGoodsViewModel extends ViewModel { | |||
LogUtils.d("GoodRecipeSynchronous"); | |||
List<BPA_GOODS_PROCESS_DETAIL> datas1 = new ArrayList<>(); | |||
List<BPA_GOODS_SUBATTRIBUTE_GROUP> datas2 = new ArrayList<>(); | |||
for(GoodsClassifyBean item : cloudGoodsList.getValue()){ | |||
for(GoodsInfoBean item : cloudGoodsList.getValue().getGoodsInfoList()){ | |||
if(item.getGoodsInfoList()!=null){ | |||
item.getGoodsInfoList().forEach(goodinfo->{ | |||
try { | |||
HashMap<String,String> groupList = new HashMap<>(); | |||
for (GoodsClassifyBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean: | |||
for (GoodsInfoBean.GoodsInfoListBean.GoodsTechnologyActionListBean goodsTechnologyActionListBean: | |||
goodinfo.getGoodsTechnologyActionList()){ | |||
//添加子属性组合 | |||
if(groupList.get(goodsTechnologyActionListBean.getGoodsAttributeId())==null){ | |||
@@ -493,12 +554,12 @@ public class HomeGoodsViewModel extends ViewModel { | |||
* @param goodsAttributeId | |||
* @return | |||
*/ | |||
private static String GetRecipeName(String goodsAttributeId, List<GoodsClassifyBean.GoodsAttributeListBean> attributes){ | |||
private static String GetRecipeName(String goodsAttributeId, List<GoodsInfoBean.GoodsAttributeListBean> attributes){ | |||
String[] props = goodsAttributeId.split("[,]"); | |||
StringBuffer recpipeNameTemp = new StringBuffer(); | |||
try{ | |||
for(GoodsClassifyBean.GoodsAttributeListBean bean : attributes){ | |||
for(GoodsClassifyBean.GoodsAttributeListBean.GoodsAttributeValueListBean sub:bean.getGoodsAttributeValueList()){ | |||
for(GoodsInfoBean.GoodsAttributeListBean bean : attributes){ | |||
for(GoodsInfoBean.GoodsAttributeListBean.GoodsAttributeValueListBean sub:bean.getGoodsAttributeValueList()){ | |||
for(String id : props){ | |||
if(sub!=null && sub.getGoodsAttributeValueId().equals(id)){ | |||
recpipeNameTemp.append(sub.getAttributeValue()).append("-"); | |||
@@ -11,6 +11,7 @@ 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_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
@@ -19,6 +20,8 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
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.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.MaterialUtil; | |||
import com.bonait.bnframework.common.db.util.ProcessModelUtil; | |||
@@ -33,6 +36,7 @@ import com.bonait.bnframework.common.model.upload.GoodsProcessDetail; | |||
import com.bonait.bnframework.common.model.upload.MaterialDataInfo; | |||
import com.bonait.bnframework.common.model.upload.UpAttributeBean; | |||
import com.bonait.bnframework.common.model.upload.UpClassifyBean; | |||
import com.bonait.bnframework.common.model.upload.UpGoodsClassifyBean; | |||
import com.bonait.bnframework.common.model.upload.UpResData; | |||
import com.bonait.bnframework.common.model.upload.UploadRes; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
@@ -71,6 +75,10 @@ public class UpdateAllDataService { | |||
return; | |||
} | |||
if(goods==null) return; | |||
if(goods.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("请选择商品"); | |||
return; | |||
} | |||
if (NetworkUtils.checkNetworkAvailable(context)) { | |||
try{ | |||
WaitProcessUtil.getInstance().Show(context,"商品上传","准备上传商品,请耐心稍等...","Product upload","Preparing to upload the product, please be patient for a moment"); | |||
@@ -261,9 +269,50 @@ public class UpdateAllDataService { | |||
} | |||
/** | |||
* 商品分类 | |||
* @param goods | |||
* @param context | |||
*/ | |||
private static void upLoadGoodsClassifyInfo(List<BPA_GOODS> goods,Context context){ | |||
try{ | |||
WaitProcessUtil.getInstance().Show("正在上传商品分类信息,请耐心稍等...","Uploading category information, please be patient..."); | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.get(0).goodClassifyid); | |||
assert classify != null; | |||
List<UpGoodsClassifyBean> upClassifyBeans = new ArrayList<>(); | |||
UpGoodsClassifyBean upClassifyBean = new UpGoodsClassifyBean(); | |||
upClassifyBean.id = classify.id; | |||
upClassifyBean.name = classify.name; | |||
upClassifyBean.sort = 0; | |||
upClassifyBean.remark = ""; | |||
goods.forEach(good->{ | |||
UpGoodsClassifyBean.GoodsList bean = new UpGoodsClassifyBean.GoodsList(); | |||
bean.goodsId = good.id; | |||
bean.goodsName = good.name; | |||
upClassifyBean.goodsList.add(bean); | |||
}); | |||
upClassifyBeans.add(upClassifyBean); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsClassify"; | |||
Post(url,context,upClassifyBeans,"商品分类信息",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品分类成功"); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
Analysis(context,response,"商品工艺",url).OnSource(()->{ | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
} | |||
} | |||
/** | |||
* 属性分类 | |||
* @param goods | |||
* @param context | |||
*/ | |||
private static void upLoadClassifyInfo(List<BPA_GOODS> goods,Context context){ | |||
try { | |||
WaitProcessUtil.getInstance().Show("正在上传分类信息,请耐心稍等...","Uploading category information, please be patient..."); | |||
WaitProcessUtil.getInstance().Show("正在上传属性分类信息,请耐心稍等...","Uploading category information, please be patient..."); | |||
List<UpClassifyBean> upClassifyBeans = new ArrayList<>(); | |||
goods.forEach(good->{ | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(good.propClassifyId); | |||
@@ -277,8 +326,8 @@ public class UpdateAllDataService { | |||
} | |||
}); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
Post(url,context,upClassifyBeans,"分类信息",(response->{ | |||
Analysis(context,response,"分类信息",url).OnSource(()->{ | |||
Post(url,context,upClassifyBeans,"属性分类信息",(response->{ | |||
Analysis(context,response,"属性分类信息",url).OnSource(()->{ | |||
upLoadAttribute(upClassifyBeans,goods,context); | |||
}); | |||
})); | |||
@@ -437,8 +486,10 @@ public class UpdateAllDataService { | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
Post(url,context,goodsProcessDetailList,"商品工艺",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功"); | |||
NewToastUtil.getInstance().showToastError("上传商品工艺成功"); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
NewToastUtil.getInstance().showToast("上传商品工艺成功"); | |||
Analysis(context,response,"商品工艺",url).OnSource(()->{ | |||
upLoadGoodsClassifyInfo(goodsList,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
@@ -10,6 +10,7 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
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_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP; | |||
@@ -18,6 +19,7 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
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.GoodsProcessDetailDBUtil; | |||
import com.bonait.bnframework.common.db.util.MaterialUtil; | |||
@@ -33,6 +35,7 @@ import com.bonait.bnframework.common.model.upload.GoodsProcessDetail; | |||
import com.bonait.bnframework.common.model.upload.MaterialDataInfo; | |||
import com.bonait.bnframework.common.model.upload.UpAttributeBean; | |||
import com.bonait.bnframework.common.model.upload.UpClassifyBean; | |||
import com.bonait.bnframework.common.model.upload.UpGoodsClassifyBean; | |||
import com.bonait.bnframework.common.model.upload.UpResData; | |||
import com.bonait.bnframework.common.model.upload.UploadRes; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
@@ -284,7 +287,7 @@ public class UpdateDataService { | |||
} | |||
/** | |||
* 商品分类 | |||
* 属性分类 | |||
* @param goodsId | |||
* @param context | |||
*/ | |||
@@ -303,8 +306,8 @@ public class UpdateDataService { | |||
upClassifyBean.remark = ""; | |||
upClassifyBeans.add(upClassifyBean); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
Post(url,context,upClassifyBeans,"分类信息",(response->{ | |||
Analysis(context,response,"分类信息",url).OnSource(()->{ | |||
Post(url,context,upClassifyBeans,"属性分类信息",(response->{ | |||
Analysis(context,response,"属性分类信息",url).OnSource(()->{ | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(classify.id); | |||
if (!attributes.isEmpty()){ | |||
upLoadAttribute(attributes,goodsId,context); | |||
@@ -319,6 +322,46 @@ public class UpdateDataService { | |||
} | |||
/** | |||
* 商品分类 | |||
* @param goodsId | |||
* @param context | |||
*/ | |||
private static void upLoadGoodsClassifyInfo(String goodsId,Context context){ | |||
try{ | |||
WaitProcessUtil.getInstance().Show("正在上传分类信息,请耐心稍等...","Uploading category information, please be patient..."); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodsId); | |||
assert goods != null; | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.goodClassifyid); | |||
assert classify != null; | |||
List<UpGoodsClassifyBean> upClassifyBeans = new ArrayList<>(); | |||
UpGoodsClassifyBean upClassifyBean = new UpGoodsClassifyBean(); | |||
upClassifyBean.id = classify.id; | |||
upClassifyBean.name = classify.name; | |||
upClassifyBean.sort = 0; | |||
upClassifyBean.remark = ""; | |||
List<BPA_GOODS> goodsList = GoodsDBUtil.getByClassifyId(classify.id); | |||
goodsList.forEach(good->{ | |||
UpGoodsClassifyBean.GoodsList bean = new UpGoodsClassifyBean.GoodsList(); | |||
bean.goodsId = good.id; | |||
bean.goodsName = good.name; | |||
upClassifyBean.goodsList.add(bean); | |||
}); | |||
upClassifyBeans.add(upClassifyBean); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsClassify"; | |||
Post(url,context,upClassifyBeans,"商品分类信息",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品分类成功"); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
Analysis(context,response,"商品工艺",url).OnSource(()->{ | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
} | |||
} | |||
/** | |||
* 商品分类属性 | |||
* @param attributes | |||
@@ -494,7 +537,9 @@ public class UpdateDataService { | |||
Post(url,context,goodsProcessDetailList,"商品工艺",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功"); | |||
NewToastUtil.getInstance().showToastError("上传商品工艺成功"); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
Analysis(context,response,"商品工艺",url).OnSource(()->{ | |||
upLoadGoodsClassifyInfo(goodsId,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
@@ -0,0 +1,5 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<shape xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<stroke android:color="@color/color3" android:width="@dimen/dp_1"/> | |||
</shape> |
@@ -0,0 +1,6 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<item android:state_selected="true" android:color="@color/app_color_blue"/> | |||
<item android:color="@color/black"/> | |||
</selector> |
@@ -8,22 +8,58 @@ | |||
android:id="@+id/root" | |||
android:fitsSystemWindows="true"> | |||
<com.google.android.material.bottomnavigation.BottomNavigationView | |||
android:id="@+id/navigation" | |||
android:layout_marginTop="54dp" | |||
<!-- <com.google.android.material.navigation.NavigationView--> | |||
<!-- android:id="@+id/navigation"--> | |||
<!-- android:layout_marginTop="54dp"--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="50dp"--> | |||
<!-- android:layout_gravity="top"--> | |||
<!-- android:background="@drawable/qmui_list_item_bg_with_border_bottom"--> | |||
<!-- app:itemHorizontalTranslationEnabled="false"--> | |||
<!-- app:labelVisibilityMode="labeled"--> | |||
<!-- app:menu="@menu/classifytb"--> | |||
<!-- style="@style/BottomNavigationTextStyle"--> | |||
<!-- app:itemIconTint="@null"--> | |||
<!-- app:itemIconSize="0dp"--> | |||
<!-- android:fitsSystemWindows="true"/>--> | |||
<LinearLayout | |||
android:id="@+id/ll_tab" | |||
android:layout_marginTop="60dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="50dp" | |||
android:layout_gravity="top" | |||
android:background="@drawable/qmui_list_item_bg_with_border_bottom" | |||
app:itemHorizontalTranslationEnabled="false" | |||
app:labelVisibilityMode="labeled" | |||
app:menu="@menu/classifytb" | |||
app:itemIconTint="@null" | |||
app:itemIconSize="0dp" | |||
android:fitsSystemWindows="true"/> | |||
android:orientation="horizontal" | |||
android:paddingTop="@dimen/dp_5" | |||
android:layout_marginLeft="@dimen/dp_25" | |||
android:layout_marginRight="@dimen/dp_25" | |||
android:layout_height="@dimen/dp_70"> | |||
<TextView | |||
android:id="@+id/tv_classify_property" | |||
android:layout_width="0dp" | |||
android:layout_weight="1" | |||
android:textColor="@drawable/bg_tab_text_color_selector" | |||
android:text="属性分类编辑" | |||
android:background="@drawable/bg_tab_text" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_height="match_parent" | |||
> | |||
</TextView> | |||
<TextView | |||
android:id="@+id/tv_classify_goods" | |||
android:layout_width="0dp" | |||
android:layout_weight="1" | |||
android:background="@drawable/bg_tab_text" | |||
android:text="商品分类编辑" | |||
android:textSize="@dimen/sp_32" | |||
android:gravity="center" | |||
android:textColor="@drawable/bg_tab_text_color_selector" | |||
android:layout_height="match_parent" | |||
/> | |||
</LinearLayout> | |||
<com.qmuiteam.qmui.widget.QMUIViewPager | |||
android:id="@+id/viewpager" | |||
android:layout_marginTop="104dp" | |||
android:layout_marginTop="135dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="?attr/app_content_bg_color" /> | |||
@@ -86,17 +86,18 @@ | |||
/> | |||
<TextView | |||
android:id="@+id/line" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_1" | |||
app:layout_constraintTop_toBottomOf="@id/desc" | |||
android:layout_marginTop="@dimen/dp_90" | |||
android:layout_marginTop="@dimen/dp_15" | |||
android:background="@color/color3" | |||
/> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:layout_marginLeft="@dimen/dp_21" | |||
android:layout_marginTop="180dp" | |||
android:layout_marginTop="120dp" | |||
android:id="@+id/recycler_goods" | |||
android:layout_width="match_parent" | |||
android:orientation="vertical" | |||
@@ -20,7 +20,7 @@ | |||
android:paddingBottom="@dimen/dp_25" | |||
android:layout_marginBottom="2dp" | |||
android:ellipsize="middle" | |||
android:textSize="25dp" | |||
android:textSize="32sp" | |||
android:text="@string/btn_addclass" | |||
android:textColor="#823E17" | |||
android:gravity="center" | |||
@@ -3,9 +3,9 @@ | |||
<item | |||
android:id="@+id/bottom_device_1" | |||
android:title="属性分类编辑" | |||
android:textSize="20sp"/> | |||
android:textSize="32sp"/> | |||
<item | |||
android:id="@+id/bottom_device_2" | |||
android:title="商品分类编辑" | |||
android:textSize="20sp"/> | |||
android:textSize="32sp"/> | |||
</menu> |
@@ -37,6 +37,9 @@ | |||
</style> | |||
<style name="BottomNavigationTextStyle" parent="Widget.Design.BottomNavigationView"> | |||
<item name="android:textSize">32sp</item> <!-- 设置你想要的字体大小 --> | |||
</style> | |||
<!--=======通用弹框主题============--> | |||
<style name="dialogCommonTheme" parent="@android:style/Theme.Dialog"> | |||