guilin преди 7 месеца
родител
ревизия
ebe5b4f984

+ 6 - 0
app/src/main/AndroidManifest.xml

@@ -244,6 +244,12 @@
             android:screenOrientation="sensor"
             android:configChanges="orientation|keyboardHidden|screenSize"
             tools:ignore="LockedOrientationActivity"/>
+ <activity
+            android:name=".detection.ScanPhotosMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="sensor"
+            android:configChanges="orientation|keyboardHidden|screenSize"
+            tools:ignore="LockedOrientationActivity"/>
 
 
         <activity

+ 6 - 0
app/src/main/java/com/fxy/adapter/GridImageAdapter.java

@@ -365,4 +365,10 @@ public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.View
         this.audioListener = listener;
     }
 
+
+    public void clearData(){
+        ossPhotoList.clear();
+        notifyDataSetChanged();
+    }
+
 }

+ 1 - 2
app/src/main/java/com/fxy/common/PictureSelectorUpload.java

@@ -188,7 +188,7 @@ public class PictureSelectorUpload {
     public void emptyRemake(){
         selectList.clear();
         ossPhotoList.clear();
-        adapter.notifyDataSetChanged();
+        adapter.clearData();
     }
 
 
@@ -724,5 +724,4 @@ public class PictureSelectorUpload {
 
 
 
-
 }

+ 225 - 14
app/src/main/java/com/fxy/detection/DetectionPutInMainActivity.java

@@ -9,10 +9,15 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 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.inputmethod.EditorInfo;
 import android.widget.EditText;
+import android.widget.ImageButton;
 import android.widget.LinearLayout;
+import android.widget.TextView;
 import android.widget.Toast;
 
 import com.elvishew.xlog.XLog;
@@ -40,6 +45,9 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
@@ -56,6 +64,17 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
      */
     Context mContext = this;
 
+    @BindView(R.id.et_order_number)
+    EditText etOrderNumber;
+
+
+
+    @BindView(R.id.et_tracking_number)
+    EditText etTrackingNumber;
+
+
+
+
     @BindView(R.id.ll_label_picture)
     LinearLayout llLabelPicture;
 
@@ -63,6 +82,12 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     @BindView(R.id.ll_weigh_picture)
     LinearLayout llWeighPicture;
 
+    @BindView(R.id.ll_result)
+    LinearLayout llResult;
+
+    @BindView(R.id.tv_result)
+    TextView tvResult;
+
 
 
     private PictureSelectorUpload labelPictureSelectorUpload;
@@ -73,9 +98,9 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     private ScanBean scanBean;
 
 
+    private boolean showWeightImg = false;
 
-
-
+    private boolean isRequiredShow = false;
     protected String action;
 
 
@@ -201,9 +226,7 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
         //XLog.e("event:"+event.getKeyCode());
         if ((event.getKeyCode()==KeyEvent.KEYCODE_DPAD_CENTER || event.getKeyCode()==KeyEvent.KEYCODE_ENTER )  && event.getAction() == KeyEvent.ACTION_DOWN){
             //按确定键
-            if(this.validate()){
 
-            }
         }
         return super.dispatchKeyEvent(event);
     }
@@ -314,7 +337,12 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
     }
 
     private void initEdit() {
-
+        List<EditText> list = new ArrayList<>();
+        list.add(etTrackingNumber);
+        list.add(etOrderNumber);
+        unifyEdit(list);
+        llResult.setVisibility(View.GONE);
+        llWeighPicture.setVisibility(View.GONE);
     }
 
 
@@ -322,6 +350,96 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
 
     }
 
