Browse Source

23

tags/old_version_1
fyf 1 year ago
parent
commit
84ba4f8df4
17 changed files with 524 additions and 273 deletions
  1. +382
    -253
      app/src/main/java/com/bonait/bnframework/business/ConfigData.java
  2. +4
    -1
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  3. +2
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/MessageName.java
  4. +3
    -2
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  5. +4
    -4
      app/src/main/java/com/bonait/bnframework/common/model/mode/ActionJsonMode.java
  6. +16
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/BPA_GoodsAttributeValue.java
  7. +31
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/BPA_GoodsTechnologyAction.java
  8. +5
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/CloudGood.java
  9. +7
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/GoodBomInfo.java
  10. +5
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java
  11. +4
    -1
      app/src/main/java/com/bonait/bnframework/common/model/mode/ResGoodProcess.java
  12. +4
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/UpdateCloudGood.java
  13. +24
    -3
      app/src/main/java/com/bonait/bnframework/common/view/GoodEditDialog.java
  14. +2
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/adapter/good_adapter.java
  15. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java
  16. +9
    -7
      app/src/main/res/layout/fragment_home_sbkz.xml
  17. +21
    -0
      app/src/main/res/layout/item/layout/dialog_edit.xml

+ 382
- 253
app/src/main/java/com/bonait/bnframework/business/ConfigData.java View File

@@ -33,6 +33,8 @@ import com.bonait.bnframework.common.modbus.ModbusTcpHelper;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.model.ResAPI;
import com.bonait.bnframework.common.model.mode.ActionJsonMode;
import com.bonait.bnframework.common.model.mode.BPA_GoodsAttributeValue;
import com.bonait.bnframework.common.model.mode.BPA_GoodsTechnologyAction;
import com.bonait.bnframework.common.model.mode.BomTechnologyActionInfo;
import com.bonait.bnframework.common.model.mode.BomTypeInfo;
import com.bonait.bnframework.common.model.mode.ProcessT;
@@ -284,6 +286,8 @@ public class ConfigData {
ConfigName.getInstance().cloudData.goodsUintInfo = new Json<GoodsUintInfo>().jsonToListobject(GoodsUintInfo.class, item.text);
} else if (item.name.equals("配方分类")) {
ConfigName.getInstance().cloudData.bomTypeInfo = new Json<BomTypeInfo>().jsonToListobject(BomTypeInfo.class, item.text);
} else if (item.name.equals("商品属性")) {
ConfigName.getInstance().cloudData.goodsAttributeValue = new Json<BomTypeInfo>().jsonToListobject(BPA_GoodsAttributeValue.class, item.text);
}
}
}
@@ -300,27 +304,27 @@ public class ConfigData {
OkGo.<ResAPI<OrganizeMode>>get(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetStore + ConfigName.getInstance().ClientAutoKey)
.tag(context)
.execute(new JsonDialogCallback<ResAPI<OrganizeMode>>(context) {
@Override
public void onSuccess(Response<ResAPI<OrganizeMode>> response) {
ResAPI<OrganizeMode> organize = response.body();
if (organize.isSuccess) {
ConfigName.getInstance().organizeMode = organize.data;
OkGo.<ResAPI<DeviceInformation>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetDeviceInformation, ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceAutoKey)).tag(context).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<DeviceInformation>>(context) {
@Override
public void onSuccess(Response<ResAPI<DeviceInformation>> response) {
ResAPI<DeviceInformation> deviceInformation = response.body();
if (deviceInformation.succeeded) {
ConfigName.getInstance().deviceInformation = deviceInformation.data;
if (ConfigName.getInstance().deviceInformation != null) {
ConfigName.getInstance().DeviceId = ConfigName.getInstance().deviceInformation.id;
MessageManager.getInstance().sendMessage(MessageName.GetOrganize, "GetOrganize");
@Override
public void onSuccess(Response<ResAPI<OrganizeMode>> response) {
ResAPI<OrganizeMode> organize = response.body();
if (organize.isSuccess) {
ConfigName.getInstance().organizeMode = organize.data;
OkGo.<ResAPI<DeviceInformation>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetDeviceInformation, ConfigName.getInstance().organizeMode.id, ConfigName.getInstance().DeviceAutoKey)).tag(context).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<DeviceInformation>>(context) {
@Override
public void onSuccess(Response<ResAPI<DeviceInformation>> response) {
ResAPI<DeviceInformation> deviceInformation = response.body();
if (deviceInformation.succeeded) {
ConfigName.getInstance().deviceInformation = deviceInformation.data;
if (ConfigName.getInstance().deviceInformation != null) {
ConfigName.getInstance().DeviceId = ConfigName.getInstance().deviceInformation.id;
MessageManager.getInstance().sendMessage(MessageName.GetOrganize, "GetOrganize");
}
}
}
}
});
}
});
}
}
});
}
});
} else {
ToastUtils.warning("无网络,请先连接网络!!!");
}
@@ -479,6 +483,14 @@ public class ConfigData {
QueryDB.AddClouddata(data);
}

if (allDataResAPI.data.goodsAttributeValue != null) {
data = new BPA_CLOUDDATA();
data.id = java.util.UUID.randomUUID().toString();
data.name = "商品属性";
data.text = new Gson().toJson(allDataResAPI.data.goodsAttributeValue);
QueryDB.AddClouddata(data);
}

