@@ -17,6 +17,7 @@ import androidx.fragment.app.FragmentTransaction; | |||
import com.example.bpa.config.ConfigName; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.helper.ModbusTcpServer; | |||
import com.example.bpa.view.fragment.CloudFragment; | |||
import com.example.bpa.view.fragment.HeplerFragment; | |||
import com.example.bpa.view.fragment.HomeFragment; | |||
@@ -57,6 +58,7 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen | |||
setContentView(R.layout.activity_main); | |||
Init(); | |||
initEvents(); | |||
initBusiness(); | |||
} | |||
//endregion | |||
@@ -77,6 +79,7 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen | |||
ShowFragment(homeFragment,"系统主页"); | |||
//ShowFragment(systemCapabilitiesFragment,"功能菜单"); | |||
DataBus.getInstance().UpdateMainGoods(); | |||
} | |||
/** | |||
* 初始化按钮事件 | |||
@@ -90,6 +93,13 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen | |||
HomeMain.setOnClickListener(this); | |||
ColseMain.setOnClickListener(this); | |||
} | |||
/** | |||
* 初始化业务 | |||
*/ | |||
private void initBusiness() { | |||
//PLC数据监控 | |||
ModbusTcpServer.get().Connect(ConfigName.getInstance().Address, ConfigName.getInstance().Post); | |||
} | |||
//endregion | |||
//region 点击事件 | |||
@@ -9,20 +9,18 @@ import com.example.bpa.config.ConfigName; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_ALERTLOG; | |||
import com.example.bpa.db.mode.BPA_LOG; | |||
import com.example.bpa.db.mode.BPA_MATERIAL; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.example.bpa.db.mode.BPA_SUGAR; | |||
import com.example.bpa.db.mode.BPA_USER; | |||
import com.example.bpa.helper.Json; | |||
import com.example.bpa.helper.MessageLog; | |||
import com.example.bpa.helper.ModbusTcpServer; | |||
import com.example.bpa.helper.SdCart; | |||
import com.example.bpa.helper.ToastUtil; | |||
import com.example.bpa.service.BusinessServer; | |||
import com.example.bpa.view.mode.AlertLogEnum; | |||
import com.example.bpa.view.mode.UserLogEnum; | |||
import java.util.ArrayList; | |||
/** | |||
* 程序启动执行 | |||
* 创建:fengyoufu 20230413 | |||
@@ -40,13 +38,11 @@ public class ICSApp extends Application { | |||
InitDBdata(); | |||
//4.初始化Main | |||
Main.getInstance(); | |||
//5.PLC数据监控 | |||
ModbusTcpServer.get().Connect(ConfigName.getInstance().Address, ConfigName.getInstance().Post); | |||
//BusinessServer.Get().test(); | |||
// MessageLog.ShowAlertMessage(AlertLogEnum.传感器异常日志,"传感器异常"); | |||
// MessageLog.ShowAlertMessage(AlertLogEnum.异常订单未制作日志,"异常订单未制作日志"); | |||
// MessageLog.ShowAlertMessage(AlertLogEnum.料仓缺料日志,"料仓缺料日志"); | |||
//MessageLog.ShowAlertMessage(AlertLogEnum.传感器异常日志,"传感器异常"); | |||
//MessageLog.ShowAlertMessage(AlertLogEnum.异常订单未制作日志,"异常订单未制作日志"); | |||
//MessageLog.ShowAlertMessage(AlertLogEnum.料仓缺料日志,"料仓缺料日志"); | |||
} | |||
/** | |||
@@ -2,15 +2,13 @@ package com.example.bpa.config; | |||
import com.example.bpa.Model.ResultA; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.DeviceData; | |||
import com.example.bpa.service.DeviceData; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_ALERTLOG; | |||
import com.example.bpa.db.mode.BPA_GOODS; | |||
import com.example.bpa.db.mode.BPA_LOG; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.view.adapter.maingoods_adapter; | |||
import com.example.bpa.view.adapter.makegood_adapter; | |||
import com.example.bpa.view.control.MyLayoutManager; | |||
import com.example.bpa.view.mode.MakeStatus; | |||
import com.example.bpa.view.mode.ResGoodsMake; | |||
import com.example.bpa.view.mode.ResGoodsRecipe; | |||
@@ -1,4 +1,4 @@ | |||
package com.example.bpa.app; | |||
package com.example.bpa.helper; | |||
public enum DataFormat { | |||
ABCD, |
@@ -1,4 +1,4 @@ | |||
package com.example.bpa.app; | |||
package com.example.bpa.helper; | |||
import com.licheedev.modbus4android.ModbusWorker; | |||
@@ -1,10 +1,14 @@ | |||
package com.example.bpa.app; | |||
package com.example.bpa.helper; | |||
import com.example.bpa.Model.IReadCallBack; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.service.BusinessServer; | |||
import com.example.bpa.service.DeviceData; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.helper.MessageLog; | |||
import com.example.bpa.service.DeviceServer; | |||
import com.example.bpa.service.LogServer; | |||
import com.example.bpa.service.OrderServer; | |||
import com.licheedev.modbus4android.ModbusCallback; | |||
import com.licheedev.modbus4android.ModbusParam; | |||
import com.licheedev.modbus4android.ModbusRespException; | |||
@@ -14,8 +18,6 @@ import com.serotonin.modbus4j.exception.ModbusInitException; | |||
import com.serotonin.modbus4j.exception.ModbusTransportException; | |||
import com.serotonin.modbus4j.msg.ReadCoilsResponse; | |||
import com.serotonin.modbus4j.msg.ReadHoldingRegistersResponse; | |||
import com.serotonin.modbus4j.msg.WriteCoilResponse; | |||
import com.serotonin.modbus4j.msg.WriteRegistersResponse; | |||
import java.nio.ByteBuffer; | |||
import java.util.Arrays; | |||
@@ -129,7 +131,12 @@ public class ModbusTcpServer { | |||
//3.设置自动模式 | |||
DeviceData.Get().setHandOrAutoSwitch(true, null); | |||
DeviceData.Get().setCleaningMode(false,null);//关闭自动清洗模式 | |||
//4.启动设备服务 | |||
DeviceServer.Get().Init(); | |||
//5.启动日志服务 | |||
LogServer.Get().Init(); | |||
//6.云订单服务 | |||
OrderServer.Get().Init(); | |||
} | |||
@Override |
@@ -1,7 +1,6 @@ | |||
package com.example.bpa.app; | |||
package com.example.bpa.service; | |||
import com.example.bpa.Model.IRun; | |||
import com.example.bpa.Model.IRunT; | |||
import com.example.bpa.Model.IThread; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.Model.ResultA; | |||
@@ -11,21 +10,20 @@ import com.example.bpa.db.mode.BPA_GOODS; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.db.mode.BPA_SUGAR; | |||
import com.example.bpa.helper.MessageLog; | |||
import com.example.bpa.helper.ModbusTcpServer; | |||
import com.example.bpa.helper.ThreadManager; | |||
import com.example.bpa.view.mode.AlertLogEnum; | |||
import com.example.bpa.view.mode.MakeStatus; | |||
import com.example.bpa.view.mode.ResGoodsRecipe; | |||
import com.example.bpa.view.mode.UserLogEnum; | |||
import java.sql.Ref; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Date; | |||
import java.util.LinkedHashMap; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
import java.util.concurrent.ConcurrentLinkedQueue; | |||
/** | |||
* 业务服务 | |||
*/ | |||
public class BusinessServer { | |||
private static volatile BusinessServer _instance; | |||
@@ -1,24 +1,15 @@ | |||
package com.example.bpa.app; | |||
package com.example.bpa.service; | |||
import com.example.bpa.Model.IReadCallBack; | |||
import com.example.bpa.Model.IRun; | |||
import com.example.bpa.Model.IRunT; | |||
import com.example.bpa.Model.IThread; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.helper.MessageLog; | |||
import com.example.bpa.helper.ModbusTcpServer; | |||
import com.example.bpa.helper.RTrig; | |||
import com.example.bpa.helper.ThreadManager; | |||
import com.licheedev.modbus4android.ModbusCallback; | |||
import com.licheedev.modbus4android.ModbusRespException; | |||
import com.serotonin.modbus4j.exception.ModbusInitException; | |||
import com.serotonin.modbus4j.exception.ModbusTransportException; | |||
import com.serotonin.modbus4j.msg.ReadHoldingRegistersResponse; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
import java.util.concurrent.ConcurrentLinkedQueue; | |||
import java.util.concurrent.ExecutionException; | |||
public class DeviceData { | |||
private static volatile DeviceData _instance; |
@@ -0,0 +1,61 @@ | |||
package com.example.bpa.service; | |||
import com.example.bpa.Model.IRun; | |||
import com.example.bpa.Model.IThread; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.Model.ResultA; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_GOODS; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.db.mode.BPA_SUGAR; | |||
import com.example.bpa.helper.MessageLog; | |||
import com.example.bpa.helper.ModbusTcpServer; | |||
import com.example.bpa.helper.ThreadManager; | |||
import com.example.bpa.view.mode.AlertLogEnum; | |||
import com.example.bpa.view.mode.ResGoodsRecipe; | |||
import com.example.bpa.view.mode.UserLogEnum; | |||
import java.util.ArrayList; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
/** | |||
* 设备服务 | |||
* 设备预警、上报设备告警、上报设备状态 | |||
*/ | |||
public class DeviceServer { | |||
//region 私有单例 | |||
private static volatile DeviceServer _instance; | |||
public static DeviceServer Get() { | |||
if (_instance == null) | |||
_instance = new DeviceServer(); | |||
return _instance; | |||
} | |||
private DeviceServer() { | |||
} | |||
//endregion | |||
//region | |||
/** | |||
* 初始化 | |||
*/ | |||
public void Init() | |||
{ | |||
// ThreadManager.Get().StartLong("设备服务", true, new IThread() { | |||
// @Override | |||
// public void Run() throws InterruptedException { | |||
// MessageLog.ShowInfo("我是设备服务!"); | |||
// Thread.sleep(2000); | |||
// } | |||
// @Override | |||
// public void RunComplete() throws InterruptedException { | |||
// } | |||
// }); | |||
} | |||
//endregion | |||
} |
@@ -0,0 +1,45 @@ | |||
package com.example.bpa.service; | |||
import com.example.bpa.Model.IThread; | |||
import com.example.bpa.helper.MessageLog; | |||
import com.example.bpa.helper.ThreadManager; | |||
/** | |||
* 日志服务 | |||
* 周期性上报日志 | |||
*/ | |||
public class LogServer { | |||
//region 私有单例 | |||
private static volatile LogServer _instance; | |||
public static LogServer Get() { | |||
if (_instance == null) | |||
_instance = new LogServer(); | |||
return _instance; | |||
} | |||
private LogServer() { | |||
} | |||
//endregion | |||
//region | |||
/** | |||
* 初始化 | |||
*/ | |||
public void Init() | |||
{ | |||
// ThreadManager.Get().StartLong("日志服务", true, new IThread() { | |||
// @Override | |||
// public void Run() throws InterruptedException { | |||
// MessageLog.ShowInfo("我是日志服务!"); | |||
// Thread.sleep(2000); | |||
// } | |||
// @Override | |||
// public void RunComplete() throws InterruptedException { | |||
// } | |||
// }); | |||
} | |||
//endregion | |||
} |
@@ -0,0 +1,45 @@ | |||
package com.example.bpa.service; | |||
import com.example.bpa.Model.IThread; | |||
import com.example.bpa.helper.MessageLog; | |||
import com.example.bpa.helper.ThreadManager; | |||
/** | |||
* 订单服务 | |||
* 收发订单、订单预警、接收云端订单信息 | |||
*/ | |||
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 | |||
/** | |||
* 初始化 | |||
*/ | |||
public void Init() | |||
{ | |||
// ThreadManager.Get().StartLong("订单服务", true, new IThread() { | |||
// @Override | |||
// public void Run() throws InterruptedException { | |||
// MessageLog.ShowInfo("我是订单服务!"); | |||
// Thread.sleep(2000); | |||
// } | |||
// @Override | |||
// public void RunComplete() throws InterruptedException { | |||
// } | |||
// }); | |||
} | |||
//endregion | |||
} |
@@ -12,9 +12,8 @@ import androidx.annotation.NonNull; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.BusinessServer; | |||
import com.example.bpa.service.BusinessServer; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.db.mode.BPA_GOODS; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.view.mode.mainGoods; | |||
@@ -81,6 +80,12 @@ public class maingoods_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol | |||
@Override | |||
public void onClick(View v) { | |||
if(!DataBus.getInstance().PlcIsConnect) | |||
{ | |||
T.show(view.getContext(),"PLC未连接,不允许下单!"); | |||
return; | |||
} | |||
BusinessServer.Get().AddCommodity(id); | |||
T.show(view.getContext(),"开始制作商品:"+goodname.getText().toString()); | |||
} | |||
@@ -6,7 +6,6 @@ import android.content.ContextWrapper; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.Button; | |||
import android.widget.ImageView; | |||
import android.widget.ProgressBar; | |||
import android.widget.TextView; | |||
@@ -15,18 +14,12 @@ import androidx.annotation.NonNull; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.BusinessServer; | |||
import com.example.bpa.app.DeviceData; | |||
import com.example.bpa.config.ConfigName; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.view.from.lsjy_activity; | |||
import com.example.bpa.view.mode.MakeStatus; | |||
import com.example.bpa.view.mode.ResGoodsMake; | |||
import com.example.bpa.view.mode.mainGoods; | |||
import java.util.List; | |||
import java.util.Random; | |||
/** | |||
* 制作商品 | |||
@@ -2,36 +2,21 @@ package com.example.bpa.view.fragment; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.recyclerview.widget.LinearLayoutManager; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.util.Log; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.ListView; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.BusinessServer; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_GOODS; | |||
import com.example.bpa.helper.Json; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.view.adapter.maingoods_adapter; | |||
import com.example.bpa.view.adapter.makegood_adapter; | |||
import com.example.bpa.view.adapter.sp_adapter; | |||
import com.example.bpa.view.control.MyLayoutManager; | |||
import com.example.bpa.view.from.add_pf_activity; | |||
import com.example.bpa.view.from.yfpf_activity; | |||
import com.example.bpa.view.inteface.MyClickListener; | |||
import com.example.bpa.view.mode.mainGoods; | |||
import java.util.ArrayList; | |||
/** | |||
* 主页界面 | |||
@@ -2,9 +2,7 @@ package com.example.bpa.view.fragment.setting; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.fragment.app.FragmentActivity; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
@@ -19,7 +17,7 @@ import android.widget.Switch; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.DeviceData; | |||
import com.example.bpa.service.DeviceData; | |||
import com.example.bpa.helper.T; | |||
import java.util.ArrayList; | |||
@@ -2,23 +2,18 @@ package com.example.bpa.view.fragment.setting; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.fragment.app.Fragment; | |||
import android.os.Build; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.Button; | |||
import android.widget.CompoundButton; | |||
import android.widget.EditText; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.DeviceData; | |||
import com.example.bpa.config.ConfigName; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_GOODS; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.db.mode.BPA_SYSTEMSET; | |||
import com.example.bpa.helper.T; | |||
@@ -2,7 +2,6 @@ package com.example.bpa.view.from; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import android.graphics.drawable.Drawable; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.view.Window; | |||
@@ -18,11 +17,9 @@ import android.widget.TextView; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.DeviceData; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.service.DeviceData; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashMap; | |||
import java.util.Map; | |||
@@ -6,7 +6,6 @@ import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import android.os.Bundle; | |||
import android.util.Log; | |||
import android.view.View; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
@@ -14,15 +13,10 @@ import android.widget.AdapterView; | |||
import android.widget.ArrayAdapter; | |||
import android.widget.ImageView; | |||
import android.widget.ListView; | |||
import android.widget.Spinner; | |||
import android.widget.TextView; | |||
import com.example.bpa.Model.IReadCallBack; | |||
import com.example.bpa.Model.IThread; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.DeviceData; | |||
import com.example.bpa.app.ModbusTcpServer; | |||
import com.example.bpa.config.ConfigName; | |||
import com.example.bpa.service.DeviceData; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_MATERIAL; | |||
@@ -30,7 +24,6 @@ import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.example.bpa.helper.FlashHelper; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.helper.ThreadManager; | |||
import com.example.bpa.view.adapter.lc_item_adapter; | |||
import com.example.bpa.view.adapter.selectitem_adapter; | |||
import com.example.bpa.view.control.ItemClickListener; | |||
@@ -38,7 +31,6 @@ import com.example.bpa.view.control.MyLayoutManager; | |||
import com.example.bpa.view.mode.lcMode; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
/** | |||
@@ -1,9 +1,7 @@ | |||
package com.example.bpa.view.from; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.view.Window; | |||
@@ -12,32 +10,17 @@ import android.widget.Button; | |||
import android.widget.CompoundButton; | |||
import android.widget.EditText; | |||
import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.ListView; | |||
import android.widget.Switch; | |||
import android.widget.TextView; | |||
import com.example.bpa.Model.IThread; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.DeviceData; | |||
import com.example.bpa.service.DeviceData; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_MATERIAL; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.helper.FlashHelper; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.helper.ThreadManager; | |||
import com.example.bpa.view.adapter.lc_item_adapter; | |||
import com.example.bpa.view.adapter.lsjy_adapter; | |||
import com.example.bpa.view.adapter.wl_adapter; | |||
import com.example.bpa.view.inteface.MyClickListener; | |||
import com.example.bpa.view.mode.ResGoodsRecipe; | |||
import com.example.bpa.view.mode.ResSilosMode; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
/** | |||
@@ -8,15 +8,14 @@ import android.util.Log; | |||
import android.view.View; | |||
import android.view.Window; | |||
import android.view.WindowManager; | |||
import android.widget.AdapterView; | |||
import android.widget.Button; | |||
import android.widget.ImageView; | |||
import android.widget.ListView; | |||
import android.widget.TextView; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.BusinessServer; | |||
import com.example.bpa.config.ConfigName; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.service.BusinessServer; | |||
import com.example.bpa.config.MessageName; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_GOODS; | |||
@@ -176,6 +175,11 @@ public class yfpf_activity extends AppCompatActivity implements View.OnClickList | |||
startActivity(intent); | |||
break; | |||
case R.id.button_xf://下发按钮 | |||
if(!DataBus.getInstance().PlcIsConnect) | |||
{ | |||
T.show(this,"PLC未连接,不允许下单!"); | |||
return; | |||
} | |||
BusinessServer.Get().AddCommodity(((BPA_GOODS) data).id); | |||
T.show(this, "下发成功!"); | |||
break; | |||
@@ -1,7 +1,5 @@ | |||
package com.example.bpa.view.from; | |||
import static com.example.bpa.helper.T.show; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import android.os.Bundle; | |||
@@ -18,9 +16,8 @@ import android.widget.TextView; | |||
import com.example.bpa.Model.IWriteCallBack; | |||
import com.example.bpa.R; | |||
import com.example.bpa.app.DeviceData; | |||
import com.example.bpa.service.DeviceData; | |||
import com.example.bpa.config.DataBus; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.helper.T; | |||
/** | |||
@@ -101,7 +101,7 @@ | |||
android:textColor="@color/white" | |||
android:layout_gravity="center" | |||
android:layout_marginTop="20dp" | |||
android:layout_width="120dp" | |||
android:layout_width="150dp" | |||
android:layout_height="wrap_content" | |||
/> | |||
@@ -114,7 +114,7 @@ | |||
android:layout_alignParentRight="true" | |||
android:layout_gravity="center" | |||
android:layout_marginTop="20dp" | |||
android:layout_width="120dp" | |||
android:layout_width="150dp" | |||
android:layout_height="wrap_content" | |||
/> | |||
</RelativeLayout> | |||