@@ -0,0 +1,367 @@ | |||
package com.bonait.bnframework.business; | |||
import android.util.Log; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODPROPERTY; | |||
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_GOODSRECIPENAME; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.mode.BPA_MENU; | |||
import com.bonait.bnframework.common.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.bonait.bnframework.common.helper.AES; | |||
import com.bonait.bnframework.common.helper.I.IMessage; | |||
import com.bonait.bnframework.common.helper.I.IRun; | |||
import com.bonait.bnframework.common.helper.I.IThread; | |||
import com.bonait.bnframework.common.helper.Json; | |||
import com.bonait.bnframework.common.helper.MQTT; | |||
import com.bonait.bnframework.common.helper.MessageLog; | |||
import com.bonait.bnframework.common.helper.ThreadManager; | |||
import com.bonait.bnframework.common.helper.mode.BPAPackage; | |||
import com.bonait.bnframework.common.helper.mode.BPA_GoodsInfo; | |||
import com.bonait.bnframework.common.helper.mode.BPA_HeartPackage; | |||
import com.bonait.bnframework.common.helper.mode.BatchingsInfo; | |||
import com.bonait.bnframework.common.helper.mode.Batchingstechnology; | |||
import com.bonait.bnframework.common.helper.mode.BomAttributeValueReInfo; | |||
import com.bonait.bnframework.common.helper.mode.GoodsAttributeInfo; | |||
import com.bonait.bnframework.common.helper.mode.GoodsAttributeValueInfo; | |||
import com.bonait.bnframework.common.helper.mode.GoodsBom; | |||
import com.bonait.bnframework.common.helper.mode.GyAction; | |||
import com.bonait.bnframework.common.helper.mode.Message_HeartModel; | |||
import com.bonait.bnframework.common.helper.mode.PushDeviceGoods; | |||
import com.bonait.bnframework.common.helper.mode.TechnologyActions; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.Comparator; | |||
import java.util.Date; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
import java.util.concurrent.ConcurrentLinkedQueue; | |||
/** | |||
* 订单服务 | |||
* 收发订单、订单预警、接收云端订单信息 | |||
*/ | |||
public class OrderServer { | |||
//region 私有单例 | |||
private static volatile OrderServer _instance; | |||
public static OrderServer Get() { | |||
if (_instance == null) | |||
_instance = new OrderServer(); | |||
return _instance; | |||
} | |||
private OrderServer() { | |||
} | |||
//endregion | |||
//region 变量 | |||
//endreigon | |||
//region 公共函数 | |||
/** | |||
* 初始化 | |||
*/ | |||
public void Init() | |||
{ | |||
} | |||
/** | |||
* MQTT初始化 | |||
*/ | |||
public void MqttInit() | |||
{ | |||
//消息回调 | |||
MQTT.get().callback=new IMessage() { | |||
@Override | |||
public void MessageRecive(String topic, String Message) { | |||
try { | |||
if(!Message.isEmpty()) | |||
{ | |||
String msg= new AES().Decrypt(Message); | |||
if(!msg.isEmpty()) | |||
{ | |||
Log.d("远程数据更新", msg); | |||
BPAPackage model=new Json<BPAPackage>().jsonToobject(BPAPackage.class,((String)msg)); | |||
if((model.ClientId+"").equals(ConfigName.getInstance().DeviceAutoKey) && model.ClientType==9) | |||
{ | |||
MessageLog.ShowInfo("收到远程更新数据通知!"); | |||
RefreshTheData(model.Message); | |||
} | |||
} | |||
} | |||
} catch (Exception e) { | |||
Log.d("1", "MessageRecive: "); | |||
} | |||
} | |||
}; | |||
//连接成功标志 | |||
MQTT.get().ConnectOk=new IRun() { | |||
@Override | |||
public void Run() { | |||
String[] Str={ConfigName.getInstance().mqtt_topic+ ConfigName.getInstance().ClientAutoKey}; | |||
MQTT.get().Subscrib(Str); | |||
MessageLog.ShowInfo("订阅主题:" + Str); | |||
} | |||
}; | |||
//初始化MQTT连接 | |||
MQTT.get().Connect(ConfigName.getInstance().mqtt_userName, | |||
ConfigName.getInstance().mqtt_passWord, | |||
ConfigName.getInstance().mqtt_ip, | |||
ConfigName.getInstance().mqtt_post); | |||
ThreadManager.Get().StartLong("心跳服务", true, new IThread() { | |||
@Override | |||
public void Run() throws InterruptedException { | |||
if(MQTT.get().IsConnect) | |||
{ | |||
try { | |||
PushHeart(); | |||
} catch (Exception e) { | |||
} | |||
} | |||
Thread.sleep(1000); | |||
} | |||
@Override | |||
public void RunComplete() throws InterruptedException { | |||
} | |||
}); | |||
} | |||
public void PushHeart() throws Exception { | |||
BPA_HeartPackage heart=new BPA_HeartPackage(); | |||
heart.MessageId=16; | |||
heart.ClientId=Integer.parseInt(ConfigName.getInstance().DeviceAutoKey); | |||
heart.ClientType=9; | |||
Message_HeartModel mode=new Message_HeartModel(); | |||
mode.DeviceType=9; | |||
mode.Healthy=1; | |||
heart.Message=mode; | |||
heart.MessageVersion=0; | |||
heart.Timestamp=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); | |||
String Message= new Json<BPA_HeartPackage>().objectToJson(BPA_HeartPackage.class,heart); | |||
String msg= new AES().Encrypt(Message); | |||
MQTT.get().publish(ConfigName.getInstance().mqtt_hearttopic,msg); | |||
} | |||
/** | |||
* 刷新数据 | |||
* @param data | |||
*/ | |||
public void RefreshTheData(PushDeviceGoods data) | |||
{ | |||
try { | |||
//region 更新商品类型 | |||
List<String> GoodType=new ArrayList<>(); | |||
for (BPA_GOODSTYPE item: QueryDB.GetGoodsTypeALL()) | |||
{ | |||
QueryDB.DeleteGoodsType(item); | |||
} | |||
for (BPA_GoodsInfo item:data.GoodsInfos) | |||
{ | |||
if(!GoodType.contains(item.Goods_TypeID)) | |||
{ | |||
BPA_GOODSTYPE bpa_goodstype = new BPA_GOODSTYPE(); | |||
bpa_goodstype.id=item.TypeId; | |||
bpa_goodstype.name =item.Goods_TypeID; | |||
bpa_goodstype.deviceID = ConfigName.getInstance().DeviceId; | |||
bpa_goodstype.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddGoodsType(bpa_goodstype); | |||
} | |||
GoodType.add(item.Goods_TypeID); | |||
} | |||
//endregion | |||
//region 更新规格属性 | |||
for (BPA_GOODPROPERTY item: QueryDB.GetGoodsPropertyALL("0")) | |||
{ | |||
ArrayList<BPA_GOODPROPERTY> ddd=QueryDB.GetGoodsPropertyALL(item.id); | |||
for (BPA_GOODPROPERTY item1:ddd) | |||
{ | |||
QueryDB.DeleteGoodsProperty(item1); | |||
} | |||
QueryDB.DeleteGoodsProperty(item); | |||
} | |||
for (GoodsAttributeInfo info :data.GoodsAttributeInfo) | |||
{ | |||
BPA_GOODPROPERTY bpa_goodproperty = new BPA_GOODPROPERTY(); | |||
bpa_goodproperty.id=info.Id; | |||
bpa_goodproperty.name = info.AttributeName; | |||
bpa_goodproperty.foreignKeyRe = ""; | |||
bpa_goodproperty.parentid = "0"; | |||
bpa_goodproperty.GoodsTypeId=info.GoodsTypeId; | |||
bpa_goodproperty.sort=info.Sort; | |||
bpa_goodproperty.deviceID = ConfigName.getInstance().DeviceId; | |||
bpa_goodproperty.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddGoodsProperty(bpa_goodproperty); | |||
for (GoodsAttributeValueInfo val: info.GoodsAttributeValue) | |||
{ | |||
bpa_goodproperty.id=val.Id; | |||
bpa_goodproperty.name = val.AttributeValue; | |||
bpa_goodproperty.foreignKeyRe = val.WaiKey; | |||
bpa_goodproperty.parentid = info.Id; | |||
bpa_goodproperty.GoodsTypeId=""; | |||
bpa_goodproperty.sort=val.Sort; | |||
bpa_goodproperty.deviceID = ConfigName.getInstance().DeviceId; | |||
bpa_goodproperty.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddGoodsProperty(bpa_goodproperty); | |||
} | |||
} | |||
//endregion | |||
//region 更新商品数据 | |||
for (BPA_GOODS item:QueryDB.GetGoodsALL()) | |||
{ | |||
QueryDB.DeleteGoods(item); | |||
} | |||
int k=1; | |||
for (BPA_GoodsInfo item:data.GoodsInfos) | |||
{ | |||
BPA_GOODS goodx = new BPA_GOODS(); | |||
goodx.id=item.Id; | |||
goodx.name = item.Goods_Name; | |||
goodx.sort = item.Goods_Sort==0?k: item.Goods_Sort; | |||
goodx.maketime = 180; | |||
goodx.issc = 1; | |||
goodx.status = item.Status==1?0:1; | |||
goodx.url=item.Goods_ImgUrl; | |||
goodx.deviceID = ConfigName.getInstance().DeviceId; | |||
goodx.userID = ConfigName.getInstance().user.userID; | |||
goodx.foreignKeyRe=item.ForeignKeyRe; | |||
goodx.goodtype=item.TypeId; | |||
goodx.materialids=item.materialids; | |||
QueryDB.AddGoods(goodx); | |||
k++; | |||
} | |||
//endregion | |||
//region 更新物料数据,料仓物料绑定关系 | |||
for (BPA_MATERIAL item:QueryDB.GetMaterialALL()) | |||
{ | |||
QueryDB.DeleteMaterial(item); | |||
} | |||
//物料id / 物料数据 | |||
ConcurrentHashMap<String,BPA_MATERIAL> Info=new ConcurrentHashMap<>(); | |||
List<BatchingsInfo> bayc=data.BatchingsInfos; | |||
Collections.sort(bayc, new Comparator<BatchingsInfo>() { | |||
@Override | |||
public int compare(BatchingsInfo o1, BatchingsInfo o2) { | |||
return Double.valueOf(o1.BatchingKey).compareTo(Double.valueOf(o2.BatchingKey)); | |||
} | |||
}); | |||
Integer I=0; | |||
for (BatchingsInfo item:bayc) | |||
{ | |||
BPA_MATERIAL bpa_material=new BPA_MATERIAL(); | |||
bpa_material.id=item.BatchingId; | |||
bpa_material.name=item.BatchingName; | |||
bpa_material.imgUrl=""; | |||
bpa_material.type=0; | |||
bpa_material.createTime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(new Date().getTime() + I*1000));; | |||
bpa_material.deviceID= ConfigName.getInstance().DeviceId; | |||
bpa_material.userID=ConfigName.getInstance().user.userID; | |||
if(!Info.containsKey(item.BatchingId)) | |||
Info.put(item.BatchingId,bpa_material); | |||
I++; | |||
} | |||
for (String item:Info.keySet()) | |||
{ | |||
QueryDB.AddMaterial(Info.get(item)); | |||
} | |||
for (BPA_SILOSANDMATERIAL item:QueryDB.GetSilosAndMaterialALL())//删除料仓关联物料 | |||
{ | |||
BatchingsInfo info=null; | |||
for (BatchingsInfo wl:bayc) | |||
{ | |||
if (wl.BatchingId.equals(item.materialID)) | |||
{ | |||
info=wl; | |||
} | |||
} | |||
if(info==null) | |||
{ | |||
item.materialID=""; | |||
QueryDB.UpdateSilosAndMaterial(item); | |||
} | |||
} | |||
//endregion | |||
//region 更新商品配方 配方信息 | |||
for (BPA_GOODSRECIPENAME item:QueryDB.GetGoodsSrecipeNameALL())//商品配方表 | |||
{ | |||
QueryDB.DeleteGoodsRecipeName(item); | |||
} | |||
for (BPA_GOODSRECIPE item:QueryDB.GetGoodsSrecipeALL())//删除商品配方明细 | |||
{ | |||
QueryDB.DeleteGoodsSrecipe(item); | |||
} | |||
ConcurrentHashMap<String, BomAttributeValueReInfo> bomAttributeValueReInfo=new ConcurrentHashMap<>(); | |||
for (BomAttributeValueReInfo item:data.BomAttributeValueReInfo)//商品配方关联表 | |||
{ | |||
if(!Info.containsKey(item.GoodsId+","+item.BoomId)) | |||
{ | |||
bomAttributeValueReInfo.put(item.GoodsId+","+item.BoomId,item); | |||
} | |||
} | |||
for (GoodsBom item:data.GoodsBomInfos)//商品配方信息 | |||
{ | |||
BPA_GOODSRECIPENAME n=new BPA_GOODSRECIPENAME(); | |||
n.id=item.GoodsBomId; | |||
n.name=item.BomName; | |||
n.goodsID=item.GoodsId; | |||
BomAttributeValueReInfo km=bomAttributeValueReInfo.get(item.GoodsId+","+item.BomId); | |||
if(km!=null) | |||
{ | |||
n.design=km.GoodsAttributeValueId; | |||
} | |||
QueryDB.AddGoodsRecipeName(n); | |||
BPA_GOODSRECIPE da=new BPA_GOODSRECIPE(); | |||
da.goodsID = item.GoodsId; | |||
da.exp=item.BomName; | |||
da.materialType =1; | |||
da.recipeID=item.GoodsBomId; | |||
da.deviceID = ConfigName.getInstance().DeviceId; | |||
da.userID = ConfigName.getInstance().user.userID; | |||
for (BatchingsInfo info: data.BatchingsInfos) | |||
{ | |||
if(info.GoodsBomId.equals(item.GoodsBomId)) | |||
{ | |||
da.id=info.Id; | |||
da.materialID = info.BatchingId; | |||
da.value =String.format ("%.1f", info.BomQty); | |||
da.sort =0; | |||
QueryDB.AddGoodsSrecipe(da); | |||
} | |||
} | |||
} | |||
//endregion | |||
} catch (Exception e) { | |||
Log.d("TAG", "RefreshTheData: "); | |||
} | |||
} | |||
//endregion | |||
} |
@@ -747,6 +747,10 @@ public class ConfigName { | |||
add(new Res_PLCADDRESS("手动控制11", "M52.0", 1, 1)); | |||
add(new Res_PLCADDRESS("手动控制12", "M52.1", 1, 1)); | |||
add(new Res_PLCADDRESS("手动控制13", "M52.2", 1, 1)); | |||
add(new Res_PLCADDRESS("手动控制14", "M52.3", 1, 1)); | |||
add(new Res_PLCADDRESS("手动控制15", "M52.4", 1, 1)); | |||
add(new Res_PLCADDRESS("手动控制16", "M52.5", 1, 1)); | |||
add(new Res_PLCADDRESS("M_外置仓1反转", "M50.6", 1, 1)); | |||
add(new Res_PLCADDRESS("M_外置仓2反转", "M50.7", 1, 1)); | |||
@@ -807,6 +811,9 @@ public class ConfigName { | |||
add(new ResSilosModel("陈醋仓", 11)); | |||
add(new ResSilosModel("猪油仓", 12)); | |||
add(new ResSilosModel("牛油仓", 13)); | |||
add(new ResSilosModel("粉料仓", 14)); | |||
add(new ResSilosModel("粉料仓", 15)); | |||
add(new ResSilosModel("粉料仓", 16)); | |||
}}; | |||
/** | |||
@@ -291,7 +291,8 @@ public class DataBus { | |||
_chid.add(m); | |||
} | |||
re.child = _chid; | |||
re.GoodsTypeId=item.GoodsTypeId; | |||
re.sort= item.sort; | |||
bpa_goodproperties.add(re); | |||
} | |||
@@ -1075,7 +1075,7 @@ public class QueryDB { | |||
* @return | |||
*/ | |||
public static ArrayList<BPA_GOODPROPERTY> GetGoodsPropertyALL(String parentid) { | |||
String orderby = Desc_Time_Up;//先按排序 创建时间倒序 | |||
String orderby = Desc_Sort_Up + ',' +Desc_Time_Up;//先按排序 创建时间倒序 | |||
String where = "isDelete=? and parentid=?"; | |||
String[] args = new String[]{"0", parentid}; | |||
ArrayList<BPA_GOODPROPERTY> data = new ArrayList<>(); | |||
@@ -1144,6 +1144,22 @@ public class QueryDB { | |||
Update(BPA_GOODPROPERTY.class, goodproperty); | |||
} | |||
} | |||
public static void UpdateGoodsPropertySort(String id, int sort) { | |||
BPA_GOODPROPERTY goodproperty = GetGoodsPropertyID(id); | |||
if (goodproperty != null) { | |||
goodproperty.sort = sort; | |||
Update(BPA_GOODPROPERTY.class, goodproperty); | |||
} | |||
} | |||
public static void UpdateGoodsPropertyType(String id, String sort) { | |||
BPA_GOODPROPERTY goodproperty = GetGoodsPropertyID(id); | |||
if (goodproperty != null) { | |||
goodproperty.GoodsTypeId = sort; | |||
Update(BPA_GOODPROPERTY.class, goodproperty); | |||
} | |||
} | |||
//endregion | |||
//region BPA_GOODSRECIPENAME 商品配方关联表 | |||
@@ -1180,6 +1196,23 @@ public class QueryDB { | |||
return Delete(BPA_GOODSRECIPENAME.class, data.id); | |||
} | |||
/** | |||
* 获取所有商品配方明细 | |||
* | |||
* @return | |||
*/ | |||
public static ArrayList<BPA_GOODSRECIPENAME> GetGoodsSrecipeNameALL() { | |||
String orderby = Desc_Time_Up;//先按排序 创建时间倒序 | |||
String where = "isDelete=?"; | |||
String[] args = new String[]{"0"}; | |||
ArrayList<BPA_GOODSRECIPENAME> data = new ArrayList<>(); | |||
ArrayList<Object> obj = Get(BPA_GOODSRECIPENAME.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data.add((BPA_GOODSRECIPENAME) k); | |||
} | |||
return data; | |||
} | |||
/** | |||
* 商品ID查询配方关联表 | |||
* | |||
@@ -3213,6 +3246,9 @@ public class QueryDB { | |||
((BPA_GOODPROPERTY) data).name = cursor.getString((int) cursor.getColumnIndex("name")); | |||
((BPA_GOODPROPERTY) data).foreignKeyRe = cursor.getString((int) cursor.getColumnIndex("foreignKeyRe")); | |||
((BPA_GOODPROPERTY) data).parentid = cursor.getString((int) cursor.getColumnIndex("parentid")); | |||
((BPA_GOODPROPERTY) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); | |||
((BPA_GOODPROPERTY) data).GoodsTypeId = cursor.getString((int) cursor.getColumnIndex("GoodsTypeId")); | |||
break; | |||
case "BPA_GOODSRECIPENAME": | |||
data = new BPA_GOODSRECIPENAME(); | |||
@@ -11,4 +11,12 @@ public class BPA_GOODPROPERTY extends ModeBase { | |||
public String foreignKeyRe; | |||
//父id | |||
public String parentid; | |||
/** | |||
* 排序 | |||
*/ | |||
public int sort; | |||
/** | |||
* 商品类型id | |||
*/ | |||
public String GoodsTypeId; | |||
} |
@@ -46,4 +46,10 @@ public class BPA_GoodsInfo { | |||
public String UpdateBy; | |||
public String GroupId; | |||
public String ForeignKeyRe;//外键 | |||
public String Design;//做法 | |||
public String TypeId;//小类id | |||
public String materialids;//默认物料集合 | |||
} |
@@ -0,0 +1,18 @@ | |||
package com.bonait.bnframework.common.helper.mode; | |||
public class BomAttributeValueReInfo | |||
{ | |||
public String Id ; | |||
/** | |||
* 商品id | |||
*/ | |||
public String GoodsId ; | |||
/** | |||
* 配方id | |||
*/ | |||
public String BoomId ; | |||
/** | |||
* 商品做法id | |||
*/ | |||
public String GoodsAttributeValueId ; | |||
} |
@@ -0,0 +1,27 @@ | |||
package com.bonait.bnframework.common.helper.mode; | |||
import java.util.List; | |||
/** | |||
* 规格属性表 | |||
*/ | |||
public class GoodsAttributeInfo | |||
{ | |||
public String Id; | |||
/** | |||
* 属性名称 | |||
*/ | |||
public String AttributeName; | |||
/** | |||
* 商品类型id | |||
*/ | |||
public String GoodsTypeId; | |||
/** | |||
* 排序 | |||
*/ | |||
public int Sort; | |||
/** | |||
* 子属性 | |||
*/ | |||
public List<GoodsAttributeValueInfo> GoodsAttributeValue; | |||
} |
@@ -0,0 +1,22 @@ | |||
package com.bonait.bnframework.common.helper.mode; | |||
public class GoodsAttributeValueInfo | |||
{ | |||
public String Id; | |||
/** | |||
* 商品属性id | |||
*/ | |||
public String GoodsAttributeId; | |||
/** | |||
* 属性名称 | |||
*/ | |||
public String AttributeValue; | |||
/** | |||
* 排序 | |||
*/ | |||
public int Sort; | |||
/** | |||
* 外键 | |||
*/ | |||
public String WaiKey; | |||
} |
@@ -0,0 +1,8 @@ | |||
package com.bonait.bnframework.common.helper.mode; | |||
public class GyAction { | |||
public String TechnologyactionId ;//工艺id | |||
public String ActionName ;//名称 | |||
public String ActionValue ;//变量 | |||
public String BatchingId ;//物料id | |||
} |
@@ -19,7 +19,19 @@ public class PushDeviceGoods { | |||
/// </summary> | |||
public List<BatchingsInfo> BatchingsInfos; | |||
/// <summary> | |||
/// 配方绑定的工艺 | |||
/// 配方绑定的工艺-> 单流程工艺 | |||
/// </summary> | |||
public List<Batchingstechnology> Batchingstechnologys; | |||
/// <summary> | |||
/// 商品工艺信息 -->多流程工艺 | |||
/// </summary> | |||
public List<TechnologyActions> TechnologyActions; //暂时不使用 | |||
/// <summary> | |||
/// 商品属性 | |||
/// </summary> | |||
public List<GoodsAttributeInfo> GoodsAttributeInfo ; | |||
/// <summary> | |||
/// 商品配方关联表 | |||
/// </summary> | |||
public List<BomAttributeValueReInfo> BomAttributeValueReInfo; | |||
} |
@@ -0,0 +1,11 @@ | |||
package com.bonait.bnframework.common.helper.mode; | |||
public class TechnologyActions { | |||
public String Id ; | |||
public String StepName;//工艺名称 | |||
public boolean IsBatch ;//是否批量处理 | |||
public String BomId ;// 配方分类 id | |||
public String ChnologyId ;//工艺模型id | |||
public String ActionJson ;//信息json | |||
public String Sort;//排序 | |||
} |
@@ -12,9 +12,11 @@ import android.widget.RelativeLayout; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.business.OrderServer; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.helper.I.IThread; | |||
import com.bonait.bnframework.common.helper.MQTT; | |||
import com.bonait.bnframework.common.helper.MediaPlayerHelper; | |||
import com.bonait.bnframework.common.helper.MessageLog; | |||
import com.bonait.bnframework.common.helper.ThreadManager; | |||
@@ -73,6 +75,7 @@ public class BottomNavigationMainActivity extends BaseActivity { | |||
//关闭PLC连接 | |||
ConfigData.getInstance().ColsePLC(); | |||
MediaPlayerHelper.getInstance().Release(); | |||
MQTT.get().ConnMqttBroken(false);//释放mqtt | |||
super.onDestroy(); | |||
} | |||
@@ -114,6 +117,8 @@ public class BottomNavigationMainActivity extends BaseActivity { | |||
ConfigData.getInstance().ToggleEnvironment(); | |||
//2.初始化PLC | |||
ReconnectModbus(); | |||
//MQTT数据监听 | |||
OrderServer.Get().MqttInit(); | |||
//初始化阿里云连接 | |||
//AliyunIOTManager.getInstance().OpenDev(this); | |||
} | |||
@@ -6,6 +6,7 @@ import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.ArrayAdapter; | |||
import android.widget.Button; | |||
import android.widget.ImageView; | |||
import android.widget.TextView; | |||
import androidx.annotation.NonNull; | |||
@@ -42,8 +43,8 @@ public class goodpf_apapter extends ArrayAdapter<BPA_GOODSRECIPENAME> { | |||
View view = LayoutInflater.from(getContext()).inflate(resource1, parent, false); | |||
//分别获取 image view 和 textview 的实例 | |||
TextView name = view.findViewById(R.id.name); | |||
Button button = view.findViewById(R.id.button_item); | |||
Button button_update = view.findViewById(R.id.button_update); | |||
ImageView button = view.findViewById(R.id.button_item); | |||
ImageView button_update = view.findViewById(R.id.button_update); | |||
// 设置要显示的图片和文字 | |||
name.setText(bpa_goodsrecipename.name); | |||
@@ -16,6 +16,7 @@ import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODPROPERTY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.view.MyLayoutManager; | |||
@@ -29,13 +30,16 @@ public class sx_adapter extends ArrayAdapter<BPA_GOODPROPERTY> { | |||
*/ | |||
private MyClickListener mListener; | |||
private List<BPA_GOODPROPERTY> datas; | |||
private ArrayList<BPA_GOODSTYPE> goodstypes; | |||
int resource1; | |||
public Context contextA; | |||
public sx_adapter(@NonNull Context context, int resource, @NonNull List<BPA_GOODPROPERTY> objects, MyClickListener listener) { | |||
public sx_adapter(@NonNull Context context, int resource, @NonNull List<BPA_GOODPROPERTY> objects, ArrayList<BPA_GOODSTYPE> bpa_goodstypes, MyClickListener listener) { | |||
super(context, resource, objects); | |||
mListener = listener; | |||
contextA=context; | |||
datas=objects; | |||
goodstypes=bpa_goodstypes; | |||
this.resource1=resource; | |||
} | |||
//每个子项被滚动到屏幕内的时候会被调用 | |||
@@ -47,8 +51,12 @@ public class sx_adapter extends ArrayAdapter<BPA_GOODPROPERTY> { | |||
View view = LayoutInflater.from(getContext()).inflate(resource1, parent, false); | |||
//分别获取 image view 和 textview 的实例 | |||
TextView name = view.findViewById(R.id.name);//属性名称 | |||
TextView sort = view.findViewById(R.id.sort);//排序 | |||
TextView typeS = view.findViewById(R.id.typeS);//排序 | |||
ImageView button = view.findViewById(R.id.button_item);//删除 | |||
ImageView button_add = view.findViewById(R.id.button_add);//增加 子属性 | |||
RecyclerView recyclerView=view.findViewById(R.id.recycler_view); | |||
ArrayList<BPA_GOODPROPERTY> zsx= QueryDB.GetGoodsPropertyALL(bpa_goodproperty.id); | |||
@@ -62,7 +70,9 @@ public class sx_adapter extends ArrayAdapter<BPA_GOODPROPERTY> { | |||
// 设置要显示的图片和文字 | |||
name.setText(bpa_goodproperty.name); | |||
sort.setText(bpa_goodproperty.sort+""); | |||
typeS.setText(GetName(bpa_goodproperty.GoodsTypeId)); | |||
name.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
@@ -70,6 +80,20 @@ public class sx_adapter extends ArrayAdapter<BPA_GOODPROPERTY> { | |||
} | |||
}); | |||
sort.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
if(mListener!=null) mListener.clickListener(view,bpa_goodproperty); | |||
} | |||
}); | |||
typeS.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
if(mListener!=null) mListener.clickListener(view,bpa_goodproperty); | |||
} | |||
}); | |||
button.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
@@ -85,4 +109,27 @@ public class sx_adapter extends ArrayAdapter<BPA_GOODPROPERTY> { | |||
}); | |||
return view; | |||
} | |||
public String GetName(String ids) | |||
{ | |||
String name=""; | |||
if(ids==null || ids.isEmpty()) | |||
{ | |||
return ""; | |||
} | |||
for (BPA_GOODSTYPE item:goodstypes) | |||
{ | |||
if(ids.contains(item.id)) | |||
{ | |||
name+=item.name+","; | |||
} | |||
} | |||
if(!name.isEmpty()) | |||
{ | |||
name=name.substring(0, name.length() - 1); | |||
} | |||
return name; | |||
} | |||
} |
@@ -64,13 +64,19 @@ public class zsx_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder; | |||
myViewHolder.edittext.setText(goodproperty.name+""); | |||
myViewHolder.edittext_wj.setText(goodproperty.foreignKeyRe+""); | |||
myViewHolder.edittext_px.setText(goodproperty.sort+""); | |||
myViewHolder.save_text.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
String xh=myViewHolder.edittext_px.getText().toString(); | |||
if(xh==null || xh.isEmpty()) | |||
{ | |||
ToastUtils.info("排序不能为空"); | |||
return; | |||
} | |||
goodproperty.name=myViewHolder.edittext.getText().toString(); | |||
goodproperty.foreignKeyRe=myViewHolder.edittext_wj.getText().toString(); | |||
goodproperty.sort=Integer.parseInt(xh); | |||
if (goodproperty.name.isEmpty()) { | |||
ToastUtils.info("属性名称不能为空"); | |||
return; | |||
@@ -129,6 +135,7 @@ public class zsx_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||
public static class MyLCViewHolder1 extends RecyclerView.ViewHolder { | |||
EditText edittext;//名称 | |||
EditText edittext_wj;//外键 | |||
EditText edittext_px;//排序 | |||
TextView save_text; | |||
TextView delete_text; | |||
public MyLCViewHolder1(View view) { | |||
@@ -137,7 +144,7 @@ public class zsx_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||
edittext_wj=view.findViewById(R.id.edittext_wj); | |||
save_text=view.findViewById(R.id.save_text); | |||
delete_text=view.findViewById(R.id.delete_text); | |||
edittext_px=view.findViewById(R.id.edittext_px); | |||
} | |||
} | |||
} |
@@ -317,7 +317,8 @@ public class GoodPeiFangActivity extends BaseActivity { | |||
_chid.add(m); | |||
} | |||
re.child = _chid; | |||
re.GoodsTypeId=item.GoodsTypeId; | |||
re.sort= item.sort; | |||
bpa_goodproperties.add(re); | |||
} | |||
@@ -18,6 +18,7 @@ import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODPROPERTY; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.utils.AlertDialogUtils; | |||
@@ -28,6 +29,8 @@ import com.qmuiteam.qmui.widget.dialog.QMUIDialog; | |||
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
@@ -41,6 +44,10 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||
* 属性数据 | |||
*/ | |||
ArrayList<BPA_GOODPROPERTY> bpa_goodproperties = new ArrayList<>(); | |||
ArrayList<BPA_GOODSTYPE> bpa_goodstypes=new ArrayList<>(); | |||
ConcurrentHashMap<String,String> itemstypes=new ConcurrentHashMap<>(); | |||
private Context context; | |||
@Override | |||
protected View onCreateView() { | |||
@@ -61,6 +68,16 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||
* 初始化界面 | |||
*/ | |||
public void InitView() { | |||
bpa_goodstypes= QueryDB.GetGoodsTypeALL(); | |||
itemstypes.clear(); | |||
for (BPA_GOODSTYPE item:bpa_goodstypes) | |||
{ | |||
if(!itemstypes.containsKey(item.name)) | |||
{ | |||
itemstypes.put(item.name,item.id); | |||
} | |||
} | |||
Initdata_sx(); | |||
} | |||
@@ -91,6 +108,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||
bpa_goodproperty.name = text.toString(); | |||
bpa_goodproperty.foreignKeyRe = ""; | |||
bpa_goodproperty.parentid = "0"; | |||
bpa_goodproperty.sort=0; | |||
bpa_goodproperty.deviceID = ConfigName.getInstance().DeviceId; | |||
bpa_goodproperty.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddGoodsProperty(bpa_goodproperty); | |||
@@ -149,6 +167,95 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||
}) | |||
.show(); | |||
break; | |||
case R.id.sort: | |||
final QMUIDialog.EditTextDialogBuilder builder1 = new QMUIDialog.EditTextDialogBuilder(context); | |||
builder1.setTitle("排序") | |||
.setPlaceholder("在此输入排序") | |||
.setDefaultText(((BPA_GOODPROPERTY) data).sort+"") | |||
.setInputType(InputType.TYPE_CLASS_NUMBER) | |||
.addAction("取消", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
dialog.dismiss(); | |||
} | |||
}) | |||
.addAction("确定", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
CharSequence text = builder1.getEditText().getText(); | |||
if (text != null && text.length() > 0) { | |||
QueryDB.UpdateGoodsPropertySort(((BPA_GOODPROPERTY) data).id, Integer.parseInt(text.toString())); | |||
Initdata_sx(); | |||
dialog.dismiss(); | |||
} else { | |||
//请填入昵称 | |||
ToastUtils.info("排序不能为空!"); | |||
} | |||
} | |||
}) | |||
.show(); | |||
break; | |||
case R.id.typeS: | |||
ArrayList<Integer> keys=new ArrayList<Integer>(); | |||
String[] items = itemstypes.keySet().toArray(new String[itemstypes.keySet().size()]); | |||
if(((BPA_GOODPROPERTY) data).GoodsTypeId!=null && !((BPA_GOODPROPERTY) data).GoodsTypeId.isEmpty()) | |||
{ | |||
for (int i=0;i<items.length;i++) | |||
{ | |||
if(((BPA_GOODPROPERTY) data).GoodsTypeId.contains(itemstypes.get(items[i]))) | |||
{ | |||
keys.add(i); | |||
} | |||
} | |||
} | |||
int []intarrs=new int[keys.size()]; | |||
for(int i=0;i<intarrs.length;i++){ | |||
intarrs[i]=keys.get(i); | |||
} | |||
final QMUIDialog.MultiCheckableDialogBuilder builder3 = new QMUIDialog.MultiCheckableDialogBuilder(context) | |||
.addItems(items, new DialogInterface.OnClickListener() { | |||
@Override | |||
public void onClick(DialogInterface dialog, int which) { | |||
} | |||
}) | |||
.setCheckedItems(intarrs); | |||
builder3.addAction("取消", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
dialog.dismiss(); | |||
} | |||
}); | |||
builder3.addAction("确定", new QMUIDialogAction.ActionListener() { | |||
@Override | |||
public void onClick(QMUIDialog dialog, int index) { | |||
String result=""; | |||
for(int i=0;i<builder3.getCheckedItemIndexes().length;i++){ | |||
result+=""+itemstypes.get(items[builder3.getCheckedItemIndexes()[i]])+","; | |||
} | |||
if(result.isEmpty()) | |||
{ | |||
ToastUtils.info("必须选择一个类型!"); | |||
return; | |||
} | |||
if(!result.isEmpty()) | |||
{ | |||
result=result.substring(0, result.length() - 1); | |||
} | |||
QueryDB.UpdateGoodsPropertyType(((BPA_GOODPROPERTY) data).id, result); | |||
Initdata_sx(); | |||
dialog.dismiss(); | |||
} | |||
}); | |||
builder3.show(); | |||
break; | |||
case R.id.button_item://删除按钮 | |||
String title = "温馨提示!"; | |||
String message = "客官确定要删除属性【"+((BPA_GOODPROPERTY) data).name+"】吗?"; | |||
@@ -174,6 +281,7 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||
bpa_goodproperty.name = "子属性示例"; | |||
bpa_goodproperty.foreignKeyRe = ""; | |||
bpa_goodproperty.parentid = sx.id; | |||
bpa_goodproperty.sort=0; | |||
bpa_goodproperty.deviceID = ConfigName.getInstance().DeviceId; | |||
bpa_goodproperty.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddGoodsProperty(bpa_goodproperty); | |||
@@ -212,8 +320,9 @@ public class Jcsjgl_sxgl_fragment extends BaseFragment implements MyClickListene | |||
*/ | |||
public void Initdata_sx() { | |||
try { | |||
bpa_goodproperties = QueryDB.GetGoodsPropertyALL("0"); | |||
sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, this); | |||
sx_adapter adapter = new sx_adapter(context, R.layout.sx_item, bpa_goodproperties, bpa_goodstypes,this); | |||
datatab_sx.setAdapter(adapter); | |||
} catch (Exception e) { | |||
@@ -82,6 +82,7 @@ public class add_makegood_control extends LinearLayout{ | |||
initEvent(); | |||
} | |||
ArrayList<ResGoodProperty> bpa_goodproperties = new ArrayList<>(); | |||
private void initData() { | |||
//2.填充规则数据,查询所有属性大类 | |||
@@ -89,9 +90,23 @@ public class add_makegood_control extends LinearLayout{ | |||
layoutManager.setOrientation(LinearLayoutManager.VERTICAL); | |||
datatab_makesx.setLayoutManager(layoutManager); | |||
if(DataBus.getInstance().sxadapter==null) | |||
//if(DataBus.getInstance().sxadapter==null) | |||
{ | |||
DataBus.getInstance().sxadapter = new pfsx_adapter(contextMian,DataBus.getInstance().bpa_goodproperties); | |||
bpa_goodproperties.clear(); | |||
for (ResGoodProperty pro:DataBus.getInstance().bpa_goodproperties) | |||
{ | |||
if(pro.GoodsTypeId!=null && !pro.GoodsTypeId.isEmpty()) | |||
{ | |||
if(pro.GoodsTypeId.contains(Good.goodtype)) | |||
{ | |||
bpa_goodproperties.add(pro); | |||
} | |||
}else | |||
{ | |||
bpa_goodproperties.add(pro); | |||
} | |||
} | |||
DataBus.getInstance().sxadapter = new pfsx_adapter(contextMian,bpa_goodproperties); | |||
} | |||
datatab_makesx.setAdapter(DataBus.getInstance().sxadapter); | |||
@@ -176,7 +191,7 @@ public class add_makegood_control extends LinearLayout{ | |||
public boolean DataValidation() { | |||
//1.数据名称不能为空 | |||
ggids = "";names=""; | |||
for (ResGoodProperty item : DataBus.getInstance().bpa_goodproperties) { | |||
for (ResGoodProperty item : bpa_goodproperties) { | |||
for (ResGoodProperty k : item.child) { | |||
if (k.isSelect) { | |||
ggids += k.id + ","; | |||
@@ -126,6 +126,10 @@ public class add_pf_control extends LinearLayout implements MyClickListener { | |||
cipe.materialID=m.id; | |||
cipe.materialName=m.name; | |||
cipe.value="0"; | |||
if (DataBus.getInstance().Recipe==null) | |||
{ | |||
DataBus.getInstance().Recipe=new ArrayList<>(); | |||
} | |||
DataBus.getInstance().Recipe.add(cipe); | |||
adapter4.notifyDataSetChanged(); | |||
@@ -198,7 +202,7 @@ public class add_pf_control extends LinearLayout implements MyClickListener { | |||
{ | |||
for(BPA_MATERIAL wl:resMaterilas) | |||
{ | |||
if(Good.materialids.contains(wl.id)) | |||
if(Good.materialids!=null && !Good.materialids.isEmpty() && Good.materialids.contains(wl.id)) | |||
{ | |||
ResGoodsRecipe cipe=new ResGoodsRecipe(); | |||
cipe.sort=0; | |||
@@ -210,6 +214,11 @@ public class add_pf_control extends LinearLayout implements MyClickListener { | |||
} | |||
} | |||
} | |||
if( DataBus.getInstance().Recipe==null) | |||
{ | |||
DataBus.getInstance().Recipe=new ArrayList<>(); | |||
} | |||
adapter4= new xxpf_adapter(getContext(), R.layout.xxpf_item, DataBus.getInstance().Recipe,this); | |||
datatab_pf.setAdapter(adapter4); | |||
} | |||
@@ -222,7 +231,22 @@ public class add_pf_control extends LinearLayout implements MyClickListener { | |||
public void SetData(BPA_GOODSRECIPENAME name, BPA_GOODS good,ArrayList<ResGoodProperty> properties) | |||
{ | |||
try { | |||
bpa_goodproperties=properties; | |||
//根据商品类型判断属性 | |||
bpa_goodproperties.clear(); | |||
for (ResGoodProperty pro:properties) | |||
{ | |||
if(pro.GoodsTypeId!=null && !pro.GoodsTypeId.isEmpty()) | |||
{ | |||
if(pro.GoodsTypeId.contains(good.goodtype)) | |||
{ | |||
bpa_goodproperties.add(pro); | |||
} | |||
}else | |||
{ | |||
bpa_goodproperties.add(pro); | |||
} | |||
} | |||
bpaGoodsrecipename=name; | |||
Good=good; | |||
if(name!=null) | |||
@@ -1,12 +1,18 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<!-- 在Topbar下方的Tab面板的背景,带底部分割线 --> | |||
<inset xmlns:android="http://schemas.android.com/apk/res/android" | |||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" | |||
> | |||
<shape> | |||
<solid android:color="@color/tab_panel_bg" /> | |||
<stroke | |||
android:width="1dp" | |||
android:color="@color/color3" /> | |||
</shape> | |||
</inset> | |||
<item | |||
android:left="-10dp" | |||
android:right="-10dp" | |||
android:top="-10dp"> | |||
<shape> | |||
<!-- <solid android:color="@color/tab_panel_bg" />--> | |||
<stroke | |||
android:width="1dp" | |||
android:color="@color/color3" /> | |||
</shape> | |||
</item> | |||
</layer-list> |
@@ -35,8 +35,43 @@ | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="回锅肉" | |||
android:textAlignment="center" | |||
android:textSize="13dp"/> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:background="@drawable/border" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1"> | |||
<TextView | |||
android:id="@+id/typeS" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
android:text="小类" | |||
android:textAlignment="center" | |||
android:textSize="13dp" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:background="@drawable/border" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1"> | |||
<TextView | |||
android:id="@+id/sort" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
android:text="排序" | |||
android:textAlignment="center" | |||
android:textSize="13dp" /> | |||
</RelativeLayout> | |||
<LinearLayout | |||
android:layout_width="0dp" | |||
@@ -49,11 +84,11 @@ | |||
android:layout_weight="1"> | |||
<ImageView | |||
android:layout_centerInParent="true" | |||
android:id="@+id/button_item" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:src="@mipmap/new_delete"/> | |||
android:layout_centerInParent="true" | |||
android:src="@mipmap/new_delete" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
@@ -62,11 +62,11 @@ | |||
android:layout_weight="1"> | |||
<ImageView | |||
android:layout_centerInParent="true" | |||
android:id="@+id/button_update" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:src="@mipmap/new_update"/> | |||
android:layout_centerInParent="true" | |||
android:src="@mipmap/new_update" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
@@ -76,7 +76,7 @@ | |||
<ImageView | |||
android:layout_centerInParent="true" | |||
android:id="@+id/button_item" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:src="@mipmap/new_delete"/> | |||
</RelativeLayout> | |||
@@ -96,7 +96,36 @@ | |||
android:textStyle="bold" | |||
android:textColor="@color/white"/> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_marginLeft="20dp" | |||
android:text="商品小类" | |||
android:textAlignment="center" | |||
android:textStyle="bold" | |||
android:textColor="@color/white"/> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_marginLeft="20dp" | |||
android:text="排序" | |||
android:textAlignment="center" | |||
android:textStyle="bold" | |||
android:textColor="@color/white"/> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
@@ -0,0 +1,45 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="fill_parent" | |||
android:layout_height="fill_parent" | |||
android:orientation="vertical" | |||
android:padding="@dimen/dp_10"> | |||
<TextView | |||
android:id="@+id/textView1" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="属性名称" /> | |||
<EditText | |||
android:id="@+id/editTextName" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入名称" | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp"> | |||
<requestFocus /> | |||
</EditText> | |||
<TextView | |||
android:id="@+id/textView2" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="属性排序" /> | |||
<EditText | |||
android:id="@+id/editTextNum" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入序号" | |||
android:inputType="number" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp" | |||
android:text="0"> | |||
</EditText> | |||
</LinearLayout> |
@@ -133,12 +133,14 @@ | |||
android:layout_weight="1"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:textAlignment="center" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_marginLeft="20dp" | |||
android:text="配方名称" | |||
android:textColor="@color/white"/> | |||
android:textColor="@color/white" /> | |||
</RelativeLayout> | |||
@@ -148,8 +150,8 @@ | |||
android:layout_weight="1"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_width="match_parent" | |||
android:textAlignment="center" android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_marginLeft="20dp" | |||
android:text="用户操作" | |||
@@ -2,15 +2,47 @@ | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="200dp" | |||
android:layout_height="120dp"> | |||
android:layout_height="150dp"> | |||
<LinearLayout | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_marginTop="5dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical" | |||
android:background="@color/main_background"> | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="20dp" | |||
android:src="@mipmap/topline"/> | |||
<LinearLayout | |||
android:layout_marginTop="10dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:layout_marginLeft="5dp" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
tools:ignore="MissingConstraints" | |||
android:textColor="@color/gray_deep" | |||
android:text="名称:" | |||
android:textSize="12dp"/> | |||
<EditText | |||
android:id="@+id/edittext" | |||
android:layout_width="140dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="5dp" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入名称" | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp" /> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
<LinearLayout | |||
android:layout_marginTop="@dimen/dp_10" | |||
@@ -22,19 +54,20 @@ | |||
android:layout_height="wrap_content" | |||
tools:ignore="MissingConstraints" | |||
android:textColor="@color/gray_deep" | |||
android:text="名称:" | |||
android:text="排序:" | |||
android:textSize="12dp"/> | |||
<EditText | |||
android:id="@+id/edittext" | |||
android:id="@+id/edittext_px" | |||
android:layout_width="140dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="5dp" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入名称" | |||
android:inputType="text" | |||
android:hint="请输入序号" | |||
android:inputType="number" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp" /> | |||
android:textSize="12dp" | |||
android:text="0"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
@@ -63,10 +96,10 @@ | |||
</LinearLayout> | |||
<RelativeLayout | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:layout_marginBottom="10dp" | |||
android:paddingTop="5dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="5dp"> | |||
<TextView | |||
android:id="@+id/save_text" | |||
@@ -86,6 +119,12 @@ | |||
android:textColor="@color/red_primary_dark" | |||
android:text="删除"/> | |||
<ImageView | |||
android:layout_marginTop="15dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="20dp" | |||
android:rotation="180" | |||
android:src="@mipmap/topline" /> | |||
</RelativeLayout> | |||
</LinearLayout> | |||