Browse Source

现场修改

调味吧台第二版
fyf 1 year ago
parent
commit
ba08c11a0c
23 changed files with 456 additions and 149 deletions
  1. +7
    -7
      app/src/main/java/com/example/bpa/MainActivity.java
  2. +10
    -0
      app/src/main/java/com/example/bpa/Model/BpaGG.java
  3. +7
    -0
      app/src/main/java/com/example/bpa/Model/BpaGGXX.java
  4. +6
    -0
      app/src/main/java/com/example/bpa/Model/BpaKeyValue.java
  5. +1
    -1
      app/src/main/java/com/example/bpa/app/BootInit.java
  6. +10
    -10
      app/src/main/java/com/example/bpa/config/ConfigName.java
  7. +8
    -0
      app/src/main/java/com/example/bpa/config/DataBus.java
  8. +42
    -5
      app/src/main/java/com/example/bpa/helper/ModbusTcpServer.java
  9. +8
    -13
      app/src/main/java/com/example/bpa/service/BusinessServer.java
  10. +88
    -22
      app/src/main/java/com/example/bpa/service/DeviceData.java
  11. +25
    -0
      app/src/main/java/com/example/bpa/service/OrderServer.java
  12. +20
    -2
      app/src/main/java/com/example/bpa/view/adapter/maingoods_adapter.java
  13. +23
    -3
      app/src/main/java/com/example/bpa/view/adapter/order_adapter.java
  14. +2
    -1
      app/src/main/java/com/example/bpa/view/control/clsf_control.java
  15. +58
    -0
      app/src/main/java/com/example/bpa/view/control/gg_control.java
  16. +17
    -37
      app/src/main/java/com/example/bpa/view/fragment/SsjkFragment.java
  17. +1
    -1
      app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java
  18. +5
    -3
      app/src/main/java/com/example/bpa/view/from/lsjy_activity.java
  19. +4
    -0
      app/src/main/java/com/example/bpa/view/mode/mainGoods.java
  20. +70
    -40
      app/src/main/res/layout/from/layout/activity_lsjy.xml
  21. +20
    -0
      app/src/main/res/layout/item/layout/gg_item.xml
  22. +11
    -1
      app/src/main/res/layout/item/layout/maingoods.xml
  23. +13
    -3
      app/src/main/res/layout/item/layout/order_item.xml

+ 7
- 7
app/src/main/java/com/example/bpa/MainActivity.java View File

@@ -283,13 +283,13 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen
//Main.getInstance().GetOrder("456715513230397440");


// if (OrderID.isEmpty()) {
// T.show(MainActivity.this, "无制作中饮品!");
// } else {
// ShowDialogWJ(OrderID);
// }
if (OrderID.isEmpty()) {
T.show(MainActivity.this, "无制作中饮品!");
} else {
ShowDialogWJ(OrderID);
}

MessageManager.getInstance().sendMessage(MessageName.GetOrderInformation.name(),"m0022|P0003|A001,B001|2");
//MessageManager.getInstance().sendMessage(MessageName.GetOrderInformation.name(),"m0022|P0003|A001,B001|2");


//Main.getInstance().GetOrder(OrderID);
@@ -659,7 +659,7 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen
int num = 1;
try {
num = Integer.parseInt(res[3]);
Mgoodid = goodid + ggid.replace(',', '_');
Mgoodid = goodid +"_"+ ggid.replace(',', '_');
} catch (Exception ex) {

}


+ 10
- 0
app/src/main/java/com/example/bpa/Model/BpaGG.java View File

@@ -0,0 +1,10 @@
package com.example.bpa.Model;

import java.util.List;

/**
* 规则
*/
public class BpaGG {
public List<BpaGGXX> data;
}

+ 7
- 0
app/src/main/java/com/example/bpa/Model/BpaGGXX.java View File

@@ -0,0 +1,7 @@
package com.example.bpa.Model;

import java.util.List;

public class BpaGGXX extends BpaKeyValue {
public List<BpaKeyValue> detail;
}

+ 6
- 0
app/src/main/java/com/example/bpa/Model/BpaKeyValue.java View File

@@ -0,0 +1,6 @@
package com.example.bpa.Model;

public class BpaKeyValue {
public String key;
public String name;
}

+ 1
- 1
app/src/main/java/com/example/bpa/app/BootInit.java View File