Message msg = new Message();
msg.obj = "MSG_REFRESH";
mHandler.sendMessage(msg);
@@ -507,8 +519,7 @@ public class ConfigData {
ResAPI<List<CloudGood>> allDataResAPI = response.body();
if (allDataResAPI.succeeded && allDataResAPI.data != null && allDataResAPI.data.size() > 0) {
ConfigName.getInstance().cloudGoods = allDataResAPI.data;
if(mHandler!=null)
{
if (mHandler != null) {
Message msg = new Message();
msg.obj = "MSG_REFRESH";
mHandler.sendMessage(msg);
@@ -526,7 +537,7 @@ public class ConfigData {
*
* @param context
*/
public void GetGoodProcess(Context context, String goodid,Boolean isSX) {
public void GetGoodProcess(Context context, String goodid, Boolean isSX) {
Boolean IsXZ = QueryDB.GetGoodsIDIs(goodid);
if (IsXZ) {
ToastUtils.warning("请勿重复下载,本地商品已存在!!!");
@@ -537,7 +548,7 @@ public class ConfigData {
if (ConfigName.getInstance().organizeMode == null) {
return;
}
OkGo.<ResAPI<ResGoodProcess>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoodsBom, goodid)).tag(context).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<ResGoodProcess>>(context) {
OkGo.<ResAPI<ResGoodProcess>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoodsBom, goodid, ConfigName.getInstance().DeviceId)).tag(context).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<ResGoodProcess>>(context) {
@Override
public void onSuccess(Response<ResAPI<ResGoodProcess>> response) {
ResAPI<ResGoodProcess> allDataResAPI = response.body();
@@ -562,61 +573,122 @@ public class ConfigData {
good.issc = 0;
good.url = cloudGood.goods_ImgUrl;
good.exp = "云端商品";
good.gyid=allDataResAPI.data.bomInfo.get(0).id;
good.gyid="";
if(allDataResAPI.data.bomInfo!=null && allDataResAPI.data.bomInfo.size()>0)
{
good.gyid =allDataResAPI.data.bomInfo.get(0).id;
}
QueryDB.AddGoods(good);
//2.增加配方
if (allDataResAPI.data.bomTechnologyActionInfo != null && allDataResAPI.data.bomTechnologyActionInfo.size() > 0) {
List<BomTechnologyActionInfo> bayc = allDataResAPI.data.bomTechnologyActionInfo;
Collections.sort(bayc, new Comparator<BomTechnologyActionInfo>() {
// if (allDataResAPI.data.bomTechnologyActionInfo != null && allDataResAPI.data.bomTechnologyActionInfo.size() > 0) {
// List<BomTechnologyActionInfo> bayc = allDataResAPI.data.bomTechnologyActionInfo;
// Collections.sort(bayc, new Comparator<BomTechnologyActionInfo>() {
// @Override
// public int compare(BomTechnologyActionInfo o1, BomTechnologyActionInfo o2) {
//
// return Double.valueOf(o1.sort).compareTo(Double.valueOf(o2.sort));
// }
// });
// for (BomTechnologyActionInfo k : allDataResAPI.data.bomTechnologyActionInfo) {
// BPA_GOODSRECIPE item = new BPA_GOODSRECIPE();
// item.goodsID = good.id;
// item.sort = k.sort;
// if(k.stepName.contains("液体料"))
// {
// item.processname="液体料";
// }else if(k.stepName.contains("搅拌"))
// {
// item.processname="搅拌";
// }else if(k.stepName.contains("位置"))
// {
// item.processname="位置";
// }else if(k.stepName.contains("加热"))
// {
// item.processname="加热";
// }else if(k.stepName.contains("主料"))
// {
// item.processname="主料";
// }else if(k.stepName.contains("延迟"))
// {
// item.processname="延迟";
// }else if(k.stepName.contains("出菜"))
// {
// item.processname="出菜";
// }else
// {
// item.processname = k.stepName;
// }
//
// if (!k.actionJson.isEmpty()) {
// String data = "";
// String desc = "";
// boolean iswl = false;
// List<ActionJsonMode> gyActions = new Json<List<ActionJsonMode>>().jsonToListobject(ActionJsonMode.class, ((String) k.actionJson));
// for (ActionJsonMode m : gyActions) {
// if(m.ActionName!=null && m.ActionValue!="")
// {
// data += m.ActionName + "," + m.ActionValue + "|";
// desc += m.ActionValue + ",";
// if (!m.BatchingId.isEmpty()) {
// iswl = true;
// }
// }
// }
// if (data.contains("|")) {
// item.processvalue = data.substring(0, data.length() - 1);
// }
// if (desc.contains(",")) {
// item.processms = item.processname + "(" + desc.substring(0, desc.length() - 1) + ")";
// }
// item.materialType = iswl ? 0 : 1;
// }
// QueryDB.AddGoodsSrecipe(item);
// }
// }

if (allDataResAPI.data.goodsTechnologyActionInfo != null && allDataResAPI.data.goodsTechnologyActionInfo.size() > 0) {
List<BPA_GoodsTechnologyAction> bayc = allDataResAPI.data.goodsTechnologyActionInfo;
Collections.sort(bayc, new Comparator<BPA_GoodsTechnologyAction>() {
@Override
public int compare(BomTechnologyActionInfo o1, BomTechnologyActionInfo o2) {
public int compare(BPA_GoodsTechnologyAction o1, BPA_GoodsTechnologyAction o2) {

return Double.valueOf(o1.sort).compareTo(Double.valueOf(o2.sort));
}
});
for (BomTechnologyActionInfo k : allDataResAPI.data.bomTechnologyActionInfo) {
for (BPA_GoodsTechnologyAction k : allDataResAPI.data.goodsTechnologyActionInfo) {
BPA_GOODSRECIPE item = new BPA_GOODSRECIPE();
item.goodsID = good.id;
item.sort = k.sort;
if(k.stepName.contains("液体料"))
{
item.processname="液体料";
}else if(k.stepName.contains("搅拌"))
{
item.processname="搅拌";
}else if(k.stepName.contains("位置"))
{
item.processname="位置";
}else if(k.stepName.contains("加热"))
{
item.processname="加热";
}else if(k.stepName.contains("主料"))
{
item.processname="主料";
}else if(k.stepName.contains("延迟"))
{
item.processname="延迟";
}else if(k.stepName.contains("出菜"))
{
item.processname="出菜";
}else
{
if (k.stepName.contains("液体料")) {
item.processname = "液体料";
} else if (k.stepName.contains("搅拌")) {
item.processname = "搅拌";
} else if (k.stepName.contains("位置")) {
item.processname = "位置";
} else if (k.stepName.contains("加热")) {
item.processname = "加热";
} else if (k.stepName.contains("主料")) {
item.processname = "主料";
} else if (k.stepName.contains("延迟")) {
item.processname = "延迟";
} else if (k.stepName.contains("出菜")) {
item.processname = "出菜";
} else {
item.processname = k.stepName;
}

if (!k.actionJson.isEmpty()) {
String data = "";
String desc = "";
boolean iswl = false;
//boolean iswl = false;
List<ActionJsonMode> gyActions = new Json<List<ActionJsonMode>>().jsonToListobject(ActionJsonMode.class, ((String) k.actionJson));
for (ActionJsonMode m : gyActions) {
if(m.ActionName!=null && m.ActionValue!="")
{
data += m.ActionName + "," + m.ActionValue + "|";
desc += m.ActionValue + ",";
if (!m.BatchingId.isEmpty()) {
iswl = true;
}
if (m.actionName != null && m.actionValue != "") {
data += m.actionName + "," + m.actionValue + "|";
desc += m.actionValue + ",";
// if (!m.batchingId.isEmpty()) {
// iswl = true;
// }
}
}
if (data.contains("|")) {
@@ -625,15 +697,14 @@ public class ConfigData {
if (desc.contains(",")) {
item.processms = item.processname + "(" + desc.substring(0, desc.length() - 1) + ")";
}
item.materialType = iswl ? 0 : 1;
item.materialType =k.isBatch ? 1 : 0;
}
QueryDB.AddGoodsSrecipe(item);
}
}
ToastUtils.info("下载菜品成功!!!");

if(isSX)
{
if (isSX) {
MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
}
}
@@ -659,209 +730,265 @@ public class ConfigData {
ToastUtils.warning("无组织信息不能上传,请设置当前店铺信息!!!");
return;
}
final GoodEditDialog editDialog = new GoodEditDialog(context);
editDialog.setTitle("上传菜谱界面");
editDialog.setYesOnclickListener("确定", new GoodEditDialog.onYesOnclickListener() {
@Override
public void onYesClick(String sp, String dl, String xl, String dw, String fl) {

Boolean isSuceess = false;
BPA_GOODS good = QueryDB.GetGoodsId(goodid);
try
{
final Boolean[] boom = {false};
OssHelper.getInstance().OnCharge=new IRunT() {
@Override
public void Run(Object o) {
ResAPI<String> resAPI=(ResAPI<String>)o;
if(resAPI.succeeded)
BPA_GOODS good = QueryDB.GetGoodsId(goodid);//ConfigName.getInstance().SaasAddress
OkGo.<ResAPI<List<CloudGood>>>get(String.format(ConfigName.getInstance().SaasAddress + ConfigName.getInstance().GetGoodIsCloud, good.name))
.tag(context)
.tag(context).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId))
.execute(new JsonDialogCallback<ResAPI<List<CloudGood>>>(context) {
@Override
public void onSuccess(Response<ResAPI<List<CloudGood>>> response) {
ResAPI<List<CloudGood>> organize = response.body();
//商品配方
if (organize.data.isEmpty()) {

} else {
CloudGood good_p= organize.data.get(0);
if(!good.id.equals(good_p.id)) //如果商品id 不一致 需要删除商品并且新建商品
{
good.url=resAPI.data;
QueryDB.UpdateGoods(good);
QueryDB.DeleteGoods(good);

ArrayList<BPA_GOODSRECIPE> goodsrecipes1 = QueryDB.GetGoodsSrecipeID(good.id);
for (BPA_GOODSRECIPE k:goodsrecipes1)
{
QueryDB.DeleteGoodsSrecipe(k);
k.goodsID=good_p.id;
QueryDB.AddGoodsSrecipe(k);
}

good.id =good_p.id;
QueryDB.AddGoods(good);
}
boom[0] =true;
}
};
OssHelper.getInstance().UpdataFile(context,good.url);
while (!boom[0])
{
Thread.sleep(100);
}
}catch (Exception ex)
{

}
UpdateCloudGood update = new UpdateCloudGood();
try {
update.storeId = ConfigName.getInstance().organizeMode.id;
update.deviceId = ConfigName.getInstance().DeviceId;
update.userId=ConfigName.getInstance().user.name;
update.goodsInfo = new CloudGood();
update.bomTechnologyActionInfo = new ArrayList<BomTechnologyActionInfo>();
update.goodsInfo.id = good.id;
update.goodsInfo.createAt = good.createTime;
update.goodsInfo.isDeleted = 0;
update.goodsInfo.status = 0;
update.goodsInfo.groupId = ConfigName.getInstance().organizeMode.companyId;
update.goodsInfo.autoKey = 0;
update.goodsInfo.isWeigh = false;
update.goodsInfo.vipPrice = 0;
update.goodsInfo.price = 0;
update.goodsInfo.code = good.id;
update.goodsInfo.goods_Sort = good.sort;
update.goodsInfo.goods_Descritption = "设备上传商品";
update.goodsInfo.goods_Name = good.name;

//选择菜谱 大类id 小类id 单位id
update.foodMenuId = sp;
update.goodsInfo.goods_ImgUrl = good.url;//图片地址
update.goodsInfo.parentTypeID = dl;//大类
update.goodsInfo.goods_TypeID = xl;//小类
update.goodsInfo.goodsUintId = dw;//单位

String id=good.gyid;
if(good.gyid==null)
{
id=java.util.UUID.randomUUID().toString();
QueryDB.UpdateGoodsGY(good.id,id);
}
UpdateBomInfo bom = new UpdateBomInfo();
bom.id=id;
bom.bomType = fl;
bom.name = good.name;
bom.code = java.util.UUID.randomUUID().toString();
bom.isMain = true;
bom.sort = 0;
update.bomInfo = bom;

ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
for (BPA_GOODSRECIPE item : goodsrecipes) {
GoodsTechnology goodsTechnology = null;
for (GoodsTechnology _find : ConfigName.getInstance().cloudData.goodsTechnology) {
if (_find.name.equals(item.processname)) {
goodsTechnology = _find;
break;
//创建商品bom清单
if(good.gyid == null && good_p.goodsBomInfo!=null && good_p.goodsBomInfo.size()>0)
{
good.gyid =good_p.goodsBomInfo.get(0).bomId;
QueryDB.UpdateGoodsGY(good.id, good.gyid);
}
}

if (goodsTechnology != null) {
//2.根据工序变量集合-获取变量名称和值
List<String> names = new ArrayList<>();
final HashMap<String, String> formulation = new HashMap<>();
//region 获取变量名称和值
String text = item.processvalue;
List<String> data = new ArrayList<>();
if (text.contains("|")) {
String[] res = text.split("[|]");
for (int i = 0; i < res.length; i++) {
data.add(res[i]);
}
} else {
data.add(text);
}
for (String item1 : data) {
if (!item1.isEmpty() && item1.contains(",")) {
String[] wl = item1.split("[,]");
if (wl != null && wl.length == 2) {
String name = wl[0];
String val = wl[1];
names.add(name);
formulation.put(name, val);
}
}
}
//endregion

List<ActionJsonMode> actionJsonModes = new ArrayList<>();
//region 获取工艺集合
if (item.materialType == 0)//物料
{
for (String f : names) {
BatchingInfo batchingInfo = null;
for (BatchingInfo _find : ConfigName.getInstance().cloudData.batchingInfo) {
if (_find.batching_Name.equals(f)) {
batchingInfo = _find;
break;
final GoodEditDialog editDialog = new GoodEditDialog(context);
editDialog.setTitle("上传菜谱界面");
editDialog.setYesOnclickListener("确定", new GoodEditDialog.onYesOnclickListener() {
@Override
public void onYesClick(String sp, String dl, String xl, String dw, String fl, String sxid) {

Boolean isSuceess = false;
try {
final Boolean[] boom = {false};
OssHelper.getInstance().OnCharge = new IRunT() {
@Override
public void Run(Object o) {
ResAPI<String> resAPI = (ResAPI<String>) o;
if (resAPI.succeeded) {
good.url = resAPI.data;
QueryDB.UpdateGoods(good);
}
boom[0] = true;
}
};
if(good.url!=null)
{
OssHelper.getInstance().UpdataFile(context, good.url);
while (!boom[0]) {
Thread.sleep(100);
}
}
ActionJsonMode m = new ActionJsonMode();
m.TechnologyactionId = "";//模型id
m.BatchingId = batchingInfo != null ? batchingInfo.id : "";//物料id
m.ActionName = f;
m.ActionValue = formulation.get(f);
actionJsonModes.add(m);
} catch (Exception ex) {

}
} else//模型
{
for (String f : names) {
TechnologyAction technologyAction = null;
for (TechnologyAction _find : ConfigName.getInstance().cloudData.technologyAction) {
if (_find.actionName.equals(f) && _find.goodstechnologyId.equals(goodsTechnology.id)) {
technologyAction = _find;
break;
UpdateCloudGood update = new UpdateCloudGood();
try {
update.storeId = ConfigName.getInstance().organizeMode.id;
update.deviceId = ConfigName.getInstance().DeviceId;
update.userId = ConfigName.getInstance().user.name;
update.goodsInfo = new CloudGood();
update.bomTechnologyActionInfo = new ArrayList<BomTechnologyActionInfo>();
update.goodsTechnologyActionInfo = new ArrayList<BPA_GoodsTechnologyAction>();

update.goodsInfo.id = good.id;
update.goodsInfo.createAt = good.createTime;
update.goodsInfo.isDeleted = 0;
update.goodsInfo.status = 0;
update.goodsInfo.groupId = ConfigName.getInstance().organizeMode.companyId;
update.goodsInfo.autoKey = 0;
update.goodsInfo.isWeigh = false;
update.goodsInfo.vipPrice = 0;
update.goodsInfo.price = 0;
update.goodsInfo.code = good.id;
update.goodsInfo.goods_Sort = good.sort;
update.goodsInfo.goods_Descritption = "设备上传商品";
update.goodsInfo.goods_Name = good.name;

//选择菜谱 大类id 小类id 单位id
update.foodMenuId = sp;
update.goodsInfo.goods_ImgUrl = good.url;//图片地址
update.goodsInfo.parentTypeID = dl;//大类
update.goodsInfo.goods_TypeID = xl;//小类
update.goodsInfo.goodsUintId = dw;//单位

String id = good.gyid;
if (good.gyid == null) {
id = java.util.UUID.randomUUID().toString();
QueryDB.UpdateGoodsGY(good.id, id);
}
UpdateBomInfo bom = new UpdateBomInfo();
bom.id = id;
bom.bomType = fl;
bom.name = good.name;
bom.code = java.util.UUID.randomUUID().toString();
bom.isMain = true;
bom.sort = 0;
update.bomInfo = bom;

ArrayList<BPA_GOODSRECIPE> goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
for (BPA_GOODSRECIPE item : goodsrecipes) {
GoodsTechnology goodsTechnology = null;
for (GoodsTechnology _find : ConfigName.getInstance().cloudData.goodsTechnology) {
if (_find.name.equals(item.processname)) {
goodsTechnology = _find;
break;
}
}

if (goodsTechnology != null) {
//2.根据工序变量集合-获取变量名称和值
List<String> names = new ArrayList<>();
final HashMap<String, String> formulation = new HashMap<>();
//region 获取变量名称和值
String text = item.processvalue;
List<String> data = new ArrayList<>();
if (text.contains("|")) {
String[] res = text.split("[|]");
for (int i = 0; i < res.length; i++) {
data.add(res[i]);
}
} else {
data.add(text);
}
for (String item1 : data) {
if (!item1.isEmpty() && item1.contains(",")) {
String[] wl = item1.split("[,]");
if (wl != null && wl.length == 2) {
String name = wl[0];
String val = wl[1];
names.add(name);
formulation.put(name, val);
}
}
}
//endregion

List<ActionJsonMode> actionJsonModes = new ArrayList<>();
//region 获取工艺集合
if (item.materialType == 0)//物料
{
for (String f : names) {
BatchingInfo batchingInfo = null;
for (BatchingInfo _find : ConfigName.getInstance().cloudData.batchingInfo) {
if (_find.batching_Name.equals(f)) {
batchingInfo = _find;
break;
}
}
ActionJsonMode m = new ActionJsonMode();
m.technologyactionId = batchingInfo != null ? batchingInfo.id :"";//模型id
m.batchingId = "";//物料id
m.actionName = f;
m.actionValue = formulation.get(f);
actionJsonModes.add(m);
}
} else//模型
{
for (String f : names) {
TechnologyAction technologyAction = null;
for (TechnologyAction _find : ConfigName.getInstance().cloudData.technologyAction) {
if (_find.actionName.equals(f) && _find.goodstechnologyId.equals(goodsTechnology.id)) {
technologyAction = _find;
break;
}
}
ActionJsonMode m = new ActionJsonMode();
m.technologyactionId = technologyAction != null ? technologyAction.id : "";//模型id
m.batchingId = "";//物料id
m.actionName = f;
m.actionValue = formulation.get(f);
actionJsonModes.add(m);
}
}
//endregion

// BomTechnologyActionInfo info = new BomTechnologyActionInfo();
// info.stepName = item.processname;
// info.actionJson = new Gson().toJson(actionJsonModes);
// info.isBatch = (item.materialType == 0 ? true : false);
// info.chnologyId = goodsTechnology.id;//工艺名称id
// info.createAt = item.createTime;
// info.groupId = ConfigName.getInstance().organizeMode.companyId;
// info.id = item.id;
// info.isDeleted = 0;
// info.sort = item.sort;
// info.bomId=bom.id;
// update.bomTechnologyActionInfo.add(info);

BPA_GoodsTechnologyAction info2 = new BPA_GoodsTechnologyAction();
info2.stepName = item.processname;
info2.actionJson = new Gson().toJson(actionJsonModes);
info2.isBatch = (item.materialType == 0 ? false:true);
info2.chnologyId = goodsTechnology.id;//工艺名称id
info2.createAt = item.createTime;
info2.groupId = ConfigName.getInstance().organizeMode.companyId;
info2.id = item.id;
info2.isDeleted = 0;
info2.sort = item.sort;
info2.goodsId = good.id;
info2.deviceId = ConfigName.getInstance().DeviceId;
info2.goodsAttributeId = sxid;
update.goodsTechnologyActionInfo.add(info2);
}
}
ActionJsonMode m = new ActionJsonMode();
m.TechnologyactionId = technologyAction != null ? technologyAction.id : "";//模型id
m.BatchingId = "";//物料id
m.ActionName = f;
m.ActionValue = formulation.get(f);
actionJsonModes.add(m);
isSuceess = true;
} catch (Exception ex) {
isSuceess = true;
ToastUtils.info("上传菜品异常:" + ex.getMessage());
}
}
//endregion

BomTechnologyActionInfo info = new BomTechnologyActionInfo();
info.stepName = item.processname;
info.actionJson = new Gson().toJson(actionJsonModes);
info.isBatch = (item.materialType == 0 ? true : false);
info.chnologyId = goodsTechnology.id;//工艺名称id
info.createAt = item.createTime;
info.groupId = ConfigName.getInstance().organizeMode.companyId;
info.id = item.id;
info.isDeleted = 0;
info.sort = item.sort;
info.bomId=bom.id;
update.bomTechnologyActionInfo.add(info);
}
}
isSuceess = true;
} catch (Exception ex) {
isSuceess = true;
ToastUtils.info("上传菜品异常:" + ex.getMessage());
}


if (isSuceess) {
try {
String str=ConfigName.getInstance().SaasAddress + ConfigName.getInstance().UpdateGoods;
//String str="http://192.168.1.64:5001/api/CommInteface/SendGoodsInfo";
OkGo.<ResAPI<Boolean>>post(str).tag(context).upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(update))).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<Boolean>>(context) {
@Override
public void onSuccess(Response<ResAPI<Boolean>> response) {
ResAPI<Boolean> allDataResAPI = response.body();
if (allDataResAPI.succeeded) {
ToastUtils.info("上传菜品成功!!!");
MessageManager.getInstance().sendMessage(MessageName.ScGood, "GoodUpdate");
editDialog.dismiss();
} else {
ToastUtils.warning("上传菜品失败!!!");
if (isSuceess) {
try {
String str = ConfigName.getInstance().SaasAddress + ConfigName.getInstance().UpdateGoods;
// String str="http://192.168.1.7:5000/api/CommInteface/SendGoodsInfo";
OkGo.<ResAPI<Boolean>>post(str).tag(context).upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(update))).headers(new HttpHeaders("TenantId", ConfigName.getInstance().organizeMode.companyId)).execute(new JsonDialogCallback<ResAPI<Boolean>>(context) {
@Override
public void onSuccess(Response<ResAPI<Boolean>> response) {
ResAPI<Boolean> allDataResAPI = response.body();
if (allDataResAPI.succeeded) {
ToastUtils.info("上传菜品成功!!!");
MessageManager.getInstance().sendMessage(MessageName.ScGood, "GoodUpdate");
editDialog.dismiss();
} else {
ToastUtils.warning("上传菜品失败!!!");
}
}
});
} catch (Exception ex) {
ToastUtils.info("上传菜品异常:" + ex.getMessage());
}
}
}
});
} catch (Exception ex) {
ToastUtils.info("上传菜品异常:" + ex.getMessage());
editDialog.setNoOnclickListener("取消", new GoodEditDialog.onNoOnclickListener() {
@Override
public void onNoClick() {
editDialog.dismiss();
}
});
editDialog.show();
}
}
}
});
editDialog.setNoOnclickListener("取消", new GoodEditDialog.onNoOnclickListener() {
@Override
public void onNoClick() {
editDialog.dismiss();
}
});
editDialog.show();
});


} else {
ToastUtils.warning("无网络,请先连接网络!!!");
}
@@ -875,7 +1002,7 @@ public class ConfigData {
public void AddImage(Context context) {
BitmapFactory.Options options = new BitmapFactory.Options();
//options.inSampleSize = 2;//宽高压缩为原来的1/2
options.inPreferredConfig=Bitmap.Config.RGB_565;
options.inPreferredConfig = Bitmap.Config.RGB_565;

Bitmap bitmap1 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image1, options);
Bitmap bitmap2 = BitmapFactory.decodeResource(context.getResources(), R.mipmap.image2, options);
@@ -905,14 +1032,13 @@ public class ConfigData {
List<Res_PLCADDRESS> plcaddresses = ConfigName.getInstance().PlcAddress_大炒;
List<ProcessT> processTS = ConfigName.getInstance().Process_大炒;

if(ConfigName.getInstance().versionSelectionEnum.equals("大炒版本"))
{
if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) {
plcaddresses = ConfigName.getInstance().PlcAddress_大炒;
processTS = ConfigName.getInstance().Process_大炒;
} else if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本")) {
plcaddresses = ConfigName.getInstance().PlcAddress_大炒自动投料;
processTS = ConfigName.getInstance().Process_大炒自动投料;
}else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) {
} else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) {
plcaddresses = ConfigName.getInstance().PlcAddress_小炒;
processTS = ConfigName.getInstance().Process_小炒;
}
@@ -958,7 +1084,7 @@ public class ConfigData {
processModel.processid = process.id;
processModel.name = item;
processModel.sort = chidindex;
processModel.data=ConfigName.getInstance().GetProcessTypeVal(item);
processModel.data = ConfigName.getInstance().GetProcessTypeVal(item);
processModel.datatype = ((item.equals("主料名称") ? 1 : (processModel.data.isEmpty() ? 0 : 2)));
QueryDB.AddProcessModel(processModel);
chidindex++;
@@ -974,6 +1100,7 @@ public class ConfigData {
//endregion

//region PLC初始化

/**
* 连接PLC
*/
@@ -989,13 +1116,15 @@ public class ConfigData {
}
}).start();
}

/**
* 关闭PLC
*/
public void ColsePLC() {
ModbusTcpHelper.get().release();//释放modbus
ConfigName.getInstance().PlcIsConnect=false;
ConfigName.getInstance().PlcIsConnect = false;
}

/**
* PLC初始化完成时,需要注册的服务
*/


+ 4
- 1
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -214,9 +214,12 @@ public class ConfigName {
//获取 商品
public String GetGoods = "kitchen/api/CommInteface/GetDeviceGood?storeId=%s&deviceId=%s";
//获取商品配方信息
public String GetGoodsBom = "kitchen/api/CommInteface/GetDeviceGoodBomTechnology?goodsId=%s";
public String GetGoodsBom = "kitchen/api/CommInteface/GetDeviceGoodBomTechnology?goodsId=%s&deviceId=%s";
//上传商品
public String UpdateGoods = "kitchen/api/CommInteface/SendGoodsInfo";
//获取商品信息
public String GetGoodIsCloud = "kitchen/api/CommInteface/GetGoodsInfo?goodsName=%s";

//版本更新
public String UpdateVersion = "http://111.9.47.105:18097/api/Version/GetLatest";
//endregion


+ 2
- 0
app/src/main/java/com/bonait/bnframework/common/constant/MessageName.java View File

@@ -27,4 +27,6 @@ public interface MessageName {


String OpenMakeGoodFrom="OpenMakeGoodFrom";//打开制作界面

String GoodIsCunZai="GoodIsCunZai";
}

+ 3
- 2
app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java View File

@@ -690,8 +690,9 @@ public class QueryDB {
Update(BPA_GOODS.class, goods);
}
}

/**
* 修改是否收藏
* 修改商品Bomid
*
* @param id
* @param gyid
@@ -723,7 +724,7 @@ public class QueryDB {
* @return
*/
public static ArrayList<BPA_GOODS> GetGoodsALL() {
String orderby = Desc_Time_Up;//先按排序 创建时间倒序
String orderby = Desc_Sort_Up;//先按排序 创建时间倒序
String where = "isDelete=?";
String[] args = new String[]{"0"};
ArrayList<BPA_GOODS> data = new ArrayList<>();


+ 4
- 4
app/src/main/java/com/bonait/bnframework/common/model/mode/ActionJsonMode.java View File

@@ -1,8 +1,8 @@
package com.bonait.bnframework.common.model.mode;

public class ActionJsonMode {
public String TechnologyactionId ;//工艺id
public String ActionName ;//名称
public String ActionValue ;//变量
public String BatchingId ;//物料id
public String technologyactionId ;//工艺id
public String actionName ;//名称
public String actionValue ;//变量
public String batchingId ;//物料id
}

+ 16
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/BPA_GoodsAttributeValue.java View File

@@ -0,0 +1,16 @@
package com.bonait.bnframework.common.model.mode;

public class BPA_GoodsAttributeValue {
public String id;
/// <summary>
///商品属性id
/// </summary>
public String goodsAttributeId;
/// <summary>
/// 属性值
/// </summary>
public String attributeValue;
public int sort;
public String waiKey;
public String groupId;
}

+ 31
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/BPA_GoodsTechnologyAction.java View File

@@ -0,0 +1,31 @@
package com.bonait.bnframework.common.model.mode;

public class BPA_GoodsTechnologyAction {
public String id;
/// <summary>
/// 步骤名称
/// </summary>
public String stepName;
/// <summary>
/// 动作json
/// </summary>
public String actionJson;
/// <summary>
/// 商品属性id集合
/// </summary>
public String goodsAttributeId;
/// <summary>
/// 是否物料
/// </summary>
public boolean isBatch;
/// <summary>
/// 动作value
/// </summary>
public String chnologyId;
public String createAt;
public String groupId;//加盟商id
public int isDeleted;
public int sort;
public String goodsId;
public String deviceId;
}

+ 5
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/CloudGood.java View File

@@ -1,5 +1,7 @@
package com.bonait.bnframework.common.model.mode;

import java.util.List;

/**
* 云端商品
*/
@@ -23,4 +25,7 @@ public class CloudGood {
public int isDeleted;//0
public String createAt;
public String id;

//商品boom
public List<GoodBomInfo> goodsBomInfo;
}

+ 7
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/GoodBomInfo.java View File

@@ -0,0 +1,7 @@
package com.bonait.bnframework.common.model.mode;

public class GoodBomInfo {
public String id ;
public String goods_Id ;
public String bomId ;
}

+ 5
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/ResALLData.java View File

@@ -39,4 +39,9 @@ public class ResALLData {
* 配方分类
*/
public List<BomTypeInfo> bomTypeInfo;

/**
* 商品属性
*/
public List<BPA_GoodsAttributeValue> goodsAttributeValue;
}

+ 4
- 1
app/src/main/java/com/bonait/bnframework/common/model/mode/ResGoodProcess.java View File

@@ -11,5 +11,8 @@ public class ResGoodProcess {
* 商品配方
*/
public List<BomTechnologyActionInfo> bomTechnologyActionInfo;

/**
* 新商品配方
*/
public List<BPA_GoodsTechnologyAction> goodsTechnologyActionInfo;
}

+ 4
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/UpdateCloudGood.java View File

@@ -18,6 +18,10 @@ public class UpdateCloudGood {
*/
public List<BomTechnologyActionInfo> bomTechnologyActionInfo;

/**
* 商品工艺(新版本版本)
*/
public List<BPA_GoodsTechnologyAction> goodsTechnologyActionInfo;
/**
* 菜谱
*/


+ 24
- 3
app/src/main/java/com/bonait/bnframework/common/view/GoodEditDialog.java View File

@@ -14,6 +14,7 @@ import android.widget.TextView;

import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.model.mode.BPA_GoodsAttributeValue;
import com.bonait.bnframework.common.model.mode.BomTypeInfo;
import com.bonait.bnframework.common.model.mode.FoodMenuInfo;
import com.bonait.bnframework.common.model.mode.GoodsParentTypeInfo;
@@ -33,6 +34,9 @@ public class GoodEditDialog extends Dialog {
private Spinner editsp_xl;//小类
private Spinner editsp_dw;//单位
private Spinner editsp_fl;//分类

private Spinner editsp_spsx;//商品属性

private String titleStr;//从外界设置的title文本
private String messageStr;//从外界设置的消息文本
//确定文本和取消文本的显示内容
@@ -104,7 +108,7 @@ public class GoodEditDialog extends Dialog {
,map_xl.get(editsp_xl.getSelectedItem().toString())
,map_dw.get(editsp_dw.getSelectedItem().toString())
,map_fl.get(editsp_fl.getSelectedItem().toString())
);
,map_sx.get(editsp_spsx.getSelectedItem().toString()));
}
}
}
@@ -141,7 +145,7 @@ public class GoodEditDialog extends Dialog {
Map<String,String> map_xl = new LinkedHashMap<>();
Map<String,String> map_dw = new LinkedHashMap<>();
Map<String,String> map_fl = new LinkedHashMap<>();
Map<String,String> map_sx = new LinkedHashMap<>();
/**
* 初始化界面控件
*/
@@ -154,6 +158,7 @@ public class GoodEditDialog extends Dialog {
editsp_xl = (Spinner) findViewById(R.id.editsp_xl);
editsp_dw = (Spinner) findViewById(R.id.editsp_dw);
editsp_fl = (Spinner) findViewById(R.id.editsp_fl);
editsp_spsx= (Spinner) findViewById(R.id.editsp_spsx);
for (FoodMenuInfo item:ConfigName.getInstance().cloudData.foodMenuInfo)
{
map_cp.put(item.name,item.id);
@@ -174,11 +179,17 @@ public class GoodEditDialog extends Dialog {
{
map_fl.put(item.name,item.id);
}

for (BPA_GoodsAttributeValue item:ConfigName.getInstance().cloudData.goodsAttributeValue)
{
map_sx.put(item.attributeValue,item.id);
}
SetAdapter(editsp_cp,map_cp);
SetAdapter(editsp_dl,map_dl);
SetAdapter(editsp_xl,map_xl);
SetAdapter(editsp_dw,map_dw);
SetAdapter(editsp_fl,map_fl);
SetAdapter(editsp_spsx,map_sx);
}

/**
@@ -210,6 +221,16 @@ public class GoodEditDialog extends Dialog {
ToastUtils.info("单位必须选择!");
return false;
}
if(editsp_fl.getSelectedItem().toString().isEmpty())
{
ToastUtils.info("配方分类必须选择!");
return false;
}
if(editsp_spsx.getSelectedItem().toString().isEmpty())
{
ToastUtils.info("商品属性必须选择!");
return false;
}
return true;
}catch (Exception ex)
{
@@ -247,7 +268,7 @@ public class GoodEditDialog extends Dialog {
* 设置确定按钮和取消被点击的接口
*/
public interface onYesOnclickListener {
public void onYesClick(String sp,String dl,String xl,String dw,String fl);
public void onYesClick(String sp,String dl,String xl,String dw,String fl,String sx);
}

public interface onNoOnclickListener {


+ 2
- 1
app/src/main/java/com/bonait/bnframework/modules/home/adapter/good_adapter.java View File

@@ -103,7 +103,8 @@ public class good_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
myViewHolder.tvTag.setText(name);
myViewHolder.tvNote.setText("时间:" + mode.getNote() + "秒");
//设置图片
if (!url.equals("未知")) {
if(url!=null && !url.isEmpty() &&!url.equals("未知"))
{
myBitmapUtils.disPlay(myViewHolder.ImageUrl, url);
}
//上传按钮点击


+ 1
- 1
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java View File

@@ -103,7 +103,7 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter {
tvTag.setText(name);
tvNote.setText("时间:"+ ((SectionItem)section.getItemAt(itemIndex)).getNote()+"秒");
//设置图片
if(!url.equals("未知"))
if(url!=null && !url.isEmpty() &&!url.equals("未知"))
{
myBitmapUtils.disPlay(ImageUrl,url);
}


+ 9
- 7
app/src/main/res/layout/fragment_home_sbkz.xml View File

@@ -48,11 +48,13 @@
android:layout_weight="4">

<ImageView
android:layout_margin="@dimen/dp_10"
android:id="@+id/device_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/device1" />
android:src="@mipmap/device1"
android:antialias="true"/>

<!-- 温度 -->
<LinearLayout
@@ -71,7 +73,7 @@
android:shadowDy="15.0"
android:shadowRadius="7.0"
android:text="39°C"
android:textColor="#d60522"
android:textColor="#770B1A"
android:textSize="60dp"
android:textStyle="bold" />

@@ -83,7 +85,7 @@
android:shadowDy="10.0"
android:shadowRadius="3.0"
android:text="锅底温度"
android:textColor="#d60522"
android:textColor="#770B1A"
android:textSize="26dp" />
</LinearLayout>

@@ -126,7 +128,7 @@
android:id="@+id/touliao_k"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginLeft="18dp"
android:layout_marginTop="205dp"
android:orientation="horizontal">

@@ -168,7 +170,7 @@
android:id="@+id/touliao_m"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginLeft="18dp"
android:layout_marginTop="240dp"
android:orientation="horizontal">

@@ -249,8 +251,8 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="40dp"
android:layout_marginBottom="70dp"
android:layout_marginRight="45dp"
android:layout_marginBottom="75dp"
android:orientation="vertical">

<com.bonait.bnframework.modules.home.fragment.mode.imagebuttom3


+ 21
- 0
app/src/main/res/layout/item/layout/dialog_edit.xml View File

@@ -128,6 +128,27 @@
android:layout_centerVertical="true"/>
</LinearLayout>

<LinearLayout
android:layout_gravity="center"
android:layout_marginBottom="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="商品属性"
android:textColor="@color/black"
android:layout_marginRight="@dimen/dp_10"/>
<Spinner
android:id="@+id/editsp_spsx"
style="@style/commonSpinnerStyle"
android:layout_width="140dp"
android:layout_height="24dp"
android:paddingLeft="@dimen/dp_10"
android:layout_centerVertical="true"/>
</LinearLayout>

<View
android:layout_width="match_parent"
android:layout_height="1px"


Loading…
Cancel
Save