Compare commits
No commits in common. '69e9e55aacec9b680bcd16999f62343a394c120b' and '18f7e176f2d0c34855bbdac8559c34610b25c570' have entirely different histories.
69e9e55aac
...
18f7e176f2
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 9.0 KiB |
@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"artifactType": {
|
|
||||||
"type": "APK",
|
|
||||||
"kind": "Directory"
|
|
||||||
},
|
|
||||||
"applicationId": "com.example.logistics",
|
|
||||||
"variantName": "release",
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "SINGLE",
|
|
||||||
"filters": [],
|
|
||||||
"attributes": [],
|
|
||||||
"versionCode": 1,
|
|
||||||
"versionName": "1.0",
|
|
||||||
"outputFile": "app-release.apk"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"elementType": "File"
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
|
|
||||||
<script type="text/javascript" type="text/javascript">
|
|
||||||
|
|
||||||
function callJS(){
|
|
||||||
var ros = new ROSLIB.Ros({
|
|
||||||
url : 'ws://192.168.43.20:9090'
|
|
||||||
});
|
|
||||||
|
|
||||||
ros.on('connection', function() {
|
|
||||||
console.log('Connected to websocket server.');
|
|
||||||
});
|
|
||||||
|
|
||||||
ros.on('error', function(error) {
|
|
||||||
console.log('Error connecting to websocket server: ', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
ros.on('close', function() {
|
|
||||||
console.log('Connection to websocket server closed.');
|
|
||||||
});
|
|
||||||
|
|
||||||
// 发布一个话题
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var move_base= new ROSLIB.ActionClient({
|
|
||||||
ros : ros,
|
|
||||||
serverName : '/move_base',
|
|
||||||
actionName : 'move_base_msgs/MoveBaseAction'
|
|
||||||
});
|
|
||||||
|
|
||||||
var currentTime = new Date();
|
|
||||||
var secs = Math.floor(currentTime.getTime()/1000)
|
|
||||||
var nsecs = Math.round(1000000000*(currentTime.getTime()/1000-secs))
|
|
||||||
|
|
||||||
var goal = new ROSLIB.Goal({
|
|
||||||
actionClient: move_base,
|
|
||||||
goalMessage:{
|
|
||||||
target_pose:{
|
|
||||||
header:{
|
|
||||||
frame_id:'map',
|
|
||||||
stamp:{
|
|
||||||
secs: secs,
|
|
||||||
nsecs:nsecs
|
|
||||||
}
|
|
||||||
},
|
|
||||||
pose:{
|
|
||||||
position:{
|
|
||||||
x:-3.97, //-0.743 -0.0273 取件点
|
|
||||||
y:1.68, //3.00 -0.09
|
|
||||||
z:0.000
|
|
||||||
},
|
|
||||||
orientation:{
|
|
||||||
x:0.000,
|
|
||||||
y:0.000,
|
|
||||||
z:0.000,
|
|
||||||
w:1.000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
goal.on('feedback', function(feedback) {
|
|
||||||
console.log('Feedback: ' + feedback.sequence);
|
|
||||||
});
|
|
||||||
|
|
||||||
goal.on('result', function(result) {
|
|
||||||
console.log('Final Result: ' + result.sequence);
|
|
||||||
});
|
|
||||||
|
|
||||||
ros.on('connection', function() {
|
|
||||||
console.log('Connected to websocket server.');
|
|
||||||
});
|
|
||||||
|
|
||||||
ros.on('error', function(error) {
|
|
||||||
console.log('Error connecting to websocket server: ', error);
|
|
||||||
});
|
|
||||||
|
|
||||||
ros.on('close', function() {
|
|
||||||
console.log('Connection to websocket server closed.');
|
|
||||||
});
|
|
||||||
|
|
||||||
//goal.send();
|
|
||||||
|
|
||||||
var cmdVel = new ROSLIB.Topic({
|
|
||||||
ros : ros,
|
|
||||||
name : '/cmd_vel',
|
|
||||||
messageType : 'geometry_msgs/Twist'
|
|
||||||
});
|
|
||||||
|
|
||||||
var twist = new ROSLIB.Message({
|
|
||||||
linear : {
|
|
||||||
x : 0.2,
|
|
||||||
y : 0.0,
|
|
||||||
z : 0.0
|
|
||||||
},
|
|
||||||
angular : {
|
|
||||||
x : 0.0,
|
|
||||||
y : 0.0,
|
|
||||||
z : 0.0
|
|
||||||
}
|
|
||||||
});
|
|
||||||
cmdVel.publish(twist);
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<h1>Simple roslib Example</h1>
|
|
||||||
<p>Check your Web Console for output.</p>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.example.logistics.dao;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.example.logistics.tools.DBOpenHelper;
|
||||||
|
import com.example.logistics.tools.MD5Utils;
|
||||||
|
import com.example.logistics.ui.MainActivity;
|
||||||
|
import com.example.logistics.ui.MenuActivity;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class goodDao {
|
||||||
|
|
||||||
|
private static final String TAG = "goodDao";
|
||||||
|
|
||||||
|
public int search(String id, String phonenum, Context context){
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
Connection connection = DBOpenHelper.getConn();
|
||||||
|
|
||||||
|
int msg = 0;
|
||||||
|
try{
|
||||||
|
String sql = "select * from goods where id = ?";
|
||||||
|
|
||||||
|
if(connection != null){
|
||||||
|
PreparedStatement ps = connection.prepareStatement(sql);
|
||||||
|
if(ps != null){
|
||||||
|
Log.e(TAG, "id: " + id);
|
||||||
|
ps.setInt(1,Integer.parseInt(id));
|
||||||
|
ResultSet rs = ps.executeQuery();
|
||||||
|
|
||||||
|
int count = rs.getMetaData().getColumnCount();
|
||||||
|
while(rs.next()){
|
||||||
|
for(int i = 1; i <= count; i++){
|
||||||
|
String field = rs.getMetaData().getColumnName(i);
|
||||||
|
map.put(field, rs.getString(field));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connection.close();
|
||||||
|
ps.close();
|
||||||
|
if(map.size() != 0){
|
||||||
|
StringBuilder s = new StringBuilder();
|
||||||
|
for(String key:map.keySet()){
|
||||||
|
if(key.equals("phonenum")){
|
||||||
|
String strphone = String.valueOf(map.get(key));
|
||||||
|
Log.d("abc", strphone);
|
||||||
|
if(phonenum.equals(strphone.substring(7,11))){
|
||||||
|
msg = 1; //phonenum correct
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
builder.setTitle("快件位置");
|
||||||
|
builder.setMessage("\n第 "+ map.get("shelfnum")+ " 号货架\n第 " + map.get("floornum")+ " 层");
|
||||||
|
Looper.prepare();
|
||||||
|
builder.show();
|
||||||
|
Looper.loop();
|
||||||
|
}else{
|
||||||
|
msg = 2; //phonenum incorrect
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Log.e(TAG, "result is null");
|
||||||
|
msg = 3; //result is null
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Log.e(TAG, "ps is null");
|
||||||
|
msg = 0;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
Log.e(TAG, "connection is null");
|
||||||
|
msg = 0;
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
Log.d(TAG, "search bug: " + e.getMessage());
|
||||||
|
msg = 0;
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.example.logistics.dao;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.example.logistics.entity.User;
|
||||||
|
import com.example.logistics.tools.DBOpenHelper;
|
||||||
|
import com.example.logistics.tools.MD5Utils;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class operationDao {
|
||||||
|
private static final String TAG = "operationDao";
|
||||||
|
|
||||||
|
public boolean add(String pickupcode, String phonenum){
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
Connection connection = DBOpenHelper.getConn();
|
||||||
|
try{
|
||||||
|
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
|
||||||
|
String time = format1.format(date);
|
||||||
|
|
||||||
|
String sql = "insert into operations(pickupcode, phonenum, time) values (?,?,?)";
|
||||||
|
|
||||||
|
if(connection != null){
|
||||||
|
PreparedStatement ps = connection.prepareStatement(sql);
|
||||||
|
|
||||||
|
if(ps != null){
|
||||||
|
ps.setString(1, pickupcode);
|
||||||
|
ps.setString(2, phonenum);
|
||||||
|
ps.setString(3, time);
|
||||||
|
|
||||||
|
int rs = ps.executeUpdate();
|
||||||
|
if(rs > 0){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
Log.e(TAG, "异常 add operation");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,223 +0,0 @@
|
|||||||
package com.example.logistics.manager;
|
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.example.logistics.tools.DBOpenHelper;
|
|
||||||
import com.example.logistics.tools.MD5Utils;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class goodManager {
|
|
||||||
|
|
||||||
private static final String TAG = "goodDao";
|
|
||||||
|
|
||||||
public int search(String id, String phonenum, Context context){
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
|
|
||||||
Connection connection = DBOpenHelper.getConn();
|
|
||||||
|
|
||||||
|
|
||||||
int msg = 0;
|
|
||||||
try{
|
|
||||||
String sql = "select * from goods where id = ?";
|
|
||||||
|
|
||||||
if(connection != null){
|
|
||||||
PreparedStatement ps = connection.prepareStatement(sql);
|
|
||||||
if(ps != null){
|
|
||||||
Log.e(TAG, "id: " + id);
|
|
||||||
ps.setInt(1,Integer.parseInt(id));
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
int count = rs.getMetaData().getColumnCount();
|
|
||||||
while(rs.next()){
|
|
||||||
for(int i = 1; i <= count; i++){
|
|
||||||
String field = rs.getMetaData().getColumnName(i);
|
|
||||||
map.put(field, rs.getString(field));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
connection.close();
|
|
||||||
ps.close();
|
|
||||||
if(map.size() != 0){
|
|
||||||
StringBuilder s = new StringBuilder();
|
|
||||||
for(String key:map.keySet()){
|
|
||||||
if(key.equals("phonenum")){
|
|
||||||
String strphone = String.valueOf(map.get(key));
|
|
||||||
Log.d("abc", strphone);
|
|
||||||
if(phonenum.equals(strphone.substring(7,11))){
|
|
||||||
msg = 1; //phonenum correct
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
|
||||||
builder.setTitle("快件位置");
|
|
||||||
builder.setMessage("\n第 "+ map.get("shelfnum")+ " 号货架\n第 " + map.get("floornum")+ " 层");
|
|
||||||
Looper.prepare();
|
|
||||||
builder.show();
|
|
||||||
Looper.loop();
|
|
||||||
}else{
|
|
||||||
msg = 2; //phonenum incorrect
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "result is null");
|
|
||||||
msg = 3; //result is null
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "ps is null");
|
|
||||||
msg = 0;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "connection is null");
|
|
||||||
msg = 0;
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
Log.d(TAG, "search bug: " + e.getMessage());
|
|
||||||
msg = 0;
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean delete(String pickupcode){
|
|
||||||
|
|
||||||
Connection connection = DBOpenHelper.getConn();
|
|
||||||
try{
|
|
||||||
String sql = "delete from goods where id = ?";
|
|
||||||
|
|
||||||
if(connection != null){
|
|
||||||
PreparedStatement ps = connection.prepareStatement(sql);
|
|
||||||
if(ps != null){
|
|
||||||
Log.e(TAG, "pickupcode: " + pickupcode);
|
|
||||||
ps.setString(1,pickupcode);
|
|
||||||
|
|
||||||
ps.executeUpdate();
|
|
||||||
|
|
||||||
connection.close();
|
|
||||||
ps.close();
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "ps is null");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "connection is null");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
Log.d(TAG, "delete bug" + e.getMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Map<String, Object>> nopick(String phonenum){
|
|
||||||
|
|
||||||
Connection connection = DBOpenHelper.getConn();
|
|
||||||
|
|
||||||
List<Map<String, Object>> datalist;
|
|
||||||
datalist = new ArrayList<Map<String, Object>>();
|
|
||||||
try{
|
|
||||||
String sql = "select * from goods where phonenum = ?";
|
|
||||||
|
|
||||||
if(connection != null){
|
|
||||||
PreparedStatement ps = connection.prepareStatement(sql);
|
|
||||||
if(ps != null){
|
|
||||||
Log.e(TAG, "phonenum: " + phonenum);
|
|
||||||
ps.setString(1,phonenum);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
int count = rs.getMetaData().getColumnCount();
|
|
||||||
while(rs.next()){
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
for(int i = 1; i <= count; i++){
|
|
||||||
String field = rs.getMetaData().getColumnName(i);
|
|
||||||
if(field.equals("id")){
|
|
||||||
map.put(field, rs.getString(field));
|
|
||||||
}
|
|
||||||
if(field.equals("time")) {
|
|
||||||
map.put(field, rs.getString(field));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datalist.add(map);
|
|
||||||
}
|
|
||||||
connection.close();
|
|
||||||
ps.close();
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "ps is null");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "connection is null");
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
Log.d(TAG, "search bug: " + e.getMessage());
|
|
||||||
}
|
|
||||||
return datalist;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int pickup(String pickupcode, String phonenum){
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
|
|
||||||
Connection connection = DBOpenHelper.getConn();
|
|
||||||
|
|
||||||
int msg = 0;
|
|
||||||
try{
|
|
||||||
String sql = "select * from goods where id=?";
|
|
||||||
|
|
||||||
if(connection != null){
|
|
||||||
PreparedStatement ps = connection.prepareStatement(sql);
|
|
||||||
if(ps != null){
|
|
||||||
Log.e(TAG, "pickupcode: " + pickupcode);
|
|
||||||
ps.setInt(1,Integer.parseInt(pickupcode));
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
int count = rs.getMetaData().getColumnCount();
|
|
||||||
while(rs.next()){
|
|
||||||
for(int i = 1; i <= count; i++){
|
|
||||||
String field = rs.getMetaData().getColumnName(i);
|
|
||||||
map.put(field, rs.getString(field));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
connection.close();
|
|
||||||
ps.close();
|
|
||||||
if(map.size() != 0){
|
|
||||||
StringBuilder s = new StringBuilder();
|
|
||||||
for(String key:map.keySet()){
|
|
||||||
if(key.equals("phonenum")){
|
|
||||||
if(phonenum.equals(map.get(key).toString().substring(7,11))){
|
|
||||||
msg = 1; //password correct
|
|
||||||
}else{
|
|
||||||
msg = 2; //password incorrect
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "result is null");
|
|
||||||
msg = 3; //result is null
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "ps is null");
|
|
||||||
msg = 0;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "connection is null");
|
|
||||||
msg = 0;
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
Log.d(TAG, "login bug: " + e.getMessage());
|
|
||||||
msg = 0;
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
package com.example.logistics.manager;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.example.logistics.tools.DBOpenHelper;
|
|
||||||
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class operationManager {
|
|
||||||
private static final String TAG = "operationDao";
|
|
||||||
|
|
||||||
public boolean add(String pickupcode, String phonenum){
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
|
|
||||||
Connection connection = DBOpenHelper.getConn();
|
|
||||||
try{
|
|
||||||
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
|
||||||
|
|
||||||
Date date = new Date();
|
|
||||||
|
|
||||||
String time = format1.format(date);
|
|
||||||
|
|
||||||
String sql = "insert into operations(pickupcode, phonenum, time) values (?,?,?)";
|
|
||||||
|
|
||||||
if(connection != null){
|
|
||||||
PreparedStatement ps = connection.prepareStatement(sql);
|
|
||||||
|
|
||||||
if(ps != null){
|
|
||||||
ps.setString(1, pickupcode);
|
|
||||||
ps.setString(2, phonenum);
|
|
||||||
ps.setString(3, time);
|
|
||||||
|
|
||||||
int rs = ps.executeUpdate();
|
|
||||||
if(rs > 0){
|
|
||||||
return true;
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}catch(Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
Log.e(TAG, "异常 add operation");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Map<String, Object>> history(String phonenum){
|
|
||||||
|
|
||||||
Connection connection = DBOpenHelper.getConn();
|
|
||||||
|
|
||||||
List<Map<String, Object>> datalist;
|
|
||||||
datalist = new ArrayList<Map<String, Object>>();
|
|
||||||
try{
|
|
||||||
String sql = "select * from operations where phonenum = ?";
|
|
||||||
|
|
||||||
if(connection != null){
|
|
||||||
PreparedStatement ps = connection.prepareStatement(sql);
|
|
||||||
if(ps != null){
|
|
||||||
Log.e(TAG, "phonenum: " + phonenum);
|
|
||||||
ps.setString(1,phonenum);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
|
|
||||||
int count = rs.getMetaData().getColumnCount();
|
|
||||||
while(rs.next()){
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
for(int i = 1; i <= count; i++){
|
|
||||||
String field = rs.getMetaData().getColumnName(i);
|
|
||||||
if(field.equals("pickupcode")){
|
|
||||||
map.put(field, rs.getString(field));
|
|
||||||
}
|
|
||||||
if(field.equals("time")) {
|
|
||||||
map.put(field, rs.getString(field));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datalist.add(map);
|
|
||||||
}
|
|
||||||
connection.close();
|
|
||||||
ps.close();
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "ps is null");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Log.e(TAG, "connection is null");
|
|
||||||
}
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
Log.d(TAG, "search bug: " + e.getMessage());
|
|
||||||
}
|
|
||||||
return datalist;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package com.example.logistics.tools;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import org.java_websocket.client.WebSocketClient;
|
|
||||||
import org.java_websocket.drafts.Draft_6455;
|
|
||||||
import org.java_websocket.handshake.ServerHandshake;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
public class JWebSocketClient extends WebSocketClient {
|
|
||||||
public JWebSocketClient(URI serverUri) {
|
|
||||||
super(serverUri, new Draft_6455());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onOpen(ServerHandshake handshakedata) {
|
|
||||||
Log.e("JWebSocketClient", "onOpen()");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(String message) {
|
|
||||||
Log.e("JWebSocketClient", "onMessage()");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClose(int code, String reason, boolean remote) {
|
|
||||||
Log.e("JWebSocketClient", "onClose()");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(Exception ex) {
|
|
||||||
Log.e("JWebSocketClient", "onError()");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.example.logistics.tools;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
|
|
||||||
import com.jilk.ros.rosbridge.ROSBridgeClient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ Create by dadac on 2018/10/8.
|
|
||||||
* @Function:
|
|
||||||
* @Return:
|
|
||||||
*/
|
|
||||||
public class RCApplication extends Application {
|
|
||||||
|
|
||||||
|
|
||||||
ROSBridgeClient client;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTerminate() {
|
|
||||||
if (client != null)
|
|
||||||
client.disconnect();
|
|
||||||
super.onTerminate();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public ROSBridgeClient getRosClient() {
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRosClient(ROSBridgeClient client) {
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|