@@ -52,7 +52,7 @@ public class BootInit {
//4.初始化Main
Main.getInstance();

BusinessServer.Get().test();
//BusinessServer.Get().test();
//MessageLog.ShowAlertMessage(AlertLogEnum.传感器异常日志,"传感器异常");
//MessageLog.ShowAlertMessage(AlertLogEnum.异常订单未制作日志,"异常订单未制作日志");
//MessageLog.ShowAlertMessage(AlertLogEnum.料仓缺料日志,"料仓缺料日志");


+ 10
- 10
app/src/main/java/com/example/bpa/config/ConfigName.java View File

@@ -257,16 +257,16 @@ public class ConfigName {
*/
public List<Res_ZDSF> zdsfs_出料算法=new ArrayList<Res_ZDSF>(){{
//硬件设备 初始化
add(new Res_ZDSF("外置通道(一)","M5.0","VW144","VW44","VW168"));
add(new Res_ZDSF("外置通道(二)","M5.1","VW146","VW46","VW170"));
add(new Res_ZDSF("外置通道(三)","M5.2","VW148","VW48","VW172"));
add(new Res_ZDSF("外置通道(四)","M5.3","VW150","VW50","VW174"));
add(new Res_ZDSF("外置通道(五)","M5.4","VW152","VW52","VW176"));
add(new Res_ZDSF("外置通道(六)","M5.5","VW154","VW54","VW178"));
// add(new Res_ZDSF("外置通道(七)","M5.6","VW156","VW56","VW180"));
// add(new Res_ZDSF("外置通道(八)","M5.7","VW158","VW58","VW182"));
// add(new Res_ZDSF("外置通道(九)","M6.0","VW160","VW60","VW184"));
// add(new Res_ZDSF("外置通道(十)","M6.1","VW162","VW62","VW186"));
add(new Res_ZDSF("外置通道(一)","VW194.0","VW144","VW44","VW168"));
add(new Res_ZDSF("外置通道(二)","VW194.1","VW146","VW46","VW170"));
add(new Res_ZDSF("外置通道(三)","VW194.2","VW148","VW48","VW172"));
add(new Res_ZDSF("外置通道(四)","VW194.3","VW150","VW50","VW174"));
add(new Res_ZDSF("外置通道(五)","VW194.4","VW152","VW52","VW176"));
add(new Res_ZDSF("外置通道(六)","VW194.5","VW154","VW54","VW178"));
// add(new Res_ZDSF("外置通道(七)","VW194.6","VW156","VW56","VW180"));
// add(new Res_ZDSF("外置通道(八)","VW194.7","VW158","VW58","VW182"));
// add(new Res_ZDSF("外置通道(九)","VW194.8","VW160","VW60","VW184"));
// add(new Res_ZDSF("外置通道(十)","VW194.9","VW162","VW62","VW186"));

}};
}

+ 8
- 0
app/src/main/java/com/example/bpa/config/DataBus.java View File

@@ -382,6 +382,14 @@ public class DataBus {
newgood.name = good.name;
newgood.url=good.url;
newgood.message = "";
if(good.design!=null &&!good.design.isEmpty())
{
newgood.design=good.design;
}
if(good.foreignKeyRe!=null && !good.foreignKeyRe.isEmpty())
{
newgood.foreignKeyRe=good.foreignKeyRe;
}
mainGoods.add(newgood);
}
}


+ 42
- 5
app/src/main/java/com/example/bpa/helper/ModbusTcpServer.java View File

@@ -144,7 +144,7 @@ public class ModbusTcpServer {
} else {
EndAdd--;
}
return Prefix + FirstAdd + startAdd + "." + EndAdd;
return Prefix + (FirstAdd + startAdd) + "." + EndAdd;
}
return "";
}
@@ -247,6 +247,8 @@ public class ModbusTcpServer {
OrderServer.Get().Init();
//7.自动加热服务
ReheatServer.Get().Init();
//8.扫码服务
ScanCodeServer.Get().Init();
}

