# Conflicts: # app/build.gradle # app/src/main/java/com/bonait/bnframework/business/ConfigData.java鸿鹄中学一拖二
@@ -1,17 +1,10 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<project version="4"> | |||
<component name="deploymentTargetDropDown"> | |||
<runningDeviceTargetSelectedWithDropDown> | |||
<Target> | |||
<type value="RUNNING_DEVICE_TARGET" /> | |||
<deviceKey> | |||
<Key> | |||
<type value="SERIAL_NUMBER" /> | |||
<value value="127.0.0.1:7555" /> | |||
</Key> | |||
</deviceKey> | |||
</Target> | |||
</runningDeviceTargetSelectedWithDropDown> | |||
<timeTargetWasSelectedWithDropDown value="2024-07-19T02:34:44.522758700Z" /> | |||
<value> | |||
<entry key="app"> | |||
<State /> | |||
</entry> | |||
</value> | |||
</component> | |||
</project> |
@@ -171,9 +171,14 @@ dependencies { | |||
implementation 'com.contrarywind:Android-PickerView:3.2.6' | |||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.9' | |||
api 'org.greenrobot:eventbus:3.1.1' | |||
//日志工具 可定位代码行数 | |||
api 'com.apkfuns.logutils:library:1.7.5' | |||
//http服务器组件 | |||
implementation 'org.nanohttpd:nanohttpd:2.3.1' | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.bonait.bnframework.HBL; | |||
import com.bonait.bnframework.common.helper.MessageLog; | |||
import com.bonait.bnframework.common.helper.SendData; | |||
import com.google.gson.Gson; | |||
import com.lzy.okgo.model.HttpParams; | |||
import java.util.Map; | |||
import fi.iki.elonen.NanoHTTPD; | |||
public class HttpServer extends NanoHTTPD { | |||
public HttpServer() { | |||
super(35000); | |||
try{ | |||
start(NanoHTTPD.SOCKET_READ_TIMEOUT, false); | |||
}catch (Exception ex){ | |||
MessageLog.ShowError("启动服务失败!"+ex.getMessage()); | |||
} | |||
} | |||
@Override | |||
public Response serve(IHTTPSession session) { | |||
try{ | |||
if (session.getMethod()==Method.POST){ | |||
Map<String,String> headers= session.getHeaders();//获取请求头数据 | |||
if(session.getUri().contains("/api/GetMainConsoleData")){ | |||
return newFixedLengthResponse(Response.Status.OK, HttpParams.MEDIA_TYPE_JSON.toString(), new Gson().toJson( new SendData())); // 返回响应 | |||
} | |||
} | |||
return newFixedLengthResponse(Response.Status.INTERNAL_ERROR, HttpParams.MEDIA_TYPE_JSON.toString(), new Gson().toJson("不是有效的请求")); // 返回响应 | |||
}catch (Exception ex){ | |||
MessageLog.ShowError("请求失败!"+ex.getMessage()); | |||
return newFixedLengthResponse(Response.Status.INTERNAL_ERROR, HttpParams.MEDIA_TYPE_JSON.toString(), new Gson().toJson(ex.getMessage())); // 返回响应 | |||
} | |||
} | |||
} |
@@ -1,12 +1,19 @@ | |||
package com.bonait.bnframework.business; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.graphics.Bitmap; | |||
import android.graphics.BitmapFactory; | |||
import android.os.Handler; | |||
import android.os.Message; | |||
import android.util.Log; | |||
import com.bonait.bnframework.MainApplication; | |||
import com.bonait.bnframework.HBL.Dialog.WaitDialog; | |||
import com.bonait.bnframework.HBL.Task; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
@@ -26,8 +33,13 @@ import com.bonait.bnframework.common.db.mode.BPA_USER; | |||
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS; | |||
import com.bonait.bnframework.common.db.util.DBListDataUtil; | |||
import com.bonait.bnframework.common.helper.ConfigUtil; | |||
import com.bonait.bnframework.common.helper.I.IRun; | |||
import com.bonait.bnframework.common.helper.I.IRunT; | |||
import com.bonait.bnframework.common.helper.Json; | |||
import com.bonait.bnframework.common.helper.MessageLog; | |||
import com.bonait.bnframework.common.helper.SendData; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.image.utils.LocalCacheUtils; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
@@ -60,6 +72,7 @@ import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.GoodEditDialog; | |||
import com.google.gson.Gson; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.callback.StringCallback; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
import com.lzy.okgo.model.Response; | |||
@@ -154,6 +167,12 @@ public class ConfigData { | |||
case 10: | |||
set.value = String.valueOf(ConfigName.getInstance().DevicePort); | |||
break; | |||
case 11: | |||
set.value = ConfigName.getInstance().F1HMIAddress; | |||
break; | |||
case 12: | |||
set.value = ConfigName.getInstance().F2HMIAddress; | |||
break; | |||
} | |||
set.deviceID = ConfigName.getInstance().DeviceId; | |||
set.userID = ConfigName.getInstance().user.userID; | |||
@@ -234,11 +253,114 @@ public class ConfigData { | |||
case 10: | |||
ConfigName.getInstance().DevicePort = Integer.parseInt(item.value); | |||
break; | |||
case 11: | |||
ConfigName.getInstance().F1HMIAddress = item.value; | |||
break; | |||
case 12: | |||
ConfigName.getInstance().F2HMIAddress = item.value; | |||
break; | |||
} | |||
} | |||
} | |||
IRun run1; | |||
IRun run2; | |||
/** | |||
* 同步商品数据到设备屏幕 | |||
*/ | |||
public void DownDataToDevice(Context context, Activity activity){ | |||
// AtomicBoolean one =new AtomicBoolean(false); | |||
// AtomicBoolean two = new AtomicBoolean(false); | |||
// WaitDialog.Show("商品下发","开始下发商品到一号炒锅",context,activity); | |||
Task.Run(()->{ | |||
try{ | |||
// run1=()->{ | |||
// WaitDialog.AddText("开始下发商品到二号炒锅"); | |||
// String url1 = "http://" + ConfigName.getInstance().F2HMIAddress+":36000/api/DownGoodsData"; | |||
// OkGo.<String>post(url1).upJson(new Gson().toJson(new SendData())).tag(this).execute(new StringCallback() { | |||
// @Override | |||
// public void onSuccess(Response<String> response) { | |||
// ToastUtils.info("下发数据到二号设备成功!"); | |||
// WaitDialog.AddText("下发商品到二号炒锅成功"); | |||
// two.set(true); | |||
// if(run2!=null)run2.Run(); | |||
// } | |||
// @Override | |||
// public void onError(Response<String> val){ | |||
// ToastUtils.info("下发数据到二号设备失败!"); | |||
// WaitDialog.AddText("下发商品到二号炒锅失败"); | |||
// Task.Delay(1000); | |||
// if(run2!=null)run2.Run(); | |||
// } | |||
// }); | |||
// | |||
// }; | |||
// run2=()->{ | |||
// ConfigName.getInstance().IsChangeGoods=false; | |||
// if(!one.get()&&!two.get()){ | |||
// WaitDialog.TimeOut("商品同步到一号、二号炒锅失败!"); | |||
// return; | |||
// } | |||
// if(!one.get()){ | |||
// WaitDialog.TimeOut("商品同步到一号炒锅失败!"); | |||
// return; | |||
// } | |||
// if(!two.get()){ | |||
// WaitDialog.TimeOut("商品同步到二号炒锅失败!"); | |||
// return; | |||
// } | |||
// WaitDialog.Dismiss(); | |||
// }; | |||
String url = "http://" + ConfigName.getInstance().F1HMIAddress+":36000/api/DownGoodsData"; | |||
OkGo.<String>post(url).upJson(new Gson().toJson(new SendData())).tag(this).execute(new StringCallback() { | |||
@Override | |||
public void onSuccess(Response<String> response) { | |||
ToastUtils.info("下发商品到一号设备成功!"); | |||
// WaitDialog.AddText("下发商品到一号炒锅成功"); | |||
// one.set(true); | |||
} | |||
@Override | |||
public void onError(Response<String> val){ | |||
ToastUtils.info("下发商品到一号设备失败!"); | |||
// WaitDialog.AddText("下发商品到一号炒锅失败"); | |||
// Task.Delay(1000); | |||
} | |||
}); | |||
String url1 = "http://" + ConfigName.getInstance().F2HMIAddress+":36000/api/DownGoodsData"; | |||
OkGo.<String>post(url1).upJson(new Gson().toJson(new SendData())).tag(this).execute(new StringCallback() { | |||
@Override | |||
public void onSuccess(Response<String> response) { | |||
Task.Delay(1500); | |||
ToastUtils.info("下发数据到二号设备成功!"); | |||
// WaitDialog.AddText("下发商品到二号炒锅成功"); | |||
// two.set(true); | |||
// if(run2!=null)run2.Run(); | |||
} | |||
@Override | |||
public void onError(Response<String> val){ | |||
Log.d("DownGoodsData", "onError: "+val.message()+val.code()+val.message()); | |||
Task.Delay(1500); | |||
// ToastUtils.info("下发数据到二号设备失败!"); | |||
// WaitDialog.AddText("下发商品到二号炒锅失败"); | |||
// if(run2!=null)run2.Run(); | |||
} | |||
}); | |||
}catch (Exception e){ | |||
// MessageLog.ShowError("下发商品失败!"+e.getMessage()); | |||
// WaitDialog.TimeOut("下发商品失败"); | |||
ToastUtils.error("下发商品失败!"+e.getMessage()); | |||
} | |||
}); | |||
} | |||
/** | |||
* 切换环境 | |||
*/ | |||
@@ -172,6 +172,17 @@ public class ConfigName { | |||
public String DeviceAddress="192.168.1.103"; | |||
public int DevicePort=502; | |||
/** | |||
* 炒锅1屏幕地址 | |||
*/ | |||
public String F1HMIAddress="10.0.2.15"; | |||
/** | |||
* 炒锅2屏幕地址 | |||
*/ | |||
public String F2HMIAddress="10.0.2.15"; | |||
/** | |||
* 是否有修改商品 | |||
*/ | |||
@@ -1,41 +1,83 @@ | |||
package com.bonait.bnframework.modules.home.activity; | |||
import android.os.Bundle; | |||
import android.util.Log; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.viewpager.widget.ViewPager; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.net.wifi.p2p.WifiP2pConfig; | |||
import android.net.wifi.p2p.WifiP2pGroup; | |||
import android.net.wifi.p2p.WifiP2pManager; | |||
import android.net.wifi.p2p.WifiP2pManager.Channel; | |||
import android.os.Bundle; | |||
import android.util.Log; | |||
import com.bonait.bnframework.HBL.Dialog.AlertDialogButton; | |||
import com.bonait.bnframework.HBL.Dialog.DialogHelper; | |||
import com.bonait.bnframework.HBL.HttpServer; | |||
import com.bonait.bnframework.HBL.Task; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.business.ConfigData; | |||
import com.bonait.bnframework.business.DoubleFryingpanControl; | |||
import com.bonait.bnframework.business.FryingpanModbusHelper; | |||
import com.bonait.bnframework.business.OrderServer; | |||
import com.bonait.bnframework.business.PeripheralData; | |||
import com.bonait.bnframework.business.RobotControl; | |||
import com.bonait.bnframework.business.RobotData; | |||
import com.bonait.bnframework.business.YJDeviceHelper; | |||
import com.bonait.bnframework.common.ModbusSlave.ModbusTcpSlave; | |||
import com.bonait.bnframework.common.base.BaseActivity; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.QueryDB; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | |||
import com.bonait.bnframework.common.helper.I.IRunT; | |||
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.TcpClient; | |||
import com.bonait.bnframework.common.helper.TcpServer; | |||
import com.bonait.bnframework.common.http.callback.json.JsonDialogCallback; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.modbus.IOperateResult; | |||
import com.bonait.bnframework.common.modbus.ModbusMaster; | |||
import com.bonait.bnframework.common.model.ResAPI; | |||
import com.bonait.bnframework.common.model.mode.ActionJsonMode; | |||
import com.bonait.bnframework.common.model.mode.BatchingInfo; | |||
import com.bonait.bnframework.common.model.mode.BomTechnologyActionInfo; | |||
import com.bonait.bnframework.common.model.mode.CloudGood; | |||
import com.bonait.bnframework.common.model.mode.GoodsTechnology; | |||
import com.bonait.bnframework.common.model.mode.TechnologyAction; | |||
import com.bonait.bnframework.common.model.mode.UpdateBomInfo; | |||
import com.bonait.bnframework.common.model.mode.UpdateCloudGood; | |||
import com.bonait.bnframework.common.oss.OssHelper; | |||
import com.bonait.bnframework.common.tabbar.MainNavigateTabBar; | |||
import com.bonait.bnframework.common.utils.NetworkUtils; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.GoodEditDialog; | |||
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter; | |||
import com.bonait.bnframework.modules.home.fragment.DingDanfragment; | |||
import com.bonait.bnframework.modules.home.fragment.DoubleFryingpanFragment; | |||
import com.bonait.bnframework.modules.home.fragment.GongnengFragment; | |||
import com.bonait.bnframework.modules.home.fragment.RobotMain; | |||
import com.bonait.bnframework.modules.home.fragment.SheZhifragment; | |||
import com.bonait.bnframework.modules.mine.fragment.MyFragment; | |||
import com.google.gson.Gson; | |||
import com.lzy.okgo.OkGo; | |||
import com.lzy.okgo.model.HttpHeaders; | |||
import com.lzy.okgo.model.Response; | |||
import com.qmuiteam.qmui.widget.QMUIViewPager; | |||
import java.net.InetAddress; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
import okhttp3.MediaType; | |||
import okhttp3.RequestBody; | |||
public class BottomNavigationMainActivity extends BaseActivity { | |||
@@ -44,159 +86,39 @@ public class BottomNavigationMainActivity extends BaseActivity { | |||
@BindView(R.id.viewpager) | |||
QMUIViewPager viewPager; | |||
Context context; | |||
Activity activity; | |||
HttpServer hs; | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
setContentView(R.layout.activity_bottom_navigation_main); | |||
context=this; | |||
activity=this; | |||
try { | |||
ButterKnife.bind(this); | |||
MediaPlayerHelper.getInstance().SetConText(getBaseContext()); | |||
mNavigateTabBar.onRestoreInstanceState(savedInstanceState); | |||
mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(R.mipmap.gongneng, R.mipmap.gongneng_selected, "功能")); | |||
// mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(R.mipmap.dingdan, R.mipmap.dingdan_selected, "日志")); | |||
mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(0, 0, "")); | |||
mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(R.mipmap.shezhi, R.mipmap.shezhi_selected, "设置")); | |||
// mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_person, R.mipmap.comui_tab_person_selected, "我的")); | |||
mNavigateTabBar.setTabSelectListener(mOnNavigationItemSelectedListener); | |||
initFragment(); | |||
Init(); | |||
TcpServer.getInstance().startServer(40000); | |||
// TcpClient tcpClient = new TcpClient(); | |||
// tcpClient.Connect(); | |||
} | |||
catch (Exception e){ | |||
Log.i("TAG", "onCreate: "+e.getMessage()); | |||
} | |||
} | |||
//region P2P通讯 | |||
// WifiP2pManager manager ; | |||
// Channel channel ; | |||
// private void P2pInit(){ | |||
// //初始化设备 | |||
// manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE); | |||
// channel = manager.initialize(this, getMainLooper(), null); | |||
// | |||
// // 监听Wifi-Direct事件 | |||
// channel.listenOnChannel(new WifiP2pManager.ChannelListener() { | |||
// @Override | |||
// public void onChannelDisconnected() { | |||
// | |||
// } | |||
// // 处理设备发现、连接、连接变化等 | |||
// }); | |||
// | |||
// // 发现其他Wifi-Direct设备 | |||
// manager.discoverPeers(channel, new WifiP2pManager.ActionListener() { | |||
// public void onSuccess() { | |||
// // 发现设备成功 | |||
// } | |||
// public void onFailure(int reasonCode) { | |||
// // 发现失败 | |||
// } | |||
// }); | |||
// | |||
// // 连接到选择的设备 | |||
// WifiP2pConfig config = new WifiP2pConfig(); | |||
// config.deviceAddress = "设备地址"; | |||
// manager.connect(channel, config, new WifiP2pManager.ActionListener() { | |||
// @Override | |||
// public void onSuccess() { | |||
// | |||
// } | |||
// | |||
// @Override | |||
// public void onFailure(int i) { | |||
// | |||
// } | |||
// // 连接成功或失败的回调 | |||
// }); | |||
// | |||
// // 请求IP地址 | |||
// manager.requestGroupInfo(channel, new WifiP2pManager.GroupInfoListener() { | |||
// public void onGroupInfoAvailable(WifiP2pGroup group) { | |||
// InetAddress groupOwnerAddress = group.getOwner().getDeviceAddress(); | |||
// // 使用IP地址建立Socket连接 | |||
// } | |||
// }); | |||
// | |||
// | |||
// WifiDirectHelper wdh = new WifiDirectHelper(manager,channel); | |||
// wdh.register(this); | |||
// manager.discoverPeers(channel, new WifiP2pManager.ActionListener() { | |||
// @Override | |||
// public void onSuccess() { | |||
// // 搜索成功 | |||
// } | |||
// | |||
// @Override | |||
// public void onFailure(int reason) { | |||
// // 搜索失败 | |||
// } | |||
// }); | |||
// | |||
// manager.requestPeers(channel, new WifiP2pManager.PeerListListener() { | |||
// @Override | |||
// public void onPeersAvailable(WifiP2pDeviceList peers) { | |||
// List<WifiP2pDevice> deviceList = new ArrayList<>(peers.getDeviceList()); | |||
// // 获取设备列表 | |||
// } | |||
// }); | |||
// | |||
// | |||
// | |||
// } | |||
// | |||
// | |||
// // 当需要传输文件时,调用transferFile方法 | |||
// public void transferFile() { | |||
// WifiP2pFileTransferServer server = new WifiP2pFileTransferServer(channel, this); | |||
// server.setFileTransferListener(new WifiP2pFileTransferServer.FileTransferListener() { | |||
// @Override | |||
// public void onFileTransferStarted(String filename) { | |||
// // 文件传输开始 | |||
// } | |||
// | |||
// @Override | |||
// public void onFileTransferProgress(String filename, int progress) { | |||
// // 文件传输进度更新 | |||
// } | |||
// | |||
// @Override | |||
// public void onFileTransferFinished(String filename) { | |||
// // 文件传输完成 | |||
// } | |||
// }); | |||
// | |||
// // 启动服务器 | |||
// server.startServer(); | |||
// | |||
// // 选择要传输的文件 | |||
// File file = ...; | |||
// | |||
// // 发起对 chosenDevice 设备的文件传输请求 | |||
// server.transferFile(chosenDevice, file); | |||
// } | |||
//endregion | |||
@Override | |||
protected void onDestroy() { | |||
// FryingpanTwoModebus.getInstance().Dispose(); | |||
// FryingpanOneModebus.getInstance().Dispose(); | |||
FryingpanModbusHelper.getInstance().Dispose(); | |||
YJDeviceHelper.getInstance().Close(); | |||
TcpServer.getInstance().stopServer(); | |||
if(hs!=null) | |||
hs.stop(); | |||
//关闭PLC连接 | |||
ConfigData.getInstance().ColsePLC(); | |||
MediaPlayerHelper.getInstance().Release(); | |||
@@ -212,18 +134,15 @@ public class BottomNavigationMainActivity extends BaseActivity { | |||
private void initFragment() { | |||
fragmentList = new ArrayList<>(); | |||
fragmentList.add(new GongnengFragment()); | |||
// fragmentList.add(new DingDanfragment()); | |||
if(ConfigName.getInstance().versionSelectionEnum.equals("一拖四")){ | |||
fragmentList.add(new RobotMain()); | |||
} | |||
else if (ConfigName.getInstance().versionSelectionEnum.equals("一拖二")){ | |||
fragmentList.add(new DoubleFryingpanFragment()); | |||
hs = new HttpServer(); | |||
} | |||
// fragmentList.add(new MakeGoodFragment());//再来一单 | |||
fragmentList.add(new SheZhifragment()); | |||
// fragmentList.add(new MyFragment()); | |||
ConfigName.getInstance().fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), fragmentList); | |||
viewPager.setAdapter(ConfigName.getInstance().fragmentAdapter); | |||
ConfigName.getInstance().fragmentAdapter.SetViewPage(viewPager); | |||
@@ -242,10 +161,9 @@ public class BottomNavigationMainActivity extends BaseActivity { | |||
public void Init() { | |||
//1.同步时间 | |||
NetworkUtils.SynchronizationTime(); | |||
//主持 | |||
//ConfigData.getInstance().GetOrganize(this); | |||
//判断连接环境 | |||
ConfigData.getInstance().ToggleEnvironment(); | |||
if(ConfigName.getInstance().versionSelectionEnum.equals("一拖四")){ | |||
RobotControl.getInstance().Init(); | |||
} | |||
@@ -255,16 +173,13 @@ public class BottomNavigationMainActivity extends BaseActivity { | |||
if( PeripheralData.PutBlowComplete){ | |||
DialogHelper.showInfo(this,"餐盆到位,请出餐!", AlertDialogButton.OK,null); | |||
PeripheralData.PutBlowComplete=false; | |||
Task.Run(()->{ | |||
Task.Delay(3000); | |||
YJDeviceHelper.getInstance().ConveyorLineControl(false); | |||
}}; | |||
} | |||
}); | |||
} | |||
}; | |||
// PeripheralData.OutPen.ChangeNotify = (s)->{ | |||
// if(s){ | |||
// | |||
// }; | |||
RobotData.EStop.ChangeNotify=(s)->{ | |||
if(s) DialogHelper.showError(this,"机器人急停中!", AlertDialogButton.OK,null); | |||
}; | |||
@@ -272,16 +187,7 @@ public class BottomNavigationMainActivity extends BaseActivity { | |||
// DialogHelper.showError(this,"机器人急停中!", AlertDialogButton.OK,null); | |||
// }; | |||
} | |||
//2.初始化PLC | |||
// ReconnectModbus(); | |||
//MQTT数据监听 | |||
// OrderServer.Get().MqttInit(); | |||
} | |||
/** | |||
* 配置bottom底部菜单栏监听器,手指点击底部菜单监听 | |||
@@ -290,41 +196,19 @@ public class BottomNavigationMainActivity extends BaseActivity { | |||
= new MainNavigateTabBar.OnTabSelectedListener() { | |||
@Override | |||
public void onTabSelected(MainNavigateTabBar.ViewHolder holder) { | |||
// int _postion = 2; | |||
// switch (holder.tag) { | |||
// case "功能": | |||
// _postion = 0; | |||
// break; | |||
// case "订单": | |||
// _postion = 1; | |||
// break; | |||
// case "设置": | |||
// _postion = 3; | |||
// break; | |||
// case "我的": | |||
// _postion = 4; | |||
// break; | |||
// case "": | |||
// _postion = 2; | |||
// break; | |||
// } | |||
int _postion = 0; | |||
switch (holder.tag) { | |||
case "功能": | |||
_postion = 0; | |||
break; | |||
// case "订单": | |||
// _postion = 1; | |||
// break; | |||
case "设置": | |||
_postion =2; | |||
break; | |||
// case "我的": | |||
// _postion = 4; | |||
// break; | |||
case "": | |||
_postion = 1; | |||
TcpServer.getInstance().SendData(); | |||
if(ConfigName.getInstance().IsChangeGoods) { | |||
ConfigData.getInstance().DownDataToDevice(context,activity); | |||
} | |||
break; | |||
} | |||
viewPager.setCurrentItem(_postion); | |||
@@ -1,6 +1,8 @@ | |||
package com.bonait.bnframework.modules.home.fragment; | |||
import android.annotation.SuppressLint; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import android.os.Handler; | |||
@@ -104,10 +106,15 @@ public class DoubleFryingpanFragment extends BaseFragment { | |||
*/ | |||
private DialogView mWarehouselocSelectVisual; | |||
Context context; | |||
Activity activity; | |||
@Override | |||
protected View onCreateView() { | |||
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_double_fryingpan, null); | |||
ButterKnife.bind(this, root); | |||
context=getContext(); | |||
activity=getActivity(); | |||
return root; | |||
} | |||
@@ -228,8 +235,9 @@ public class DoubleFryingpanFragment extends BaseFragment { | |||
btn_syncGoods.setOnClickListener((View v)->{ | |||
DialogHelper.showWarn(getContext(),"是否将本地商品同步到所有炒锅,此操作将覆盖炒锅本地商品,请问是否继续?",AlertDialogButton.YesNo,(s)->{ | |||
if(s){ | |||
ConfigName.getInstance().IsChangeGoods=true; | |||
TcpServer.getInstance().SendData(); | |||
// ConfigName.getInstance().IsChangeGoods=true; | |||
// TcpServer.getInstance().SendData(); | |||
ConfigData.getInstance().DownDataToDevice(context,activity); | |||
} | |||
}); | |||
}); | |||
@@ -52,6 +52,10 @@ public class SystemParameterActivity extends BaseActivity { | |||
EditText edittext3; | |||
@BindView(R.id.edittext4) | |||
EditText edittext4; | |||
@BindView(R.id.hmi1_Ip) | |||
EditText hmi1_Ip; | |||
@BindView(R.id.hmi2_ip) | |||
EditText hmi2_ip; | |||
@BindView(R.id.environment) | |||
Spinner environment; | |||
@@ -106,6 +110,8 @@ public class SystemParameterActivity extends BaseActivity { | |||
editTextLists.add(F2edittext2); | |||
editTextLists.add(DeviceIp); | |||
editTextLists.add(DevicePort); | |||
editTextLists.add(hmi1_Ip); | |||
editTextLists.add(hmi2_ip); | |||
material_map.put("开发环境", 0); | |||
material_map.put("测试环境", 1); | |||
@@ -179,6 +185,14 @@ public class SystemParameterActivity extends BaseActivity { | |||
ConfigName.getInstance().DevicePort = Integer.parseInt(item.value); | |||
DevicePort.setText(item.value); | |||
break; | |||
case 11: | |||
ConfigName.getInstance().F1HMIAddress = item.value; | |||
hmi1_Ip.setText(item.value); | |||
break; | |||
case 12: | |||
ConfigName.getInstance().F2HMIAddress = item.value; | |||
hmi2_ip.setText(item.value); | |||
break; | |||
} | |||
} | |||
@@ -211,6 +225,9 @@ public class SystemParameterActivity extends BaseActivity { | |||
ConfigName.getInstance().ClientAutoKey = edittext3.getText().toString(); | |||
ConfigName.getInstance().DeviceAutoKey = edittext4.getText().toString(); | |||
ConfigName.getInstance().F1HMIAddress = hmi1_Ip.getText().toString(); | |||
ConfigName.getInstance().F2HMIAddress = hmi2_ip.getText().toString(); | |||
ConfigName.getInstance().Environment = environment.getSelectedItem().toString(); | |||
boolean isgb = false; | |||
@@ -202,6 +202,48 @@ | |||
</TableRow> | |||
<!-- Table5--> | |||
<TableRow | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="center" | |||
android:layout_margin="5dp"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="right" | |||
android:text="炒锅屏幕1地址:" /> | |||
<EditText | |||
android:id="@+id/hmi1_Ip" | |||
android:layout_width="120dp" | |||
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" /> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_marginLeft="@dimen/dp_10" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="right" | |||
android:text="炒锅屏幕2地址:" /> | |||
<EditText | |||
android:id="@+id/hmi2_ip" | |||
android:layout_width="120dp" | |||
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"/> | |||
</TableRow> | |||
<!-- Table6--> | |||
<TableRow | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||