guilin 1 mēnesi atpakaļ
vecāks
revīzija
d34aa3ed21

+ 2 - 3
app/src/main/AndroidManifest.xml

@@ -295,15 +295,14 @@
             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"
+            android:screenOrientation="portrait"
             tools:ignore="LockedOrientationActivity"/>
 
 
-
         <activity
             android:name=".workOrder.WorkOrderOptMainActivity"
             android:windowSoftInputMode="stateHidden|adjustPan"

+ 57 - 39
app/src/main/java/com/fxy/detection/ScanPhotosMainActivity.java

@@ -32,11 +32,13 @@ 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.AsyncPictureSelector;
 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.utils.UploadUtils;
 import com.fxy.view.FloatingImageView;
 import com.google.gson.Gson;
 import com.google.zxing.Result;
@@ -48,6 +50,7 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
@@ -68,10 +71,17 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
     @BindView(R.id.ll_take_picture)
     LinearLayout llTakePicture;
 
+    @BindView(R.id.ll_scan_confirm)
+    LinearLayout llScanConfirm;
+    @BindView(R.id.ll_confirm)
+    LinearLayout llConfirm;
 
-    private ArrayList photoList =new ArrayList<>();
+    @BindView(R.id.tv_await_num)
+    TextView tvAwaitNum;
 
-    private PictureSelectorUpload pictureSelectorUpload;
+    private List<String> photoList =new ArrayList<>();
+
+    private AsyncPictureSelector pictureSelectorUpload;
     //
     //扫码扫码动作
     private ScanBean scanBean;
@@ -128,9 +138,19 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
             if (requestCode == PictureConfig.CHOOSE_REQUEST) {// 图片选择结果回调
                 pictureSelectorUpload.getSelectImg(data);
             }
+
+            totalAwaitNum();
         }
     }
 
+
+
+    //getAwaitNum
+    private void totalAwaitNum(){
+        int awaitNum = UploadUtils.getAwaitNum(mRealm,getClass().getSimpleName());
+        tvAwaitNum.setText(String.valueOf(awaitNum));
+    }
+
     /**
      * EventBus接收信息的方法,开启后才会调用(非粘性事件)
      *
@@ -138,10 +158,9 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
      */
     @Override
     protected void EventBean(BaseEventBusBean event) {
-//        XLog.e("----------接收返回--------------");
-//        XLog.e("接收返回:"+event.getEventCode());
-        if (event != null && event.getEventCode() == EventCode.displacement_refresh){
-
+        assert event != null;
+        if (event != null && event.getEventCode() == EventCode.file_upload_lister) {
+            totalAwaitNum();
         }
     }
 
@@ -160,7 +179,7 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
         iniData();
 
         RecyclerView rvShowImg = (RecyclerView)llTakePicture.findViewById(R.id.rv_show_img);
-        pictureSelectorUpload  = setItemPicture("detection",rvShowImg,9,PictureConfig.TYPE_IMAGE);
+        pictureSelectorUpload  = setItemPicture("detection",rvShowImg,99);
 
 
         //监听浮动按钮
@@ -177,37 +196,24 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
 
 
 
+
     /**
      * 设置多个上传文件
-     * @param actionType String
+     * @param uploadType 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) {
+    private AsyncPictureSelector setItemPicture(String uploadType,RecyclerView showImg,int num){
 
-                System.out.println("actionType:"+actionType);
+        String notifyUrl = Urls.getServiceAddress(this) + Urls.FXY_DETECTION_PUTIN;
+        AsyncPictureSelector pictureUpload = new AsyncPictureSelector(ScanPhotosMainActivity.this,showImg,"detection",uploadType,notifyUrl,false);
+        pictureUpload.setUploadType(uploadType);
+        pictureUpload.setCompress(true,100,100);
+        pictureUpload.setOnlyCamera(true);
+        pictureUpload.setMaxSelectNum(num);
 
-            }
-        });
         return  pictureUpload;
     }
 
-
     @Override
     public boolean dispatchKeyEvent(KeyEvent event) {
         //XLog.e("event:"+event.getKeyCode());
@@ -356,22 +362,31 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
         showSuccessToast("扫描成功");
         urlCode = scanResult;
         pictureSelectorUpload.authCamera();
+        setActionTake();
     }
 
+    private void setActionScan(){
+        llTakePicture.setVisibility(View.GONE);
+        llConfirm.setVisibility(View.GONE);
+        llScanConfirm.setVisibility(View.VISIBLE);
+    }
+
+    private void setActionTake (){
+        llTakePicture.setVisibility(View.VISIBLE);
+        llConfirm.setVisibility(View.VISIBLE);
+        llScanConfirm.setVisibility(View.GONE);
+    }
 
     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
@@ -384,7 +399,7 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
                                 pictureSelectorUpload.emptyRemake();//清空图片
                                 photoList.clear();
                                 urlCode = "";
-
+                                setActionScan();
                             }else{
                                 showWarningToast(bean.msg);
                             }
@@ -401,7 +416,7 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
      * 校验必录
      */
     private boolean validate(){
-        photoList = pictureSelectorUpload.getPhotoList();
+        photoList = pictureSelectorUpload.getOssPhotoList();
 
         if (urlCode.isEmpty()){
             showWarningToast("请选扫码");
@@ -428,13 +443,13 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
     }
 
     //sIsGoodinfoMatch,sIsBattery,sIsMagnetic,sIsWood,sIsExtra,sIsOther
-    @OnClick({R.id.btn_confirm})
+    @OnClick({R.id.btn_scan_confirm,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) ){
+           case R.id.btn_scan_confirm:
+               if (urlCode.isEmpty() || (pictureSelectorUpload!=null && pictureSelectorUpload.getOssPhotoList().size()==0) ){
                    ActivityScanerCode.setScanerListener(mScanerListener);
                    ActivityScanerCode.intent2Activity(mContext, BaseConfig.COMMON_SCANNER_ONLY);
                }else{
@@ -452,22 +467,25 @@ public class ScanPhotosMainActivity extends  BaseActivity implements StoJNI.Scan
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            //取消上传任务
-                           pictureInbound();
+
 
                        }
                    }).show();
                }
 