@Override
@@ -352,7 +354,33 @@ public class ModbusTcpServer {
}
return 0;
}
public static byte[] float2byte(float f) {

// 把float转换为byte[]
int fbit = Float.floatToIntBits(f);

byte[] b = new byte[4];
for (int i = 0; i < 4; i++) {
b[i] = (byte) (fbit >> (24 - i * 8));
}

// 翻转数组
int len = b.length;
// 建立一个与源数组元素类型相同的数组
byte[] dest = new byte[len];
// 为了防止修改源数组,将源数组拷贝一份副本
System.arraycopy(b, 0, dest, 0, len);
byte temp;
// 将顺位第i个与倒数第i个交换
for (int i = 0; i < len / 2; ++i) {
temp = dest[i];
dest[i] = dest[len - i - 1];
dest[len - i - 1] = temp;
}

return dest;

}
private byte[] IntToByte(int number) {
int temp = number;
byte[] b = new byte[4];
@@ -477,11 +505,12 @@ public class ModbusTcpServer {
try {
ReadHoldingRegistersResponse res = ModbusTcpHelper.get().syncReadHoldingRegisters(1, add, length);
byte[] data = res.getData();
byte[] data1 = Arrays.copyOfRange(data, 0, 18);
byte[] data1 = Arrays.copyOfRange(data, 0, data.length);
//36 GUID 18 Number
String id = "";
try {
byte[] tempdata = new byte[18];
byte[] tempdata = new byte[data.length];
int index=0;
for (int i = 0; i < data1.length; i++) {
if (i % 2 == 0) {

@@ -489,7 +518,13 @@ public class ModbusTcpServer {
} else {
tempdata[i - 1] = data1[i];
}

if (data1[i]==0 && index==0)
{
index=i;
}
}

id = new String(tempdata, "UTF-8").trim();
} catch (UnsupportedEncodingException ex) {
}
@@ -585,7 +620,7 @@ public class ModbusTcpServer {
int add = GetAddress(Address);
if (add < 0) return;
try {
ReadHoldingRegistersResponse res = ModbusTcpHelper.get().syncReadHoldingRegisters(1, add, length);
ReadHoldingRegistersResponse res = ModbusTcpHelper.get().syncReadHoldingRegisters(1, add, length*2);
byte[] data = res.getData();
float[] tempValues = new float[length];
for (int i = 0; i < length; i++) {
@@ -703,7 +738,9 @@ public class ModbusTcpServer {
int add = GetAddress(Address);
if (add < 0) return;
int intBits = Float.floatToRawIntBits(Value);
short[] send = new short[]{(short) ((intBits >> 16) & 0xffff), (short) (intBits & 0xffff)};
short[] send = IntToShorts(intBits);

//short[] send = new short[]{(short) ((intBits >> 16) & 0xffff), (short) (intBits & 0xffff)};
try {
ModbusTcpHelper.get().syncWriteRegisters(1, add, send);



+ 8
- 13
app/src/main/java/com/example/bpa/service/BusinessServer.java View File

@@ -162,19 +162,12 @@ public class BusinessServer {
}

//将其余料仓出料设置为0,重置
for (int k = 1; k <= 20; k++) {
if (!liaochang.contains(k)) {
DeviceData.Get().setDemandValue((short) 0, k, new IWriteCallBack() {
@Override
public void onSuccess() {
}

@Override
public void onFailure(String ErrorMsg) {
}
});
}
}
// for (int k = 1; k <= 13; k++) {
// if(!liaochang.contains(k))
// {
// DeviceData.Get().setDemandValue((short) 0, k, null);
// }
// }

//等待配料完成,一直等待
final boolean[] IsComplete = {false};
@@ -210,6 +203,8 @@ public class BusinessServer {
count += goodsRecipes.size();
DataBus.getInstance().UpdateGoodsMake(suborder.id, "步骤【" + key + "】:" + RecipesNames + "-配料完成!", count, key, true);
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "[" + good.name + "]步骤【" + key + "】下发" + RecipesNames + "执行完成!");


}
//endregion
//5.设置数据中心商品已制作完成


+ 88
- 22
app/src/main/java/com/example/bpa/service/DeviceData.java View File

@@ -109,13 +109,51 @@ public class DeviceData {
});

//读取通道补偿模式
ModbusTcpServer.get().ReadBool("M5.0", 10, booleans -> {
for (int i=0;i<booleans.length;i++)
{
CompensateValue.put(i,booleans[i]);
// ModbusTcpServer.get().ReadBool("M5.0", 10, booleans -> {
// for (int i=0;i<booleans.length;i++)
// {
// CompensateValue.put(i,booleans[i]);
// }
// });
ModbusTcpServer.get().ReadbcStatus("VW194", 1, data -> {
byte status=data[0];//0x92
CompensateValue.put(0, ByteHelper.getBit(status,0)==1);
CompensateValue.put(1, ByteHelper.getBit(status,1)==1);
CompensateValue.put(2, ByteHelper.getBit(status,2)==1);
CompensateValue.put(3, ByteHelper.getBit(status,3)==1);
CompensateValue.put(4, ByteHelper.getBit(status,4)==1);
CompensateValue.put(5, ByteHelper.getBit(status,5)==1);
});

//读取实时状态
ModbusTcpServer.get().ReadStatus("VW500", 4, data -> {
for (int i = 0; i < data.length; i++) {
byte status=data[i];//0x92
IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1);
IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1);
IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1);
IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1);
IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1);
IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1);
IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1);
IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1);
}
});
}
Thread.sleep(10);
}

@Override
public void RunComplete() throws InterruptedException {

}
});

