guilin 1 年間 前
コミット
de5c568f3a

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

@@ -214,6 +214,17 @@
             android:windowSoftInputMode="stateHidden|adjustPan"
             android:screenOrientation="portrait"
             tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name=".hk.HkOutboundMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+        <activity
+            android:name=".hk.HkTrayMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
     </application>
 
 

+ 642 - 0
app/src/main/java/com/fxy/hk/HkOutboundMainActivity.java

@@ -0,0 +1,642 @@
+package com.fxy.hk;
+
+import android.annotation.SuppressLint;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+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.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.RequiresApi;
+
+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.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+import com.fxy.common.CommonDialog;
+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.zxing.Result;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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 HkOutboundMainActivity extends  BaseActivity implements StoJNI.ScanCallBack {
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+    //单号
+    @BindView(R.id.et_order_no)
+    EditText etOrderNo;
+
+    //单号
+    @BindView(R.id.et_container_code)
+    EditText etContainerCode;
+
+    //托盘组件
+    @BindView(R.id.ll_container)
+    LinearLayout llContainer;
+
+
+    @BindView(R.id.ib_order_no_clear)
+    ImageButton ibOrderNoClear;
+
+    //浮动按钮
+    @BindView(R.id.iv_drag)
+    FloatingImageView iv_drag;
+
+
+
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+
+    private Unbinder unbinder;
+
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fxy_hk_outbound;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+
+    }
+    //finish的返回监听
+    //这里的requestCode参数,就是上面设置的 1 ,当跳转的页面返回的时候,通过这个加以判断
+    //resultCode ,这个参数是在跳转的页面里面规定的,它也是一个int类型的标志
+    //第三个参数包含了返回的值
+    //如果不需要所跳转的页面返回值,也就不需要这个方法了
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+//        XLog.e("requestCode:"+requestCode);
+//        XLog.e("resultCode:"+resultCode);
+        if (requestCode == 200 && resultCode == 200)//之前提到的两个标志,在这里显示出了作用
+        {
+        }else if (resultCode==0){
+        }
+    }
+
+
+    /**
+     * 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(getString(R.string.str_cargo_storage));
+        initData();
+        initEdit();
+        //监听浮动按钮
+        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);
+                }
+            }
+        });
+    }
+
+    private void initData(){
+
+    }
+
+    @Override
+    public boolean dispatchKeyEvent(KeyEvent event) {
+        //XLog.e("event:"+event.getKeyCode());
+        if ((event.getKeyCode()==KeyEvent.KEYCODE_DPAD_CENTER )  && event.getAction() == KeyEvent.ACTION_DOWN){
+            //按确定键
+            if(this.validate()){
+                //doPutIn();
+            }
+        }
+        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());
+        }
+    }
+
+
+    //统一按钮回调
+    public void callbackEditor(View v){
+        switch (v.getId()) {
+            case R.id.et_order_no:
+                getOutboundInfo();
+                break;
+            case R.id.et_container_code:
+                addOutbound();
+                break;
+            default:
+        }
+    }
+
+
+
+
+
+    private void initEdit() {
+        List<EditText> list = new ArrayList<>();
+        list.add(etOrderNo);
+        list.add(etContainerCode);
+        unifyEdit(list);
+    }
+
+    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){
+        //获取焦点的view对象
+        View view=getWindow().getDecorView().findFocus();
+        //如果是EditText
+        if(view instanceof EditText)
+        {
+            ((EditText) view).setText(scanResult);
+            //执行回调
+            callbackEditor(view);
+        }
+    }
+
+    /**
+     * 获取打托信息
+     */
+    private void getOutboundInfo(){
+        final String outbound_number = etOrderNo.getText().toString().trim();
+        if (outbound_number.isEmpty()){
+            setEditTextFocused(etOrderNo,true);
+            showWarningToast(etOrderNo.getHint().toString());
+            return ;
+        }
+        try {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("outbound_number",outbound_number);
+            if (!checkRepeat(Urls.FXY_HK_CHECK_OUTBOUND+(jsonObject.toString()))){
+                Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
+                return;
+            }
+
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_HK_CHECK_OUTBOUND).upJson(jsonObject)
+                    .execute(new MyDialogCallback(this, true, true) {
+                        @Override
+                        public void onSuccess(Response<String> response) {
+                            super.onSuccess(response);
+                            ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
+                            if(bean.code == 1){
+                                etOrderNo.setEnabled(false);
+                                ibOrderNoClear.setVisibility(View.GONE);
+                                etContainerCode.setEnabled(true);
+                                etContainerCode.requestFocus();
+                            }else{
+                                showWarningToast(bean.msg);
+                                etOrderNo.requestFocus();
+                                etOrderNo.selectAll();
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            XLog.e("请求托盘信息错误:"+e.getMessage(),e);
+        }
+    }
+
+    /**
+     * 关闭托盘
+     */
+    private void finishLoad(){
+        final String outbound_number = etOrderNo.getText().toString().trim();
+        if (outbound_number.isEmpty()){
+            setEditTextFocused(etOrderNo,true);
+            showWarningToast(etOrderNo.getHint().toString());
+            return;
+        }
+        try {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("outbound_number",outbound_number);
+
+
+            if (!checkRepeat(Urls.FXY_FINISH_LOAD+(jsonObject.toString()))){
+                Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
+                return;
+            }
+
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_FINISH_LOAD).upJson(jsonObject)
+                    .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);
+                                etContainerCode.setEnabled(false);
+                                clearAllData();
+                                if(bean.code == 1){
+                                    etOrderNo.setText("");
+                                    etOrderNo.requestFocus();
+                                    showSuccessToast(bean.msg);
+                                }else{
+                                    showWarningToast(bean.msg);
+                                }
+
+
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                                showEmptyView("关闭完成装柜解析错误:"+e.getMessage());
+                                XLog.e("关完成装柜解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            XLog.e("完成装柜错误:"+e.getMessage(),e);
+        }
+    }
+
+    private void addOutbound() {
+        //校验数据
+        if (!validate()){
+            return;
+        }
+
+        try {
+            String pallet_code = etContainerCode.getText().toString().trim();
+            final String outbound_number = etOrderNo.getText().toString().trim();
+            JSONObject param = new JSONObject();
+            param.put("pallet_code",pallet_code);
+            param.put("outbound_number",outbound_number);
+
+            if (!checkRepeat(Urls.FXY_HK_CHECK_SCAN_PALLET+(param.toString()))){return;}
+
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_HK_CHECK_SCAN_PALLET)
+                    .upJson(param)
+                    .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);
+                                    clearData();
+                                }else{
+                                    showWarningToast(bean.msg);
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                                XLog.e("请求出库返回错误",e.getMessage());
+                            }
+                        }
+                    });
+        } catch (JSONException e) {
+            showEmptyView("请求出库失败:"+e.getMessage());
+            e.printStackTrace();
+        }
+
+
+    }
+
+    /*
+     * 校验必录
+     */
+    private boolean validate(){
+        if(!checkNull(etOrderNo)){
+            setEditTextFocused(etOrderNo,true);
+            showWarningToast(etOrderNo.getHint().toString());
+            return false;
+        }
+        if(!checkNull(etContainerCode)){
+            setEditTextFocused(etContainerCode,true);
+            showWarningToast(etContainerCode.getHint().toString());
+            return false;
+        }
+        return true;
+    }
+
+    private void clearData() {
+
+        etContainerCode.setText("");
+        etContainerCode.requestFocus();
+        setEditTextNormal(etContainerCode,true);
+    }
+
+    //清除订单信息
+    private void clearAllData() {
+
+        etContainerCode.setText("");
+        etOrderNo.setText("");
+        etContainerCode.setEnabled(false);
+        etOrderNo.setEnabled(true);
+        setEditTextNormal(etContainerCode,true);
+        setEditTextNormal(etOrderNo,true);
+        etOrderNo.requestFocus();
+    }
+
+    @OnClick({R.id.btn_change})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+            case R.id.btn_change:
+                clearAllData();
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * 统一设置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 true;
+                        }else{
+                            setEditTextNormal(v,true);
+                        }
+
+                        callbackEditor(v);
+
+                        return true;
+                    }
+                    return true;
+                }
+            });
+            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){
+                            setEditTextFocused(currentEditText,true);
+                        }
+                    }
+                }
+
+                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+                }
+
+                public void afterTextChanged(Editable s) {
+
+                }
+            });
+
+            if (imageButton !=null ){
+                unifyClearEdit(imageButton);
+            }
+        }
+    }
+
+
+    @Override
+    protected void onDestroy() {
+        unbinder.unbind();
+
+
+        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());
+        }
+    }
+
+
+}

