|
@@ -9,43 +9,51 @@ import android.content.Intent;
|
|
|
import android.content.IntentFilter;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
+import android.os.Looper;
|
|
|
import android.os.Message;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.text.Editable;
|
|
|
import android.text.TextWatcher;
|
|
|
import android.view.KeyEvent;
|
|
|
import android.view.View;
|
|
|
+import android.view.ViewGroup;
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageButton;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.ProgressBar;
|
|
|
+import android.widget.Switch;
|
|
|
import android.widget.TextView;
|
|
|
-import android.widget.Toast;
|
|
|
|
|
|
+import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
|
+import com.chad.library.adapter.base.BaseViewHolder;
|
|
|
import com.elvishew.xlog.XLog;
|
|
|
import com.fxy.R;
|
|
|
import com.fxy.baselibrary.base.BaseActivity;
|
|
|
import com.fxy.baselibrary.bean.BaseEventBusBean;
|
|
|
import com.fxy.baselibrary.interfaces.OnRxScanerListener;
|
|
|
-import com.fxy.baselibrary.qrcode.ActivityScanerCode;
|
|
|
import com.fxy.baselibrary.util.JsonUtil;
|
|
|
+import com.fxy.baselibrary.views.MarqueeTextView;
|
|
|
import com.fxy.bean.ActionBean;
|
|
|
import com.fxy.bean.ScanBean;
|
|
|
-import com.fxy.common.AsyncUpload;
|
|
|
-import com.fxy.common.PictureSelectorUpload;
|
|
|
+import com.fxy.common.AsyncFileUpload;
|
|
|
+import com.fxy.common.AsyncPictureSelector;
|
|
|
+import com.fxy.common.AsyncPictureUpload;
|
|
|
import com.fxy.common.UploadProgressEvent;
|
|
|
import com.fxy.constant.BaseConfig;
|
|
|
import com.fxy.constant.EventCode;
|
|
|
-import com.fxy.detection.bean.NeedPhotoBean;
|
|
|
+import com.fxy.constant.SPCache;
|
|
|
+import com.fxy.detection.bean.StorageRecordBean;
|
|
|
import com.fxy.detection.bean.TakePictureBean;
|
|
|
+import com.fxy.detection.bean.TrackingBoxBean;
|
|
|
import com.fxy.net.MyDialogCallback;
|
|
|
import com.fxy.net.Urls;
|
|
|
-import com.fxy.view.FloatingImageView;
|
|
|
+import com.fxy.putIn.TrayMainActivity;
|
|
|
+import com.fxy.utils.UploadUtils;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.google.zxing.Result;
|
|
|
import com.luck.picture.lib.config.PictureConfig;
|
|
|
-import com.luck.picture.lib.entity.LocalMedia;
|
|
|
import com.lzy.okgo.OkGo;
|
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
@@ -67,94 +75,101 @@ import sto.android.app.StoJNI;
|
|
|
import sto.android.app.StoPdaKeyEvent;
|
|
|
import sto.android.app.StoTongJNI;
|
|
|
|
|
|
-public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.ScanCallBack{
|
|
|
+public class BoxPutInDetailsMainActivity extends BaseActivity implements StoJNI.ScanCallBack{
|
|
|
|
|
|
/**
|
|
|
* 列表适配器
|
|
|
*/
|
|
|
Context mContext = this;
|
|
|
-
|
|
|
- @BindView(R.id.et_order_number)
|
|
|
- EditText etOrderNumber;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @BindView(R.id.et_tracking_number)
|
|
|
- EditText etTrackingNumber;
|
|
|
-
|
|
|
+
|
|
|
@BindView(R.id.et_unit_code)
|
|
|
EditText etUnitCode;
|
|
|
|
|
|
//拍照区域
|
|
|
@BindView(R.id.ll_camera_picture_module)
|
|
|
LinearLayout llCameraPictureModule;
|
|
|
-
|
|
|
-
|
|
|
- @BindView(R.id.ll_label_picture)
|
|
|
- LinearLayout llLabelPicture;
|
|
|
-
|
|
|
-
|
|
|
- @BindView(R.id.ll_weigh_picture)
|
|
|
- LinearLayout llWeighPicture;
|
|
|
-
|
|
|
- @BindView(R.id.ll_result)
|
|
|
- LinearLayout llResult;
|
|
|
-
|
|
|
- @BindView(R.id.tv_result)
|
|
|
- TextView tvResult;
|
|
|
-
|
|
|
+
|
|
|
@BindView(R.id.ll_await_num)
|
|
|
LinearLayout llAwaitNum;
|
|
|
|
|
|
@BindView(R.id.tv_await_num)
|
|
|
TextView tvAwaitNum;
|
|
|
+
|
|
|
+ @BindView(R.id.btn_confirm)
|
|
|
+ TextView btnConfirm;
|
|
|
+
|
|
|
|
|
|
+ @BindView(R.id.ll_btn_confirm)
|
|
|
+ LinearLayout llConfirm;
|
|
|
|
|
|
- @BindView(R.id.pb_progressbar)
|
|
|
- ProgressBar pbProgressbar;
|
|
|
+ @BindView(R.id.btn_clear)
|
|
|
+ TextView btnClear;
|
|
|
|
|
|
- @BindView(R.id.percentage_text_view)
|
|
|
- TextView tvPercentageTextView;
|
|
|
+ @BindView(R.id.ll_btn_clear)
|
|
|
+ LinearLayout llClear;
|
|
|
+
|
|
|
+ @BindView(R.id.ll_unit_code)
|
|
|
+ LinearLayout llUnitCode;
|
|
|
|
|
|
+ @BindView(R.id.recyclerview)
|
|
|
+ RecyclerView recyclerView;
|
|
|
|
|
|
- @BindView(R.id.btn_start_upload)
|
|
|
- TextView btnStartUpload;
|
|
|
+ @BindView(R.id.mt_tracking_number)
|
|
|
+ MarqueeTextView mtTrackingNumber;
|
|
|
|
|
|
- @BindView(R.id.ll_upload_progressbar)
|
|
|
- LinearLayout llUploadProgressbar;
|
|
|
+ @BindView(R.id.mt_box_number)
|
|
|
+ MarqueeTextView mtBoxNumber;
|
|
|
|
|
|
+ @BindView(R.id.tv_qty)
|
|
|
+ TextView tvQty;
|
|
|
+
|
|
|
+
|
|
|
+ private String customerCode = "";
|
|
|
|
|
|
private HashMap<String, Object> postData = new HashMap<>();
|
|
|
|
|
|
- private HashMap<String,AsyncUpload> mapPictureSelector = new HashMap<>();
|
|
|
+ private HashMap<String,AsyncPictureSelector> mapPictureSelector = new HashMap<>();
|
|
|
|
|
|
private List<TakePictureBean> takePictureBeanList = new ArrayList<>();
|
|
|
|
|
|
+ private TrackingBoxBean trackingBoxBean;
|
|
|
|
|
|
private String currentPictureType= "";
|
|
|
|
|
|
private boolean currentUploadStatus = false;
|
|
|
+
|
|
|
+
|
|
|
+ private boolean isRequiredShow = false;
|
|
|
+
|
|
|
//
|
|
|
//扫码扫码动作
|
|
|
private ScanBean scanBean;
|
|
|
|
|
|
+
|
|
|
+ private Unbinder unbinder;
|
|
|
|
|
|
- private boolean showWeightImg = false;
|
|
|
+ private JSONObject postParam = new JSONObject();
|
|
|
|
|
|
- private boolean isRequiredShow = false;
|
|
|
+ private int leisure = 10;
|
|
|
|
|
|
- private ArrayList<String> baseImgList = new ArrayList<>();
|
|
|
- protected String action;
|
|
|
|
|
|
|
|
|
- private Unbinder unbinder;
|
|
|
|
|
|
- private JSONObject postParam = new JSONObject();
|
|
|
+
|
|
|
+ private View notDataView; //没有数据显示页
|
|
|
+ private View errorView; //错误显示页
|
|
|
+ private View emptyView; //空显示页
|
|
|
+ /**
|
|
|
+ * 列表适配器
|
|
|
+ */
|
|
|
+ private FinishWorkAdapter mAdapter;
|
|
|
+
|
|
|
+ private List<StorageRecordBean> tallyDataList = new ArrayList<>() ;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
public int getContentViewResId() {
|
|
|
- return R.layout.activity_fxy_detection_putin;
|
|
|
+ return R.layout.activity_fxy_detection_box_putin_details;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -170,6 +185,8 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
@Override
|
|
|
protected void getBundleExtras(Bundle bundle) {
|
|
|
//XLog.e("接收数据解析:",bundle);
|
|
|
+ trackingBoxBean = JsonUtil.jsonString2Bean(bundle.getString("data"),TrackingBoxBean.class);
|
|
|
+ customerCode = bundle.getString("customer_code","");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -191,7 +208,18 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
mapPictureSelector.get(currentPictureType).getSelectImg(data);
|
|
|
}
|
|
|
totalAwaitNum();
|
|
|
- checkSubmit();
|
|
|
+ for (int i=0;i<takePictureBeanList.size();i++){
|
|
|
+ int num = takePictureBeanList.get(i).getNumber();
|
|
|
+ String field = takePictureBeanList.get(i).getField();
|
|
|
+ int has = mapPictureSelector.get(field).getOssPhotoList().size();
|
|
|
+ if (has < num ){
|
|
|
+ mapPictureSelector.get(field).authCamera();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ finishInbound();
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -199,14 +227,20 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
/**
|
|
|
* EventBus接收信息的方法,开启后才会调用(非粘性事件)
|
|
|
*
|
|
|
- * @param event
|
|
|
+ * @param event BaseEventBusBean
|
|
|
*/
|
|
|
@Override
|
|
|
protected void EventBean(BaseEventBusBean event) {
|
|
|
// XLog.e("----------接收返回--------------");
|
|
|
// XLog.e("接收返回:"+event.getEventCode());
|
|
|
- if (event != null && event.getEventCode() == EventCode.displacement_refresh){
|
|
|
-
|
|
|
+ assert event != null;
|
|
|
+ switch (event.getEventCode()){
|
|
|
+ case EventCode.picture_selector_lister:
|
|
|
+ currentPictureType = event.getData().toString();
|
|
|
+ break;
|
|
|
+ case EventCode.file_upload_lister:
|
|
|
+ totalAwaitNum();
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -219,51 +253,37 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
@Override
|
|
|
protected void initView() {
|
|
|
unbinder = ButterKnife.bind(this);
|
|
|
- setTitleName("单箱入库");
|
|
|
+ setTitleName("内件码操作");
|
|
|
|
|
|
+ initAdapter();
|
|
|
+
|
|
|
+ setRequestResult();
|
|
|
+ setCameraPicture();
|
|
|
initEdit();
|
|
|
- iniData();
|
|
|
- RecyclerView rvLabelShowImg = (RecyclerView)llLabelPicture.findViewById(R.id.rv_show_img);
|
|
|
- RecyclerView rvWeighShowImg = (RecyclerView)llWeighPicture.findViewById(R.id.rv_show_img);
|
|
|
- mapPictureSelector.put("label_img",setItemPicture("label_img",rvLabelShowImg,9));
|
|
|
- mapPictureSelector.put("weight_img",setItemPicture("weight_img",rvWeighShowImg,9));
|
|
|
|
|
|
- iniPhoto();
|
|
|
totalAwaitNum();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 设置多个上传文件
|
|
|
* @param uploadType String
|
|
|
* @param showImg RecyclerView
|
|
|
*/
|
|
|
- private AsyncUpload setItemPicture(String uploadType,RecyclerView showImg,int num){
|
|
|
+ private AsyncPictureSelector setItemPicture(String uploadType,RecyclerView showImg,int num){
|
|
|
|
|
|
String notifyUrl = Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN;
|
|
|
- AsyncUpload pictureUpload = new AsyncUpload(DetectionPutInMainActivity.this,showImg,"detection",uploadType,notifyUrl,false);
|
|
|
+ AsyncPictureSelector pictureUpload = new AsyncPictureSelector(BoxPutInDetailsMainActivity.this,showImg,"detection",uploadType,notifyUrl,false);
|
|
|
pictureUpload.setUploadType(uploadType);
|
|
|
pictureUpload.setCompress(true,100,100);
|
|
|
pictureUpload.setOnlyCamera(true);
|
|
|
pictureUpload.setMaxSelectNum(num);
|
|
|
-
|
|
|
- //showImg.onTouchEvent()
|
|
|
-
|
|
|
- pictureUpload.setOnChangeListener(new AsyncUpload.UploadChangeListener() {
|
|
|
- @Override
|
|
|
- public void uploadResult(boolean State,String actionType) {
|
|
|
- if (State) {
|
|
|
- totalAwaitNum();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void uploadFileKey(String fileKey) {
|
|
|
- System.out.println("fileKey:"+fileKey);
|
|
|
- currentPictureType = fileKey;
|
|
|
- }
|
|
|
- });
|
|
|
return pictureUpload;
|
|
|
}
|
|
|
|
|
@@ -271,17 +291,18 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
private void setCameraPicture(){
|
|
|
llCameraPictureModule.removeAllViews();;
|
|
|
for (int i=0;i<takePictureBeanList.size();i++){
|
|
|
- addPictureSelectorUpload(llCameraPictureModule,takePictureBeanList.get(i));
|
|
|
+ TakePictureBean takePictureBean = takePictureBeanList.get(i);
|
|
|
+ addPictureSelectorUpload(llCameraPictureModule,takePictureBean);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void addPictureSelectorUpload(LinearLayout linearLayout, TakePictureBean takePictureBean){
|
|
|
View itemPictureSelector = View.inflate(mContext, R.layout.item_picture_selector, null);
|
|
|
TextView tvPicturesTitle = itemPictureSelector.findViewById(R.id.tv_pictures_title);
|
|
|
- tvPicturesTitle.setText(takePictureBean.getField());
|
|
|
+ tvPicturesTitle.setText(takePictureBean.getTitle());
|
|
|
RecyclerView rvLabelShowImg = (RecyclerView)itemPictureSelector.findViewById(R.id.recyclerview);
|
|
|
linearLayout.addView(itemPictureSelector);
|
|
|
- AsyncUpload tmpPictureSelector = setItemPicture(takePictureBean.getField(),rvLabelShowImg,takePictureBean.getNumber());
|
|
|
+ AsyncPictureSelector tmpPictureSelector = setItemPicture(takePictureBean.getField(),rvLabelShowImg,takePictureBean.getNumber());
|
|
|
mapPictureSelector.put(takePictureBean.getField(),tmpPictureSelector);
|
|
|
}
|
|
|
|
|
@@ -296,14 +317,41 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
}
|
|
|
|
|
|
public HashMap<String, Object> getNotifyParam(){
|
|
|
- postData.put("box_number",etOrderNumber.getText().toString().trim());
|
|
|
- postData.put("tracking_number",etTrackingNumber.getText().toString().trim());
|
|
|
+ postData.put("tracking_number",trackingBoxBean.getTrackingNumber().trim());
|
|
|
+ postData.put("box_number",trackingBoxBean.getBoxNumber().trim());
|
|
|
postData.put("unit_code",etUnitCode.getText().toString().trim());
|
|
|
- mapPictureSelector.get(currentPictureType).setNotifyParam(postData);
|
|
|
- mapPictureSelector.get(currentPictureType).setNotifyParam(postData);
|
|
|
return postData;
|
|
|
}
|
|
|
|
|
|
+ private static class FinishWorkAdapter extends BaseQuickAdapter<StorageRecordBean, BaseViewHolder> {
|
|
|
+ public FinishWorkAdapter(List<StorageRecordBean> data){
|
|
|
+ super(R.layout.item_card_intercept, data);
|
|
|
+ }
|
|
|
+ @Override
|
|
|
+ protected void convert(BaseViewHolder helper, StorageRecordBean item) {
|
|
|
+ helper.addOnClickListener(R.id.tv_status);//定义setOnItemChildClickListener 事件点击
|
|
|
+ try {
|
|
|
+ helper.setText(R.id.tv_order_no,item.getUnitCode());
|
|
|
+ helper.getView(R.id.tv_location).setVisibility(View.GONE);
|
|
|
+ helper.getView(R.id.tv_status).setVisibility(View.GONE);
|
|
|
+ } catch (Exception e) {
|
|
|
+ XLog.e("列表赋值错误",e);
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void initAdapter(){
|
|
|
+ emptyView = this.getLayoutInflater().inflate(R.layout.pager_empty, (ViewGroup) recyclerView.getParent(), false);
|
|
|
+ errorView = this.getLayoutInflater().inflate(R.layout.pager_error, (ViewGroup) recyclerView.getParent(), false);
|
|
|
+ notDataView = emptyView;
|
|
|
+
|
|
|
+ mAdapter = new FinishWorkAdapter(tallyDataList);
|
|
|
+ mAdapter.setEmptyView(emptyView);
|
|
|
+ mAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
|
|
|
+ recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
|
|
+ recyclerView.setAdapter(mAdapter);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
//监听按键
|
|
@@ -413,67 +461,28 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
|
|
|
private void initEdit() {
|
|
|
List<EditText> list = new ArrayList<>();
|
|
|
- list.add(etTrackingNumber);
|
|
|
- list.add(etOrderNumber);
|
|
|
list.add(etUnitCode);
|
|
|
unifyEdit(list);
|
|
|
- llResult.setVisibility(View.GONE);
|
|
|
- llWeighPicture.setVisibility(View.GONE);
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void iniData(){
|
|
|
- baseImgList.add("label_img");
|
|
|
- baseImgList.add("weight_img");
|
|
|
- }
|
|
|
|
|
|
//getAwaitNum
|
|
|
private void totalAwaitNum(){
|
|
|
- int awaitNum = mapPictureSelector.get("label_img").getAwaitNum();
|
|
|
+ int awaitNum = UploadUtils.getAwaitNum(mRealm,getClass().getSimpleName());
|
|
|
tvAwaitNum.setText(String.valueOf(awaitNum));
|
|
|
- if (awaitNum == 0){
|
|
|
- operateStopUpload();
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//统一按钮回调
|
|
|
@SuppressLint("NonConstantResourceId")
|
|
|
public void callbackEditor(View v){
|
|
|
- XLog.e("获取:"+v.getId());
|
|
|
- XLog.e("id:"+R.id.et_tracking_number);
|
|
|
switch (v.getId()) {
|
|
|
- case R.id.et_tracking_number:
|
|
|
- getInboundTrack();
|
|
|
- break;
|
|
|
- case R.id.et_order_number:
|
|
|
- if (etTrackingNumber.getText().toString().isEmpty()){
|
|
|
- etTrackingNumber.requestFocus();
|
|
|
- return;
|
|
|
- }
|
|
|
- if (etOrderNumber.getText().toString().isEmpty()){
|
|
|
- etOrderNumber.requestFocus();
|
|
|
- return;
|
|
|
- }
|
|
|
- etUnitCode.requestFocus();
|
|
|
- etUnitCode.setSelection(etUnitCode.getText().toString().length());
|
|
|
- break;
|
|
|
+
|
|
|
case R.id.et_unit_code:
|
|
|
- for (int i=0;i<baseImgList.size();i++){
|
|
|
- String tmpKey = baseImgList.get(0);
|
|
|
- if (mapPictureSelector.containsKey(tmpKey) && mapPictureSelector.get(tmpKey).getOssPhotoList().size()==0){
|
|
|
- mapPictureSelector.get(tmpKey).authCamera();
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- for (int i=0;i<takePictureBeanList.size();i++){
|
|
|
- String tmpKey = takePictureBeanList.get(0).getField();
|
|
|
- if (mapPictureSelector.containsKey(tmpKey) && mapPictureSelector.get(tmpKey).getOssPhotoList().size()==0){
|
|
|
- mapPictureSelector.get(tmpKey).authCamera();
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- pictureInbound();
|
|
|
+ checkUnitCode();
|
|
|
+
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -590,164 +599,149 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void getInboundTrack(){
|
|
|
- int awaitNum = mapPictureSelector.get("label_img").getAwaitNum();
|
|
|
- if (currentUploadStatus && awaitNum>0){
|
|
|
- new AlertDialog.Builder(mContext).setTitle(R.string.dl_hint)
|
|
|
- .setMessage("当前正在上传图片。是否需要停止上传继续操作")
|
|
|
- .setNegativeButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
- if (!currentUploadStatus){
|
|
|
- operateStartUpload();
|
|
|
- }
|
|
|
- dialogInterface.dismiss();
|
|
|
- }
|
|
|
- }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
|
|
|
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ //检查是否存在上传
|
|
|
+ private void checkIsUpload(){
|
|
|
+ int awaitNum = UploadUtils.getAwaitNum(mRealm,getClass().getSimpleName());
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- }).show();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //设置返回
|
|
|
+ private void setRequestResult(){
|
|
|
+ takePictureBeanList = trackingBoxBean.getNeedPhoto();
|
|
|
+ tallyDataList.clear();
|
|
|
+ if (!trackingBoxBean.getZuijinNums().isEmpty()){
|
|
|
+ tallyDataList = trackingBoxBean.getZuijinNums();
|
|
|
}
|
|
|
|
|
|
- if (etTrackingNumber.getText().toString().isEmpty()){
|
|
|
- showErrorToast(etTrackingNumber.getHint().toString());
|
|
|
- return;
|
|
|
+ llCameraPictureModule.setVisibility(View.VISIBLE);
|
|
|
+
|
|
|
+ mtBoxNumber.setText(trackingBoxBean.getBoxNumber());
|
|
|
+ mtTrackingNumber.setText(trackingBoxBean.getTrackingNumber());
|
|
|
+ tvQty.setText(String.valueOf(trackingBoxBean.getYipaizhaoQty()));
|
|
|
+
|
|
|
+ btnConfirm.setText("入库完成".concat(" - ").concat(trackingBoxBean.getShowText()));
|
|
|
+ if (trackingBoxBean.getYipaizhaoQty()>0){
|
|
|
+ llConfirm.setVisibility(View.VISIBLE);
|
|
|
+ }else{
|
|
|
+ llConfirm.setVisibility(View.GONE);
|
|
|
}
|
|
|
|
|
|
+ if (trackingBoxBean.getNoClear().equals("Y")){
|
|
|
+ llClear.setVisibility(View.VISIBLE);
|
|
|
+ }else{
|
|
|
+ llClear.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
|
|
|
- Map<String,Object> math = new HashMap<>();
|
|
|
- math.put("tracking_number",etTrackingNumber.getText().toString().trim());
|
|
|
+ mAdapter.setNewData(tallyDataList);
|
|
|
+ mAdapter.notifyDataSetChanged();
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- String mathJson = (new Gson()).toJson(math);
|
|
|
|
|
|
- if (!checkRepeat(Urls.FXY_DETECTION_PUTIN_TRACK+(mathJson.toString()))){
|
|
|
- Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
|
|
|
+ private void checkUnitCode(){
|
|
|
+ checkIsUpload();
|
|
|
+ if (etUnitCode.getText().toString().isEmpty()){
|
|
|
+ showErrorToast(etUnitCode.getHint().toString());
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN_TRACK).upJson(mathJson)
|
|
|
- .execute(new MyDialogCallback(this, true, true) {
|
|
|
+ Gson gson = new Gson();
|
|
|
+ Map<String,Object> math = new HashMap<>();
|
|
|
+ math.put("tracking_number",trackingBoxBean.getTrackingNumber().trim());
|
|
|
+ math.put("box_number",trackingBoxBean.getBoxNumber().trim());
|
|
|
+ math.put("unit_code",etUnitCode.getText().toString().trim());
|
|
|
+ if (!customerCode.isEmpty()){
|
|
|
+ math.put("customer_code",customerCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN_UNIT).upJson(gson.toJson(math))
|
|
|
+ .execute(new MyDialogCallback(this, true, false) {
|
|
|
@Override
|
|
|
public void onSuccess(Response<String> response) {
|
|
|
super.onSuccess(response);
|
|
|
try {
|
|
|
+
|
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
|
- JSONObject result = new JSONObject();
|
|
|
+ TrackingBoxBean resTrackingBoxBean = new TrackingBoxBean();
|
|
|
if (bean.data!=null && !bean.data.isEmpty() && !bean.data.equals("[]")){
|
|
|
- result = new JSONObject(bean.data);
|
|
|
+ resTrackingBoxBean = JsonUtil.jsonString2Bean(bean.data,TrackingBoxBean.class);
|
|
|
}
|
|
|
+ String voiceName = resTrackingBoxBean.getVoiceName();
|
|
|
+
|
|
|
+ if (resTrackingBoxBean.getNeedConfirm().equals("Y")){
|
|
|
+ new AlertDialog.Builder(mContext).setTitle(R.string.dl_hint)
|
|
|
+ .setMessage(resTrackingBoxBean.getConfirmMsg())
|
|
|
+ .setNegativeButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ dialogInterface.dismiss();
|
|
|
+ etUnitCode.setText("");
|
|
|
+ }
|
|
|
+ }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
+ checkTakePicture();
|
|
|
+ }
|
|
|
+ }).show();
|
|
|
+ }else{
|
|
|
+ if(bean.code == 1){
|
|
|
+ showSuccessToast(bean.msg,voiceName);
|
|
|
+ checkTakePicture();
|
|
|
+ }else{
|
|
|
+ showWarningToast(bean.msg,voiceName);
|
|
|
+ }
|
|
|
|
|
|
- String voiceName = result.has("voice_name") ? result.getString("voice_name"):"";
|
|
|
- String showText = result.has("show_text") ? result.getString("show_text"):"";
|
|
|
- String show_weight_img = result.has("show_weight_img") ? result.getString("show_weight_img"):"";
|
|
|
-
|
|
|
-
|
|
|
- if (result.has("need_photo")){
|
|
|
- takePictureBeanList = JsonUtil.jsonString2Beans(result.getString("need_photo"),TakePictureBean.class);
|
|
|
}
|
|
|
|
|
|
- showWeightImg = show_weight_img.contains("1");
|
|
|
- llWeighPicture.setVisibility(showWeightImg ? View.VISIBLE:View.GONE);
|
|
|
- llResult.setVisibility(showText.isEmpty() ? View.GONE:View.VISIBLE);
|
|
|
- tvResult.setText(showText);
|
|
|
-
|
|
|
- setCameraPicture();
|
|
|
-
|
|
|
- if(bean.code == 1){
|
|
|
- showSuccessToast(bean.msg,voiceName);
|
|
|
-
|
|
|
- }else{
|
|
|
- showWarningToast(bean.msg,voiceName);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
+ }catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- XLog.e("添加开箱拆柜数据结果返回错误",e.getMessage());
|
|
|
+ XLog.e("第二步确认错误",e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- etOrderNumber.requestFocus();
|
|
|
- etOrderNumber.setSelection(etOrderNumber.getText().toString().length());
|
|
|
}
|
|
|
|
|
|
- private void checkSubmit(){
|
|
|
- if (mapPictureSelector.get("label_img").getOssPhotoList().size()==0){
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (showWeightImg && mapPictureSelector.get("weight_img").getOssPhotoList().size()==0){
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (takePictureBeanList.size()>0){
|
|
|
- for (int i=0;i<takePictureBeanList.size();i++){
|
|
|
- if (mapPictureSelector.get(takePictureBeanList.get(i).getField()).getOssPhotoList().size()==0){
|
|
|
- return;
|
|
|
- }
|
|
|
+ private void checkTakePicture(){
|
|
|
+ for (int i=0;i<takePictureBeanList.size();i++){
|
|
|
+ String tmpKey = takePictureBeanList.get(0).getField();
|
|
|
+ if (mapPictureSelector.containsKey(tmpKey) && mapPictureSelector.get(tmpKey).getOssPhotoList().size()==0){
|
|
|
+ mapPictureSelector.get(tmpKey).authCamera();
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
- pictureInbound();
|
|
|
- initUnitCode();
|
|
|
+ finishInbound();
|
|
|
}
|
|
|
|
|
|
- private void pictureInbound(){
|
|
|
+
|
|
|
+ //提交内件码
|
|
|
+ private void finishInbound(){
|
|
|
isRequiredShow = true;
|
|
|
if (!validate()){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-// if (!checkRepeat(Urls.FXY_DETECTION_PUTIN+(postParam.toString()))){
|
|
|
-// Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
|
|
|
-// return;
|
|
|
-// }
|
|
|
-
|
|
|
OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN).upJson(postParam)
|
|
|
- .execute(new MyDialogCallback(this, true, false) {
|
|
|
- @Override
|
|
|
- public void onSuccess(Response<String> response) {
|
|
|
- super.onSuccess(response);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- //假成功
|
|
|
-
|
|
|
- showSuccessToast("success");
|
|
|
- }
|
|
|
-
|
|
|
- //完成入库
|
|
|
- private void finishInbound(){
|
|
|
- isRequiredShow = true;
|
|
|
- if (etTrackingNumber.getText().toString().isEmpty()){
|
|
|
- showWarningToast(etTrackingNumber.getHint().toString());
|
|
|
- return ;
|
|
|
- }
|
|
|
-
|
|
|
- if (etOrderNumber.getText().toString().isEmpty()){
|
|
|
- showWarningToast(etOrderNumber.getHint().toString());
|
|
|
- return ;
|
|
|
- }
|
|
|
- HashMap<String,Object> postData = new HashMap<>();
|
|
|
- postData.put("box_number",etOrderNumber.getText().toString().trim());
|
|
|
- postData.put("tracking_number",etTrackingNumber.getText().toString().trim());
|
|
|
-
|
|
|
- String body = (new Gson()).toJson(postData);
|
|
|
-
|
|
|
- OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN).upJson(body)
|
|
|
.execute(new MyDialogCallback(this, true, false) {
|
|
|
@Override
|
|
|
public void onSuccess(Response<String> response) {
|
|
|
super.onSuccess(response);
|
|
|
try {
|
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
|
-// if(bean.code == 1){
|
|
|
-// showSuccessToast(bean.msg);
|
|
|
-// }else{
|
|
|
-// showWarningToast(bean.msg);
|
|
|
-// }
|
|
|
+ if(bean.code == 1){
|
|
|
+ showSuccessToast(bean.msg);
|
|
|
+ if (bean.data!=null && !bean.data.isEmpty() && !bean.data.equals("[]")){
|
|
|
+ trackingBoxBean = JsonUtil.jsonString2Bean(bean.data,TrackingBoxBean.class);
|
|
|
+ setRequestResult();
|
|
|
+ }
|
|
|
+ initFinish();
|
|
|
+ }else{
|
|
|
+ showWarningToast(bean.msg);
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
XLog.e("添加开箱拆柜数据结果返回错误",e.getMessage());
|
|
@@ -755,42 +749,24 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- //假成功
|
|
|
+ }
|
|
|
|
|
|
- showSuccessToast("success");
|
|
|
- initFinish();
|
|
|
- }
|
|
|
|
|
|
- public void initUnitCode(){
|
|
|
+ private void initFinish(){
|
|
|
isRequiredShow = false;
|
|
|
- for (String key : mapPictureSelector.keySet()) {
|
|
|
- if (!baseImgList.contains(key)){
|
|
|
- mapPictureSelector.get(key).emptyRemake();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
etUnitCode.setText("");
|
|
|
etUnitCode.requestFocus();
|
|
|
- llLabelPicture.setVisibility(View.GONE);
|
|
|
- }
|
|
|
|
|
|
- private void initFinish(){
|
|
|
- initUnitCode();
|
|
|
- for (int i=0;i<baseImgList.size();i++){
|
|
|
- if (mapPictureSelector.containsKey(baseImgList.get(i))){
|
|
|
- mapPictureSelector.get(baseImgList.get(i)).emptyRemake();
|
|
|
+ if (!trackingBoxBean.getNoClear().equals("Y")){
|
|
|
+ for (int n=0;n<takePictureBeanList.size();n++){
|
|
|
+ String tmpKey = takePictureBeanList.get(n).getField();
|
|
|
+ if (mapPictureSelector.containsKey(tmpKey) ){
|
|
|
+ mapPictureSelector.get(tmpKey).emptyRemake();
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
- llResult.setVisibility(View.GONE);
|
|
|
- llWeighPicture.setVisibility(View.GONE);
|
|
|
- llLabelPicture.setVisibility(View.VISIBLE);
|
|
|
|
|
|
- takePictureBeanList.clear();
|
|
|
- setCameraPicture();
|
|
|
- etTrackingNumber.setText("");
|
|
|
- etOrderNumber.setText("");
|
|
|
- etTrackingNumber.requestFocus();
|
|
|
+ llConfirm.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -799,15 +775,7 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
private boolean validate(){
|
|
|
|
|
|
|
|
|
- if (etTrackingNumber.getText().toString().isEmpty()){
|
|
|
- showWarningToast(etTrackingNumber.getHint().toString());
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if (etOrderNumber.getText().toString().isEmpty()){
|
|
|
- showWarningToast(etOrderNumber.getHint().toString());
|
|
|
- return false;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
if (etUnitCode.getText().toString().isEmpty()){
|
|
|
showWarningToast(etUnitCode.getHint().toString());
|
|
@@ -818,25 +786,7 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
postParam = new JSONObject();
|
|
|
Gson gson = new Gson();
|
|
|
|
|
|
- List<String> stringList = mapPictureSelector.get("label_img").getOssPhotoList();
|
|
|
- if (stringList.size()==0){
|
|
|
- showWarningToast("面单照片不能为空");
|
|
|
- return false;
|
|
|
- }
|
|
|
- postParam.put("label_img_tag",mapPictureSelector.get("label_img").getUniqueTag());
|
|
|
- postParam.put("label_img",gson.toJson(stringList));
|
|
|
-
|
|
|
-
|
|
|
- AsyncUpload weightUpload = mapPictureSelector.get("weight_img");
|
|
|
- if (showWeightImg && weightUpload!=null){
|
|
|
- List<String> weighPhotoList = weightUpload.getOssPhotoList();
|
|
|
- if (weighPhotoList.size()==0){
|
|
|
- showWarningToast("内件照片不能为空");
|
|
|
- return false;
|
|
|
- }
|
|
|
- postParam.put("weight_img_tag",weightUpload.getUniqueTag());
|
|
|
- postParam.put("weight_img",gson.toJson(weighPhotoList));
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
//拍照
|
|
|
if (takePictureBeanList.size()>0){
|
|
@@ -858,10 +808,15 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
}
|
|
|
|
|
|
|
|
|
- postParam.put("box_number",etOrderNumber.getText().toString().trim());
|
|
|
- postParam.put("tracking_number",etTrackingNumber.getText().toString().trim());
|
|
|
+ postParam.put("box_number",trackingBoxBean.getBoxNumber().trim());
|
|
|
+ postParam.put("tracking_number",trackingBoxBean.getTrackingNumber().trim());
|
|
|
postParam.put("unit_code",etUnitCode.getText().toString().trim());
|
|
|
|
|
|
+ if (!customerCode.isEmpty()){
|
|
|
+ postParam.put("is_customer_code",1);
|
|
|
+ postParam.put("customer_code",customerCode);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
} catch (JSONException e) {
|
|
|
showWarningToast("系统异常"+e.getMessage());
|
|
@@ -871,110 +826,36 @@ public class DetectionPutInMainActivity extends BaseActivity implements StoJNI.
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private void iniPhoto(){
|
|
|
-// HashMap<String, Object> map = new HashMap<>();
|
|
|
-// map.put("disabled",false);
|
|
|
-// map.put("error","不可拍照");
|
|
|
-// labelPictureSelectorUpload.setLimitOperate(map);
|
|
|
-// weighPictureSelectorUpload.setLimitOperate(map);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
//sIsGoodinfoMatch,sIsBattery,sIsMagnetic,sIsWood,sIsExtra,sIsOther
|
|
|
- @OnClick({R.id.btn_confirm,R.id.btn_start_upload})
|
|
|
+ @SuppressLint("NonConstantResourceId")
|
|
|
+ @OnClick({R.id.btn_confirm,R.id.btn_clear})
|
|
|
public void onViewClicked(View view) {
|
|
|
Bundle bundle = new Bundle();
|
|
|
switch (view.getId()) {
|
|
|
case R.id.btn_confirm:
|
|
|
- finishInbound();
|
|
|
+ Intent intent = new Intent();
|
|
|
+ setResult(200, intent);//返回值,2 是改返回的标志,也会返回
|
|
|
+ showSuccessToast("success");
|
|
|
+ finish();
|
|
|
break;
|
|
|
- case R.id.btn_start_upload:
|
|
|
-
|
|
|
- if (currentUploadStatus) {
|
|
|
- operateStopUpload();
|
|
|
- } else {
|
|
|
- operateStartUpload();
|
|
|
+ case R.id.btn_clear:
|
|
|
+ for (int n=0;n<takePictureBeanList.size();n++){
|
|
|
+ String tmpKey = takePictureBeanList.get(n).getField();
|
|
|
+ if (mapPictureSelector.containsKey(tmpKey) ){
|
|
|
+ mapPictureSelector.get(tmpKey).emptyRemake();
|
|
|
+ }
|
|
|
}
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void operateStopUpload(){
|
|
|
- if (currentUploadStatus){
|
|
|
- mapPictureSelector.get("label_img").setStopUpload();
|
|
|
- currentUploadStatus = false;
|
|
|
- btnStartUpload.setText("开始上传");
|
|
|
- llUploadProgressbar.setVisibility(View.GONE);
|
|
|
- }
|
|
|
- }
|
|
|
- private void operateStartUpload(){
|
|
|
- if (!currentUploadStatus){
|
|
|
- mapPictureSelector.get("label_img").setStartUpload();
|
|
|
- currentUploadStatus = true;
|
|
|
- btnStartUpload.setText("停止上传");
|
|
|
- llUploadProgressbar.setVisibility(View.VISIBLE);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- protected void showBack() {
|
|
|
- super.showBack();
|
|
|
- tb_iv_left.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
-
|
|
|
- int num = mapPictureSelector.get("label_img").getAwaitNum();
|
|
|
-
|
|
|
- if (num>0){
|
|
|
- new AlertDialog.Builder(mContext).setTitle(R.string.dl_hint)
|
|
|
- .setMessage("返回会取消上传还有"+num+"条数据未上传,确定要返回吗")
|
|
|
- .setNegativeButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
- if (!currentUploadStatus){
|
|
|
- operateStartUpload();
|
|
|
- }
|
|
|
- dialogInterface.dismiss();
|
|
|
- }
|
|
|
- }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
- if (isShowBackDialog) {
|
|
|
- onBackPressedSupport();
|
|
|
- } else {
|
|
|
- finish();
|
|
|
- }
|
|
|
- }
|
|
|
- }).show();
|
|
|
-
|
|
|
- }else{
|
|
|
- if (isShowBackDialog) {
|
|
|
- onBackPressedSupport();
|
|
|
- } else {
|
|
|
- finish();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- @Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
- public void onUploadProgress(UploadProgressEvent event) {
|
|
|
- // 更新进度条或其他 UI 元素
|
|
|
- int num = event.getProgress();
|
|
|
- pbProgressbar.setProgress(num);
|
|
|
- tvPercentageTextView.setText(String.valueOf(num).concat("%"));
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
unbinder.unbind();
|
|
|
-
|
|
|
- for (AsyncUpload asyncUpload : mapPictureSelector.values()) {
|
|
|
- asyncUpload.removeHandler();
|
|
|
- }
|
|
|
-
|
|
|
super.onDestroy();
|
|
|
}
|
|
|
@Override
|