ThreadManager.Get().StartLong("Plc设备数据监听-状态监控", true, new IThread() {
@Override
public void Run() throws InterruptedException {
if(DataBus.getInstance().PlcIsConnect)
{
//配料完成 M0.3
CompleteListen("M0.3", "配料完成", OnChargeMixtureCompleteNotify);

@@ -124,10 +162,23 @@ public class DeviceData {

//校准校正完成信号 M0.7
CompleteListen("M0.7", "校准完成", OnChargeMixtureComNotPar);
}
Thread.sleep(10);
}

@Override
public void RunComplete() throws InterruptedException {

}
});

ThreadManager.Get().StartLong("Plc设备数据监听-扫码线程", true, new IThread() {
@Override
public void Run() throws InterruptedException {
if(DataBus.getInstance().PlcIsConnect)
{
//读取当前扫码信息
ModbusTcpServer.get().ReadString("VW300", 20, (data) -> {
ModbusTcpServer.get().ReadString("VW702", 40, (data) -> {

if (!Code.equals(data)) {
if (!data.isEmpty() && OnScanTheCodeInformationT != null) {
@@ -141,21 +192,6 @@ public class DeviceData {
//3.制作订单信息
//4.回馈订单信息
});

//读取实时状态
ModbusTcpServer.get().ReadStatus("VW500", 4, data -> {
for (int i = 0; i < data.length; i++) {
byte status=data[i];//0x92
IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1);
IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1);
IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1);
IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1);
IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1);
IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1);
IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1);
IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1);
}
});
}
Thread.sleep(10);
}
@@ -268,7 +304,8 @@ public class DeviceData {
public float getCalibrationValueXS(int ch) {
if (!CalibrationValueXS.containsKey(ch))
return 1.0F;
return CalibrationValueXS.get(ch);
float k=CalibrationValueXS.get(ch);
return k==0?1.0F:k;
}


@@ -836,7 +873,7 @@ public class DeviceData {
* 扫码清零
*/
public void setCodeClear(IWriteCallBack callback) {
ModbusTcpServer.get().WriteString("VW300", 20, callback);
ModbusTcpServer.get().WriteString("VW702", 40, callback);
}
//endregion

@@ -992,6 +1029,35 @@ public class DeviceData {
return 0;
}
}

/**
* 写开关
* @param Adder
* @param
* @return
*/
public boolean writeAutomationSwitch(String Adder,boolean valbll)
{
if (DataBus.getInstance().PlcIsConnect)
{
String[] res = Adder.split("[.]");
String firstAdd = res[0]; //VW100
int endAdd = Integer.parseInt(res[1]); //1 //第几位
ModbusTcpServer.get().ReadShort(firstAdd, 1, new IReadCallBack<short[]>() {
@Override
public void onSuccess(short[] shorts) {
Short val=shorts[0];
Short valk= ByteHelper.setBit(val,endAdd,valbll);
ModbusTcpServer.get().WriteShort(firstAdd, valk, null);
}
});

return true;
}else
{
return false;
}
}
//endregion




+ 25
- 0
app/src/main/java/com/example/bpa/service/OrderServer.java View File

@@ -20,6 +20,7 @@ import com.example.bpa.db.QueryDB;
import com.example.bpa.db.mode.BPA_GOODS;
import com.example.bpa.db.mode.BPA_GOODSRECIPE;
import com.example.bpa.db.mode.BPA_MATERIAL;
import com.example.bpa.db.mode.BPA_MENU;
import com.example.bpa.db.mode.BPA_SILOSANDMATERIAL;
import com.example.bpa.db.mode.BPA_SUBORDER;
import com.example.bpa.helper.AES;
@@ -112,6 +113,7 @@ public class OrderServer {
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().DevId) && model.ClientType==9)
{
@@ -212,11 +214,18 @@ public class OrderServer {
public void RefreshTheData(PushDeviceGoods data)
{
try {
//0.更新类别
for (BPA_MENU item:QueryDB.GetMenuALL())
{
QueryDB.DeleteMenu(item);
}

//1.更新商品数据
for (BPA_GOODS item:QueryDB.GetGoodsALL())
{
QueryDB.DeleteGoods(item);
}
List<String> Lb=new ArrayList<>();
int k=1;
for (BPA_GoodsInfo item:data.GoodsInfos)
{
@@ -232,11 +241,27 @@ public class OrderServer {
goodx.userID = ConfigName.getInstance().user.userID;
goodx.foreignKeyRe=item.ForeignKeyRe;
goodx.design=item.Design;
if(item.Goods_TypeID !=null && !item.Goods_TypeID.isEmpty())
{
goodx.exp=item.Goods_TypeID;
if(!Lb.contains(item.Goods_TypeID))
{
Lb.add(item.Goods_TypeID);
}
}
QueryDB.AddGoods(goodx);
}
k++;
}

for (String item:Lb) {
BPA_MENU menu=new BPA_MENU();
menu.name=item;
menu.deviceID= ConfigName.getInstance().DeviceId;
menu.userID=ConfigName.getInstance().user.userID;
QueryDB.AddMenu(menu);
}

//2.新增物料
for (BPA_MATERIAL item:QueryDB.GetMaterialALL())
{


+ 20
- 2
app/src/main/java/com/example/bpa/view/adapter/maingoods_adapter.java View File

@@ -6,12 +6,16 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.bpa.Model.BPAPackage;
import com.example.bpa.Model.BpaGG;
import com.example.bpa.Model.BpaGGXX;
import com.example.bpa.R;
import com.example.bpa.app.Main;
import com.example.bpa.config.ConfigName;
@@ -19,10 +23,12 @@ import com.example.bpa.config.MessageName;
import com.example.bpa.db.QueryDB;
import com.example.bpa.db.mode.BPA_ORDER;
import com.example.bpa.db.mode.BPA_SUBORDER;
import com.example.bpa.helper.Json;
import com.example.bpa.message.MessageManager;
import com.example.bpa.service.BusinessServer;
import com.example.bpa.config.DataBus;
import com.example.bpa.helper.T;
import com.example.bpa.view.control.gg_control;
import com.example.bpa.view.mode.mainGoods;

import java.util.List;
@@ -57,6 +63,18 @@ public class maingoods_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol
myViewHolder.goodname.setText(mainGoods.get(position).name);
myViewHolder.id = mainGoods.get(position).id;
myViewHolder.url= mainGoods.get(position).url;
String gg=mainGoods.get(position).design; // json
String ggxz=mainGoods.get(position).foreignKeyRe; //P0003_A001_B001s
if(gg!=null && ggxz!=null && !ggxz.isEmpty() && !gg.isEmpty())
{

List<BpaGGXX> model=new Json<BpaGGXX>().jsonToListobject(BpaGGXX.class,((String)gg));
for (BpaGGXX item :model)
{
gg_control control=new gg_control(context,null,item,ggxz);
myViewHolder.gg.addView(control);
}
}
int num = (int) new Random().nextInt(DataBus.getInstance().good_picMap.size());//随机商品图片
myViewHolder.good_pic.setImageResource(DataBus.getInstance().good_picMap.get(num));
}
@@ -81,14 +99,14 @@ public class maingoods_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol

public String url;

LinearLayout gg;
public MyLCViewHolder(View view) {
super(view);
goodname = (TextView) view.findViewById(R.id.goodname);
goodmake = (Button) view.findViewById(R.id.goodmake);
good_pic = (ImageView)view.findViewById(R.id.good_pic);
makerelative= (RelativeLayout)view.findViewById(R.id.makerelative);
gg= (LinearLayout)view.findViewById(R.id.gg);
makerelative.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {


+ 23
- 3
app/src/main/java/com/example/bpa/view/adapter/order_adapter.java View File

@@ -10,6 +10,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

@@ -18,14 +19,17 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.bpa.MainActivity;
import com.example.bpa.Model.BpaGGXX;
import com.example.bpa.Model.SuOrderA;
import com.example.bpa.R;
import com.example.bpa.config.ConfigName;
import com.example.bpa.config.DataBus;
import com.example.bpa.helper.Json;
import com.example.bpa.helper.MyImageView;
import com.example.bpa.helper.T;
import com.example.bpa.helper.WrapContentLinearLayoutManager;
import com.example.bpa.service.BusinessServer;
import com.example.bpa.view.control.gg_control;
import com.example.bpa.view.mode.MakeStatus;
import com.example.bpa.view.mode.ResGoodsMake;
import com.example.bpa.view.mode.StatusMode;
@@ -64,8 +68,23 @@ public class order_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
myViewHolder.title.setText(statusMode.good.name);
if(statusMode.subOrder.goodImg!=null && !statusMode.subOrder.goodImg.isEmpty())
{
myViewHolder.image.setImageURL(statusMode.subOrder.goodImg);
// myViewHolder.image.setImageURL(statusMode.subOrder.goodImg);
}


String gg=statusMode.good.design; // json
String ggxz=statusMode.good.foreignKeyRe; //P0003_A001_B001s
if(gg!=null && ggxz!=null && !ggxz.isEmpty() && !gg.isEmpty())
{
myViewHolder.gg.removeAllViews();
List<BpaGGXX> model=new Json<BpaGGXX>().jsonToListobject(BpaGGXX.class,((String)gg));
for (BpaGGXX item :model)
{
gg_control control=new gg_control(context,null,item,ggxz);
myViewHolder.gg.addView(control);
}
}

myViewHolder.goodms.setText(statusMode.makeMs);
myViewHolder.progress_bar.setProgress(statusMode.makeProcess);
;
@@ -177,13 +196,14 @@ public class order_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
ProgressBar progress_bar;
pflc_adapter adapter;
RecyclerView pllc;
LinearLayout gg;
public MyViewHolder(View view) {
super(view);
title = (TextView) view.findViewById(R.id.title);
goodms = (TextView) view.findViewById(R.id.goodms);
progress_bar = (ProgressBar) view.findViewById(R.id.progress_bar);
image = (MyImageView) view.findViewById(R.id.image);
//image = (MyImageView) view.findViewById(R.id.image);
gg= view.findViewById(R.id.gg);
start_button = (Button) view.findViewById(R.id.start_button);
goodStatus = (TextView) view.findViewById(R.id.start_text);
pllc = view.findViewById(R.id.pllc);


+ 2
- 1
app/src/main/java/com/example/bpa/view/control/clsf_control.java View File

@@ -90,7 +90,8 @@ public class clsf_control extends LinearLayout {
boolean isopen= switch1.isChecked();
if (DataBus.getInstance().PlcIsConnect)
{
DeviceData.Get().setSwitch(isopen,sf.kg_address,null);
DeviceData.Get().writeAutomationSwitch(sf.kg_address,isopen);
//DeviceData.Get().setSwitch(isopen,sf.kg_address,null);
T.show(view.getContext(), sf.name.toString()+(isopen?"打开":"关闭")+"成功!");

}else


+ 58
- 0
app/src/main/java/com/example/bpa/view/control/gg_control.java View File

@@ -0,0 +1,58 @@
package com.example.bpa.view.control;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.bpa.Model.BpaGGXX;
import com.example.bpa.Model.BpaKeyValue;
import com.example.bpa.Model.Res_ZDSF;
import com.example.bpa.R;

public class gg_control extends LinearLayout {

private View root;
TextView name;
LinearLayout grid;
public gg_control(Context context, @Nullable AttributeSet attrs,BpaGGXX gg,String nn) {
super(context, attrs);
root= LayoutInflater.from(context).inflate(R.layout.gg_item, this);
name= this.findViewById(R.id.name);
grid= this.findViewById(R.id.ms);
name.setText(gg.name+":");
for (BpaKeyValue item :gg.detail)
{
if(nn.contains(item.key))//红色
{
TextView view=new TextView(context);
view.setText(item.name );
view.setTextColor(Color.RED);
AutoNextLineLinearLayout.LayoutParams params = new AutoNextLineLinearLayout
.LayoutParams(AutoNextLineLinearLayout.LayoutParams.WRAP_CONTENT,
AutoNextLineLinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(20, 0, 0, 0);
view.setLayoutParams(params);
grid.addView(view);
}else //白色
{
TextView view=new TextView(context);
view.setText(item.name);
view.setTextColor(Color.WHITE);
AutoNextLineLinearLayout.LayoutParams params = new AutoNextLineLinearLayout
.LayoutParams(AutoNextLineLinearLayout.LayoutParams.WRAP_CONTENT,
AutoNextLineLinearLayout.LayoutParams.WRAP_CONTENT);
params.setMargins(20, 0, 0, 0);
view.setLayoutParams(params);
grid.addView(view);
}
}
}
}

+ 17
- 37
app/src/main/java/com/example/bpa/view/fragment/SsjkFragment.java View File

@@ -77,7 +77,7 @@ public class SsjkFragment extends Fragment implements View.OnClickListener {
DataBus.getInstance().statusModes=new ArrayList<>();
DataBus.getInstance().statusModes.add(new StatusMode("出料口按钮",R.mipmap.gd1,R.mipmap.gd2,false));
DataBus.getInstance().statusModes.add(new StatusMode("保温池高水位",R.mipmap.fq1,R.mipmap.fq2,false));
DataBus.getInstance().statusModes.add(new StatusMode("加热箱高水位",R.mipmap.fq1,R.mipmap.fq2,false));
// DataBus.getInstance().statusModes.add(new StatusMode("加热箱高水位",R.mipmap.fq1,R.mipmap.fq2,false));

DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(一)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(二)",R.mipmap.rdl1,R.mipmap.rdl2,false));
@@ -85,38 +85,26 @@ public class SsjkFragment extends Fragment implements View.OnClickListener {
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(四)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(五)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(六)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("保温池排水阀",R.mipmap.csf1,R.mipmap.csf2,false));
DataBus.getInstance().statusModes.add(new StatusMode("保温箱排水阀",R.mipmap.csf1,R.mipmap.csf2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(一)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(二)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(三)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(四)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(五)",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(六)",R.mipmap.rdl1,R.mipmap.rdl2,false));

DataBus.getInstance().statusModes.add(new StatusMode("出口振动器",R.mipmap.zdq1,R.mipmap.zdq2,false));

DataBus.getInstance().statusModes.add(new StatusMode("猪油仓加热盘",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
DataBus.getInstance().statusModes.add(new StatusMode("保温池加热管",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
DataBus.getInstance().statusModes.add(new StatusMode("猪油仓管道加热",R.mipmap.lcjr1,R.mipmap.lcjr2,false));

DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(一)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(二)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(三)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(四)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));

DataBus.getInstance().statusModes.add(new StatusMode("水池进水阀",R.mipmap.jsf1,R.mipmap.jsf2,false));

DataBus.getInstance().statusModes.add(new StatusMode("酱油泵",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("醋泵",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("猪油泵",R.mipmap.rdl1,R.mipmap.rdl2,false));

DataBus.getInstance().statusModes.add(new StatusMode("牛油泵",R.mipmap.rdl1,R.mipmap.rdl2,false));
DataBus.getInstance().statusModes.add(new StatusMode("水池进水阀",R.mipmap.jsf1,R.mipmap.jsf2,false));
DataBus.getInstance().statusModes.add(new StatusMode("水池排水阀",R.mipmap.csf1,R.mipmap.csf2,false));
DataBus.getInstance().statusModes.add(new StatusMode("猪油管道保温",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
DataBus.getInstance().statusModes.add(new StatusMode("牛油管道保温",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
DataBus.getInstance().statusModes.add(new StatusMode("水池加热",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
DataBus.getInstance().statusModes.add(new StatusMode("三色灯(绿)",R.mipmap.ssd1,R.mipmap.ssd2,false));
DataBus.getInstance().statusModes.add(new StatusMode("三色灯(红)",R.mipmap.ssd1,R.mipmap.ssd2,false));
DataBus.getInstance().statusModes.add(new StatusMode("三色灯(黄)",R.mipmap.ssd1,R.mipmap.ssd2,false));

DataBus.getInstance().statusModes.add(new StatusMode("加热箱加热管",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
DataBus.getInstance().statusModes.add(new StatusMode("加热箱抽水泵",R.mipmap.jsf1,R.mipmap.jsf2,false));
DataBus.getInstance().statusModes.add(new StatusMode("保温管道加热丝",R.mipmap.lcjr1,R.mipmap.lcjr2,false));

Run();

@@ -171,24 +159,16 @@ public class SsjkFragment extends Fragment implements View.OnClickListener {
//1.出口 0-15
SetStatus(0,DeviceData.Get().getConcurrentHash(0));
SetStatus(1,DeviceData.Get().getConcurrentHash(1));
SetStatus(2,DeviceData.Get().getConcurrentHash(2));

//2.外置仓 16-31 16-25
SetStatus(3,DeviceData.Get().getConcurrentHash(16));
SetStatus(4,DeviceData.Get().getConcurrentHash(17));
SetStatus(5,DeviceData.Get().getConcurrentHash(18));
SetStatus(6,DeviceData.Get().getConcurrentHash(19));
SetStatus(7,DeviceData.Get().getConcurrentHash(20));
SetStatus(8,DeviceData.Get().getConcurrentHash(21));
SetStatus(9,DeviceData.Get().getConcurrentHash(22));
SetStatus(10,DeviceData.Get().getConcurrentHash(23));
SetStatus(11,DeviceData.Get().getConcurrentHash(24));
SetStatus(12,DeviceData.Get().getConcurrentHash(25));

// SetStatus(2,DeviceData.Get().getConcurrentHash(2));
//3.
for(int i=0;i<21;i++)
for(int i=0;i<10;i++)//25
{
SetStatus(2+i,DeviceData.Get().getConcurrentHash(16+i));
}

for(int i=0;i<16;i++)//25
{
SetStatus(13+i,DeviceData.Get().getConcurrentHash(32+i));
SetStatus(12+i,DeviceData.Get().getConcurrentHash(32+i));
}
adapter.refresh();
} catch (Exception e) {
@@ -197,7 +177,7 @@ public class SsjkFragment extends Fragment implements View.OnClickListener {
}
});
}
Thread.sleep(1000);
Thread.sleep(100);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}


+ 1
- 1
app/src/main/java/com/example/bpa/view/from/dzcjy_activity.java View File

@@ -168,7 +168,7 @@ public class dzcjy_activity extends AppCompatActivity implements View.OnClickLis
}
});

Thread.sleep(500);
Thread.sleep(50);

} catch (Exception e) {



+ 5
- 3
app/src/main/java/com/example/bpa/view/from/lsjy_activity.java View File

@@ -196,6 +196,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
ClearText.setOnClickListener(this);
SaveValue.setOnClickListener(this);
cl_botton.setOnClickListener(this);
savefztime.setOnClickListener(this);
//switch
// Switch_1.setOnCheckedChangeListener(this);
// Switch_2.setOnCheckedChangeListener(this);
@@ -382,7 +383,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
try {
String stime = fzText.getText().toString();
if (stime.equals("")) {
T.show(lsjy_activity.this, "校准基准时间不能为空!");
T.show(lsjy_activity.this, "反转时间不能为空!");
return;
}
int ftime = 0;
@@ -579,7 +580,7 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
}
}
});
Thread.sleep(100);
Thread.sleep(50);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@@ -601,7 +602,8 @@ public class lsjy_activity extends AppCompatActivity implements View.OnClickList
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
int val = DeviceData.Get().getCallCurrentWeight(9);
int val = DeviceData.Get().getCallCurrentWeight(1);
val=val<=0?0:val;
DeviceData.Get().setCalibrationValue((short) val, kkk + 1, null);
String s = String.valueOf(val);
editTextLists.get(kkk).setText(String.format("%.1f", (Double.parseDouble(s) / 10)));


+ 4
- 0
app/src/main/java/com/example/bpa/view/mode/mainGoods.java View File

@@ -8,4 +8,8 @@ public class mainGoods {
public String message;

public String url;

public String foreignKeyRe;//商品外键id

public String design;//商品规格
}

+ 70
- 40
app/src/main/res/layout/from/layout/activity_lsjy.xml View File

@@ -812,12 +812,12 @@
android:theme="@style/MyEditText_num" />

<Button
android:layout_span="2"
android:id="@+id/cl_botton"
android:layout_width="40dp"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_margin="5dp"
android:layout_marginTop="10dp"
android:layout_marginRight="50dp"
android:background="@drawable/btn_greenblue"
android:text="出料" />

@@ -831,24 +831,41 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:orientation="vertical">
android:layout_marginLeft="80dp"
android:orientation="horizontal">

<TextView
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="重量:"
android:textColor="@color/white"
android:textStyle="bold"></TextView>
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="重量:"
android:textColor="@color/white"
android:textStyle="bold"
android:textSize="20dp"
android:layout_alignParentBottom="true"
></TextView>
</RelativeLayout>

<TextView
android:layout_marginLeft="10dp"
android:id="@+id/zhongliang"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:text="0g"
android:textColor="@color/color_purl"
android:textSize="40dp"
android:textStyle="bold"></TextView>
<Button
android:layout_marginTop="5dp"
android:id="@+id/ClearText"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@drawable/btn_greenblue"
android:textSize="12dp"
android:layout_weight="2"
android:text="称重清零" />
</LinearLayout>

<Button
@@ -867,6 +884,7 @@
android:textSize="16dp" />

<TableLayout
android:layout_marginRight="40dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
@@ -900,14 +918,21 @@
<Button
android:id="@+id/savetime"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="@drawable/settingbutton"
android:text="保存时间"
android:textColor="@color/white"
android:layout_height="wrap_content"
android:background="@drawable/btn_greenblue"
android:textSize="12dp"
android:textStyle="bold" />
android:text="保存时间" />
<!-- <Button-->
<!-- android:id="@+id/savetime"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="30dp"-->
<!-- android:layout_gravity="center"-->
<!-- android:layout_marginLeft="5dp"-->
<!-- android:background="@drawable/btn_greenblue"-->
<!-- android:text="保存时间"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="12dp"-->
<!-- android:textStyle="bold" />-->
</TableRow>

<TableRow
@@ -936,38 +961,43 @@
android:singleLine="true"
android:textColor="@color/white"
android:theme="@style/MyEditText_num" />
<!-- <Button-->
<!-- android:id="@+id/savefztime"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="30dp"-->
<!-- android:layout_gravity="center"-->
<!-- android:layout_marginLeft="5dp"-->
<!-- android:background="@drawable/btn_greenblue"-->
<!-- android:text="保存时间"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="12dp"-->
<!-- android:textStyle="bold" />-->
<Button
android:id="@+id/savefztime"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="@drawable/settingbutton"
android:text="保存时间"
android:textColor="@color/white"
android:layout_height="wrap_content"
android:background="@drawable/btn_greenblue"
android:textSize="12dp"
android:textStyle="bold" />
android:text="保存时间" />
</TableRow>

<TableRow
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="35dp">
android:layout_gravity="center">

<Button
android:id="@+id/ClearText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="5dp"
android:layout_weight="2"
android:background="@drawable/settingbutton"
android:text="称重清零"
android:textColor="@color/white"
android:textSize="12dp"
android:textStyle="bold" />
<!-- <Button-->
<!-- android:id="@+id/ClearText"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="45dp"-->
<!-- android:layout_marginTop="10dp"-->
<!-- android:layout_marginRight="5dp"-->
<!-- android:layout_weight="2"-->
<!-- android:background="@drawable/settingbutton"-->
<!-- android:text="称重清零"-->
<!-- android:textColor="@color/white"-->
<!-- android:textSize="12dp"-->
<!-- android:textStyle="bold" />-->
</TableRow>
</TableLayout>



+ 20
- 0
app/src/main/res/layout/item/layout/gg_item.xml View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="规格:"
android:textColor="@color/white"></TextView>

<LinearLayout
android:id="@+id/ms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

</LinearLayout>

</LinearLayout>

+ 11
- 1
app/src/main/res/layout/item/layout/maingoods.xml View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="236dp"
android:layout_height="132dp"
android:layout_height="162dp"
>
<LinearLayout
android:layout_width="match_parent"
@@ -48,6 +48,16 @@
android:textStyle="bold"
android:typeface="serif" />

<LinearLayout
android:id="@+id/gg"
android:layout_marginTop="40dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">


</LinearLayout>

<Button
android:id="@+id/goodmake"
android:layout_width="match_parent"


+ 13
- 3
app/src/main/res/layout/item/layout/order_item.xml View File

@@ -25,14 +25,24 @@
android:textColor="@color/white"
android:textSize="19dp"
android:textStyle="bold" />
<com.example.bpa.helper.MyImageView
android:id="@+id/image"

<LinearLayout
android:id="@+id/gg"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_alignParentLeft="true"
android:scaleType="fitXY" />
android:orientation="vertical">
</LinearLayout>
<!-- <com.example.bpa.helper.MyImageView-->
<!-- android:id="@+id/image"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="100dp"-->
<!-- android:layout_marginLeft="8dp"-->
<!-- android:layout_marginRight="8dp"-->
<!-- android:layout_alignParentLeft="true"-->
<!-- android:scaleType="fitXY" />-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">


Loading…
Cancel
Save