+ 18 - 19
app/src/main/java/com/fxy/hk/HkPutinMainActivity.java

@@ -148,26 +148,25 @@ public class HkPutinMainActivity extends  BaseActivity implements StoJNI.ScanCal
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
 
-        if (resultCode == RESULT_OK) {
-            if (requestCode == PictureConfig.CHOOSE_REQUEST) {// 图片选择结果回调
-                List<LocalMedia>  images = PictureSelector.obtainMultipleResult(data);
-                LocalMedia localMedia = images.get(0);
-                String localPath = localMedia.isCompressed() ? localMedia.getCompressPath():localMedia.getPath();
-                filedUpload.filedUpload(localPath);
-                filedUpload.setOnChangeListener(new FiledUpload.UploadChangeListener() {
-                    @Override
-                    public void uploadResult(UploadResultBean uploadResultBean) {
-                        if (uploadResultBean.getStatus()==1){
-                            ArrayList<String> photoList =  new ArrayList<String>();
-                            photoList.add(uploadResultBean.getPath());
-                            pictureInbound(photoList);
-                        }else{
-                            showErrorToast("上传图片失败");
-                            XLog.e("上传结果失败"+uploadResultBean.getError());
-                        }
+        // 图片选择结果回调
+        if (resultCode == RESULT_OK && requestCode == PictureConfig.CHOOSE_REQUEST) {
+            List<LocalMedia>  images = PictureSelector.obtainMultipleResult(data);
+            LocalMedia localMedia = images.get(0);
+            String localPath = localMedia.isCompressed() ? localMedia.getCompressPath():localMedia.getPath();
+            filedUpload.filedUpload(localPath);
+            filedUpload.setOnChangeListener(new FiledUpload.UploadChangeListener() {
+                @Override
+                public void uploadResult(UploadResultBean uploadResultBean) {
+                    if (uploadResultBean.getStatus()==1){
+                        ArrayList<String> photoList =  new ArrayList<String>();
+                        photoList.add(uploadResultBean.getPath());
+                        pictureInbound(photoList);
+                    }else{
+                        showErrorToast("上传图片失败");
+                        XLog.e("上传结果失败"+uploadResultBean.getError());
                     }
-                });
-            }
+                }
+            });
         }
     }
 

+ 784 - 0
app/src/main/java/com/fxy/hk/HkTrayMainActivity.java

@@ -0,0 +1,784 @@
+package com.fxy.hk;
+
+import android.annotation.SuppressLint;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+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.TextView;
+
+import androidx.annotation.RequiresApi;
+
+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.bean.UploadResultBean;
+import com.fxy.common.CommonDialog;
+import com.fxy.common.FiledUpload;
+import com.fxy.constant.BaseConfig;
+import com.fxy.constant.EventCode;
+import com.fxy.hk.bean.InboundBean;
+import com.fxy.hk.bean.OutboundBean;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+import com.fxy.putIn.TallyMainActivity;
+import com.fxy.view.FloatingImageView;
+import com.google.gson.Gson;
+import com.google.zxing.Result;
+import com.luck.picture.lib.PictureSelector;
+import com.luck.picture.lib.config.PictureConfig;
+import com.luck.picture.lib.config.PictureMimeType;
+import com.luck.picture.lib.entity.LocalMedia;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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 HkTrayMainActivity extends BaseActivity implements StoJNI.ScanCallBack {
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+
+    //单号清除
+    @BindView(R.id.ib_container_code_clear)
+    ImageButton ibContainerCodeClear;
+    //单号
+    @BindView(R.id.et_container_code)
+    EditText etContainerCode;
+
+    //单号清除
+    @BindView(R.id.ib_ctn_code_clear)
+    ImageButton ibCtnCodeClear;
+    //单号
+    @BindView(R.id.et_ctn_code)
+    EditText etCtnCode;
+
+
+
+    @BindView(R.id.recyclerview)
+    RecyclerView recyclerView;
+
+    private FiledUpload filedUpload;
+
+    /**
+     * 列表适配器
+     */
+    private FinishWorkAdapter mAdapter;
+
+
+    //浮动按钮
+    @BindView(R.id.iv_drag)
+    FloatingImageView iv_drag;
+
+    private View notDataView;   //没有数据显示页
+    private View errorView;     //错误显示页
+    private View emptyView;     //空显示页
+
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+    private Unbinder unbinder;
+
+    private int isChange = 0;
+    private ArrayList<String> photoList = new ArrayList<String>();
+    ;
+
+    //托盘数据
+    private List<InboundBean> tallyDataList = new ArrayList<>();
+
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fxy_hk_tray;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+
+    }
+
+    //finish的返回监听
+    //这里的requestCode参数,就是上面设置的 1 ,当跳转的页面返回的时候,通过这个加以判断
+    //resultCode ,这个参数是在跳转的页面里面规定的,它也是一个int类型的标志
+    //第三个参数包含了返回的值
+    //如果不需要所跳转的页面返回值,也就不需要这个方法了
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        // 图片选择结果回调
+        if (resultCode == RESULT_OK && requestCode == PictureConfig.CHOOSE_REQUEST) {
+            List<LocalMedia> images = PictureSelector.obtainMultipleResult(data);
+            LocalMedia localMedia = images.get(0);
+            String localPath = localMedia.isCompressed() ? localMedia.getCompressPath() : localMedia.getPath();
+            filedUpload.filedUpload(localPath);
+            filedUpload.setOnChangeListener(new FiledUpload.UploadChangeListener() {
+                @Override
+                public void uploadResult(UploadResultBean uploadResultBean) {
+                    if (uploadResultBean.getStatus() == 1) {
+                        photoList.clear();
+                        photoList.add(uploadResultBean.getPath());
+                        ctnPhoto();
+                    } else {
+                        showErrorToast("上传图片失败");
+                        XLog.e("上传结果失败" + uploadResultBean.getError());
+                    }
+                }
+            });
+        }
+    }
+
+
+    /**
+     * 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("托盘入库");
+
+        initAdapter();
+        initData();
+        initEdit();
+        //监听浮动按钮
+        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);
+                }
+            }
+        });
+
+
+        filedUpload = new FiledUpload(HkTrayMainActivity.this, "photo");
+
+
+    }
+
+
+    private void initData() {
+
+    }
+
+    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);
+
+    }
+
+
+    @Override
+    public boolean dispatchKeyEvent(KeyEvent event) {
+        //XLog.e("event:"+event.getKeyCode());
+//        if ((event.getKeyCode()==KeyEvent.KEYCODE_DPAD_CENTER )  && event.getAction() == KeyEvent.ACTION_DOWN){
+//            //按确定键
+//            if(validate()){
+//                doPutIn();
+//            }
+//            return true;
+//        }
+        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());
+        }
+    }
+
+
+    //统一按钮回调
+    public void callbackEditor(View v) {
+        switch (v.getId()) {
+            case R.id.et_container_code:
+                checkPallet();
+                break;
+            case R.id.et_ctn_code:
+                checkCtnNo();
+                break;
+            default:
+        }
+    }
+
+    private void initEdit() {
+        List<EditText> list = new ArrayList<>();
+        list.add(etCtnCode);
+        list.add(etContainerCode);
+        unifyEdit(list);
+        etContainerCode.requestFocus();
+    }
+
+    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) {
+        //获取焦点的view对象
+        View view = getWindow().getDecorView().findFocus();
+        //如果是EditText
+        if (view instanceof EditText) {
+            ((EditText) view).setText(scanResult);
+            //执行回调
+            callbackEditor(view);
+        }
+    }
+
+
+    /**
+     * 检查打托信息
+     */
+    private void checkPallet() {
+        if (!checkNull(etContainerCode)) {
+            setEditTextFocused(etContainerCode, true);
+            showWarningToast(etContainerCode.getHint().toString());
+            return;
+        }
+        String postJson = formatParam(1);
+        if (!checkRepeat(Urls.FXY_HK_CHECK_PALLET + (postJson))) {
+            return;
+        }
+
+        OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_HK_CHECK_PALLET).upJson(postJson)
+                .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);
+
+                                etContainerCode.setEnabled(false);
+                                ibContainerCodeClear.setVisibility(View.GONE);
+                                etCtnCode.setEnabled(true);
+                                etCtnCode.requestFocus();
+                            } else {
+                                showWarningToast(bean.msg);
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            XLog.e("请求返回打托信息错误", e.getMessage());
+                        }
+                    }
+                });
+    }
+
+    /**
+     * 检查箱号
+     */
+    private void checkCtnNo() {
+        if (!validate()) {
+            return;
+        }
+
+        String postJson = formatParam(2);
+        if (!checkRepeat(Urls.FXY_HK_CHECK_CTN + (postJson))) {
+            return;
+        }
+
+        OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_HK_CHECK_CTN).upJson(postJson)
+                .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);
+                                authCamera();
+                            } else {
+
+                                JSONObject result = new JSONObject(bean.data);
+
+                                if (result.has("is_change") && result.getInt("is_change") == 1) {
+                                    new AlertDialog.Builder(mContext)
+                                            .setTitle(R.string.dl_hint)
+                                            .setMessage(bean.msg)
+                                            .setNegativeButton(R.string.str_submit, new DialogInterface.OnClickListener() {
+                                                @RequiresApi(api = Build.VERSION_CODES.KITKAT)
+                                                @Override
+                                                public void onClick(DialogInterface dialogInterface, int i) {
+                                                    isChange = 1;
+                                                    authCamera();
+                                                }
+                                            }).setPositiveButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
+                                        @Override
+                                        public void onClick(DialogInterface dialogInterface, int i) {
+                                            //取消不做操作
+
+                                        }
+                                    }).show();
+                                } else {
+                                    showWarningToast(bean.msg);
+                                }
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            XLog.e("请求返回箱号检查错误", e.getMessage());
+                        }
+                    }
+                });
+    }
+
+    private void authCamera() {
+        //拍照
+        com.luck.picture.lib.PictureSelector.create(this)
+                .openCamera(PictureMimeType.ofImage())
+                //只需要拍照
+                //.selectionMode(PictureConfig.SINGLE)
+//                .isCamera(true)
+                //.compressMaxKB()//压缩最大值kb compressGrade()为Luban.CUSTOM_GEAR有效
+                .compress(true) // 压缩
+                .cropCompressQuality(100)// 裁剪压缩质量 默认100
+                .minimumCompressSize(100) //最新压缩图片 默认100
+                .forResult(PictureConfig.CHOOSE_REQUEST);
+    }
+
+    /**
+     *
+     */
+    private void ctnPhoto() {
+        if (!validate()) {
+            return;
+        }
+
+        String postJson = formatParam(3);
+        if (!checkRepeat(Urls.FXY_HK_CTN_PHOTO + (postJson))) {
+            return;
+        }
+        OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_HK_CTN_PHOTO).upJson(postJson)
+                .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);
+                                InboundBean inboundBean = JsonUtil.getObject(bean.data, InboundBean.class);
+                                tallyDataList.add(inboundBean);
+                                mAdapter.setNewData(tallyDataList);
+                                mAdapter.notifyDataSetChanged();
+                                etCtnCode.setText("");
+                                setEditTextNormal(etCtnCode,true);
+                            } else {
+                                showWarningToast(bean.msg);
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            XLog.e("请求返回箱号检查错误", e.getMessage());
+                        }
+                    }
+                });
+
+
+    }
+
+
+    /**
+     * @param type int 1、打托 - 拍照,2、打托 - 扫箱号 3、打托 - 拍照
+     * @return
+     */
+    private String formatParam(int type) {
+        JSONObject jsonObject = new JSONObject();
+        try {
+
+            jsonObject.put("pallet_code", etContainerCode.getText().toString().trim());
+
+            if (type > 1) {
+                jsonObject.put("ctn_code", etCtnCode.getText().toString().trim());
+            }
+
+            if (type > 2) {
+                if (isChange > 0) {
+                    jsonObject.put("is_change", isChange);
+                }
+                Gson gson = new Gson();
+                jsonObject.put("photo", gson.toJson(photoList));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            XLog.e("组装数据失败");
+        }
+        return jsonObject.toString();
+    }
+
+    /*
+     * 校验必录
+     */
+    private boolean validate() {
+
+
+        if (!checkNull(etContainerCode)) {
+            setEditTextFocused(etContainerCode, true);
+            showWarningToast(etContainerCode.getHint().toString());
+            return false;
+        }
+
+
+        if (!checkNull(etCtnCode)) {
+            setEditTextFocused(etCtnCode, true);
+            showWarningToast(etCtnCode.getHint().toString());
+            return false;
+        }
+
+
+        return true;
+    }
+
+    private class FinishWorkAdapter extends BaseQuickAdapter<InboundBean, BaseViewHolder> {
+        public FinishWorkAdapter(List<InboundBean> data) {
+            super(R.layout.item_putin_scan, data);
+        }
+
+
+        public void setNewData(List<InboundBean> tallyDataList) {
+        }
+
+        @Override
+        protected void convert(BaseViewHolder helper, InboundBean item) {
+            helper.addOnClickListener(R.id.ib_clear);//定义setOnItemChildClickListener 事件点击
+            helper.setText(R.id.tv_number, item.getCtnCode());
+            helper.getView(R.id.ib_clear).setVisibility(View.GONE);
+        }
+    }
+
+
+    //清除订单信息
+    private void clearData() {
+        etContainerCode.setText("");
+        etCtnCode.setText("");
+        etContainerCode.setEnabled(true);
+        etCtnCode.setEnabled(false);
+        tallyDataList.clear();
+        mAdapter.notifyDataSetChanged();
+        setEditTextNormal(etCtnCode, true);
+        setEditTextNormal(etContainerCode, true);
+        etContainerCode.requestFocus();
+    }
+
+    @OnClick({R.id.btn_change})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+            case R.id.btn_change:
+                clearData();
+                break;
+            default:
+                break;
+        }
+    }
+
+    /**
+     * 统一设置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 (event != null) {
+                        XLog.e("KeyCode:" + event.getKeyCode() + "--ActionCode:" + event.getAction());
+                    }
+
+                    //|| (actionId == KeyEvent.ACTION_DOWN && event.getKeyCode()==KeyEvent.KEYCODE_ENTER )
+                    if (actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_DONE ||
+                            (actionId == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
+                        if (v.getText().toString().trim().isEmpty()) {
+                            setEditTextFocused(v, true);
+                            showWarningToast(v.getHint().toString());
+                            return true;
+                        } else {
+                            setEditTextNormal(v, true);
+                        }
+                        callbackEditor(v);
+                        return false;
+                    }
+                    return false;
+
+                    //返回true,保留软键盘。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) {
+                            setEditTextFocused(currentEditText, true);
+                        }
+                    }
+                }
+
+                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+                }
+
+                public void afterTextChanged(Editable s) {
+
+                }
+            });
+
+            if (imageButton != null) {
+                unifyClearEdit(imageButton);
+            }
+        }
+    }
+
+
+    @Override
+    protected void onDestroy() {
+        unbinder.unbind();
+
+
+        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());
+        }
+    }
+
+
+}

+ 72 - 0
app/src/main/java/com/fxy/hk/bean/InboundBean.java

@@ -0,0 +1,72 @@
+package com.fxy.hk.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class InboundBean implements Parcelable {
+    public String pallet_code = "";
+    public String ctn_code = "";
+
+    public String getPalletCode() {
+        return pallet_code;
+    }
+
+    public InboundBean setPalletCode(String pallet_code) {
+        this.pallet_code = pallet_code;
+        return this;
+    }
+
+    public String getCtnCode() {
+        return ctn_code;
+    }
+
+    public InboundBean setCtnCode(String ctn_code) {
+        this.ctn_code = ctn_code;
+        return this;
+    }
+
+    @Override
+    public String toString() {
+        return "InboundBean{" +
+                "pallet_code='" + pallet_code + '\'' +
+                ", ctn_code='" + ctn_code + '\'' +
+                '}';
+    }
+
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.pallet_code);
+        dest.writeString(this.ctn_code);
+    }
+
+    public void readFromParcel(Parcel source) {
+        this.pallet_code = source.readString();
+        this.ctn_code = source.readString();
+    }
+
+    public InboundBean() {
+    }
+
+    protected InboundBean(Parcel in) {
+        this.pallet_code = in.readString();
+        this.ctn_code = in.readString();
+    }
+
+    public static final Creator<InboundBean> CREATOR = new Creator<InboundBean>() {
+        @Override
+        public InboundBean createFromParcel(Parcel source) {
+            return new InboundBean(source);
+        }
+
+        @Override
+        public InboundBean[] newArray(int size) {
+            return new InboundBean[size];
+        }
+    };
+}

+ 50 - 0
app/src/main/java/com/fxy/hk/bean/OutboundBean.java

@@ -0,0 +1,50 @@
+package com.fxy.hk.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class OutboundBean implements Parcelable {
+    public String order = "";
+
+    public String getOrder() {
+        return order;
+    }
+
+    public OutboundBean setOrder(String order) {
+        this.order = order;
+        return this;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.order);
+    }
+
+    public void readFromParcel(Parcel source) {
+        this.order = source.readString();
+    }
+
+    public OutboundBean() {
+    }
+
+    protected OutboundBean(Parcel in) {
+        this.order = in.readString();
+    }
+
+    public static final Creator<OutboundBean> CREATOR = new Creator<OutboundBean>() {
+        @Override
+        public OutboundBean createFromParcel(Parcel source) {
+            return new OutboundBean(source);
+        }
+
+        @Override
+        public OutboundBean[] newArray(int size) {
+            return new OutboundBean[size];
+        }
+    };
+}

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

@@ -21,7 +21,9 @@ import com.fxy.common.VersionUpgrades;
 import com.elvishew.xlog.XLog;
 import com.fxy.constant.SPCache;
 import com.fxy.helper.HkDataHelper;
+import com.fxy.hk.HkOutboundMainActivity;
 import com.fxy.hk.HkPutinMainActivity;
+import com.fxy.hk.HkTrayMainActivity;
 import com.fxy.login.LoginActivity;
 import com.fxy.net.MyDialogCallback;
 import com.fxy.net.Urls;
@@ -169,7 +171,7 @@ public class HomePagerFragment extends BaseFragment implements View.OnClickListe
      */
     @OnClick({R.id.search_view, R.id.ivt_tally,R.id.ivt_cargo_storage,R.id.ivt_putin_photos,
             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_handle_work_order,R.id.ivt_add_work_order,R.id.ivt_hk_tally,R.id.ivt_hk_outbound})
     public void onClick(View v) {
         Bundle bundle = new Bundle();
         switch (v.getId()) {
@@ -203,7 +205,12 @@ public class HomePagerFragment extends BaseFragment implements View.OnClickListe
             case R.id.ivt_hk_putin:
                 intent2Page(getActivity(), HkPutinMainActivity.class, false,bundle);
                 break;
-
+            case R.id.ivt_hk_tally:
+                intent2Page(getActivity(), HkTrayMainActivity.class, false,bundle);;
+                break;
+            case R.id.ivt_hk_outbound:
+                intent2Page(getActivity(), HkOutboundMainActivity.class, false,bundle);;
+                break;
             default:
                 showToast("还没有配置点击事件");
                 break;

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

@@ -154,8 +154,20 @@ public class Urls {
     public static final String FXY_GK_INBOUND_PICTURE = "/pda/HongkongInbound/picture";
 
 
+    //打托 - 扫托盘
+    public static final String FXY_HK_CHECK_PALLET = "/pda/HongkongInbound/checkPallet";
 
+    //打托 - 扫箱号
+    public static final String FXY_HK_CHECK_CTN = "/pda/HongkongInbound/checkCtnNo";
 
+    //打托 - 扫箱号
+    public static final String FXY_HK_CTN_PHOTO = "/pda/HongkongInbound/ctnPhoto";
+
+    //打托 - 扫描香港出库单号
+    public static final String FXY_HK_CHECK_OUTBOUND = "/pda/HongkongOutbound/checkOutbound";
+
+    //打托 - 扫描香港出库单号
+    public static final String FXY_HK_CHECK_SCAN_PALLET = "/pda/HongkongOutbound/scanPallet";
 
     /*返修易 -- end*/
 

+ 92 - 0
app/src/main/res/layout/activity_fxy_hk_outbound.xml

@@ -0,0 +1,92 @@
+<?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">
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="4dp"
+            android:background="@color/md_grey_100" />
+
+        <LinearLayout
+            style="@style/FromLinearLayoutItem"
+            android:orientation="horizontal">
+            <EditText
+                style="@style/EditTextStyle"
+                android:id="@+id/et_order_no"
+                android:hint="扫描出库批次"
+
+                android:text=""/>
+            <ImageButton
+                style="@style/ClearImg"
+                android:id="@+id/ib_order_no_clear"
+                />
+
+
+        </LinearLayout>
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="4dp"
+            android:background="@color/md_grey_100" />
+
+        <LinearLayout
+            android:id="@+id/ll_container"
+            style="@style/FromLinearLayoutItem"
+            android:orientation="horizontal">
+            <EditText
+                style="@style/EditTextStyle"
+                android:enabled="false"
+                android:id="@+id/et_container_code"
+                android:hint="@string/hint_please_scan_container_code"
+                android:text=""/>
+            <ImageButton
+                android:id="@+id/ib_container_code_clear"
+                style="@style/ClearImg" />
+
+        </LinearLayout>
+
+
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="1dp"
+            android:background="@color/md_grey_100" />
+
+        <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:padding="10dp">
+            <TextView
+                style="@style/fontSize"
+                android:id="@+id/btn_change"
+                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>
+
+    </LinearLayout>
+
+
+    <include layout="@layout/item_float_image" />
+</LinearLayout>

+ 126 - 0
app/src/main/res/layout/activity_fxy_hk_tray.xml

@@ -0,0 +1,126 @@
+<?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="wrap_content"
+        android:scrollbars="none">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical">
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="4dp"
+                android:background="@color/md_grey_100" />
+
+            <LinearLayout
+                android:id="@+id/ll_container"
+                style="@style/FromLinearLayoutItem"
+                android:orientation="horizontal">
+                <EditText
+                    style="@style/EditTextStyle"
+                    android:id="@+id/et_container_code"
+                    android:hint="@string/hint_please_scan_container_code"
+                    android:text=""/>
+                <ImageButton
+                    android:id="@+id/ib_container_code_clear"
+                    style="@style/ClearImg" />
+
+            </LinearLayout>
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="4dp"
+                android:background="@color/md_grey_100" />
+
+            <LinearLayout
+                style="@style/FromLinearLayoutItem"
+                android:orientation="horizontal">
+                <EditText
+                    style="@style/EditTextStyle"
+                    android:id="@+id/et_ctn_code"
+                    android:enabled="false"
+                    android:hint="请输入/扫描箱号"
+                    android:text=""/>
+                <ImageButton
+                    style="@style/ClearImg"
+                    android:id="@+id/ib_ctn_code_clear"
+                    />
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingBottom="5dp"
+                android:paddingTop="5dp"
+                android:orientation="horizontal">
+                <TextView
+                    android:layout_marginLeft="@dimen/dp_10"
+                    style="@style/tvLeftStyle"
+                    android:text="最近扫描:" />
+
+
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="fill_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:gravity="center_vertical"
+                android:orientation="horizontal"
+                android:scrollbars="vertical"
+                android:paddingTop="@dimen/dp_10"
+                android:paddingBottom="@dimen/dp_10"
+                >
+                <android.support.v7.widget.RecyclerView
+                    android:id="@+id/recyclerview"
+                    android:layout_width="match_parent"
+                    android:layout_height="match_parent"
+                    android:background="#fff"
+                    android:overScrollMode="never"/>
+            </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:padding="10dp">
+                <TextView
+                    style="@style/fontSize"
+                    android:id="@+id/btn_change"
+                    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>
+        </LinearLayout>
+    </ScrollView>
+
+
+    <include layout="@layout/item_float_image" />
+</LinearLayout>

+ 23 - 9
app/src/main/res/layout/fragment_homepager.xml

@@ -259,15 +259,7 @@
                         android:textColor="@color/black_3d3d3d"
                         android:textSize="@dimen/t14"
                         android:textStyle="bold" />
-                    <TextView
-                        android:layout_width="wrap_content"
-                        android:layout_height="wrap_content"
-                        android:layout_gravity="center"
-                        android:text="@string/index_put_out"
-                        android:textColor="@color/black_3d3d3d"
-                        android:textSize="@dimen/t14"
-                        android:visibility="gone"
-                        android:textStyle="bold" />
+
 
                     <TableRow
                         android:layout_width="match_parent"
@@ -281,6 +273,28 @@
                             android:drawableTop="@drawable/ic_shift"
                             android:drawablePadding="5dp"
                             android:text="入库扫描" />
+                        <TextView
+                            style="@style/ImageViewWithTextStyle.FontSize"
+                            android:id="@+id/ivt_hk_tally"
+                            android:drawableTop="@drawable/ic_shift"
+                            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_hk_outbound"
+                            android:drawableTop="@drawable/ic_shift"
+                            android:drawablePadding="5dp"
+                            android:text="出库校验" />
+
                     </TableRow>
                 </LinearLayout>
             </LinearLayout>

+ 3 - 3
local.properties

@@ -4,6 +4,6 @@
 # Location of the SDK. This is only used by Gradle.
 # For customization when using a Version Control System, please read the
 # header note.
-#Tue Jul 07 14:56:58 CST 2020
-ndk.dir=D\:\\Android\\SDK\\ndk-bundle
-sdk.dir=D\:\\Android\\Sdk
+#Thu Jan 11 13:45:18 CST 2024
+ndk.dir=E\:\\Android\\SDK\\ndk-bundle
+sdk.dir=E\:\\Android\\Sdk