初始化
This commit is contained in:
@@ -0,0 +1,137 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.service;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alct.mdp.MDPLocationCollectionManager;
|
||||
import com.alct.mdp.model.Image;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.msg.MsgUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/11/23 20:31
|
||||
* @description:
|
||||
*/
|
||||
public class MakeUpAlService extends Service {
|
||||
|
||||
//装货照片 卸货照片 回单照片
|
||||
|
||||
private Context con;
|
||||
private Gson gson=new Gson();
|
||||
private int cd=60*1;
|
||||
private Handler hd=new Handler(msg -> {
|
||||
switch (msg.what){
|
||||
case 15:
|
||||
up();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
con=getBaseContext();
|
||||
new Handler().postDelayed(() -> {
|
||||
MsgUtil.addHdMsgWat(hd,15);
|
||||
},cd);
|
||||
}
|
||||
|
||||
//开始
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e("服务开启","-----");
|
||||
return START_STICKY;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void up(){
|
||||
String id_1=SPUtil.getSP(con,"make","装货");
|
||||
String id_2=SPUtil.getSP(con,"make","卸货");
|
||||
String id_3=SPUtil.getSP(con,"make","回单");
|
||||
if(!"".equals(id_1)){
|
||||
String image_1=SPUtil.getSP(con,"make","装货-"+id_1);
|
||||
up_image_z(id_1,gson.fromJson(image_1,Image.class));
|
||||
}
|
||||
if(!"".equals(id_2)){
|
||||
String image_2=SPUtil.getSP(con,"make","卸货-"+id_2);
|
||||
up_image_z(id_2,gson.fromJson(image_2,Image.class));
|
||||
}
|
||||
if(!"".equals(id_3)){
|
||||
String image_3=SPUtil.getSP(con,"make","回单-"+id_3);
|
||||
up_image_z(id_3,gson.fromJson(image_3,Image.class));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void up_image_z(String id,Image image){
|
||||
MDPLocationCollectionManager.uploadPickupImage(con,id,image, new com.alct.mdp.callback.OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联","装货照片上传成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(装货照片):",s+s1);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void up_image(String id,Image image){
|
||||
MDPLocationCollectionManager.uploadUnloadImage(con,id, image, new com.alct.mdp.callback.OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联","卸货照片上传成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(卸货照片):",s+s1);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
public void receipt_image(String id,Image image){
|
||||
MDPLocationCollectionManager.uploadPODImage(con,id, image, new com.alct.mdp.callback.OnResultListener() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.e("上报安联","回单照片上传成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(String s, String s1) {
|
||||
Log.e("上报安联失败(回单照片):",s+s1);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user