+    //统一按钮回调
+    public void callbackEditor(View v){
+        switch (v.getId()) {
+            case R.id.et_tracking_number:
+                getInboundTrack();
+                break;
+            case R.id.et_order_number:
+                labelPictureSelectorUpload.authCamera();
+                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() {
@@ -349,9 +467,14 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
         if(view instanceof EditText)
         {
             ((EditText) view).setText(scanResult);
-
+            showSuccessToast("扫描成功");
             switch (view.getId()) {
-
+                case R.id.et_tracking_number:
+                    getInboundTrack();
+                    break;
+                case R.id.et_order_number:
+                    showSuccessToast("扫描成功");
+                    break;
                 default:
             }
 
@@ -359,8 +482,66 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
         }
     }
 
+    private void getInboundTrack(){
+
+
+        if (etTrackingNumber.getText().toString().isEmpty()){
+            showErrorToast(etTrackingNumber.getHint().toString());
+            return;
+        }
+
+
+        Map<String,Object> math = new HashMap<>();
+        math.put("tracking_number",etTrackingNumber.getText().toString().trim());
+
+
+        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();
+            return;
+        }
+
+        OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN_TRACK).upJson(mathJson)
+                .execute(new MyDialogCallback(this, true, true) {
+                    @Override
+                    public void onSuccess(Response<String> response) {
+                        super.onSuccess(response);
+                        try {
+                            ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
+                            JSONObject result = new JSONObject();
+                            if (bean.data!=null && !bean.data.isEmpty() && !bean.data.equals("[]")){
+                                result = new JSONObject(bean.data);
+                            }
+
+                            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"):"";
+
+
+
+                            showWeightImg = show_weight_img.contains("1");
+                            llWeighPicture.setVisibility(showWeightImg ? View.VISIBLE:View.GONE);
+                            llResult.setVisibility(showText.isEmpty() ? View.GONE:View.VISIBLE);
+                            tvResult.setText(showText);
+
+                            if(bean.code == 1){
+                                showSuccessToast(bean.msg,voiceName);
+                                etOrderNumber.requestFocus();
+                                etOrderNumber.setSelection(etOrderNumber.getText().toString().length());
+                            }else{
+                                showWarningToast(bean.msg,voiceName);
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            XLog.e("添加开箱拆柜数据结果返回错误",e.getMessage());
+                        }
+                    }
+                });
+    }
 
     private void pictureInbound(){
+        isRequiredShow = true;
         if (!validate()){
             return;
         }
@@ -381,9 +562,19 @@ public class DetectionPutInMainActivity extends  BaseActivity implements StoJNI.
                         try {
                             ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
                             if(bean.code == 1){
+                                isRequiredShow = false;
                                 showSuccessToast(bean.msg);
-                                labelPictureSelectorUpload.emptyRemake();//清空图片
+                                 labelPictureSelectorUpload.emptyRemake();//清空图片
                                 weighPictureSelectorUpload.emptyRemake();
+
+
+                                etOrderNumber.setText("");
+                                etTrackingNumber.setText("");
+                                etTrackingNumber.requestFocus();
+
+                                llResult.setVisibility(View.GONE);
+                                llWeighPicture.setVisibility(View.GONE);
+
                             }else{
                                 showWarningToast(bean.msg);
                             }
@@ -401,24 +592,44 @@ 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;
+        }
+
         try {
             postParam = new JSONObject();
+            Gson gson = new Gson();
 
             ArrayList<String> labelPhotoList = labelPictureSelectorUpload.getPhotoList();
-            ArrayList<String> weighPhotoList = weighPictureSelectorUpload.getPhotoList();
+
 
             //检查是否拍照  工单处理时拍照拍照非必传
             if (labelPhotoList.size()==0){
                 showWarningToast("面单照片不能为空");
                 return false;
             }
-            if (weighPhotoList.size()==0){
-                showWarningToast("称重照片不能为空");
-                return false;
+
+            if (showWeightImg){
+                ArrayList<String> weighPhotoList = weighPictureSelectorUpload.getPhotoList();
+                if (weighPhotoList.size()==0){
+                    showWarningToast("内件照片不能为空");
+                    return false;
+                }
+                postParam.put("weight_img",gson.toJson(weighPhotoList));
             }
-            Gson gson = new Gson();
+
+
             postParam.put("label_img",gson.toJson(labelPhotoList));
-            postParam.put("weight_img",gson.toJson(weighPhotoList));
+
+            postParam.put("box_number",etOrderNumber.getText().toString().trim());
+            postParam.put("tracking_number",etTrackingNumber.getText().toString().trim());
 
         } catch (JSONException e) {
             showWarningToast("系统异常"+e.getMessage());

+ 496 - 0
app/src/main/java/com/fxy/detection/ScanPhotosMainActivity.java

@@ -0,0 +1,496 @@
+package com.fxy.detection;
+
+import android.annotation.SuppressLint;
+import android.app.AlertDialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+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.inputmethod.EditorInfo;
+import android.widget.EditText;
+import android.widget.ImageButton;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+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.util.StringUtils;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+import com.fxy.common.PictureSelectorUpload;
+import com.fxy.constant.BaseConfig;
+import com.fxy.constant.EventCode;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+import com.fxy.view.FloatingImageView;
+import com.google.gson.Gson;
+import com.google.zxing.Result;
+import com.luck.picture.lib.config.PictureConfig;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import butterknife.Unbinder;
+import sto.android.app.StoJNI;
+import sto.android.app.StoPdaKeyEvent;
+import sto.android.app.StoTongJNI;
+
+public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.ScanCallBack{
+
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+
+
+    @BindView(R.id.ll_take_picture)
+    LinearLayout llTakePicture;
+
+
+    private ArrayList photoList =new ArrayList<>();
+
+    private PictureSelectorUpload pictureSelectorUpload;
+    //
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+
+    //浮动按钮
+    @BindView(R.id.iv_drag)
+    FloatingImageView iv_drag;
+
+
+    private String urlCode = "";
+
+    protected String action;
+
+
+    private Unbinder unbinder;
+
+    private JSONObject postParam = new JSONObject();
+
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fxy_scan_photos;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+        //XLog.e("接收数据解析:",bundle);
+        action = bundle.getString("action","add");
+    }
+
+
+
+    //finish的返回监听
+    //这里的requestCode参数,就是上面设置的 1 ,当跳转的页面返回的时候,通过这个加以判断
+    //resultCode ,这个参数是在跳转的页面里面规定的,它也是一个int类型的标志
+    //第三个参数包含了返回的值
+    //如果不需要所跳转的页面返回值,也就不需要这个方法了
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (resultCode == RESULT_OK) {
+            if (requestCode == PictureConfig.CHOOSE_REQUEST) {// 图片选择结果回调
+                pictureSelectorUpload.getSelectImg(data);
+            }
+        }
+    }
+
+    /**
+     * EventBus接收信息的方法,开启后才会调用(非粘性事件)
+     *
+     * @param event
+     */
+    @Override
+    protected void EventBean(BaseEventBusBean event) {
+//        XLog.e("----------接收返回--------------");
+//        XLog.e("接收返回:"+event.getEventCode());
+        if (event != null && event.getEventCode() == EventCode.displacement_refresh){
+
+        }
+    }
+
+    @Override
+    public boolean isPlayMusic() {
+        return true;
+    }
+
+
+    @Override
+    protected void initView() {
+        unbinder = ButterKnife.bind(this);
+        setTitleName("扫码拍照");
+
+        initEdit();
+        iniData();
+
+        RecyclerView rvShowImg = (RecyclerView)llTakePicture.findViewById(R.id.rv_show_img);
+        pictureSelectorUpload  = setItemPicture("detection",rvShowImg,9,PictureConfig.TYPE_IMAGE);
+
+
+        //监听浮动按钮
+        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 showImg RecyclerView
+     */
+    private PictureSelectorUpload setItemPicture(String actionType,RecyclerView showImg,int maxNum,int pictureType){
+        PictureSelectorUpload pictureUpload = new PictureSelectorUpload(ScanPhotosMainActivity.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) {
+                    pictureInbound();
+                }
+            }
+
+            @Override
+            public void uploadActionType(String actionType) {
+
+                System.out.println("actionType:"+actionType);
+
+            }
+        });
+        return  pictureUpload;
+    }
+
+
+    @Override
+    public boolean dispatchKeyEvent(KeyEvent event) {
+        //XLog.e("event:"+event.getKeyCode());
+        if ((event.getKeyCode()==KeyEvent.KEYCODE_DPAD_CENTER || event.getKeyCode()==KeyEvent.KEYCODE_ENTER )  && event.getAction() == KeyEvent.ACTION_DOWN){
+            //按确定键
+
+        }
+        return super.dispatchKeyEvent(event);
+    }
+
+    //监听按键
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        XLog.e("监听按键:"+keyCode);XLog.e(event);
+        if (scanBean.getIsBroadcast()==0 && StoTongJNI.getIns(mContext).getEventFuction(keyCode)  == StoPdaKeyEvent.KEYCODE_SCAN
+                && event.getRepeatCount() == 0) {
+
+            if (StoTongJNI.getIns(mContext).GetScannerIsScanning()) {
+//
+            } else {
+                StoTongJNI.getIns(mContext).SetScannerStart();
+            }
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+    @SuppressLint("HandlerLeak")
+    Handler scanHandler = new Handler() {
+
+        @Override
+        public void handleMessage(Message msg) {
+            // TODO Auto-generated method stub
+            if (msg.obj != null) {
+
+                String scanResult = msg.obj.toString().trim();
+                if (!scanResult.isEmpty()){
+                    setScanResult(scanResult);
+                }
+            }
+
+        }
+
+    };
+    @Override
+    public void onScanResults(String str) {
+        Message msg = new Message();
+        msg.obj = str;
+        scanHandler.sendMessage(msg);
+
+
+    }
+
+
+    @Override
+    public void onScanResults(String str, int type) {
+
+    }
+    /**
+     * 定义广播接受
+     */
+    BroadcastReceiver mReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            String scanResult = intent.getStringExtra(scanBean.getDataName());
+            if (scanResult==null){return; }
+            String scanStatus = "";
+            if (!scanBean.getStatusName().isEmpty()){
+                scanStatus = intent.getStringExtra(scanBean.getStatusName());
+            }else{
+                scanStatus = scanResult.isEmpty()? "" : "ok"; //有值 默认是扫码成功;
+            }
+
+            //新大陆(MT65,MT90) 需要手动关闭
+            if (!scanBean.getActionStop().isEmpty()){
+                Intent stopIntent = new Intent(scanBean.getActionStop());
+                mContext.sendBroadcast(stopIntent);
+            }
+
+            if ("ok".equals(scanStatus)){
+                setScanResult(scanResult);
+            }else{
+                showErrorToast(getString(R.string.scan_failed));
+            }
+        }
+    };
+
+    /**
+     * 注册广播
+     */
+    private void initReceiver(){
+
+        try {
+
+            String scanStr = getScanSetting();
+            scanBean = JsonUtil.getObject(scanStr, ScanBean.class);
+            Integer is_broadcast = scanBean.getIsBroadcast();//是否广播
+
+            if (is_broadcast ==1){
+                IntentFilter mFilter = new IntentFilter(scanBean.getAction());
+                this.registerReceiver(mReceiver, mFilter);
+            }else{
+                //不广播进行处理 jni模式
+                String pdaBrand = StoTongJNI.getmPdaBrand();
+                if (!pdaBrand.isEmpty()){
+                    StoTongJNI.getIns(this).setmScanCB(this);
+                    StoTongJNI.getIns(this).SetScannerOn();
+                }
+            }
+
+
+        }catch (Exception e) {
+            showErrorToast("获取扫码配置失败"+e.getMessage());
+            XLog.e("获取扫码配置失败:" + e.getMessage());
+        }
+    }
+
+    private void initEdit() {
+
+    }
+
+
+    private void iniData(){
+
+    }
+
+
+
+    private OnRxScanerListener mScanerListener = new OnRxScanerListener() {
+        @Override
+        public void onSuccess(String type, Result result) {
+            String scanResult = result.getText();
+            switch (type){
+                case BaseConfig.COMMON_SCANNER_ONLY:
+                    setScanResult(scanResult);
+
+                    break;
+            }
+        }
+        @Override
+        public void onFail(String type, String message) {
+
+        }
+    };
+
+    //把扫描结果赋值
+    private void setScanResult(String scanResult){
+        showSuccessToast("扫描成功");
+        urlCode = scanResult;
+        pictureSelectorUpload.authCamera();
+    }
+
+
+    private void pictureInbound(){
+        if (!validate()){
+            return;
+        }
+
+
+        if (!checkRepeat(Urls.FXY_DETECTION_CODE_PHOTO+(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_CODE_PHOTO).upJson(postParam)
+                .execute(new MyDialogCallback(this, true, true) {
+                    @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);
+                                pictureSelectorUpload.emptyRemake();//清空图片
+                                photoList.clear();
+                                urlCode = "";
+
+                            }else{
+                                showWarningToast(bean.msg);
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            XLog.e("添加理货数据结果返回错误",e.getMessage());
+                        }
+                    }
+                });
+    }
+
+
+    /*
+     * 校验必录
+     */
+    private boolean validate(){
+        photoList = pictureSelectorUpload.getPhotoList();
+
+        if (urlCode.isEmpty()){
+            showWarningToast("请选扫码");
+            return false;
+        }
+        try {
+            postParam = new JSONObject();
+            //检查是否拍照  工单处理时拍照拍照非必传
+            if (photoList.size()==0){
+                showWarningToast("请拍照上传");
+                return false;
+            }
+            Gson gson = new Gson();
+            postParam.put("label_img",gson.toJson(photoList));
+            postParam.put("url_code",urlCode);
+
+        } catch (JSONException e) {
+            showWarningToast("系统异常"+e.getMessage());
+            e.printStackTrace();
+            return false;
+        }
+
+        return true;
+    }
+
+    //sIsGoodinfoMatch,sIsBattery,sIsMagnetic,sIsWood,sIsExtra,sIsOther
+    @OnClick({R.id.btn_confirm})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+
+           case R.id.btn_confirm:
+               if (urlCode.isEmpty() || (pictureSelectorUpload!=null && pictureSelectorUpload.getPhotoList().size()==0) ){
+                   ActivityScanerCode.setScanerListener(mScanerListener);
+                   ActivityScanerCode.intent2Activity(mContext, BaseConfig.COMMON_SCANNER_ONLY);
+               }else{
+                   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) {
+
+                                   dialogInterface.dismiss();
+
+                               }
+                           }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
+                       @Override
+                       public void onClick(DialogInterface dialogInterface, int i) {
+                           //取消上传任务
+                           pictureInbound();
+
+                       }
+                   }).show();
+               }
+
+                break;
+            default:
+                break;
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        unbinder.unbind();
+        pictureSelectorUpload.removeHandler();
+        super.onDestroy();
+    }
+    @Override
+    protected void onResume() {
+        super.onResume();
+        initReceiver();
+    }
+    @Override
+    protected void onPause() {
+        super.onPause();
+        //销毁在onResume()方法中的广播
+        try {
+            //停止扫描
+            Integer is_broadcast = scanBean.getIsBroadcast();//是否广播
+            if (is_broadcast==0){
+                StoTongJNI.getIns(mContext).SetScannerStop();
+                StoTongJNI.getIns(mContext).SetScannerOff();
+            }else{
+                unregisterReceiver(mReceiver);
+            }
+        }catch (Exception e){
+            XLog.e("销毁广播失败:",e.getMessage());
+        }
+    }
+
+}

