|
@@ -1,6 +1,7 @@
|
|
package com.fxy.putIn;
|
|
package com.fxy.putIn;
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.annotation.SuppressLint;
|
|
|
|
+import android.app.Dialog;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
@@ -18,34 +19,35 @@ import android.widget.EditText;
|
|
import android.widget.ImageButton;
|
|
import android.widget.ImageButton;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
-import android.widget.Toast;
|
|
|
|
|
|
|
|
import com.elvishew.xlog.XLog;
|
|
import com.elvishew.xlog.XLog;
|
|
import com.fxy.R;
|
|
import com.fxy.R;
|
|
import com.fxy.baselibrary.base.BaseActivity;
|
|
import com.fxy.baselibrary.base.BaseActivity;
|
|
import com.fxy.baselibrary.bean.BaseEventBusBean;
|
|
import com.fxy.baselibrary.bean.BaseEventBusBean;
|
|
import com.fxy.baselibrary.interfaces.OnRxScanerListener;
|
|
import com.fxy.baselibrary.interfaces.OnRxScanerListener;
|
|
-import com.fxy.baselibrary.qrcode.ActivityScanerCode;
|
|
|
|
import com.fxy.baselibrary.util.JsonUtil;
|
|
import com.fxy.baselibrary.util.JsonUtil;
|
|
-import com.fxy.baselibrary.util.StringUtils;
|
|
|
|
|
|
+import com.fxy.baselibrary.views.MarqueeTextView;
|
|
import com.fxy.bean.ActionBean;
|
|
import com.fxy.bean.ActionBean;
|
|
import com.fxy.bean.ScanBean;
|
|
import com.fxy.bean.ScanBean;
|
|
-import com.fxy.common.PictureSelectorUpload;
|
|
|
|
|
|
+import com.fxy.common.AsyncPictureSelector;
|
|
|
|
+import com.fxy.common.AsyncPictureUpload;
|
|
|
|
+import com.fxy.common.CommonDialog;
|
|
import com.fxy.constant.BaseConfig;
|
|
import com.fxy.constant.BaseConfig;
|
|
import com.fxy.constant.EventCode;
|
|
import com.fxy.constant.EventCode;
|
|
import com.fxy.net.MyDialogCallback;
|
|
import com.fxy.net.MyDialogCallback;
|
|
import com.fxy.net.Urls;
|
|
import com.fxy.net.Urls;
|
|
-import com.fxy.view.FloatingImageView;
|
|
|
|
|
|
+import com.fxy.putIn.bean.TallyPutInBean;
|
|
|
|
+import com.fxy.utils.UploadUtils;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
import com.google.zxing.Result;
|
|
import com.google.zxing.Result;
|
|
import com.luck.picture.lib.config.PictureConfig;
|
|
import com.luck.picture.lib.config.PictureConfig;
|
|
import com.lzy.okgo.OkGo;
|
|
import com.lzy.okgo.OkGo;
|
|
import com.lzy.okgo.model.Response;
|
|
import com.lzy.okgo.model.Response;
|
|
|
|
|
|
-import org.json.JSONException;
|
|
|
|
-import org.json.JSONObject;
|
|
|
|
-
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import butterknife.BindView;
|
|
import butterknife.BindView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.ButterKnife;
|
|
@@ -62,39 +64,53 @@ public class PutinPalletMainActivity extends BaseActivity implements StoJNI.Sca
|
|
*/
|
|
*/
|
|
Context mContext = this;
|
|
Context mContext = this;
|
|
|
|
|
|
- //单号清除
|
|
|
|
- @BindView(R.id.ib_order_no_clear)
|
|
|
|
- ImageButton ibOrderNoClear;
|
|
|
|
|
|
+ @BindView(R.id.et_order_number)
|
|
|
|
+ EditText etOrderNumber;
|
|
|
|
+
|
|
|
|
|
|
- //单号
|
|
|
|
- @BindView(R.id.et_order_no)
|
|
|
|
- EditText etOrderNo;
|
|
|
|
|
|
+ @BindView(R.id.tv_await_num)
|
|
|
|
+ TextView tvAwaitNum;
|
|
|
|
|
|
|
|
+ @BindView(R.id.mt_customer_code)
|
|
|
|
+ MarqueeTextView mtCtn;
|
|
|
|
|
|
- @BindView(R.id.ll_take_picture)
|
|
|
|
- LinearLayout llTakePicture;
|
|
|
|
|
|
+ @BindView(R.id.ll_label_picture)
|
|
|
|
+ LinearLayout llLabelPicture;
|
|
|
|
|
|
|
|
+ @BindView(R.id.ll_order_number)
|
|
|
|
+ LinearLayout llOrderNumber;
|
|
|
|
+ @BindView(R.id.ll_extend_info)
|
|
|
|
+ LinearLayout llExtendInfo;
|
|
|
|
|
|
- private ArrayList photoList =new ArrayList<>();
|
|
|
|
|
|
|
|
- private PictureSelectorUpload pictureSelectorUpload;
|
|
|
|
//
|
|
//
|
|
//扫码扫码动作
|
|
//扫码扫码动作
|
|
private ScanBean scanBean;
|
|
private ScanBean scanBean;
|
|
|
|
|
|
|
|
+ private ArrayList<String> baseImgList = new ArrayList<>();
|
|
|
|
+ protected String action;
|
|
|
|
|
|
- //浮动按钮
|
|
|
|
- @BindView(R.id.iv_drag)
|
|
|
|
- FloatingImageView iv_drag;
|
|
|
|
|
|
|
|
|
|
+ private HashMap<String, AsyncPictureSelector> mapPictureSelector = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ private boolean isRequiredShow = false;
|
|
|
|
|
|
|
|
+ private String currentPictureType= "label_img";
|
|
|
|
|
|
- protected String action;
|
|
|
|
|
|
+ private Unbinder unbinder;
|
|
|
|
|
|
|
|
+ private AsyncPictureUpload asyncPictureUpload;
|
|
|
|
|
|
- private Unbinder unbinder;
|
|
|
|
|
|
+ private TallyPutInBean tallyPutInBean;
|
|
|
|
+
|
|
|
|
+ private CommonDialog commonDialog;
|
|
|
|
+
|
|
|
|
+ //是否需要显示客户
|
|
|
|
+ private boolean needCustomer;
|
|
|
|
+
|
|
|
|
+ //客户名称
|
|
|
|
+ private String ctn="";
|
|
|
|
|
|
- private JSONObject postParam = new JSONObject();
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -115,7 +131,6 @@ public class PutinPalletMainActivity extends BaseActivity implements StoJNI.Sca
|
|
@Override
|
|
@Override
|
|
protected void getBundleExtras(Bundle bundle) {
|
|
protected void getBundleExtras(Bundle bundle) {
|
|
//XLog.e("接收数据解析:",bundle);
|
|
//XLog.e("接收数据解析:",bundle);
|
|
- action = bundle.getString("action","add");
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -128,12 +143,20 @@ public class PutinPalletMainActivity extends BaseActivity implements StoJNI.Sca
|
|
@Override
|
|
@Override
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
super.onActivityResult(requestCode, resultCode, data);
|
|
-
|
|
|
|
if (resultCode == RESULT_OK) {
|
|
if (resultCode == RESULT_OK) {
|
|
- if (requestCode == PictureConfig.CHOOSE_REQUEST) {// 图片选择结果回调
|
|
|
|
- pictureSelectorUpload.getSelectImg(data);
|
|
|
|
|
|
+ // 图片选择结果回调
|
|
|
|
+ if (requestCode == PictureConfig.CHOOSE_REQUEST) {
|
|
|
|
+ if (mapPictureSelector.containsKey(currentPictureType)){
|
|
|
|
+ mapPictureSelector.get(currentPictureType).getSelectImg(data);
|
|
|
|
+ }
|
|
|
|
+ totalAwaitNum();
|
|
|
|
+// asyncPictureUpload.setStartUpload();
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -145,9 +168,14 @@ public class PutinPalletMainActivity extends BaseActivity implements StoJNI.Sca
|
|
protected void EventBean(BaseEventBusBean event) {
|
|
protected void EventBean(BaseEventBusBean event) {
|
|
// XLog.e("----------接收返回--------------");
|
|
// XLog.e("----------接收返回--------------");
|
|
// XLog.e("接收返回:"+event.getEventCode());
|
|
// XLog.e("接收返回:"+event.getEventCode());
|
|
- if (event != null && event.getEventCode() == EventCode.displacement_refresh){
|
|
|
|
-
|
|
|
|
|
|
+ assert event != null;
|
|
|
|
+ switch (event.getEventCode()){
|
|
|
|
+ case EventCode.file_upload_lister:
|
|
|
|
+ totalAwaitNum();
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -161,70 +189,50 @@ public class PutinPalletMainActivity extends BaseActivity implements StoJNI.Sca
|
|
unbinder = ButterKnife.bind(this);
|
|
unbinder = ButterKnife.bind(this);
|
|
setTitleName("托盘入库");
|
|
setTitleName("托盘入库");
|
|
|
|
|
|
|
|
+ asyncPictureUpload = new AsyncPictureUpload(this);
|
|
initEdit();
|
|
initEdit();
|
|
iniData();
|
|
iniData();
|
|
|
|
+ RecyclerView rvLabelShowImg = (RecyclerView)llLabelPicture.findViewById(R.id.rv_show_img);
|
|
|
|
+ mapPictureSelector.put("label_img",setItemPicture("label_img",rvLabelShowImg,9999));
|
|
|
|
|
|
- RecyclerView rvShowImg = (RecyclerView)llTakePicture.findViewById(R.id.rv_show_img);
|
|
|
|
- pictureSelectorUpload = setItemPicture("photo",rvShowImg,9,PictureConfig.TYPE_IMAGE);
|
|
|
|
|
|
|
|
|
|
+ totalAwaitNum();
|
|
|
|
|
|
- //监听浮动按钮
|
|
|
|
- iv_drag.setOnClickListener(new View.OnClickListener() {
|
|
|
|
- @Override
|
|
|
|
- public void onClick(View v) {
|
|
|
|
- if(!iv_drag.isDrag()){
|
|
|
|
- ActivityScanerCode.setScanerListener(mScanerListener);
|
|
|
|
- ActivityScanerCode.intent2Activity(mContext, BaseConfig.COMMON_SCANNER_ONLY);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 设置多个上传文件
|
|
* 设置多个上传文件
|
|
- * @param actionType String
|
|
|
|
|
|
+ * @param uploadType String
|
|
* @param showImg RecyclerView
|
|
* @param showImg RecyclerView
|
|
*/
|
|
*/
|
|
- private PictureSelectorUpload setItemPicture(String actionType,RecyclerView showImg,int maxNum,int pictureType){
|
|
|
|
- PictureSelectorUpload pictureUpload = new PictureSelectorUpload(PutinPalletMainActivity.this,showImg,"work",maxNum,pictureType);
|
|
|
|
- pictureUpload.setActionType(actionType);
|
|
|
|
- pictureUpload.setCompress(true,100,500);
|
|
|
|
- pictureUpload.setOnlyCamera(true);
|
|
|
|
- //showImg.onTouchEvent()
|
|
|
|
-
|
|
|
|
- pictureUpload.setOnChangeListener(new PictureSelectorUpload.UploadChangeListener() {
|
|
|
|
- @Override
|
|
|
|
- public void uploadResult(boolean State,String actionType) {
|
|
|
|
- if (State) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ private AsyncPictureSelector setItemPicture(String uploadType,RecyclerView showImg,int num){
|
|
|
|
|
|
- @Override
|
|
|
|
- public void uploadActionType(String actionType) {
|
|
|
|
-
|
|
|
|
- System.out.println("actionType:"+actionType);
|
|
|
|
|
|
+ String notifyUrl = Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN;
|
|
|
|
+ AsyncPictureSelector pictureUpload = new AsyncPictureSelector(PutinPalletMainActivity.this,showImg,"tally",uploadType,notifyUrl,false);
|
|
|
|
+ pictureUpload.setUploadType(uploadType);
|
|
|
|
+ pictureUpload.setCompress(true,100,100);
|
|
|
|
+ pictureUpload.setOnlyCamera(true);
|
|
|
|
+ pictureUpload.setMaxSelectNum(num);
|
|
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
return pictureUpload;
|
|
return pictureUpload;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
|
public boolean dispatchKeyEvent(KeyEvent event) {
|
|
//XLog.e("event:"+event.getKeyCode());
|
|
//XLog.e("event:"+event.getKeyCode());
|
|
if ((event.getKeyCode()==KeyEvent.KEYCODE_DPAD_CENTER || event.getKeyCode()==KeyEvent.KEYCODE_ENTER ) && event.getAction() == KeyEvent.ACTION_DOWN){
|
|
if ((event.getKeyCode()==KeyEvent.KEYCODE_DPAD_CENTER || event.getKeyCode()==KeyEvent.KEYCODE_ENTER ) && event.getAction() == KeyEvent.ACTION_DOWN){
|
|
//按确定键
|
|
//按确定键
|
|
- if(this.validate()){
|
|
|
|
- pictureSelectorUpload.authCamera();
|
|
|
|
- }
|
|
|
|
|
|
+ getPallet();
|
|
}
|
|
}
|
|
return super.dispatchKeyEvent(event);
|
|
return super.dispatchKeyEvent(event);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//监听按键
|
|
//监听按键
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
XLog.e("监听按键:"+keyCode);XLog.e(event);
|
|
XLog.e("监听按键:"+keyCode);XLog.e(event);
|
|
@@ -331,57 +339,142 @@ public class PutinPalletMainActivity extends BaseActivity implements StoJNI.Sca
|
|
}
|
|
}
|
|
|
|
|
|
private void initEdit() {
|
|
private void initEdit() {
|
|
- //
|
|
|
|
- etOrderNo.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
|
- @Override
|
|
|
|
- public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
|
- if (actionId == EditorInfo.IME_ACTION_DONE) {
|
|
|
|
- String orderNo = etOrderNo.getText().toString().trim();
|
|
|
|
- if (StringUtils.isEmpty(orderNo)) {
|
|
|
|
- setEditTextFocused(v,true);
|
|
|
|
- showWarningToast(v.getHint().toString());
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- pictureSelectorUpload.authCamera();
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- etOrderNo.addTextChangedListener(new TextWatcher() {
|
|
|
|
- public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
- if (s.length() > 0 ) {
|
|
|
|
- if (etOrderNo.isEnabled()){
|
|
|
|
- ibOrderNoClear.setVisibility(View.VISIBLE);
|
|
|
|
- }
|
|
|
|
- setEditTextNormal(etOrderNo,true);
|
|
|
|
- } else {
|
|
|
|
- ibOrderNoClear.setVisibility(View.INVISIBLE);
|
|
|
|
- setEditTextFocused(etOrderNo,true);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ List<EditText> list = new ArrayList<>();
|
|
|
|
+ list.add(etOrderNumber);
|
|
|
|
+ unifyEdit(list);
|
|
|
|
+ }
|
|
|
|
|
|
- public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
- }
|
|
|
|
|
|
|
|
- public void afterTextChanged(Editable s) {
|
|
|
|
|
|
+ private void iniData(){
|
|
|
|
+ baseImgList.add("label_img");
|
|
|
|
+ initDialog();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private void initDialog(){
|
|
|
|
+ commonDialog = new CommonDialog(mContext, R.style.dialog, "need_ctn", new CommonDialog.OnCloseListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public void onClickCancel(Dialog dialog, boolean confirm) {
|
|
|
|
+ ctn = "" ;
|
|
|
|
+ dialog.dismiss();
|
|
}
|
|
}
|
|
- });
|
|
|
|
- ibOrderNoClear.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
@Override
|
|
- public void onClick(View view) {
|
|
|
|
- etOrderNo.requestFocus();
|
|
|
|
- etOrderNo.getText().clear();
|
|
|
|
|
|
+ public void onClickSubmit(Dialog dialog, boolean confirm) {
|
|
|
|
+ String string = commonDialog.contentTxt.getText().toString().trim();
|
|
|
|
+ if (commonDialog.getTypeCode().equals("need_ctn")){
|
|
|
|
+ ctn = string;
|
|
|
|
+ }
|
|
|
|
+ mtCtn.setText(ctn);
|
|
|
|
+ commonDialog.dismiss();
|
|
|
|
+ llExtendInfo.setVisibility(View.VISIBLE);
|
|
|
|
+ if (mapPictureSelector.get(currentPictureType).getOssPhotoList().size()==0){
|
|
|
|
+ mapPictureSelector.get(currentPictureType).authCamera();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ commonDialog.setContentLabel("");
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //getAwaitNum
|
|
|
|
+ private void totalAwaitNum(){
|
|
|
|
+ int awaitNum = UploadUtils.getAwaitNum(mRealm,getClass().getSimpleName());
|
|
|
|
+ tvAwaitNum.setText(String.valueOf(awaitNum));
|
|
|
|
+ }
|
|
|
|
|
|
- private void iniData(){
|
|
|
|
|
|
+ //统一按钮回调
|
|
|
|
+ @SuppressLint("NonConstantResourceId")
|
|
|
|
+ public void callbackEditor(View v){
|
|
|
|
+
|
|
|
|
+ switch (v.getId()) {
|
|
|
|
+
|
|
|
|
+ case R.id.et_order_number:
|
|
|
|
+
|
|
|
|
+ getPallet();
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 统一设置Edit监听
|
|
|
|
+ * @param list
|
|
|
|
+ */
|
|
|
|
+ public void unifyEdit(List<EditText> list){
|
|
|
|
+ for (int i=0;i<list.size();i++){
|
|
|
|
+ EditText editText = list.get(i);
|
|
|
|
+
|
|
|
|
+ LinearLayout linearLayout = (LinearLayout)editText.getParent();
|
|
|
|
+ ImageButton imageButton = getChildImageButton(linearLayout);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //监听按确定
|
|
|
|
+ editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
|
+ @Override
|
|
|
|
+ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
|
|
|
|
+ //XLog.e("actionId:"+actionId);
|
|
|
|
+ if (actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_DONE ) {
|
|
|
|
+ if (v.getText().toString().trim().isEmpty()) {
|
|
|
|
+ setEditTextFocused(v,true);
|
|
|
|
+ showWarningToast(v.getHint().toString());
|
|
|
|
+ return false;
|
|
|
|
+ }else{
|
|
|
|
+ setEditTextNormal(v,true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ callbackEditor(v);
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ editText.addTextChangedListener(new TextWatcher() {
|
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
+ EditText currentEditText = null;
|
|
|
|
+ ImageButton currentImage = null;
|
|
|
|
+ //获取焦点的view对象
|
|
|
|
+ View view=getWindow().getDecorView().findFocus();
|
|
|
|
+ //如果是EditText
|
|
|
|
+ if(view instanceof EditText){
|
|
|
|
+ currentEditText = (EditText) view;
|
|
|
|
+ currentImage = getChildImageButton((LinearLayout)currentEditText.getParent());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (s.length() > 0 ) {
|
|
|
|
+
|
|
|
|
+ if (currentImage !=null ){
|
|
|
|
+ currentImage.setVisibility(View.VISIBLE);
|
|
|
|
+ }
|
|
|
|
+ if (currentEditText!=null){
|
|
|
|
+ setEditTextNormal(currentEditText,true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ if (currentImage !=null ){
|
|
|
|
+ currentImage.setVisibility(View.INVISIBLE);
|
|
|
|
+ }
|
|
|
|
+ if (currentEditText!=null && isRequiredShow){
|
|
|
|
+ setEditTextFocused(currentEditText,true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (imageButton !=null ){
|
|
|
|
+ unifyClearEdit(imageButton);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
private OnRxScanerListener mScanerListener = new OnRxScanerListener() {
|
|
private OnRxScanerListener mScanerListener = new OnRxScanerListener() {
|
|
@@ -409,116 +502,158 @@ public class PutinPalletMainActivity extends BaseActivity implements StoJNI.Sca
|
|
if(view instanceof EditText)
|
|
if(view instanceof EditText)
|
|
{
|
|
{
|
|
((EditText) view).setText(scanResult);
|
|
((EditText) view).setText(scanResult);
|
|
|
|
+ showSuccessToast("扫描成功");
|
|
|
|
+ callbackEditor(view);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- switch (view.getId()) {
|
|
|
|
- case R.id.et_order_no:
|
|
|
|
- pictureSelectorUpload.authCamera();
|
|
|
|
- break;
|
|
|
|
- default:
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ //检查是否存在上传
|
|
|
|
+ private void checkIsUpload(){
|
|
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private void pictureInbound(){
|
|
|
|
- if (!validate()){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
- if (!checkRepeat(Urls.FXY_BATCH_PICTURE_INBOUND+(postParam.toString()))){
|
|
|
|
- Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
|
|
|
|
|
|
+ //获取跟踪单号
|
|
|
|
+ private void getPallet(){
|
|
|
|
+
|
|
|
|
+ checkIsUpload();
|
|
|
|
+ if (etOrderNumber.getText().toString().isEmpty()){
|
|
|
|
+ showErrorToast(etOrderNumber.getHint().toString());
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ Map<String,Object> math = new HashMap<>();
|
|
|
|
+ math.put("tracking_number",etOrderNumber.getText().toString().trim());
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_BATCH_PICTURE_INBOUND).upJson(postParam)
|
|
|
|
|
|
+ String mathJson = (new Gson()).toJson(math);
|
|
|
|
+ OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_SCAN_PALLET_TRACKING).upJson(mathJson)
|
|
.execute(new MyDialogCallback(this, true, true) {
|
|
.execute(new MyDialogCallback(this, true, true) {
|
|
@Override
|
|
@Override
|
|
public void onSuccess(Response<String> response) {
|
|
public void onSuccess(Response<String> response) {
|
|
super.onSuccess(response);
|
|
super.onSuccess(response);
|
|
|
|
+
|
|
try {
|
|
try {
|
|
|
|
+
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
- if(bean.code == 1){
|
|
|
|
- showSuccessToast(bean.msg);
|
|
|
|
- pictureSelectorUpload.emptyRemake();//清空图片
|
|
|
|
- photoList.clear();
|
|
|
|
- etOrderNo.setText("");
|
|
|
|
|
|
+ if (bean.data!=null && !bean.data.isEmpty() && !bean.data.equals("[]")){
|
|
|
|
+ tallyPutInBean = JsonUtil.jsonString2Bean(bean.data,TallyPutInBean.class);
|
|
|
|
+ }else{
|
|
|
|
+ tallyPutInBean = new TallyPutInBean();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String voiceName = tallyPutInBean.getVoiceName();
|
|
|
|
|
|
|
|
+ if(bean.code == 1){
|
|
|
|
+ showSuccessToast(bean.msg,voiceName);
|
|
|
|
+ commonDialog.setTitle("托数","请输入托数").setContent(ctn).show();
|
|
}else{
|
|
}else{
|
|
- showWarningToast(bean.msg);
|
|
|
|
|
|
+ showWarningToast(bean.msg,voiceName);
|
|
}
|
|
}
|
|
- } catch (Exception e) {
|
|
|
|
|
|
+ }catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
- XLog.e("添加理货数据结果返回错误",e.getMessage());
|
|
|
|
|
|
+ XLog.e("确认错误",e.getMessage());
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- /*
|
|
|
|
- * 校验必录
|
|
|
|
- */
|
|
|
|
- private boolean validate(){
|
|
|
|
- photoList = pictureSelectorUpload.getPhotoList();
|
|
|
|
- //数据检查不通过
|
|
|
|
- String orderNo = etOrderNo.getText().toString().trim();
|
|
|
|
- if (orderNo.isEmpty()){
|
|
|
|
- showWarningToast(etOrderNo.getHint().toString());
|
|
|
|
- return false;
|
|
|
|
|
|
+ //提交面单信息
|
|
|
|
+ private void palletInbound(){
|
|
|
|
+ checkIsUpload();
|
|
|
|
+ if (etOrderNumber.getText().toString().isEmpty()){
|
|
|
|
+ showErrorToast(etOrderNumber.getHint().toString());
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- try {
|
|
|
|
|
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
+ Map<String,Object> math = new HashMap<>();
|
|
|
|
+ math.put("tracking_number",etOrderNumber.getText().toString().trim());
|
|
|
|
+ math.put("ctn",ctn);
|
|
|
|
|
|
|
|
+ //面单
|
|
|
|
+ List<String> stringList = mapPictureSelector.get("label_img").getOssPhotoList();
|
|
|
|
+ if (stringList.size()==0){
|
|
|
|
+ showWarningToast("面单照片不能为空");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ math.put("label_img_tag",mapPictureSelector.get("label_img").getUniqueTag());
|
|
|
|
+ math.put("label_img",gson.toJson(stringList));
|
|
|
|
|
|
|
|
|
|
- postParam = new JSONObject();
|
|
|
|
|
|
+ OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_PALLET_INBOUND).upJson(gson.toJson(math))
|
|
|
|
+ .execute(new MyDialogCallback(this, true, true) {
|
|
|
|
+ @Override
|
|
|
|
+ public void onSuccess(Response<String> response) {
|
|
|
|
+ super.onSuccess(response);
|
|
|
|
+ try {
|
|
|
|
|
|
- //检查是否拍照 工单处理时拍照拍照非必传
|
|
|
|
- if (photoList.size()==0){
|
|
|
|
- showWarningToast("请拍照上传");
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- Gson gson = new Gson();
|
|
|
|
- postParam.put("photo",gson.toJson(photoList));
|
|
|
|
- postParam.put("tracking_number",orderNo);
|
|
|
|
-
|
|
|
|
- } catch (JSONException e) {
|
|
|
|
- showWarningToast("系统异常"+e.getMessage());
|
|
|
|
- e.printStackTrace();
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
+ ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
|
|
|
|
+ if (bean.data!=null && !bean.data.isEmpty() && !bean.data.equals("[]")){
|
|
|
|
+ tallyPutInBean = JsonUtil.jsonString2Bean(bean.data,TallyPutInBean.class);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ String voiceName = tallyPutInBean.getVoiceName();
|
|
|
|
+ if(bean.code == 1){
|
|
|
|
+ showSuccessToast(bean.msg,voiceName);
|
|
|
|
+ initFinish();
|
|
|
|
+ }else{
|
|
|
|
+ showWarningToast(bean.msg,voiceName);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ XLog.e("错误",e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
|
|
- return true;
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private void initFinish(){
|
|
|
|
+ etOrderNumber.setText("");
|
|
|
|
+ etOrderNumber.setEnabled(true);
|
|
|
|
+ for (int i=0;i<baseImgList.size();i++){
|
|
|
|
+ if (mapPictureSelector.containsKey(baseImgList.get(i))){
|
|
|
|
+ mapPictureSelector.get(baseImgList.get(i)).emptyRemake();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ etOrderNumber.requestFocus();
|
|
|
|
+ llExtendInfo.setVisibility(View.GONE);
|
|
|
|
+ ctn = "";
|
|
}
|
|
}
|
|
|
|
|
|
//sIsGoodinfoMatch,sIsBattery,sIsMagnetic,sIsWood,sIsExtra,sIsOther
|
|
//sIsGoodinfoMatch,sIsBattery,sIsMagnetic,sIsWood,sIsExtra,sIsOther
|
|
- @OnClick({R.id.btn_confirm,R.id.btn_photos})
|
|
|
|
|
|
+ @OnClick({R.id.btn_confirm,R.id.tv_edit_customer})
|
|
public void onViewClicked(View view) {
|
|
public void onViewClicked(View view) {
|
|
Bundle bundle = new Bundle();
|
|
Bundle bundle = new Bundle();
|
|
switch (view.getId()) {
|
|
switch (view.getId()) {
|
|
- case R.id.btn_photos:
|
|
|
|
- pictureSelectorUpload.authCamera();
|
|
|
|
|
|
+ case R.id.btn_confirm:
|
|
|
|
+ palletInbound();
|
|
break;
|
|
break;
|
|
- case R.id.btn_confirm:
|
|
|
|
- pictureInbound();
|
|
|
|
|
|
+ case R.id.tv_edit_customer:
|
|
|
|
+ commonDialog.setTitle("托数","请输入托数").setContent(ctn).show();
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected void onDestroy() {
|
|
protected void onDestroy() {
|
|
unbinder.unbind();
|
|
unbinder.unbind();
|
|
- pictureSelectorUpload.removeHandler();
|
|
|
|
super.onDestroy();
|
|
super.onDestroy();
|
|
|
|
+ asyncPictureUpload.removeHandler();
|
|
}
|
|
}
|
|
@Override
|
|
@Override
|
|
protected void onResume() {
|
|
protected void onResume() {
|