+                break;
+            case R.id.btn_confirm:
+                pictureInbound();
                 break;
             default:
                 break;
         }
     }
 
+
     @Override
     protected void onDestroy() {
         unbinder.unbind();
-        pictureSelectorUpload.removeHandler();
         super.onDestroy();
     }
     @Override

+ 72 - 2
app/src/main/java/com/fxy/putIn/TallyPutInMainActivity.java

@@ -1,10 +1,13 @@
 package com.fxy.putIn;
 
 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.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
@@ -19,6 +22,8 @@ import android.widget.ImageButton;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import androidx.annotation.RequiresApi;
+
 import com.elvishew.xlog.XLog;
 import com.fxy.R;
 import com.fxy.baselibrary.base.BaseActivity;
@@ -98,7 +103,10 @@ public class TallyPutInMainActivity extends  BaseActivity implements StoJNI.Scan
 
     private TallyPutInBean tallyPutInBean;
 
-
+    //是否重新打开
+    private int isOpen=0;
+    //强制更改
+    private int isChange=0;
 
     @Override
     public int getContentViewResId() {
@@ -486,6 +494,9 @@ public class TallyPutInMainActivity extends  BaseActivity implements StoJNI.Scan
         }
         Map<String,Object> math = new HashMap<>();
         math.put("pallet_code",etOrderNumber.getText().toString().trim());
+        if (isOpen>0){
+            math.put("is_open",isOpen);
+        }
 
         String mathJson = (new Gson()).toJson(math);
          OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_CHECK_PALLET).upJson(mathJson)
@@ -505,6 +516,27 @@ public class TallyPutInMainActivity extends  BaseActivity implements StoJNI.Scan
 
                             String voiceName = tallyPutInBean.getVoiceName();
 