+ 8 - 2
app/src/main/java/com/fxy/main/fragment/HomePagerFragment.java

@@ -18,7 +18,6 @@ import com.fxy.detection.DetectionConfirmGoodsMainActivity;
 import com.fxy.detection.DetectionDestroyOutboundMainActivity;
 import com.fxy.detection.DetectionPutInMainActivity;
 import com.fxy.detection.DetectionPutawayMainActivity;
-import com.fxy.detection.DetectionWorkMainActivity;
 import com.fxy.helper.HkDataHelper;
 import com.fxy.hk.HkOutboundMainActivity;
 import com.fxy.hk.HkPickupStartMainActivity;
@@ -28,6 +27,7 @@ import com.fxy.hk.HkTrayMainActivity;
 import com.fxy.putIn.CheckUnpackingMainActivity;
 import com.fxy.putIn.PutinPalletMainActivity;
 import com.fxy.putIn.PutinPhotosMainActivity;
+import com.fxy.detection.ScanPhotosMainActivity;
 import com.fxy.putIn.TallyMainActivity;
 import com.fxy.putOut.DeliveryGoodsMainActivity;
 import com.fxy.tool.OrderToolMainActivity;
@@ -146,7 +146,8 @@ public class HomePagerFragment extends BaseFragment implements View.OnClickListe
             R.id.ivt_order_tool,R.id.ivt_check,R.id.ivt_putin_pallet,R.id.ivt_hk_putin,
             R.id.ivt_handle_work_order,R.id.ivt_add_work_order,R.id.ivt_hk_tally,R.id.ivt_hk_outbound,
             R.id.ivt_hk_pallet_location,R.id.ivt_hk_pickup,
