@@ -53,6 +53,7 @@ | |||
android:screenOrientation="portrait" | |||
android:launchMode="singleTask" | |||
android:exported="false" /> | |||
<activity | |||
android:name=".ui.activity.RecProcessActivity" | |||
android:screenOrientation="portrait" | |||
@@ -160,6 +161,10 @@ | |||
android:exported="true" | |||
android:screenOrientation="landscape" | |||
android:launchMode="singleTask"/> | |||
<activity android:name=".newui.activity.EditClassifyTabActivity" | |||
android:exported="true" | |||
android:screenOrientation="landscape" | |||
android:launchMode="singleTask"/> | |||
<activity android:name=".newui.activity.LogRecordHActivity" | |||
android:exported="true" | |||
android:screenOrientation="landscape" | |||
@@ -560,34 +560,54 @@ public class APIHelper { | |||
}).start(); | |||
} | |||
public static void get(String urlAdd,Map<String,String> params,IRunT<String> callback) { | |||
new Thread(()->{ | |||
try { | |||
String ResponseAdd = BuildUrlWithParams(urlAdd,params);//请求地址和参数 | |||
URL url = new URL(ResponseAdd); | |||
HttpURLConnection Connection = (HttpURLConnection) url.openConnection(); | |||
Connection.setRequestMethod("GET"); | |||
Connection.setConnectTimeout(3000); | |||
Connection.setReadTimeout(3000); | |||
int responseCode = Connection.getResponseCode(); | |||
if (responseCode == Connection.HTTP_OK) { | |||
InputStream inputStream = Connection.getInputStream(); | |||
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream(); | |||
byte[] bytes = new byte[1024]; | |||
int length = 0; | |||
while ((length = inputStream.read(bytes)) != -1) { | |||
arrayOutputStream.write(bytes, 0, length); | |||
arrayOutputStream.flush();//强制释放缓冲区 | |||
} | |||
String s = arrayOutputStream.toString(); | |||
if(callback!=null)callback.Run(s); | |||
} else { | |||
MessageLog.ShowError("get 请求失败"); | |||
public static <T> OperateResultT<T> get(String urlAdd,Map<String,String> params, TypeReference<APIResultT<T>> defaultValue) { | |||
HttpURLConnection connection = null; | |||
InputStream inputStream = null; | |||
BufferedReader reader = null; | |||
StringBuffer buffer = new StringBuffer(); | |||
try { | |||
String ResponseAdd = BuildUrlWithParams(urlAdd,params);//请求地址和参数 | |||
URL url = new URL(ResponseAdd); | |||
HttpURLConnection Connection = (HttpURLConnection) url.openConnection(); | |||
Connection.setRequestMethod("GET"); | |||
Connection.setConnectTimeout(5000); | |||
Connection.setReadTimeout(5000); | |||
// 获取响应结果 | |||
int statusCode = Connection.getResponseCode(); | |||
if (statusCode == HttpURLConnection.HTTP_OK) { | |||
inputStream = Connection.getInputStream(); | |||
reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); | |||
String line; | |||
while ((line = reader.readLine()) != null) { | |||
buffer.append(line); | |||
} | |||
} catch (Exception e) { | |||
MessageLog.ShowError(e); | |||
} else { | |||
return OperateResultT.CreateFailedT("服务器返回错误,状态码:" + statusCode); | |||
} | |||
}).start(); | |||
} catch (Exception e){ | |||
return OperateResultT.CreateFailedT("POST 请求异常:"+e.toString()); | |||
}finally { | |||
try{ | |||
// 关闭连接和流 | |||
if (reader != null) reader.close(); | |||
if (inputStream != null) inputStream.close(); | |||
if (connection != null) connection.disconnect(); | |||
}catch(Exception e){ | |||
return OperateResultT.CreateFailedT("POST 请求异常:"+e.toString()); | |||
} | |||
} | |||
try{ | |||
APIResultT<T> res = JSON.parseObject(buffer.toString(),defaultValue); | |||
if(res!=null && res.succeeded.toUpperCase().equals("TRUE")){ | |||
return OperateResultT.CreateSuccess(res.data); | |||
}else { | |||
return OperateResultT.CreateFailedT("内容解析失败"); | |||
} | |||
}catch(Exception e){ | |||
return OperateResultT.CreateFailedT("GET请求返回值解析异常,"+e.toString()); | |||
} | |||
} | |||
/** | |||
@@ -1,5 +1,6 @@ | |||
package com.bonait.bnframework.Model; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
@@ -8,136 +9,14 @@ import java.util.List; | |||
* @date: 2024/5/9 11:19. | |||
*/ | |||
public class GoodsClassifyBean { | |||
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,124 +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 void setGoodsId(String goodsId) { | |||
this.goodsId = goodsId; | |||
} | |||
public String getGoodsClassifyId() { | |||
return goodsClassifyId; | |||
} | |||
public String getDeviceId() { | |||
return deviceId; | |||
} | |||
public void setGoodsClassifyId(String goodsClassifyId) { | |||
this.goodsClassifyId = goodsClassifyId; | |||
} | |||
public void setDeviceId(String deviceId) { | |||
this.deviceId = deviceId; | |||
} | |||
public String getGoodsClassifyName() { | |||
return goodsClassifyName; | |||
} | |||
public String getWarehousrTemplateId() { | |||
return warehousrTemplateId; | |||
} | |||
public void setGoodsClassifyName(String goodsClassifyName) { | |||
this.goodsClassifyName = goodsClassifyName; | |||
} | |||
public void setWarehousrTemplateId(String warehousrTemplateId) { | |||
this.warehousrTemplateId = warehousrTemplateId; | |||
} | |||
} | |||
public List<GoodsList> getGoodsList() { | |||
return goodsList; | |||
} | |||
@Override | |||
public String toString() { | |||
return "GoodsClassifyBean{" + | |||
"goodsTypeId='" + goodsTypeId + '\'' + | |||
", goodsTypeName='" + goodsTypeName + '\'' + | |||
", goodsAttributeList=" + goodsAttributeList + | |||
", goodsInfoList=" + goodsInfoList + | |||
'}'; | |||
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,268 @@ | |||
package com.bonait.bnframework.Model; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: 菜谱分类云端数据 | |||
* @date: 2024/5/9 11:19. | |||
*/ | |||
public class GoodsInfoBean { | |||
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 String getGoodsId() { | |||
return goodsId; | |||
} | |||
public void setGoodsId(String goodsId) { | |||
this.goodsId = goodsId; | |||
} | |||
public String getGoodsName() { | |||
return goodsName; | |||
} | |||
public void setGoodsName(String goodsName) { | |||
this.goodsName = goodsName; | |||
} | |||
public List<GoodsTechnologyActionListBean> getGoodsTechnologyActionList() { | |||
return goodsTechnologyActionList; | |||
} | |||
public void setGoodsTechnologyActionList(List<GoodsTechnologyActionListBean> goodsTechnologyActionList) { | |||
this.goodsTechnologyActionList = goodsTechnologyActionList; | |||
} | |||
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 void setGoodsId(String goodsId) { | |||
this.goodsId = goodsId; | |||
} | |||
public String getDeviceId() { | |||
return deviceId; | |||
} | |||
public void setDeviceId(String deviceId) { | |||
this.deviceId = deviceId; | |||
} | |||
public String getWarehousrTemplateId() { | |||
return warehousrTemplateId; | |||
} | |||
public void setWarehousrTemplateId(String warehousrTemplateId) { | |||
this.warehousrTemplateId = warehousrTemplateId; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
package com.bonait.bnframework.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.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 + | |||
'}'; | |||
} | |||
} |
@@ -31,7 +31,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<>(); | |||
@@ -14,15 +14,14 @@ public class GoodsDataInfo implements Serializable { | |||
private String name; | |||
private String descritption; | |||
private String imgUrl; | |||
private int price; | |||
private String price; | |||
private boolean isWeigh; | |||
private String goodsTypeId; | |||
private String goodsTypeName; | |||
private String goodsUintId; | |||
private String goodsUintName; | |||
public GoodsDataInfo(String id, String name, String descritption, String imgUrl, int price, boolean isWeigh, | |||
String goodsTypeId, String goodsTypeName, String goodsUintId, String goodsUintName) { | |||
public GoodsDataInfo(String id, String name, String descritption, String imgUrl, String price, boolean isWeigh, | |||
String goodsTypeId, String goodsTypeName) { | |||
this.id = id; | |||
this.name = name; | |||
this.descritption = descritption; | |||
@@ -31,8 +30,7 @@ public class GoodsDataInfo implements Serializable { | |||
this.isWeigh = isWeigh; | |||
this.goodsTypeId = goodsTypeId; | |||
this.goodsTypeName = goodsTypeName; | |||
this.goodsUintId = goodsUintId; | |||
this.goodsUintName = goodsUintName; | |||
} | |||
public String getId() { | |||
@@ -67,11 +65,11 @@ public class GoodsDataInfo implements Serializable { | |||
this.imgUrl = imgUrl; | |||
} | |||
public int getPrice() { | |||
public String getPrice() { | |||
return price; | |||
} | |||
public void setPrice(int price) { | |||
public void setPrice(String price) { | |||
this.price = price; | |||
} | |||
@@ -99,19 +97,4 @@ public class GoodsDataInfo implements Serializable { | |||
this.goodsTypeName = goodsTypeName; | |||
} | |||
public String getGoodsUintId() { | |||
return goodsUintId; | |||
} | |||
public void setGoodsUintId(String goodsUintId) { | |||
this.goodsUintId = goodsUintId; | |||
} | |||
public String getGoodsUintName() { | |||
return goodsUintName; | |||
} | |||
public void setGoodsUintName(String goodsUintName) { | |||
this.goodsUintName = goodsUintName; | |||
} | |||
} |
@@ -11,22 +11,61 @@ import java.util.List; | |||
public class GoodsProcessDetail implements Serializable { | |||
public String goodsId; | |||
public String goodsName; | |||
public String deviceId; | |||
public String warehousrTemplateId; | |||
public String deviceName; | |||
public String warehousrTemplateId;//设备仓位id | |||
public String warehousrTemplateName;//设备仓位名称 | |||
public List<TechnologyActionList> technologyActionList; | |||
@Override | |||
public String toString() { | |||
return "GoodsProcessDetail{" + | |||
"goodsId='" + goodsId + '\'' + | |||
", goodsName='" + goodsName + '\'' + | |||
", deviceId='" + deviceId + '\'' + | |||
", deviceName='" + deviceName + '\'' + | |||
", warehousrTemplateId='" + warehousrTemplateId + '\'' + | |||
", warehousrTemplateName='" + warehousrTemplateName + '\'' + | |||
", technologyActionList=" + technologyActionList + | |||
'}'; | |||
} | |||
public static class TechnologyActionList implements Serializable { | |||
public String id; | |||
public String stepName; | |||
public List<ActionJson> actionJson; | |||
public String goodsAttributeId; | |||
public String chnologyId; | |||
public String sort; | |||
@Override | |||
public String toString() { | |||
return "TechnologyActionList{" + | |||
"stepName='" + stepName + '\'' + | |||
", actionJson=" + actionJson + | |||
", goodsAttributeId='" + goodsAttributeId + '\'' + | |||
", chnologyId='" + chnologyId + '\'' + | |||
", sort='" + sort + '\'' + | |||
'}'; | |||
} | |||
public static class ActionJson implements Serializable { | |||
public String actionName; | |||
public String actionValue; | |||
public String technologyactionId; | |||
public int index; | |||
@Override | |||
public String toString() { | |||
return "ActionJson{" + | |||
"actionName='" + actionName + '\'' + | |||
", actionValue='" + actionValue + '\'' + | |||
", technologyactionId='" + technologyactionId + '\'' + | |||
", index=" + index + | |||
'}'; | |||
} | |||
public ActionJson(String actionName, String actionValue, String technologyactionId, int index) { | |||
this.actionName = actionName; | |||
this.actionValue = actionValue; | |||
@@ -6,47 +6,18 @@ package com.bonait.bnframework.Model.upload; | |||
* @date: 2024/7/25 15:55. | |||
*/ | |||
public class MaterialDataInfo { | |||
private String id; | |||
private String name; | |||
private String typeName; | |||
private String uintName; | |||
public String id; | |||
public String name; | |||
public String typeId; | |||
public String typeName; | |||
public MaterialDataInfo(String id,String name,String typeName,String uintName){ | |||
public MaterialDataInfo(String id,String name,String typeName,String typeId){ | |||
this.id = id; | |||
this.name = name; | |||
this.typeName = typeName; | |||
this.uintName = uintName; | |||
this.typeId = typeId; | |||
} | |||
public String getId() { | |||
return id; | |||
} | |||
public void setId(String id) { | |||
this.id = id; | |||
} | |||
public String getName() { | |||
return name; | |||
} | |||
public void setName(String name) { | |||
this.name = name; | |||
} | |||
public String getTypeName() { | |||
return typeName; | |||
} | |||
public void setTypeName(String typeName) { | |||
this.typeName = typeName; | |||
} | |||
public String getUintName() { | |||
return uintName; | |||
} | |||
public void setUintName(String uintName) { | |||
this.uintName = uintName; | |||
} | |||
} |
@@ -11,9 +11,12 @@ import java.util.List; | |||
*/ | |||
public class UpAttributeBean implements Serializable { | |||
public String goodsTypeId; | |||
public String attributeName; | |||
public String goodsTypeName; | |||
public List<GoodsAttributeValueBean> goodsAttributeValue = new ArrayList<>(); | |||
public String id; | |||
public int sort; | |||
public List<GoodsAttributeValueBean> goodsAttributeValueList = new ArrayList<>(); | |||
public String getAttributeName() { | |||
return attributeName; | |||
@@ -31,19 +34,34 @@ public class UpAttributeBean implements Serializable { | |||
this.goodsTypeName = goodsTypeName; | |||
} | |||
public List<GoodsAttributeValueBean> getGoodsAttributeValue() { | |||
return goodsAttributeValue; | |||
} | |||
public void setGoodsAttributeValue(List<GoodsAttributeValueBean> goodsAttributeValue) { | |||
this.goodsAttributeValue = goodsAttributeValue; | |||
@Override | |||
public String toString() { | |||
return "UpAttributeBean{" + | |||
"goodsTypeId='" + goodsTypeId + '\'' + | |||
", attributeName='" + attributeName + '\'' + | |||
", goodsTypeName='" + goodsTypeName + '\'' + | |||
", id='" + id + '\'' + | |||
", sort=" + sort + | |||
", goodsAttributeValueList=" + goodsAttributeValueList + | |||
'}'; | |||
} | |||
public static class GoodsAttributeValueBean implements Serializable { | |||
private String attributeValue; | |||
private int sort; | |||
public String id; | |||
public String attributeValue; | |||
public int sort; | |||
@Override | |||
public String toString() { | |||
return "GoodsAttributeValueBean{" + | |||
"id='" + id + '\'' + | |||
", attributeValue='" + attributeValue + '\'' + | |||
", sort=" + sort + | |||
'}'; | |||
} | |||
public GoodsAttributeValueBean(String attributeValue, int sort) { | |||
public GoodsAttributeValueBean(String id, String attributeValue, int sort) { | |||
this.id=id; | |||
this.attributeValue = attributeValue; | |||
this.sort = sort; | |||
} | |||
@@ -11,6 +11,27 @@ public class UpClassifyBean implements Serializable { | |||
public String pid; | |||
public String name; | |||
public int sort; | |||
public String id; | |||
public String remark; | |||
@Override | |||
public String toString() { | |||
return "UpClassifyBean{" + | |||
"pid='" + pid + '\'' + | |||
", name='" + name + '\'' + | |||
", sort=" + sort + | |||
", id='" + id + '\'' + | |||
", remark='" + remark + '\'' + | |||
'}'; | |||
} | |||
public String getId() { | |||
return id; | |||
} | |||
public void setId(String id) { | |||
this.id = id; | |||
} | |||
public String getPid() { | |||
return pid; | |||
@@ -0,0 +1,23 @@ | |||
package com.bonait.bnframework.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; | |||
} | |||
} |
@@ -1,7 +1,6 @@ | |||
package com.bonait.bnframework.Model.upload; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
@@ -11,9 +10,6 @@ import java.util.List; | |||
public class UpResData implements Serializable{ | |||
public int code; | |||
public String message; | |||
public List<DataList> dataList; | |||
public static class DataList implements Serializable{ | |||
public String id; | |||
public String name; | |||
} | |||
public String id; | |||
public String name; | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.bonait.bnframework.Model.upload; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
@@ -10,7 +11,7 @@ import java.io.Serializable; | |||
public class UploadRes<T> implements Serializable { | |||
public int statusCode; | |||
public T data; | |||
public List<T> data; | |||
public boolean succeeded; | |||
public String errors; | |||
public String extras; | |||
@@ -20,6 +20,7 @@ import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
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; | |||
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; | |||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.util.PlcAddressUtil; | |||
import com.bonait.bnframework.common.helper.ConfigUtil; | |||
@@ -51,8 +52,11 @@ import com.bonait.bnframework.common.model.mode.UpdateBomInfo; | |||
import com.bonait.bnframework.common.model.mode.UpdateCloudGood; | |||
import com.bonait.bnframework.common.oss.OssHelper; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
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.newui.http.UpdateAllDataService; | |||
import com.bonait.bnframework.newui.http.UpdateDataService; | |||
import com.google.gson.Gson; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
@@ -113,11 +117,18 @@ public class ConfigData { | |||
* 加载系统配置 | |||
*/ | |||
public void LoadSystem() { | |||
// ArrayList<BPA_SYSTEMSET> bpa_systemsets = QueryDB.GetSystemsetALL(); | |||
//// for(BPA_SYSTEMSET item:bpa_systemsets) | |||
//// { | |||
//// QueryDB.DeleteSystemset(item.id); | |||
//// } | |||
ArrayList<BPA_SYSTEMSET> bpa_systemsets = QueryDB.GetSystemsetALL(); | |||
for(BPA_SYSTEMSET systemset : bpa_systemsets ){ | |||
if(systemset.type==-203){ | |||
ConfigName.getInstance().Key = systemset.value; | |||
UpdateDataService.key = systemset.value; | |||
} | |||
} | |||
// for(BPA_SYSTEMSET item:bpa_systemsets) | |||
// { | |||
// QueryDB.DeleteSystemset(item.id); | |||
// } | |||
// for (int i = 1; i < 5; i++) { | |||
// int ty = i; | |||
// BPA_SYSTEMSET set = new BPA_SYSTEMSET(); | |||
@@ -22,6 +22,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_RECORD; | |||
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_ORDER_DETAIL; | |||
import com.bonait.bnframework.common.db.mode.BPA_ORDER_LIST; | |||
import com.bonait.bnframework.common.db.mode.BPA_ORDER_RECORD; | |||
@@ -35,6 +36,7 @@ import com.bonait.bnframework.common.notification.MainNotification; | |||
import com.bonait.bnframework.common.utils.AppUtils; | |||
import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.newui.http.UpdateDataService; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.cache.CacheEntity; | |||
import com.lzy.okgo.cache.CacheMode; | |||
@@ -246,6 +248,9 @@ public class MainInit { | |||
if(!DBHelper.getInstance(MainApplication.getContext()).doesTableExist(BPA_ORDER_LIST.class)){ | |||
DBHelper.getInstance(MainApplication.getContext()).CreateTablesAll(BPA_ORDER_LIST.class,null); | |||
} | |||
if(!DBHelper.getInstance(MainApplication.getContext()).doesTableExist(BPA_MATERIAL_TYPE.class)){ | |||
DBHelper.getInstance(MainApplication.getContext()).CreateTablesAll(BPA_MATERIAL_TYPE.class,null); | |||
} | |||
//11个料仓 1-9个液体 10水阀 11勾芡 | |||
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_SILOS_CALIBRATE.class,null); | |||
@@ -91,7 +91,7 @@ public class RecordManager { | |||
order.groupName = group.name; | |||
order.groupId = group.id; | |||
order.goodsName = goods.name; | |||
order.classifyId = goods.classifyId; | |||
order.classifyId = goods.propClassifyId; | |||
order.goodsId = goods.id; | |||
switch (type){ | |||
case "完成": | |||
@@ -52,7 +52,10 @@ public class ConfigName { | |||
} | |||
return mInstance; | |||
} | |||
/** | |||
* 平台授权码 | |||
*/ | |||
public String Key = "be992a44-d6a8-462d-8206-3c7998fa944b"; | |||
/** | |||
* 火力 | |||
*/ | |||
@@ -65,6 +68,7 @@ public class ConfigName { | |||
* 锅口朝向 | |||
*/ | |||
public String guokouChaoxiang = ""; | |||
public static String dataPath = "/hblxiaochaokaoxiangdb"; | |||
public String oven_wendu="0"; | |||
@@ -530,6 +534,7 @@ public class ConfigName { | |||
public final static String environment="environment"; | |||
public final static String shopNumber="shopNumber"; | |||
public final static String deviceNumber="deviceNumber"; | |||
public final static String serviceKey="serviceKey"; | |||
public final static String deviceLocation="deviceLocation"; | |||
public final static String deviceName="deviceName"; | |||
public final static String deviceNum="deviceNum"; | |||
@@ -602,7 +607,8 @@ public class ConfigName { | |||
/** | |||
* 店铺设备号 | |||
*/ | |||
public String DeviceAutoKey = "159"; | |||
public String DeviceAutoKey = "260";//炒锅 | |||
public String DeviceAutoKey2 = "259";//烤箱 | |||
/** | |||
* 设备id | |||
*/ | |||
@@ -23,6 +23,7 @@ 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_LOG_RECORD; | |||
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; | |||
@@ -34,6 +35,7 @@ import com.bonait.bnframework.common.db.mode.BPA_ORDER_RECORD; | |||
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; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE; | |||
@@ -115,6 +117,16 @@ public class QueryDB { | |||
Update(BPA_MATERIAL.class, data); | |||
} | |||
/** | |||
* 删除物料数据 | |||
* add fengyoufu 20230413 | |||
* | |||
* @param data 物料数据 | |||
* @return 是否成功 | |||
*/ | |||
public static boolean DeleteMaterialType(BPA_MATERIAL_TYPE data) { | |||
return Delete(BPA_MATERIAL_TYPE.class, data.id); | |||
} | |||
/** | |||
* 删除物料数据 | |||
* add fengyoufu 20230413 | |||
@@ -2913,7 +2925,8 @@ public class QueryDB { | |||
((BPA_GOODS) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); | |||
((BPA_GOODS) data).status = cursor.getInt((int) cursor.getColumnIndex("status")); | |||
((BPA_GOODS) data).url = cursor.getString((int) cursor.getColumnIndex("url")); | |||
((BPA_GOODS) data).classifyId = cursor.getString((int) cursor.getColumnIndex("classifyId")); | |||
((BPA_GOODS) data).propClassifyId = cursor.getString((int) cursor.getColumnIndex("propClassifyId")); | |||
((BPA_GOODS) data).goodClassifyid = cursor.getString((int) cursor.getColumnIndex("goodClassifyid")); | |||
((BPA_GOODS) data).isCollect = cursor.getInt((int) cursor.getColumnIndex("isCollect")); | |||
break; | |||
@@ -3131,6 +3144,12 @@ public class QueryDB { | |||
((BPA_GOODS_CLASSIFY) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | |||
((BPA_GOODS_CLASSIFY) data).type = cursor.getInt((int) cursor.getColumnIndex("type")); | |||
break; | |||
case "BPA_PROPERTY_CLASSIFY": | |||
data = new BPA_PROPERTY_CLASSIFY(); | |||
//私有 | |||
((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_GOODS_SUBATTRIBUTE_GROUP": | |||
data = new BPA_GOODS_SUBATTRIBUTE_GROUP(); | |||
//私有 | |||
@@ -3150,6 +3169,11 @@ public class QueryDB { | |||
((BPA_ORDER_DETAIL) data).type = cursor.getInt((int) cursor.getColumnIndex("type")); | |||
((BPA_ORDER_DETAIL) data).status = cursor.getInt((int) cursor.getColumnIndex("status")); | |||
break; | |||
case "BPA_MATERIAL_TYPE": | |||
data = new BPA_MATERIAL_TYPE(); | |||
//私有 | |||
((BPA_MATERIAL_TYPE) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | |||
break; | |||
} | |||
((ModeBase) data).id = cursor.getString((int) cursor.getColumnIndex("id")); | |||
((ModeBase) data).createTime = cursor.getString((int) cursor.getColumnIndex("createTime")); | |||
@@ -30,6 +30,7 @@ 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; | |||
import com.bonait.bnframework.common.db.mode.BPA_LOG_RECORD; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE; | |||
@@ -143,7 +144,7 @@ public class DBHelper extends SQLiteOpenHelper { | |||
CreateTablesAll(BPA_GOODS_SUBATTRIBUTE_GROUP.class,null);//子属性组合 | |||
CreateTablesAll(BPA_ATTRIBUTE.class,null);//属性 | |||
CreateTablesAll(BPA_SUBATTRIBUTE.class,null);//子属性 | |||
CreateTablesAll(BPA_PROPERTY_CLASSIFY.class,null);//属性分类表 | |||
ForeignKeys(); | |||
} | |||
/** | |||
@@ -11,7 +11,7 @@ public class BPA_ATTRIBUTE extends ModeBase { | |||
*/ | |||
public int sort; | |||
/** | |||
* 分类id | |||
*属性分类id | |||
*/ | |||
public String classifyId; | |||
/** | |||
@@ -27,22 +27,27 @@ public class BPA_GOODS extends ModeBase { | |||
* 是否收藏 0 未收藏 1 收藏 | |||
*/ | |||
public int isCollect; | |||
/** | |||
* 属性分类id | |||
*/ | |||
public String propClassifyId; | |||
/** | |||
* 商品分类id | |||
*/ | |||
public String classifyId; | |||
public String goodClassifyid; | |||
@Override | |||
public String toString() { | |||
return "BPA_GOODS{" + | |||
"name='" + name + '\'' + | |||
", id='" + id + '\'' + | |||
", url='" + url + '\'' + | |||
", sort=" + sort + | |||
", status=" + status + | |||
", isCollect=" + isCollect + | |||
", classifyId='" + classifyId + '\'' + | |||
", propClassifyId='" + propClassifyId + '\'' + | |||
", goodClassifyid='" + goodClassifyid + '\'' + | |||
'}'; | |||
} | |||
} |
@@ -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; | |||
} |
@@ -0,0 +1,26 @@ | |||
package com.bonait.bnframework.common.db.mode; | |||
/** | |||
* 属性分类表 | |||
*/ | |||
public class BPA_PROPERTY_CLASSIFY extends ModeBase { | |||
/** | |||
* 属性分类名称 | |||
*/ | |||
public String name; | |||
/** | |||
* 状态 | |||
*/ | |||
public int state; | |||
@Override | |||
public String toString() { | |||
return "BPA_GOODS_CLASSIFY{" + | |||
"name='" + name + '\'' + | |||
", state=" + state + | |||
", id=" + id + | |||
'}'; | |||
} | |||
} |
@@ -0,0 +1,331 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import com.apkfuns.logutils.LogUtils; | |||
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_CLOUDDATA; | |||
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_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESS; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
* @description: 批量增删 | |||
* @date: 2024/7/23 9:48. | |||
*/ | |||
public class DBListDataUtil { | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addPROCESSModelList( List<BPA_PROCESSModel> list) { | |||
if(list==null || list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
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(BPA_PROCESSModel.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
public static boolean addPROCESSList( List<BPA_PROCESS> list) { | |||
if(list==null || list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
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(BPA_PROCESS.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
public static boolean addGOODSRECIPEList( List<BPA_GOODSRECIPE> list) { | |||
if(list==null || list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
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(BPA_GOODSRECIPE.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
public static boolean addMATERIALList( List<BPA_MATERIAL> list) { | |||
if(list==null || list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
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(BPA_MATERIAL.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
public static boolean addGOODSList( List<BPA_GOODS> list) { | |||
if(list==null || list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
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(BPA_GOODS.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
public static boolean addCLOUDDATAList( List<BPA_CLOUDDATA> list) { | |||
if(list==null || list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
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(BPA_CLOUDDATA.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
} |
@@ -31,6 +31,25 @@ public class GoodsDBUtil { | |||
return QueryDB.Add(BPA_GOODS.class, data); | |||
} | |||
/** | |||
* 根据商品分类id删除商品数据 | |||
* | |||
* @param goodClassifyId | |||
* @return 是否成功 | |||
*/ | |||
public static boolean deleteByGoodClassifyId(String goodClassifyId) { | |||
boolean result = true; | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
long delete = db.delete(BPA_GOODS.class.getSimpleName(), "goodClassifyid=?", | |||
new String[]{goodClassifyId}); | |||
if(delete <= 0){ | |||
result = false; | |||
} | |||
db.close(); | |||
LogUtils.d("deleteByClassifyId 删除属性数据 result=" + result); | |||
return result; | |||
} | |||
/** | |||
* 批量新增 | |||
* @param list | |||
@@ -105,6 +124,25 @@ public class GoodsDBUtil { | |||
return QueryDB.Delete(BPA_GOODS.class, data.id); | |||
} | |||
/** | |||
* 根据属性id删除商品数据 | |||
* | |||
* @param propClassifyId | |||
* @return 是否成功 | |||
*/ | |||
public static boolean deleteByPropClassifyId(String propClassifyId) { | |||
boolean result = true; | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
long delete = db.delete(BPA_GOODS.class.getSimpleName(), "propClassifyId=?", | |||
new String[]{propClassifyId}); | |||
if(delete <= 0){ | |||
result = false; | |||
} | |||
db.close(); | |||
LogUtils.d("deleteByClassifyId 删除属性数据 result=" + result); | |||
return result; | |||
} | |||
/** | |||
* 删除商品数据 | |||
* | |||
@@ -206,7 +244,7 @@ public class GoodsDBUtil { | |||
*/ | |||
public static ArrayList<BPA_GOODS> getByClassifyId(String classifyId) { | |||
String orderby = QueryDB.Desc_Sort_Up; | |||
String where = "isDelete=? and classifyId=?"; | |||
String where = "isDelete=? and goodClassifyid=?"; | |||
String[] args = new String[]{"0",classifyId}; | |||
ArrayList<BPA_GOODS> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_GOODS.class, where, args, orderby); | |||
@@ -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; | |||
} | |||
} |
@@ -30,7 +30,7 @@ public class OrderDetailUtil { | |||
if(goods==null){ | |||
return false; | |||
} | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.goodClassifyid); | |||
if(classify==null){ | |||
return false; | |||
} | |||
@@ -40,7 +40,7 @@ public class OrderDetailUtil { | |||
data.goodsName = goods.name; | |||
data.groupName = bean.name; | |||
data.groupId = bean.id; | |||
data.classifyId = goods.classifyId; | |||
data.classifyId = goods.propClassifyId; | |||
data.process = 0; | |||
data.status = 0; | |||
return QueryDB.Add(BPA_ORDER_DETAIL.class, data); | |||
@@ -51,7 +51,7 @@ public class OrderDetailUtil { | |||
if(goods==null){ | |||
return false; | |||
} | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.goodClassifyid); | |||
if(classify==null){ | |||
return false; | |||
} | |||
@@ -61,7 +61,7 @@ public class OrderDetailUtil { | |||
data.goodsName = goods.name; | |||
data.groupName = bean.name; | |||
data.groupId = bean.id; | |||
data.classifyId = goods.classifyId; | |||
data.classifyId = goods.propClassifyId; | |||
data.process = 0; | |||
data.status = status; | |||
return QueryDB.Add(BPA_ORDER_DETAIL.class, data); | |||
@@ -0,0 +1,237 @@ | |||
package com.bonait.bnframework.common.db.util; | |||
import android.content.ContentValues; | |||
import android.database.sqlite.SQLiteDatabase; | |||
import android.util.Log; | |||
import com.apkfuns.logutils.LogUtils; | |||
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_PROPERTY_CLASSIFY; | |||
import com.bonait.bnframework.common.helper.Tools; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* @author: liup | |||
* @description: 属性分类数据库操作 | |||
* @date: 2024/5/8 9:07. | |||
*/ | |||
public class PropClassifyDBUtil { | |||
/** | |||
* 新增属性分类数据 | |||
* | |||
* @param data 属性分类数据 | |||
* @return 是否成功 | |||
*/ | |||
public static boolean add(BPA_PROPERTY_CLASSIFY data) { | |||
return QueryDB.Add(BPA_PROPERTY_CLASSIFY.class, data); | |||
} | |||
/** | |||
* 批量新增 | |||
* @param list | |||
* @return | |||
*/ | |||
public static boolean addList( List<BPA_PROPERTY_CLASSIFY> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
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(BPA_PROPERTY_CLASSIFY.class.getSimpleName(), null, cv); | |||
if (insert == -1) { | |||
throw new Exception("Failed to insert data at index " + i); | |||
} | |||
} | |||
LogUtils.d("removeList 批量添加工序"); | |||
db.setTransactionSuccessful(); | |||
return insert > 0; | |||
} catch (Exception e) { | |||
LogUtils.d("addList 批量新增异常"); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 修改属性分类数据 | |||
* | |||
* @param data | |||
*/ | |||
public static void update(BPA_PROPERTY_CLASSIFY data) { | |||
QueryDB.Update(BPA_PROPERTY_CLASSIFY.class, data); | |||
} | |||
/** | |||
* 删除属性分类数据 | |||
* | |||
* @param data 属性分类数据 | |||
* @return 是否成功 | |||
*/ | |||
public static boolean delete(BPA_PROPERTY_CLASSIFY data) { | |||
return QueryDB.Delete(BPA_PROPERTY_CLASSIFY.class, data.id); | |||
} | |||
/** | |||
* 删除 | |||
* | |||
* @return | |||
*/ | |||
public static boolean DeleteList(List<BPA_PROPERTY_CLASSIFY> list) { | |||
if(list.isEmpty()){ | |||
return true; | |||
} | |||
QueryDB.lock.lock(); | |||
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase(); | |||
boolean isSucess = true; | |||
try { | |||
db.beginTransaction(); | |||
for(int i = 0; i < list.size(); i++){ | |||
if(!list.get(i).id.isEmpty()){ | |||
long delete = db.delete(BPA_PROPERTY_CLASSIFY.class.getSimpleName(), "id = ?", | |||
new String[]{list.get(i).id}); | |||
if(delete<=0){ | |||
isSucess = false; | |||
} | |||
} | |||
} | |||
db.setTransactionSuccessful(); | |||
return isSucess; | |||
} catch (Exception e) { | |||
Log.d("删除异常", "删除异常: " + e.getMessage()); | |||
} finally { | |||
db.endTransaction(); | |||
db.close(); | |||
QueryDB.lock.unlock(); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 删除属性分类数据 | |||
* | |||
* @param id 属性分类id | |||
* @return 是否成功 | |||
*/ | |||
public static boolean deleteById(String id) { | |||
BPA_PROPERTY_CLASSIFY bean = getById(id); | |||
if(bean!=null){ | |||
return QueryDB.Delete(BPA_PROPERTY_CLASSIFY.class, bean.id); | |||
} | |||
return false; | |||
} | |||
/** | |||
* 根据属性分类id获取属性分类 | |||
* | |||
* @param id | |||
* @return BPA_PROPERTY_CLASSIFY | |||
*/ | |||
public static BPA_PROPERTY_CLASSIFY getById(String id) { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and id=?"; | |||
String[] args = new String[]{"0", id}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_PROPERTY_CLASSIFY.class, where, args, orderby); | |||
return obj.size() > 0 ? (BPA_PROPERTY_CLASSIFY) obj.get(0) : null; | |||
} | |||
/** | |||
* 根据属性分类name获取属性分类 | |||
* | |||
* @param name | |||
* @return BPA_PROPERTY_CLASSIFY | |||
*/ | |||
public static BPA_PROPERTY_CLASSIFY getByName(String name) { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and name=?"; | |||
String[] args = new String[]{"0", name}; | |||
ArrayList<Object> obj = QueryDB.Get(BPA_PROPERTY_CLASSIFY.class, where, args, orderby); | |||
return obj.size() > 0 ? (BPA_PROPERTY_CLASSIFY) obj.get(0) : null; | |||
} | |||
/** | |||
* 根据属性分类name获取属性分类 | |||
* | |||
* @param name | |||
* @return BPA_PROPERTY_CLASSIFY | |||
*/ | |||
public static ArrayList<BPA_PROPERTY_CLASSIFY> getListByName(String name) { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? and name=?"; | |||
String[] args = new String[]{"0", name}; | |||
ArrayList<BPA_PROPERTY_CLASSIFY> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_PROPERTY_CLASSIFY.class, where, args, orderby); | |||
for(Object bean : obj){ | |||
data.add((BPA_PROPERTY_CLASSIFY) bean); | |||
} | |||
return data; | |||
} | |||
/** | |||
* 根据分类classifyId获取属性分类列表 | |||
* | |||
* @return ArrayList<BPA_PROPERTY_CLASSIFY> | |||
*/ | |||
public static ArrayList<BPA_PROPERTY_CLASSIFY> getAll() { | |||
String orderby = QueryDB.Desc_Time_Up; | |||
String where = "isDelete=? "; | |||
String[] args = new String[]{"0"}; | |||
ArrayList<BPA_PROPERTY_CLASSIFY> data = new ArrayList<>(); | |||
ArrayList<Object> obj = QueryDB.Get(BPA_PROPERTY_CLASSIFY.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data.add((BPA_PROPERTY_CLASSIFY) k); | |||
} | |||
LogUtils.d("getAll 根据分类classifyId获取属性分类列表 data=" + data.toString()); | |||
return data; | |||
} | |||
/** | |||
* 删除所有属性相关的数据 | |||
*/ | |||
public static void deleteAllGoodsData(){ | |||
List<BPA_PROPERTY_CLASSIFY> classifyList = getAll(); | |||
for(BPA_PROPERTY_CLASSIFY classify :classifyList){ | |||
AttributeDBUtil.deleteByClassifyId(classify.id); | |||
GoodsDBUtil.deleteByPropClassifyId(classify.id); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(classify.id); | |||
SubAttributeDBUtil.deleteByClassifyId(classify.id); | |||
} | |||
} | |||
} |
@@ -42,7 +42,7 @@ public class SdCart { | |||
ConfigName.getInstance().sdCardPath = sdDir.toString(); | |||
} | |||
ConfigName.getInstance().appResRoot = ConfigName.getInstance().sdCardPath + "/hblxiaochaokaoxiangdb"; | |||
ConfigName.getInstance().appResRoot = ConfigName.getInstance().sdCardPath + ConfigName.dataPath; | |||
ConfigName.getInstance().dbPath = ConfigName.getInstance().appResRoot + "/hbl.db"; | |||
File rootFile = new File(ConfigName.getInstance().appResRoot); | |||
if (!rootFile.exists()) //创建目录 | |||
@@ -9,6 +9,7 @@ import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.NetworkUtils; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.glide.transform.FitXYRoundRadiusTransform; | |||
import com.bumptech.glide.Glide; | |||
import com.bumptech.glide.load.engine.DiskCacheStrategy; | |||
@@ -23,7 +24,7 @@ import java.io.FileOutputStream; | |||
*/ | |||
public class LocalCacheUtils { | |||
private static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblxiaochaokaoxiangdb/WebImage"; | |||
private static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+ ConfigName.dataPath+"/WebImage"; | |||
//region 私有单例 | |||
private static volatile LocalCacheUtils _instance; | |||
@@ -65,7 +65,7 @@ public class OssHelper { | |||
* 上传完成通知 | |||
*/ | |||
public IRunT OnCharge; | |||
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblxiaochaokaoxiangdb/WebImage"; | |||
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() +ConfigName.dataPath+ "/WebImage"; | |||
/** | |||
* 上传文件 | |||
@@ -5,7 +5,10 @@ import android.content.Context; | |||
import android.view.View; | |||
import android.widget.TextView; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.newui.widget.XComDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
@@ -131,7 +134,52 @@ public class AlertDialogUtils { | |||
} | |||
}); | |||
} | |||
public static void showTipDialog(AppCompatActivity activity, String title_zh, String content_zh, String title_en, String content_en, DialogClickListener listener){ | |||
showCancelAndConfirmDialog(activity,R.layout.dialog_with_cancel_confirm, new XComDialog.OnDialogListener(){ | |||
@Override | |||
public void onDialogClick(View layoutView, XComDialog xCom) { | |||
TextView tvTitle = layoutView.findViewById(R.id.tv_title); | |||
TextView tvContent = layoutView.findViewById(R.id.tv_content); | |||
TextView tvCancel = layoutView.findViewById(R.id.tv_cancel); | |||
TextView tvConfirm = layoutView.findViewById(R.id.tv_confirm); | |||
DisplayManager.scaleView(layoutView.findViewById(R.id.rl_btn)); | |||
DisplayManager.scaleView(tvTitle); | |||
DisplayManager.scaleView(tvContent); | |||
DisplayManager.scaleView(tvCancel); | |||
DisplayManager.scaleView(tvConfirm); | |||
switch (ConfigName.getInstance().app.getString(R.string.language)){ | |||
case "en": | |||
tvTitle.setText( title_en+""); | |||
tvContent.setText(content_en+""); | |||
break; | |||
case "zh": | |||
tvTitle.setText( title_zh+""); | |||
tvContent.setText(content_zh+""); | |||
break; | |||
} | |||
tvCancel.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
xCom.dismissX(); | |||
if(listener!=null){ | |||
listener.onCancel(); | |||
} | |||
} | |||
}); | |||
tvConfirm.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
xCom.dismissX(); | |||
if(listener!=null){ | |||
listener.onConfirm(); | |||
} | |||
} | |||
}); | |||
} | |||
}); | |||
} | |||
/** | |||
* 对话框,自定义确定按钮 | |||
* */ | |||
@@ -454,14 +454,17 @@ public class DisplayManager | |||
{ | |||
for (int i = 0, n = root.getChildCount(); i < n; i++) | |||
{ | |||
View v = root.getChildAt(i); | |||
scaleView(v); | |||
if (v instanceof ViewGroup) | |||
{ | |||
scaleViewGroup((ViewGroup) v); | |||
try{ | |||
View v = root.getChildAt(i); | |||
scaleView(v); | |||
if (v instanceof ViewGroup) | |||
{ | |||
scaleViewGroup((ViewGroup) v); | |||
} | |||
}catch (Exception e){ | |||
LogUtils.d("scaleViewGroup e="+e.getMessage()); | |||
} | |||
} | |||
} | |||
@@ -1,5 +1,10 @@ | |||
package com.bonait.bnframework.common.utils; | |||
import com.apkfuns.logutils.LogUtils; | |||
import org.json.JSONArray; | |||
import org.json.JSONObject; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
@@ -36,7 +41,29 @@ public class ProcessValueUtil { | |||
return formulation; | |||
} | |||
public static String dealProcessSms(String value){ | |||
StringBuilder stringBuffer = new StringBuilder(); | |||
stringBuffer.append("("); | |||
if(value.contains("|")){ | |||
String[] res = value.split("\\|"); | |||
for(String s:res){ | |||
if(s.contains(",")){ | |||
String[] res2 = s.split(","); | |||
stringBuffer.append(res2[1]).append(","); | |||
}else { | |||
stringBuffer.append(s).append(","); | |||
} | |||
} | |||
}else { | |||
if(value.contains(",")){ | |||
String[] res2 = value.split(","); | |||
stringBuffer.append(res2[1]).append(","); | |||
}else { | |||
stringBuffer.append(value).append(","); | |||
} | |||
} | |||
return stringBuffer.toString().substring(0,stringBuffer.length()-1)+")"; | |||
} | |||
public static String getProcessSms(String value){ | |||
StringBuilder stringBuilder = new StringBuilder(); | |||
@@ -68,4 +95,54 @@ public class ProcessValueUtil { | |||
} | |||
return stringBuilder.substring(0,stringBuilder.length()-1)+")"; | |||
} | |||
public static String dealProcessJsonToValue(String json){ | |||
StringBuilder stringBuffer = new StringBuilder(); | |||
try{ | |||
JSONArray array = new JSONArray(json); | |||
if(json.contains("物料名称")){ | |||
String name = ""; | |||
String value = ""; | |||
for (int i =0 ;i<array.length();i++){ | |||
JSONObject dataJson = array.getJSONObject(i); | |||
if(dataJson.optString("actionName").equals("物料名称")){ | |||
name = dataJson.optString("actionValue"); | |||
} else if(dataJson.optString("actionName").equals("物料重量")){ | |||
value = dataJson.optString("actionValue"); | |||
} else if(dataJson.optString("actionName").equals("重量")){ | |||
value = dataJson.optString("actionValue"); | |||
} | |||
} | |||
stringBuffer.append(name).append(",").append(value).append("|"); | |||
}else{ | |||
for (int i =0 ;i<array.length();i++){ | |||
HashMap<String,String> map = new HashMap<>(); | |||
JSONObject dataJson = array.getJSONObject(i); | |||
if(!dataJson.optString("actionName").equals("执行步骤")){ | |||
if(dataJson.optString("actionName").equals("加热档位")||dataJson.optString("actionName").equals("搅拌档位") ){ | |||
String value = dataJson.optString("actionValue"); | |||
if(value.contains("档")){ | |||
stringBuffer.append(dataJson.optString("actionName")).append(",").append(dataJson.optString("actionValue")).append("|"); | |||
}else{ | |||
stringBuffer.append(dataJson.optString("actionName")).append(",").append(dataJson.optString("actionValue")).append("档").append("|"); | |||
} | |||
}else { | |||
stringBuffer.append(dataJson.optString("actionName")).append(",").append(dataJson.optString("actionValue")).append("|"); | |||
} | |||
} | |||
} | |||
} | |||
if(stringBuffer.length()>0){ | |||
stringBuffer.deleteCharAt(stringBuffer.length()-1); | |||
} | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
} | |||
LogUtils.d("ProcessValueUtil dealProcessJsonToValue json="+json); | |||
LogUtils.d("ProcessValueUtil dealProcessJsonToValue stringBuffer="+stringBuffer.toString()); | |||
return stringBuffer.toString(); | |||
} | |||
} |
@@ -167,7 +167,7 @@ public class DiyProcessHActivity extends BaseActivity { | |||
if(goods!=null){ | |||
viewBinding.title.setText((subAttributeGroupName.isEmpty()||subAttributeGroupName.equals(goods.name)) ? goods.name:(goods.name+"——"+subAttributeGroupName)); | |||
} | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.goodClassifyid); | |||
assert classify != null; | |||
type = classify.type; | |||
// viewBinding.tvType.setText(type==0?"炒菜":"烤菜"); | |||
@@ -154,7 +154,7 @@ public class DiyProcessOvenActivity extends BaseActivity { | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodId); | |||
assert goods != null; | |||
viewBinding.title.setText((subAttributeGroupName.isEmpty()||subAttributeGroupName.equals(goods.name)) ? goods.name:(goods.name+"——"+subAttributeGroupName)); | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.goodClassifyid); | |||
assert classify != null; | |||
type = classify.type; | |||
ArrayList<BPA_GOODS_PROCESS_DETAIL> list = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId); | |||
@@ -0,0 +1,134 @@ | |||
package com.bonait.bnframework.newui.activity; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.MenuItem; | |||
import androidx.annotation.Nullable; | |||
import androidx.viewpager.widget.ViewPager; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ActivityEditClassifyTabBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.newui.adapter.FragmentAdapter; | |||
import com.bonait.bnframework.newui.fragment.GoodEditClassifyFragment; | |||
import com.bonait.bnframework.newui.fragment.PropEditClassifyFragment; | |||
import org.greenrobot.eventbus.EventBus; | |||
import butterknife.ButterKnife; | |||
/** | |||
* @author: liup | |||
* @description: 编辑分类 | |||
* @date: 2024/5/6 16:04. | |||
*/ | |||
public class EditClassifyTabActivity extends BaseActivity { | |||
private final static String TAG = "EditClassifyTabActivity 编辑分类 ==> "; | |||
private Context context; | |||
private ActivityEditClassifyTabBinding viewBinding; | |||
private MenuItem menuItem; | |||
private FragmentAdapter fragmentAdapter = null; | |||
@Override | |||
protected void onCreate(@Nullable Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
viewBinding = ActivityEditClassifyTabBinding.inflate(getLayoutInflater()); | |||
setContentView(viewBinding.getRoot()); | |||
ButterKnife.bind(this); | |||
context = this; | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
Init(); | |||
initTopBar(); | |||
} | |||
private void initTopBar(){ | |||
// viewBinding.topbar.setTitle("编辑分类"); | |||
viewBinding.back.setOnClickListener(v->{ | |||
finishActivity(); | |||
}); | |||
} | |||
private void Init(){ | |||
fragmentAdapter = new FragmentAdapter(getSupportFragmentManager()); | |||
fragmentAdapter.addFragment(new PropEditClassifyFragment()); | |||
fragmentAdapter.addFragment(new GoodEditClassifyFragment()); | |||
viewBinding.viewpager.setAdapter(fragmentAdapter); | |||
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.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); | |||
}); | |||
viewBinding.tvClassifyProperty.setSelected(true); | |||
} | |||
/** | |||
* 配置ViewPager监听器,手指滑动监听 | |||
*/ | |||
private ViewPager.OnPageChangeListener pageChangeListener = new ViewPager.OnPageChangeListener() { | |||
@Override | |||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | |||
// MenuItem menuItem = viewBinding.navigation.getMenu().getItem(position); | |||
} | |||
@Override | |||
public void onPageSelected(int position) { | |||
// 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 | |||
public void onPageScrollStateChanged(int state) { | |||
} | |||
}; | |||
@Override | |||
protected void doOnBackPressed() { | |||
super.doOnBackPressed(); | |||
finishActivity(); | |||
} | |||
private void finishActivity(){ | |||
setResult(RESULT_OK, null); | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
finish(); | |||
} | |||
@Override | |||
protected String getClassName() { | |||
return "编辑分类页"; | |||
} | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
} | |||
} |
@@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
@@ -33,7 +34,7 @@ public class ImageChooseActivity extends BaseActivity { | |||
QMUITopBarLayout mTopBar;//顶部标题 | |||
@BindView(R.id.recycler_view) | |||
RecyclerView recyclerView;//image列表 | |||
public static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+"/hblxiaochaokaoxiangdb/WebImage"; | |||
public static final String CACHE_PATH= Environment.getExternalStorageDirectory().getAbsolutePath()+ ConfigName.dbPath+"/WebImage"; | |||
List<image_sp> data =new ArrayList<>(); | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
@@ -101,7 +101,7 @@ public class AddOrderDialog extends DialogFragment { | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if(goods!=null){ | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
attributeList = AttributeDBUtil.getByClassify(goods.propClassifyId); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
initView(); | |||
@@ -114,7 +114,7 @@ public class EditGoodsHDialog extends DialogFragment { | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if(goods!=null){ | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
attributeList = AttributeDBUtil.getByClassify(goods.propClassifyId); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
initView(); | |||
@@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
import com.bonait.bnframework.Model.GoodsInfoBean; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
@@ -28,7 +29,7 @@ import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.FragmentCloudGoodsHBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.GoodClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.CloudGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.WaiteProgressDialog; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
@@ -49,7 +50,7 @@ import java.util.Objects; | |||
public class CloudGoodsHFragment extends BaseFragment { | |||
private FragmentCloudGoodsHBinding viewBinding; | |||
private CloudGoodsAdapter goodsAdapter; | |||
private ClassifyAdapter classifyAdapter,classifyAdapter2; | |||
private GoodClassifyAdapter classifyAdapter,classifyAdapter2; | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList2 = new ArrayList<>(); | |||
@@ -173,7 +174,7 @@ public class CloudGoodsHFragment extends BaseFragment { | |||
}); | |||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | |||
classifyAdapter =new ClassifyAdapter() { | |||
classifyAdapter =new GoodClassifyAdapter() { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
LogUtils.d("分类列表点击 position="+position+" name = "+mData.get(position).name); | |||
@@ -187,7 +188,7 @@ public class CloudGoodsHFragment extends BaseFragment { | |||
}; | |||
viewBinding.recyclerClassify.setAdapter(classifyAdapter); | |||
classifyAdapter2 =new ClassifyAdapter() { | |||
classifyAdapter2 =new GoodClassifyAdapter() { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
LogUtils.d("分类列表点击 position="+position+" name = "+mData.get(position).name); | |||
@@ -214,14 +215,14 @@ public class CloudGoodsHFragment extends BaseFragment { | |||
private void dealClassifyData(){ | |||
classifyList.clear(); | |||
classifyList2.clear(); | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
if(viewModel.cloudGoodsList.getValue()!=null && viewModel.cloudGoodsList.getValue().getGoodsClassifyList()!=null){ | |||
LogUtils.d(" classifyList="+viewModel.cloudGoodsList.getValue()); | |||
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(); | |||
goodsClassify.name = bean.getGoodsTypeName(); | |||
goodsClassify.id = bean.getGoodsClassifyId(); | |||
goodsClassify.name = bean.getGoodsClassifyName(); | |||
for(GoodsClassifyBean bean2:viewModel.goodsList){ | |||
if(bean.getGoodsTypeId().equals(bean2.getGoodsTypeId())){ | |||
if(bean.getGoodsClassifyId().equals(bean2.getGoodsClassifyId())){ | |||
goodsClassify.type = 1; | |||
break; | |||
} | |||
@@ -253,20 +254,30 @@ public class CloudGoodsHFragment extends BaseFragment { | |||
} | |||
if(position>=0 && !classifyList.isEmpty()){ | |||
String goodsId = classifyList.get(position).id; | |||
if(goodsId!=null && viewModel.cloudGoodsList.getValue()!=null){ | |||
for (GoodsClassifyBean bean : viewModel.cloudGoodsList.getValue()){ | |||
LogUtils.d("dealGoodsData goodsId="+goodsId+";bean.getGoodsTypeId()="+bean.getGoodsTypeId()); | |||
if(goodsId.equals(bean.getGoodsTypeId())){ | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = goodsInfoListBean.getGoodsName(); | |||
goods.id = goodsInfoListBean.getGoodsId(); | |||
goods.classifyId = bean.getGoodsTypeId(); | |||
goods.url = goodsInfoListBean.getImgUrl(); | |||
goodsList.add(goods); | |||
if(goodsId!=null && viewModel.cloudGoodsList.getValue()!=null&& viewModel.cloudGoodsList.getValue().getGoodsClassifyList()!=null){ | |||
String classifyID = classifyList.get(position).id; | |||
LogUtils.d("dealGoodsData classifyID="+classifyID+";classifyList.size="+classifyList.size()); | |||
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 -> { | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
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; | |||
} | |||
} | |||
} | |||
@@ -0,0 +1,450 @@ | |||
package com.bonait.bnframework.newui.fragment; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.widget.AdapterView; | |||
import android.widget.ArrayAdapter; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.RecordManager; | |||
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.AttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogAddClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogAddClassifyHBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.databinding.FragmentGoodEditClassifyBinding; | |||
import com.bonait.bnframework.newui.widget.NewToastUtil; | |||
import com.bonait.bnframework.ui.adapter.goods.LocalGoodsAdapter; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
/** | |||
* @author: liup | |||
* @description: 编辑分类 | |||
* @date: 2024/5/6 16:04. | |||
*/ | |||
public class GoodEditClassifyFragment extends BaseFragment { | |||
private final static String TAG = "EditClassifyActivity 编辑分类 ==> "; | |||
private Context context; | |||
private FragmentGoodEditClassifyBinding viewBinding; | |||
/** | |||
* 下拉列表 | |||
*/ | |||
private ArrayAdapter<String> spinnerAdapter;// | |||
private final Map<String, String> classifyList = new LinkedHashMap<>(); | |||
private final List<String> classifyNameList = new ArrayList<>(); | |||
private boolean isUserClicked = false; | |||
private int classifyPosition = 0;//选中位置 | |||
private LocalGoodsAdapter goodsAdapter; | |||
private boolean isEdit = false; | |||
private String CurrentGoodClassifyId; | |||
/** | |||
* 判断重复点击 | |||
*/ | |||
private long lastTime; | |||
private long lastTime2; | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
public boolean isFast2Click(){ | |||
long curTime = System.currentTimeMillis(); | |||
if(curTime - lastTime2 < 1000){ | |||
return true; | |||
} | |||
lastTime2 = curTime; | |||
return false; | |||
} | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_good_edit_classify, null); | |||
viewBinding = FragmentGoodEditClassifyBinding.bind(root); | |||
ButterKnife.bind(this, root); | |||
return root; | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context=getContext(); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
initData(); | |||
initView(); | |||
// EventBus.getDefault().register(this); | |||
} | |||
private void initData(){ | |||
classifyPosition=0; | |||
classifyList.clear(); | |||
classifyList.put(getString(R.string.text_noselect),""); | |||
for(BPA_GOODS_CLASSIFY goodsClassify:GoodsClassifyDBUtil.getAll()){ | |||
classifyList.put(goodsClassify.name,goodsClassify.id); | |||
} | |||
} | |||
/** | |||
* 选中分类名称 | |||
*/ | |||
private void selectClassify(int position){ | |||
classifyPosition = position; | |||
viewBinding.spinnerClassify.setSelection(position); | |||
LogUtils.d(TAG+" viewBinding.spinnerClassify.getSelectedItem().toString()="+viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
if(position>0){ | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
} | |||
} | |||
private void setSelectStatus(int value){ | |||
for(BPA_GOODS good:goodsList){ | |||
good.status=value; | |||
} | |||
goodsAdapter.notifyDataSetChanged(); | |||
} | |||
/** | |||
* 初始化 | |||
* 修改子属性 | |||
* 删除子属性 | |||
*/ | |||
private void initView(){ | |||
//下拉选择 | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter = new ArrayAdapter<>(context, R.layout.spinner_text_item, classifyNameList); | |||
LogUtils.d(" initView classifyNameList="+classifyNameList); | |||
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
viewBinding.spinnerClassify.setAdapter(spinnerAdapter); | |||
viewBinding.spinnerClassify.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
isUserClicked = true; | |||
view.performClick(); | |||
return false; | |||
} | |||
}); | |||
viewBinding.spinnerClassify.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
if (isUserClicked)//不是用户点击返回 | |||
{ | |||
selectClassify(i); | |||
isUserClicked = false; | |||
if(i>0 && i<classifyNameList.size()){ | |||
BPA_GOODS_CLASSIFY goodClassify = GoodsClassifyDBUtil.getByName(classifyNameList.get(i)); | |||
if(goodClassify!=null){ | |||
CurrentGoodClassifyId=goodClassify.id; | |||
ArrayList<BPA_GOODS> goods = GoodsDBUtil.getByClassifyId(goodClassify.id); | |||
Map<String,BPA_GOODS> goodMap = new HashMap<>(); | |||
if(goods!=null){ | |||
for (BPA_GOODS good:goods){ | |||
goodMap.put(good.name,good); | |||
} | |||
for(BPA_GOODS good:goodsList){ | |||
good.status=goodMap.containsKey(good.name)?1:2; | |||
} | |||
goodsAdapter.notifyDataSetChanged(); | |||
} | |||
} | |||
}else{ | |||
setSelectStatus(0); | |||
CurrentGoodClassifyId=""; | |||
} | |||
} | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
goodsAdapter = new LocalGoodsAdapter(){ | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
} | |||
@Override | |||
protected void uploadGoods(View v, int position) { | |||
} | |||
@Override | |||
protected void deleteGoods(View v, int position) { | |||
} | |||
@Override | |||
protected void selectGoods(View v, int position,boolean isSelect){ | |||
if(!CurrentGoodClassifyId.equals("")){ | |||
mData.get(position).goodClassifyid=isSelect?CurrentGoodClassifyId:""; | |||
BPA_GOODS bg = new BPA_GOODS(); | |||
bg.name=mData.get(position).name; | |||
bg.url=mData.get(position).url; | |||
bg.sort=mData.get(position).sort; | |||
bg.status=0; | |||
bg.isCollect=mData.get(position).isCollect; | |||
bg.propClassifyId=mData.get(position).propClassifyId; | |||
bg.goodClassifyid=mData.get(position).goodClassifyid; | |||
bg.id=mData.get(position).id; | |||
bg.createTime=mData.get(position).createTime; | |||
bg.updateTime=mData.get(position).updateTime; | |||
bg.deleteTime=mData.get(position).deleteTime; | |||
bg.deviceID=mData.get(position).deviceID; | |||
bg.userID=mData.get(position).userID; | |||
bg.isDelete=mData.get(position).isDelete; | |||
bg.exp=mData.get(position).exp; | |||
GoodsDBUtil.update(bg); | |||
} | |||
} | |||
@Override | |||
protected void addGoods() { | |||
} | |||
}; | |||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | |||
goodsList.clear(); | |||
goodsList.addAll(GoodsDBUtil.getAll()); | |||
goodsAdapter.setNewData(goodsList); | |||
} | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_add_classify,R.id.btn_update_classify,R.id.btn_delete_classify}) | |||
public void onViewClicked(View view) { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast!"); | |||
return; | |||
} | |||
switch (view.getId()){ | |||
case R.id.btn_add_classify://添加分类 | |||
addClassify(); | |||
break; | |||
case R.id.btn_update_classify://修改分类 | |||
updateClassify(); | |||
break; | |||
case R.id.btn_delete_classify://删除分类 | |||
removeClassify(); | |||
break; | |||
} | |||
} | |||
/** | |||
* 添加分类 | |||
*/ | |||
private void addClassify(){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_classify_h, (layoutView, xCom) -> { | |||
DialogAddClassifyHBinding binding = DialogAddClassifyHBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("新增分类名称"); | |||
binding.edit.setHint("请输入分类名称"); | |||
List<String> spinner = new ArrayList<>(); | |||
spinner.add("炒锅"); | |||
spinner.add("烤箱"); | |||
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, R.layout.spinner_text_item, spinner); | |||
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
binding.spinnerType.setAdapter(adapter); | |||
binding.spinnerType.setSelection(0); | |||
binding.btnClose.setOnClickListener(v->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for (Map.Entry<String, String> entry : classifyList.entrySet()) { | |||
if(entry.getKey().equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该分类,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
BPA_GOODS_CLASSIFY goodsClassify = new BPA_GOODS_CLASSIFY(); | |||
goodsClassify.name = input; | |||
String type = binding.spinnerType.getSelectedItem().toString(); | |||
if(type.equals("炒锅")){ | |||
goodsClassify.type = 0; | |||
}else { | |||
goodsClassify.type = 1; | |||
} | |||
if(GoodsClassifyDBUtil.add(goodsClassify)){ | |||
classifyList.put(input,goodsClassify.id); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyList.size()-1);//更新数据 | |||
NewToastUtil.getInstance().showToast("添加["+input+"]分类成功!"); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "添加["+input+"]分类成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("添加["+input+"]分类失败!"); | |||
} | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 修改分类 | |||
*/ | |||
private void updateClassify(){ | |||
if(classifyPosition == 0){ | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString(); | |||
binding.title.setText(getString(R.string.top_reviseclass)); | |||
binding.edit.setText(classifyName); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for (Map.Entry<String, String> entry : classifyList.entrySet()) { | |||
if(entry.getKey().equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该分类,请换一个名称!","This class already exists, please change its name!"); | |||
return; | |||
} | |||
} | |||
BPA_GOODS_CLASSIFY goodsClassify = GoodsClassifyDBUtil.getById(classifyId); | |||
goodsClassify.name = input; | |||
GoodsClassifyDBUtil.update(goodsClassify); | |||
classifyList.remove(classifyName); | |||
classifyList.put(input,classifyId); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyList.size()-1);//更新数据 | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "修改["+input+"]分类成功!"); | |||
NewToastUtil.getInstance().showToast("修改["+input+"]分类成功!","Revise ["+input+"] Success!"); | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!","The name cannot be empty!"); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 删除分类 | |||
*/ | |||
private void removeClassify(){ | |||
if(classifyPosition>0){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString(); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_deleteclass)); | |||
switch (getString(R.string.language)){ | |||
case "en": | |||
binding.edit.setText("Delete all products&attributes of ["+classifyName+"] ?"); | |||
break; | |||
case "zh": | |||
binding.edit.setText("是否删除["+classifyName+"]分类下所有商品及属性?"); | |||
break; | |||
} | |||
binding.cancel.setOnClickListener(view1 ->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast"); | |||
return; | |||
} | |||
if(GoodsClassifyDBUtil.deleteById(classifyId)){ | |||
GoodsClassifyDBUtil.DeleteList(GoodsClassifyDBUtil.getListByName(classifyName)); | |||
AttributeDBUtil.deleteByClassifyId(classifyId); | |||
GoodsDBUtil.deleteByGoodClassifyId(classifyId); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(classifyId); | |||
SubAttributeDBUtil.deleteByClassifyId(classifyId); | |||
classifyList.remove(classifyName); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyPosition-1);//更新数据 | |||
NewToastUtil.getInstance().showToast("删除["+classifyName+"]分类成功!","Delete ["+classifyName+"] Success!"); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "删除["+classifyName+"]分类成功!"); | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("删除["+classifyName+"]分类失败!","Delete ["+classifyName+"] Fail!"); | |||
} | |||
}); | |||
}); | |||
} | |||
} | |||
private void initTopBar(){ | |||
// viewBinding.topbar.setTitle("编辑分类"); | |||
// viewBinding.back.setOnClickListener(v->{ | |||
//// finishActivity(); | |||
// }); | |||
} | |||
// @Override | |||
// protected void doOnBackPressed() { | |||
// super.doOnBackPressed(); | |||
// finishActivity(); | |||
// } | |||
// private void finishActivity(){ | |||
// setResult(RESULT_OK, null); | |||
// EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
// finish(); | |||
// } | |||
// @Override | |||
// protected String getClassName() { | |||
// return "编辑分类页"; | |||
// } | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
} | |||
} |
@@ -23,6 +23,7 @@ import com.bonait.bnframework.databinding.DialogWithCancelConfirmBinding; | |||
import com.bonait.bnframework.databinding.FragmentHomeMainsBinding; | |||
import com.bonait.bnframework.manager.ActivityLifecycleManager; | |||
import com.bonait.bnframework.newui.activity.EditClassifyHActivity; | |||
import com.bonait.bnframework.newui.activity.EditClassifyTabActivity; | |||
import com.bonait.bnframework.newui.activity.EditGoodsHActivity; | |||
import com.bonait.bnframework.newui.activity.LogRecordHActivity; | |||
import com.bonait.bnframework.newui.activity.LoginHActivity; | |||
@@ -72,7 +73,7 @@ public class HomeMainsFragment extends BaseFragment { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
return; | |||
} | |||
OpenActivity(EditClassifyHActivity.class); | |||
OpenActivity(EditClassifyTabActivity.class); | |||
}); | |||
binding.llYanfa.setOnClickListener(v->{ | |||
if(ConfigName.getInstance().user.name.equals("一般用户")){ | |||
@@ -24,10 +24,12 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
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.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.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
@@ -38,10 +40,11 @@ import com.bonait.bnframework.databinding.FragmentLocalGoodsHBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodPicEvent; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.newui.activity.EditClassifyHActivity; | |||
import com.bonait.bnframework.newui.activity.EditClassifyTabActivity; | |||
import com.bonait.bnframework.newui.dialog.EditGoodsHDialog; | |||
import com.bonait.bnframework.newui.http.UpdateAllDataService; | |||
import com.bonait.bnframework.newui.http.UpdateDataService; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.GoodClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.LocalGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.AddGoodsDialog; | |||
import com.bonait.bnframework.newui.widget.NewToastUtil; | |||
@@ -52,6 +55,7 @@ import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @author: liup | |||
@@ -61,15 +65,21 @@ import java.util.List; | |||
public class LocalGoodsHFragment extends BaseFragment { | |||
private FragmentLocalGoodsHBinding viewBinding; | |||
private LocalGoodsAdapter goodsAdapter; | |||
private ClassifyAdapter classifyAdapter,classifyAdapter2; | |||
private GoodClassifyAdapter goodClassifyAdapter, goodClassifyAdapter2; | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList2 = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> goodClassifyList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> goodClassifyList2 = new ArrayList<>(); | |||
/** | |||
* 属性分类列表 | |||
*/ | |||
private ArrayList<BPA_PROPERTY_CLASSIFY> propClassifyList = new ArrayList<>(); | |||
private static final int MSG_FRESH_GOODS= 1; | |||
private Long FRESH_DELAY_TIME = 200L; | |||
private AddGoodsDialog addGoodsDialog; | |||
private EditGoodsHDialog editGoodsDialog; | |||
private boolean IsAllSelect=false; | |||
/** | |||
* 可编辑 | |||
*/ | |||
@@ -88,12 +98,12 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case MSG_FRESH_GOODS: | |||
if(classifyAdapter.getCurrentPosition()>=0){ | |||
if(goodClassifyAdapter.getCurrentPosition()>=0){ | |||
goodsList.clear(); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList.get(classifyAdapter.getCurrentPosition()).id)); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList.get(goodClassifyAdapter.getCurrentPosition()).id)); | |||
}else { | |||
goodsList.clear(); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList2.get(classifyAdapter2.getCurrentPosition()).id)); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList2.get(goodClassifyAdapter2.getCurrentPosition()).id)); | |||
} | |||
goodsAdapter.notifyDataSetChanged(); | |||
break; | |||
@@ -119,7 +129,40 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
@SuppressLint("NotifyDataSetChanged") | |||
private void initView(){ | |||
viewBinding.updateAll.setOnClickListener(v->{ | |||
viewBinding.allSelectTV.setVisibility(View.GONE); | |||
viewBinding.allSelectTV.setOnClickListener(view->{ | |||
IsAllSelect=!IsAllSelect; | |||
setSelectStatus(IsAllSelect?1:2); | |||
viewBinding.allSelectTV.setText(IsAllSelect?"全不选":"全选"); | |||
}); | |||
viewBinding.CancelTV.setVisibility(View.GONE); | |||
viewBinding.CancelTV.setOnClickListener(view->{ | |||
viewBinding.selectCB.setChecked(true); | |||
}); | |||
viewBinding.selectCB.setVisibility(isEdit?View.VISIBLE:View.GONE); | |||
viewBinding.selectCB.setOnCheckedChangeListener((view,value)->{ | |||
if(value){ | |||
viewBinding.selectCB.setVisibility(View.VISIBLE); | |||
setSelectStatus(0); | |||
viewBinding.allSelectTV.setText("全选"); | |||
viewBinding.allSelectTV.setVisibility(View.GONE); | |||
viewBinding.CancelTV.setVisibility(View.GONE); | |||
viewBinding.edit.setVisibility(View.GONE); | |||
}else{ | |||
viewBinding.selectCB.setVisibility(View.GONE); | |||
viewBinding.allSelectTV.setVisibility(View.VISIBLE); | |||
viewBinding.CancelTV.setVisibility(View.VISIBLE); | |||
viewBinding.edit.setVisibility(View.VISIBLE); | |||
setSelectStatus(2); | |||
} | |||
viewBinding.edit.setEnabled(false); | |||
viewBinding.edit.setAlpha(0.5f); | |||
}); | |||
viewBinding.uploadAll.setOnClickListener(v->{ | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
@@ -127,11 +170,11 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "请确认", "确认上传全部分类、全部商品、全部工序信息?上传将会覆盖云端商品,请确认", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
List<BPA_GOODS> res = goodsList.stream().filter(p->p.status==1).collect(Collectors.toList()); | |||
if(res!=null) { | |||
UpdateAllDataService.startUpLoadAll(res,getContext()); | |||
} | |||
UpdateAllDataService.startUpLoadAll(getContext()); | |||
viewBinding.selectCB.setChecked(true);//全部上传后隐藏多选内容 | |||
} | |||
@Override | |||
@@ -156,12 +199,27 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
@Override | |||
public void onConfirm() { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast!"); | |||
return; | |||
} | |||
MainInit.clearGoodsInfo(); | |||
List<BPA_GOODS> res = goodsList.stream().filter(p->p.status==1).collect(Collectors.toList()); | |||
if(res!=null) { | |||
res.forEach(bean->{ | |||
GoodsProcessDetailDBUtil.deleteByGoodsId(bean.id); | |||
SubAttributeGroupDBUtil.deleteByGoodsId(bean.id); | |||
if(GoodsDBUtil.delete(bean)){ | |||
NewToastUtil.getInstance().showToast("删除["+bean.name+"]成功!","Delete ["+bean.name+"] Success!"); | |||
goodsList.remove(bean); | |||
goodsAdapter.notifyDataSetChanged(); | |||
RecordManager.getInstance().addLogRecord("角色操作日志","删除["+bean.name+"]菜品成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("删除["+bean.name+"]失败!","Delete ["+bean.name+"] Fail!"); | |||
} | |||
}); | |||
} | |||
updateData(); | |||
RecordManager.getInstance().addLogRecord("角色操作日志","删除所有商品信息"); | |||
viewBinding.selectCB.setChecked(true);//全部删除后隐藏多选内容 | |||
} | |||
@Override | |||
@@ -240,46 +298,30 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
} | |||
@Override | |||
protected void addGoods() { | |||
if(type.equals("0")){ | |||
if(!classifyList.isEmpty() && getActivity()!=null){ | |||
if(classifyList.size()>classifyAdapter.getCurrentPosition()){ | |||
BPA_GOODS_CLASSIFY classify = classifyList.get(classifyAdapter.getCurrentPosition()); | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(classify.id); | |||
if(attributes.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("当前分类没有属性,请先创建分类父属性"); | |||
return; | |||
}else { | |||
for(BPA_ATTRIBUTE attribute:attributes){ | |||
if(SubAttributeDBUtil.getByParentAttributeId(attribute.id).isEmpty()){ | |||
NewToastUtil.getInstance().showToast("当前分类父属性["+attribute.name+"]没有子属性,无法创建"); | |||
return; | |||
} | |||
} | |||
} | |||
} | |||
protected void selectGoods(View v, int position, boolean isSelect) { | |||
mData.get(position).status=isSelect?1:2; | |||
List<BPA_GOODS> res = goodsList.stream().filter(p->p.status==1).collect(Collectors.toList()); | |||
if(res!=null) { | |||
if(res.size()==goodsList.size()){ | |||
viewBinding.allSelectTV.setText("全不选"); | |||
IsAllSelect=true; | |||
} | |||
}else{ | |||
if(!classifyList2.isEmpty() && getActivity()!=null){ | |||
if(classifyList2.size()>classifyAdapter2.getCurrentPosition()){ | |||
BPA_GOODS_CLASSIFY classify = classifyList2.get(classifyAdapter2.getCurrentPosition()); | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(classify.id); | |||
if(attributes.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("当前分类没有属性,请先创建分类父属性"); | |||
return; | |||
}else { | |||
for(BPA_ATTRIBUTE attribute:attributes){ | |||
if(SubAttributeDBUtil.getByParentAttributeId(attribute.id).isEmpty()){ | |||
NewToastUtil.getInstance().showToast("当前分类父属性["+attribute.name+"]没有子属性,无法创建"); | |||
return; | |||
} | |||
} | |||
} | |||
} | |||
else{ | |||
viewBinding.allSelectTV.setText("全选"); | |||
IsAllSelect=false; | |||
} | |||
viewBinding.edit.setEnabled(res.size()>0?true:false); | |||
viewBinding.edit.setAlpha(res.size()>0?1.0f:0.5f); | |||
} | |||
} | |||
addGoodsDialog(); | |||
@Override | |||
protected void addGoods() { | |||
if(!propClassifyList.isEmpty() && getActivity()!=null){ | |||
addGoodsDialog(); | |||
}else{ | |||
NewToastUtil.getInstance().showToast("请先创建属性分类","Please create attribute classification first"); | |||
} | |||
} | |||
}; | |||
goodsAdapter.setEdit(isEdit); | |||
@@ -293,37 +335,44 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
}); | |||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | |||
classifyAdapter =new ClassifyAdapter() { | |||
goodClassifyAdapter =new GoodClassifyAdapter() { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
LogUtils.d("分类列表点击 position="+position+" name = "+mData.get(position).name); | |||
RecordManager.getInstance().addLogRecord("角色操作日志","点击["+mData.get(position).name+"]分类"); | |||
handler.removeMessages(MSG_FRESH_GOODS); | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,FRESH_DELAY_TIME);//避免快速点击 | |||
int lastPos = classifyAdapter2.getCurrentPosition(); | |||
classifyAdapter2.setCurrentPosition(-1); | |||
classifyAdapter2.notifyItemChanged(lastPos); | |||
int lastPos = goodClassifyAdapter2.getCurrentPosition(); | |||
goodClassifyAdapter2.setCurrentPosition(-1); | |||
goodClassifyAdapter2.notifyItemChanged(lastPos); | |||
type="0"; | |||
} | |||
}; | |||
classifyAdapter.setCurrentPosition(0); | |||
viewBinding.recyclerClassify.setAdapter(classifyAdapter); | |||
goodClassifyAdapter.setCurrentPosition(0); | |||
viewBinding.recyclerClassify.setAdapter(goodClassifyAdapter); | |||
classifyAdapter2 =new ClassifyAdapter() { | |||
goodClassifyAdapter2 =new GoodClassifyAdapter() { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
LogUtils.d("分类列表点击 position="+position+" name = "+mData.get(position).name); | |||
RecordManager.getInstance().addLogRecord("角色操作日志","点击["+mData.get(position).name+"]分类"); | |||
handler.removeMessages(MSG_FRESH_GOODS); | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,FRESH_DELAY_TIME);//避免快速点击 | |||
int lastPos = classifyAdapter.getCurrentPosition(); | |||
classifyAdapter.setCurrentPosition(-1); | |||
int lastPos = goodClassifyAdapter.getCurrentPosition(); | |||
goodClassifyAdapter.setCurrentPosition(-1); | |||
type="1"; | |||
classifyAdapter.notifyItemChanged(lastPos); | |||
goodClassifyAdapter.notifyItemChanged(lastPos); | |||
} | |||
}; | |||
classifyAdapter2.setCurrentPosition(-1); | |||
viewBinding.recyclerClassify2.setAdapter(classifyAdapter2); | |||
goodClassifyAdapter2.setCurrentPosition(-1); | |||
viewBinding.recyclerClassify2.setAdapter(goodClassifyAdapter2); | |||
} | |||
private void setSelectStatus(int value){ | |||
for(BPA_GOODS good:goodsList){ | |||
good.status=value; | |||
} | |||
goodsAdapter.notifyDataSetChanged(); | |||
} | |||
/** | |||
@@ -359,14 +408,15 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
return; | |||
} | |||
if(type.equals("0")){ | |||
if(classifyList.isEmpty()){ | |||
if(goodClassifyList.isEmpty()){ | |||
return; | |||
} | |||
}else { | |||
if(classifyList2.isEmpty()){ | |||
if(goodClassifyList2.isEmpty()){ | |||
return; | |||
} | |||
} | |||
if(getActivity()!=null){ | |||
LogUtils.d(" addGoodsDialog addGoodsDialog="+addGoodsDialog); | |||
if(addGoodsDialog == null){ | |||
@@ -375,7 +425,7 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
addGoodsDialog.dismiss(); | |||
} | |||
Bundle bundle = new Bundle(); | |||
bundle.putInt("classifyPosition",type.equals("0")?classifyAdapter.getCurrentPosition():classifyAdapter2.getCurrentPosition()); | |||
bundle.putString("goodClassifyId", goodClassifyList.get(goodClassifyAdapter.getCurrentPosition()).id); | |||
bundle.putString("type",type); | |||
addGoodsDialog.setArguments(bundle); | |||
addGoodsDialog.show(getActivity().getSupportFragmentManager(), "addGoods"); | |||
@@ -386,7 +436,7 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
} | |||
private void jumpClassify(){ | |||
Intent intent = new Intent(getContext(), EditClassifyHActivity.class); | |||
Intent intent = new Intent(getContext(), EditClassifyTabActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
@@ -399,24 +449,25 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
public void updateData() { | |||
LogUtils.d("updateData"); | |||
goodsList.clear(); | |||
classifyList.clear(); | |||
classifyList2.clear(); | |||
classifyList.addAll(GoodsClassifyDBUtil.getAll("0")); | |||
classifyList2.addAll(GoodsClassifyDBUtil.getAll("1")); | |||
if(!classifyList.isEmpty()){ | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, classifyList.size()-1); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList.get(last2).id)); | |||
goodClassifyList.clear(); | |||
goodClassifyList2.clear(); | |||
goodClassifyList.addAll(GoodsClassifyDBUtil.getAll("0")); | |||
goodClassifyList2.addAll(GoodsClassifyDBUtil.getAll("1")); | |||
if(!goodClassifyList.isEmpty()){ | |||
int last = Math.max(goodClassifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, goodClassifyList.size()-1); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList.get(last2).id)); | |||
} | |||
goodsAdapter.setNewData(goodsList); | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, classifyList.size()-1); | |||
classifyAdapter.setCurrentPosition(last2); | |||
classifyAdapter.setNewData(classifyList); | |||
classifyAdapter2.setCurrentPosition(-1); | |||
classifyAdapter2.setNewData(classifyList2); | |||
int last = Math.max(goodClassifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, goodClassifyList.size()-1); | |||
goodClassifyAdapter.setCurrentPosition(last2); | |||
goodClassifyAdapter.setNewData(goodClassifyList); | |||
goodClassifyAdapter2.setCurrentPosition(-1); | |||
goodClassifyAdapter2.setNewData(goodClassifyList2); | |||
propClassifyList.addAll(PropClassifyDBUtil.getAll()); | |||
} | |||
@Override | |||
@@ -446,14 +497,14 @@ public class LocalGoodsHFragment extends BaseFragment { | |||
EventBus.getDefault().unregister(this); | |||
if(goodsList!=null){ | |||
goodsList.clear(); | |||
classifyList.clear(); | |||
goodClassifyList.clear(); | |||
goodsList = null; | |||
classifyList = null; | |||
goodClassifyList = null; | |||
} | |||
if(goodsAdapter!=null){ | |||
goodsAdapter = null; | |||
classifyAdapter = null; | |||
classifyAdapter2 = null; | |||
goodClassifyAdapter = null; | |||
goodClassifyAdapter2 = null; | |||
} | |||
if(handler!=null){ | |||
handler.removeCallbacksAndMessages(null); | |||
@@ -0,0 +1,685 @@ | |||
package com.bonait.bnframework.newui.fragment; | |||
import android.annotation.SuppressLint; | |||
import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.widget.AdapterView; | |||
import android.widget.ArrayAdapter; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
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_GOODS_SUBATTRIBUTE_GROUP; | |||
import com.bonait.bnframework.common.db.mode.BPA_PROPERTY_CLASSIFY; | |||
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.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ActivityEditClassifyHBinding; | |||
import com.bonait.bnframework.databinding.DialogAddClassifyBinding; | |||
import com.bonait.bnframework.databinding.DialogAddClassifyHBinding; | |||
import com.bonait.bnframework.databinding.DialogAddNameBinding; | |||
import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.databinding.FragmentPropEditClassifyBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.newui.activity.EditClassifyHActivity; | |||
import com.bonait.bnframework.newui.adapter.AttributeHAdapter; | |||
import com.bonait.bnframework.newui.adapter.SubattributeHAdapter; | |||
import com.bonait.bnframework.newui.widget.NewToastUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
import java.util.ArrayList; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
/** | |||
* @author: liup | |||
* @description: 编辑分类 | |||
* @date: 2024/5/6 16:04. | |||
*/ | |||
public class PropEditClassifyFragment extends BaseFragment { | |||
private final static String TAG = "EditClassifyActivity 编辑分类 ==> "; | |||
private Context context; | |||
private FragmentPropEditClassifyBinding viewBinding; | |||
/** | |||
* 父属性列表 | |||
*/ | |||
private AttributeHAdapter attributeAdapter; | |||
private final List<BPA_ATTRIBUTE> attributeList = new ArrayList<>(); | |||
/** | |||
* 子属性列表 | |||
*/ | |||
private SubattributeHAdapter subattributeAdapter; | |||
private final List<BPA_SUBATTRIBUTE> subattributeList = new ArrayList<>(); | |||
/** | |||
* 下拉列表 | |||
*/ | |||
private ArrayAdapter<String> spinnerAdapter;// | |||
private final Map<String, String> classifyList = new LinkedHashMap<>(); | |||
private final List<String> classifyNameList = new ArrayList<>(); | |||
private boolean isUserClicked = false; | |||
private int attributePosition = 0;//属性选中位置 | |||
private int classifyPosition = 0;//选中位置 | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_prop_edit_classify, null); | |||
viewBinding = FragmentPropEditClassifyBinding.bind(root); | |||
ButterKnife.bind(this, root); | |||
return root; | |||
} | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context=getContext(); | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
ButterKnife.bind(viewBinding.getRoot()); | |||
initData(); | |||
initView(); | |||
} | |||
private void initData(){ | |||
attributePosition = 0; | |||
classifyPosition=0; | |||
attributeList.clear(); | |||
subattributeList.clear(); | |||
classifyList.clear(); | |||
classifyList.put("未选择",""); | |||
for(BPA_PROPERTY_CLASSIFY goodsClassify: PropClassifyDBUtil.getAll()){ | |||
classifyList.put(goodsClassify.name,goodsClassify.id); | |||
} | |||
} | |||
/** | |||
* 选中分类名称 | |||
*/ | |||
private void selectClassify(int position){ | |||
attributeList.clear(); | |||
subattributeList.clear(); | |||
attributePosition = 0; | |||
attributeAdapter.setSelectPosition(0); | |||
classifyPosition = position; | |||
viewBinding.spinnerClassify.setSelection(position); | |||
LogUtils.d(TAG+" viewBinding.spinnerClassify.getSelectedItem().toString()="+viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
if(position>0){ | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
attributeList.addAll(AttributeDBUtil.getByClassify(classifyId)); | |||
if(!attributeList.isEmpty()){ | |||
subattributeList.addAll(SubAttributeDBUtil.getByParentAttributeId(attributeList.get(attributePosition).id)); | |||
} | |||
} | |||
attributeAdapter.notifyDataSetChanged(); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
} | |||
/** | |||
* 初始化 | |||
* 修改子属性 | |||
* 删除子属性 | |||
*/ | |||
private void initView(){ | |||
attributeAdapter = new AttributeHAdapter(context, R.layout.item_attribute_h, attributeList, new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
updateAttribute(); | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("重复点击!"); | |||
return; | |||
} | |||
attributePosition = k; | |||
//选中 | |||
BPA_ATTRIBUTE bean = (BPA_ATTRIBUTE) data; | |||
subattributeList.clear(); | |||
subattributeList.addAll(SubAttributeDBUtil.getByParentAttributeId(bean.id)); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
} | |||
}); | |||
attributePosition = 0; | |||
attributeAdapter.setSelectPosition(0); | |||
viewBinding.listAttribute.setAdapter(attributeAdapter); | |||
attributeAdapter.notifyDataSetChanged(); | |||
subattributeAdapter = new SubattributeHAdapter(context, R.layout.item_subattribute_h, subattributeList, new SubattributeHAdapter.MyClickListener() { | |||
@Override | |||
public void clickName(View v,int position,BPA_SUBATTRIBUTE data) { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("重复点击!"); | |||
return; | |||
} | |||
//修改子属性 | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_name, (layoutView, xCom) -> { | |||
DialogAddNameBinding binding = DialogAddNameBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("修改子属性名称"); | |||
binding.edit.setHint("请输入子属性名称"); | |||
binding.edit.setText(data.name); | |||
binding.btnClose.setOnClickListener(view1->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for(BPA_SUBATTRIBUTE bean:subattributeList){ | |||
if(bean.name.equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该子属性,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
xCom.dismissX(); | |||
String oldName = data.name; | |||
data.name = input; | |||
SubAttributeDBUtil.update(data); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
for(BPA_GOODS goods:GoodsDBUtil.getByClassifyId(classifyId)){ | |||
if(goods!=null){ | |||
for(BPA_GOODS_SUBATTRIBUTE_GROUP group : SubAttributeGroupDBUtil.getByGoodsId(goods.id)){ | |||
if(group.name!=null && group.name.contains(oldName)){ | |||
group.name = group.name.replace(oldName,input); | |||
SubAttributeGroupDBUtil.update(group); | |||
} | |||
} | |||
} | |||
} | |||
NewToastUtil.getInstance().showToast("修改成功"); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
if(position-1>=0 && !subattributeList.isEmpty()){ | |||
viewBinding.listSubattribute.smoothScrollToPosition(position-1); | |||
} | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
} | |||
@Override | |||
public void clickDelete(View v,int position,BPA_SUBATTRIBUTE data) { | |||
//删除子属性 | |||
removeSubAttribute(position,data); | |||
} | |||
}); | |||
viewBinding.listSubattribute.setAdapter(subattributeAdapter); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
//下拉选择 | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter = new ArrayAdapter<>(context, R.layout.spinner_text_item, classifyNameList); | |||
LogUtils.d(" initView classifyNameList="+classifyNameList); | |||
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
viewBinding.spinnerClassify.setAdapter(spinnerAdapter); | |||
viewBinding.spinnerClassify.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
isUserClicked = true; | |||
view.performClick(); | |||
return false; | |||
} | |||
}); | |||
viewBinding.spinnerClassify.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
if (isUserClicked)//不是用户点击返回 | |||
{ | |||
selectClassify(i); | |||
isUserClicked = false; | |||
} | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
} | |||
}); | |||
} | |||
@SuppressLint("NonConstantResourceId") | |||
@OnClick({R.id.btn_add_classify,R.id.btn_update_classify,R.id.btn_add_attribute, | |||
R.id.btn_delete_attribute,R.id.btn_add_subattribute,R.id.btn_delete_classify}) | |||
public void onViewClicked(View view) { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
switch (view.getId()){ | |||
case R.id.btn_add_classify://添加分类 | |||
addClassify(); | |||
break; | |||
case R.id.btn_update_classify: | |||
updateClassify(); | |||
break; | |||
case R.id.btn_delete_classify://删除分类 | |||
removeClassify(); | |||
break; | |||
case R.id.btn_add_attribute://添加属性 | |||
addAttribute(); | |||
break; | |||
case R.id.btn_delete_attribute://删除属性 | |||
removeAttribute(); | |||
break; | |||
case R.id.btn_update_attribute://删除属性 | |||
updateAttribute(); | |||
break; | |||
case R.id.btn_add_subattribute://添加子属性 | |||
addSubAttribute(); | |||
break; | |||
} | |||
} | |||
/** | |||
* 添加分类 | |||
*/ | |||
private void addClassify(){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_add_classify, (layoutView, xCom) -> { | |||
DialogAddClassifyBinding binding = DialogAddClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText(getString(R.string.top_addclass)); | |||
binding.edit.setHint(getString(R.string.info_addclass)); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for (Map.Entry<String, String> entry : classifyList.entrySet()) { | |||
if(entry.getKey().equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该属性分类,请换一个名称!","This class already exists, please change its name!"); | |||
return; | |||
} | |||
} | |||
BPA_PROPERTY_CLASSIFY goodsClassify = new BPA_PROPERTY_CLASSIFY(); | |||
goodsClassify.name = input; | |||
if(PropClassifyDBUtil.add(goodsClassify)){ | |||
classifyList.put(input,goodsClassify.id); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyList.size()-1);//更新数据 | |||
NewToastUtil.getInstance().showToast("添加["+input+"]分类成功!","Add ["+input+"] Success!"); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "添加["+input+"]属性分类成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("添加["+input+"]属性分类失败!","Add ["+input+"] Fail!"); | |||
} | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!","The name cannot be empty!"); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 修改分类 | |||
*/ | |||
private void updateClassify(){ | |||
if(classifyPosition == 0){ | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_name, (layoutView, xCom) -> { | |||
DialogAddNameBinding binding = DialogAddNameBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString(); | |||
binding.title.setText("修改分类名称"); | |||
binding.edit.setText(classifyName); | |||
binding.btnClose.setOnClickListener(v->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for (Map.Entry<String, String> entry : classifyList.entrySet()) { | |||
if(entry.getKey().equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该分类,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
BPA_PROPERTY_CLASSIFY goodsClassify = PropClassifyDBUtil.getById(classifyId); | |||
goodsClassify.name = input; | |||
PropClassifyDBUtil.update(goodsClassify); | |||
classifyList.remove(classifyName); | |||
classifyList.put(input,classifyId); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyList.size()-1);//更新数据 | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "修改["+input+"]分类成功!"); | |||
NewToastUtil.getInstance().showToast("修改["+input+"]分类成功!"); | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 删除分类 | |||
*/ | |||
private void removeClassify(){ | |||
if(classifyPosition>0){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String classifyName = viewBinding.spinnerClassify.getSelectedItem().toString(); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("删除分类名称"); | |||
binding.edit.setText("是否删除["+classifyName+"]分类下所有商品及属性?"); | |||
binding.cancel.setOnClickListener(view1 ->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
if(GoodsClassifyDBUtil.deleteById(classifyId)){ | |||
GoodsClassifyDBUtil.DeleteList(GoodsClassifyDBUtil.getListByName(classifyName)); | |||
AttributeDBUtil.deleteByClassifyId(classifyId); | |||
GoodsDBUtil.deleteByPropClassifyId(classifyId); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(classifyId); | |||
SubAttributeDBUtil.deleteByClassifyId(classifyId); | |||
classifyList.remove(classifyName); | |||
classifyNameList.clear(); | |||
classifyNameList.addAll(classifyList.keySet()); | |||
spinnerAdapter.notifyDataSetChanged(); | |||
selectClassify(classifyPosition-1);//更新数据 | |||
NewToastUtil.getInstance().showToast("删除["+classifyName+"]分类成功!"); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "删除["+classifyName+"]分类成功!"); | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("删除["+classifyName+"]分类失败!"); | |||
} | |||
}); | |||
}); | |||
} | |||
} | |||
/** | |||
* 添加属性 | |||
*/ | |||
private void addAttribute(){ | |||
if(attributeList.size()>=6){ | |||
NewToastUtil.getInstance().showToast("属性已达到上限"); | |||
return; | |||
} | |||
if(classifyPosition==0){ | |||
return; | |||
} | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
if(GoodsDBUtil.getClassifyId(classifyId)!=null){ | |||
AlertDialogUtils.showTipDialog((AppCompatActivity)getActivity(), "注意", "添加属性将会影响当前分类下所有菜品,请确保该分类下没有商品再操作", | |||
new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
} | |||
@Override | |||
public void onCancel() { | |||
} | |||
}); | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_name, (layoutView, xCom) -> { | |||
DialogAddNameBinding binding = DialogAddNameBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("新增属性名称"); | |||
binding.edit.setHint("请输入属性名称"); | |||
binding.btnClose.setOnClickListener(v->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for(BPA_ATTRIBUTE bean:attributeList){ | |||
if(bean.name.equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该属性,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
BPA_ATTRIBUTE attribute = new BPA_ATTRIBUTE(); | |||
attribute.name = input; | |||
attribute.classifyId = classifyId; | |||
AttributeDBUtil.add(attribute); | |||
xCom.dismissX(); | |||
attributeList.add(attribute); | |||
attributePosition = attributeList.size()-1; | |||
attributeAdapter.setSelectPosition(attributeList.size()-1); | |||
viewBinding.listAttribute.smoothScrollToPosition(attributePosition); | |||
attributeAdapter.notifyDataSetChanged(); | |||
subattributeList.clear(); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "新增["+input+"]属性成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 删除属性 | |||
*/ | |||
private void removeAttribute(){ | |||
if(classifyPosition==0){ | |||
return; | |||
} | |||
String classifyId1 = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
if(GoodsDBUtil.getClassifyId(classifyId1)!=null){ | |||
AlertDialogUtils.showTipDialog((AppCompatActivity)getActivity(), "警告", "删除属性将会影响当前分类下所有菜品,请确保该分类下没有商品再操作", | |||
new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
} | |||
@Override | |||
public void onCancel() { | |||
} | |||
}); | |||
return; | |||
} | |||
if(attributePosition>=0&&attributePosition<attributeList.size()){ | |||
BPA_ATTRIBUTE attribute = attributeList.get(attributePosition); | |||
//判断是否绑定了属性 | |||
List<BPA_SUBATTRIBUTE> subattributes = SubAttributeDBUtil.getByParentAttributeId(attribute.id); | |||
for(BPA_SUBATTRIBUTE bean : subattributes){ | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String goodName = SubAttributeGroupDBUtil.isIncludeByClassify(classifyId,bean.name); | |||
if(!goodName.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品"); | |||
return; | |||
} | |||
} | |||
AttributeDBUtil.delete(attribute); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "删除["+attribute.name+"]属性成功!"); | |||
if(attributePosition-1>=0){ | |||
attributeList.remove(attributePosition); | |||
attributePosition = attributePosition-1; | |||
attributeAdapter.setSelectPosition(attributePosition); | |||
subattributeList.clear(); | |||
subattributeList.addAll(SubAttributeDBUtil.getByParentAttributeId(attributeList.get(attributePosition).id)); | |||
}else { | |||
attributeList.clear(); | |||
subattributeList.clear(); | |||
} | |||
attributeAdapter.notifyDataSetChanged(); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
} | |||
} | |||
/** | |||
* 修改属性 | |||
*/ | |||
private void updateAttribute(){ | |||
if(classifyPosition==0){ | |||
return; | |||
} | |||
if(attributePosition>=0&&attributePosition<attributeList.size()){ | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_name, (layoutView, xCom) -> { | |||
DialogAddNameBinding binding = DialogAddNameBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("修改属性名称"); | |||
binding.edit.setHint("请输入属性名称"); | |||
binding.btnClose.setOnClickListener(v->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.edit.setText(attributeList.get(attributePosition).name); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for(BPA_ATTRIBUTE bean:attributeList){ | |||
if(bean.name.equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该属性,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
BPA_ATTRIBUTE attribute = attributeList.get(attributePosition); | |||
attribute.name = input; | |||
AttributeDBUtil.update(attribute); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "修改["+attribute.name+"]属性成功!"); | |||
attributeAdapter.notifyDataSetChanged(); | |||
xCom.dismissX(); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
} | |||
} | |||
/** | |||
* 添加子属性 | |||
*/ | |||
private void addSubAttribute(){ | |||
if(classifyPosition==0){ | |||
return; | |||
} | |||
if(attributeList.size()<=0){ | |||
NewToastUtil.getInstance().showToast("请先添加属性"); | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity)getActivity(), R.layout.dialog_add_name, (layoutView, xCom) -> { | |||
DialogAddNameBinding binding = DialogAddNameBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("新增子属性名称"); | |||
binding.edit.setHint("请输入子属性名称"); | |||
binding.btnClose.setOnClickListener(v->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
return; | |||
} | |||
BPA_ATTRIBUTE attribute = attributeList.get(attributePosition); | |||
String input = String.valueOf(binding.edit.getText()); | |||
if(!input.isEmpty()){ | |||
for(BPA_SUBATTRIBUTE bean:subattributeList){ | |||
if(bean.name.equals(input)){ | |||
NewToastUtil.getInstance().showToast("已有该子属性,请换一个名称!"); | |||
return; | |||
} | |||
} | |||
BPA_SUBATTRIBUTE subattribute = new BPA_SUBATTRIBUTE(); | |||
subattribute.name = input; | |||
subattribute.parentAttributeId = attribute.id; | |||
SubAttributeDBUtil.add(subattribute); | |||
xCom.dismissX(); | |||
subattributeList.add(subattribute); | |||
subattributeAdapter.notifyDataSetChanged(); | |||
viewBinding.listSubattribute.smoothScrollToPosition(subattributeList.size()-1); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "新增["+subattribute.name+"]子属性成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("名称不能为空!"); | |||
} | |||
}); | |||
}); | |||
} | |||
/** | |||
* 删除子属性 | |||
*/ | |||
private void removeSubAttribute(int position,Object data){ | |||
BPA_SUBATTRIBUTE bean = (BPA_SUBATTRIBUTE) data; | |||
//判断是否绑定了属性 | |||
String classifyId = classifyList.get(viewBinding.spinnerClassify.getSelectedItem().toString()); | |||
String goodName = SubAttributeGroupDBUtil.isIncludeByClassify(classifyId,bean.name); | |||
if(!goodName.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("商品["+goodName+"]正在使用["+bean.name+"]属性,请先删除对应商品"); | |||
return; | |||
} | |||
SubAttributeDBUtil.delete(bean); | |||
RecordManager.getInstance().addLogRecord("角色操作日志", "删除["+bean.name+"]子属性成功!"); | |||
subattributeList.remove(position); | |||
if(position-1>=0 && !subattributeList.isEmpty()){ | |||
viewBinding.listSubattribute.smoothScrollToPosition(position-1); | |||
} | |||
subattributeAdapter.notifyDataSetChanged(); | |||
} | |||
@Override | |||
protected boolean canDragBack() { | |||
return false; | |||
} | |||
} |
@@ -1,8 +1,10 @@ | |||
package com.bonait.bnframework.newui.http; | |||
import android.content.Context; | |||
import android.os.Environment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.Result.OperateResult; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.Model.upload.GoodsDataInfo; | |||
import com.bonait.bnframework.Model.upload.GoodsProcessDetail; | |||
@@ -10,11 +12,11 @@ import com.bonait.bnframework.Model.upload.MaterialDataInfo; | |||
import com.bonait.bnframework.Model.upload.ProcessModelBean; | |||
import com.bonait.bnframework.Model.upload.UpAttributeBean; | |||
import com.bonait.bnframework.Model.upload.UpClassifyBean; | |||
import com.bonait.bnframework.Model.upload.UpGoodsClassifyBean; | |||
import com.bonait.bnframework.Model.upload.UpResData; | |||
import com.bonait.bnframework.Model.upload.UploadRes; | |||
import com.bonait.bnframework.business.RecordManager; | |||
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_ATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
@@ -22,17 +24,20 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
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_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL_TYPE; | |||
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_PROPERTY_CLASSIFY; | |||
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; | |||
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.helper.I.IRunT; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.newui.widget.NewToastUtil; | |||
@@ -47,8 +52,8 @@ import org.json.JSONException; | |||
import org.json.JSONObject; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import okhttp3.MediaType; | |||
@@ -63,17 +68,20 @@ public class UpdateAllDataService { | |||
private static String path = UpdateDataService.path; | |||
private static String key = UpdateDataService.key; | |||
public static void startUpLoadAll(Context context){ | |||
if(ConfigName.getInstance().isFast2Click()){ | |||
NewToastUtil.getInstance().showToast("点击太快了"); | |||
public static void startUpLoadAll(List<BPA_GOODS> goods,Context context){ | |||
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"); | |||
if(UpdateDataService.isDownProcessModel){ | |||
upLoadMaterial(context); | |||
upLoadMaterial(goods,context); | |||
}else { | |||
downLoadProcessModel(context); | |||
downLoadProcessModel(goods,context); | |||
} | |||
}catch (Exception e){ | |||
NewToastUtil.getInstance().showToastError("异常 "+e.getMessage()); | |||
@@ -85,15 +93,16 @@ public class UpdateAllDataService { | |||
} | |||
} | |||
/** | |||
* 下载云端工艺模型 | |||
* @param context | |||
*/ | |||
private static void downLoadProcessModel( Context context){ | |||
private static void downLoadProcessModel(List<BPA_GOODS> goods, Context context){ | |||
try{ | |||
String url = "http://"+path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
WaitProcessUtil.getInstance().show(context,"匹配工艺模型","正在同步云端工艺模型..."); | |||
String url = path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
if(context!=null){ | |||
WaitProcessUtil.getInstance().Show("正在同步云端工艺模型...","Synchronizing cloud process models..."); | |||
} | |||
HashMap<String,String> params = new HashMap<>(); | |||
params.put("autokey",ConfigName.getInstance().DeviceAutoKey); | |||
String body = new Gson().toJson(params); | |||
@@ -101,9 +110,7 @@ public class UpdateAllDataService { | |||
headers.put("key", key); | |||
OkGo.<ProcessModelBean>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
body)) | |||
.upRequestBody( RequestBody.create(MediaType.parse("application/json; charset=utf-8"),body)) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<ProcessModelBean>(context) { | |||
@Override | |||
@@ -151,7 +158,6 @@ public class UpdateAllDataService { | |||
JSONObject jsonObject = array.getJSONObject(i); | |||
actions.add(jsonObject.optString("actionValueName")); | |||
} | |||
} catch (JSONException e) { | |||
throw new RuntimeException(e); | |||
} | |||
@@ -168,13 +174,13 @@ public class UpdateAllDataService { | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESSModel.class,null); | |||
ProcessModelUtil.addProcessList(processeList); | |||
ProcessModelUtil.addProcessModelList(processModelList); | |||
upLoadMaterial(context); | |||
downLoadProcessModel2(goods,context); | |||
} | |||
@Override | |||
public void onError(Response<ProcessModelBean> response) { | |||
super.onError(response); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
NewToastUtil.getInstance().showToastError("下载工艺模型失败 "+response.message()); | |||
LogUtils.d("下载工艺模型失败 "+response.message()); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-下载工艺模型失败"); | |||
@@ -185,39 +191,88 @@ public class UpdateAllDataService { | |||
} | |||
} | |||
private static void upLoadMaterial(Context context){ | |||
try { | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传物料信息,请耐心稍等..."); | |||
List<BPA_MATERIAL> materials = MaterialUtil.GetMaterialALL(); | |||
List<MaterialDataInfo> upMaterialBean = new ArrayList<>(); | |||
for(BPA_MATERIAL material:materials){ | |||
upMaterialBean.add(new MaterialDataInfo(material.id,material.name,"液体料","")); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Material/AddMaterial"; | |||
private static void downLoadProcessModel2(List<BPA_GOODS> goods, Context context){ | |||
try{ | |||
String url = path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
HashMap<String,String> params = new HashMap<>(); | |||
params.put("autokey",ConfigName.getInstance().DeviceAutoKey); | |||
String body = new Gson().toJson(params); | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
OkGo.<ProcessModelBean>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(upMaterialBean))) | |||
.upRequestBody( RequestBody.create(MediaType.parse("application/json; charset=utf-8"),body)) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
.execute(new JsonDialogCallback<ProcessModelBean>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-批量上传物料信息成功"); | |||
NewToastUtil.getInstance().showToast("批量上传物料信息成功"); | |||
upLoadClassifyInfo(context); | |||
public void onSuccess(Response<ProcessModelBean> response) { | |||
LogUtils.d("下载工艺模型成功"); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-成功"); | |||
List<BPA_PROCESS> processeList = new ArrayList<>(); | |||
List<BPA_PROCESSModel> processModelList = new ArrayList<>(); | |||
ProcessModelBean processModelBean = response.body(); | |||
int pos = 1; | |||
if(processModelBean!=null && processModelBean.data!=null){ | |||
for(ProcessModelBean.ProcessModelData processModelData:processModelBean.data){ | |||
BPA_PROCESS process = new BPA_PROCESS(); | |||
process.id = processModelData.id; | |||
process.name = processModelData.name; | |||
process.sort = pos; | |||
pos++; | |||
processeList.add(process); | |||
if(processModelData.actionList!=null){ | |||
for(ProcessModelBean.ProcessModelData.ActionListBean actionListBean: processModelData.actionList){ | |||
BPA_PROCESSModel processModel = new BPA_PROCESSModel(); | |||
processModel.id = actionListBean.id; | |||
processModel.processid = processModelData.id; | |||
processModel.name = actionListBean.actionName; | |||
processModel.sort = actionListBean.sort; | |||
if(actionListBean.actionType!=null){ | |||
switch (actionListBean.actionType){ | |||
case "text": | |||
processModel.datatype = 1; | |||
break; | |||
case "select": | |||
processModel.datatype = 2; | |||
break; | |||
case "digit": | |||
processModel.datatype = 0; | |||
break; | |||
} | |||
} | |||
if(actionListBean.actionValue!=null && !actionListBean.actionValue.isEmpty()){ | |||
List<String> actions = new ArrayList<>(); | |||
try { | |||
JSONArray array = new JSONArray(actionListBean.actionValue); | |||
for (int i = 0; array != null && i < array.length(); i++){ | |||
JSONObject jsonObject = array.getJSONObject(i); | |||
actions.add(jsonObject.optString("actionValueName")); | |||
} | |||
} catch (JSONException e) { | |||
throw new RuntimeException(e); | |||
} | |||
if(!actions.isEmpty()){ | |||
processModel.data = actions.toString(); | |||
} | |||
} | |||
processModelList.add(processModel); | |||
} | |||
} | |||
} | |||
} | |||
ProcessModelUtil.addProcessList(processeList); | |||
ProcessModelUtil.addProcessModelList(processModelList); | |||
upLoadMaterial(goods,context); | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
public void onError(Response<ProcessModelBean> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-批量上传物料信息失败"); | |||
NewToastUtil.getInstance().showToastError("批量上传物料信息失败 "+response.message()); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
NewToastUtil.getInstance().showToastError("下载工艺模型失败 "+response.message()); | |||
LogUtils.d("下载工艺模型失败 "+response.message()); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-下载工艺模型失败"); | |||
} | |||
}); | |||
}catch (Exception e){ | |||
@@ -226,229 +281,314 @@ public class UpdateAllDataService { | |||
} | |||
private static void upLoadClassifyInfo(Context context){ | |||
try { | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传所有分类信息,请耐心稍等..."); | |||
List<BPA_GOODS_CLASSIFY> classifys = GoodsClassifyDBUtil.getAll(); | |||
if(classifys.isEmpty()){ | |||
WaitProcessUtil.getInstance().dismiss(); | |||
return; | |||
/** | |||
* 接口请求数据的验证 | |||
* @param response 接口返回的消息体 | |||
* @param typeInfo 接口请求提示的消息类型 | |||
* @param url 接口请求的Url | |||
* @return | |||
*/ | |||
private static OperateResult Analysis(Context context, Response<UploadRes<UpResData>> response, String typeInfo, String url){ | |||
boolean isSuccess = true; | |||
StringBuffer names = new StringBuffer(); | |||
String errorMsg =""; | |||
if(response.body().statusCode == 200){ | |||
for(UpResData upResData:response.body().data){ | |||
if (upResData.code>30000){ | |||
isSuccess = false; | |||
names.append("[").append(upResData.name).append("]"); | |||
errorMsg=upResData.message; | |||
} | |||
} | |||
}else{ | |||
isSuccess = false; | |||
} | |||
List<UpClassifyBean> upClassifyBeans = new ArrayList<>(); | |||
if(!isSuccess){ | |||
NewToastUtil.getInstance().showToastError(errorMsg+"-"+names.toString()); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传"+typeInfo+"失败-重复数据-"+names); | |||
WaitProcessUtil.getInstance().Dismiss(context,"上传"+typeInfo+"失败",errorMsg); | |||
return OperateResult.CreateFailed(""); | |||
}else{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传"+typeInfo+"成功"); | |||
NewToastUtil.getInstance().showToast("上传物料信息成功"); | |||
return OperateResult.CreateSuccess(); | |||
} | |||
} | |||
private static void Post(String url, Context context, Object data, String typeInfo, IRunT<Response<UploadRes<UpResData>>> Success){ | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"),new Gson().toJson(data))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
if(Success!=null)Success.Run(response); | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传"+typeInfo+"失败"); | |||
NewToastUtil.getInstance().showToastError("上传"+typeInfo+"失败:"+response.message()); | |||
WaitProcessUtil.getInstance().Dismiss(context,"上传"+typeInfo+"失败",response.message()); | |||
} | |||
}); | |||
} | |||
private static void upLoadMaterial(List<BPA_GOODS> goods,Context context){ | |||
try { | |||
WaitProcessUtil.getInstance().Show("正在上传物料信息,请耐心稍等...","Material information is in progress, please be patient and wait for a moment"); | |||
List<BPA_MATERIAL> materials = MaterialUtil.GetMaterialALL(); | |||
for(int i=0;i<classifys.size();i++){ | |||
UpClassifyBean upClassifyBean = new UpClassifyBean(); | |||
upClassifyBean.pid = "0"; | |||
upClassifyBean.name = classifys.get(i).name; | |||
upClassifyBean.sort = 0; | |||
upClassifyBeans.add(upClassifyBean); | |||
List<MaterialDataInfo> upMaterialBean = new ArrayList<>(); | |||
BPA_MATERIAL_TYPE materialType = MaterialUtil.GetMaterialTypeByName("液体料"); | |||
for(BPA_MATERIAL material:materials){ | |||
upMaterialBean.add(new MaterialDataInfo(material.id,material.name,"液体料",materialType.id)); | |||
} | |||
String url = path+"/api/ExternalPlatform/Material/AddMaterial"; | |||
Post(url,context,upMaterialBean,"物料信息",(response->{ | |||
Analysis(context,response,"物料信息",url).OnSource(()->{ | |||
upLoadClassifyInfo(goods,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(upClassifyBeans))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-批量上传分类信息成功"); | |||
NewToastUtil.getInstance().showToast("批量上传分类信息成功"); | |||
upLoadAttribute(context); | |||
} | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-批量上传分类信息失败"); | |||
NewToastUtil.getInstance().showToastError("批量上传分类信息失败 "+response.message()); | |||
} | |||
}); | |||
/** | |||
* 商品分类 | |||
* @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 = 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..."); | |||
List<UpClassifyBean> upClassifyBeans = new ArrayList<>(); | |||
goods.forEach(good->{ | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(good.propClassifyId); | |||
if(classify!=null){ | |||
UpClassifyBean upClassifyBean = new UpClassifyBean(); | |||
upClassifyBean.id = classify.id; | |||
upClassifyBean.name = classify.name; | |||
upClassifyBean.sort = 0; | |||
upClassifyBean.remark = ""; | |||
upClassifyBeans.add(upClassifyBean); | |||
} | |||
}); | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
Post(url,context,upClassifyBeans,"属性分类信息",(response->{ | |||
Analysis(context,response,"属性分类信息",url).OnSource(()->{ | |||
upLoadAttribute(upClassifyBeans,goods,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
} | |||
private static void upLoadAttribute(Context context){ | |||
private static void upLoadAttribute(List<UpClassifyBean> upClassifyBeans,List<BPA_GOODS> goods,Context context){ | |||
try { | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传所有分类属性,请耐心稍等..."); | |||
List<BPA_GOODS_CLASSIFY> classifys = GoodsClassifyDBUtil.getAll(); | |||
WaitProcessUtil.getInstance().Show("正在上传分类属性信息,请耐心稍等...","Uploading classified attribute information, please wait..."); | |||
List<UpAttributeBean> upAttributeBeans = new ArrayList<>(); | |||
for(BPA_GOODS_CLASSIFY classify1:classifys){ | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(classify1.id); | |||
for(BPA_ATTRIBUTE bean:attributes){ | |||
upClassifyBeans.forEach(ucb->{ | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(ucb.id); | |||
attributes.forEach(bean->{ | |||
UpAttributeBean upAttributeBean = new UpAttributeBean(); | |||
upAttributeBean.setAttributeName(bean.name); | |||
upAttributeBean.setGoodsTypeName(classify1.name); | |||
upAttributeBean.attributeName = (bean.name); | |||
upAttributeBean.id = bean.id; | |||
upAttributeBean.goodsTypeName = (ucb.name); | |||
upAttributeBean.goodsTypeId = ucb.id; | |||
upAttributeBean.sort = 1; | |||
List<BPA_SUBATTRIBUTE> subattributes = SubAttributeDBUtil.getByParentAttributeId(bean.id); | |||
for(BPA_SUBATTRIBUTE subattribute:subattributes){ | |||
upAttributeBean.goodsAttributeValue.add(new UpAttributeBean.GoodsAttributeValueBean(subattribute.name,subattribute.sort)); | |||
upAttributeBean.goodsAttributeValueList.add(new UpAttributeBean.GoodsAttributeValueBean(subattribute.id,subattribute.name,subattribute.sort)); | |||
} | |||
upAttributeBeans.add(upAttributeBean); | |||
} | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsAttribute"; | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(upAttributeBeans))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
NewToastUtil.getInstance().showToast("批量上传分类属性信息成功"); | |||
upLoadGoodsInfo(context); | |||
} | |||
}); | |||
}); | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsAttribute"; | |||
Post(url,context,upAttributeBeans,"分类属性信息",(response->{ | |||
Analysis(context,response,"分类属性信息",url).OnSource(()->{ | |||
upLoadGoodsInfo(goods,context); | |||
}); | |||
})); | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-批量上传商品基础信息失败"); | |||
NewToastUtil.getInstance().showToastError("批量上传分类属性信息失败 "+response.message()); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
}); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
} | |||
private static void upLoadGoodsInfo(Context context){ | |||
private static void upLoadGoodsInfo(List<BPA_GOODS> goods,Context context){ | |||
try { | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传所有商品信息,请耐心稍等..."); | |||
List<BPA_GOODS> goods = GoodsDBUtil.getAll(); | |||
WaitProcessUtil.getInstance().Show("正在上传商品信息,请耐心稍等...","Uploading product information, please be patient for a moment"); | |||
List<GoodsDataInfo> upMaterialBean = new ArrayList<>(); | |||
for(BPA_GOODS good : goods){ | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(good.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(good.propClassifyId); | |||
if(classify!=null){ | |||
upMaterialBean.add(new GoodsDataInfo(good.id,good.name,"",good.url,0,false,good.classifyId, | |||
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"; | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(upMaterialBean))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-批量上传商品基础信息成功"); | |||
NewToastUtil.getInstance().showToast("批量上传商品基础信息成功"); | |||
upLoadDetailInfo(context); | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-批量上传商品基础信息失败"); | |||
NewToastUtil.getInstance().showToastError("批量上传商品基础信息失败 "+response.message()); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
}); | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
Post(url,context,upMaterialBean,"商品基础信息",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品基础信息成功"); | |||
NewToastUtil.getInstance().showToast("上传商品基础信息成功"); | |||
upLoadDetailInfo(goods,context); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
} | |||
private static void upLoadDetailInfo(Context context){ | |||
private static void upLoadDetailInfo(List<BPA_GOODS> goodsList,Context context){ | |||
try { | |||
List<GoodsProcessDetail> goodsProcessDetailList = new ArrayList<>(); | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传工艺信息,请耐心稍等..."); | |||
List<BPA_GOODS> goodsList = GoodsDBUtil.getAll(); | |||
WaitProcessUtil.getInstance().Show("正在上传工艺信息,请耐心稍等...","Uploading process information, please wait..."); | |||
for(BPA_GOODS goods:goodsList){ | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
assert classify != null; | |||
BPA_GOODS_CLASSIFY goodClassify = GoodsClassifyDBUtil.getById(goods.goodClassifyid); | |||
assert goodClassify != null; | |||
GoodsProcessDetail goodsProcessDetail = new GoodsProcessDetail(); | |||
goodsProcessDetail.goodsId = goods.id; | |||
goodsProcessDetail.deviceId = goodClassify.type==0?ConfigName.getInstance().DeviceAutoKey2:ConfigName.getInstance().DeviceAutoKey; | |||
goodsProcessDetail.goodsName = goods.name; | |||
goodsProcessDetail.deviceName = "中大型炒锅500"; | |||
goodsProcessDetail.warehousrTemplateId = ""; | |||
goodsProcessDetail.warehousrTemplateName = ""; | |||
List<GoodsProcessDetail.TechnologyActionList> technologyActionLists = new ArrayList<>(); | |||
List<BPA_GOODS_SUBATTRIBUTE_GROUP> groups = SubAttributeGroupDBUtil.getByGoodsId(goods.id); | |||
List<BPA_GOODS_PROCESS_DETAIL> goodsProcessDetails = new ArrayList<>(); | |||
for(BPA_GOODS_SUBATTRIBUTE_GROUP group:groups){ | |||
goodsProcessDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(group.id)); | |||
} | |||
for(BPA_GOODS_PROCESS_DETAIL bean : goodsProcessDetails){ | |||
GoodsProcessDetail.TechnologyActionList technologyActionList = new GoodsProcessDetail.TechnologyActionList(); | |||
technologyActionList.id = bean.id; | |||
technologyActionList.sort = bean.sort+""; | |||
technologyActionList.stepName = bean.processname; | |||
BPA_PROCESS process = ProcessModelUtil.getProcessByName(bean.processname); | |||
if(process!=null){ | |||
technologyActionList.chnologyId = process.id; | |||
BPA_GOODS_SUBATTRIBUTE_GROUP goodsSubattributeGroup = SubAttributeGroupDBUtil.getById(bean.goodsSubAttributeGroupId); | |||
if(goodsSubattributeGroup!=null){ | |||
technologyActionList.goodsAttributeId = goodsSubattributeGroup.subAttributeIdList; | |||
} | |||
HashMap<String,String> processModel = new LinkedHashMap<>(); | |||
List<BPA_PROCESSModel> processModelList = QueryDB.GetProcessModelALL(); | |||
for(BPA_PROCESSModel bean : processModelList){ | |||
processModel.put(bean.name,bean.id); | |||
} | |||
// for(BPA_GOODS_PROCESS_DETAIL bean : goodsProcessDetails){ | |||
// List<GoodsProcessDetail.ActionJson> actionJson = new ArrayList<>(); | |||
// List<String> data = new ArrayList<>(); | |||
// if (bean.processvalue.contains("|")) { | |||
// String[] res = bean.processvalue.split("[|]"); | |||
// data.addAll(Arrays.asList(res)); | |||
// } else { | |||
// data.add(bean.processvalue); | |||
// } | |||
// int index = 0; | |||
// for (String item : data) { | |||
// if (item.contains(",")) { | |||
// String[] wl = item.split("[,]"); | |||
// if (wl.length == 2) { | |||
// String name = wl[0]; | |||
// String val = wl[1]; | |||
// actionJson.add(new GoodsProcessDetail.ActionJson(name,val,"",index)); | |||
// index++; | |||
// } | |||
// | |||
// } | |||
// } | |||
// GoodsProcessDetail goodsProcessDetail = new GoodsProcessDetail(bean.id,bean.processname,bean.goodsSubAttributeGroupId, | |||
// "",bean.sort+"",goods.id,ConfigName.getInstance().DeviceAutoKey,""); | |||
// goodsProcessDetail.setActionJson(actionJson); | |||
// goodsProcessDetailList.add(goodsProcessDetail); | |||
// } | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(goodsProcessDetailList))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功"); | |||
NewToastUtil.getInstance().showToastError("上传商品工艺成功"); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
List<GoodsProcessDetail.TechnologyActionList.ActionJson> actionJson = new ArrayList<>(); | |||
List<String> data = new ArrayList<>(); | |||
if (bean.processvalue.contains("|")) { | |||
String[] res = bean.processvalue.split("[|]"); | |||
data.addAll(Arrays.asList(res)); | |||
} else { | |||
data.add(bean.processvalue); | |||
} | |||
int index = 0; | |||
for (String item : data) { | |||
if (item.contains(",")) { | |||
if(bean.processname.equals("液体料")){ | |||
String[] wl = item.split("[,]"); | |||
if (wl.length == 2) { | |||
//液体料单独处理 | |||
String name = wl[0]; | |||
String val = wl[1]; | |||
BPA_PROCESSModel model = ProcessModelUtil.getProcessModelByName(process.id,"物料名称"); | |||
if(model!=null){ | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson("物料名称",name,model.id,index)); | |||
index++; | |||
BPA_PROCESSModel model2 = ProcessModelUtil.getProcessModelByName(process.id,"重量"); | |||
if(model2==null){ | |||
model2 = ProcessModelUtil.getProcessModelByName(process.id,"物料重量"); | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson("物料重量",val,model2.id,index)); | |||
}else { | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson("重量",val,model2.id,index)); | |||
} | |||
}else { | |||
NewToastUtil.getInstance().showToastError(name+"液体料工序上传失败"); | |||
RecordManager.getInstance().addLogRecord("数据接收", name+"-液体料工序上传失败"); | |||
} | |||
} | |||
}else{ | |||
String[] wl = item.split("[,]"); | |||
if (wl.length == 2) { | |||
String name = wl[0]; | |||
String val = wl[1]; | |||
BPA_PROCESSModel model = ProcessModelUtil.getProcessModelByName(process.id,name); | |||
if(model!=null) | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(name,val,model.id,index)); | |||
index++; | |||
} | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺失败"); | |||
NewToastUtil.getInstance().showToastError("上传商品工艺失败 "+response.message()); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
} | |||
}); | |||
technologyActionList.actionJson = actionJson; | |||
technologyActionLists.add(technologyActionList); | |||
} | |||
} | |||
goodsProcessDetail.technologyActionList = technologyActionLists; | |||
goodsProcessDetailList.add(goodsProcessDetail); | |||
} | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsTechnologyAction"; | |||
Post(url,context,goodsProcessDetailList,"商品工艺",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功"); | |||
NewToastUtil.getInstance().showToast("上传商品工艺成功"); | |||
Analysis(context,response,"商品工艺",url).OnSource(()->{ | |||
upLoadGoodsClassifyInfo(goodsList,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
} | |||
} | |||
@@ -1,9 +1,10 @@ | |||
package com.bonait.bnframework.newui.http; | |||
import android.content.Context; | |||
import android.os.Environment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.HBL.API.APIHelper; | |||
import com.bonait.bnframework.HBL.Result.OperateResult; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.Model.upload.GoodsDataInfo; | |||
import com.bonait.bnframework.Model.upload.GoodsProcessDetail; | |||
@@ -11,6 +12,7 @@ import com.bonait.bnframework.Model.upload.MaterialDataInfo; | |||
import com.bonait.bnframework.Model.upload.ProcessModelBean; | |||
import com.bonait.bnframework.Model.upload.UpAttributeBean; | |||
import com.bonait.bnframework.Model.upload.UpClassifyBean; | |||
import com.bonait.bnframework.Model.upload.UpGoodsClassifyBean; | |||
import com.bonait.bnframework.Model.upload.UpResData; | |||
import com.bonait.bnframework.Model.upload.UploadRes; | |||
import com.bonait.bnframework.business.RecordManager; | |||
@@ -22,8 +24,10 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
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_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL_TYPE; | |||
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_PROPERTY_CLASSIFY; | |||
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; | |||
@@ -31,11 +35,12 @@ 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; | |||
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.helper.I.IRunT; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.newui.widget.NewToastUtil; | |||
import com.bonait.bnframework.newui.widget.WaitProcessUtil; | |||
import com.google.gson.Gson; | |||
@@ -43,6 +48,7 @@ import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
import com.lzy.okgo.model.Response; | |||
import org.greenrobot.eventbus.EventBus; | |||
import org.json.JSONArray; | |||
import org.json.JSONException; | |||
import org.json.JSONObject; | |||
@@ -61,8 +67,9 @@ import okhttp3.RequestBody; | |||
* @date: 2024/7/25 14:55. | |||
*/ | |||
public class UpdateDataService { | |||
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 = ""; | |||
public static boolean isDownProcessModel = false;//是否同步了云端工艺模型 | |||
public static void startUpLoad(BPA_GOODS good, Context context){ | |||
@@ -70,6 +77,7 @@ public class UpdateDataService { | |||
if(good!=null){ | |||
//等待弹窗 | |||
try{ | |||
WaitProcessUtil.getInstance().Show(context,"商品上传","准备上传商品,请耐心稍等...","Product upload","Preparing to upload the product, please be patient for a moment"); | |||
if(isDownProcessModel){ | |||
upLoadMaterial(good.id,context,null); | |||
}else { | |||
@@ -80,10 +88,10 @@ public class UpdateDataService { | |||
}finally { | |||
} | |||
}else { | |||
NewToastUtil.getInstance().showToast("商品为空"); | |||
NewToastUtil.getInstance().showToast("商品为空","Goods empty!"); | |||
} | |||
}else { | |||
NewToastUtil.getInstance().showToast("无网络,请先连接网络"); | |||
NewToastUtil.getInstance().showToast("无网络,请先连接网络","No network exists. Please connect to the network first!"); | |||
} | |||
} | |||
@@ -93,8 +101,10 @@ public class UpdateDataService { | |||
*/ | |||
public static void downLoadProcessModel(String id, Context context){ | |||
try{ | |||
String url = "http://"+path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
WaitProcessUtil.getInstance().show(context,"匹配工艺模型","正在同步云端工艺模型..."); | |||
String url = path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
if(context!=null){ | |||
WaitProcessUtil.getInstance().Show("正在同步云端工艺模型...","Synchronizing cloud process models..."); | |||
} | |||
HashMap<String,String> params = new HashMap<>(); | |||
params.put("autokey",ConfigName.getInstance().DeviceAutoKey); | |||
String body = new Gson().toJson(params); | |||
@@ -145,20 +155,20 @@ public class UpdateDataService { | |||
break; | |||
} | |||
} | |||
if(actionListBean.actionValue!=null && !actionListBean.actionValue.isEmpty()){ | |||
List<String> actions = new ArrayList<>(); | |||
// processModel.data = ConfigName.GetProcessTypeVal(processModel.name); | |||
if(actionListBean.actionValue!=null && !actionListBean.actionValue.isEmpty()) { | |||
StringBuilder actions = new StringBuilder(); | |||
try { | |||
JSONArray array = new JSONArray(actionListBean.actionValue); | |||
for (int i = 0; array != null && i < array.length(); i++){ | |||
for (int i = 0; array != null && i < array.length(); i++) { | |||
JSONObject jsonObject = array.getJSONObject(i); | |||
actions.add(jsonObject.optString("actionValueName")); | |||
actions.append(jsonObject.optString("actionValueName")).append("、"); | |||
} | |||
} catch (JSONException e) { | |||
throw new RuntimeException(e); | |||
} | |||
if(!actions.isEmpty()){ | |||
processModel.data = actions.toString(); | |||
if(!actions.toString().isEmpty()){ | |||
processModel.data = actions.toString().substring(0,actions.length()-1); | |||
} | |||
} | |||
@@ -167,32 +177,22 @@ public class UpdateDataService { | |||
} | |||
} | |||
} | |||
// MainApplication.handler.post(new Runnable() { | |||
// @Override | |||
// public void run() { | |||
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESS.class,null); | |||
// DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESSModel.class,null); | |||
// ProcessModelUtil.addProcessList(processeList); | |||
// ProcessModelUtil.addProcessModelList(processModelList); | |||
// if(id!=null && !id.isEmpty()){ | |||
// upLoadMaterial(id,context,null); | |||
// } | |||
// } | |||
// }); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESS.class,null); | |||
DBHelper.getInstance(MainApplication.getContext()).DeleteCreateTables(BPA_PROCESSModel.class,null); | |||
ProcessModelUtil.addProcessList(processeList); | |||
ProcessModelUtil.addProcessModelList(processModelList); | |||
if(id!=null && !id.isEmpty()){ | |||
upLoadMaterial(id,context,null); | |||
} | |||
isDownProcessModel = true; | |||
downLoadProcessModel2(id, context); | |||
} | |||
@Override | |||
public void onError(Response<ProcessModelBean> response) { | |||
super.onError(response); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
if(context!=null){ | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
} | |||
NewToastUtil.getInstance().showToastError("下载工艺模型失败 "+response.message()); | |||
LogUtils.d("下载工艺模型失败 "+response.message()); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-下载工艺模型失败"); | |||
@@ -201,118 +201,272 @@ public class UpdateDataService { | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
} | |||
/** | |||
* 上传 | |||
* @param goodsId | |||
* 下载云端工艺模型 | |||
* @param context | |||
*/ | |||
private static void upLoadMaterial(String goodsId,Context context,List<MaterialDataInfo> upMaterialBean){ | |||
public static void downLoadProcessModel2(String id, Context context){ | |||
try{ | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传所有分类信息,请耐心稍等..."); | |||
List<BPA_MATERIAL> materials = MaterialUtil.GetMaterialALL(); | |||
if(upMaterialBean==null){ | |||
upMaterialBean = new ArrayList<>(); | |||
} | |||
for(BPA_MATERIAL material:materials){ | |||
upMaterialBean.add(new MaterialDataInfo(material.id,material.name,"液体料","g")); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Material/AddMaterial"; | |||
String body = new Gson().toJson(upMaterialBean); | |||
String url = path+"/api/ExternalPlatform/Device/GetDeviceTechnology"; | |||
HashMap<String,String> params = new HashMap<>(); | |||
params.put("autokey",ConfigName.getInstance().DeviceAutoKey2); | |||
String body = new Gson().toJson(params); | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
LogUtils.d("upLoadMaterial url="+url+" ;key="+key+";sign="+ APIHelper.GetSign("",key)+";headers="+headers.toString()); | |||
LogUtils.d("upLoadMaterial body="+body); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
LogUtils.d("downLoadProcessModel url="+url+" headers="+headers.toString()+" params="+params.toString()); | |||
OkGo.<ProcessModelBean>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
body)) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
.execute(new JsonDialogCallback<ProcessModelBean>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传分类信息成功"); | |||
NewToastUtil.getInstance().showToast("上传分类信息成功"); | |||
LogUtils.d("上传分类信息成功"); | |||
upLoadClassifyInfo(goodsId,context); | |||
public void onSuccess(Response<ProcessModelBean> response) { | |||
LogUtils.d("下载工艺模型成功"); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-成功"); | |||
List<BPA_PROCESS> processeList = new ArrayList<>(); | |||
List<BPA_PROCESSModel> processModelList = new ArrayList<>(); | |||
ProcessModelBean processModelBean = response.body(); | |||
int pos = 1; | |||
if(processModelBean!=null && processModelBean.data!=null){ | |||
for(ProcessModelBean.ProcessModelData processModelData:processModelBean.data){ | |||
BPA_PROCESS process = new BPA_PROCESS(); | |||
process.id = processModelData.id; | |||
process.name = processModelData.name; | |||
process.sort = pos; | |||
pos++; | |||
processeList.add(process); | |||
if(processModelData.actionList!=null){ | |||
for(ProcessModelBean.ProcessModelData.ActionListBean actionListBean: processModelData.actionList){ | |||
BPA_PROCESSModel processModel = new BPA_PROCESSModel(); | |||
processModel.id = actionListBean.id; | |||
processModel.processid = processModelData.id; | |||
processModel.name = actionListBean.actionName; | |||
processModel.sort = actionListBean.sort; | |||
if(actionListBean.actionType!=null){ | |||
switch (actionListBean.actionType){ | |||
case "text": | |||
processModel.datatype = 1; | |||
break; | |||
case "select": | |||
processModel.datatype = 2; | |||
break; | |||
case "digit": | |||
processModel.datatype = 0; | |||
break; | |||
} | |||
} | |||
// processModel.data = ConfigName.GetProcessTypeVal(processModel.name); | |||
if(actionListBean.actionValue!=null && !actionListBean.actionValue.isEmpty()) { | |||
StringBuilder actions = new StringBuilder(); | |||
try { | |||
JSONArray array = new JSONArray(actionListBean.actionValue); | |||
for (int i = 0; array != null && i < array.length(); i++) { | |||
JSONObject jsonObject = array.getJSONObject(i); | |||
actions.append(jsonObject.optString("actionValueName")).append("、"); | |||
} | |||
} catch (JSONException e) { | |||
throw new RuntimeException(e); | |||
} | |||
if(!actions.toString().isEmpty()){ | |||
processModel.data = actions.toString().substring(0,actions.length()-1); | |||
} | |||
} | |||
processModelList.add(processModel); | |||
} | |||
} | |||
} | |||
} | |||
ProcessModelUtil.addProcessList(processeList); | |||
ProcessModelUtil.addProcessModelList(processModelList); | |||
if(id!=null && !id.isEmpty()){ | |||
upLoadMaterial(id,context,null); | |||
} | |||
isDownProcessModel = true; | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
public void onError(Response<ProcessModelBean> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传物料信息失败"); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
NewToastUtil.getInstance().showToastError("上传物料信息失败 "+response.message()); | |||
LogUtils.d("上传物料信息失败 "+response.message()); | |||
if(context!=null){ | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
} | |||
NewToastUtil.getInstance().showToastError("下载工艺模型失败 "+response.message()); | |||
LogUtils.d("下载工艺模型失败 "+response.message()); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-下载工艺模型失败"); | |||
} | |||
}); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
} | |||
/** | |||
* 接口请求数据的验证 | |||
* @param response 接口返回的消息体 | |||
* @param typeInfo 接口请求提示的消息类型 | |||
* @param url 接口请求的Url | |||
* @return | |||
*/ | |||
private static OperateResult Analysis(Context context, Response<UploadRes<UpResData>> response, String typeInfo, String url){ | |||
boolean isSuccess = true; | |||
StringBuffer names = new StringBuffer(); | |||
String errorMsg =""; | |||
if(response.body().statusCode == 200){ | |||
for(UpResData upResData:response.body().data){ | |||
if (upResData.code>30000){ | |||
isSuccess = false; | |||
names.append("[").append(upResData.name).append("]"); | |||
errorMsg=upResData.message; | |||
} | |||
} | |||
}else{ | |||
isSuccess = false; | |||
} | |||
if(!isSuccess){ | |||
NewToastUtil.getInstance().showToastError(errorMsg+"-"+names.toString()); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传"+typeInfo+"失败-重复数据-"+names); | |||
WaitProcessUtil.getInstance().Dismiss(context,"上传"+typeInfo+"失败",errorMsg); | |||
return OperateResult.CreateFailed(""); | |||
}else{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传"+typeInfo+"成功"); | |||
NewToastUtil.getInstance().showToast("上传物料信息成功"); | |||
return OperateResult.CreateSuccess(); | |||
} | |||
} | |||
private static void Post(String url, Context context, Object data, String typeInfo, IRunT<Response<UploadRes<UpResData>>> Success){ | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody(RequestBody.create(MediaType.parse("application/json; charset=utf-8"),new Gson().toJson(data))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
if(Success!=null)Success.Run(response); | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传"+typeInfo+"失败"); | |||
NewToastUtil.getInstance().showToastError("上传"+typeInfo+"失败:"+response.message()); | |||
WaitProcessUtil.getInstance().Dismiss(context,"上传"+typeInfo+"失败",response.message()); | |||
} | |||
}); | |||
} | |||
/** | |||
* 上传 | |||
* @param goodsId | |||
* @param context | |||
*/ | |||
private static void upLoadMaterial(String goodsId,Context context,List<MaterialDataInfo> upMaterialBean){ | |||
try{ | |||
WaitProcessUtil.getInstance().Show("正在上传物料信息,请耐心稍等...","Material information is in progress, please be patient and wait for a moment"); | |||
List<BPA_MATERIAL> materials = MaterialUtil.GetMaterialALL(); | |||
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,"液体料",materialType.id)); | |||
} | |||
String url = path+"/api/ExternalPlatform/Material/AddMaterial"; | |||
Post(url,context,upMaterialBean,"物料信息",(response->{ | |||
Analysis(context,response,"物料信息",url).OnSource(()->{ | |||
upLoadClassifyInfo(goodsId,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
} | |||
/** | |||
* 商品分类 | |||
* 属性分类 | |||
* @param goodsId | |||
* @param context | |||
*/ | |||
private static void upLoadClassifyInfo(String goodsId,Context context){ | |||
try{ | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传所有分类属性,请耐心稍等..."); | |||
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.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
List<UpClassifyBean> upClassifyBeans = new ArrayList<>(); | |||
UpClassifyBean upClassifyBean = new UpClassifyBean(); | |||
upClassifyBean.pid = "0"; | |||
upClassifyBean.id = classify.id; | |||
upClassifyBean.name = classify.name; | |||
upClassifyBean.sort = 0; | |||
upClassifyBean.remark = ""; | |||
upClassifyBeans.add(upClassifyBean); | |||
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); | |||
if (!attributes.isEmpty()){ | |||
upLoadAttribute(attributes,goodsId,context); | |||
}else { | |||
upLoadGoodsInfo(goodsId,context); | |||
} | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsType"; | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(upClassifyBeans))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传分类属性信息成功"); | |||
NewToastUtil.getInstance().showToast("上传分类属性信息成功"); | |||
LogUtils.d("上传分类属性信息成功"); | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(classify.id); | |||
if (!attributes.isEmpty()){ | |||
upLoadAttribute(attributes,goodsId,context); | |||
}else { | |||
upLoadGoodsInfo(goodsId,context); | |||
} | |||
} | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传分类信息失败"); | |||
NewToastUtil.getInstance().showToastError("上传分类信息失败 "+response.message()); | |||
LogUtils.d("上传分类信息失败 "+response.message()); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
/** | |||
* 商品分类 | |||
* @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 = ""; | |||
} | |||
}); | |||
UpGoodsClassifyBean.GoodsList bean = new UpGoodsClassifyBean.GoodsList(); | |||
bean.goodsId = goods.id; | |||
bean.goodsName = goods.name; | |||
upClassifyBean.goodsList.add(bean); | |||
upClassifyBeans.add(upClassifyBean); | |||
String url = 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(); | |||
} | |||
} | |||
/** | |||
@@ -323,49 +477,33 @@ public class UpdateDataService { | |||
*/ | |||
private static void upLoadAttribute(List<BPA_ATTRIBUTE> attributes,String goodsId,Context context){ | |||
try{ | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传所有商品信息,请耐心稍等..."); | |||
WaitProcessUtil.getInstance().Show("正在上传分类属性信息,请耐心稍等...","Uploading classified attribute information, please wait..."); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodsId); | |||
assert goods != null; | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
List<UpAttributeBean> upAttributeBeans = new ArrayList<>(); | |||
for(BPA_ATTRIBUTE bean:attributes){ | |||
UpAttributeBean upAttributeBean = new UpAttributeBean(); | |||
upAttributeBean.setAttributeName(bean.name); | |||
upAttributeBean.setGoodsTypeName(classify.name); | |||
upAttributeBean.attributeName = (bean.name); | |||
upAttributeBean.id = bean.id; | |||
upAttributeBean.goodsTypeName = (classify.name); | |||
upAttributeBean.goodsTypeId = classify.id; | |||
upAttributeBean.sort = 1; | |||
List<BPA_SUBATTRIBUTE> subattributes = SubAttributeDBUtil.getByParentAttributeId(bean.id); | |||
for(BPA_SUBATTRIBUTE subattribute:subattributes){ | |||
upAttributeBean.goodsAttributeValue.add(new UpAttributeBean.GoodsAttributeValueBean(subattribute.name,subattribute.sort)); | |||
upAttributeBean.goodsAttributeValueList.add(new UpAttributeBean.GoodsAttributeValueBean(subattribute.id,subattribute.name,subattribute.sort)); | |||
} | |||
upAttributeBeans.add(upAttributeBean); | |||
} | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoodsAttribute"; | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(upAttributeBeans))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传分类属性信息成功"); | |||
LogUtils.d("上传分类属性信息成功 "+response.message()); | |||
upLoadGoodsInfo(goodsId,context); | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
LogUtils.d("上传分类属性信息失败 "+response.message()); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传分类属性信息失败"); | |||
NewToastUtil.getInstance().showToastError("上传分类属性信息失败 "+response.message()); | |||
} | |||
}); | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsAttribute"; | |||
Post(url,context,upAttributeBeans,"分类属性信息",(response->{ | |||
Analysis(context,response,"分类属性信息",url).OnSource(()->{ | |||
upLoadGoodsInfo(goodsId,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
@@ -379,43 +517,29 @@ public class UpdateDataService { | |||
*/ | |||
private static void upLoadGoodsInfo(String goodsId,Context context){ | |||
try{ | |||
WaitProcessUtil.getInstance().Show("正在上传商品信息,请耐心稍等...","Uploading product information, please be patient for a moment"); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodsId); | |||
assert goods != null; | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
List<GoodsDataInfo> upMaterialBean = new ArrayList<>(); | |||
upMaterialBean.add(new GoodsDataInfo(goods.id,goods.name,"",goods.url,0,false,goods.classifyId, | |||
classify.name,"","默认单位")); | |||
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"; | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(upMaterialBean))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
LogUtils.d("上传商品基础信息成功"); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品基础信息成功"); | |||
NewToastUtil.getInstance().showToast("上传商品基础信息成功"); | |||
upLoadDetailInfo(goodsId,context); | |||
} | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
LogUtils.d("上传商品基础信息失败 "+response.message()); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品基础信息失败"); | |||
NewToastUtil.getInstance().showToastError("上传商品基础信息失败 "+response.message()); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
}); | |||
Post(url,context,upMaterialBean,"商品基础信息",(response->{ | |||
Analysis(context,response,"商品基础信息",url).OnSource(()->{ | |||
upLoadDetailInfo(goodsId,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
} | |||
@@ -429,11 +553,13 @@ public class UpdateDataService { | |||
*/ | |||
private static void upLoadDetailInfo(String goodsId,Context context){ | |||
try{ | |||
WaitProcessUtil.getInstance().show(context,"数据上传","正在上传工艺信息,请耐心稍等..."); | |||
WaitProcessUtil.getInstance().Show("正在上传工艺信息,请耐心稍等...","Uploading process information, please wait..."); | |||
BPA_GOODS goods = GoodsDBUtil.getById(goodsId); | |||
assert goods != null; | |||
BPA_GOODS_CLASSIFY classify = GoodsClassifyDBUtil.getById(goods.classifyId); | |||
BPA_PROPERTY_CLASSIFY classify = PropClassifyDBUtil.getById(goods.propClassifyId); | |||
assert classify != null; | |||
BPA_GOODS_CLASSIFY goodClassify = GoodsClassifyDBUtil.getById(goods.goodClassifyid); | |||
assert goodClassify != null; | |||
List<BPA_GOODS_SUBATTRIBUTE_GROUP> groups = SubAttributeGroupDBUtil.getByGoodsId(goodsId); | |||
List<BPA_GOODS_PROCESS_DETAIL> goodsProcessDetails = new ArrayList<>(); | |||
@@ -441,14 +567,20 @@ public class UpdateDataService { | |||
goodsProcessDetails.addAll(GoodsProcessDetailDBUtil.getByGroupId(group.id)); | |||
} | |||
GoodsProcessDetail goodsProcessDetailList = new GoodsProcessDetail(); | |||
goodsProcessDetailList.deviceId = ConfigName.getInstance().DeviceAutoKey; | |||
goodsProcessDetailList.goodsId = goodsId; | |||
List<GoodsProcessDetail> goodsProcessDetailList = new ArrayList<>(); | |||
GoodsProcessDetail goodsProcessDetail = new GoodsProcessDetail(); | |||
goodsProcessDetail.goodsId = goodsId; | |||
goodsProcessDetail.deviceId = goodClassify.type==0?ConfigName.getInstance().DeviceAutoKey2:ConfigName.getInstance().DeviceAutoKey; | |||
goodsProcessDetail.goodsName = goods.name; | |||
goodsProcessDetail.deviceName = "中大型炒锅500"; | |||
goodsProcessDetail.warehousrTemplateId = ""; | |||
goodsProcessDetail.warehousrTemplateName = ""; | |||
List<GoodsProcessDetail.TechnologyActionList> technologyActionLists = new ArrayList<>(); | |||
for(BPA_GOODS_PROCESS_DETAIL bean : goodsProcessDetails){ | |||
GoodsProcessDetail.TechnologyActionList technologyActionList = new GoodsProcessDetail.TechnologyActionList(); | |||
technologyActionList.id = bean.id; | |||
technologyActionList.sort = bean.sort+""; | |||
technologyActionList.stepName = bean.processname; | |||
BPA_PROCESS process = ProcessModelUtil.getProcessByName(bean.processname); | |||
@@ -470,13 +602,38 @@ public class UpdateDataService { | |||
int index = 0; | |||
for (String item : data) { | |||
if (item.contains(",")) { | |||
String[] wl = item.split("[,]"); | |||
if (wl.length == 2) { | |||
String name = wl[0]; | |||
String val = wl[1]; | |||
BPA_PROCESSModel model = ProcessModelUtil.getProcessModelByName(process.id,name); | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(name,val,model.id,index)); | |||
index++; | |||
if(bean.processname.equals("液体料")){ | |||
String[] wl = item.split("[,]"); | |||
if (wl.length == 2) { | |||
//液体料单独处理 | |||
String name = wl[0]; | |||
String val = wl[1]; | |||
BPA_PROCESSModel model = ProcessModelUtil.getProcessModelByName(process.id,"物料名称"); | |||
if(model!=null){ | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson("物料名称",name,model.id,index)); | |||
index++; | |||
BPA_PROCESSModel model2 = ProcessModelUtil.getProcessModelByName(process.id,"重量"); | |||
if(model2==null){ | |||
model2 = ProcessModelUtil.getProcessModelByName(process.id,"物料重量"); | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson("物料重量",val,model2.id,index)); | |||
}else { | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson("重量",val,model2.id,index)); | |||
} | |||
}else { | |||
NewToastUtil.getInstance().showToastError(name+"液体料工序上传失败"); | |||
RecordManager.getInstance().addLogRecord("数据接收", name+"-液体料工序上传失败"); | |||
} | |||
} | |||
}else{ | |||
String[] wl = item.split("[,]"); | |||
if (wl.length == 2) { | |||
String name = wl[0]; | |||
String val = wl[1]; | |||
BPA_PROCESSModel model = ProcessModelUtil.getProcessModelByName(process.id,name); | |||
if(model!=null) | |||
actionJson.add(new GoodsProcessDetail.TechnologyActionList.ActionJson(name,val,model.id,index)); | |||
index++; | |||
} | |||
} | |||
} | |||
@@ -486,38 +643,23 @@ public class UpdateDataService { | |||
technologyActionLists.add(technologyActionList); | |||
} | |||
} | |||
goodsProcessDetailList.technologyActionList = technologyActionLists; | |||
String url = "http://"+path+"/api/ExternalPlatform/Goods/AddGoods"; | |||
HttpHeaders headers = new HttpHeaders(); | |||
headers.put("key", key); | |||
OkGo.<UploadRes<UpResData>>post(url) | |||
.tag(context) | |||
.upRequestBody( | |||
RequestBody.create(MediaType.parse("application/json; charset=utf-8"), | |||
new Gson().toJson(goodsProcessDetailList))) | |||
.headers(headers) | |||
.execute(new JsonDialogCallback<UploadRes<UpResData>>(context) { | |||
@Override | |||
public void onSuccess(Response<UploadRes<UpResData>> response) { | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功"); | |||
NewToastUtil.getInstance().showToastError("上传商品工艺成功"); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
public void onError(Response<UploadRes<UpResData>> response) { | |||
super.onError(response); | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺失败"); | |||
NewToastUtil.getInstance().showToastError("上传商品工艺失败 "+response.message()); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
}); | |||
goodsProcessDetail.technologyActionList = technologyActionLists; | |||
goodsProcessDetailList.add(goodsProcessDetail); | |||
String url = path+"/api/ExternalPlatform/Goods/AddGoodsTechnologyAction"; | |||
Post(url,context,goodsProcessDetailList,"商品工艺",(response->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", url+"-上传商品工艺成功"); | |||
NewToastUtil.getInstance().showToastError("上传商品工艺成功"); | |||
Analysis(context,response,"商品工艺",url).OnSource(()->{ | |||
upLoadGoodsClassifyInfo(goodsId,context); | |||
}); | |||
})); | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
LogUtils.d("网络请求异常"+e.getMessage()); | |||
WaitProcessUtil.getInstance().Dismiss(); | |||
} | |||
} | |||
} |
@@ -13,6 +13,7 @@ import androidx.core.content.ContextCompat; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.ViewLayoutToastBinding; | |||
@@ -61,6 +62,35 @@ public class NewToastUtil { | |||
}); | |||
} | |||
public void showToast(String message_zh,String message_en){ | |||
MainApplication.handler.post(() -> { | |||
if(toast != null){ | |||
toast.cancel(); | |||
} | |||
toast = new Toast(MainApplication.getContext()); | |||
String content = ""; | |||
switch (ConfigName.getInstance().app.getString(R.string.language)){ | |||
case "en": | |||
content = message_en; | |||
break; | |||
case "zh": | |||
content = message_zh; | |||
break; | |||
} | |||
if(content.length() > 50){ | |||
content = content.substring(0,50)+"..."; | |||
} | |||
View layout = LayoutInflater.from(MainApplication.getContext()).inflate(R.layout.view_layout_toast,null); | |||
ViewLayoutToastBinding binding = ViewLayoutToastBinding.bind(layout); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.toastText.setText(content); | |||
toast.setGravity(Gravity.BOTTOM,0, (int) (DisplayManager.getWidthScaleRate()* DimensUtil.getDimens(10))); | |||
toast.setDuration(Toast.LENGTH_SHORT); | |||
toast.setView(layout); | |||
toast.show(); | |||
}); | |||
} | |||
public void showToastBottom(String message){ | |||
MainApplication.handler.post(() -> { | |||
if(toast != null){ | |||
@@ -1,8 +1,13 @@ | |||
package com.bonait.bnframework.newui.widget; | |||
import android.app.ProgressDialog; | |||
import android.content.Context; | |||
import android.util.Log; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.ui.dialog.WaiteProgressDialog; | |||
/** | |||
@@ -25,6 +30,7 @@ public class WaitProcessUtil { | |||
} | |||
public void show(Context context,String title, String message){ | |||
MainApplication.handler.post(() -> { | |||
if(progressDialog!=null){ | |||
progressDialog.dismiss(); | |||
@@ -36,6 +42,19 @@ public class WaitProcessUtil { | |||
}); | |||
} | |||
public void show(Context context,String title, String message,String title_en,String message_en){ | |||
MainApplication.handler.post(() -> { | |||
if(progressDialog!=null){ | |||
progressDialog.dismiss(); | |||
} | |||
progressDialog = new WaiteProgressDialog(context); | |||
progressDialog.setTitleAndMessage(title,message,title_en,message_en); | |||
progressDialog.setCancelable(false); | |||
progressDialog.show(); | |||
}); | |||
} | |||
public void dismiss(){ | |||
MainApplication.handler.post(()->{ | |||
if(progressDialog!=null){ | |||
@@ -44,4 +63,70 @@ public class WaitProcessUtil { | |||
} | |||
}); | |||
} | |||
public void dismiss(Context context,String title,String info){ | |||
MainApplication.handler.post(()->{ | |||
if(progressDialog!=null){ | |||
progressDialog.dismiss(); | |||
progressDialog = null; | |||
} | |||
AlertDialogUtils.showDialog(context,title,info); | |||
}); | |||
} | |||
//region 等待弹框 | |||
ProgressDialog progressDialog1; | |||
public void Show(Context context,String title, String message,String title_en,String message_en){ | |||
MainApplication.handler.post(() -> { | |||
progressDialog1 = new ProgressDialog(context); | |||
switch (ConfigName.getInstance().app.getString(R.string.language)){ | |||
case "en": | |||
progressDialog1.setTitle(title_en); | |||
progressDialog1.setMessage(message_en); | |||
break; | |||
case "zh": | |||
progressDialog1.setTitle(title); | |||
progressDialog1.setMessage(message); | |||
break; | |||
} | |||
progressDialog1.setCancelable(false); | |||
progressDialog1.show(); | |||
}); | |||
} | |||
public void Show(String info,String message_en){ | |||
if(progressDialog1==null) return; | |||
MainApplication.handler.post(() -> { | |||
switch (ConfigName.getInstance().app.getString(R.string.language)){ | |||
case "en": | |||
if(progressDialog1!=null) { | |||
progressDialog1.setMessage(message_en); | |||
}; | |||
break; | |||
case "zh": | |||
if(progressDialog1!=null) { | |||
progressDialog1.setMessage(info); | |||
}; | |||
break; | |||
} | |||
Log.i("WaitShow", "Show: "+info); | |||
}); | |||
} | |||
public void Dismiss(){ | |||
MainApplication.handler.post(() -> { | |||
if(progressDialog1!=null){ | |||
progressDialog1.dismiss(); | |||
progressDialog1 = null; | |||
} | |||
}); | |||
} | |||
public void Dismiss(Context context,String title,String info){ | |||
MainApplication.handler.post(()->{ | |||
if(progressDialog1!=null){ | |||
progressDialog1.dismiss(); | |||
progressDialog1 = null; | |||
} | |||
AlertDialogUtils.showDialog(context,title,info); | |||
}); | |||
} | |||
//endregion | |||
} |
@@ -19,17 +19,17 @@ import com.bonait.bnframework.databinding.ItemClassifyBinding; | |||
* @description: | |||
* @date: 2024/5/9 9:02. | |||
*/ | |||
public abstract class ClassifyAdapter extends BaseAdapter<BPA_GOODS_CLASSIFY,ClassifyAdapter.ViewHolder> { | |||
public abstract class GoodClassifyAdapter extends BaseAdapter<BPA_GOODS_CLASSIFY, GoodClassifyAdapter.ViewHolder> { | |||
@NonNull | |||
@Override | |||
public ClassifyAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
return new ClassifyAdapter.ViewHolder(ItemClassifyBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | |||
public GoodClassifyAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { | |||
return new GoodClassifyAdapter.ViewHolder(ItemClassifyBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); | |||
} | |||
@SuppressLint("SetTextI18n") | |||
@Override | |||
public void onBindViewHolder(@NonNull ClassifyAdapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) { | |||
public void onBindViewHolder(@NonNull GoodClassifyAdapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) { | |||
if(DisplayManager.shouldScale(holder.binding.name)){ | |||
DisplayManager.scaleViewGroup(holder.binding.getRoot()); | |||
} |
@@ -54,7 +54,7 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods | |||
holder.binding.image.setImageResource(R.mipmap.loading123); | |||
} | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goods.classifyId)!=null){ | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goods.propClassifyId)!=null){ | |||
holder.binding.downLoad.setVisibility(View.GONE); | |||
}else { | |||
holder.binding.downLoad.setVisibility(View.VISIBLE); | |||
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.CheckBox; | |||
import androidx.annotation.NonNull; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
@@ -25,9 +26,16 @@ public abstract class LocalGoodsAdapter extends BaseAdapter<BPA_GOODS,LocalGoods | |||
private boolean isEdit = false; | |||
private MyBitmapUtils myBitmapUtils = new MyBitmapUtils(); | |||
private CheckBox select; | |||
public void setEdit(boolean isEdit){ | |||
this.isEdit = isEdit; | |||
} | |||
public void setAllSelect(boolean value){ | |||
if(select!=null){ | |||
select.setChecked(value); | |||
} | |||
} | |||
@NonNull | |||
@Override | |||
@@ -69,12 +77,24 @@ public abstract class LocalGoodsAdapter extends BaseAdapter<BPA_GOODS,LocalGoods | |||
}else { | |||
holder.binding.image.setImageResource(R.mipmap.loading123); | |||
} | |||
//多选框设置 | |||
holder.binding.image.setEnabled(goods.status>0?false:true); | |||
holder.binding.upload.setEnabled(goods.status>0?false:true); | |||
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.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() { | |||
@Override | |||
public void onClick(View view) { | |||
// ConfigData.getInstance().UploadGoods(holder.itemView.getContext(), goods.id); | |||
// uploadGoods(view,position); | |||
uploadGoods(view,position); | |||
} | |||
}); | |||
@@ -118,6 +138,7 @@ public abstract class LocalGoodsAdapter extends BaseAdapter<BPA_GOODS,LocalGoods | |||
protected abstract void uploadGoods(View v, int position); | |||
protected abstract void deleteGoods(View v, int position); | |||
protected abstract void selectGoods(View v, int position,boolean isSelect); | |||
protected abstract void addGoods(); | |||
} | |||
@@ -23,8 +23,10 @@ import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
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.util.GoodsClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.GoodsDBUtil; | |||
import com.bonait.bnframework.common.db.util.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.glide.GlideUtil; | |||
import com.bonait.bnframework.common.utils.AdbCommandUtil; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
@@ -55,8 +57,9 @@ public class AddGoodsDialog extends DialogFragment { | |||
private String TAG = " AddGoodsDialog =>"; | |||
private DialogAddGoodsBinding viewBinding; | |||
private ClassifySpinnerAdapter spinnerAdapter; | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private int classifyPosition = -1; | |||
private ArrayList<BPA_PROPERTY_CLASSIFY> classifyList = new ArrayList<>(); | |||
private int classifyPosition = 0; | |||
private String goodClassifyId = ""; | |||
private String picUrl = ""; | |||
public boolean isDismiss = false; | |||
private String type = "0"; | |||
@@ -67,7 +70,7 @@ public class AddGoodsDialog extends DialogFragment { | |||
super.onCreate(savedInstanceState); | |||
setStyle(STYLE_NORMAL, R.style.DialogScale); | |||
if(getArguments()!=null){ | |||
classifyPosition = getArguments().getInt("classifyPosition"); | |||
goodClassifyId = getArguments().getString("goodClassifyId"); | |||
type = getArguments().getString("type"); | |||
} | |||
} | |||
@@ -219,10 +222,11 @@ public class AddGoodsDialog extends DialogFragment { | |||
} | |||
return; | |||
} | |||
BPA_GOODS_CLASSIFY classify = classifyList.get(classifyPosition); | |||
BPA_PROPERTY_CLASSIFY classify = classifyList.get(classifyPosition); | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = name; | |||
goods.classifyId = classify.id; | |||
goods.propClassifyId = classify.id; | |||
goods.goodClassifyid = goodClassifyId; | |||
goods.url = picUrl; | |||
GoodsDBUtil.add(goods); | |||
dismiss(); | |||
@@ -237,9 +241,9 @@ public class AddGoodsDialog extends DialogFragment { | |||
public void updateClassifyData(int position){ | |||
classifyPosition = position; | |||
classifyList.clear(); | |||
classifyList.addAll(GoodsClassifyDBUtil.getAll(type)); | |||
classifyList.addAll(PropClassifyDBUtil.getAll()); | |||
List<String> classifyNameList = new ArrayList<>(); | |||
for(BPA_GOODS_CLASSIFY bean: classifyList){ | |||
for(BPA_PROPERTY_CLASSIFY bean: classifyList){ | |||
classifyNameList.add(bean.name); | |||
} | |||
LogUtils.d(" updateClassifyData getContext()="+getContext()); | |||
@@ -202,7 +202,7 @@ public class AttributeSelectDialog extends DialogFragment { | |||
viewBinding.clContent1.setVisibility(View.GONE); | |||
viewBinding.clContent2.setVisibility(View.VISIBLE); | |||
if (goods != null) { | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
attributeList = AttributeDBUtil.getByClassify(goods.propClassifyId); | |||
updateAttributeData(); | |||
} | |||
} | |||
@@ -125,7 +125,7 @@ public class EditGoodsDialog extends DialogFragment { | |||
} | |||
goods = GoodsDBUtil.getById(goodId); | |||
if(goods!=null){ | |||
attributeList = AttributeDBUtil.getByClassify(goods.classifyId); | |||
attributeList = AttributeDBUtil.getByClassify(goods.propClassifyId); | |||
} | |||
AdbCommandUtil.hideStatusBar(true); | |||
initView(); | |||
@@ -5,6 +5,8 @@ import android.content.Context; | |||
import android.os.Bundle; | |||
import android.view.WindowManager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.DialogProgressWaiteBinding; | |||
@@ -53,7 +55,22 @@ public class WaiteProgressDialog extends ProgressDialog { | |||
this.title = title; | |||
this.message = message; | |||
} | |||
public void setTitleAndMessage(String title,String message,String title_en,String message_en){ | |||
switch (ConfigName.getInstance().app.getString(R.string.language)){ | |||
case "en": | |||
title = title_en; | |||
message = message_en; | |||
break; | |||
case "zh": | |||
break; | |||
} | |||
if(binding!=null){ | |||
binding.title.setText(title); | |||
binding.message.setText(message); | |||
} | |||
this.title = title; | |||
this.message = message; | |||
} | |||
@Override | |||
public void show() { | |||
super.show(); | |||
@@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
import com.bonait.bnframework.Model.GoodsInfoBean; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
@@ -28,7 +29,7 @@ import com.bonait.bnframework.common.utils.DimensUtil; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.databinding.FragmentCloudGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.GoodClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.CloudGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.WaiteProgressDialog; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
@@ -49,7 +50,7 @@ import java.util.Objects; | |||
public class CloudGoodsFragment extends BaseFragment { | |||
private FragmentCloudGoodsBinding viewBinding; | |||
private CloudGoodsAdapter goodsAdapter; | |||
private ClassifyAdapter classifyAdapter; | |||
private GoodClassifyAdapter goodClassifyAdapter; | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
private static final int MSG_FRESH_GOODS= 1; | |||
@@ -70,7 +71,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
super.handleMessage(msg); | |||
switch (msg.what){ | |||
case MSG_FRESH_GOODS: | |||
dealGoodsData(classifyAdapter.getCurrentPosition()); | |||
dealGoodsData(goodClassifyAdapter.getCurrentPosition()); | |||
break; | |||
} | |||
} | |||
@@ -171,7 +172,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
}); | |||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | |||
classifyAdapter =new ClassifyAdapter() { | |||
goodClassifyAdapter =new GoodClassifyAdapter() { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
LogUtils.d("分类列表点击 position="+position+" name = "+mData.get(position).name); | |||
@@ -179,7 +180,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,200L);//避免快速点击 | |||
} | |||
}; | |||
viewBinding.recyclerClassify.setAdapter(classifyAdapter); | |||
viewBinding.recyclerClassify.setAdapter(goodClassifyAdapter); | |||
} | |||
/** | |||
@@ -192,16 +193,16 @@ public class CloudGoodsFragment extends BaseFragment { | |||
private void dealClassifyData(){ | |||
classifyList.clear(); | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
for (GoodsClassifyBean bean : Objects.requireNonNull(viewModel.cloudGoodsList.getValue())){ | |||
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.getGoodsTypeId(); | |||
goodsClassify.name = bean.getGoodsTypeName(); | |||
goodsClassify.id = bean.getGoodsClassifyId(); | |||
goodsClassify.name = bean.getGoodsClassifyName(); | |||
classifyList.add(goodsClassify); | |||
} | |||
} | |||
classifyAdapter.setCurrentPosition(0); | |||
classifyAdapter.setNewData(classifyList); | |||
goodClassifyAdapter.setCurrentPosition(0); | |||
goodClassifyAdapter.setNewData(classifyList); | |||
} | |||
private void dealGoodsData(int position){ | |||
@@ -209,17 +210,29 @@ public class CloudGoodsFragment extends BaseFragment { | |||
if(!classifyList.isEmpty()){ | |||
String goodsId = classifyList.get(position).id; | |||
if(viewModel.cloudGoodsList.getValue()!=null){ | |||
for (GoodsClassifyBean bean : viewModel.cloudGoodsList.getValue()){ | |||
if(goodsId.equals(bean.getGoodsTypeId())){ | |||
for(GoodsClassifyBean.GoodsInfoListBean goodsInfoListBean: bean.getGoodsInfoList() ){ | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
goods.name = goodsInfoListBean.getGoodsName(); | |||
goods.id = goodsInfoListBean.getGoodsId(); | |||
goods.classifyId = bean.getGoodsTypeId(); | |||
goods.url = goodsInfoListBean.getImgUrl(); | |||
goodsList.add(goods); | |||
String classifyID = classifyList.get(position).id; | |||
LogUtils.d("dealGoodsData classifyID="+classifyID+";classifyList.size="+classifyList.size()); | |||
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 -> { | |||
BPA_GOODS goods = new BPA_GOODS(); | |||
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; | |||
} | |||
} | |||
} | |||
@@ -243,7 +256,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
} | |||
if(goodsAdapter!=null){ | |||
goodsAdapter = null; | |||
classifyAdapter = null; | |||
goodClassifyAdapter = null; | |||
} | |||
if(handler!=null){ | |||
handler.removeCallbacksAndMessages(null); | |||
@@ -259,7 +272,7 @@ public class CloudGoodsFragment extends BaseFragment { | |||
*/ | |||
private boolean downLoadCloudGoods(int pos){ | |||
BPA_GOODS goods = goodsAdapter.getData().get(pos); | |||
BPA_GOODS_CLASSIFY goodsClassify = classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()); | |||
BPA_GOODS_CLASSIFY goodsClassify = goodClassifyAdapter.getData().get(goodClassifyAdapter.getCurrentPosition()); | |||
if(GoodsDBUtil.getByIdAndClassifyId(goods.id,goodsClassify.id)!=null){ | |||
NewToastUtil.getInstance().showToastError("请勿重复下载,本地商品已存在!!!"); | |||
return false; | |||
@@ -9,6 +9,7 @@ import android.os.Looper; | |||
import android.os.Message; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
@@ -21,11 +22,16 @@ import com.bonait.bnframework.business.MainInit; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
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.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.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
import com.bonait.bnframework.common.utils.DimensUtil; | |||
@@ -34,10 +40,13 @@ import com.bonait.bnframework.databinding.DialogDeleteClassifyBinding; | |||
import com.bonait.bnframework.databinding.FragmentLocalGoodsBinding; | |||
import com.bonait.bnframework.event.FreshLocalGoodPicEvent; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.newui.activity.EditClassifyTabActivity; | |||
import com.bonait.bnframework.newui.http.UpdateAllDataService; | |||
import com.bonait.bnframework.newui.http.UpdateDataService; | |||
import com.bonait.bnframework.ui.activity.EditClassifyActivity; | |||
import com.bonait.bnframework.ui.activity.EditGoodsActivity; | |||
import com.bonait.bnframework.ui.activity.MainActivity; | |||
import com.bonait.bnframework.ui.adapter.classify.ClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.classify.GoodClassifyAdapter; | |||
import com.bonait.bnframework.ui.adapter.goods.LocalGoodsAdapter; | |||
import com.bonait.bnframework.ui.dialog.AddGoodsDialog; | |||
import com.bonait.bnframework.ui.dialog.EditGoodsDialog; | |||
@@ -48,6 +57,8 @@ import org.greenrobot.eventbus.Subscribe; | |||
import org.greenrobot.eventbus.ThreadMode; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @author: liup | |||
@@ -57,13 +68,23 @@ import java.util.ArrayList; | |||
public class LocalGoodsFragment extends BaseFragment { | |||
private FragmentLocalGoodsBinding viewBinding; | |||
private LocalGoodsAdapter goodsAdapter; | |||
private ClassifyAdapter classifyAdapter; | |||
private GoodClassifyAdapter goodClassifyAdapter; | |||
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); | |||
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); | |||
/** | |||
* 商品分类列表 | |||
*/ | |||
private ArrayList<BPA_GOODS_CLASSIFY> goodClassifyList = new ArrayList<>(); | |||
/** | |||
* 属性分类列表 | |||
*/ | |||
private ArrayList<BPA_PROPERTY_CLASSIFY> propClassifyList = new ArrayList<>(); | |||
private static final int MSG_FRESH_GOODS= 1; | |||
private Long FRESH_DELAY_TIME = 200L; | |||
private AddGoodsDialog addGoodsDialog; | |||
private EditGoodsDialog editGoodsDialog; | |||
private boolean IsAllSelect=false; | |||
/** | |||
* 可编辑 | |||
@@ -83,7 +104,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
switch (msg.what){ | |||
case MSG_FRESH_GOODS: | |||
goodsList.clear(); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList.get(classifyAdapter.getCurrentPosition()).id)); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList.get(goodClassifyAdapter.getCurrentPosition()).id)); | |||
goodsAdapter.notifyDataSetChanged(); | |||
break; | |||
} | |||
@@ -106,30 +127,93 @@ public class LocalGoodsFragment extends BaseFragment { | |||
EventBus.getDefault().register(this); | |||
} | |||
private void setSelectStatus(int value){ | |||
for(BPA_GOODS good:goodsList){ | |||
good.status=value; | |||
} | |||
goodsAdapter.notifyDataSetChanged(); | |||
} | |||
@SuppressLint("NotifyDataSetChanged") | |||
private void initView(){ | |||
DisplayManager.scaleViewGroup(viewBinding.getRoot()); | |||
viewBinding.allSelectTV.setVisibility(View.GONE); | |||
viewBinding.allSelectTV.setOnClickListener(view->{ | |||
IsAllSelect=!IsAllSelect; | |||
setSelectStatus(IsAllSelect?1:2); | |||
viewBinding.allSelectTV.setText(IsAllSelect?"全不选":"全选"); | |||
}); | |||
viewBinding.CancelTV.setVisibility(View.GONE); | |||
viewBinding.CancelTV.setOnClickListener(view->{ | |||
viewBinding.selectCB.setChecked(true); | |||
}); | |||
viewBinding.selectCB.setVisibility(isEdit?View.VISIBLE:View.GONE); | |||
viewBinding.selectCB.setOnCheckedChangeListener((view,value)->{ | |||
if(value){ | |||
viewBinding.selectCB.setVisibility(View.VISIBLE); | |||
setSelectStatus(0); | |||
viewBinding.allSelectTV.setText("全选"); | |||
viewBinding.allSelectTV.setVisibility(View.GONE); | |||
viewBinding.CancelTV.setVisibility(View.GONE); | |||
viewBinding.edit.setVisibility(View.GONE); | |||
}else{ | |||
viewBinding.selectCB.setVisibility(View.GONE); | |||
viewBinding.allSelectTV.setVisibility(View.VISIBLE); | |||
viewBinding.CancelTV.setVisibility(View.VISIBLE); | |||
viewBinding.edit.setVisibility(View.VISIBLE); | |||
setSelectStatus(2); | |||
} | |||
viewBinding.edit.setEnabled(false); | |||
viewBinding.edit.setAlpha(0.5f); | |||
}); | |||
viewBinding.addClassify.setVisibility(isEdit?View.VISIBLE:View.GONE); | |||
viewBinding.uploadAll.setOnClickListener(v->{ | |||
List<BPA_GOODS> res = goodsList.stream().filter(p->p.status==1).collect(Collectors.toList()); | |||
if(res!=null) { | |||
UpdateAllDataService.startUpLoadAll(res,getContext()); | |||
} | |||
viewBinding.selectCB.setChecked(true);//全部上传后隐藏多选内容 | |||
}); | |||
viewBinding.addClassify.setOnClickListener(view -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast!"); | |||
return; | |||
} | |||
jumpClassify(); | |||
}); | |||
viewBinding.deleteAll.setVisibility(isEdit?View.VISIBLE:View.GONE); | |||
viewBinding.deleteAll.setOnClickListener(v->{ | |||
AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "请确认", "确认删除所有商品信息?", new AlertDialogUtils.DialogClickListener() { | |||
// AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "请确认", "确认删除选择的所有商品信息?", new AlertDialogUtils.DialogClickListener() { | |||
AlertDialogUtils.showTipDialog((AppCompatActivity) getActivity(), "请确认", "确认删除所有商品信息?","Confirm","Confirm to delete all product information?", new AlertDialogUtils.DialogClickListener() { | |||
@Override | |||
public void onConfirm() { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast!"); | |||
return; | |||
} | |||
MainInit.clearGoodsInfo(); | |||
List<BPA_GOODS> res = goodsList.stream().filter(p->p.status==1).collect(Collectors.toList()); | |||
if(res!=null) { | |||
res.forEach(bean->{ | |||
GoodsProcessDetailDBUtil.deleteByGoodsId(bean.id); | |||
SubAttributeGroupDBUtil.deleteByGoodsId(bean.id); | |||
if(GoodsDBUtil.delete(bean)){ | |||
NewToastUtil.getInstance().showToast("删除["+bean.name+"]成功!","Delete ["+bean.name+"] Success!"); | |||
goodsList.remove(bean); | |||
goodsAdapter.notifyDataSetChanged(); | |||
RecordManager.getInstance().addLogRecord("角色操作日志","删除["+bean.name+"]菜品成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("删除["+bean.name+"]失败!","Delete ["+bean.name+"] Fail!"); | |||
} | |||
}); | |||
} | |||
updateData(); | |||
RecordManager.getInstance().addLogRecord("角色操作日志","删除所有商品信息"); | |||
viewBinding.selectCB.setChecked(true);//全部删除后隐藏多选内容 | |||
} | |||
@Override | |||
@@ -145,7 +229,7 @@ public class LocalGoodsFragment extends BaseFragment { | |||
protected void onItemClick(View v, int position) { | |||
LogUtils.d(" LocalGoodsAdapter onItemClick position="+position); | |||
if(isFast2Click()){ | |||
NewToastUtil.getInstance().showToast("请勿快速点击!"); | |||
NewToastUtil.getInstance().showToast("请勿快速点击!","Click too fast!"); | |||
return; | |||
} | |||
try { | |||
@@ -171,49 +255,112 @@ public class LocalGoodsFragment extends BaseFragment { | |||
@Override | |||
protected void uploadGoods(View v, int position) { | |||
if(ConfigName.getInstance().isFast2Click()){ | |||
NewToastUtil.getInstance().showToast("点击太快了","Click too fast!"); | |||
return; | |||
} | |||
UpdateDataService.startUpLoad(mData.get(position),getContext()); | |||
} | |||
@Override | |||
protected void deleteGoods(View v, int position) { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast!"); | |||
return; | |||
} | |||
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_delete_classify, (layoutView, xCom) -> { | |||
BPA_GOODS bean = mData.get(position); | |||
DialogDeleteClassifyBinding binding = DialogDeleteClassifyBinding.bind(layoutView); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
binding.title.setText("删除菜品"); | |||
binding.edit.setText("是否删除["+bean.name+"]下所有组合配方?"); | |||
binding.title.setText(getString(R.string.text_deleterecipe)); | |||
switch (getString(R.string.text_deleterecipe)){ | |||
case "en": | |||
binding.edit.setText("Delete ["+bean.name+"] all recipes?"); | |||
break; | |||
case "zh": | |||
binding.edit.setText("是否删除["+bean.name+"]下所有组合配方?"); | |||
break; | |||
} | |||
binding.cancel.setOnClickListener(view1 ->{ | |||
xCom.dismissX(); | |||
}); | |||
binding.submit.setOnClickListener(view1 -> { | |||
if(ConfigName.getInstance().isFastClick()){ | |||
NewToastUtil.getInstance().showToast("点击过快!"); | |||
NewToastUtil.getInstance().showToast("点击过快!","Click too fast!"); | |||
return; | |||
} | |||
GoodsProcessDetailDBUtil.deleteByGoodsId(bean.id); | |||
SubAttributeGroupDBUtil.deleteByGoodsId(bean.id); | |||
if(GoodsDBUtil.delete(bean)){ | |||
NewToastUtil.getInstance().showToast("删除["+bean.name+"]成功!"); | |||
switch (getString(R.string.text_deleterecipe)){ | |||
case "en": | |||
binding.edit.setText("Delete ["+bean.name+"] all recipes?"); | |||
break; | |||
case "zh": | |||
binding.edit.setText("是否删除["+bean.name+"]下所有组合配方?"); | |||
break; | |||
} | |||
NewToastUtil.getInstance().showToast("删除["+bean.name+"]成功!","Delete ["+bean.name+"] Success!"); | |||
goodsList.remove(bean); | |||
goodsAdapter.notifyDataSetChanged(); | |||
xCom.dismissX(); | |||
RecordManager.getInstance().addLogRecord("角色操作日志","删除["+bean.name+"]菜品成功!"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("删除["+bean.name+"]失败!"); | |||
NewToastUtil.getInstance().showToast("删除["+bean.name+"]失败!","Delete ["+bean.name+"] Fail!"); | |||
} | |||
}); | |||
}); | |||
} | |||
@Override | |||
protected void selectGoods(View v, int position,boolean isSelect){ | |||
mData.get(position).status=isSelect?1:2; | |||
List<BPA_GOODS> res = goodsList.stream().filter(p->p.status==1).collect(Collectors.toList()); | |||
if(res!=null) { | |||
if(res.size()==goodsList.size()){ | |||
viewBinding.allSelectTV.setText("全不选"); | |||
IsAllSelect=true; | |||
} | |||
else{ | |||
viewBinding.allSelectTV.setText("全选"); | |||
IsAllSelect=false; | |||
} | |||
viewBinding.edit.setEnabled(res.size()>0?true:false); | |||
viewBinding.edit.setAlpha(res.size()>0?1.0f:0.5f); | |||
} | |||
} | |||
@Override | |||
protected void addGoods() { | |||
addGoodsDialog(); | |||
//添加商品的时候选择一个商品分类 | |||
//添加商品的时候选择一个属性分类 | |||
if(!propClassifyList.isEmpty() && getActivity()!=null){ | |||
String selectPropName=""; | |||
BPA_PROPERTY_CLASSIFY classify= PropClassifyDBUtil.getByName(selectPropName); | |||
if (classify!=null){ | |||
List<BPA_ATTRIBUTE> attributes = AttributeDBUtil.getByClassify(classify.id); | |||
if(attributes.isEmpty()){ | |||
NewToastUtil.getInstance().showToast("当前分类没有属性,请先创建分类父属性","The current class does not have attributes. Create the parent attributes of the class first"); | |||
return; | |||
}else { | |||
for(BPA_ATTRIBUTE attribute:attributes){ | |||
if(SubAttributeDBUtil.getByParentAttributeId(attribute.id).isEmpty()){ | |||
NewToastUtil.getInstance().showToast("当前分类父属性["+attribute.name+"]没有子属性,无法创建","Parent property of the current class ["+attribute.name+"] has no subattribute,Cannot create!"); | |||
return; | |||
} | |||
} | |||
} | |||
} | |||
addGoodsDialog(); | |||
} | |||
} | |||
}; | |||
goodsAdapter.setEdit(isEdit); | |||
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams)viewBinding.recyclerGoods.getLayoutParams(); | |||
params.topMargin=isEdit?83:10; | |||
viewBinding.recyclerGoods.setLayoutParams(params); | |||
viewBinding.recyclerGoods.addItemDecoration(new RecyclerView.ItemDecoration() { | |||
@Override | |||
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { | |||
@@ -224,17 +371,18 @@ public class LocalGoodsFragment extends BaseFragment { | |||
}); | |||
viewBinding.recyclerGoods.setAdapter(goodsAdapter); | |||
classifyAdapter =new ClassifyAdapter() { | |||
goodClassifyAdapter =new GoodClassifyAdapter() { | |||
@Override | |||
protected void onItemClick(View v, int position) { | |||
viewBinding.selectCB.setChecked(true);//切换分类后隐藏多选内容 | |||
LogUtils.d("分类列表点击 position="+position+" name = "+mData.get(position).name); | |||
RecordManager.getInstance().addLogRecord("角色操作日志","点击["+mData.get(position).name+"]分类"); | |||
handler.removeMessages(MSG_FRESH_GOODS); | |||
handler.sendEmptyMessageDelayed(MSG_FRESH_GOODS,FRESH_DELAY_TIME);//避免快速点击 | |||
} | |||
}; | |||
classifyAdapter.setCurrentPosition(0); | |||
viewBinding.recyclerClassify.setAdapter(classifyAdapter); | |||
goodClassifyAdapter.setCurrentPosition(0); | |||
viewBinding.recyclerClassify.setAdapter(goodClassifyAdapter); | |||
} | |||
/** | |||
@@ -266,10 +414,10 @@ public class LocalGoodsFragment extends BaseFragment { | |||
*/ | |||
public void addGoodsDialog(){ | |||
if(isFastClick()){ | |||
NewToastUtil.getInstance().showToast("请勿快速点击!"); | |||
NewToastUtil.getInstance().showToast("请勿快速点击!","Click too fast!"); | |||
return; | |||
} | |||
if(!classifyList.isEmpty() && getActivity()!=null){ | |||
if(!propClassifyList.isEmpty() && getActivity()!=null){ | |||
LogUtils.d(" addGoodsDialog addGoodsDialog="+addGoodsDialog); | |||
if(addGoodsDialog == null){ | |||
addGoodsDialog = new AddGoodsDialog(); | |||
@@ -277,23 +425,20 @@ public class LocalGoodsFragment extends BaseFragment { | |||
addGoodsDialog.dismiss(); | |||
} | |||
Bundle bundle = new Bundle(); | |||
bundle.putInt("classifyPosition",classifyAdapter.getCurrentPosition()); | |||
// bundle.putInt("goodClassifyPosition", goodClassifyAdapter.getCurrentPosition()); | |||
bundle.putString("goodClassifyId", goodClassifyList.get(goodClassifyAdapter.getCurrentPosition()).id); | |||
addGoodsDialog.setArguments(bundle); | |||
addGoodsDialog.show(getActivity().getSupportFragmentManager(), "addGoods"); | |||
}else { | |||
NewToastUtil.getInstance().showToast("当前没有分类,请先添加分类"); | |||
NewToastUtil.getInstance().showToast("当前没有分类,请先添加分类","Currently no class,Please add class first"); | |||
jumpClassify(); | |||
} | |||
} | |||
private void jumpClassify(){ | |||
if(getActivity() instanceof MainActivity){ | |||
((MainActivity)getActivity()).jumpClassifyActivity(); | |||
}else if (getActivity() instanceof EditGoodsActivity){ | |||
Intent intent = new Intent(getContext(), EditClassifyActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
Intent intent = new Intent(getContext(), EditClassifyTabActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
@@ -304,21 +449,22 @@ public class LocalGoodsFragment extends BaseFragment { | |||
public void updateData() { | |||
LogUtils.d("updateData"); | |||
goodsList.clear(); | |||
classifyList.clear(); | |||
goodClassifyList.clear(); | |||
classifyList.addAll(GoodsClassifyDBUtil.getAll()); | |||
if(!classifyList.isEmpty()){ | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, classifyList.size()-1); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyList.get(last2).id)); | |||
goodClassifyList.addAll(GoodsClassifyDBUtil.getAll()); | |||
if(!goodClassifyList.isEmpty()){ | |||
int last = Math.max(goodClassifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, goodClassifyList.size()-1); | |||
goodsList.addAll(GoodsDBUtil.getByClassifyId(goodClassifyList.get(last2).id)); | |||
} | |||
goodsAdapter.setNewData(goodsList); | |||
int last = Math.max(classifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, classifyList.size()-1); | |||
classifyAdapter.setCurrentPosition(last2); | |||
classifyAdapter.setNewData(classifyList); | |||
int last = Math.max(goodClassifyAdapter.getCurrentPosition(), 0); | |||
int last2 = Math.min(last, goodClassifyList.size()-1); | |||
goodClassifyAdapter.setCurrentPosition(last2); | |||
goodClassifyAdapter.setNewData(goodClassifyList); | |||
propClassifyList.addAll(PropClassifyDBUtil.getAll()); | |||
} | |||
@Override | |||
@@ -348,13 +494,13 @@ public class LocalGoodsFragment extends BaseFragment { | |||
EventBus.getDefault().unregister(this); | |||
if(goodsList!=null){ | |||
goodsList.clear(); | |||
classifyList.clear(); | |||
goodClassifyList.clear(); | |||
goodsList = null; | |||
classifyList = null; | |||
goodClassifyList = null; | |||
} | |||
if(goodsAdapter!=null){ | |||
goodsAdapter = null; | |||
classifyAdapter = null; | |||
goodClassifyAdapter = null; | |||
} | |||
if(handler!=null){ | |||
handler.removeCallbacksAndMessages(null); | |||
@@ -14,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.newui.activity.FileActivity; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.Constants; | |||
@@ -107,7 +108,7 @@ public class PicManagerFragment extends BaseFragment { | |||
ArrayList<FileEntity> yx_files = new ArrayList<>(); | |||
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/hblxiaochaokaoxiangdb/WebImage"; | |||
private static final String CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + ConfigName.dataPath+"/WebImage"; | |||
private void flushedImage() { | |||
File path = new File(CACHE_PATH);// 获得路径 | |||
@@ -1,5 +1,7 @@ | |||
package com.bonait.bnframework.ui.fragment.setting; | |||
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
@@ -8,14 +10,19 @@ import android.widget.ArrayAdapter; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; | |||
import com.bonait.bnframework.common.utils.DisplayManager; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.PreferenceUtils; | |||
import com.bonait.bnframework.databinding.FragmentSceneSetBinding; | |||
import com.bonait.bnframework.newui.http.UpdateDataService; | |||
import com.bonait.bnframework.newui.widget.NewToastUtil; | |||
import com.bonait.bnframework.ui.viewmodel.HomeGoodsViewModel; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -53,16 +60,44 @@ public class SceneSetFragment extends BaseFragment { | |||
viewBinding.spinnerEnvironment.setSelection(i); | |||
} | |||
} | |||
viewBinding.editShopNumber.setText(PreferenceUtils.getString(ConfigName.shopNumber,"")); | |||
viewBinding.editDeviceNumber.setText(PreferenceUtils.getString(ConfigName.deviceNumber,"")); | |||
viewBinding.zijianSwitch.setChecked(PreferenceUtils.getBoolean(ConfigName.rootTip,true)); | |||
viewBinding.btnUpdateKey.setOnClickListener(v->{ | |||
ThreadManager.get().execute(new Thread(()->{ | |||
HomeGoodsViewModel.GetServiceKey(new HomeGoodsViewModel.CallBack() { | |||
@Override | |||
public void success() { | |||
if(viewBinding!=null){ | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
if(viewBinding.editKey!=null){ | |||
viewBinding.editKey.setText(ConfigName.getInstance().Key+""); | |||
PreferenceUtils.setString(ConfigName.serviceKey,viewBinding.editKey.getText().toString()); | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}); | |||
})); | |||
}); | |||
viewBinding.editKey.setText(ConfigName.getInstance().Key+""); | |||
viewBinding.btnSave.setOnClickListener(v->{ | |||
PreferenceUtils.setString(ConfigName.environment,viewBinding.spinnerEnvironment.getSelectedItem().toString()); | |||
PreferenceUtils.setString(ConfigName.shopNumber,viewBinding.editShopNumber.getText().toString()); | |||
PreferenceUtils.setString(ConfigName.serviceKey,viewBinding.editKey.getText().toString()); | |||
PreferenceUtils.setString(ConfigName.deviceNumber,viewBinding.editDeviceNumber.getText().toString()); | |||
PreferenceUtils.setBoolean(ConfigName.rootTip,viewBinding.zijianSwitch.isChecked()); | |||
NewToastUtil.getInstance().showToast("保存成功"); | |||
ConfigName.getInstance().Key = viewBinding.editKey.getText().toString(); | |||
UpdateDataService.key = ConfigName.getInstance().Key; | |||
BPA_SYSTEMSET set_main4 = new BPA_SYSTEMSET(); | |||
set_main4.type = -203; | |||
set_main4.value =viewBinding.btnUpdateKey.getText().toString(); | |||
set_main4.deviceID = ConfigName.getInstance().DeviceId; | |||
set_main4.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set_main4); | |||
}); | |||
} | |||
@@ -14,9 +14,10 @@ import com.bonait.bnframework.HBL.API.APIResultT; | |||
import com.bonait.bnframework.HBL.Thread.ThreadManager; | |||
import com.bonait.bnframework.Model.GoodsClassifyBean; | |||
import com.bonait.bnframework.Model.GoodsData; | |||
import com.bonait.bnframework.Model.GoodsInfoBean; | |||
import com.bonait.bnframework.Model.MaterialData; | |||
import com.bonait.bnframework.Model.MaterialRequestPar; | |||
import com.bonait.bnframework.Model.ProcessValueUtil; | |||
import com.bonait.bnframework.Model.MaterialTypeData; | |||
import com.bonait.bnframework.business.RecordManager; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
@@ -26,18 +27,27 @@ import com.bonait.bnframework.common.db.mode.BPA_GOODS_CLASSIFY; | |||
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_MATERIAL; | |||
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_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_SUBATTRIBUTE; | |||
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET; | |||
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.PropClassifyDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeDBUtil; | |||
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ProcessValueUtil; | |||
import com.bonait.bnframework.event.FreshLocalGoodsEvent; | |||
import com.bonait.bnframework.newui.http.UpdateDataService; | |||
import com.bonait.bnframework.newui.widget.NewToastUtil; | |||
import com.bonait.bnframework.newui.widget.WaitProcessUtil; | |||
import org.greenrobot.eventbus.EventBus; | |||
@@ -52,39 +62,43 @@ import java.util.Map; | |||
* @date: 2024/5/14 9:33. | |||
*/ | |||
public class HomeGoodsViewModel extends ViewModel { | |||
public MutableLiveData<List<GoodsClassifyBean>> cloudGoodsList = new MutableLiveData<>(); | |||
public List<GoodsClassifyBean> goodsList = new ArrayList<>(); | |||
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; | |||
public List<GoodsClassifyBean> goodsList = new ArrayList<>(); | |||
public void fetchCloudData(Context context){ | |||
if (NetworkUtils.checkNetworkAvailable(context)) { | |||
WaitProcessUtil.getInstance().show(context,"下载云端","正在请求云端数据...","Download cloud","Requesting cloud data..."); | |||
ThreadManager.get().execute(new Thread(()->{ | |||
GetGoodsInfo(); | |||
GetMaterialInfo(); | |||
GetMaterialType(); | |||
if(!UpdateDataService.isDownProcessModel){ | |||
UpdateDataService.downLoadProcessModel(null,null); | |||
} | |||
})); | |||
} | |||
} | |||
/** | |||
* 获取商品信息 | |||
*/ | |||
public void GetGoodsInfo(){ | |||
String autoKey = ConfigName.getInstance().DeviceAutoKey; | |||
String url = "https://cfv.black-pa.com/kitchbase/api/goods/Getdevicegoods?deviceId=260"; | |||
String url = Path+"/api/goods/Getdevicegoods?deviceId=260"; | |||
LogUtils.d("GetGoodsInfo url="+url); | |||
RecordManager.getInstance().addLogRecord("数据接收", "请求商品信息-"+url); | |||
APIHelper.PostT(url,null,null,new TypeReference<APIResultT<GoodsData>>(){}).OnSource(s->{ | |||
LogUtils.d("GetGoodsInfo s.Content="+s.Content.toString()); | |||
LogUtils.d("GetGoodsInfo s.Content="+s.Content); | |||
RecordManager.getInstance().addLogRecord("数据接收", "接收商品信息成功"); | |||
goodsList.clear(); | |||
goodsList.addAll(s.Content.getGoodsInfoList()); | |||
// runOnUiThread(new Runnable() { | |||
// @Override | |||
// public void run() { | |||
// cloudGoodsList.setValue(goodsList); | |||
// } | |||
// }); | |||
goodsList.addAll(s.Content.getGoodsClassifyList()); | |||
ThreadManager.get().execute(new Thread(()->{ | |||
GetGoodsInfo2(); | |||
})); | |||
}).OnFailed(e->{ | |||
WaitProcessUtil.getInstance().dismiss(); | |||
}); | |||
} | |||
@@ -99,26 +113,74 @@ public class HomeGoodsViewModel extends ViewModel { | |||
runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
List<GoodsClassifyBean> dataList = new ArrayList<>(); | |||
dataList.addAll(goodsList); | |||
dataList.addAll(s.Content.getGoodsInfoList()); | |||
cloudGoodsList.setValue(dataList); | |||
cloudGoodsList.setValue(s.Content); | |||
} | |||
}); | |||
hasData = true; | |||
WaitProcessUtil.getInstance().dismiss(); | |||
}).OnFailed(e->{ | |||
WaitProcessUtil.getInstance().dismiss(); | |||
}); | |||
} | |||
public static interface CallBack{ | |||
void success(); | |||
} | |||
/** | |||
* 获取平台授权码 | |||
*/ | |||
public static void GetServiceKey(CallBack listener){ | |||
String url = UpdateDataService.path+"/api/check/auth-key/"+ConfigName.getInstance().DeviceAutoKey; | |||
// String url = "http://192.168.1.50:5006/api/check/auth-key/279"; | |||
LogUtils.d("GetServiceKey url="+url); | |||
RecordManager.getInstance().addLogRecord("数据接收", "获取平台授权码-"+url); | |||
APIHelper.get(url,null,new TypeReference<APIResultT<String>>(){}).OnSource(s->{ | |||
LogUtils.d("GetServiceKey s.Content="+s.Content); | |||
RecordManager.getInstance().addLogRecord("数据接收", "获取平台授权码成功"); | |||
ConfigName.getInstance().Key = s.Content.toString()+""; | |||
UpdateDataService.key = s.Content.toString()+""; | |||
BPA_SYSTEMSET set_main4 = new BPA_SYSTEMSET(); | |||
set_main4.type = -203; | |||
set_main4.value = s.Content.toString()+""; | |||
set_main4.deviceID = ConfigName.getInstance().DeviceId; | |||
set_main4.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set_main4); | |||
if(listener!=null){ | |||
listener.success(); | |||
} | |||
}).OnFailed(e->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", "获取平台授权码失败"); | |||
}); | |||
} | |||
/** | |||
* 获取物料信息 | |||
*/ | |||
public static void GetMaterialInfo(){ | |||
String url = "https://cfv.black-pa.com/saasbase/api/ExternalPlatform/Material/GetMaterialPageList"; | |||
String url = UpdateDataService.path+"/api/ExternalPlatform/Material/GetMaterialPageList";//saasbase | |||
LogUtils.d("GetMaterialInfo url="+url); | |||
String key ="2c39bc05-25c2-46c4-b5c6-dba349058492"; | |||
String key =UpdateDataService.key; | |||
RecordManager.getInstance().addLogRecord("数据接收", "接收物料信息-"+url); | |||
APIHelper.PostT(url,new MaterialRequestPar(1,100),key,new TypeReference<APIResultT<MaterialData>>(){}).OnSource(s->{ | |||
RecordManager.getInstance().addLogRecord("数据接收", "接收物料信息成功"); | |||
UpdateLocalMaterial(s.Content); | |||
}); | |||
long curTime6 = System.currentTimeMillis(); | |||
} | |||
/** | |||
* 获取物料类型信息 | |||
*/ | |||
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){ | |||
@@ -151,38 +213,85 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
} | |||
} | |||
LogUtils.d("UpdateLocalMaterial datas.size="+datas); | |||
LogUtils.d("UpdateLocalMaterial datas="+datas); | |||
if(!datas.isEmpty()){ | |||
MaterialUtil.addMaterialList(BPA_MATERIAL.class,datas); | |||
NewToastUtil.getInstance().showToast("已同步云端物料信息"); | |||
NewToastUtil.getInstance().showToast("已同步云端物料信息","Material information in the cloud has been synchronized!"); | |||
} | |||
} | |||
private static void UpdateLocalMaterialType(MaterialTypeData materialModels){ | |||
LogUtils.d("UpdateLocalMaterialType 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!"); | |||
} | |||
} | |||
/** | |||
* 单个云端商品下载 | |||
* @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(GoodsClassifyDBUtil.getById(goodsClassify.id)==null){ | |||
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+"】分类的父属性数量不匹配,无法下载"); | |||
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不匹配,无法下载"); | |||
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; | |||
} | |||
} | |||
@@ -190,7 +299,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
} | |||
if(GoodsDBUtil.getByNameAndClassifyId(goods.name,goodsClassify.id)!=null){ | |||
NewToastUtil.getInstance().showToast("已有该商品,请先删除再【"+goods.name+"】,再下载"); | |||
NewToastUtil.getInstance().showToast("已有该商品,请先删除【"+goods.name+"】,再下载","The same product【"+goods.name+"】available,please delete and download!"); | |||
return; | |||
} | |||
//添加商品 | |||
@@ -201,34 +310,33 @@ 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())){ | |||
BPA_SUBATTRIBUTE subattribute = new BPA_SUBATTRIBUTE(); | |||
subattribute.parentAttributeId = goodsAttributeListBean.getGoodsAttributeId(); | |||
subattribute.name = goodsAttributeValueListBean.getAttributeValue(); | |||
subattribute.sort = goodsAttributeValueListBean.getSort(); | |||
subattribute.id = goodsAttributeValueListBean.getGoodsAttributeValueId(); | |||
subattribute.sort = goodsAttributeValueListBean.getSort(); | |||
SubAttributeDBUtil.add(subattribute); | |||
LogUtils.d(" 添加子属性 成功"+goodsAttributeValueListBean.getAttributeValue()); | |||
}else { | |||
@@ -240,10 +348,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(); | |||
@@ -265,7 +373,8 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
processDetail.materialType = goodsTechnologyActionListBean.getStepName().contains("液体")?0:1; | |||
String value = ProcessValueUtil.dealProcessJsonToValue(goodsTechnologyActionListBean.getActionJson()); | |||
processDetail.processms = goodsTechnologyActionListBean.getStepName()+ ProcessValueUtil.dealProcessSms(value); | |||
LogUtils.d("downLoadCloudGoods value="+value); | |||
processDetail.processms = goodsTechnologyActionListBean.getStepName()+ProcessValueUtil.dealProcessSms(value); | |||
processDetail.sort = goodsTechnologyActionListBean.getSort(); | |||
processDetail.processname = goodsTechnologyActionListBean.getStepName(); | |||
processDetail.processvalue = value; | |||
@@ -293,6 +402,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)); | |||
@@ -310,53 +420,78 @@ public class HomeGoodsViewModel extends ViewModel { | |||
LogUtils.d(" synchronizedCloudData3 usetime="+(curTime5-lastTime)); | |||
lastTime = curTime5; | |||
EventBus.getDefault().post(new FreshLocalGoodsEvent()); | |||
NewToastUtil.getInstance().showToast("云端数据同步成功"); | |||
NewToastUtil.getInstance().showToast("云端数据同步成功","The cloud data is synchronized successfully!"); | |||
}catch (Exception e){ | |||
NewToastUtil.getInstance().showToast("云端数据同步失败"); | |||
NewToastUtil.getInstance().showToast("云端数据同步失败","The cloud data is synchronized fails"); | |||
e.printStackTrace(); | |||
} | |||
})); | |||
} | |||
/** | |||
* 同步云端商品分类到本地 | |||
* 同步云端商品分类到本地 所有商品 | |||
*/ | |||
private void GoodTypeSynchronous(){ | |||
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()){ | |||
BPA_GOODS_CLASSIFY bpa_goodstype = new BPA_GOODS_CLASSIFY(); | |||
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){ | |||
return; | |||
} | |||
LogUtils.d("GoodTypeSynchronous1"); | |||
List<BPA_PROPERTY_CLASSIFY> datas = new ArrayList<>(); | |||
List<BPA_PROPERTY_CLASSIFY> dataHas = new ArrayList<>(); | |||
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(); | |||
bpa_goodstype.userID="超级管理员"; | |||
for(GoodsClassifyBean bean:goodsList){ | |||
if(item.getGoodsTypeId().equals(bean.getGoodsTypeId())){ | |||
bpa_goodstype.type = 1; | |||
break; | |||
} | |||
} | |||
datas.add(bpa_goodstype); | |||
if(item.getGoodsTypeName()!=null){ | |||
List<BPA_GOODS_CLASSIFY> bean = GoodsClassifyDBUtil.getListByName(item.getGoodsTypeName()); | |||
List<BPA_PROPERTY_CLASSIFY> bean = PropClassifyDBUtil.getListByName(item.getGoodsTypeName()); | |||
if(!bean.isEmpty()){ | |||
dataHas.addAll(bean); | |||
} | |||
} | |||
} | |||
//删除重复的分类 | |||
GoodsClassifyDBUtil.DeleteList(dataHas); | |||
for(BPA_GOODS_CLASSIFY bean : dataHas){ | |||
PropClassifyDBUtil.DeleteList(dataHas); | |||
for(BPA_PROPERTY_CLASSIFY bean : dataHas){ | |||
AttributeDBUtil.deleteByClassifyId(bean.id); | |||
GoodsDBUtil.deleteByClassifyId(bean.id); | |||
GoodsDBUtil.deleteByPropClassifyId(bean.id); | |||
SubAttributeGroupDBUtil.deleteByClassifyId(bean.id); | |||
SubAttributeDBUtil.deleteByClassifyId(bean.id); | |||
} | |||
//批量添加 | |||
GoodsClassifyDBUtil.addList(datas); | |||
PropClassifyDBUtil.addList(datas); | |||
} | |||
/** | |||
@@ -369,7 +504,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 +549,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.classifyId=item.getGoodsTypeId(); | |||
bpa_goods.status=1; | |||
bpa_goods.propClassifyId =item.getGoodsTypeId(); | |||
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 +584,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){ | |||
@@ -470,7 +612,7 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
processDetail.materialType = goodsTechnologyActionListBean.getStepName().contains("液体")?0:1; | |||
String value = ProcessValueUtil.dealProcessJsonToValue(goodsTechnologyActionListBean.getActionJson()); | |||
processDetail.processms = goodsTechnologyActionListBean.getStepName()+ ProcessValueUtil.dealProcessSms(value); | |||
processDetail.processms = goodsTechnologyActionListBean.getStepName()+ProcessValueUtil.dealProcessSms(value); | |||
processDetail.sort = goodsTechnologyActionListBean.getSort(); | |||
LogUtils.d(" goodsTechnologyActionListBean.getSort()="+goodsTechnologyActionListBean.getSort()+" processDetail.sort="+processDetail.sort); | |||
processDetail.processname = goodsTechnologyActionListBean.getStepName(); | |||
@@ -493,12 +635,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("-"); | |||
@@ -514,5 +656,4 @@ public class HomeGoodsViewModel extends ViewModel { | |||
} | |||
return recpipeNameTemp.toString().substring(0, recpipeNameTemp.length() - 1); | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:color="#7FEF5362" | |||
android:radius="-1dp"> | |||
<item android:state_pressed="true"> | |||
<shape> | |||
<solid android:color="#d4d4d4" /> | |||
<corners android:radius="10dp" /> | |||
</shape> | |||
</item> | |||
<item android:state_enabled="false"> | |||
<shape> | |||
<solid android:color="#d4d4d4" /> | |||
<corners android:radius="10dp" /> | |||
</shape> | |||
</item> | |||
<item> | |||
<shape> | |||
<solid android:color="#d4d4d4" /> | |||
<corners android:radius="10dp" /> | |||
</shape> | |||
</item> | |||
</ripple> |
@@ -20,8 +20,8 @@ | |||
android:paddingBottom="@dimen/dp_25" | |||
android:layout_marginBottom="2dp" | |||
android:ellipsize="middle" | |||
android:textSize="@dimen/sp_32" | |||
android:text="添加分类" | |||
android:textSize="32sp" | |||
android:text="@string/btn_addclass" | |||
android:textColor="#823E17" | |||
android:gravity="center" | |||
android:background="#EFE9D2"/> | |||
@@ -36,47 +36,106 @@ | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<!-- <TextView--> | |||
<!-- android:id="@+id/upload_all"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:visibility="gone"--> | |||
<!-- tools:visibility="visible"--> | |||
<!-- android:layout_height="@dimen/dp_70"--> | |||
<!-- android:paddingTop="10dp"--> | |||
<!-- android:paddingBottom="10dp"--> | |||
<!-- android:layout_marginEnd="300dp"--> | |||
<!-- android:paddingStart="10dp"--> | |||
<!-- android:paddingEnd="@dimen/dp_10"--> | |||
<!-- android:layout_marginBottom="5dp"--> | |||
<!-- android:layout_alignParentEnd="true"--> | |||
<!-- android:ellipsize="middle"--> | |||
<!-- android:textSize="@dimen/sp_32"--> | |||
<!-- android:text="@string/btn_updateall"--> | |||
<!-- android:textColor="#823E17"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:layout_alignParentTop="true"--> | |||
<!-- android:background="@drawable/bg_round15_yellow_btn"/>--> | |||
<!-- <TextView--> | |||
<!-- android:id="@+id/delete_all"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:visibility="gone"--> | |||
<!-- tools:visibility="visible"--> | |||
<!-- android:layout_height="@dimen/dp_70"--> | |||
<!-- android:paddingTop="10dp"--> | |||
<!-- android:paddingBottom="10dp"--> | |||
<!-- android:layout_marginEnd="60dp"--> | |||
<!-- android:paddingStart="10dp"--> | |||
<!-- android:paddingEnd="@dimen/dp_10"--> | |||
<!-- android:layout_marginBottom="5dp"--> | |||
<!-- android:layout_alignParentEnd="true"--> | |||
<!-- android:ellipsize="middle"--> | |||
<!-- android:textSize="@dimen/sp_32"--> | |||
<!-- android:text="@string/btn_deleteall"--> | |||
<!-- android:textColor="#823E17"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:layout_alignParentTop="true"--> | |||
<!-- android:background="@drawable/bg_round15_yellow_btn"/>--> | |||
<TextView | |||
android:id="@+id/delete_all" | |||
android:id="@+id/allSelectTV" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:layout_height="@dimen/dp_90" | |||
android:paddingTop="@dimen/dp_25" | |||
android:paddingBottom="@dimen/dp_25" | |||
android:paddingStart="@dimen/dp_25" | |||
android:paddingEnd="@dimen/dp_25" | |||
android:layout_marginBottom="2dp" | |||
android:layout_marginLeft="20dp" | |||
android:padding="10dp" | |||
android:layout_toRightOf="@id/recycler_classify" | |||
android:textSize="@dimen/sp_32" | |||
android:text="全选" | |||
android:gravity="center" | |||
android:layout_alignParentTop="true"/> | |||
<TextView | |||
android:id="@+id/CancelTV" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:layout_marginRight="20dp" | |||
android:padding="10dp" | |||
android:layout_alignParentEnd="true" | |||
android:ellipsize="middle" | |||
android:textSize="@dimen/sp_32" | |||
android:text="删除所有商品" | |||
android:textColor="#823E17" | |||
android:text="取消" | |||
android:gravity="center" | |||
android:layout_alignParentBottom="true" | |||
android:background="@drawable/bg_round25_yellow_btn"/> | |||
android:layout_alignParentTop="true"/> | |||
<CheckBox | |||
android:id="@+id/selectCB" | |||
android:layout_width="wrap_content" | |||
android:layout_marginEnd="20dp" | |||
android:buttonTint="@color/gray" | |||
android:checked="true" | |||
android:scaleX="2" | |||
android:scaleY="2" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentEnd="true" | |||
android:layout_alignParentTop="true"/> | |||
<TextView | |||
android:id="@+id/line1" | |||
android:layout_width="@dimen/dp_1" | |||
android:layout_height="match_parent" | |||
android:background="@color/color3" | |||
android:layout_marginLeft="@dimen/dp_140" | |||
/> | |||
android:layout_marginLeft="@dimen/dp_140"/> | |||
<TextView | |||
android:id="@+id/line2" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_3" | |||
android:background="@color/color3" | |||
/> | |||
android:background="@color/color3"/> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:layout_marginLeft="@dimen/dp_21" | |||
android:layout_marginTop="@dimen/dp_3" | |||
android:layout_marginTop="83dp" | |||
android:id="@+id/recycler_goods" | |||
android:layout_width="match_parent" | |||
android:layout_marginBottom="@dimen/dp_95" | |||
android:layout_toRightOf="@id/recycler_classify" | |||
android:orientation="vertical" | |||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" | |||
@@ -84,6 +143,68 @@ | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<LinearLayout | |||
android:id="@+id/edit" | |||
android:layout_width="match_parent" | |||
android:layout_height="70dp" | |||
android:layout_marginLeft="30dp" | |||
android:layout_marginRight="30dp" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:layout_toRightOf="@id/recycler_classify" | |||
android:background="@drawable/all_edit_btn" | |||
android:layout_alignParentBottom="true" | |||
android:layout_marginBottom="20dp"> | |||
<RelativeLayout | |||
android:id="@+id/upload_all" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1" | |||
android:gravity="center" | |||
android:layout_centerHorizontal="true"> | |||
<ImageView | |||
android:id="@+id/img1" | |||
android:layout_width="50dp" | |||
android:layout_height="50dp" | |||
android:layout_centerVertical="true" | |||
android:src="@mipmap/ysc" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="@string/btn_update" | |||
android:layout_toRightOf="@id/img1" | |||
android:layout_centerVertical="true" | |||
android:textColor="@color/black" | |||
android:textSize="25sp" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:id="@+id/delete_all" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1" | |||
android:gravity="center" | |||
android:layout_centerHorizontal="true"> | |||
<ImageView | |||
android:id="@+id/img2" | |||
android:layout_width="50dp" | |||
android:layout_height="50dp" | |||
android:layout_centerVertical="true" | |||
android:src="@mipmap/ysc1" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="@string/btn_delete" | |||
android:layout_toRightOf="@id/img2" | |||
android:layout_centerVertical="true" | |||
android:textColor="@color/black" | |||
android:textSize="25sp" /> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -7,7 +7,7 @@ | |||
android:fitsSystemWindows="true" | |||
android:orientation="vertical" | |||
android:id="@+id/root" | |||
tools:context=".ViewModel.FragmentViewModel.SystemSeasoningsetFragment"> | |||
> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
@@ -23,23 +23,33 @@ | |||
android:layout_height="70dp" | |||
android:textColor="@color/black" | |||
android:textSize="32sp" | |||
android:text="商家店铺号:" | |||
android:text="平台授权码:" | |||
android:layout_gravity="center_vertical" | |||
android:gravity="center_vertical" | |||
/> | |||
<EditText | |||
android:id="@+id/edit_shop_number" | |||
android:layout_width="420dp" | |||
android:id="@+id/edit_key" | |||
android:layout_width="800dp" | |||
android:layout_height="70dp" | |||
android:layout_marginLeft="5dp" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入商家店铺号" | |||
android:hint="请输入授权码" | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="32sp" /> | |||
<Button | |||
android:id="@+id/btn_update_key" | |||
android:layout_width="300dp" | |||
android:layout_height="70dp" | |||
android:background="@drawable/bg_btn_login_selected" | |||
android:text="更新授权码" | |||
android:textColor="@color/white" | |||
android:layout_marginLeft="50dp" | |||
android:textSize="32sp"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
@@ -59,7 +69,7 @@ | |||
<EditText | |||
android:id="@+id/edit_device_number" | |||
android:layout_width="420dp" | |||
android:layout_width="800dp" | |||
android:layout_height="70dp" | |||
android:layout_marginLeft="5dp" | |||
android:background="@drawable/input_bj" | |||
@@ -89,7 +99,7 @@ | |||
<Spinner | |||
android:id="@+id/spinner_environment" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="420dp" | |||
android:layout_width="800dp" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_centerVertical="true" /> | |||
@@ -56,7 +56,7 @@ | |||
android:layout_height="match_parent" | |||
android:layout_weight="1" | |||
android:gravity="center" | |||
android:visibility="gone" | |||
android:visibility="visible" | |||
android:layout_centerHorizontal="true"> | |||
<ImageView | |||
@@ -103,7 +103,17 @@ | |||
</RelativeLayout> | |||
</LinearLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
tools:ignore="MissingConstraints"> | |||
<CheckBox | |||
android:id="@+id/SelectStatus" | |||
android:layout_width="50dp" | |||
android:layout_height="50dp" | |||
android:buttonTint="@color/deep_purple_primary" | |||
android:layout_alignParentRight="true"/> | |||
</RelativeLayout> | |||
<FrameLayout | |||
android:id="@+id/add" | |||
@@ -0,0 +1,94 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:orientation="vertical" | |||
android:id="@+id/root" | |||
android:fitsSystemWindows="true"> | |||
<!-- <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="80dp" | |||
android:layout_width="match_parent" | |||
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="155dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="?attr/app_content_bg_color" /> | |||
<com.qmuiteam.qmui.widget.QMUITopBarLayout | |||
android:id="@+id/topbar" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/home_tab_height" > | |||
<TextView | |||
android:id="@+id/back" | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:textColor="@color/white" | |||
android:textSize="30dp" | |||
android:text="@string/btn_return" | |||
android:paddingRight="@dimen/dp_50" | |||
android:drawableLeft="@mipmap/fanhui" | |||
android:gravity="center" | |||
android:paddingLeft="@dimen/dp_5" | |||
android:drawablePadding="@dimen/dp_5" | |||
/> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:text="@string/top_editclass" | |||
android:textColor="@color/white" | |||
android:textSize="36sp" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
/> | |||
</com.qmuiteam.qmui.widget.QMUITopBarLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,139 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:orientation="vertical" | |||
android:id="@+id/root" | |||
android:fitsSystemWindows="true"> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/content" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<TextView | |||
android:id="@+id/desc" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_70" | |||
android:text="" | |||
android:gravity="center" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="#823E17" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinner_classify" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_375" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_add_classify" | |||
android:layout_width="@dimen/dp_110" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="@string/btn_new" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/spinner_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_delete_classify" | |||
android:layout_width="@dimen/dp_110" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="@string/btn_delete" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/btn_add_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_update_classify" | |||
android:layout_width="@dimen/dp_110" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="@string/btn_revise" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/btn_delete_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
/> | |||
<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_15" | |||
android:background="@color/color3" | |||
/> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:layout_marginLeft="@dimen/dp_21" | |||
android:layout_marginTop="120dp" | |||
android:id="@+id/recycler_goods" | |||
android:layout_width="match_parent" | |||
android:orientation="vertical" | |||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" | |||
app:spanCount="3" | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
<!-- <com.qmuiteam.qmui.widget.QMUITopBarLayout--> | |||
<!-- android:id="@+id/topbar"--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="@dimen/home_tab_height" >--> | |||
<!-- <TextView--> | |||
<!-- android:id="@+id/back"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="30dp"--> | |||
<!-- android:text="@string/btn_return"--> | |||
<!-- android:paddingRight="@dimen/dp_50"--> | |||
<!-- android:drawableLeft="@mipmap/fanhui"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:paddingLeft="@dimen/dp_5"--> | |||
<!-- android:drawablePadding="@dimen/dp_5"--> | |||
<!-- />--> | |||
<!-- <TextView--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:text="@string/top_editclass"--> | |||
<!-- android:textColor="@color/white"--> | |||
<!-- android:textSize="36sp"--> | |||
<!-- android:layout_gravity="center"--> | |||
<!-- android:gravity="center"--> | |||
<!-- />--> | |||
<!-- </com.qmuiteam.qmui.widget.QMUITopBarLayout>--> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -72,7 +72,49 @@ | |||
</LinearLayout> | |||
<TextView | |||
android:id="@+id/allSelectTV" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:layout_marginLeft="270dp" | |||
android:padding="10dp" | |||
android:textSize="@dimen/sp_32" | |||
android:text="全选" | |||
android:gravity="center" | |||
android:textColor="@color/main_title_color1" | |||
android:textStyle="bold" | |||
android:layout_alignParentTop="true"/> | |||
<TextView | |||
android:id="@+id/CancelTV" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:layout_marginRight="20dp" | |||
android:padding="10dp" | |||
android:layout_alignParentEnd="true" | |||
android:textSize="@dimen/sp_32" | |||
android:text="取消" | |||
android:textColor="@color/main_title_color1" | |||
android:textStyle="bold" | |||
android:gravity="center" | |||
android:layout_alignParentTop="true"/> | |||
<CheckBox | |||
android:id="@+id/selectCB" | |||
android:layout_width="wrap_content" | |||
android:layout_marginEnd="20dp" | |||
android:buttonTint="@color/gray" | |||
android:checked="true" | |||
android:scaleX="2" | |||
android:scaleY="2" | |||
android:layout_height="@dimen/dp_70" | |||
android:textColor="@color/main_title_color1" | |||
android:layout_alignParentEnd="true" | |||
android:layout_alignParentTop="true"/> | |||
<TextView | |||
android:id="@+id/line1" | |||
android:layout_width="@dimen/dp_1" | |||
@@ -90,7 +132,7 @@ | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:layout_marginLeft="@dimen/dp_21" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginTop="80dp" | |||
android:id="@+id/recycler_goods" | |||
android:layout_width="match_parent" | |||
android:layout_marginStart="270dp" | |||
@@ -100,46 +142,107 @@ | |||
android:layout_height="match_parent"> | |||
</androidx.recyclerview.widget.RecyclerView> | |||
<TextView | |||
android:id="@+id/update_all" | |||
android:layout_width="wrap_content" | |||
<LinearLayout | |||
android:id="@+id/edit" | |||
android:layout_width="800dp" | |||
android:layout_height="70dp" | |||
android:layout_marginStart="685dp" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:layout_height="@dimen/dp_90" | |||
android:paddingTop="@dimen/dp_25" | |||
android:paddingBottom="@dimen/dp_25" | |||
android:paddingStart="@dimen/dp_25" | |||
android:paddingEnd="@dimen/dp_25" | |||
android:layout_marginBottom="5dp" | |||
android:layout_alignParentEnd="true" | |||
android:layout_marginEnd="300dp" | |||
android:ellipsize="middle" | |||
android:textSize="@dimen/sp_32" | |||
android:text="上传全部商品" | |||
android:textColor="#823E17" | |||
android:gravity="center" | |||
android:layout_toRightOf="@id/recycler_classify" | |||
android:background="@drawable/all_edit_btn" | |||
android:layout_alignParentBottom="true" | |||
android:background="@drawable/bg_round25_yellow_btn"/> | |||
android:layout_marginBottom="20dp"> | |||
<RelativeLayout | |||
android:id="@+id/upload_all" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1" | |||
android:gravity="center" | |||
android:layout_centerHorizontal="true"> | |||
<TextView | |||
android:id="@+id/delete_all" | |||
android:layout_width="wrap_content" | |||
android:visibility="gone" | |||
tools:visibility="visible" | |||
android:layout_height="@dimen/dp_90" | |||
android:paddingTop="@dimen/dp_25" | |||
android:paddingBottom="@dimen/dp_25" | |||
android:paddingStart="@dimen/dp_25" | |||
android:paddingEnd="@dimen/dp_25" | |||
android:layout_marginBottom="5dp" | |||
android:layout_alignParentEnd="true" | |||
android:ellipsize="middle" | |||
android:textSize="@dimen/sp_32" | |||
android:text="删除全部商品" | |||
android:textColor="#823E17" | |||
android:gravity="center" | |||
android:layout_alignParentBottom="true" | |||
android:background="@drawable/bg_round25_yellow_btn"/> | |||
<ImageView | |||
android:id="@+id/img1" | |||
android:layout_width="50dp" | |||
android:layout_height="50dp" | |||
android:layout_centerVertical="true" | |||
android:src="@mipmap/ysc" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="@string/btn_update" | |||
android:layout_toRightOf="@id/img1" | |||
android:layout_centerVertical="true" | |||
android:textColor="@color/black" | |||
android:textSize="25sp" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:id="@+id/delete_all" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1" | |||
android:gravity="center" | |||
android:layout_centerHorizontal="true"> | |||
<ImageView | |||
android:id="@+id/img2" | |||
android:layout_width="50dp" | |||
android:layout_height="50dp" | |||
android:layout_centerVertical="true" | |||
android:src="@mipmap/ysc1" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="@string/btn_delete" | |||
android:layout_toRightOf="@id/img2" | |||
android:layout_centerVertical="true" | |||
android:textColor="@color/black" | |||
android:textSize="25sp" /> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
<!-- <TextView--> | |||
<!-- android:id="@+id/update_all"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:visibility="gone"--> | |||
<!-- tools:visibility="visible"--> | |||
<!-- android:layout_height="@dimen/dp_90"--> | |||
<!-- android:paddingTop="@dimen/dp_25"--> | |||
<!-- android:paddingBottom="@dimen/dp_25"--> | |||
<!-- android:paddingStart="@dimen/dp_25"--> | |||
<!-- android:paddingEnd="@dimen/dp_25"--> | |||
<!-- android:layout_marginBottom="5dp"--> | |||
<!-- android:layout_alignParentEnd="true"--> | |||
<!-- android:layout_marginEnd="300dp"--> | |||
<!-- android:ellipsize="middle"--> | |||
<!-- android:textSize="@dimen/sp_32"--> | |||
<!-- android:text="上传全部商品"--> | |||
<!-- android:textColor="#823E17"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:layout_alignParentBottom="true"--> | |||
<!-- android:background="@drawable/bg_round25_yellow_btn"/>--> | |||
<!-- <TextView--> | |||
<!-- android:id="@+id/delete_all"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:visibility="gone"--> | |||
<!-- tools:visibility="visible"--> | |||
<!-- android:layout_height="@dimen/dp_90"--> | |||
<!-- android:paddingTop="@dimen/dp_25"--> | |||
<!-- android:paddingBottom="@dimen/dp_25"--> | |||
<!-- android:paddingStart="@dimen/dp_25"--> | |||
<!-- android:paddingEnd="@dimen/dp_25"--> | |||
<!-- android:layout_marginBottom="5dp"--> | |||
<!-- android:layout_alignParentEnd="true"--> | |||
<!-- android:ellipsize="middle"--> | |||
<!-- android:textSize="@dimen/sp_32"--> | |||
<!-- android:text="删除全部商品"--> | |||
<!-- android:textColor="#823E17"--> | |||
<!-- android:gravity="center"--> | |||
<!-- android:layout_alignParentBottom="true"--> | |||
<!-- android:background="@drawable/bg_round25_yellow_btn"/>--> | |||
</RelativeLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,239 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:orientation="vertical" | |||
android:id="@+id/root" | |||
android:fitsSystemWindows="true"> | |||
<androidx.constraintlayout.widget.ConstraintLayout | |||
android:id="@+id/content" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<TextView | |||
android:id="@+id/desc" | |||
android:layout_width="wrap_content" | |||
android:layout_height="@dimen/dp_70" | |||
android:text="" | |||
android:gravity="center" | |||
app:layout_constraintTop_toTopOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="#823E17" | |||
/> | |||
<Spinner | |||
android:id="@+id/spinner_classify" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="@dimen/dp_500" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_centerVertical="true" | |||
app:layout_constraintLeft_toRightOf="@id/desc" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginStart="20dp" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_add_classify" | |||
android:layout_width="@dimen/dp_170" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="新增" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/spinner_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_30" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_delete_classify" | |||
android:layout_width="@dimen/dp_120" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="删除" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/btn_add_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_30" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_update_classify" | |||
android:layout_width="@dimen/dp_120" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="修改" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
app:layout_constraintLeft_toRightOf="@id/btn_delete_classify" | |||
app:layout_constraintTop_toTopOf="@id/desc" | |||
android:layout_marginLeft="@dimen/dp_30" | |||
/> | |||
<TextView | |||
android:id="@+id/title" | |||
android:layout_width="@dimen/dp_420" | |||
android:layout_height="@dimen/dp_70" | |||
android:text="属性" | |||
android:gravity="center" | |||
app:layout_constraintTop_toBottomOf="@id/desc" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:background="#EFE9D2" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="#823E17" | |||
/> | |||
<TextView | |||
android:id="@+id/title2" | |||
android:layout_width="0dp" | |||
android:layout_height="@dimen/dp_70" | |||
android:text="子属性" | |||
android:gravity="center" | |||
app:layout_constraintTop_toBottomOf="@id/desc" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintLeft_toRightOf="@id/title" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:background="#EFE9D2" | |||
android:textSize="@dimen/sp_32" | |||
android:textColor="#823E17" | |||
/> | |||
<RelativeLayout | |||
android:layout_width="@dimen/dp_420" | |||
android:layout_height="0dp" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
app:layout_constraintTop_toBottomOf="@id/title" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
> | |||
<ListView | |||
android:id="@+id/list_attribute" | |||
android:layout_width="@dimen/dp_420" | |||
android:layout_height="wrap_content" | |||
android:divider="@color/color3" | |||
android:dividerHeight="@dimen/dp_1" | |||
android:layout_marginBottom="@dimen/dp_90" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_add_attribute" | |||
android:layout_width="@dimen/dp_190" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_marginBottom="10dp" | |||
android:layout_marginStart="10dp" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="+添加属性" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_alignBottom="@id/list_attribute" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_delete_attribute" | |||
android:layout_width="@dimen/dp_190" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_alignParentBottom="true" | |||
android:layout_marginBottom="10dp" | |||
android:layout_marginEnd="10dp" | |||
android:layout_alignParentEnd="true" | |||
android:background="@drawable/bg_round15_red_btn" | |||
android:text="-删除属性" | |||
android:textColor="@color/white" | |||
android:gravity="center" | |||
android:textSize="@dimen/sp_32" | |||
android:layout_alignBottom="@id/list_attribute" | |||
/> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:layout_height="0dp" | |||
app:layout_constraintRight_toRightOf="parent" | |||
app:layout_constraintLeft_toRightOf="@id/line3" | |||
app:layout_constraintTop_toBottomOf="@id/title" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
> | |||
<ListView | |||
android:id="@+id/list_subattribute" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:divider="#00000000" | |||
android:dividerHeight="@dimen/dp_20" | |||
android:layout_marginBottom="@dimen/dp_90" | |||
android:layout_marginStart="20dp" | |||
android:layout_marginEnd="20dp" | |||
/> | |||
<TextView | |||
android:id="@+id/btn_add_subattribute" | |||
android:layout_width="@dimen/dp_235" | |||
android:layout_height="@dimen/dp_70" | |||
android:background="@drawable/bg_round15_yellow_btn" | |||
android:text="+添加子属性" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/sp_32" | |||
android:gravity="center" | |||
android:layout_alignParentBottom="true" | |||
android:layout_marginBottom="10dp" | |||
android:layout_marginLeft="@dimen/dp_25" | |||
/> | |||
</RelativeLayout> | |||
<TextView | |||
android:id="@+id/line1" | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_1" | |||
app:layout_constraintTop_toBottomOf="@id/desc" | |||
android:layout_marginTop="@dimen/dp_20" | |||
android:background="@color/color3" | |||
/> | |||
<TextView | |||
android:layout_width="match_parent" | |||
android:layout_height="@dimen/dp_1" | |||
app:layout_constraintTop_toBottomOf="@id/desc" | |||
android:layout_marginTop="@dimen/dp_90" | |||
android:background="@color/color3" | |||
/> | |||
<TextView | |||
android:id="@+id/line3" | |||
android:layout_width="@dimen/dp_1" | |||
android:layout_height="0dp" | |||
app:layout_constraintTop_toBottomOf="@id/line1" | |||
app:layout_constraintBottom_toBottomOf="parent" | |||
app:layout_constraintLeft_toLeftOf="parent" | |||
android:layout_marginLeft="@dimen/dp_420" | |||
android:background="@color/color3" | |||
/> | |||
</androidx.constraintlayout.widget.ConstraintLayout> | |||
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout> |
@@ -0,0 +1,197 @@ | |||
<resources> | |||
<string name="app_name">菠萝小炒-新</string> | |||
<string name="file_normal">常用文件</string> | |||
<string name="file_all">全部文件</string> | |||
<string name="empty_data">没有数据</string> | |||
<string name="not_available">sd卡不可用</string> | |||
<string name="already_select">已选择:%s</string> | |||
<string name="file_select_res">确定%s</string> | |||
<string name="file_select_max">最多选择%d个文件</string> | |||
<string name="file_select_res1">保存本地%s</string> | |||
<!-- TODO: Remove or change this placeholder text --> | |||
<string name="hello_blank_fragment">Hello blank fragment</string> | |||
<string name="title_activity_bottom_navigation2">标题</string> | |||
<string name="title_home">Home</string> | |||
<string name="title_dashboard">烹饪</string> | |||
<string name="user_account">请输入用户名</string> | |||
<string name="mine">我的</string> | |||
<string name="dummy_button">Dummy Button</string> | |||
<string name="dummy_content">DUMMY\nCONTENT</string> | |||
<string name="common_example">示例图片</string> | |||
<!-- TODO: 系统设置 --> | |||
<string name="NetworkManagement">资源管理</string> | |||
<string name="DeviceInformation">设备信息</string> | |||
<string name="SystemSettings">系统设置</string> | |||
<string name="SeasoningSettings">调料设置</string> | |||
<!-- TODO: 物料表格设置 --> | |||
<string name="str_index">顺序</string> | |||
<string name="str_name">名称</string> | |||
<string name="str_age">年龄</string> | |||
<!--TODO: 提示文案--> | |||
<string name="tip_save_menu_title">保存菜谱操作提示!</string> | |||
<string name="tip_create_menu_title">生成菜谱操作提示!</string> | |||
<string name="tip_save_menu_content">请问客官确定要保存[%s]菜谱吗?</string> | |||
<string name="tip_create_menu_content">请问客官确定要生成[%s]菜谱吗?</string> | |||
<string name="tip_save_cancel">CanCel</string> | |||
<string name="tip_save_confirm">OK</string> | |||
<!--TODO: 中英文对照表--> | |||
<string name="language">en</string> | |||
<string name="btn_sign">SIGN</string> | |||
<string name="text_Password">Please enter your password</string> | |||
<string name="text_User">Please enter a username</string> | |||
<string name="top_User">Username</string> | |||
<string name="top_Password">Password</string> | |||
<string name="text_Login_Fass">The username or password is incorrect!</string> | |||
<string name="text_LoadInfo">The software is being initialized, please wait....</string> | |||
<string name="text_Appstart">Starting...</string> | |||
<string name="text_Login_Suc">Login successful!</string> | |||
<string name="text_StartCooking">Start Cook</string> | |||
<string name="text_SDCZ">Manual Operation</string> | |||
<string name="text_home_SZ">Silo Settings</string> | |||
<string name="text_home_CPYF">Menu Develop</string> | |||
<string name="btn_exit">Exit</string> | |||
<string name="btn_recipe">Recipe</string> | |||
<string name="btn_device">Device</string> | |||
<string name="btn_fry_sp">Stir-fry speed-按钮</string> | |||
<string name="btn_fry_fast">Stir-fry Fast-按钮</string> | |||
<string name="btn_fry_middle">Stir-fry Middle-按钮</string> | |||
<string name="btn_fry_slow">Stir-fry Slow-按钮</string> | |||
<string name="btn_fry_stop">Stir-fry Stop-按钮</string> | |||
<string name="btn_fast">Fast</string> | |||
<string name="btn_middle">Middle</string> | |||
<string name="btn_slow">Slow</string> | |||
<string name="btn_stop">Stop</string> | |||
<string name="btn_pot">Pot Direction-按钮</string> | |||
<string name="btn_origin">Original-按钮</string> | |||
<string name="btn_maintain">Maintain-按钮</string> | |||
<string name="btn_fry">Fry-按钮</string> | |||
<string name="btn_extract">Extract-按钮</string> | |||
<string name="btn_pour">Pour-按钮</string> | |||
<string name="btn_clean">Clean-按钮</string> | |||
<string name="btn_watergun">Water Gun-按钮</string> | |||
<string name="btn_addwater">Add Water-按钮</string> | |||
<string name="text_potdirection_1">Please control the pan direction: Extraction Position</string> | |||
<string name="text_potdirection_2">Please control the pan direction: Clean Position</string> | |||
<string name="text_waterset">Null</string> | |||
<string name="btn_waterset">Set</string> | |||
<string name="btn_pourmeal">Pour Out Meal-按钮</string> | |||
<string name="btn_putmeal">Feed-按钮</string> | |||
<string name="text_waitput">Please wait for the end of the last feeding!!!</string> | |||
<string name="btn_initialize">Init</string> | |||
<string name="btn_rinse">Rinse</string> | |||
<string name="text_localrecipe">Local Recipe</string> | |||
<string name="text_cloudrecipe">Cloud Recipe</string> | |||
<string name="text_deviceconnect">Device connection: Connected</string> | |||
<string name="text_devicedisconnect">Device connection: DisConnected</string> | |||
<string name="btn_return">Return</string> | |||
<string name="text_top_cpgl">Recipe Management</string> | |||
<string name="btn_downloadall">Download All</string> | |||
<string name="btn_refresh">Refresh</string> | |||
<string name="btn_download">Download</string> | |||
<string name="text_downloadsuc">Download Successful</string> | |||
<string name="text_downloadinfo">Please download the product first!</string> | |||
<string name="btn_update">Update</string> | |||
<string name="btn_delete">Delete</string> | |||
<string name="text_deleterecipe">Delete Recipe</string> | |||
<string name="btn_deleteall">Delete All</string> | |||
<string name="btn_updateall">Update All</string> | |||
<string name="text_edit">Edit Recipe</string> | |||
<string name="text_selectpic">Select Picture:</string> | |||
<string name="text_recipename">Recipe Name:</string> | |||
<string name="btn_cancel">Cancel</string> | |||
<string name="btn_next">Next</string> | |||
<string name="text_inputrecipe">Please enter the recipe name!</string> | |||
<string name="text_selectab">Select Attribute</string> | |||
<string name="text_commodityab">Commodity Attribute:</string> | |||
<string name="text_defaultab">Default Attribute:</string> | |||
<string name="text_prev">Prev</string> | |||
<string name="btn_cooking">Cooking</string> | |||
<string name="btn_editprocess">Edit Process</string> | |||
<string name="btn_deleterecipe">Delete Recipe</string> | |||
<string name="text_writeprocess">Fill in the main material name</string> | |||
<string name="text_bit_1">1 Bit</string> | |||
<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_savereturn">Save&return</string> | |||
<string name="btn_tolead">To Lead</string> | |||
<string name="text_step">Cook Step</string> | |||
<string name="text_cookprocess">Cook Process</string> | |||
<string name="btn_cooksimulate">Simulation Cook</string> | |||
<string name="btn_add">+Add</string> | |||
<string name="btn_insert">Insert</string> | |||
<string name="btn_upinsert">UpInsert</string> | |||
<string name="btn_Downinsert">DownInsert</string> | |||
<string name="btn_revise">Revise</string> | |||
<string name="btn_create">Create</string> | |||
<string name="text_haveattr_1">There are selection attributes\n(No Process)</string> | |||
<string name="text_haveattr_2">There are selection attributes</string> | |||
<string name="text_haveattr">Null</string> | |||
<string name="info_datanull">Data Null</string> | |||
<string name="info_editprocess">This combination has no process, please edit the process first!</string> | |||
<string name="info_selectprocess">Please select the subattribute for each row!</string> | |||
<string name="btn_addclass">Add Class</string> | |||
<string name="text_deleteinfo">Delete or Not?</string> | |||
<string name="btn_selectclass">Select Class</string> | |||
<string name="btn_selectclass_1">Select Attribute Class:</string> | |||
<string name="top_editclass">Edit Class</string> | |||
<string name="text_noselect">Unselect</string> | |||
<string name="text_attribute">Attribute</string> | |||
<string name="text_childattribute">Subattribute</string> | |||
<string name="btn_addattribute">+AddAttribute</string> | |||
<string name="btn_deleteattribute">-DeleteAttribute</string> | |||
<string name="btn_reviseattribute">ReviseAttribute</string> | |||
<string name="btn_addchildattribute">+AddSubattribute</string> | |||
<string name="top_addattribute">New Attribute Name</string> | |||
<string name="info_addattribute">Please enter a attribute name</string> | |||
<string name="top_revisechildattribute">Revise Subattribute Name</string> | |||
<string name="info_revisechildattribute">Please enter a subattribute name</string> | |||
<string name="top_addchildattribute">New Subattribute Name</string> | |||
<string name="top_reviseattribute">Revise Attribute Name</string> | |||
<string name="btn_new">New</string> | |||
<string name="top_addclass">New Class Name</string> | |||
<string name="info_addclass">Please enter a class name</string> | |||
<string name="top_reviseclass">Revise Class Name</string> | |||
<string name="top_deleteclass">Delete Class Name</string> | |||
<string name="top_importprocess">To Lead Existing Process</string> | |||
<string name="text_haveprocess_1">Existential process</string> | |||
<string name="text_haveprocess_2">Non-existent process</string> | |||
<string name="text_haveprocess_3">Unable to import while editing</string> | |||
<string name="text_cooking">Cooking</string> | |||
<string name="text_waitstart">Wait starting</string> | |||
<string name="text_expect">Expect to wait</string> | |||
<string name="btn_liquid">Liquid</string> | |||
<string name="text_Silo"> Bit Silo</string> | |||
<string name="text_capacityset">Capacity set</string> | |||
<string name="text_totalcapacity">Total Capacity:</string> | |||
<string name="text_alarmcapacity">Alarm Capacity:</string> | |||
<string name="text_calibrationspices">Calibration Spices</string> | |||
<string name="text_grammage">Grammage:</string> | |||
<string name="text_replacematerial">Replace Material</string> | |||
<string name="text_selectmaterial">Select Material:</string> | |||
<string name="btn_save">Save</string> | |||
<string name="text_valve">④(Valve)</string> | |||
<string name="text_servedish">Serve Dish</string> | |||
<string name="btn_single_silo">Single Silo Feed</string> | |||
<string name="btn_single_silo_clean">Single Silo Clean</string> | |||
<string name="btn_calibrated_spices">Calibrate Spices</string> | |||
<string name="top_passwordconfirm">Password Confirmation</string> | |||
<string name="text_permissionpassword">Please enter the permission password</string> | |||
<string name="top_operation">Operation instruction</string> | |||
<string name="top_operation_step_1">1. Material Settings: click "Settings" - "Material selection" to replace the material in the bunker.</string> | |||
<string name="top_operation_step_2">2. capacity Settings: Click "Settings" - "capacity Settings" \n, fill in the (total, alarm) capacity.</string> | |||
<string name="top_operation_step_3">3. material calibration: click "Settings" - "seasoning calibration", record the \n discharge gram re-write the calibration, save effective.\n (Note: This operation requires emptying the pipe first)</string> | |||
<string name="view_close">close</string> | |||
<string name="top_cleantip">Deep cleaning pumping amount</string> | |||
<string name="top_cleaninfo">Enter your dosage</string> | |||
<string name="text_calibrationinfo">The pipe needs to be emptied before calibration</string> | |||
<string name="top_autotest">Auto test</string> | |||
</resources> |
@@ -42,4 +42,156 @@ | |||
<string name="tip_save_cancel">取消</string> | |||
<string name="tip_save_confirm">确定</string> | |||
<!--TODO: 中英文对照表--> | |||
<string name="language">zh</string> | |||
<string name="btn_sign">登 录</string> | |||
<string name="text_Password">请输入密码!</string> | |||
<string name="text_User">请输入用户名</string> | |||
<string name="top_User">用户名</string> | |||
<string name="top_Password">密码</string> | |||
<string name="text_Login_Fass">账号密码不正确!</string> | |||
<string name="text_LoadInfo">软件初始化,加载中请稍后....</string> | |||
<string name="text_Appstart">程序启动中...</string> | |||
<string name="text_Login_Suc">登录成功!</string> | |||
<string name="text_StartCooking">开始烹饪</string> | |||
<string name="text_SDCZ">手动操作</string> | |||
<string name="text_home_SZ">料仓设置</string> | |||
<string name="text_home_CPYF">菜品研发</string> | |||
<string name="btn_exit">注销</string> | |||
<string name="btn_recipe">菜谱</string> | |||
<string name="btn_device">设备</string> | |||
<string name="btn_fry_sp">翻炒速度-按钮</string> | |||
<string name="btn_fry_fast">翻炒速度 快-按钮</string> | |||
<string name="btn_fry_middle">翻炒速度 中-按钮</string> | |||
<string name="btn_fry_slow">翻炒速度 慢-按钮</string> | |||
<string name="btn_fry_stop">翻炒速度 停-按钮</string> | |||
<string name="btn_fast">快</string> | |||
<string name="btn_middle">中</string> | |||
<string name="btn_slow">慢</string> | |||
<string name="btn_stop">停</string> | |||
<string name="btn_pot">锅口朝向-按钮</string> | |||
<string name="btn_origin">原点位-按钮</string> | |||
<string name="btn_maintain">维护位-按钮</string> | |||
<string name="btn_fry">炒菜位-按钮</string> | |||
<string name="btn_extract">抽料位-按钮</string> | |||
<string name="btn_pour">倒菜位-按钮</string> | |||
<string name="btn_clean">清洗位-按钮</string> | |||
<string name="btn_watergun">洗锅水枪-按钮</string> | |||
<string name="btn_addwater">锅内加水-按钮</string> | |||
<string name="text_potdirection_1">请先控制锅口朝向:抽料位</string> | |||
<string name="text_potdirection_2">请先控制锅口朝向:清洗位</string> | |||
<string name="text_waterset">未设置</string> | |||
<string name="btn_waterset">设置</string> | |||
<string name="btn_pourmeal">出 餐-按钮</string> | |||
<string name="btn_putmeal">投料-按钮</string> | |||
<string name="text_waitput">请耐心等待上一次投料结束!!!</string> | |||
<string name="btn_initialize">初始化</string> | |||
<string name="btn_rinse">清洗</string> | |||
<string name="text_localrecipe">本地菜谱</string> | |||
<string name="text_cloudrecipe">云端菜谱</string> | |||
<string name="text_deviceconnect">设备状态:已连接</string> | |||
<string name="text_devicedisconnect">设备状态:未连接</string> | |||
<string name="btn_return">返 回</string> | |||
<string name="text_top_cpgl">菜品管理</string> | |||
<string name="btn_downloadall">下载所有商品</string> | |||
<string name="btn_refresh">刷 新</string> | |||
<string name="btn_download">下载</string> | |||
<string name="text_downloadsuc">下载成功!</string> | |||
<string name="text_downloadinfo">请先下载该商品</string> | |||
<string name="btn_update">上传</string> | |||
<string name="btn_delete">删除</string> | |||
<string name="text_deleterecipe">删除菜品</string> | |||
<string name="btn_deleteall">删除所有商品</string> | |||
<string name="btn_updateall">上传所有商品</string> | |||
<string name="text_edit">编辑菜品</string> | |||
<string name="text_selectpic">选择图片:</string> | |||
<string name="text_recipename">菜品名称:</string> | |||
<string name="btn_cancel">取消</string> | |||
<string name="btn_next">下一步</string> | |||
<string name="text_inputrecipe">请输入菜品名称!</string> | |||
<string name="text_selectab">选择属性</string> | |||
<string name="text_commodityab">商品属性:</string> | |||
<string name="text_defaultab">默认属性:</string> | |||
<string name="text_prev">上一步</string> | |||
<string name="btn_cooking">去烹饪</string> | |||
<string name="btn_editprocess">编辑工序</string> | |||
<string name="btn_deleterecipe">删除配方</string> | |||
<string name="text_writeprocess">按编号填写主料名称</string> | |||
<string name="text_bit_1">1号位</string> | |||
<string name="text_bit_2">2号位</string> | |||
<string name="text_bit_3">3号位</string> | |||
<string name="text_bit_4">4号位</string> | |||
<string name="text_savereturn">保存并返回</string> | |||
<string name="btn_tolead">导入工序</string> | |||
<string name="text_step">步骤</string> | |||
<string name="text_cookprocess">烹饪工艺</string> | |||
<string name="btn_cooksimulate">模拟炒制</string> | |||
<string name="btn_add">+添加</string> | |||
<string name="btn_insert">插入</string> | |||
<string name="btn_upinsert">向上插入</string> | |||
<string name="btn_Downinsert">向下插入</string> | |||
<string name="btn_revise">修改</string> | |||
<string name="btn_create">创建</string> | |||
<string name="text_haveattr_1">存在选择组合\n(没有工序)</string> | |||
<string name="text_haveattr_2">存在选择组合</string> | |||
<string name="text_haveattr">不存在选中组合</string> | |||
<string name="info_datanull">数据为空</string> | |||
<string name="info_editprocess">该组合没有工序,请先编辑工序</string> | |||
<string name="info_selectprocess">请选择每行对应的子属性!</string> | |||
<string name="btn_selectclass">选择分类</string> | |||
<string name="btn_selectclass_1">选择属性分类:</string> | |||
<string name="btn_addclass">添加分类</string> | |||
<string name="text_deleteinfo">是否删除?</string> | |||
<string name="top_editclass">编辑分类</string> | |||
<string name="text_noselect">未选择</string> | |||
<string name="text_attribute">属性</string> | |||
<string name="text_childattribute">子属性</string> | |||
<string name="btn_addattribute">+添加属性</string> | |||
<string name="btn_deleteattribute">-删除属性</string> | |||
<string name="btn_reviseattribute">修改属性</string> | |||
<string name="btn_addchildattribute">+添加子属性</string> | |||
<string name="top_addattribute">新增属性名称</string> | |||
<string name="info_addattribute">请输入属性名称</string> | |||
<string name="top_revisechildattribute">修改子属性名称</string> | |||
<string name="info_revisechildattribute">请输入子属性名称</string> | |||
<string name="top_addchildattribute">新增子属性名称</string> | |||
<string name="top_reviseattribute">修改属性名称</string> | |||
<string name="btn_new">新增</string> | |||
<string name="top_addclass">新增分类名称</string> | |||
<string name="info_addclass">请输入分类名称</string> | |||
<string name="top_reviseclass">修改分类名称</string> | |||
<string name="top_deleteclass">删除分类名称</string> | |||
<string name="top_importprocess">导入已有工序组合</string> | |||
<string name="text_haveprocess_1">存在分组</string> | |||
<string name="text_haveprocess_2">不存在分组</string> | |||
<string name="text_haveprocess_3">正在编辑无法导入</string> | |||
<string name="text_cooking">菜谱烹饪</string> | |||
<string name="text_waitstart">等待开始</string> | |||
<string name="text_expect">预计等待</string> | |||
<string name="btn_liquid">液料</string> | |||
<string name="text_Silo"> 号料仓</string> | |||
<string name="text_capacityset">容量设置</string> | |||
<string name="text_totalcapacity">总容量:</string> | |||
<string name="text_alarmcapacity">告警容量:</string> | |||
<string name="text_calibrationspices">调料标定</string> | |||
<string name="text_grammage">克重:</string> | |||
<string name="text_replacematerial">更换物料</string> | |||
<string name="text_selectmaterial">物料选择:</string> | |||
<string name="btn_save">保存</string> | |||
<string name="text_valve">④(水阀)</string> | |||
<string name="text_servedish">出餐</string> | |||
<string name="btn_single_silo">单仓补料</string> | |||
<string name="btn_single_silo_clean">单仓清洗</string> | |||
<string name="btn_calibrated_spices">调料校准</string> | |||
<string name="top_passwordconfirm">密码确认</string> | |||
<string name="text_permissionpassword">在此输入权限密码</string> | |||
<string name="top_operation">操作说明</string> | |||
<string name="top_operation_step_1">1、物料设置:点击“设置”-“物料选择”,更换料仓物料。</string> | |||
<string name="top_operation_step_2">2、容量设置:点击“设置”-“容量设置”,填写(总、告警)容量。</string> | |||
<string name="top_operation_step_3">3、物料校准:点击“设置”-“调料校准”,记录出料克重写入标定处,保存生效。注意:此操作需要先排空管道)</string> | |||
<string name="view_close">关</string> | |||
<string name="top_cleantip">深度清洗抽水用量</string> | |||
<string name="top_cleaninfo">在此输入您的用量</string> | |||
<string name="text_calibrationinfo">标定前需要排空管道</string> | |||
<string name="top_autotest">模块自动测试</string> | |||
</resources> |