+                            if (tallyPutInBean.getIsOpen() == 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) {
+                                                isOpen = 1;
+                                                getPallet();
+                                            }
+                                        }).setPositiveButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
+                                    @Override
+                                    public void onClick(DialogInterface dialogInterface, int i) {
+                                        //取消不做操作
+                                        isOpen = 0;
+                                    }
+                                }).show();
+                            }
+
+
                             tvQty.setText(String.valueOf(tallyPutInBean.getQty()));
                             if(bean.code == 1){
                                 showSuccessToast(bean.msg,voiceName);
@@ -534,6 +566,7 @@ public class TallyPutInMainActivity extends  BaseActivity implements StoJNI.Scan
         Map<String,Object> math = new HashMap<>();
         math.put("pallet_code",tallyPutInBean.getPalletCode().trim());
 
+
         //面单
         List<String> stringList = mapPictureSelector.get("label_img").getOssPhotoList();
         if (stringList.size()==0){
@@ -543,6 +576,14 @@ public class TallyPutInMainActivity extends  BaseActivity implements StoJNI.Scan
         math.put("label_img_tag",mapPictureSelector.get("label_img").getUniqueTag());
         math.put("label_img",gson.toJson(stringList));
 
+        if (isChange>0){
+            math.put("is_change",isChange);
+        }
+
+        if (isOpen>0){
+            math.put("is_open",isOpen);
+        }
+
 
         OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FXY_PICTURE_INBOUND).upJson(gson.toJson(math))
                 .execute(new MyDialogCallback(this, true, true) {
@@ -560,9 +601,36 @@ public class TallyPutInMainActivity extends  BaseActivity implements StoJNI.Scan
                             String voiceName = tallyPutInBean.getVoiceName();
                             if(bean.code == 1){
                                 showSuccessToast(bean.msg,voiceName);
+                                for (int i=0;i<baseImgList.size();i++){
+                                    if (mapPictureSelector.containsKey(baseImgList.get(i))){
+                                        mapPictureSelector.get(baseImgList.get(i)).emptyRemake();
+                                    }
+                                }
                                 mapPictureSelector.get(currentPictureType).authCamera();
                             }else{
-                                showWarningToast(bean.msg,voiceName);
+
+                                if (tallyPutInBean.getIsChange() ==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;
+                                                    submitLabelImg();
+                                                }
+                                            }).setPositiveButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
+                                        @Override
+                                        public void onClick(DialogInterface dialogInterface, int i) {
+                                            //取消不做操作
+                                            isChange = 0;
+                                        }
+                                    }).show();
+                                }else{
+                                    showWarningToast(bean.msg,voiceName);
+                                }
+
                             }
 
                         }catch (Exception e) {
@@ -606,6 +674,8 @@ public class TallyPutInMainActivity extends  BaseActivity implements StoJNI.Scan
                                 }
                                 etOrderNumber.requestFocus();
                                 tvQty.setText("0");
+                                isOpen = 0;
+                                isChange = 0;
                             }else{
                                 showWarningToast(bean.msg);
                             }

+ 23 - 0
app/src/main/java/com/fxy/putIn/bean/TallyPutInBean.java

@@ -7,13 +7,18 @@ public class TallyPutInBean implements Parcelable {
     private int qty = 0;//
     public String pallet_code = "";
     private String voice_name= "";
+    private int is_open = 0;
+    private int is_change = 0;
     public TallyPutInBean(){
     }
 
+
     protected TallyPutInBean(Parcel in) {
         qty = in.readInt();
         pallet_code = in.readString();
         voice_name = in.readString();
+        is_open = in.readInt();
+        is_change = in.readInt();
     }
 
     @Override
@@ -21,6 +26,8 @@ public class TallyPutInBean implements Parcelable {
         dest.writeInt(qty);
         dest.writeString(pallet_code);
         dest.writeString(voice_name);
+        dest.writeInt(is_open);
+        dest.writeInt(is_change);
     }
 
     @Override
@@ -63,4 +70,20 @@ public class TallyPutInBean implements Parcelable {
     public void setVoiceName(String voice_name) {
         this.voice_name = voice_name;
     }
+
+    public int getIsOpen() {
+        return is_open;
+    }
+
+    public void setIsOpen(int is_open) {
+        this.is_open = is_open;
+    }
+
+    public int getIsChange() {
+        return is_change;
+    }
+
+    public void setIsChange(int is_change) {
+        this.is_change = is_change;
+    }
 }

+ 35 - 1
app/src/main/res/layout/activity_fxy_scan_photos.xml

@@ -46,6 +46,7 @@
             </LinearLayout>
 
             <LinearLayout
+                android:id="@+id/ll_scan_confirm"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="@dimen/dp_10"
@@ -59,7 +60,7 @@
                 android:padding="10dp">
                 <TextView
                     style="@style/fontSize"
-                    android:id="@+id/btn_confirm"
+                    android:id="@+id/btn_scan_confirm"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:layout_marginLeft="@dimen/dp_10"
@@ -71,7 +72,40 @@
                     android:textColor="@color/white"
                     android:visibility="visible" />
             </LinearLayout>
+
+            <LinearLayout
+                android:id="@+id/ll_confirm"
+                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:visibility="gone"
+                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_upload_await_number" />
+
             <include layout="@layout/item_float_image" />
+
+
         </LinearLayout>