-            R.id.ivt_detection_putin,R.id.ivt_detection_putaway,R.id.ivt_detection_destroy_outbound,R.id.ivt_detection_work})
+            R.id.ivt_detection_putin,R.id.ivt_detection_putaway,R.id.ivt_detection_destroy_outbound,
+            R.id.ivt_detection_work,R.id.ivt_scan_photos})
     public void onClick(View v) {
         Bundle bundle = new Bundle();
         switch (v.getId()) {
@@ -191,6 +192,9 @@ public class HomePagerFragment extends BaseFragment implements View.OnClickListe
             case R.id.ivt_detection_work:
                 intent2Page(getActivity(), DetectionConfirmGoodsMainActivity.class, false,bundle);
                 break;
+            case R.id.ivt_scan_photos:
+                intent2Page(getActivity(), ScanPhotosMainActivity.class, false,bundle);
+                break;
 
 
             case R.id.ivt_hk_putin:
@@ -211,6 +215,8 @@ public class HomePagerFragment extends BaseFragment implements View.OnClickListe
                 intent2Page(getActivity(), HkPickupStartMainActivity.class, false,bundle);;
                 break;
 
+
+
             default:
                 showToast("还没有配置点击事件");
                 break;

+ 5 - 0
app/src/main/java/com/fxy/net/Urls.java

@@ -158,6 +158,9 @@ public class Urls {
     //单箱入库
     public static final String FXY_DETECTION_PUTIN = "/pda/inbound/QcInbound";
 
+    //单箱入库
+    public static final String FXY_DETECTION_PUTIN_TRACK = "/pda/inbound/QcInboundTrack";
+
     // 单箱上架 -- 查验库位
     public static final String FXY_DETECTION_CHECK_LOCATION = "/pda/inbound/QcBindLocation";
     // 单箱上架
@@ -179,6 +182,8 @@ public class Urls {
 
     public static final String FXY_DETECTION_ASSIGN_DATA = "/pda/Inbound/getAssignData";
 
+    public static final String FXY_DETECTION_CODE_PHOTO = "/pda/inbound/QcCodePhoto";
+
     //打托 - 扫托盘
     public static final String FXY_HK_CHECK_PALLET = "/pda/HongkongInbound/checkPallet";
 

+ 54 - 2
app/src/main/res/layout/activity_fxy_detection_putin.xml

@@ -18,6 +18,35 @@
             android:layout_height="wrap_content"
             android:orientation="vertical">
 
+            <LinearLayout
+                android:id="@+id/ll_tracking_number"
+                style="@style/FromLinearLayoutItem"
+                android:orientation="horizontal">
+                <EditText
+                    style="@style/EditTextStyle"
+                    android:id="@+id/et_tracking_number"
+                    android:hint="扫描或者输入跟踪单号"
+                    android:text=""/>
+                <ImageButton
+                    android:id="@+id/ib_tracking_number_clear"
+                    style="@style/ClearImg" />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_order_number"
+                style="@style/FromLinearLayoutItem"
+                android:orientation="horizontal">
+                <EditText
+                    style="@style/EditTextStyle"
+                    android:id="@+id/et_order_number"
+                    android:hint="扫描或者输入箱号"
+                    android:text=""/>
+                <ImageButton
+                    android:id="@+id/ib_order_number_clear"
+                    style="@style/ClearImg" />
+
+            </LinearLayout>
             <LinearLayout
                 android:id="@+id/ll_label_picture"
                 android:layout_width="match_parent"
@@ -48,7 +77,7 @@
                 android:id="@+id/ll_weigh_picture"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:visibility="visible"
+                android:visibility="gone"
                 android:orientation="vertical">
                 <LinearLayout
                     android:layout_width="match_parent"
@@ -64,13 +93,36 @@
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:textStyle="bold"
-                        android:text="称重拍照">
+                        android:text="内件拍照">
                     </TextView>
                 </LinearLayout>
                 <include layout="@layout/fragment_show_img"/>
             </LinearLayout>
 
 
+            <LinearLayout
+                android:id="@+id/ll_result"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:background="@drawable/bg_white_et"
+                android:layout_marginLeft="@dimen/dp_10"
+                android:layout_marginRight="@dimen/dp_10"
+                android:layout_marginTop="20dp"
+                android:layout_marginBottom="20dp"
+                android:paddingBottom="10dp"
+                android:paddingTop="10dp"
+                android:gravity="center"
+                android:visibility="gone"
+                android:orientation="horizontal">
+                <TextView
+                    android:id="@+id/tv_result"
+                    style="@style/tvLeftStyle"
+                    android:paddingStart="20dp"
+                    android:paddingEnd="20dp"
+                    android:textSize="50sp"/>
+            </LinearLayout>
+
+
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"

+ 81 - 0
app/src/main/res/layout/activity_fxy_scan_photos.xml

@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:background="@color/md_grey_100"
+    android:orientation="vertical">
+    <ScrollView
+        android:id="@+id/ll_scroll_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:fitsSystemWindows="true"
+        android:scrollbars="none">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+
+
+            <LinearLayout
+                android:id="@+id/ll_take_picture"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:visibility="gone"
+                android:orientation="vertical">
+                <LinearLayout
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/dp_10"
+                    android:layout_marginRight="@dimen/dp_10"
+                    android:background="@null"
+                    android:padding="@dimen/dp_10"
+                    android:gravity="center_vertical"
+                    android:orientation="vertical">
+                    <TextView
+                        style="@style/fontSize"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:textStyle="bold"
+                        android:text="拍照">
+                    </TextView>
+                </LinearLayout>
+                <include layout="@layout/fragment_show_img"/>
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="@dimen/dp_10"
+                android:layout_marginTop="@dimen/dp_10"
+                android:layout_marginRight="@dimen/dp_10"
+                android:layout_marginBottom="@dimen/dp_4"
+                android:background="@drawable/bg_white_et"
+                android:gravity="center_vertical"
+                android:orientation="horizontal"
+                android:layout_gravity="bottom"
+                android:padding="10dp">
+                <TextView
+                    style="@style/fontSize"
+                    android:id="@+id/btn_confirm"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="@dimen/dp_10"
+                    android:layout_marginRight="@dimen/dp_10"
+                    android:background="@drawable/bg_orange_item"
+                    android:gravity="center"
+                    android:text="扫码拍照"
+                    android:padding="10dp"
+                    android:textColor="@color/white"
+                    android:visibility="visible" />
+            </LinearLayout>
+            <include layout="@layout/item_float_image" />
+        </LinearLayout>
+
+
+    </ScrollView>
+
+
+</LinearLayout>

+ 21 - 5
app/src/main/res/layout/fragment_homepager.xml

@@ -275,37 +275,53 @@
                             android:drawableTop="@drawable/ic_mapan"
                             android:drawablePadding="5dp"
                             android:text="单箱入库" />
+
                         <TextView
                             style="@style/ImageViewWithTextStyle.FontSize"
-                            android:id="@+id/ivt_detection_putaway"
+                            android:id="@+id/ivt_scan_photos"
                             android:drawableTop="@drawable/ic_mapan"
                             android:drawablePadding="5dp"
-                            android:text="单箱上架" />
+                            android:text="扫码拍照" />
 
                     </TableRow>
 
+
+
                     <TableRow
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:layout_marginTop="@dimen/t12"
+                        android:visibility="gone"
                         android:weightSum="2">
-
+                        <TextView
+                            style="@style/ImageViewWithTextStyle.FontSize"
+                            android:id="@+id/ivt_detection_putaway"
+                            android:drawableTop="@drawable/ic_mapan"
+                            android:drawablePadding="5dp"
+                            android:text="单箱上架" />
                         <TextView
                             style="@style/ImageViewWithTextStyle.FontSize"
                             android:id="@+id/ivt_detection_destroy_outbound"
                             android:drawableTop="@drawable/ic_mapan"
                             android:drawablePadding="5dp"
                             android:text="销毁出库" />
+
+
+                    </TableRow>
+                    <TableRow
+                        android:layout_width="match_parent"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="@dimen/t12"
+                        android:visibility="gone"
+                        android:weightSum="2">
                         <TextView
                             style="@style/ImageViewWithTextStyle.FontSize"
                             android:id="@+id/ivt_detection_work"
                             android:drawableTop="@drawable/ic_mapan"
                             android:drawablePadding="5dp"
                             android:text="检测作业" />
-
                     </TableRow>
 
-
                 </LinearLayout>
             </LinearLayout>