@@ -4,7 +4,7 @@ | |||
<selectionStates> | |||
<SelectionState runConfigName="app"> | |||
<option name="selectionMode" value="DROPDOWN" /> | |||
<DropdownSelection timestamp="2024-08-15T06:56:40.277909800Z"> | |||
<DropdownSelection timestamp="2024-08-15T09:34:12.064478800Z"> | |||
<Target type="DEFAULT_BOOT"> | |||
<handle> | |||
<DeviceId pluginId="Default" identifier="serial=127.0.0.1:7555;connection=ab909648" /> | |||
@@ -76,6 +76,7 @@ import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.GoodEditDialog; | |||
import com.bonait.bnframework.event.DownGoodsEvent; | |||
import com.bonait.bnframework.ui.viewmodel.UpdateDataService; | |||
import com.google.gson.Gson; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.callback.StringCallback; | |||
@@ -257,6 +258,10 @@ public class ConfigData { | |||
case -202: | |||
ConfigName.getInstance().DeviceHao = Integer.parseInt(item.value); | |||
break; | |||
case -203: | |||
ConfigName.getInstance().Key = item.value; | |||
UpdateDataService.key = item.value; | |||
break; | |||
case 1: | |||
ConfigName.getInstance().Address = item.value; | |||
break; | |||
@@ -20,6 +20,7 @@ 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_LOG; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL_TYPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
@@ -281,13 +282,15 @@ public class MainInit { | |||
ConfigData.getInstance().RevertPLCProcess(); | |||
} | |||
if(PreferenceUtils.getInt("isNewVersion",0)!=2){ | |||
if(PreferenceUtils.getInt("isNewVersion",0)!=3){ | |||
if(!DBHelper.getInstance(MainApplication.getContext()).doesTableExist(BPA_PROPERTY_CLASSIFY.class)){ | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROPERTY_CLASSIFY.class,null); | |||
} | |||
if(!DBHelper.getInstance(MainApplication.getContext()).doesTableExist(BPA_MATERIAL_TYPE.class)){ | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_MATERIAL_TYPE.class,null); | |||
} | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_GOODS.class,null); | |||
PreferenceUtils.setInt("isNewVersion",2); | |||
PreferenceUtils.setInt("isNewVersion",3); | |||
} | |||
} | |||
@@ -112,7 +112,12 @@ public class ConfigName { | |||
/** | |||
* 店铺设备号 | |||
*/ | |||
public String DeviceAutoKey = "159"; | |||
public String DeviceAutoKey = "262"; | |||
/** | |||
* 平台授权码 | |||
*/ | |||
public String Key = "d4f04e18-dfe7-4fdc-9c5b-eb4a611681ff"; | |||
/** | |||
* 设备id | |||
*/ | |||
@@ -1029,7 +1034,7 @@ public class ConfigName { | |||
put("抽水量","Weight"); | |||
put("正转反转、一直正转、一直反转","Positive&Negative、Positive、Negative"); | |||
put("原点位、出餐启动、倒菜位、抽料位、清洗位、炒菜位1、炒菜位2、炒菜位3","Origin、Pour-start、Pour、Extract、Clean、Fry1、Fry2、Fry3"); | |||
put("1号位、2号位、3号位、4号位","1 Bit、2 Bit、3 Bit、4 Bit"); | |||
put("1号位、2号位、3号位、4号位、5号位","1 Bit、2 Bit、3 Bit、4 Bit、5 Bit"); | |||
put("炒菜位1、炒菜位2、炒菜位3、原点位","Fry1、Fry2、Fry3、Origin"); | |||
put("投出等待三秒、直接投出、手动投料","Wait 3s、Direct Throw、Manual Throw"); | |||
put("停止、最低、低速、中速、高速、最高、极高","Stop、Lowest、Low、Middle、High、Highest、Extreme"); | |||
@@ -1053,6 +1058,7 @@ public class ConfigName { | |||
put("2号位","2 Bit"); | |||
put("3号位","3 Bit"); | |||
put("4号位","4 Bit"); | |||
put("5号位","5 Bit"); | |||
put("投出等待三秒","Wait 3s"); | |||
put("直接投出","Direct Throw"); | |||
put("手动投料","Manual Throw"); | |||
@@ -1089,6 +1095,7 @@ public class ConfigName { | |||
put("2 Bit","2号位"); | |||
put("3 Bit","3号位"); | |||
put("4 Bit","4号位"); | |||
put("5 Bit","5号位"); | |||
put("Wait 3s","投出等待三秒"); | |||
put("Direct Throw","直接投出"); | |||
put("Manual Throw","手动投料"); | |||
@@ -21,6 +21,7 @@ import com.bonait.bnframework.common.db.mode.BPA_CRAFTPROCESS; | |||
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_LOG; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL_TYPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_MENU; | |||
import com.bonait.bnframework.common.db.mode.BPA_MENUANDUSER; | |||
import com.bonait.bnframework.common.db.mode.BPA_ORDER; | |||
@@ -124,6 +125,17 @@ public class QueryDB { | |||
return Delete(BPA_MATERIAL.class, data.id); | |||
} | |||
/** | |||
* 删除物料数据 | |||
* add fengyoufu 20230413 | |||
* | |||
* @param data 物料数据 | |||
* @return 是否成功 | |||
*/ | |||
public static boolean DeleteMaterialType(BPA_MATERIAL_TYPE data) { | |||
return Delete(BPA_MATERIAL_TYPE.class, data.id); | |||
} | |||
// public static boolean DeleteMaterial(String id){ | |||
// boolean result = false; | |||
// SQLiteDatabase db = helper.getWritableDatabase(); | |||
@@ -2955,6 +2967,11 @@ public class QueryDB { | |||
((BPA_PROPERTY_CLASSIFY) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | |||
((BPA_PROPERTY_CLASSIFY) data).state = cursor.getInt((int) cursor.getColumnIndex("state")); | |||
break; | |||
case "BPA_MATERIAL_TYPE": | |||
data = new BPA_MATERIAL_TYPE(); | |||
//私有 | |||
((BPA_MATERIAL_TYPE) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | |||
break; | |||
case "BPA_GOODS_SUBATTRIBUTE_GROUP": | |||
data = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
//私有 | |||
@@ -22,6 +22,7 @@ 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_LOG; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL_TYPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_MENU; | |||
import com.bonait.bnframework.common.db.mode.BPA_MENUANDUSER; | |||
import com.bonait.bnframework.common.db.mode.BPA_ORDER; | |||
@@ -151,6 +152,7 @@ public class DBHelper extends SQLiteOpenHelper { | |||
CreateTablesAll(BPA_LOG_RECORD.class,null);//子属性 | |||
CreateTablesAll(BPA_ORDER_LIST.class,null);//子属性 | |||
CreateTablesAll(BPA_PROPERTY_CLASSIFY.class,null);//属性分类表 | |||
CreateTablesAll(BPA_MATERIAL_TYPE.class,null);//物料分类表 | |||
ForeignKeys(); | |||
} | |||
/** | |||
@@ -0,0 +1,10 @@ | |||
package com.bonait.bnframework.common.db.mode; | |||
/** | |||
* BPA_MATERIAL[物料表] | |||
* 创建人:fengyoufu add 20230412 | |||
*/ | |||
public class BPA_MATERIAL_TYPE extends ModeBase { | |||
//物料类型名称 | |||
public String name; | |||
} |
@@ -11,6 +11,7 @@ public class BPA_ORDER_LIST extends ModeBase{ | |||
public String groupId; | |||
public String goodsId; | |||
public String classifyId; | |||
public String propClassifyId; | |||
public int status=1;//1完成 2取消 3异常 | |||
@Override | |||
@@ -8,6 +8,7 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.file.DBHelper; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL_TYPE; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
@@ -37,6 +38,44 @@ public class MaterialUtil { | |||
LogUtils.d("GetMaterialALL 获取所有物料信息 data="+data.toString()); | |||
return data; | |||
} | |||
/** | |||
* 获取所有物料类型信息 | |||
* | |||
* @return | |||
*/ | |||
public static ArrayList<BPA_MATERIAL_TYPE> GetMaterialTypeALL() { | |||
String orderby = QueryDB.Desc_Time_Up;//出料顺序 | |||
String where = "isDelete=?"; | |||
String[] args = new String[]{"0"}; | |||
ArrayList<BPA_MATERIAL_TYPE> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_MATERIAL_TYPE.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data.add((BPA_MATERIAL_TYPE) k); | |||
} | |||
LogUtils.d("GetMaterialTypeALL 获取所有物料类型信息 data="+data.toString()); | |||
return data; | |||
} | |||
/** | |||
* 获取物料类型信息 | |||
* | |||
* @return | |||
*/ | |||
public static BPA_MATERIAL_TYPE GetMaterialTypeByName(String name) { | |||
String orderby = QueryDB.Desc_Time_Up;//出料顺序 | |||
String where = "isDelete=? and name=?"; | |||
String[] args = new String[]{"0",name}; | |||
ArrayList<BPA_MATERIAL_TYPE> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_MATERIAL_TYPE.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data.add((BPA_MATERIAL_TYPE) k); | |||
} | |||
LogUtils.d("GetMaterialTypeByName 获取物料类型信息 data="+data.toString()); | |||
return data.isEmpty()?new BPA_MATERIAL_TYPE():data.get(0); | |||
} | |||
/** | |||
* 批量新增 | |||
* @param c | |||
@@ -93,4 +132,63 @@ public class MaterialUtil { | |||
} | |||
return isSucess; | |||
} | |||
/** | |||
* 批量新增 | |||
* @param c | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addMaterialTypeList(Class c, List<BPA_MATERIAL_TYPE> list) { | |||
if(list.isEmpty()){ | |||
return false; | |||
} | |||
QueryDB.lock.lock(); | |||
boolean isSucess = false; | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
try { | |||
long insert=-1; | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
ContentValues cv = new ContentValues(); | |||
Map<String, Object> map = Tools.getObjValue(list.get(i)); | |||
if (map.get("id").toString().isEmpty()) | |||
return false; | |||
for (String key : map.keySet()) { | |||
Object value = map.get(key); | |||
if (value instanceof String) { | |||
cv.put(key, (String) value); | |||
} else if (value instanceof Integer) { | |||
cv.put(key, ((Integer) value).intValue()); | |||
} else if (value instanceof Double) { | |||
cv.put(key, ((Double) value).doubleValue()); | |||
} else if (value instanceof Float) { | |||
cv.put(key, ((Float) value).floatValue()); | |||
} else if (value instanceof Long) { | |||
cv.put(key, ((Long) value).longValue()); | |||
} else if (value instanceof Boolean) { | |||
cv.put(key, ((Boolean) value).booleanValue()); | |||
} | |||
} | |||
insert = db.insertOrThrow(c.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
db.setTransactionSuccessful(); | |||
isSucess = insert > 0; | |||
} catch (Exception e) { | |||
isSucess = false; | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return isSucess; | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.bonait.bnframework.common.model; | |||
public class MaterialModelType { | |||
public String id; | |||
public String name; | |||
@Override | |||
public String toString() { | |||
return "MaterialModelType{" + | |||
"id='" + id + '\'' + | |||
", name='" + name + '\'' + | |||
'}'; | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
package com.bonait.bnframework.common.model; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
public class MaterialTypeData { | |||
public List<MaterialModelType> data=new ArrayList<>(); | |||
@Override | |||
public String toString() { | |||
return "MaterialData{" + | |||
"data=" + data + | |||
'}'; | |||
} | |||
} |
@@ -8,6 +8,7 @@ import android.os.Bundle; | |||
import android.os.Environment; | |||
import android.view.View; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
@@ -19,12 +20,15 @@ import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.MyLayoutManager; | |||
import com.bonait.bnframework.event.ImageSelectEvent; | |||
import com.bonait.bnframework.modules.home.adapter.image_sp_adapter; | |||
import com.bonait.bnframework.modules.home.adapter.sp_adapter; | |||
import com.bonait.bnframework.modules.home.fragment.mode.image_sp; | |||
import com.qmuiteam.qmui.widget.QMUITopBar; | |||
import com.qmuiteam.qmui.widget.QMUITopBarLayout; | |||
import org.greenrobot.eventbus.EventBus; | |||
import java.io.File; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -82,6 +86,13 @@ public class ImageChooseActivity extends BaseActivity { | |||
image_sp sp=(image_sp)data; | |||
MessageManager.getInstance().sendMessage(MessageName.ClickImage,sp.url); | |||
finish(); | |||
LogUtils.d("sp.url= "+sp.url); | |||
recyclerView.postDelayed(new Runnable() { | |||
@Override | |||
public void run() { | |||
EventBus.getDefault().post(new ImageSelectEvent(CACHE_PATH+"/"+sp.url)); | |||
} | |||
},500); | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
@@ -209,6 +209,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
public void onClick(QMUIDialog dialog, int index) { | |||
if(ConfigName.isTEST){ | |||
HomeGoodsViewModel.GetMaterialInfo(); | |||
HomeGoodsViewModel.GetMaterialType(); | |||
UpdateDataService.downLoadProcessModel("",getContext()); | |||
dialog.dismiss(); | |||
return; | |||
@@ -218,6 +219,7 @@ public class SystemSeasoningsetFragment extends BaseFragment implements MyClickL | |||
if (text.toString().equals(ConfigName.getInstance().user.pass)) { | |||
// ConfigData.getInstance().SyncDataInTheCloud(context,mHandler); | |||
HomeGoodsViewModel.GetMaterialInfo(); | |||
HomeGoodsViewModel.GetMaterialType(); | |||
UpdateDataService.downLoadProcessModel("",getContext()); | |||
dialog.dismiss(); | |||
} else { | |||
@@ -24,6 +24,7 @@ import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; | |||
import com.bonait.bnframework.common.model.mode.VersionSelectionEnum; | |||
import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.ui.viewmodel.UpdateDataService; | |||
import com.orhanobut.logger.Logger; | |||
import java.util.ArrayList; | |||
@@ -52,6 +53,8 @@ public class SystemSystemsetFragment extends BaseFragment { | |||
EditText edittext101; | |||
@BindView(R.id.edittext102) | |||
EditText edittext102; | |||
@BindView(R.id.edittext_key) | |||
EditText edittext103; | |||
@BindView(R.id.environment) | |||
Spinner environment; | |||
@@ -156,6 +159,7 @@ public class SystemSystemsetFragment extends BaseFragment { | |||
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
HuoLi.setAdapter(adapter2); | |||
HuoLi.setSelection(ConfigName.getInstance().HeatingGearL.get(ConfigName.getInstance().HuoLi)); | |||
edittext103.setText(UpdateDataService.key); | |||
bpa_systemsets = QueryDB.GetSystemsetALL(); | |||
for (BPA_SYSTEMSET item : bpa_systemsets) { | |||
@@ -172,6 +176,11 @@ public class SystemSystemsetFragment extends BaseFragment { | |||
ConfigName.getInstance().DeviceHao = Integer.parseInt(item.value); | |||
edittext102.setText(item.value); | |||
break; | |||
case -203: | |||
ConfigName.getInstance().Key = item.value;; | |||
UpdateDataService.key = item.value; | |||
edittext103.setText(item.value); | |||
break; | |||
case -100: | |||
ConfigName.getInstance().versionSelectionEnum = item.value; | |||
versionselection.setSelection(material_map_vis.get(item.value)==null?0:material_map_vis.get(item.value)); | |||
@@ -250,6 +259,8 @@ public class SystemSystemsetFragment extends BaseFragment { | |||
ConfigName.getInstance().MainAddress = edittext100.getText().toString(); | |||
ConfigName.getInstance().MainPost = Integer.parseInt(edittext101.getText().toString()); | |||
ConfigName.getInstance().DeviceHao = Integer.parseInt(edittext102.getText().toString()); | |||
ConfigName.getInstance().Key = edittext103.getText().toString(); | |||
UpdateDataService.key = edittext103.getText().toString(); | |||
ConfigName.getInstance().ClientAutoKey = edittext3.getText().toString(); | |||
ConfigName.getInstance().DeviceAutoKey = edittext4.getText().toString(); | |||
@@ -311,6 +322,13 @@ public class SystemSystemsetFragment extends BaseFragment { | |||
set_main3.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set_main3); | |||
BPA_SYSTEMSET set_main4 = new BPA_SYSTEMSET(); | |||
set_main4.type = -203; | |||
set_main4.value =edittext103.getText().toString(); | |||
set_main4.deviceID = ConfigName.getInstance().DeviceId; | |||
set_main4.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set_main4); | |||
if (isgb) { | |||
ConfigData.getInstance().RevertPLCProcess(); | |||
} | |||
@@ -122,6 +122,11 @@ public class CloudGoodsFragment extends BaseFragment { | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast!"); | |||
return; | |||
} | |||
if(viewModel.cloudGoodsList.getValue()==null || viewModel.cloudGoodsList.getValue().getGoodsClassifyList()==null | |||
||viewModel.cloudGoodsList.getValue().getGoodsInfoList()==null){ | |||
NewToastUtil.getInstance().showToast("没有数据!","Not data!"); | |||
return; | |||
} | |||
AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "数据同步", "下载云端所有菜品到本地,拥有相同的分类将会被覆盖,请确认?","Data Synchronize","Download all dishes from the cloud to the local, with the same classification will be covered, please confirm?", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
@@ -194,7 +199,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
private void dealClassifyData(){ | |||
classifyList.clear(); | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
if(viewModel.cloudGoodsList.getValue()!=null && viewModel.cloudGoodsList.getValue().getGoodsClassifyList()!=null){ | |||
for (GoodsClassifyBean bean : Objects.requireNonNull(viewModel.cloudGoodsList.getValue().getGoodsClassifyList())){ | |||
BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY(); | |||
goodsClassify.id = bean.getGoodsClassifyId(); | |||
@@ -212,7 +217,8 @@ public class CloudGoodsFragment extends BaseFragment { | |||
if(!classifyList.isEmpty()){ | |||
String classifyID = classifyList.get(position).id; | |||
LogUtils.d("dealGoodsData classifyID="+classifyID+";classifyList.size="+classifyList.size()); | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
if(viewModel.cloudGoodsList.getValue()!=null && viewModel.cloudGoodsList.getValue().getGoodsClassifyList()!=null | |||
&& viewModel.cloudGoodsList.getValue().getGoodsInfoList()!=null){ | |||
for (GoodsClassifyBean bean : viewModel.cloudGoodsList.getValue().getGoodsClassifyList()){ | |||
if(classifyID.equals(bean.getGoodsClassifyId())){ | |||
bean.getGoodsList().forEach(classifyGoods -> { | |||
@@ -18,6 +18,7 @@ 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_MATERIAL_TYPE; | |||
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; | |||
@@ -36,7 +37,9 @@ 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.MaterialModelType; | |||
import com.bonait.bnframework.common.model.MaterialRequestPar; | |||
import com.bonait.bnframework.common.model.MaterialTypeData; | |||
import com.bonait.bnframework.common.thread.ThreadManager; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ProcessValueUtil; | |||
@@ -58,8 +61,8 @@ import java.util.Map; | |||
* @date: 2024/5/14 9:33. | |||
*/ | |||
public class HomeGoodsViewModel extends ViewModel { | |||
// public static String Path = "https://cfv.black-pa.com"; | |||
public static String Path = "https://192.168.1.50:5006"; | |||
public static String Path = "https://cfv.black-pa.com/kitchbase"; | |||
// public static String Path = "http://192.168.1.50:5007"; | |||
public MutableLiveData<GoodsData> cloudGoodsList = new MutableLiveData<>(); | |||
public boolean hasData = false; | |||
@@ -69,6 +72,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
ThreadManager.get().execute(new Thread(()->{ | |||
GetGoodsInfo(); | |||
GetMaterialInfo(); | |||
GetMaterialType(); | |||
if(!UpdateDataService.isDownProcessModel){ | |||
UpdateDataService.downLoadProcessModel(null,null); | |||
} | |||
@@ -97,7 +101,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
public void GetGoodsInfo(){ | |||
String url = Path+"/kitchbase/api/goods/Getdevicegoods?deviceId="+ConfigName.getInstance().DeviceAutoKey; | |||
String url = Path+"/api/goods/Getdevicegoods?deviceId="+ConfigName.getInstance().DeviceAutoKey; | |||
LogUtils.d("GetGoodsInfo url="+url); | |||
RecordManager.getInstance().addLogRecord("数据接收", "请求商品信息-"+url); | |||
APIHelper.PostT(url,null,null,new TypeReference<APIResultT<GoodsData>>(){}).OnSource(s->{ | |||
@@ -118,7 +122,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
public static void GetMaterialInfo(){ | |||
String url = Path+"/saasbase/api/ExternalPlatform/Material/GetMaterialPageList"; | |||
String url = UpdateDataService.path+"/api/ExternalPlatform/Material/GetMaterialPageList";//saasbase | |||
LogUtils.d("GetMaterialInfo url="+url); | |||
String key =UpdateDataService.key; | |||
RecordManager.getInstance().addLogRecord("数据接收", "接收物料信息-"+url); | |||
@@ -128,6 +132,17 @@ public class HomeGoodsViewModel extends ViewModel { | |||
}); | |||
} | |||
public static void GetMaterialType(){ | |||
String url = UpdateDataService.path+"/api/ExternalPlatform/Material/GetMaterialTypePageList";//saasbase | |||
LogUtils.d("GetMaterialInfo url="+url); | |||
String key =UpdateDataService.key; | |||
RecordManager.getInstance().addLogRecord("数据接收", "接收物料信息-"+url); | |||
APIHelper.PostT(url,new MaterialRequestPar(1,100),key,new TypeReference<APIResultT<MaterialTypeData>>(){}).OnSource(s->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", "接收物料信息成功"); | |||
UpdateLocalMaterialType(s.Content); | |||
}); | |||
} | |||
private static void UpdateLocalMaterial(MaterialData materialModels){ | |||
LogUtils.d("UpdateLocalMaterial materialModels="+materialModels.toString()); | |||
List<BPA_MATERIAL> datas = new ArrayList<>(); | |||
@@ -165,6 +180,37 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
EventBus.getDefault().post(new FreshSystemSeason()); | |||
} | |||
private static void UpdateLocalMaterialType(MaterialTypeData materialModels){ | |||
LogUtils.d("UpdateLocalMaterial materialModels="+materialModels.toString()); | |||
List<BPA_MATERIAL_TYPE> datas = new ArrayList<>(); | |||
ArrayList<BPA_MATERIAL_TYPE> materials = MaterialUtil.GetMaterialTypeALL(); | |||
for(int i = 0;i<materialModels.data.size();i++){ | |||
if(materialModels.data.get(i).name!=null){ | |||
boolean isExit = false; | |||
for(BPA_MATERIAL_TYPE bean : materials){ | |||
if(bean.id.equals(materialModels.data.get(i).id)){ | |||
isExit = true; | |||
}else { | |||
if (bean.name.equals(materialModels.data.get(i).name)) { | |||
QueryDB.DeleteMaterialType(bean);//删除相同名称的物料名 | |||
} | |||
} | |||
} | |||
if(!isExit){ | |||
BPA_MATERIAL_TYPE bpa_material =new BPA_MATERIAL_TYPE(); | |||
bpa_material.name = materialModels.data.get(i).name; | |||
bpa_material.id = materialModels.data.get(i).id; | |||
datas.add(bpa_material); | |||
} | |||
} | |||
} | |||
LogUtils.d("UpdateLocalMaterial datas="+datas); | |||
if(!datas.isEmpty()){ | |||
MaterialUtil.addMaterialTypeList(BPA_MATERIAL_TYPE.class,datas); | |||
NewToastUtil.getInstance().showToast("已同步云端物料信息","Material information in the cloud has been synchronized!"); | |||
} | |||
EventBus.getDefault().post(new FreshSystemSeason()); | |||
} | |||
/** | |||
@@ -1,6 +1,7 @@ | |||
package com.bonait.bnframework.ui.viewmodel; | |||
import android.content.Context; | |||
import android.os.Environment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.MainApplication; | |||
@@ -12,6 +13,7 @@ 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_MATERIAL_TYPE; | |||
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; | |||
@@ -103,7 +105,7 @@ public class UpdateAllDataService { | |||
*/ | |||
private static void downLoadProcessModel(List<BPA_GOODS> goods, Context context){ | |||
try{ | |||
String url = "http://"+path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
String url = path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
if(context!=null){ | |||
WaitProcessUtil.getInstance().Show("正在同步云端工艺模型...","Synchronizing cloud process models..."); | |||
} | |||
@@ -211,7 +213,7 @@ public class UpdateAllDataService { | |||
for(UpResData upResData:response.body().data){ | |||
if (upResData.code>30000){ | |||
isSuccess = false; | |||
names.append(upResData.name); | |||
names.append("[").append(upResData.name).append("]"); | |||
errorMsg=upResData.message; | |||
} | |||
} | |||
@@ -259,10 +261,11 @@ public class UpdateAllDataService { | |||
List<BPA_MATERIAL> materials = MaterialUtil.GetMaterialALL(); | |||
List<MaterialDataInfo> upMaterialBean = new ArrayList<>(); | |||
BPA_MATERIAL_TYPE materialType = MaterialUtil.GetMaterialTypeByName("液体料"); | |||
for(BPA_MATERIAL material:materials){ | |||
upMaterialBean.add(new MaterialDataInfo(material.id,material.name,"液体料","7b2aced3-db2a-469c-9b08-b85e3f3f1aa8")); | |||
upMaterialBean.add(new MaterialDataInfo(material.id,material.name,"液体料",materialType.id)); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Material/AddMaterial"; | |||
String url = path+"/api/ExternalPlatform/Material/AddMaterial"; | |||
Post(url,context,upMaterialBean,"物料信息",(response->{ | |||
Analysis(context,response,"物料信息",url).OnSource(()->{ | |||
upLoadClassifyInfo(goods,context); | |||
@@ -297,7 +300,7 @@ public class UpdateAllDataService { | |||
upClassifyBean.goodsList.add(bean); | |||
}); | |||
upClassifyBeans.add(upClassifyBean); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsClassify"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsClassify"; | |||
Post(url,context,upClassifyBeans,"商品分类信息",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品分类成功"); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
@@ -330,7 +333,7 @@ public class UpdateAllDataService { | |||
upClassifyBeans.add(upClassifyBean); | |||
} | |||
}); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
Post(url,context,upClassifyBeans,"属性分类信息",(response->{ | |||
Analysis(context,response,"属性分类信息",url).OnSource(()->{ | |||
upLoadAttribute(upClassifyBeans,goods,context); | |||
@@ -363,7 +366,7 @@ public class UpdateAllDataService { | |||
upAttributeBeans.add(upAttributeBean); | |||
}); | |||
}); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsAttribute"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsAttribute"; | |||
Post(url,context,upAttributeBeans,"分类属性信息",(response->{ | |||
Analysis(context,response,"分类属性信息",url).OnSource(()->{ | |||
upLoadGoodsInfo(goods,context); | |||
@@ -383,10 +386,15 @@ public class UpdateAllDataService { | |||
for(BPA_GOODS good : goods){ | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(good.propClassifyId); | |||
if(classify!=null){ | |||
upMaterialBean.add(new GoodsDataInfo(good.id,good.name,"",good.url,"0",false,good.propClassifyId,classify.name)); | |||
String imgUrl = ""; | |||
if(good.url!=null){ | |||
String path = Environment.getExternalStorageDirectory().getAbsolutePath()+ ConfigName.dataPath+"/WebImage/"; | |||
imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+good.url.replace(path,""); | |||
} | |||
upMaterialBean.add(new GoodsDataInfo(good.id,good.name,"",imgUrl,"0",false,good.propClassifyId,classify.name)); | |||
} | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
Post(url,context,upMaterialBean,"商品基础信息",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品基础信息成功"); | |||
NewToastUtil.getInstance().showToast("上传商品基础信息成功"); | |||
@@ -485,7 +493,7 @@ public class UpdateAllDataService { | |||
goodsProcessDetail.technologyActionList = technologyActionLists; | |||
goodsProcessDetailList.add(goodsProcessDetail); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsTechnologyAction"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsTechnologyAction"; | |||
Post(url,context,goodsProcessDetailList,"商品工艺",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功"); | |||
NewToastUtil.getInstance().showToast("上传商品工艺成功"); | |||
@@ -1,6 +1,7 @@ | |||
package com.bonait.bnframework.ui.viewmodel; | |||
import android.content.Context; | |||
import android.os.Environment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.MainApplication; | |||
@@ -11,6 +12,7 @@ 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_MATERIAL_TYPE; | |||
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; | |||
@@ -66,9 +68,9 @@ import okhttp3.RequestBody; | |||
* @date: 2024/7/25 14:55. | |||
*/ | |||
public class UpdateDataService { | |||
// public static String path = "cfv.black-pa.com"; | |||
public static String path = "192.168.1.50:5006"; | |||
public static String key = "b3ceddba-4cc0-4730-be5c-847f770ca287"; | |||
public static String path = "https://cfv.black-pa.com/saasbase"; | |||
// public static String path = "http://192.168.1.50:5006"; | |||
public static String key = ConfigName.getInstance().Key; | |||
public static boolean isDownProcessModel = false;//是否同步了云端工艺模型 | |||
public static void startUpLoad(BPA_GOODS good, Context context){ | |||
@@ -100,7 +102,7 @@ public class UpdateDataService { | |||
*/ | |||
public static void downLoadProcessModel(String id, Context context){ | |||
try{ | |||
String url = "http://"+path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
String url = path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
if(context!=null){ | |||
WaitProcessUtil.getInstance().Show("正在同步云端工艺模型...","Synchronizing cloud process models..."); | |||
} | |||
@@ -272,10 +274,11 @@ public class UpdateDataService { | |||
if(upMaterialBean==null){ | |||
upMaterialBean = new ArrayList<>(); | |||
} | |||
BPA_MATERIAL_TYPE materialType = MaterialUtil.GetMaterialTypeByName("液体料"); | |||
for(BPA_MATERIAL material:materials){ | |||
upMaterialBean.add(new MaterialDataInfo(material.id,material.name,"液体料","7b2aced3-db2a-469c-9b08-b85e3f3f1aa8")); | |||
upMaterialBean.add(new MaterialDataInfo(material.id,material.name,"液体料",materialType.id)); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Material/AddMaterial"; | |||
String url = path+"/api/ExternalPlatform/Material/AddMaterial"; | |||
Post(url,context,upMaterialBean,"物料信息",(response->{ | |||
Analysis(context,response,"物料信息",url).OnSource(()->{ | |||
upLoadClassifyInfo(goodsId,context); | |||
@@ -306,7 +309,7 @@ public class UpdateDataService { | |||
upClassifyBean.sort = 0; | |||
upClassifyBean.remark = ""; | |||
upClassifyBeans.add(upClassifyBean); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
Post(url,context,upClassifyBeans,"属性分类信息",(response->{ | |||
Analysis(context,response,"属性分类信息",url).OnSource(()->{ | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(classify.id); | |||
@@ -348,7 +351,7 @@ public class UpdateDataService { | |||
upClassifyBean.goodsList.add(bean); | |||
upClassifyBeans.add(upClassifyBean); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsClassify"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsClassify"; | |||
Post(url,context,upClassifyBeans,"商品分类信息",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品分类成功"); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
@@ -391,7 +394,7 @@ public class UpdateDataService { | |||
upAttributeBeans.add(upAttributeBean); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsAttribute"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsAttribute"; | |||
Post(url,context,upAttributeBeans,"分类属性信息",(response->{ | |||
Analysis(context,response,"分类属性信息",url).OnSource(()->{ | |||
upLoadGoodsInfo(goodsId,context); | |||
@@ -418,10 +421,15 @@ public class UpdateDataService { | |||
List<GoodsDataInfo> upMaterialBean = new ArrayList<>(); | |||
upMaterialBean.add(new GoodsDataInfo(goods.id,goods.name,"",goods.url,"0",false,goods.propClassifyId, | |||
String imgUrl = ""; | |||
if(goods.url!=null){ | |||
String path = Environment.getExternalStorageDirectory().getAbsolutePath()+ ConfigName.dataPath+"/WebImage/"; | |||
imgUrl = "https://bpa.oss-cn-chengdu.aliyuncs.com/hkerp/test/goods//"+goods.url.replace(path,""); | |||
} | |||
upMaterialBean.add(new GoodsDataInfo(goods.id,goods.name,"",imgUrl,"0",false,goods.propClassifyId, | |||
classify.name)); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
Post(url,context,upMaterialBean,"商品基础信息",(response->{ | |||
Analysis(context,response,"商品基础信息",url).OnSource(()->{ | |||
@@ -532,7 +540,7 @@ public class UpdateDataService { | |||
goodsProcessDetail.technologyActionList = technologyActionLists; | |||
goodsProcessDetailList.add(goodsProcessDetail); | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsTechnologyAction"; | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsTechnologyAction"; | |||
Post(url,context,goodsProcessDetailList,"商品工艺",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功"); | |||
@@ -255,10 +255,36 @@ | |||
android:layout_height="24dp" | |||
android:layout_centerVertical="true" /> | |||
</TableRow> | |||
</TableLayout> | |||
</RelativeLayout> | |||
<TableRow | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center" | |||
android:layout_margin="5dp"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="right" | |||
android:text="平台授权码:" /> | |||
<EditText | |||
android:id="@+id/edittext_key" | |||
android:layout_width="400dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="5dp" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入授权码" | |||
android:inputType="number" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp" | |||
android:text=""/> | |||
</TableRow> | |||
<RelativeLayout | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginLeft="@dimen/dp_40" | |||
@@ -165,7 +165,7 @@ | |||
android:layout_width="@dimen/dp_250" | |||
android:layout_height="match_parent" | |||
android:background="@drawable/input_bj" | |||
android:hint="5号位" | |||
android:hint="@string/text_bit_5" | |||
android:inputType="text" | |||
android:lines="1" | |||
android:padding="@dimen/dp_3" | |||
@@ -1,5 +1,5 @@ | |||
<resources> | |||
<string name="app_name">菠萝小炒-新</string> | |||
<string name="app_name">BoLuoXiaoChao-new</string> | |||
<string name="file_normal">常用文件</string> | |||
<string name="file_all">全部文件</string> | |||
<string name="empty_data">没有数据</string> | |||
@@ -121,6 +121,7 @@ | |||
<string name="text_bit_2">2 Bit</string> | |||
<string name="text_bit_3">3 Bit</string> | |||
<string name="text_bit_4">4 Bit</string> | |||
<string name="text_bit_5">5 Bit</string> | |||
<string name="text_savereturn">Save&return</string> | |||
<string name="btn_tolead">To Lead</string> | |||
<string name="text_step">Cook Step</string> | |||
@@ -121,6 +121,7 @@ | |||
<string name="text_bit_2">2号位</string> | |||
<string name="text_bit_3">3号位</string> | |||
<string name="text_bit_4">4号位</string> | |||
<string name="text_bit_5">5号位</string> | |||
<string name="text_savereturn">保存并返回</string> | |||
<string name="btn_tolead">导入工序</string> | |||
<string name="text_step">步骤</string> | |||