Browse Source

项目初始化

guilin 2 years ago
commit
0ada69393a
100 changed files with 11333 additions and 0 deletions
  1. 10 0
      .gitignore
  2. 198 0
      app/build.gradle
  3. BIN
      app/fxy.jks
  4. BIN
      app/libs/Sto.jar
  5. BIN
      app/libs/arm64-v8a/libkaicomk211.so
  6. BIN
      app/libs/arm64-v8a/libkaicomk571.so
  7. BIN
      app/libs/armeabi-v7a/libIAL.so
  8. BIN
      app/libs/armeabi-v7a/libRX70Dev.so
  9. BIN
      app/libs/armeabi-v7a/libRXC40Dev.so
  10. BIN
      app/libs/armeabi-v7a/libSDL.so
  11. BIN
      app/libs/armeabi-v7a/libbarcodereader.so
  12. BIN
      app/libs/armeabi-v7a/libbarcodereader43.so
  13. BIN
      app/libs/armeabi-v7a/libbarcodereader44.so
  14. BIN
      app/libs/armeabi-v7a/libkaicom420.so
  15. BIN
      app/libs/armeabi-v7a/libkaicom510.so
  16. BIN
      app/libs/armeabi-v7a/libkaicom520.so
  17. BIN
      app/libs/armeabi-v7a/libkaicom570.so
  18. BIN
      app/libs/armeabi-v7a/libkaicom570n.so
  19. BIN
      app/libs/armeabi-v7a/libkaicom585.so
  20. BIN
      app/libs/armeabi-v7a/libkaicomk2.so
  21. BIN
      app/libs/armeabi-v7a/libkaicomk211.so
  22. BIN
      app/libs/armeabi-v7a/libkaicomk2n.so
  23. BIN
      app/libs/armeabi-v7a/libkaicomk7.so
  24. BIN
      app/libs/armeabi-v7a/libkaicomk7s.so
  25. BIN
      app/libs/armeabi-v7a/libkaicomk7u.so
  26. BIN
      app/libs/armeabi/libIAL.so
  27. BIN
      app/libs/armeabi/libRX70Dev.so
  28. BIN
      app/libs/armeabi/libRXC40Dev.so
  29. BIN
      app/libs/armeabi/libSDL.so
  30. BIN
      app/libs/armeabi/libbarcodereader.so
  31. BIN
      app/libs/armeabi/libbarcodereader43.so
  32. BIN
      app/libs/armeabi/libbarcodereader44.so
  33. BIN
      app/libs/armeabi/libkaicom420.so
  34. BIN
      app/libs/armeabi/libkaicom510.so
  35. BIN
      app/libs/armeabi/libkaicom520.so
  36. BIN
      app/libs/armeabi/libkaicom570.so
  37. BIN
      app/libs/armeabi/libkaicom570n.so
  38. BIN
      app/libs/armeabi/libkaicom585.so
  39. BIN
      app/libs/armeabi/libkaicomk2.so
  40. BIN
      app/libs/armeabi/libkaicomk211.so
  41. BIN
      app/libs/armeabi/libkaicomk2n.so
  42. BIN
      app/libs/armeabi/libkaicomk7.so
  43. BIN
      app/libs/armeabi/libkaicomk7s.so
  44. BIN
      app/libs/armeabi/libkaicomk7u.so
  45. BIN
      app/libs/libs.zip
  46. BIN
      app/libs/meig.jar
  47. BIN
      app/libs/platform_sdk_v2.2.4.jar
  48. BIN
      app/libs/zltd_common_v1.3.3.jar
  49. 25 0
      app/proguard-rules.pro
  50. 258 0
      app/src/main/AndroidManifest.xml
  51. 46 0
      app/src/main/assets/litepal.xml
  52. 424 0
      app/src/main/java/com/action/actionmdm/MDMApi.java
  53. 585 0
      app/src/main/java/com/action/actionscaner/ScanerApi.java
  54. 115 0
      app/src/main/java/com/fxy/LauncherActivity.java
  55. 222 0
      app/src/main/java/com/fxy/adapter/GridImageAdapter.java
  56. 86 0
      app/src/main/java/com/fxy/adapter/NewPhotoAdapter.java
  57. 161 0
      app/src/main/java/com/fxy/adapter/RcAdapterWholeChange.java
  58. 58 0
      app/src/main/java/com/fxy/adapter/ShowImgAdapter.java
  59. 143 0
      app/src/main/java/com/fxy/base/CrashHandler.java
  60. 84 0
      app/src/main/java/com/fxy/base/ScanBaseActivity.java
  61. 364 0
      app/src/main/java/com/fxy/base/ServiceSettingActivity.java
  62. 154 0
      app/src/main/java/com/fxy/base/SetLanguageActivity.java
  63. 227 0
      app/src/main/java/com/fxy/base/ShowImgActivity.java
  64. 352 0
      app/src/main/java/com/fxy/base/StorageApplication.java
  65. 225 0
      app/src/main/java/com/fxy/base/fragment/PlayerVideoFragment.java
  66. 73 0
      app/src/main/java/com/fxy/base/fragment/ShowImgFragment.java
  67. 61 0
      app/src/main/java/com/fxy/base/fragment/event/UploadEvent.java
  68. 68 0
      app/src/main/java/com/fxy/bean/ActionBean.java
  69. 62 0
      app/src/main/java/com/fxy/bean/BaseDataBean.java
  70. 123 0
      app/src/main/java/com/fxy/bean/BluesBean.java
  71. 58 0
      app/src/main/java/com/fxy/bean/CommonDataBean.java
  72. 110 0
      app/src/main/java/com/fxy/bean/DictDataBean.java
  73. 103 0
      app/src/main/java/com/fxy/bean/ExceptionBean.java
  74. 77 0
      app/src/main/java/com/fxy/bean/ScalesBean.java
  75. 125 0
      app/src/main/java/com/fxy/bean/ScanBean.java
  76. 94 0
      app/src/main/java/com/fxy/bean/ScanDataBean.java
  77. 122 0
      app/src/main/java/com/fxy/bean/UpdateModel.java
  78. 81 0
      app/src/main/java/com/fxy/bean/UrlModel.java
  79. 57 0
      app/src/main/java/com/fxy/bean/VideoModel.java
  80. 63 0
      app/src/main/java/com/fxy/bean/VideoUrlModel.java
  81. 85 0
      app/src/main/java/com/fxy/bean/WeightBean.java
  82. 397 0
      app/src/main/java/com/fxy/bean/realm/CargoBaseModel.java
  83. 76 0
      app/src/main/java/com/fxy/bean/realm/ScanSetupModel.java
  84. 217 0
      app/src/main/java/com/fxy/common/CosService.java
  85. 168 0
      app/src/main/java/com/fxy/common/FiledUpload.java
  86. 230 0
      app/src/main/java/com/fxy/common/OssService.java
  87. 512 0
      app/src/main/java/com/fxy/common/PictureSelectorUpload.java
  88. 145 0
      app/src/main/java/com/fxy/common/VersionUpgrades.java
  89. 40 0
      app/src/main/java/com/fxy/constant/BaseConfig.java
  90. 116 0
      app/src/main/java/com/fxy/constant/EventCode.java
  91. 243 0
      app/src/main/java/com/fxy/constant/SPCache.java
  92. 578 0
      app/src/main/java/com/fxy/fms/check/CheckGoodsDetailsMainActivity.java
  93. 510 0
      app/src/main/java/com/fxy/fms/check/CheckGoodsMainActivity.java
  94. 476 0
      app/src/main/java/com/fxy/fms/check/CheckStartMainActivity.java
  95. 569 0
      app/src/main/java/com/fxy/fms/check/WaitCheckMainActivity.java
  96. 215 0
      app/src/main/java/com/fxy/fms/logic/ViewLogic.java
  97. 599 0
      app/src/main/java/com/fxy/fms/putIn/PutAwayMainActivity.java
  98. 484 0
      app/src/main/java/com/fxy/fms/putIn/TallyPictureMainActivity.java
  99. 659 0
      app/src/main/java/com/fxy/fms/putIn/TallyStartMainActivity.java
  100. 0 0
      app/src/main/java/com/fxy/fms/putIn/TallyVolumeMainActivity.java

+ 10 - 0
.gitignore

@@ -0,0 +1,10 @@
+/.idea
+/.vscode
+/.gradle
+/build
+/app/build
+/baselibrary/build
+/app/debug
+/app/release
+*.log
+.env

+ 198 - 0
app/build.gradle

@@ -0,0 +1,198 @@
+apply plugin: 'com.android.application'
+apply plugin: 'com.jakewharton.butterknife'
+apply plugin: 'realm-android'
+android {
+    compileSdkVersion rootProject.ext.android.compileSdkVersion
+    defaultConfig {
+        applicationId rootProject.ext.android.applicationId
+        minSdkVersion rootProject.ext.android.minSdkVersion
+        targetSdkVersion rootProject.ext.android.targetSdkVersion
+//        versionCode rootProject.ext.android.versionCode
+        versionCode getProperty("version.properties","versionCode",true)
+        versionName rootProject.ext.android.versionName
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+        javaCompileOptions {
+            annotationProcessorOptions {
+                includeCompileClasspath = true
+            }
+        }
+        multiDexEnabled true
+    }
+    lintOptions {
+        checkReleaseBuilds false
+        abortOnError false
+    }
+    signingConfigs {
+        release {
+            try {
+                storeFile file("fxy.jks")
+                storePassword KEYSTORE_PASSWORD
+                keyAlias "fxy"
+                keyPassword KEY_PASSWORD
+            } catch (ex) {
+                throw new ExceptionInInitializerError("You should define KEYSTORE_PASSWORD and KEY_PASSWORD in gradle.properties.")
+            }
+
+        }
+        debug {
+            try {
+                storeFile file("fxy.jks")
+                storePassword KEYSTORE_PASSWORD
+                keyAlias "fxy"
+                keyPassword KEY_PASSWORD
+            } catch (ex) {
+                throw new ExceptionInInitializerError("You should define KEYSTORE_PASSWORD and KEY_PASSWORD in gradle.properties.")
+            }
+        }
+
+    }
+    buildTypes {
+        release {
+            // 开启混淆
+            minifyEnabled false
+            // 对齐zip
+            zipAlignEnabled true
+            // 删除无用资源
+            shrinkResources false
+            // 是否debug
+            debuggable false
+            // 命名后缀
+            //versionNameSuffix "_release"
+            applicationIdSuffix '.eac.fxy'
+            // 签名
+            signingConfig signingConfigs.release
+            buildConfigField("String", "OSS_HOST", "\"https://fhdr.oss-cn-shenzhen.aliyuncs.com\"")
+            buildConfigField("String", "RESOURCE_TYPE", "\"aliyun\"")
+            buildConfigField("String", "RESOURCE_PREFIX", "\"prod/fxy\"")//只是默认值
+            buildConfigField("String", "WELCOME_TITLE", "\"FXY\"")
+            buildConfigField("String", "VERSION_API", "\"" + rootProject.ext.android.versionApi +  "\"")
+            buildConfigField("String", "VERSION_NUM", "\""+rootProject.ext.android.versionName+"\"")
+            manifestPlaceholders = [
+                    app_name:"FXY",
+                    icon:"@mipmap/ic_launcher",
+                    round_icon:"@mipmap/ic_launcher_round"
+            ]
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+        debug {
+            multiDexEnabled true
+            debuggable true
+            zipAlignEnabled false
+            shrinkResources false
+            minifyEnabled false
+            versionNameSuffix "_debug"
+            applicationIdSuffix '.eac.dahuo.debug'
+            signingConfig signingConfigs.debug
+            manifestPlaceholders = [
+                    app_name:"UAT-EAC",
+                    icon:"@mipmap/ic_launcher",
+                    round_icon:"@mipmap/ic_launcher_round"
+            ]
+            buildConfigField("String", "OSS_HOST", "\"https://fhdr.oss-cn-shenzhen.aliyuncs.com\"")
+            buildConfigField("String", "RESOURCE_TYPE", "\"aliyun\"")
+            buildConfigField("String", "RESOURCE_PREFIX", "\"uat/dahuo/fxy\"")//只是默认值
+            buildConfigField("String", "WELCOME_TITLE", "\"UAT-FXY\"")
+            buildConfigField("String", "VERSION_API", "\"" + rootProject.ext.android.versionApi +  "\"")
+            buildConfigField("String", "VERSION_NUM", "\""+rootProject.ext.android.versionName+"\"")
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+
+        //需要在 baselibrary也配置一下
+    }
+
+    android.applicationVariants.all { variant ->
+        variant.outputs.all {
+            outputFileName = "dahuo-pda-${variant.buildType.name}_v${defaultConfig.versionName}_${releaseTime()}.apk"
+        }
+    }
+/*    // 输出文件配置
+    applicationVariants.all { variant ->
+        variant.outputs.each { output ->
+            def outputFile = output.outputFile
+            if (outputFile != null && outputFile.name.endsWith('.apk')) {
+                def dirName = outputFile.parent // 输出文件夹所在的位置
+                // 文件名修改
+                def fileName = "app-${output.processResources.variantName}-${defaultConfig.versionName}-${variant.flavorName}.apk"
+                // 比如不想这么麻烦,直接在后面加上版本号也行:
+                // def fileName = outputFile.name.replace(".apk", "-${defaultConfig.versionName}.apk")
+                output.outputFile = new File(dirName, fileName)
+            }
+        }
+    }*/
+
+    aaptOptions {
+        cruncherEnabled = false
+        useNewCruncher = false
+    }
+
+    sourceSets {
+        main {
+            jniLibs.srcDirs = ['libs']
+        }
+    }
+
+    packagingOptions {
+        exclude 'META-INF/rxjava.properties'
+    }
+}
+dependencies {
+    implementation fileTree(include: ['*.jar'], dir: 'libs')
+    //    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
+    //        exclude group: 'com.android.support', module: 'support-annotations'
+    //    })
+    //    butterknife
+    implementation rootProject.ext.dependencies.butterknife
+    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
+    implementation 'com.luozm.captcha:captcha:1.1.2'
+    implementation rootProject.ext.dependencies.multidex
+    implementation rootProject.ext.dependencies.Spinner
+//    implementation rootProject.ext.dependencies.litepal
+    testImplementation 'junit:junit:4.12'
+    compile 'com.android.support:multidex:1.0.2'
+    compile project(':baselibrary')
+
+    // 自定义构建类型依赖
+//    raedebugCompile project(path: ':sdk', configuration: 'zj_release')
+}
+//解决控件台中文乱码问题
+tasks.withType(JavaCompile) {
+    options.encoding = "UTF-8"
+}
+def releaseTime() {
+    return new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("GMT+8:00"))
+}
+
+/**
+ * @param filename  要打开的文件名字
+ * @param propName   文件里面的键名字
+ * @param isRootProject   是否用rootProject 文件打开,true 的话,在编译时候可以得到值,打包时候无法得到值。false的话在打包时候可以得到值,编译时候 无法得到值
+ * @return  所选择的文件里面的propName对应的值
+ */
+def getProperty(String filename, String propName,boolean isRootProject) {
+    //在这里 必须是在rootProject.file  如果 file的话 ,编译时候会出错
+    def propsFile
+    def versionCode = 2
+    if (isRootProject) {
+        propsFile = rootProject.file(filename)
+    }else {
+        propsFile = file(filename)
+    }
+    if (propsFile.exists()) {
+        def props = new Properties()
+        props.load(new FileInputStream(propsFile))
+        if (props[propName] != null) {
+            //下面这个输出在android studio3.1里面 在Build窗口 右边一个锤子下面 toggle哪里,就是原来的message哪里
+            print("versionCode "+props[propName])
+            def code = (props[propName]).toInteger() //转成Integer
+            props[propName] = (++code).toString()  //自增 且转成String
+            versionCode = code
+        } else {
+            print("No such property " + propName + " in file " + filename)
+        }
+        //在这里提交 对version.properties的更改
+        props.store(propsFile.newWriter(),null)
+    } else {
+        print(filename + " does not exist!")
+    }
+    return versionCode
+}

BIN
app/fxy.jks


BIN
app/libs/Sto.jar


BIN
app/libs/arm64-v8a/libkaicomk211.so


BIN
app/libs/arm64-v8a/libkaicomk571.so


BIN
app/libs/armeabi-v7a/libIAL.so


BIN
app/libs/armeabi-v7a/libRX70Dev.so


BIN
app/libs/armeabi-v7a/libRXC40Dev.so


BIN
app/libs/armeabi-v7a/libSDL.so


BIN
app/libs/armeabi-v7a/libbarcodereader.so


BIN
app/libs/armeabi-v7a/libbarcodereader43.so


BIN
app/libs/armeabi-v7a/libbarcodereader44.so


BIN
app/libs/armeabi-v7a/libkaicom420.so


BIN
app/libs/armeabi-v7a/libkaicom510.so


BIN
app/libs/armeabi-v7a/libkaicom520.so


BIN
app/libs/armeabi-v7a/libkaicom570.so


BIN
app/libs/armeabi-v7a/libkaicom570n.so


BIN
app/libs/armeabi-v7a/libkaicom585.so


BIN
app/libs/armeabi-v7a/libkaicomk2.so


BIN
app/libs/armeabi-v7a/libkaicomk211.so


BIN
app/libs/armeabi-v7a/libkaicomk2n.so


BIN
app/libs/armeabi-v7a/libkaicomk7.so


BIN
app/libs/armeabi-v7a/libkaicomk7s.so


BIN
app/libs/armeabi-v7a/libkaicomk7u.so


BIN
app/libs/armeabi/libIAL.so


BIN
app/libs/armeabi/libRX70Dev.so


BIN
app/libs/armeabi/libRXC40Dev.so


BIN
app/libs/armeabi/libSDL.so


BIN
app/libs/armeabi/libbarcodereader.so


BIN
app/libs/armeabi/libbarcodereader43.so


BIN
app/libs/armeabi/libbarcodereader44.so


BIN
app/libs/armeabi/libkaicom420.so


BIN
app/libs/armeabi/libkaicom510.so


BIN
app/libs/armeabi/libkaicom520.so


BIN
app/libs/armeabi/libkaicom570.so


BIN
app/libs/armeabi/libkaicom570n.so


BIN
app/libs/armeabi/libkaicom585.so


BIN
app/libs/armeabi/libkaicomk2.so


BIN
app/libs/armeabi/libkaicomk211.so


BIN
app/libs/armeabi/libkaicomk2n.so


BIN
app/libs/armeabi/libkaicomk7.so


BIN
app/libs/armeabi/libkaicomk7s.so


BIN
app/libs/armeabi/libkaicomk7u.so


BIN
app/libs/libs.zip


BIN
app/libs/meig.jar


BIN
app/libs/platform_sdk_v2.2.4.jar


BIN
app/libs/zltd_common_v1.3.3.jar


+ 25 - 0
app/proguard-rules.pro

@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in D:\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

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

@@ -0,0 +1,258 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+
+          xmlns:tools="http://schemas.android.com/tools" package="com.fxy">
+
+    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION"
+                     tools:ignore="ProtectedPermissions"/>
+    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
+    <uses-permission android:name="android.permission.BLUETOOTH"/>
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.CAMERA" />
+
+    <uses-permission android:name="android.permission.INTERNET"/>
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+
+
+    <application
+        xmlns:tools="http://schemas.android.com/tools"
+        tools:replace="label"
+        android:name="com.fxy.base.StorageApplication"
+        android:allowBackup="true"
+        android:configChanges="locale"
+        android:icon="${icon}"
+        android:label="${app_name}"
+        android:roundIcon="${round_icon}"
+        android:supportsRtl="true"
+        android:theme="@style/AppTheme"
+
+    >
+
+<!--
+        <provider
+            android:name="com.cargo.utils.MyFileProvider"
+            android:authorities="com.cargo.fileprovider"
+            android:exported="false"
+            android:grantUriPermissions="true">
+            <meta-data
+                android:name="android.support.FILE_PROVIDER_PATHS"
+                android:resource="@xml/filepath" />
+        </provider>
+-->
+
+
+        <activity
+            android:name="com.fxy.LauncherActivity"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+
+        </activity>
+        <activity
+            android:name="com.fxy.main.MainActivity"
+            android:launchMode="singleTask"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.login.LoginActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.mine.ModifyPassWordActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.mine.FeedbackActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.base.SetLanguageActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.base.ServiceSettingActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+
+        <activity
+            android:name="com.fxy.mine.BlueSettingActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.mine.VersionContentActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+
+        <activity
+            android:name="com.fxy.putIn.SignInMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.putIn.TallyMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.putIn.CloseTrayMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+        <activity
+            android:name="com.fxy.putIn.PutAwayMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.repertory.ShiftMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+        <activity
+            android:name="com.fxy.repertory.CompleteShiftMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+
+
+        <activity
+            android:name="com.fxy.putOut.StartPickupMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+
+        <activity
+            android:name="com.fxy.putOut.PickupMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+
+
+        <activity
+            android:name="com.fxy.putOut.CloseContainerMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+
+        <activity
+        android:name="com.fxy.putOut.TurnOverMainActivity"
+        android:windowSoftInputMode="stateHidden|adjustPan"
+        android:screenOrientation="portrait"
+        tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.putOut.InterceptMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+
+
+        <activity
+            android:name="com.fxy.mine.ScanSettingActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity" />
+        <activity
+            android:name="com.fxy.mine.ElectronicScaleActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+        <activity
+            android:name="com.fxy.fms.putIn.TallyStartMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.fms.putIn.TallyPictureMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.fms.putIn.TallyVolumeMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.fms.check.WaitCheckMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.fms.check.CheckStartMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.fms.check.CheckGoodsMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.fms.check.CheckGoodsDetailsMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+        <activity
+            android:name="com.fxy.fms.putOut.StorageCancelMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+        <activity
+            android:name="com.fxy.fms.putOut.StorageStartMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+
+        <activity
+            android:name="com.fxy.fms.putOut.StorageFinishMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.fms.putOut.StorageAddMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+        <activity
+            android:name="com.fxy.fms.putIn.PutAwayMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+        <activity
+            android:name="com.fxy.fms.putOut.StorageChecklistMainActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+        <activity
+            android:name="com.fxy.mine.PictureSelectorActivity"
+            android:windowSoftInputMode="stateHidden|adjustPan"
+            android:screenOrientation="portrait"
+            tools:ignore="LockedOrientationActivity"/>
+
+    </application>
+
+
+</manifest>

+ 46 - 0
app/src/main/assets/litepal.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<litepal>
+    <!--
+        定义应用程序的数据库名称。
+        默认情况下,每个数据库名称都应以.db结尾。
+        如果您没有用.db命名数据库端,
+        LitePal会自动为您添加后缀。
+        例如:
+        <dbname value =“demo”/>
+    -->
+    <dbname value="fingerstorage"/>
+
+    <!--
+    	定义数据库的版本。每次你想
+        升级数据库时,版本标签都会有所帮助。
+        修改您在映射标签中定义的模型,并将
+        版本值加1,数据库的升级
+        将自动处理而不用担心。
+            例如:
+        <version value =“1”/>
+    -->
+    <version value="1"/>
+
+    <!--
+    	 使用映射标签在列表中定义模型,LitePal将为每个映射类创建表格。
+        模型中定义的支持字段将被映射到列中。       例如:
+        <list>
+            <mapping class =“com.test.model.Reader”/>
+            <mapping class =“com.test.model.Magazine”/>
+        </ list>
+    -->
+    <list>
+    </list>
+
+    <!--
+        Define where the .db file should be. "internal" means the .db file
+        will be stored in the database folder of internal storage which no
+        one can access. "external" means the .db file will be stored in the
+        path to the directory on the primary external storage device where
+        the application can place persistent files it owns which everyone
+        can access. "internal" will act as default.
+        For example:
+        <storage value="external" />
+    -->
+
+</litepal>

+ 424 - 0
app/src/main/java/com/action/actionmdm/MDMApi.java

@@ -0,0 +1,424 @@
+package com.action.actionmdm;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.support.v4.content.FileProvider;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+
+public class MDMApi {
+    private static final String TAG = "act-mdm";
+    private Context mContext;
+    private ContentResolver resolver = null;
+    private static final Uri ACTION_MDM_URI = Uri.parse("content://com.action.mdm_provider");
+    private static final String GET_MEID_IMEI = "get_meid_imei";
+    private static final String GET_DISABLE_INSTALL_PKGS = "get_disable_install_pkgs";
+    private static final String SET_DISABLE_INSTALL_PKGS = "set_disable_install_pkgs";
+    private static final String IS_DISABLE_INSTALL_ALL_APP = "is_disable_install_all_app";
+    private static final String SET_DISABLE_INSTALL_ALL_APP = "set_disable_install_all_app";
+    private static final String IS_DISABLED_STATUSBAR = "is_disabled_statusbar";
+    private static final String SET_DISABLED_STATUSBAR = "set_disabled_statusbar";
+    private static final String GET_NOT_DISPLAY_DESKTOP_ICONS = "get_not_display_desktop_icons";
+    private static final String SET_NOT_DISPLAY_DESKTOP_ICONS = "set_not_display_desktop_icons";
+    private static final String UNINSTALLER_APP = "uninstaller_app";
+    private static final String UNINSTALLER_PKG = "uninstaller_pkg";
+    private static final String UNINSTALLER_ALLUSERS = "uninstaller_allusers";
+    private static final String UNINSTALLER_SILENCE = "uninstaller_pkg_silence";
+    private static final String SET_TIME = "set_time";
+    private static final String REBOOT_DEVICE_KEY = "reboot_device";
+    private static final String SHUTDOWN_DEVICE_KEY = "shutdown_device";
+    private static final String SET_TRICOLOR_LAMP = "set_tricolor_lamp";
+    private static final String DEFAULT_OPEN = "default_open";
+
+    public MDMApi(Context context) {
+        this.mContext = context;
+        this.resolver = this.mContext.getContentResolver();
+    }
+
+    public List<String> getMeidAndImei() {
+        List<String> res = null;
+        String meidImei = null;
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras = this.resolver.call(ACTION_MDM_URI, "get_meid_imei", (String) null, extras);
+            if (extras != null) {
+                meidImei = extras.getString("get_meid_imei", (String) null);
+            }
+
+            if (!TextUtils.isEmpty(meidImei)) {
+                String[] ids = meidImei.split(",");
+                res = Arrays.asList(ids);
+            }
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+        return res;
+    }
+
+    public List<String> getDisableInstallPkgs() {
+        List<String> res = null;
+        String pkgs = null;
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras = this.resolver.call(ACTION_MDM_URI, "get_disable_install_pkgs", (String) null, extras);
+            if (extras != null) {
+                pkgs = extras.getString("get_disable_install_pkgs", (String) null);
+            }
+
+            if (!TextUtils.isEmpty(pkgs)) {
+                String[] pkgArray = pkgs.split(",");
+                res = Arrays.asList(pkgArray);
+            }
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+        return res;
+    }
+
+    public void setDisableInstallPkgs(List<String> pkgList) {
+        if (pkgList != null && pkgList.size() > 0) {
+            if (this.resolver == null) {
+                this.resolver = this.mContext.getContentResolver();
+            }
+
+            String pkgs = "";
+
+            String pkg;
+            for (Iterator i$ = pkgList.iterator(); i$.hasNext(); pkgs = pkgs + pkg + ",") {
+                pkg = (String) i$.next();
+            }
+
+            int len = pkgs.length();
+            pkgs = pkgs.substring(0, len - 1);
+            if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+                Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+                Bundle extras = new Bundle();
+                extras.putString("set_disable_install_pkgs", pkgs);
+                this.resolver.call(ACTION_MDM_URI, "set_disable_install_pkgs", (String) null, extras);
+            } else {
+                Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+            }
+
+        }
+    }
+
+    public boolean isDisableInstallAllApk() {
+        boolean isDisable = false;
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras = this.resolver.call(ACTION_MDM_URI, "is_disable_install_all_app", (String) null, extras);
+            if (extras != null) {
+                isDisable = extras.getBoolean("is_disable_install_all_app", false);
+            }
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+        return isDisable;
+    }
+
+    public void setDisableInstallAllApk(boolean isDisable) {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras.putBoolean("set_disable_install_all_app", isDisable);
+            this.resolver.call(ACTION_MDM_URI, "set_disable_install_all_app", (String) null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+    }
+
+    public boolean isDisableStatusBar() {
+        boolean isDisable = false;
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras = this.resolver.call(ACTION_MDM_URI, "is_disabled_statusbar", (String) null, extras);
+            if (extras != null) {
+                isDisable = extras.getBoolean("is_disabled_statusbar", false);
+            }
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+        return isDisable;
+    }
+
+    public void setDisableStatusBar(boolean isDisable) {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras.putBoolean("set_disabled_statusbar", isDisable);
+            this.resolver.call(ACTION_MDM_URI, "set_disabled_statusbar", (String) null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+    }
+
+    public List<String> getNotDisplayDesktopIcons() {
+        List<String> res = null;
+        String pkgs = null;
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras = this.resolver.call(ACTION_MDM_URI, "get_not_display_desktop_icons", (String) null, extras);
+            if (extras != null) {
+                pkgs = extras.getString("get_not_display_desktop_icons", (String) null);
+            }
+
+            if (!TextUtils.isEmpty(pkgs)) {
+                String[] pkgArray = pkgs.split(",");
+                res = Arrays.asList(pkgArray);
+            }
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+        return res;
+    }
+
+    public void setNotDisplayDesktopIcons(List<String> pkgList) {
+        if (pkgList != null && pkgList.size() > 0) {
+            if (this.resolver == null) {
+                this.resolver = this.mContext.getContentResolver();
+            }
+
+            String pkgs = "";
+
+            String pkg;
+            for (Iterator i$ = pkgList.iterator(); i$.hasNext(); pkgs = pkgs + pkg + ",") {
+                pkg = (String) i$.next();
+            }
+
+            int len = pkgs.length();
+            pkgs = pkgs.substring(0, len - 1);
+            if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+                Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+                Bundle extras = new Bundle();
+                extras.putString("set_not_display_desktop_icons", pkgs);
+                this.resolver.call(ACTION_MDM_URI, "set_not_display_desktop_icons", (String) null, extras);
+            } else {
+                Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+            }
+
+        }
+    }
+
+    public void uninstallApp(String pkg, boolean allUsers, boolean isSilence) {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras.putString("uninstaller_pkg", pkg);
+            extras.putBoolean("uninstaller_allusers", allUsers);
+            extras.putBoolean("uninstaller_pkg_silence", isSilence);
+            this.resolver.call(ACTION_MDM_URI, "uninstaller_app", (String) null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+    }
+
+    public void setTime(long timeMillis) {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras.putLong("set_time", timeMillis);
+            this.resolver.call(ACTION_MDM_URI, "set_time", (String) null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+    }
+
+    public void reboot() {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            this.resolver.call(ACTION_MDM_URI, "reboot_device", (String) null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+    }
+
+    public void shutdown() {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            this.resolver.call(ACTION_MDM_URI, "shutdown_device", (String) null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+    }
+
+    public void setTricolor(int value) {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras.putInt("set_tricolor_lamp", value);
+            this.resolver.call(ACTION_MDM_URI, "set_tricolor_lamp", (String) null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+
+    }
+
+    public void install(String path, boolean runAfterInstall) {
+        File apkFile = new File(path);
+        if (!apkFile.exists()) {
+            return;
+        }
+
+        Intent intent = new Intent();
+        intent.setAction(Intent.ACTION_VIEW);
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        if (Build.VERSION.SDK_INT >= 24) {
+            Log.w(TAG, "版本大于 N ,开始使用 fileProvider 进行安装…");
+            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
+            // 安装结束是否打开应用
+            intent.putExtra(DEFAULT_OPEN, runAfterInstall);
+            Uri contentUri = FileProvider.getUriForFile(mContext,
+                    "com.wubin.otg.otgmaster.fileprovider", apkFile);
+            intent.setDataAndType(contentUri,
+                    "application/vnd.android.package-archive-silence");
+        } else {
+            Log.w(TAG, "正常进行安装…");
+            intent.setDataAndType(Uri.fromFile(apkFile),
+                    "application/vnd.android.package-archive-silence");
+        }
+        mContext.startActivity(intent);
+    }
+
+    public boolean hasAdbEnable() {
+        boolean isEnabled = false;
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras = this.resolver.call(ACTION_MDM_URI, "get_adb_state", null, extras);
+            if (extras != null) {
+                isEnabled = extras.getBoolean("get_adb_state", false);
+            }
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+        return isEnabled;
+    }
+
+    public void setAdbEnable(boolean enable) {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras.putBoolean("set_adb_state", enable);
+            this.resolver.call(ACTION_MDM_URI, "set_adb_state", null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+    }
+
+    public boolean hasVirtualKeyEnable(String key) {
+        boolean isEnabled = false;
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras.putString("get_key_state", key);
+            extras = this.resolver.call(ACTION_MDM_URI, "get_key_state", null, extras);
+            if (extras != null) {
+                isEnabled = extras.getBoolean("get_key_state", false);
+            }
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+        return !isEnabled;
+    }
+
+    public void setVirtualKeyEnable(String key, boolean enable) {
+        if (this.resolver == null) {
+            this.resolver = this.mContext.getContentResolver();
+        }
+        if (this.resolver.acquireContentProviderClient(ACTION_MDM_URI) != null) {
+            Log.d("act-mdm", "find provider " + ACTION_MDM_URI);
+            Bundle extras = new Bundle();
+            extras.putString("set_key_state_key", key);
+            extras.putBoolean("set_key_state_value", !enable);
+            this.resolver.call(ACTION_MDM_URI, "set_key_state", null, extras);
+        } else {
+            Log.d("act-mdm", "Could Not Find Provider " + ACTION_MDM_URI);
+        }
+    }
+
+}

+ 585 - 0
app/src/main/java/com/action/actionscaner/ScanerApi.java

@@ -0,0 +1,585 @@
+package com.action.actionscaner;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.net.Uri;
+import android.os.Bundle;
+import sto.android.os.SystemProperties;
+import android.text.TextUtils;
+import android.util.Log;
+
+public class ScanerApi {
+
+    private static final String TAG = "ActScaner";
+    private Context mContext;
+    private ContentResolver resolver = null;
+    private static final Uri ACTION_SCAN_URI = Uri.parse("content://com.action.actionscaner.scanerprovider");
+    private static final Uri ACTION_SCAN_URI_ZEBRA = Uri.parse("content://com.action.zebrascaner.zebrascanerprovider");
+
+    private static final String IS_ENABLE_SCANER = "is_enable_scaner";
+    private static final String SET_ENABLE_SCANER = "set_enable_scaner";
+    private static final String IS_VIBRATOR = "is_vibrator";
+    private static final String SET_VIBRATOR = "set_vibrator";
+    private static final String GET_PLAY_SOUND = "get_play_sound";
+    private static final String IS_PLAY_SOUND = "is_play_sound";
+    private static final String SET_PLAY_SOUND = "set_play_sound";
+    private static final String GET_SCAN_DATA_OUTPUT = "get_scan_data_output";
+    private static final String SET_SCAN_DATA_OUTPUT = "set_scan_data_output";
+    private static final String IS_AUTO_INPUT = "is_auto_input";
+    private static final String SET_AUTO_INPUT = "set_auto_input";
+    private static final String IS_AUTO_JUMP = "is_auto_jump";
+    private static final String SET_AUTO_JUMP = "set_auto_jump";
+    private static final String IS_UNINTERRUPTED = "is_uninterrupted";
+    private static final String SET_UNINTERRUPTED = "set_uninterrupted";
+    private static final String SET_UNINTERRUPTED_TIME = "set_uninterrupted_time";
+    private static final String GET_LIGHTS_MODE = "get_lights_mode";
+    private static final String SET_LIGHTS_MODE = "set_lights_mode";
+    private static final String GET_SCANER_PARAMETER = "get_scaner_parameter";
+    private static final String SET_SCANER_PARAMETER = "set_scaner_parameter";
+    private static final String GET_SCANER_ALL_PARAMETER = "get_scaner_all_parameter";
+    private static final String SET_SCANER_ALL_PARAMETER = "set_scaner_all_parameter";
+    private static final String IS_BOOL = "is_bool";
+    private static final String CUSTOM_VALUE_KEY = "custom-value-key";
+    private static final String GET_SCANER_INFO = "get_scaner_info";
+    private static final String SCANER_ABOUT = "scaner_about";
+    private static final String CUSTOM_SCAN = "custom_scan";
+    private static final String CUSTOM_STOP_LONGLIGHT = "custom_stop_longlight";
+    private String scannerType = null;
+
+    public ScanerApi(Context context) {
+        this.mContext = context;
+        resolver = mContext.getContentResolver();
+        scannerType = SystemProperties.get("persist.camera.scanner.vendor", "hsm");
+        if(scannerType.equals("")||scannerType == null){
+            scannerType = "hsm";
+        }
+        Log.e(TAG,"scannerType = "+scannerType);
+    }
+
+    public boolean isEnableScaner() {
+        boolean isEnable = false;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, IS_ENABLE_SCANER, null, extras);
+                    if (extras != null)
+                        isEnable = extras.getBoolean(IS_ENABLE_SCANER, false);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI, IS_ENABLE_SCANER, null, extras);
+                    if (extras != null)
+                        isEnable = extras.getBoolean(IS_ENABLE_SCANER, false);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+
+        return isEnable;
+    }
+
+    public void setEnableScaner(boolean enabled) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras.putBoolean(SET_ENABLE_SCANER, enabled);
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, SET_ENABLE_SCANER, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras.putBoolean(SET_ENABLE_SCANER, enabled);
+                    extras = resolver.call(ACTION_SCAN_URI, SET_ENABLE_SCANER, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+    }
+
+    public boolean isVibrator() {
+        boolean isvibrator = false;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, IS_VIBRATOR, null, extras);
+                    if (extras != null)
+                        isvibrator = extras.getBoolean(IS_VIBRATOR, false);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI, IS_VIBRATOR, null, extras);
+                    if (extras != null)
+                        isvibrator = extras.getBoolean(IS_VIBRATOR, false);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+        return isvibrator;
+    }
+
+    public void setVibrator(boolean vibrator) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras.putBoolean(SET_VIBRATOR, vibrator);
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, SET_VIBRATOR, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras.putBoolean(SET_VIBRATOR, vibrator);
+                    extras = resolver.call(ACTION_SCAN_URI, SET_VIBRATOR, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+    }
+
+    public boolean isPlaySound() {
+        boolean isSound = false;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, GET_PLAY_SOUND, null, extras);
+                    if (extras != null) {
+                        int soundsMode = 0;
+                        if(extras.getInt(GET_PLAY_SOUND, 0)==0) {
+                            isSound = false;
+                        } else {
+                            isSound = true;
+                        }
+                    }
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI, IS_PLAY_SOUND, null, extras);
+                    if (extras != null)
+                        isSound = extras.getBoolean(IS_PLAY_SOUND, false);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+        return isSound;
+    }
+
+    public void setPlaySound(boolean isSound) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    if (isSound) {
+                        extras.putInt(SET_PLAY_SOUND, 2);
+                    } else {
+                        extras.putInt(SET_PLAY_SOUND, 0);
+                    }
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, SET_PLAY_SOUND, null, extras);
+
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras.putBoolean(SET_PLAY_SOUND, isSound);
+                    extras = resolver.call(ACTION_SCAN_URI, SET_PLAY_SOUND, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+    }
+
+    public boolean isAutoInput() {
+        boolean autoInput = false;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, GET_SCAN_DATA_OUTPUT, null, extras);
+                    if (extras != null) {
+                        int outPutType = 0;
+                        if(extras.getInt(GET_SCAN_DATA_OUTPUT, 0)==0) {
+                            autoInput = true;
+                        } else {
+                            autoInput = false;
+                        }
+                    }
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI, IS_AUTO_INPUT, null, extras);
+                    if (extras != null)
+                        autoInput = extras.getBoolean(IS_AUTO_INPUT, false);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+        return autoInput;
+    }
+
+    public void setAutoInput(boolean autoInput) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    if (autoInput) {
+                        extras.putInt(SET_SCAN_DATA_OUTPUT, 0);
+                    } else {
+                        extras.putInt(SET_SCAN_DATA_OUTPUT, 3);
+                    }
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, SET_SCAN_DATA_OUTPUT, null, extras);
+
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras.putBoolean(SET_AUTO_INPUT, autoInput);
+                    extras = resolver.call(ACTION_SCAN_URI, SET_AUTO_INPUT, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+    }
+
+    public boolean isAutoJump() {
+        boolean autoJump = false;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            Bundle extras = new Bundle();
+            extras = resolver.call(ACTION_SCAN_URI, IS_AUTO_JUMP, null, extras);
+            autoJump = extras.getBoolean(IS_AUTO_JUMP, false);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+        return autoJump;
+    }
+
+    public void setAutoJump(boolean autoJump) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            Bundle extras = new Bundle();
+            extras.putBoolean(SET_AUTO_JUMP, autoJump);
+            extras = resolver.call(ACTION_SCAN_URI, SET_AUTO_JUMP, null, extras);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+    }
+
+    public boolean isUninterrupted() {
+        boolean is_uninterrupted = false;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, IS_UNINTERRUPTED, null, extras);
+                    if (extras != null)
+                        is_uninterrupted = extras.getBoolean(IS_UNINTERRUPTED, false);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI, IS_UNINTERRUPTED, null, extras);
+                    if (extras != null)
+                        is_uninterrupted = extras.getBoolean(IS_UNINTERRUPTED, false);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+        return is_uninterrupted;
+    }
+
+    public void setUninterrupted(boolean uninterrupted) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras.putBoolean(SET_UNINTERRUPTED, uninterrupted);
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, SET_UNINTERRUPTED, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras.putBoolean(SET_UNINTERRUPTED, uninterrupted);
+                    extras = resolver.call(ACTION_SCAN_URI, SET_UNINTERRUPTED, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+    }
+
+    public void setUninterruptedTime(int uninterruptedTime) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (uninterruptedTime < 0) {
+            return;
+        }
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras.putInt(SET_UNINTERRUPTED_TIME, uninterruptedTime);
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, SET_UNINTERRUPTED_TIME, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras.putInt(SET_UNINTERRUPTED_TIME, uninterruptedTime);
+                    extras = resolver.call(ACTION_SCAN_URI, SET_UNINTERRUPTED_TIME, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+    }
+
+    public int getLightsMode() {
+        int lightsMode = 3;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            Bundle extras = new Bundle();
+            extras = resolver.call(ACTION_SCAN_URI, GET_LIGHTS_MODE, null, extras);
+            lightsMode = extras.getInt(GET_LIGHTS_MODE, 3);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+        return lightsMode;
+    }
+
+    public void setLightsMode(int lightsMode) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            Bundle extras = new Bundle();
+            extras.putInt(SET_LIGHTS_MODE, lightsMode);
+            extras = resolver.call(ACTION_SCAN_URI, SET_LIGHTS_MODE, null, extras);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+    }
+
+    public Bundle getScanerAllParameter() {
+        Bundle extras = null;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            extras = new Bundle();
+            extras = resolver.call(ACTION_SCAN_URI, GET_SCANER_ALL_PARAMETER, null, extras);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+        return extras;
+    }
+
+    public void setScanerAllParameter(Bundle bundle) {
+        if (bundle == null) return;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            Bundle extras = resolver.call(ACTION_SCAN_URI, SET_SCANER_ALL_PARAMETER, null, bundle);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+    }
+
+    public Object getScanerParameter(String parameterKey) {
+        Object object = null;
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            Bundle extras = new Bundle();
+            extras.putString(GET_SCANER_PARAMETER, parameterKey);
+            extras = resolver.call(ACTION_SCAN_URI, GET_SCANER_PARAMETER, null, extras);
+            object = extras.get(GET_SCANER_PARAMETER);
+            //Log.d(TAG, "getScanerParameter value: " + object);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+        return object;
+    }
+
+    private void setScanerParameter(Bundle bundle) {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            //Bundle extras = new Bundle();
+            //extras.putString(SET_SCANER_PARAMETER, parameter);
+            bundle = resolver.call(ACTION_SCAN_URI, SET_SCANER_PARAMETER, null, bundle);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+    }
+
+    public void setScanerParameter(String parameterKey, boolean parameter) {
+        if (!TextUtils.isEmpty(parameterKey)) {
+            Bundle extras = new Bundle();
+            extras.putString(SET_SCANER_PARAMETER, parameterKey);
+            extras.putBoolean(IS_BOOL, true);
+            extras.putBoolean(CUSTOM_VALUE_KEY, parameter);
+            setScanerParameter(extras);
+        }
+    }
+
+    public void setScanerParameter(String parameterKey, String parameter) {
+        if (!TextUtils.isEmpty(parameterKey)) {
+            Bundle extras = new Bundle();
+            extras.putString(SET_SCANER_PARAMETER, parameterKey);
+            extras.putBoolean(IS_BOOL, false);
+            extras.putString(CUSTOM_VALUE_KEY, parameter);
+            setScanerParameter(extras);
+        }
+    }
+
+	/*
+	public void setScanerParameter(String parameterKey, int parameter) {
+		if (!TextUtils.isEmpty(parameterKey)) {
+	    	String para = parameterKey + "," + parameter;
+	    	setScanerParameter(para);
+		}
+	}*/
+
+    public String getScanerInfo() {
+        String info = "";
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, SCANER_ABOUT, null, extras);
+                    if (extras != null) {
+                        info = extras.getString(SCANER_ABOUT);
+                    }
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI, GET_SCANER_INFO, null, extras);
+                    if (extras != null)
+                        info = extras.getString(GET_SCANER_INFO);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+        return info;
+    }
+
+    public void scan() {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        Bundle extras = new Bundle();
+        switch(scannerType) {
+            case "zebra":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI_ZEBRA) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI_ZEBRA, CUSTOM_SCAN, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI_ZEBRA);
+                }
+                break;
+
+            case "hsm":
+                if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+                    extras = resolver.call(ACTION_SCAN_URI, CUSTOM_SCAN, null, extras);
+                } else {
+                    Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+                }
+                break;
+        }
+    }
+
+    public void stopLongLight() {
+        if (resolver == null)
+            resolver = mContext.getContentResolver();
+        if (resolver.acquireContentProviderClient(ACTION_SCAN_URI) != null) {
+            Log.d(TAG, "find provider " + ACTION_SCAN_URI);
+            Bundle extras = new Bundle();
+            extras = resolver.call(ACTION_SCAN_URI, CUSTOM_STOP_LONGLIGHT, null, extras);
+        } else {
+            Log.d(TAG, "Could Not Find Provider " + ACTION_SCAN_URI);
+        }
+    }
+}

+ 115 - 0
app/src/main/java/com/fxy/LauncherActivity.java

@@ -0,0 +1,115 @@
+package com.fxy;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.content.ContextCompat;
+
+import com.jaeger.library.StatusBarUtil;
+import com.fxy.baselibrary.base.BaseActivity;
+import com.fxy.baselibrary.language.other.CommSharedUtil;
+import com.fxy.constant.BaseConfig;
+import com.fxy.login.LoginActivity;
+
+import java.lang.reflect.Field;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import me.wangyuwei.particleview.ParticleView;
+
+/**
+ * 启动动画
+ * @author James.Jiang
+ * @date 2020-02-25
+ */
+public class LauncherActivity extends BaseActivity {
+    private Context mContext = this;
+    @BindView(R.id.pv_2)
+    ParticleView mPv2;
+
+    @Override
+    public boolean showToolBar() {
+        return false;
+    }
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_laucher;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle extras) {
+
+    }
+
+    @Override
+    public boolean isPlayMusic() {
+        return true;
+    }
+
+    @Override
+    protected void initView() {
+        StatusBarUtil.setColor(this, ContextCompat.getColor(this, R.color.md_blue_500), 0);
+        ButterKnife.bind(this);
+        // 更新欢迎语
+        setPvText();
+
+        // 注册启动动画监听
+        mPv2.setOnParticleAnimListener(new ParticleView.ParticleAnimListener() {
+            @Override
+            public void onAnimationEnd() {
+                Intent intent = new Intent(LauncherActivity.this, LoginActivity.class);
+                startActivity(intent);
+                finish();
+            }
+        });
+        mPv2.postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                mPv2.startAnim();
+            }
+        }, 150);
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return false;
+    }
+
+
+    private void setPvText(){
+        try {
+
+            CommSharedUtil commSharedUtil = CommSharedUtil.getInstance(LauncherActivity.this);
+
+            String welcomeTitle = BuildConfig.WELCOME_TITLE; //根据打包设置标题
+            String serviceType = commSharedUtil.getString(BaseConfig.SERVICE_TYPE,"PROD");
+            if (!serviceType.toUpperCase().equals("PROD")){
+                welcomeTitle = serviceType.toLowerCase()+" "+welcomeTitle;
+            }
+
+            //String welcomeTitle = BuildConfig.WELCOME_TITLE;
+            String versionNum   = BuildConfig.VERSION_NUM;
+
+            ParticleView particleView = findViewById(R.id.pv_2);
+
+            Field mParticleText = ParticleView.class.getDeclaredField("mParticleText");
+            mParticleText.setAccessible(true);
+            mParticleText.set(particleView,versionNum);
+
+            Field mHostText = ParticleView.class.getDeclaredField("mHostText");
+            mHostText.setAccessible(true);
+            mHostText.set(particleView,welcomeTitle);
+
+        }catch (NoSuchFieldException e) {
+            e.printStackTrace();
+        }catch (IllegalAccessException e)
+        {
+            e.printStackTrace();
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+
+    }
+
+}

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

@@ -0,0 +1,222 @@
+package com.fxy.adapter;
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.support.v4.content.ContextCompat;
+import android.support.v7.widget.RecyclerView;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.engine.DiskCacheStrategy;
+import com.bumptech.glide.request.RequestOptions;
+import com.luck.picture.lib.config.PictureConfig;
+import com.luck.picture.lib.config.PictureMimeType;
+import com.luck.picture.lib.entity.LocalMedia;
+import com.luck.picture.lib.tools.DateUtils;
+import com.luck.picture.lib.tools.StringUtils;
+import com.fxy.R;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * author:luck
+ * project:PictureSelector
+ * package:com.luck.pictureselector.adapter
+ * email:893855882@qq.com
+ * data:16/7/27
+ */
+public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.ViewHolder> {
+    public static final int TYPE_CAMERA = 1;
+    public static final int TYPE_PICTURE = 2;
+    private LayoutInflater mInflater;
+    private List<LocalMedia> list = new ArrayList<>();
+    //已上传
+    private ArrayList<String> ossPhotoList =new ArrayList<>();
+    private int selectMax = 9;
+    private Context context;
+    /**
+     * 点击添加图片跳转
+     */
+    private onAddPicClickListener mOnAddPicClickListener;
+
+    public interface onAddPicClickListener {
+        void onAddPicClick();
+    }
+
+    public GridImageAdapter(Context context, onAddPicClickListener mOnAddPicClickListener) {
+        this.context = context;
+        mInflater = LayoutInflater.from(context);
+        this.mOnAddPicClickListener = mOnAddPicClickListener;
+    }
+
+    public void setSelectMax(int selectMax) {
+        this.selectMax = selectMax;
+    }
+
+    public void setList(List<LocalMedia> list) {
+        this.list = list;
+    }
+
+    public class ViewHolder extends RecyclerView.ViewHolder {
+
+        ImageView mImg;
+        LinearLayout ll_del;
+        TextView tv_duration;
+
+        ViewHolder(View view) {
+            super(view);
+            mImg = view.findViewById(R.id.fiv);
+            ll_del = view.findViewById(R.id.ll_del);
+            tv_duration = view.findViewById(R.id.tv_duration);
+        }
+    }
+
+    @Override
+    public int getItemCount() {
+        if (list.size() < selectMax) {
+            return list.size() + 1;
+        } else {
+            return list.size();
+        }
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        if (isShowAddItem(position)) {
+            return TYPE_CAMERA;
+        } else {
+            return TYPE_PICTURE;
+        }
+    }
+
+    /**
+     * 创建ViewHolder
+     */
+    @Override
+    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
+        View view = mInflater.inflate(R.layout.item_filter_image, viewGroup, false);
+        return new ViewHolder(view);
+    }
+
+    private boolean isShowAddItem(int position) {
+        int size = list.size();
+        return position == size;
+    }
+
+    /**
+     * 设置值
+     */
+    @Override
+    public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
+        //少于8张,显示继续添加的图标
+        if (getItemViewType(position) == TYPE_CAMERA) {
+            viewHolder.mImg.setImageResource(R.drawable.ic_add_img);
+            viewHolder.mImg.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    mOnAddPicClickListener.onAddPicClick();
+                }
+            });
+            viewHolder.ll_del.setVisibility(View.INVISIBLE);
+        } else {
+            viewHolder.ll_del.setVisibility(View.VISIBLE);
+            viewHolder.ll_del.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    int index = viewHolder.getAdapterPosition();
+                    // 这里有时会返回-1造成数据下标越界,具体可参考getAdapterPosition()源码,
+                    // 通过源码分析应该是bindViewHolder()暂未绘制完成导致,知道原因的也可联系我~感谢
+                    if (index != RecyclerView.NO_POSITION) {
+                        list.remove(index);
+                        ossPhotoList.remove(index);//删除oss
+                        notifyItemRemoved(index);
+                        notifyItemRangeChanged(index, list.size());
+                        Log.i("delete position:", index + "--->remove after:" + list.size());
+                    }
+                }
+            });
+            LocalMedia media = list.get(position);
+            int mimeType = media.getMimeType();
+            String path;
+            if (media.isCut() && !media.isCompressed()) {
+                // 裁剪过
+                path = media.getCutPath();
+            } else if (media.isCompressed() || (media.isCut() && media.isCompressed())) {
+                // 压缩过,或者裁剪同时压缩过,以最终压缩过图片为准
+                path = media.getCompressPath();
+            } else {
+                // 原图
+                path = media.getPath();
+            }
+            // 图片
+            if (media.isCompressed()) {
+                Log.i("compress image result:", new File(media.getCompressPath()).length() / 1024 + "k");
+                Log.i("压缩地址::", media.getCompressPath());
+            }
+
+            Log.i("原图地址::", media.getPath());
+            int pictureType = PictureMimeType.isPictureType(media.getPictureType());
+            if (media.isCut()) {
+                Log.i("裁剪地址::", media.getCutPath());
+            }
+            long duration = media.getDuration();
+            viewHolder.tv_duration.setVisibility(pictureType == PictureConfig.TYPE_VIDEO
+                    ? View.VISIBLE : View.GONE);
+            if (mimeType == PictureMimeType.ofAudio()) {
+                viewHolder.tv_duration.setVisibility(View.VISIBLE);
+                Drawable drawable = ContextCompat.getDrawable(context, R.drawable.picture_audio);
+                StringUtils.modifyTextViewDrawable(viewHolder.tv_duration, drawable, 0);
+            } else {
+                Drawable drawable = ContextCompat.getDrawable(context, R.drawable.video_icon);
+                StringUtils.modifyTextViewDrawable(viewHolder.tv_duration, drawable, 0);
+            }
+            viewHolder.tv_duration.setText(DateUtils.timeParse(duration));
+            if (mimeType == PictureMimeType.ofAudio()) {
+                viewHolder.mImg.setImageResource(R.drawable.audio_placeholder);
+            } else {
+                RequestOptions options = new RequestOptions()
+                        .centerCrop()
+                        .placeholder(R.color.color_f6)
+                        .diskCacheStrategy(DiskCacheStrategy.ALL);
+                Glide.with(viewHolder.itemView.getContext())
+                        .load(path)
+                        .apply(options)
+                        .into(viewHolder.mImg);
+            }
+            //itemView 的点击事件
+            if (mItemClickListener != null) {
+                viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        int adapterPosition = viewHolder.getAdapterPosition();
+                        mItemClickListener.onItemClick(adapterPosition, v);
+                    }
+                });
+            }
+        }
+    }
+
+    private OnItemClickListener mItemClickListener;
+
+    public interface OnItemClickListener {
+        void onItemClick(int position, View v);
+    }
+
+    public void setOnItemClickListener(OnItemClickListener listener) {
+        this.mItemClickListener = listener;
+    }
+
+    public void setPhotoPath(String photoPath) {
+        ossPhotoList.add(photoPath);
+    }
+    public ArrayList getPhotoList(){
+        return ossPhotoList;
+    }
+}

+ 86 - 0
app/src/main/java/com/fxy/adapter/NewPhotoAdapter.java

@@ -0,0 +1,86 @@
+package com.fxy.adapter;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.widget.ImageView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.elvishew.xlog.XLog;
+import com.fxy.baselibrary.imageloader.GlideUtil;
+import com.fxy.R;
+
+import java.util.List;
+
+
+/**
+ * 项目名称:FingerCRM
+ * 类描述:新增图片适配器
+ * 创建人:lzy
+ * 创建时间:2016/10/12 15:59
+ * 修改人:COMP-021-2001
+ * 修改时间:2016/10/12 15:59
+ * 修改备注:
+ */
+public class NewPhotoAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
+    private Context mContext1;
+    private String first = "add_img";
+
+    public NewPhotoAdapter(Context context,  List<String> data) {
+
+        super(R.layout.item_add_img, data);
+         XLog.d("====data===="+data);
+        if (data.isEmpty()||!first.equals(data.get(data.size()-1))) {
+            getData().add(first);
+        }
+        this.mContext1 = context;
+
+    }
+
+    public String getFirst(){
+        return first;
+    }
+
+
+    @Override
+    public void addData(@NonNull String data) {
+
+        super.addData(getData().size() - 1, data);
+    }
+
+    @Override
+    protected void convert(BaseViewHolder helper, String item) {
+        XLog.d("=======helper.getLayoutPosition()=====" + helper.getLayoutPosition() + "====getData().size()====" + getData().size() + "========item==" + item);
+
+        if (first.equals(item)) {
+            helper.setImageResource(R.id.image, R.drawable.ic_add_img);
+            if (helper.getLayoutPosition() == 12) {
+                helper.setVisible(R.id.image, false);
+            }
+        } else {
+            XLog.d("=====GlideUtil=======" + item);
+            GlideUtil.getInstance().loadImage(mContext1, (ImageView) helper.getView(R.id.image), item, false);
+        }
+    }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 161 - 0
app/src/main/java/com/fxy/adapter/RcAdapterWholeChange.java

@@ -0,0 +1,161 @@
+package com.fxy.adapter;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.support.v7.widget.RecyclerView;
+import android.text.SpannableString;
+import android.text.Spanned;
+import android.text.style.ForegroundColorSpan;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+import com.elvishew.xlog.XLog;
+import com.fxy.baselibrary.views.MarqueeTextView;
+import com.fxy.R;
+
+import org.json.JSONException;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * 容器、批次 搜索列表
+ * @author guilin
+ * @date 2020/08/13
+ */
+
+public class RcAdapterWholeChange extends RecyclerView.Adapter<RcAdapterWholeChange.MyViewHolder> {
+    private Context context;
+    /**
+     * adapter传递过来的数据集合
+     */
+    private List<String> list = new ArrayList<>();
+    /**
+     * 需要改变颜色的text
+     */
+    private String text;
+
+    private Integer showDel=1;
+
+    /**
+     * 在MainActivity中设置text
+     */
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public RcAdapterWholeChange(Context context, List<String> list,int showDel) {
+        this.context = context;
+        this.list = list;
+
+        this.showDel = showDel;
+    }
+
+
+    @Override
+    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+        View itemSearch = LayoutInflater.from(context).inflate(R.layout.item_search, parent,false);
+        MyViewHolder holder = new MyViewHolder(itemSearch);
+        return holder;
+    }
+
+    @Override
+    public void onBindViewHolder(MyViewHolder holder, final int position) {
+        /**如果没有进行搜索操作或者搜索之后点击了删除按钮 我们会在MainActivity中把text置空并传递过来*/
+        if (text != null) {
+            //设置span
+            SpannableString string = matcherSearchText(Color.rgb(255, 0, 0), list.get(position), text);
+            holder.mTvText.setText(string);
+        } else {
+            holder.mTvText.setText(list.get(position));
+        }
+        //点击监听
+        holder.mLlItem.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                try {
+                    onItemClickListener.onClick(view, position);
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                    XLog.e("点击选中"+e.getMessage());
+                }
+            }
+        });
+        //删除按钮监控
+        holder.btnDel.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                try {
+                    onItemClickListener.onClick(view, position);
+                } catch (JSONException e) {
+                    e.printStackTrace();
+                    XLog.e("点击删除失败"+e.getMessage());
+                }
+            }
+        });
+    }
+
+    @Override
+    public int getItemCount() {
+        return list.size();
+    }
+
+
+    /**
+     * Recyclerview的点击监听接口
+     */
+    public interface onItemClickListener {
+        void onClick(View view, int pos) throws JSONException;
+    }
+
+    private onItemClickListener onItemClickListener;
+
+    public void setOnItemClickListener(RcAdapterWholeChange.onItemClickListener onItemClickListener) {
+        this.onItemClickListener = onItemClickListener;
+    }
+
+    class MyViewHolder extends RecyclerView.ViewHolder {
+        private LinearLayout mLlItem;
+        private MarqueeTextView mTvText;
+        private Button btnDel;
+        public MyViewHolder(View itemView) {
+            super(itemView);
+            mLlItem = (LinearLayout) itemView.findViewById(R.id.ll_item);
+            mTvText = (MarqueeTextView) itemView.findViewById(R.id.tv_text);
+            btnDel = (Button)itemView.findViewById(R.id.btn_del);
+            if (showDel==0){
+                btnDel.setVisibility(View.GONE);
+            }
+
+        }
+
+
+
+    }
+
+    /**
+     * 正则匹配 返回值是一个SpannableString 即经过变色处理的数据
+     */
+    private SpannableString matcherSearchText(int color, String text, String keyword) {
+        SpannableString spannableString = new SpannableString(text);
+        //条件 keyword
+        Pattern pattern = Pattern.compile(keyword);
+        //匹配
+        Matcher matcher = pattern.matcher(spannableString);
+        while (matcher.find()) {
+            int start = matcher.start();
+            int end = matcher.end();
+            //ForegroundColorSpan 需要new 不然也只能是部分变色
+            spannableString.setSpan(new ForegroundColorSpan(color), start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+        }
+        //返回变色处理的结果
+        return spannableString;
+    }
+
+}
+

+ 58 - 0
app/src/main/java/com/fxy/adapter/ShowImgAdapter.java

@@ -0,0 +1,58 @@
+package com.fxy.adapter;
+
+import android.content.Context;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.widget.ImageView;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.elvishew.xlog.XLog;
+import com.fxy.baselibrary.imageloader.GlideUtil;
+import com.fxy.R;
+
+import java.util.List;
+
+/**
+ * Created by lijie on 2018/4/10.
+ */
+
+public class ShowImgAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
+    private Context mContext;
+    private String first = "add_img";
+    private int maxNum = 12;
+    public ShowImgAdapter(Context context, @Nullable List<String> data) {
+        super(R.layout.item_add_img, data);
+        this.mContext = context;
+    }
+
+    public String getFirst(){
+        return first;
+    }
+
+    //shezhi
+    public void setMaxNum(int num){
+        maxNum = num;
+    }
+
+    @Override
+    public void addData(@NonNull String data) {
+        super.addData(data);
+    }
+
+    @Override
+    protected void convert(BaseViewHolder helper, String item) {
+        XLog.d("=======helper.getLayoutPosition()=====" + helper.getLayoutPosition() + "====getData().size()====" + getData().size() + "========item==" + item);
+        if (first.equals(item)) {
+            helper.setImageResource(R.id.image, R.drawable.ic_add_img);
+            if (helper.getLayoutPosition() == maxNum) {
+                helper.setGone(R.id.image, false);
+            }
+        } else {
+            XLog.d("=====GlideUtil=======" + item);
+            GlideUtil.getInstance().loadImage(mContext, (ImageView) helper.getView(R.id.image), item, false);
+        }
+    }
+}
+
+

+ 143 - 0
app/src/main/java/com/fxy/base/CrashHandler.java

@@ -0,0 +1,143 @@
+package com.fxy.base;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+
+import com.alibaba.fastjson.JSONException;
+
+import org.json.JSONObject;
+
+import com.fxy.constant.SPCache;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+import com.fxy.baselibrary.util.RxTimeTool;
+import com.fxy.BuildConfig;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.lang.Thread.UncaughtExceptionHandler;
+
+public class CrashHandler implements UncaughtExceptionHandler {
+    //系统默认的异常处理器
+    private Thread.UncaughtExceptionHandler defaultCrashHandler;
+    private static CrashHandler crashHandler = new CrashHandler();
+    private Context mContext;
+    //私有化构造函数
+    private CrashHandler() {
+    }
+    //获取实例
+    public static CrashHandler getInstance() {
+        return crashHandler;
+    }
+    public void init(Context context) {
+        mContext = context;
+        defaultCrashHandler = Thread.getDefaultUncaughtExceptionHandler();
+        //设置系统的默认异常处理器
+        Thread.setDefaultUncaughtExceptionHandler(this);
+    }
+    @Override
+    public void uncaughtException(Thread thread, Throwable throwable) {
+        //把错误信息保存在sp中,然后在下次进入页面的时候再上传错误信息
+        saveErrorInfo(throwable);
+        if (defaultCrashHandler != null) {
+            //如果在自定义异常处理器之前,系统有自己的默认异常处理器的话,调用它来处理异常信息
+            defaultCrashHandler.uncaughtException(thread, throwable);
+        } else {
+            android.os.Process.killProcess(android.os.Process.myPid());
+            System.exit(0);
+        }
+    }
+    public void sendError() {
+        //先不发送
+        try {
+            SharedPreferences sp = mContext.getSharedPreferences("errorInfo", Context.MODE_PRIVATE);
+            String data = sp.getString("data", "");
+            if (!data.isEmpty()) {
+                JSONObject jsonObject = new JSONObject();
+                jsonObject.put("content",data);
+                OkGo.<String>post(Urls.getServiceAddress(mContext) +Urls.RECORD_LOG).upJson(jsonObject.toString())
+                        .execute(new MyDialogCallback(mContext, false, false) {
+                            @Override
+                            public void onSuccess(Response<String> response) {
+                                try {
+                                    SharedPreferences sp = mContext.getSharedPreferences("errorInfo", Context.MODE_PRIVATE);
+                                    sp.edit().putString("data", "").apply();
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                                //XLog.e(response.body());
+                            }
+                            @Override
+                            public void onError(Response<String> response) {
+                            }
+                        });
+            }
+        } catch (JSONException | org.json.JSONException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void saveErrorInfo(Throwable throwable) {
+        try {
+            SharedPreferences sp = mContext.getSharedPreferences("errorInfo", Context.MODE_PRIVATE);
+            SPCache spCache = SPCache.getInstance(mContext);
+            String accountInfo   = spCache.getUserName()+"("+spCache.getAccountName()+")";
+            String stringBuffer = getAppInfo(mContext) +
+                    "崩溃本版:" + BuildConfig.BUILD_TYPE + "\n\n" +
+                    "崩溃时间:" + RxTimeTool.getCurTimeString() + "\n\n" +
+                    "设备系统:" + Build.VERSION.RELEASE + "\n\n" +
+                    "设备厂商:" + Build.MANUFACTURER + "\n\n" +
+                    "设备型号:" + Build.MODEL + "\n\n" +
+                    "账号信息:" + accountInfo + "\n\n" +
+                    "崩溃原因:" + throwable.getMessage() + "\n\n" +
+                    "详细信息:" + collectExceptionInfo(throwable);
+            sp.edit().putString("data", stringBuffer).apply();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    /**
+     * 获取捕获异常的信息
+     */
+    private String collectExceptionInfo(Throwable ex) {
+       try {
+           Writer mWriter = new StringWriter();
+           PrintWriter mPrintWriter = new PrintWriter(mWriter);
+           ex.printStackTrace(mPrintWriter);
+           ex.printStackTrace();
+           Throwable mThrowable = ex.getCause();
+           // 迭代栈队列把所有的异常信息写入writer中
+           while (mThrowable != null) {
+               mThrowable.printStackTrace(mPrintWriter);
+               // 换行 每个个异常栈之间换行
+               mPrintWriter.append("\r\n");
+               mThrowable = mThrowable.getCause();
+           }
+           // 记得关闭
+           mPrintWriter.close();
+           return mWriter.toString();
+       } catch (Exception e) {
+           e.printStackTrace();
+           return ex.getMessage();
+       }
+    }
+
+    /**
+     * 获取应用程序信息
+     */
+    public String getAppInfo(Context context) {
+        try {
+            PackageManager packageManager = context.getPackageManager();
+            PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
+            return "应用包名:" + packageInfo.packageName + "\n\n应用版本:" + packageInfo.versionName + "\n\n";
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "";
+    }
+}

+ 84 - 0
app/src/main/java/com/fxy/base/ScanBaseActivity.java

@@ -0,0 +1,84 @@
+package com.fxy.base;
+
+import android.content.Context;
+import android.os.Handler;
+import android.os.Message;
+
+import sto.android.app.StoJNI;
+import sto.android.app.StoTongJNI;
+
+public class ScanBaseActivity{
+    private Context mContext;
+    private KlScanActivity scanActivity;
+
+    public boolean initScanResults(Context context,Handler handler, String type){
+        if ("kaicom".equals(type)) {
+            scanActivity = new KlScanActivity(context, handler);
+            scanActivity.start();
+
+            return true;
+        }
+        return false;
+    }
+    public void scanStop(String type){
+        if ("kaicom".equals(type)) {
+            if (scanActivity != null) {
+                scanActivity.stop();
+            }
+        }
+    }
+}
+
+class KlScanActivity implements StoJNI.ScanCallBack {
+    private Handler scanHandler;
+    private Context mContext;
+    @Override
+    public void onScanResults(String str) {
+        Message msg = new Message();
+        msg.obj = str;
+        scanHandler.sendMessage(msg);
+    }
+
+    @Override
+    public void onScanResults(String str, int type) {
+
+    }
+
+    public void start(){
+        String pdaBrand = StoTongJNI.getmPdaBrand();
+        if (!pdaBrand.isEmpty()){
+            StoTongJNI.getIns(mContext).setmScanCB(this);
+            StoTongJNI.getIns(mContext).SetScannerOn();
+        }
+    }
+
+    public void stop(){
+        StoTongJNI.getIns(mContext).SetScannerStop();
+        StoTongJNI.getIns(mContext).SetScannerOff();
+    }
+
+    KlScanActivity(Context context,Handler handler){
+        scanHandler = handler;
+        mContext = context;
+    }
+}
+
+//多方方法
+class DdScanActivity implements StoJNI.ScanCallBack {
+    private Handler scanHandler;
+    @Override
+    public void onScanResults(String str) {
+        Message msg = new Message();
+        msg.obj = str;
+        scanHandler.sendMessage(msg);
+    }
+
+    @Override
+    public void onScanResults(String str, int type) {
+
+    }
+
+    public DdScanActivity(Handler handler){
+        scanHandler = handler;
+    }
+}

+ 364 - 0
app/src/main/java/com/fxy/base/ServiceSettingActivity.java

@@ -0,0 +1,364 @@
+package com.fxy.base;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+import com.elvishew.xlog.XLog;
+import com.jaredrummler.materialspinner.MaterialSpinner;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+import com.fxy.baselibrary.base.BaseActivity;
+import com.fxy.baselibrary.language.other.CommSharedUtil;
+import com.fxy.BuildConfig;
+import com.fxy.R;
+import com.fxy.constant.BaseConfig;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import butterknife.Unbinder;
+
+/**
+ * 服务设置
+ * @author James.Jiang
+ * @Date 2020-01-06
+ */
+public class ServiceSettingActivity extends BaseActivity {
+    private Context mContext = this;
+    //客户端服务区选择
+    @BindView(R.id.ms_service_address)
+    MaterialSpinner serviceAddressSpinner;
+
+    @BindView(R.id.ms_env)
+    MaterialSpinner envSpinner;
+
+    @BindView(R.id.ll_env)
+    LinearLayout llEnv;
+
+    private Integer envSelectId=0;
+
+    //客户端选择
+    @BindView(R.id.ms_client)
+    MaterialSpinner clientSpinner;
+
+    private Unbinder unbinder;
+
+    @BindView(R.id.btn_service_test)
+    Button btnTest;
+
+    @BindView(R.id.btn_service_save)
+    Button btnSave;
+
+    //仓库选中
+    private Integer selectId=0;
+
+    //客户端
+    private Integer clientSelectId=0;
+
+    private String selectAreaCode="";
+
+    private String selectClientCode = "";
+
+    private String serviceType = "PROD";
+
+    private JSONArray clientArray =  new JSONArray() ;
+    // 定义服务地址集合
+    private List<Map<String, String>> clientMapList = new ArrayList<>();
+
+    //环境集合
+    private List<Map<String, String>> envMapList = new ArrayList<>();
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_setting;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean isPlayMusic() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return false;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle extras) {
+
+    }
+    // 定义服务地址集合
+    private List<Map<String, String>> addressMapList = new ArrayList<>();
+
+    private  List<String> envSpinnerList = new ArrayList<String>();
+    private  List<String> clientSpinnerList = new ArrayList<String>();
+    private  List<String> addressSpinnerList = new ArrayList<String>();
+    @Override
+    protected void initView() {
+        unbinder = ButterKnife.bind(this);
+
+        //正式隐藏
+        if (!BuildConfig.DEBUG){
+            llEnv.setVisibility(View.GONE);
+        }
+
+        setTitleName(getString(R.string.str_setting));
+        //不同客户端
+        CommSharedUtil commSharedUtil = CommSharedUtil.getInstance(ServiceSettingActivity.this);
+        selectAreaCode = commSharedUtil.getString(BaseConfig.AREA_CODE);
+        selectClientCode = commSharedUtil.getString(BaseConfig.CLIENT_CODE);
+        serviceType =  commSharedUtil.getString(BaseConfig.SERVICE_TYPE,"prod");
+
+        loadClientData();
+        initSpinner();
+        initEnvSpinner();
+
+        getFmsHost();
+
+    }
+
+    /**
+     * 设置客户端类型
+     */
+    private void loadClientData(){
+        try {
+            String clientStr = "[{\"name\":\"FXY\",\"code\":\"fxy\"}]";
+
+
+            JSONArray jsonArray = new JSONArray(clientStr);
+            for (int i = 0;i < jsonArray.length(); i++){
+                Map<String,String> hostMap = new HashMap<>();
+                JSONObject jsonObject = jsonArray.getJSONObject(i);
+                hostMap.put("name",jsonObject.getString("name"));
+                hostMap.put("code",jsonObject.getString("code"));
+                clientMapList.add(hostMap);
+                clientSpinnerList.add(jsonObject.getString("name"));
+                //selectClientCode
+                if (jsonObject.getString("code").equals(selectClientCode)){
+                    clientSelectId = i;
+                }
+            }
+
+
+            String envStr = "[{\"name\":\"正式环境\",\"code\":\"PROD\"},{\"name\":\"UAT环境\",\"code\":\"UAT\"}," +
+                    "{\"name\":\"开发者环境\",\"code\":\"dev\"},{\"name\":\"测试环境\",\"code\":\"test\"}]";
+            JSONArray envJsonArray = new JSONArray(envStr);
+
+            
+            for (int i = 0;i < envJsonArray.length(); i++){
+                Map<String,String> hostMap = new HashMap<>();
+                JSONObject jsonObject = envJsonArray.getJSONObject(i);
+                hostMap.put("name",jsonObject.getString("name"));
+                hostMap.put("code",jsonObject.getString("code"));
+                envMapList.add(hostMap);
+                envSpinnerList.add(jsonObject.getString("name"));
+                //selectClientCode
+                if (jsonObject.getString("code").equals(serviceType)){
+                    envSelectId = i;
+                }
+            }
+            
+            
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+    }
+    public void getFmsHost(){
+        addressMapList = new ArrayList<>();
+        addressSpinnerList.clear();
+        OkGo.<String>get(Urls.getFmsHostUrl(mContext))
+                .params("v", new Date().getTime())
+                .execute(new MyDialogCallback(this,false,false) {
+                    @Override
+                    public void onSuccess(Response<String> response) {
+                        try {
+                            JSONObject jsonBody = new JSONObject(response.body());
+                            JSONObject hostList= jsonBody.getJSONObject(serviceType.toLowerCase());
+                            for (Iterator item = hostList.keys();item.hasNext();) {
+                                String areaCode = (String) item.next();
+                                JSONObject tmpObject = hostList.getJSONObject(areaCode);
+                                Map<String,String> hostMap = new HashMap<>();
+                                hostMap.put("name",tmpObject.getString("name"));
+                                hostMap.put("hostUrl",tmpObject.getString("hostUrl"));
+                                hostMap.put("warehouse","[]");
+                                hostMap.put("serve",serviceType);
+                                hostMap.put("areaCode",areaCode);
+                                addressMapList.add(hostMap);
+                                addressSpinnerList.add(tmpObject.getString("name"));
+                                if (selectAreaCode!=null && selectAreaCode.equals(areaCode)){
+                                    selectId = addressMapList.size()-1;
+                                }
+                            }
+
+                            initAddressSpinner();
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            XLog.e("获取服务配置错误:",e);
+                        }
+                    }
+                });
+    }
+
+
+    /**
+     *  初始化下拉框控件值
+     */
+    private void initSpinner() {
+
+        clientSpinner.setItems(clientSpinnerList);
+        // 设置当前选中值
+        clientSpinner.setSelectedIndex(clientSelectId);
+        clientSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener(){
+            @Override
+            public void onItemSelected(MaterialSpinner view, int position, long id, Object item) {
+                clientSelectId = position;
+                //初始化默认
+                selectId = 0;
+                if (clientSelectId==1){
+                    getFmsHost();
+                }
+
+            }
+        });
+
+        
+    }
+    private void initAddressSpinner() {
+        serviceAddressSpinner.setItems(addressSpinnerList);
+        // 设置当前选中值
+        serviceAddressSpinner.setSelectedIndex(selectId);
+        serviceAddressSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() {
+            @Override
+            public void onItemSelected(MaterialSpinner view, int position, long id, Object item) {
+                selectId = position;
+            }
+        });
+    }
+
+    //监听环境变化
+    private void initEnvSpinner() {
+        envSpinner.setItems(envSpinnerList);
+        // 设置当前选中值
+        envSpinner.setSelectedIndex(envSelectId);
+        envSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() {
+            @Override
+            public void onItemSelected(MaterialSpinner view, int position, long id, Object item) {
+                envSelectId = position;
+                selectId = 0;
+                String currentServe = envMapList.get(position).get("code");
+                //类型不一致更新
+                if (!currentServe.equals(serviceType)){
+                    serviceType = currentServe;
+                    getFmsHost();
+                }
+            }
+        });
+    }
+
+
+    /**
+     * 根据名称获取服务地址
+     * @param name
+     * @return
+     */
+    private Map<String,String> getServiceAddress(String name){
+        if(addressMapList.size() > 0){
+            for (int i = 0; i < addressMapList.size();i++){
+                String name1 = addressMapList.get(i).get("name");
+                if( name1.equals(name)){
+                    return addressMapList.get(i);
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 绑定按钮事件(测试&保存)
+     * @param view
+     * @throws Exception
+     */
+    @OnClick({R.id.btn_service_test,R.id.btn_service_save})
+    public void onViewClicked(View view){
+        try {
+            String serviceName = serviceAddressSpinner.getText().toString();
+            Map<String,String> mapService = getServiceAddress(serviceName);
+
+            Map<String,String> mapClient = clientMapList.get(clientSelectId);
+            String serviceAddress = mapService.get("hostUrl");
+            String warehouse = mapService.get("warehouse");
+//            if (mapClient.get("code").equals("dhwms")){
+//                if (warehouse.equals("[]")){
+//                    showWarningToast(getString(R.string.error_unusable_warehouse));
+//                    return;
+//                }
+//            }
+            switch (view.getId()) {
+                // 服务测试
+                case R.id.btn_service_test:
+                    OkGo.<String>get(serviceAddress + Urls.CHECK_SERVICE)
+                            .execute(new MyDialogCallback(this, false, false) {
+                                @Override
+                                public void onSuccess(Response<String> response) {
+                                    showSuccessToast("服务连接正常");
+                                }
+
+                                @Override
+                                public void onError(Response<String> response) {
+                                    super.onError(response);
+                                    showWarningToast(response.body());
+                                }
+                            });
+                    break;
+                // 服务保存
+                case R.id.btn_service_save:
+                    CommSharedUtil commSharedUtil = CommSharedUtil.getInstance(ServiceSettingActivity.this);
+                    commSharedUtil.putString(BaseConfig.SERVICE_ADDRESS, serviceAddress);
+                    commSharedUtil.putString(BaseConfig.WAREHOUSE_LIST, warehouse);
+
+                    commSharedUtil.putString(BaseConfig.SERVICE_TYPE, mapService.get("serve"));
+                    commSharedUtil.putString(BaseConfig.AREA_CODE, mapService.get("areaCode"));
+                    commSharedUtil.putString(BaseConfig.CLIENT_CODE,  mapClient.get("code"));
+
+                    showSuccessToast(getString(R.string.str_save_success));
+
+                    Intent intent = new Intent();
+                    setResult(200, intent);//返回值,2 是改返回的标志,也会返回
+                    finish();
+
+                    finish();
+                    break;
+            }
+        } catch (Exception e) {
+
+            e.printStackTrace();
+        }
+    }
+    @Override
+    protected void onDestroy() {
+        unbinder.unbind();
+        super.onDestroy();
+    }
+}

+ 154 - 0
app/src/main/java/com/fxy/base/SetLanguageActivity.java

@@ -0,0 +1,154 @@
+package com.fxy.base;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import com.fxy.baselibrary.base.BaseActivity;
+import com.fxy.baselibrary.language.other.LanguageType;
+import com.fxy.baselibrary.language.other.MultiLanguageUtil;
+import com.fxy.baselibrary.util.StringUtils;
+import com.fxy.R;
+import com.fxy.constant.SPCache;
+import com.fxy.login.LoginActivity;
+import com.fxy.main.MainActivity;
+
+/**
+ * 设置语言页面
+ */
+public class SetLanguageActivity extends BaseActivity implements View.OnClickListener {
+
+    private RelativeLayout rl_followsytem;
+    private RelativeLayout rl_simplified_chinese;
+    private RelativeLayout rl_traditional_chinese;
+    private RelativeLayout rl_english;
+    private ImageView iv_english;
+    private ImageView iv_followsystem;
+    private ImageView iv_simplified_chinese;
+    private ImageView iv_traditional_chinese;
+    private int savedLanguageType;
+
+
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_set_language;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return false;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return false;
+    }
+
+    @Override
+    public boolean isPlayMusic() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle extras) {
+
+    }
+
+    @Override
+    protected void initView() {
+        setTitleName("设置语言");
+        rl_followsytem = findViewById(R.id.rl_followsytem);
+        rl_simplified_chinese = findViewById(R.id.rl_simplified_chinese);
+        rl_traditional_chinese = findViewById(R.id.rl_traditional_chinese);
+        rl_english = findViewById(R.id.rl_english);
+        iv_followsystem = findViewById(R.id.iv_followsystem);
+        iv_english = findViewById(R.id.iv_english);
+        iv_simplified_chinese = findViewById(R.id.iv_simplified_chinese);
+        iv_traditional_chinese = findViewById(R.id.iv_traditional_chinese);
+        rl_followsytem.setOnClickListener(this);
+        rl_simplified_chinese.setOnClickListener(this);
+        rl_traditional_chinese.setOnClickListener(this);
+        rl_english.setOnClickListener(this);
+        savedLanguageType = MultiLanguageUtil.getInstance().getLanguageType();
+        if (savedLanguageType == LanguageType.LANGUAGE_FOLLOW_SYSTEM) {
+            setFollowSytemVisible();
+        } else if (savedLanguageType == LanguageType.LANGUAGE_CHINESE_TRADITIONAL) {
+            setTraditionalVisible();
+        } else if (savedLanguageType == LanguageType.LANGUAGE_EN) {
+            setEnglishVisible();
+        } else if (savedLanguageType == LanguageType.LANGUAGE_CHINESE_SIMPLIFIED) {
+            setSimplifiedVisible();
+        } else {
+            setSimplifiedVisible();
+        }
+    }
+
+    @Override
+    public void onClick(View view) {
+        int id = view.getId();
+        int selectedLanguage = 0;
+        switch (id) {
+            case R.id.rl_followsytem:
+                setFollowSytemVisible();
+                selectedLanguage = LanguageType.LANGUAGE_FOLLOW_SYSTEM;
+                break;
+            case R.id.rl_simplified_chinese:
+                setSimplifiedVisible();
+                selectedLanguage = LanguageType.LANGUAGE_CHINESE_SIMPLIFIED;
+
+                break;
+            case R.id.rl_traditional_chinese:
+                setTraditionalVisible();
+                selectedLanguage = LanguageType.LANGUAGE_CHINESE_TRADITIONAL;
+
+                break;
+            case R.id.rl_english:
+                setEnglishVisible();
+                selectedLanguage = LanguageType.LANGUAGE_EN;
+                break;
+        }
+        MultiLanguageUtil.getInstance().updateLanguage(selectedLanguage);
+        if (StringUtils.isEmpty(SPCache.getInstance(SetLanguageActivity.this).getToken())) {
+            Intent intent = new Intent(SetLanguageActivity.this, LoginActivity.class);
+            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+            startActivity(intent);
+        }else{
+            Intent intent = new Intent(SetLanguageActivity.this, MainActivity.class);
+            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+            startActivity(intent);
+        }
+        if (selectedLanguage == LanguageType.LANGUAGE_FOLLOW_SYSTEM) {
+            System.exit(0);
+        }
+
+    }
+
+    private void setSimplifiedVisible() {
+        iv_followsystem.setVisibility(View.GONE);
+        iv_english.setVisibility(View.GONE);
+        iv_simplified_chinese.setVisibility(View.VISIBLE);
+        iv_traditional_chinese.setVisibility(View.GONE);
+    }
+
+    private void setEnglishVisible() {
+        iv_followsystem.setVisibility(View.GONE);
+        iv_english.setVisibility(View.VISIBLE);
+        iv_simplified_chinese.setVisibility(View.GONE);
+        iv_traditional_chinese.setVisibility(View.GONE);
+    }
+
+    private void setTraditionalVisible() {
+        iv_followsystem.setVisibility(View.GONE);
+        iv_english.setVisibility(View.GONE);
+        iv_simplified_chinese.setVisibility(View.GONE);
+        iv_traditional_chinese.setVisibility(View.VISIBLE);
+    }
+
+    private void setFollowSytemVisible() {
+        iv_followsystem.setVisibility(View.VISIBLE);
+        iv_english.setVisibility(View.GONE);
+        iv_simplified_chinese.setVisibility(View.GONE);
+        iv_traditional_chinese.setVisibility(View.GONE);
+    }
+}

+ 227 - 0
app/src/main/java/com/fxy/base/ShowImgActivity.java

@@ -0,0 +1,227 @@
+package com.fxy.base;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.Handler;
+import android.os.Message;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.Toast;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.elvishew.xlog.XLog;
+import com.fxy.baselibrary.util.RxFileTool;
+import com.fxy.baselibrary.util.RxImageTool;
+import com.fxy.baselibrary.views.dialog.RxDialogChooseImage;
+import com.fxy.baselibrary.views.dialog.RxDialogZoomImageView;
+import com.fxy.adapter.ShowImgAdapter;
+
+import org.json.JSONObject;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+/**
+ * 遗弃
+ */
+
+@SuppressLint("Registered")
+public class ShowImgActivity extends Activity {
+    private String prefix="tally";
+    private Context mContext;
+    private RecyclerView mRvShowImg ;
+    private ShowImgAdapter mPhotoAdapter;
+    private ArrayList<String>imgPathList=new ArrayList<>();
+    private ArrayList<String> ossPhotoList =new ArrayList<>();
+
+
+    private int imgCount = 0;
+    protected static final int REQUESTCODE_CAMERA = 5001 ;
+    protected static final int GET_IMAGE_BY_CAMERA = 5002 ;
+
+
+    private RxDialogChooseImage rxDialogChooseImage;
+
+
+
+    public ShowImgActivity(Context context, RecyclerView rvShowImg){
+        mContext = context;
+        mRvShowImg = rvShowImg;
+        initAdapter();
+    }
+
+    public ArrayList getPhotoList(){
+        return  ossPhotoList;
+    }
+
+
+    public void remove(){
+        uploadHandler.removeCallbacksAndMessages(null);
+    }
+
+    public void emptyRemake(){
+        imgPathList.clear();
+        ossPhotoList.clear();
+        imgPathList.add(mPhotoAdapter.getFirst());
+        mPhotoAdapter.notifyDataSetChanged();
+    }
+
+    public void setMaxNum(int num){
+        mPhotoAdapter.setMaxNum(num);
+    }
+    public void setPrefix(String str){
+        prefix = str;
+    }
+
+    private void initAdapter() {
+
+        mPhotoAdapter = new ShowImgAdapter(mContext, imgPathList);
+        mPhotoAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
+
+        //用于实现网格布局
+        GridLayoutManager manager = new GridLayoutManager(mContext, 3);
+        manager.setOrientation(GridLayoutManager.VERTICAL);
+        mRvShowImg.setLayoutManager(manager);
+
+
+        mRvShowImg.setAdapter(mPhotoAdapter);
+        //XLog.d("imgList: " +imgPathList.toString());
+        mPhotoAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
+            @Override
+            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
+                if (position<imgPathList.size()-1){
+                    RxDialogZoomImageView rxDialogZoomImageView = new RxDialogZoomImageView(mContext);
+                    rxDialogZoomImageView.setImagePath(imgPathList.get(position));
+                    rxDialogZoomImageView.show();
+                }else{
+                    rxDialogChooseImage = new RxDialogChooseImage((Activity) mContext);
+                    rxDialogChooseImage.show();
+                }
+            }
+        });
+        imgPathList.add(mPhotoAdapter.getFirst());
+        mPhotoAdapter.notifyDataSetChanged();
+    }
+
+
+    public void getFile(int requestCode, int resultCode, Intent data){
+        switch(requestCode) {
+            case REQUESTCODE_CAMERA:
+                // 设置显示的图片
+                //mUploadView.getProgressImage().setImageBitmap(bitmap);
+                //final Bitmap photo = data.getParcelableExtra("data");
+
+                if (data != null) {
+                    try {
+                        if (data.getData() != null)
+                        {
+                            Uri imageUri = data.getData();
+                            File file =  RxFileTool.getFilePhotoFromUri((Activity) mContext,imageUri);
+                            String filePath = file.getPath();
+                            new UploadThread(filePath);
+//                            OssUploadUtil ossUploadUtil = new OssUploadUtil(mContext,prefix);
+//                            OSSAsyncTask task = ossUploadUtil.uploadFiledUrl(filePath,new JSONObject(),uploadHandler);
+                            return;
+                        }
+                        Bundle bundle = data.getExtras();
+                        Bitmap bitmap = (Bitmap) bundle.get("data"); //get bitmap
+
+
+//                        Uri imageUri = Uri.parse(MediaStore.Images.Media.insertImage(mContext.getContentResolver(),bitmap,null,null));
+//                        File file =  RxFileTool.getFilePhotoFromUri((Activity) mContext,imageUri);
+//                        new UploadThread(file.getPath());
+
+                        if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+                            String name = new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
+                            String cameraFilePath = Environment.getExternalStorageDirectory().toString()+ File.separator+"temp/image/"+name+".jpg";
+                            RxImageTool.save(bitmap,cameraFilePath,Bitmap.CompressFormat.JPEG);
+                            new UploadThread(cameraFilePath);
+                        } else {
+                            Toast.makeText(mContext, "保存失败,SD卡无效", Toast.LENGTH_LONG).show();
+                        }
+                    } catch (Exception e) {
+                        XLog.e("拍照获取图片错误,错误原因:"+e.getMessage());
+                    }
+                } else {
+                    //无法获取
+                    Toast.makeText(mContext, "err****", Toast.LENGTH_LONG).show();
+                    return;
+                }
+
+                break;
+            case GET_IMAGE_BY_CAMERA:
+
+                try {
+                    if (resultCode == RESULT_CANCELED) {
+                        Toast.makeText(mContext, "点击取消从相册选择", Toast.LENGTH_LONG).show();
+                        return;
+                    }
+                    if(resultCode == RESULT_OK){
+                        Uri imageUri = data.getData();
+                        File file =  RxFileTool.getFilePhotoFromUri((Activity) mContext,imageUri);
+//                        String filePath = file.getPath();
+//                        OssUploadUtil ossUploadUtil = new OssUploadUtil(mContext,prefix);
+//                        OSSAsyncTask task = ossUploadUtil.uploadFiledUrl(filePath,new JSONObject(),uploadHandler);
+                        new UploadThread(file.getPath());
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    XLog.e("错误图片错误,错误原因:"+e.getMessage());
+                }
+
+
+
+        }
+
+        // task.cancel(); // 可以取消任务。
+        //task.waitUntilFinished(); // 等待任务完成。
+
+    }
+
+
+
+    // 开启子进程上传
+    class UploadThread extends Thread {
+        UploadThread(String filePath) {
+//            OssUploadUtil ossUploadUtil = new OssUploadUtil(mContext,prefix);
+//            OSSAsyncTask task = ossUploadUtil.uploadFiledUrl(filePath,new JSONObject(),uploadHandler);
+//            task.waitUntilFinished();
+        }
+    }
+
+    //接收图片上传
+    @SuppressLint("HandlerLeak")
+    private Handler uploadHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            try {
+                XLog.e(msg);
+                //String data = (String) msg.obj;
+                JSONObject jsonObject = (JSONObject) msg.obj;
+
+                if (jsonObject.has("uploadFilePath")){
+                    imgCount = imgPathList.size();
+                    imgPathList.remove(imgCount-1);
+                    imgPathList.add(jsonObject.getString("uploadFilePath"));
+                    imgPathList.add(mPhotoAdapter.getFirst());
+                    ossPhotoList.add("/"+jsonObject.getString("fieldName"));
+                    mPhotoAdapter.notifyDataSetChanged();
+                }
+            } catch (Exception e) {
+                XLog.e(e.getMessage());
+                e.printStackTrace();
+            }
+        }
+    };
+
+
+}

+ 352 - 0
app/src/main/java/com/fxy/base/StorageApplication.java

@@ -0,0 +1,352 @@
+package com.fxy.base;
+import android.app.Activity;
+import android.app.Application;
+import android.content.Context;
+import android.content.res.Configuration;
+import android.graphics.Bitmap;
+import android.os.Bundle;
+import android.support.multidex.MultiDex;
+import android.util.Log;
+import android.widget.ImageView;
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.Priority;
+import com.bumptech.glide.request.RequestOptions;
+import com.elvishew.xlog.LogConfiguration;
+import com.elvishew.xlog.LogLevel;
+import com.elvishew.xlog.XLog;
+import com.elvishew.xlog.flattener.DefaultFlattener;
+import com.elvishew.xlog.printer.AndroidPrinter;
+import com.elvishew.xlog.printer.ConsolePrinter;
+import com.elvishew.xlog.printer.Printer;
+import com.elvishew.xlog.printer.file.FilePrinter;
+import com.elvishew.xlog.printer.file.backup.NeverBackupStrategy;
+import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;
+import com.lzy.ninegrid.NineGridView;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.cache.CacheEntity;
+import com.lzy.okgo.cache.CacheMode;
+import com.lzy.okgo.interceptor.HttpLoggingInterceptor;
+import com.fxy.baselibrary.language.LanguageCountry;
+import com.fxy.baselibrary.language.other.MultiLanguageUtil;
+import com.fxy.baselibrary.pagemanager.MyPageManager;
+import com.fxy.baselibrary.util.JsonUtil;
+import com.fxy.BuildConfig;
+import com.fxy.R;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.UpdateModel;
+import com.fxy.net.Urls;
+
+import org.lzh.framework.updatepluginlib.UpdateConfig;
+import org.lzh.framework.updatepluginlib.base.UpdateParser;
+import org.lzh.framework.updatepluginlib.model.Update;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import io.realm.Realm;
+import io.realm.RealmConfiguration;
+import okhttp3.OkHttpClient;
+/**
+ * 系统全局设置:
+ * 1.日志级别
+ * 2.网络请求
+ * 3.多语言
+ * 4.系统更新
+ * 5.本地数据库
+ * @author James.Jiang
+ * @date   2020-01-05
+ */
+public class StorageApplication extends Application {
+    public static StorageApplication context;
+//    public LocationService locationService;
+
+    public static StorageApplication getContext() {
+        return context;
+    }
+    public boolean isShowUpdateToast = false;
+    // 多语言数组: 英语、简体中文、繁体中文
+    public static final String[] PROJECT_LANGUAGES = {
+            LanguageCountry.LANGUAGE_OPTION_ES_US,
+            LanguageCountry.LANGUAGE_OPTION_ZH_CN,
+            LanguageCountry.LANGUAGE_OPTION_ZH_TW
+    };
+    private static   String overallPutOutInfo;
+
+    public static void setOverallPutOutInfo(String overallPutOutInfo) {
+        StorageApplication.overallPutOutInfo = overallPutOutInfo;
+    }
+
+    public static String getOverallPutOutInfo() {
+        return overallPutOutInfo;
+    }
+
+
+    //static 代码段可以防止内存泄露
+//    static {
+        //设置全局的Header构建器
+//        SmartRefreshLayout.setDefaultRefreshHeaderCreater(new DefaultRefreshHeaderCreater() {
+//            @Override
+//            public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
+//                layout.setPrimaryColorsId(R.color.bluemine, android.R.color.white);//全局设置主题颜色
+//                return new CircleHeader(context).setsetSpinnerStyle(SpinnerStyle.Translate);//指定为经典Header,默认是 贝塞尔雷达Header
+//            }
+//        });
+//        //设置全局的Footer构建器
+//        SmartRefreshLayout.setDefaultRefreshFooterCreater(new DefaultRefreshFooterCreater() {
+//            @Override
+//            public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
+//                //指定为经典Footer,默认是 BallPulseFooter
+//                return new ClassicsFooter(context).setSpinnerStyle(SpinnerStyle.Translate);
+//            }
+//        });
+//    }
+    @Override
+    public void onCreate() {
+        super.onCreate();
+//        MultiDex.install(this);
+        context = this;
+//        LitePal.initialize(this);
+        MyPageManager.initWhenAppOnCreate(context,R.layout.pager_empty,R.layout.pager_loading,R.layout.pager_error);
+        initLog();
+        initOkGo();
+        initChangeLanguage();
+        initRealm();
+//        LanguageSwitcher.getInstance().initLanguage(context,PROJECT_LANGUAGES);
+//        NineGridView.setImageLoader(new GlideImageLoder());
+        initUpdateConfig();
+        //先不发送
+        CrashHandler.getInstance().init(getApplicationContext());
+        CrashHandler.getInstance().sendError();
+//        initUmeng();
+//    }
+    }
+
+    private void initRealm() {
+        Realm.init(context);
+        RealmConfiguration config = new RealmConfiguration.Builder()
+                .name("storageRealm.realm") //文件名
+                .schemaVersion(0) //版本号
+       .build();
+        Realm.setDefaultConfiguration(config);
+    }
+
+    private void initChangeLanguage() {
+        MultiLanguageUtil.getInstance().setConfiguration(context);
+        registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
+            @Override
+            public void onActivityCreated(Activity activity, Bundle bundle) {
+
+            }
+
+            @Override
+            public void onActivityStarted(Activity activity) {
+
+            }
+
+            @Override
+            public void onActivityResumed(Activity activity) {
+                MultiLanguageUtil.getInstance().setConfiguration(context);
+            }
+
+            @Override
+            public void onActivityPaused(Activity activity) {
+
+            }
+
+            @Override
+            public void onActivityStopped(Activity activity) {
+
+            }
+
+            @Override
+            public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
+
+            }
+
+            @Override
+            public void onActivityDestroyed(Activity activity) {
+
+            }
+        });
+    }
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+        MultiLanguageUtil.getInstance().setConfiguration(context);
+    }
+    private void initOkGo() {
+        OkHttpClient.Builder builder = new OkHttpClient.Builder();
+
+        //全局的读取超时时间
+        builder.readTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
+        //全局的写入超时时间
+        builder.writeTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
+        //全局的连接超时时间
+        builder.connectTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS);
+        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor("OkGo");
+        //log打印级别,决定了log显示的详细程度
+        loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.BODY);
+        //log颜色级别,决定了log在控制台显示的颜色
+        loggingInterceptor.setColorLevel(Level.INFO);
+        builder.addInterceptor(loggingInterceptor);         //添加OkGo默认debug日志
+
+        OkGo.getInstance().init(this)                       //必须调用初始化
+
+                .setOkHttpClient(builder.build())               //建议设置OkHttpClient,不设置将使用默认的
+                .setCacheMode(CacheMode.NO_CACHE)               //全局统一缓存模式,默认不使用缓存,可以不传
+                .setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE)   //全局统一缓存时间,默认永不过期,可以不传
+                .setRetryCount(1);                             //全局统一超时重连次数,默认为三次,那么最差的情况会请求4次(一次原始请求,三次重连请求),不需要可以设置为0
+//                .addCommonHeaders(headers)                      //全局公共头
+//                .addCommonParams(params)
+
+    }
+        //    private void initUmeng() {
+//        PushAgent mPushAgent = PushAgent.getInstance(this);
+//        mPushAgent.setDebugMode(true);
+//
+//        //sdk开启通知声音
+//        mPushAgent.setNotificationPlaySound(MsgConstant.NOTIFICATION_PLAY_SDK_ENABLE);
+////        UmengSDK.getInstance().init(this, true);
+////        UmengSDK.getInstance().onAppStart();
+//        //注册推送服务 每次调用register都会回调该接口
+//        mPushAgent.register(new IUmengRegisterCallback() {
+//            @Override
+//            public void onSuccess(String token) {
+//                JLog.d("lzy", "device token: " + token);
+//                deviceToken = token;
+////                sendBroadcast(new Intent(UPDATE_STATUS_ACTION));
+//            }
+//
+//            @Override
+//            public void onFailure(String s, String s1) {
+//                JLog.d("lzy", "register failed: " + s + " " + s1);
+////                sendBroadcast(new Intent(UPDATE_STATUS_ACTION));
+//            }
+//        });
+//        UmengNotificationClickHandler notificationClickHandler = new UmengNotificationClickHandler() {
+//            @Override
+//            public void dealWithCustomAction(Context context, UMessage msg) {
+//                JLog.d("lzy", "==================msg.custom============" + msg.custom);
+//                Toast.makeText(context, msg.custom, Toast.LENGTH_LONG).show();
+//            }
+//        };
+//        mPushAgent.setNotificationClickHandler(notificationClickHandler);
+//    }
+//
+//    public String deviceToken() {
+//        return deviceToken;
+//    }
+
+    public void initLog() {
+        LogConfiguration config = new LogConfiguration.Builder()
+                .logLevel(BuildConfig.DEBUG ? LogLevel.ALL             // 指定日志级别,低于该级别的日志将不会被打印,默认为 LogLevel.ALL
+                        : LogLevel.DEBUG)
+                .tag("STO-LOG")                                         // 指定 TAG,默认为 "X-LOG"
+                .t()                                                   // 允许打印线程信息,默认禁止
+                .st(5)                                                 // 允许打印深度为2的调用栈信息,默认禁止
+                .b()                                                   // 允许打印日志边框,默认禁止
+//                .jsonFormatter(new MyJsonFormatter())                  // 指定 JSON 格式化器,默认为 DefaultJsonFormatter
+//                .xmlFormatter(new MyXmlFormatter())                    // 指定 XML 格式化器,默认为 DefaultXmlFormatter
+//                .throwableFormatter(new MyThrowableFormatter())        // 指定可抛出异常格式化器,默认为 DefaultThrowableFormatter
+//                .threadFormatter(new MyThreadFormatter())              // 指定线程信息格式化器,默认为 DefaultThreadFormatter
+//                .stackTraceFormatter(new MyStackTraceFormatter())      // 指定调用栈信息格式化器,默认为 DefaultStackTraceFormatter
+//                .borderFormatter(new MyBoardFormatter())               // 指定边框格式化器,默认为 DefaultBorderFormatter
+//                .addObjectFormatter(AnyClass.class,                    // 为指定类添加格式化器
+//                        new AnyClassObjectFormatter())                     // 默认使用 Object.toString()
+//                .addInterceptor(new BlacklistTagsFilterInterceptor(    // 添加黑名单 TAG 过滤器
+//                        "blacklist1", "blacklist2", "blacklist3"))
+//                .addInterceptor(new MyInterceptor())                   // 添加一个日志拦截器
+                .build();
+
+        Printer androidPrinter = new AndroidPrinter();             // 通过 android.util.Log 打印日志的打印器
+        Printer consolePrinter = new ConsolePrinter();             // 通过 System.out 打印日志到控制台的打印器
+        Printer filePrinter = new FilePrinter                      // 打印日志到文件的打印器
+                .Builder("/sdcard/cargo-pda/pda-log/"+BuildConfig.BUILD_TYPE+"/") // 指定保存日志文件的路径
+                .fileNameGenerator(new DateFileNameGenerator())        // 指定日志文件名生成器,默认为 ChangelessFileNameGenerator("log")
+                .backupStrategy(new NeverBackupStrategy() )             // 指定日志文件备份策略,默认为 FileSizeBackupStrategy(1024 * 1024)
+                        .logFlattener(new DefaultFlattener())                       // 指定日志平铺器,默认为 DefaultFlattener
+                        .build();
+
+        XLog.init(                                                 // 初始化 XLog
+                config,                                                // 指定日志配置,如果不指定,会默认使用 new LogConfiguration.Builder().build()
+                androidPrinter,                                        // 添加任意多的打印器。如果没有添加任何打印器,会默认使用 AndroidPrinter(Android)/ConsolePrinter(java)
+                consolePrinter,
+                filePrinter);
+    }
+
+
+    private void initUpdateConfig(){
+        UpdateConfig.getConfig()
+                // 必填:数据更新接口,url与checkEntity两种方式任选一种填写
+                .setUrl(Urls.getVersionUpdate(context) + "?v=" + UUID.randomUUID().toString())
+//                .checkEntity(new CheckEntity().setMethod(HttpMethod.GET).setUrl("Urls.update"))
+                // 必填:用于从数据更新接口获取的数据response中。解析出Update实例。以便框架内部处理
+                .setUpdateParser(new UpdateParser() {
+                    @Override
+                    public Update parse(String response) {
+                        Log.d("CARGO-LOG", response != null ? response : "null");
+                        /* 此处根据上面url或者checkEntity设置的检查更新接口的返回数据response解析出
+                         * 一个update对象返回即可。更新启动时框架内部即可根据update对象的数据进行处理
+                         */
+                        Update update = new Update();
+                        ActionBean bean = JsonUtil.getObject(response, ActionBean.class);
+                        if (bean.code == 0) {
+                            UpdateModel updateModel = JsonUtil.getObject(bean.data, UpdateModel.class);
+                            if (updateModel != null ) {
+                                update.setForced(updateModel.isForced());
+                                update.setIgnore(updateModel.isIgnore());
+                                update.setUpdateContent(updateModel.getUpdateContent());
+                                update.setUpdateUrl(updateModel.getUpdateUrl());
+                                update.setVersionCode(updateModel.getVersionCode());
+                                update.setVersionName(updateModel.getVersionName());
+                            }
+                        }
+//                        // 此处模拟一个Update对象
+//                        Update update = new Update(response);
+//                        // 此apk包的更新时间
+//                        update.setUpdateTime(System.currentTimeMillis());
+//                        // 此apk包的下载地址
+//                        update.setUpdateUrl(apkFile);
+//                        // 此apk包的版本号
+//                        update.setVersionCode(2);
+//                        // 此apk包的版本名称
+//                        update.setVersionName("2.0");
+//                        // 此apk包的更新内容
+//                        update.setUpdateContent("测试更新");
+//                        // 此apk包是否为强制更新
+//                        update.setForced(false);
+//                        // 是否显示忽略此次版本更新按钮
+//                        update.setIgnore(true);
+                        return update;
+                    }
+
+                });
+    }
+
+
+    @Override
+    protected void attachBaseContext(Context context) {
+        // 初始化多语言
+        MultiLanguageUtil.init(context);
+        super.attachBaseContext(MultiLanguageUtil.getInstance().setConfiguration(context));
+        MultiDex.install(context);
+    }
+
+
+    private class GlideImageLoder implements NineGridView.ImageLoader {
+
+        @Override
+        public void onDisplayImage(Context context, ImageView imageView, String url) {
+            RequestOptions options = new RequestOptions()
+                    .centerCrop()
+                    .placeholder(R.drawable.ic_default_img)
+                    .error(R.drawable.ic_default_img)
+                    .priority(Priority.HIGH);
+            Glide.with(context).load(url).apply(options).into(imageView);
+        }
+
+        @Override
+        public Bitmap getCacheImage(String url) {
+            return null;
+        }
+    }
+}

+ 225 - 0
app/src/main/java/com/fxy/base/fragment/PlayerVideoFragment.java

@@ -0,0 +1,225 @@
+package com.fxy.base.fragment;
+
+import android.content.res.Configuration;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.request.RequestOptions;
+import com.fxy.baselibrary.base.BaseFragment;
+import com.fxy.baselibrary.views.LandLayoutVideo;
+import com.fxy.R;
+import com.shuyu.gsyvideoplayer.GSYVideoManager;
+import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
+import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack;
+import com.shuyu.gsyvideoplayer.listener.GSYVideoProgressListener;
+import com.shuyu.gsyvideoplayer.listener.LockClickListener;
+import com.shuyu.gsyvideoplayer.utils.GSYVideoType;
+import com.shuyu.gsyvideoplayer.utils.OrientationUtils;
+import com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer;
+
+/**
+ * Created by lijie on 2018/4/10.
+ */
+
+public class PlayerVideoFragment extends BaseFragment {
+
+    private LandLayoutVideo detailPlayer;
+    public static String VIDEO_PATH = "video_path";
+    public String videoPath;
+    private boolean isPlay;
+    private boolean isPause;
+    private OrientationUtils orientationUtils;
+
+
+    public static PlayerVideoFragment newInstance(String videoPath) {
+        Bundle bundle = new Bundle();
+        bundle.putString(VIDEO_PATH, videoPath);
+        PlayerVideoFragment fragment = new PlayerVideoFragment();
+        fragment.setArguments(bundle);
+        return fragment;
+    }
+
+    @Override
+    protected int getLayoutRes() {
+        return R.layout.fragment_player_video;
+    }
+
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+        videoPath = bundle.getString(VIDEO_PATH);
+    }
+    protected void initView(View rootView) {
+        detailPlayer = rootView.findViewById(R.id.detail_player);
+        initVideoPlayer();
+    }
+
+
+
+    private void initVideoPlayer() {
+        //增加封面
+        ImageView imageView = new ImageView(getActivity());
+        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
+        Glide.with(getActivity().getApplicationContext())
+                .setDefaultRequestOptions(
+                        new RequestOptions()
+                                .centerCrop()
+                )
+                .load(videoPath)
+                .into(imageView);
+        resolveNormalVideoUI();
+        //外部辅助的旋转,帮助全屏
+        orientationUtils = new OrientationUtils(getActivity(), detailPlayer);
+        //初始化不打开外部的旋转
+        orientationUtils.setEnable(false);
+        GSYVideoType.setShowType(GSYVideoType.SCREEN_TYPE_DEFAULT);
+        GSYVideoOptionBuilder gsyVideoOption = new GSYVideoOptionBuilder();
+        gsyVideoOption.setThumbImageView(imageView)
+                .setIsTouchWiget(true)
+                .setRotateViewAuto(false)
+                .setLockLand(false)
+                .setShowFullAnimation(false)
+                .setNeedLockFull(true)
+                .setSeekRatio(1)
+                .setUrl(videoPath)
+                .setCacheWithPlay(true)
+                .setVideoTitle("")
+                .setVideoAllCallBack(new GSYSampleCallBack() {
+                    @Override
+                    public void onPrepared(String url, Object... objects) {
+                        super.onPrepared(url, objects);
+                        //开始播放了才能旋转和全屏
+                        orientationUtils.setEnable(true);
+                        isPlay = true;
+                    }
+
+                    @Override
+                    public void onEnterFullscreen(String url, Object... objects) {
+                        super.onEnterFullscreen(url, objects);
+
+                    }
+
+                    @Override
+                    public void onAutoComplete(String url, Object... objects) {
+                        super.onAutoComplete(url, objects);
+                    }
+
+                    @Override
+                    public void onClickStartError(String url, Object... objects) {
+                        super.onClickStartError(url, objects);
+                    }
+
+                    @Override
+                    public void onQuitFullscreen(String url, Object... objects) {
+                        super.onQuitFullscreen(url, objects);
+                        if (orientationUtils != null) {
+                            orientationUtils.backToProtVideo();
+                        }
+                    }
+                })
+                .setLockClickListener(new LockClickListener() {
+                    @Override
+                    public void onClick(View view, boolean lock) {
+                        if (orientationUtils != null) {
+                            //配合下方的onConfigurationChanged
+                            orientationUtils.setEnable(!lock);
+                        }
+                    }
+                })
+                .setGSYVideoProgressListener(new GSYVideoProgressListener() {
+                    @Override
+                    public void onProgress(int progress, int secProgress, int currentPosition, int duration) {
+
+                    }
+                })
+                .build(detailPlayer);
+
+        detailPlayer.getFullscreenButton().setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                //直接横屏
+                orientationUtils.resolveByClick();
+
+                //第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar
+                detailPlayer.startWindowFullscreen(getActivity(), true, true);
+
+            }
+        });
+
+
+    }
+
+
+    //返回的时候需要调用,用于退出全屏
+    public boolean onBackPressed() {
+
+        if (orientationUtils != null) {
+            orientationUtils.backToProtVideo();
+        }
+
+        if (GSYVideoManager.backFromWindowFull(getActivity())) {//全屏时推出全屏
+            return false;
+        }
+        return true;
+    }
+
+
+    @Override
+    public void onPause() {
+        getCurPlay().onVideoPause();
+        super.onPause();
+        isPause = true;
+    }
+
+    @Override
+    public void onResume() {
+        getCurPlay().onVideoResume(false);
+        super.onResume();
+        isPause = false;
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        if (isPlay) {
+            getCurPlay().release();
+        }
+        //GSYPreViewManager.instance().releaseMediaPlayer();
+        if (orientationUtils != null)
+            orientationUtils.releaseListener();
+    }
+
+    @Override
+    protected void initLogic() {
+
+    }
+
+
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+        //如果旋转了就全屏
+        if (isPlay && !isPause) {
+            detailPlayer.onConfigurationChanged(getActivity(), newConfig, orientationUtils, true, true);
+        }
+    }
+
+
+    private void resolveNormalVideoUI() {
+        //增加title
+        detailPlayer.getTitleTextView().setVisibility(View.GONE);
+        detailPlayer.getBackButton().setVisibility(View.GONE);
+    }
+
+    private GSYVideoPlayer getCurPlay() {
+        if (detailPlayer.getFullWindowPlayer() != null) {
+            return detailPlayer.getFullWindowPlayer();
+        }
+        return detailPlayer;
+    }
+
+
+
+}

+ 73 - 0
app/src/main/java/com/fxy/base/fragment/ShowImgFragment.java

@@ -0,0 +1,73 @@
+package com.fxy.base.fragment;
+
+import android.os.Bundle;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.elvishew.xlog.XLog;
+import com.fxy.baselibrary.base.BaseFragment;
+import com.fxy.baselibrary.views.dialog.RxDialogZoomImageView;
+import com.fxy.R;
+import com.fxy.adapter.ShowImgAdapter;
+
+import java.util.ArrayList;
+
+/**
+ * Created by lijie on 2018/4/10.
+ */
+
+public class ShowImgFragment  extends BaseFragment {
+
+    private RecyclerView mRvShowImg ;
+    private ShowImgAdapter mPhotoAdapter;
+    private ArrayList<String>imgPathList=new ArrayList<>();
+
+    @Override
+    protected int getLayoutRes() {
+        return R.layout.fragment_show_img;
+    }
+
+    public static ShowImgFragment newInstance(ArrayList<String> imgList){
+        Bundle bundle = new Bundle();
+        bundle.putStringArrayList("imgList",imgList);
+        ShowImgFragment showImgFragment = new ShowImgFragment();
+        showImgFragment.setArguments(bundle);
+        return showImgFragment;
+    }
+
+    @Override
+    protected void initView(View rootView) {
+        mRvShowImg = rootView.findViewById(R.id.rv_show_img);
+        rootView.findViewById(R.id.ll_add_img).setVisibility(imgPathList.size()==0?View.GONE:View.VISIBLE);
+        initAdapter();
+    }
+
+    private void initAdapter() {
+        mPhotoAdapter = new ShowImgAdapter(getActivity(), imgPathList);
+        mRvShowImg.setLayoutManager(new GridLayoutManager(getActivity(),3));
+        mRvShowImg.setAdapter(mPhotoAdapter);
+        XLog.d("imgList: " +imgPathList.toString());
+        mPhotoAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
+            @Override
+            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
+                RxDialogZoomImageView rxDialogZoomImageView = new RxDialogZoomImageView(getActivity());
+                rxDialogZoomImageView.setImagePath(imgPathList.get(position));
+                rxDialogZoomImageView.show();
+            }
+        });
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+        imgPathList.addAll(bundle.getStringArrayList("imgList"));
+    }
+
+    @Override
+    protected void initLogic() {
+
+    }
+
+
+}

+ 61 - 0
app/src/main/java/com/fxy/base/fragment/event/UploadEvent.java

@@ -0,0 +1,61 @@
+package com.fxy.base.fragment.event;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 项目名称:FingerShipWork
+ * 类描述:获取服务器返回的图片地址
+ * 创建人:admin
+ * 创建时间:2018/1/4 18:06
+ * 修改人:COMP-021-2006
+ * 修改时间:2018/1/4 18:06
+ * 修改备注:
+ */
+
+public class UploadEvent implements Parcelable {
+    /**
+     * 上传服务器返回的URL(逗号分隔)
+     */
+    public String urls ="";
+
+    public UploadEvent(String photoUrls) {
+        this.urls = photoUrls;
+    }
+
+    @Override
+    public String toString() {
+        return "UploadEvent{" +
+                "urls='" + urls + '\'' +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.urls);
+    }
+
+    public UploadEvent() {
+    }
+
+    protected UploadEvent(Parcel in) {
+        this.urls = in.readString();
+    }
+
+    public static final Creator<UploadEvent> CREATOR = new Creator<UploadEvent>() {
+        @Override
+        public UploadEvent createFromParcel(Parcel source) {
+            return new UploadEvent(source);
+        }
+
+        @Override
+        public UploadEvent[] newArray(int size) {
+            return new UploadEvent[size];
+        }
+    };
+}

+ 68 - 0
app/src/main/java/com/fxy/bean/ActionBean.java

@@ -0,0 +1,68 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Created by HuangYH on 2015/9/29.
+ */
+public class ActionBean implements Parcelable {
+
+    public int status;
+    public int code = -1;
+    public int totalSize = 0;
+    public String flag;
+    public String msg;
+    public String data;
+
+    @Override
+    public String toString() {
+        return "ActionBean{" +
+                "status=" + status +
+                ", code=" + code +
+                ", totalSize=" + totalSize +
+                ", flag='" + flag + '\'' +
+                ", msg='" + msg + '\'' +
+                ", data='" + data + '\'' +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeInt(this.status);
+        dest.writeInt(this.code);
+        dest.writeInt(this.totalSize);
+        dest.writeString(this.flag);
+        dest.writeString(this.msg);
+        dest.writeString(this.data);
+    }
+
+    public ActionBean() {
+    }
+
+    protected ActionBean(Parcel in) {
+        this.status = in.readInt();
+        this.code = in.readInt();
+        this.totalSize = in.readInt();
+        this.flag = in.readString();
+        this.msg = in.readString();
+        this.data = in.readString();
+    }
+
+    public static final Parcelable.Creator<ActionBean> CREATOR = new Parcelable.Creator<ActionBean>() {
+        @Override
+        public ActionBean createFromParcel(Parcel source) {
+            return new ActionBean(source);
+        }
+
+        @Override
+        public ActionBean[] newArray(int size) {
+            return new ActionBean[size];
+        }
+    };
+}

+ 62 - 0
app/src/main/java/com/fxy/bean/BaseDataBean.java

@@ -0,0 +1,62 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.fxy.bean.realm.CargoBaseModel;
+
+import java.util.List;
+
+/**
+ * 项目名称:FingerStorage
+ * 类描述:
+ * 创建人:admin
+ * 创建时间:2018/5/22 14:00
+ * 修改人:COMP-021-2006
+ * 修改时间:2018/5/22 14:00
+ * 修改备注:
+ */
+public class BaseDataBean implements Parcelable {
+    public long version;
+    public List<CargoBaseModel> cargoDataList;
+
+    @Override
+    public String toString() {
+        return "BaseDataBean{" +
+                "version=" + version +
+                ", cargoDataList=" + cargoDataList +
+                '}';
+    }
+
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeLong(this.version);
+        dest.writeTypedList(this.cargoDataList);
+    }
+
+    public BaseDataBean() {
+    }
+
+    protected BaseDataBean(Parcel in) {
+        this.version = in.readLong();
+        this.cargoDataList = in.createTypedArrayList(CargoBaseModel.CREATOR);
+    }
+
+    public static final Parcelable.Creator<BaseDataBean> CREATOR = new Parcelable.Creator<BaseDataBean>() {
+        @Override
+        public BaseDataBean createFromParcel(Parcel source) {
+            return new BaseDataBean(source);
+        }
+
+        @Override
+        public BaseDataBean[] newArray(int size) {
+            return new BaseDataBean[size];
+        }
+    };
+}

+ 123 - 0
app/src/main/java/com/fxy/bean/BluesBean.java

@@ -0,0 +1,123 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 蓝牙对象
+ *
+ * @author qin.guilin
+ *
+ */
+public class BluesBean implements Parcelable {
+
+
+    public String blue_ele_scale;
+
+    public String blue_ele_scale_pin;
+
+    public Integer reverse = 0 ;
+
+    //连续次数 会作废
+    public Integer continuous = 1 ;
+
+    //记录日志
+    public Integer is_record_log = 0 ;
+
+    //是否清除重量
+    public Integer is_clear_weight = 0;
+
+    //方式
+    public Integer way=1;
+
+    public String blue_address="";
+
+
+
+    @Override
+    public String toString() {
+        return "BluesBean{" +
+                "blue_ele_scale=" + blue_ele_scale +
+                ", blue_ele_scale_pin=" + blue_ele_scale_pin +
+                ", reverse=" + reverse +
+                ", continuous=" + continuous +
+                ", is_record_log=" + is_record_log +
+                ", is_clear_weight=" + is_clear_weight +
+                ", way=" + way +
+                ", blue_address=" + blue_address +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.blue_ele_scale);
+        dest.writeString(this.blue_ele_scale_pin);
+        dest.writeInt(this.reverse);
+        dest.writeInt(this.continuous);
+        dest.writeInt(this.is_record_log);
+        dest.writeInt(this.is_clear_weight);
+        dest.writeInt(this.way);
+        dest.writeString(this.blue_address);
+    }
+
+    public BluesBean() {
+    }
+
+    protected BluesBean(Parcel in) {
+        this.blue_ele_scale     = in.readString();
+        this.blue_ele_scale_pin = in.readString();
+        this.reverse    = in.readInt();
+        this.continuous = in.readInt();
+        this.is_record_log = in.readInt();
+        this.is_clear_weight = in.readInt();
+        this.way = in.readInt();
+        this.blue_address = in.readString();
+    }
+
+    public static final Creator<BluesBean> CREATOR = new Creator<BluesBean>() {
+        @Override
+        public BluesBean createFromParcel(Parcel source) {
+            return new BluesBean(source);
+        }
+
+        @Override
+        public BluesBean[] newArray(int size) {
+            return new BluesBean[size];
+        }
+    };
+
+    public String getBlueEleScale() {
+        return blue_ele_scale;
+    }
+
+    public String getBlueEleScalePin() {
+        return blue_ele_scale_pin;
+    }
+
+    public String getBlueAddress() {
+        return blue_address;
+    }
+
+    public void   setBlueAddress(String blue_address) {
+        this.blue_address=blue_address;
+    }
+
+    public int getReverse() {
+        return reverse;
+    }
+
+    public int getContinuous() {
+        return continuous;
+    }
+
+    public Integer getIsRecordLog() {return is_record_log;}
+
+    public Integer getIsClearWeight() {return is_clear_weight;}
+
+    public Integer getWay() {return way;}
+}

+ 58 - 0
app/src/main/java/com/fxy/bean/CommonDataBean.java

@@ -0,0 +1,58 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 项目名称:FingerStorage
+ * 类描述:常规数据Bean
+ * 创建人:admin
+ * 创建时间:2018/3/26 18:09
+ * 修改人:COMP-021-2006
+ * 修改时间:2018/3/26 18:09
+ * 修改备注:
+ */
+
+public class CommonDataBean implements Parcelable {
+    public String id;
+    public String name;
+
+    @Override
+    public String toString() {
+        return "CommonDataBean{" +
+                "id='" + id + '\'' +
+                ", name='" + name + '\'' +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.id);
+        dest.writeString(this.name);
+    }
+
+    public CommonDataBean() {
+    }
+
+    protected CommonDataBean(Parcel in) {
+        this.id = in.readString();
+        this.name = in.readString();
+    }
+
+    public static final Parcelable.Creator<CommonDataBean> CREATOR = new Parcelable.Creator<CommonDataBean>() {
+        @Override
+        public CommonDataBean createFromParcel(Parcel source) {
+            return new CommonDataBean(source);
+        }
+
+        @Override
+        public CommonDataBean[] newArray(int size) {
+            return new CommonDataBean[size];
+        }
+    };
+}

+ 110 - 0
app/src/main/java/com/fxy/bean/DictDataBean.java

@@ -0,0 +1,110 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 数据字典对象
+ * @author James.Jiang
+ * @date 2020-01-13
+ */
+public class DictDataBean implements Parcelable {
+
+    private Integer key;
+
+    private String code;
+
+    private String name;
+
+    private String description;
+
+  @Override
+    public String toString() {
+        return "DictDataBean{" +
+                "key=" + key +
+                "code=" + code +
+                ", name=" + name +
+                ", description=" + description +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeInt(this.key);
+        dest.writeString(this.code);
+        dest.writeString(this.name);
+        dest.writeString(this.description);
+    }
+
+    public DictDataBean() {
+
+    }
+    public DictDataBean(String code,String name,String description) {
+        this.code = code;
+        this.name = name;
+        this.description = description;
+    }
+    public DictDataBean(String code,String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    public DictDataBean(Integer key,String name) {
+        this.key = key;
+        this.name = name;
+    }
+    protected DictDataBean(Parcel in) {
+        this.key = in.readInt();
+        this.code = in.readString();
+        this.name = in.readString();
+    }
+
+    public static final Creator<DictDataBean> CREATOR = new Creator<DictDataBean>() {
+        @Override
+        public DictDataBean createFromParcel(Parcel source) {
+            return new DictDataBean(source);
+        }
+
+        @Override
+        public DictDataBean[] newArray(int size) {
+            return new DictDataBean[size];
+        }
+    };
+
+    public String getCode() {
+        return code;
+    }
+
+    public Integer getKey() {
+        return key;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public void setKey(Integer key) {
+        this.key = key;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 103 - 0
app/src/main/java/com/fxy/bean/ExceptionBean.java

@@ -0,0 +1,103 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+
+/**
+ * 项目名称:FingerStorage
+ * 类描述: 异常上报bean
+ * 创建人:admin
+ * 创建时间:2018/4/18 11:53
+ * 修改人:COMP-021-2006
+ * 修改时间:2018/4/18 11:53
+ * 修改备注:
+ */
+public class ExceptionBean extends UrlModel{
+    /**
+     * 异常原因id
+     */
+    public String exceptionReasonId;
+    /**
+     * 与该次上报异常相关的id
+     */
+    public String taskId;
+    /**
+     * 异常原因
+     */
+    public String exceptionReason;
+    /**
+     * 异常上报后后台返回的记录id
+     */
+    public String exceptionId;
+    /**
+     * 备注
+     */
+    public String remark;
+    /**
+     * 上报时间
+     */
+    public String createTime;
+    /**
+     * 异常状态
+     */
+    public int exceptionType;
+
+    @Override
+    public String toString() {
+        return "ExceptionBean{" +
+                "exceptionReasonId='" + exceptionReasonId + '\'' +
+                ", taskId='" + taskId + '\'' +
+                ", exceptionReason='" + exceptionReason + '\'' +
+                ", exceptionId='" + exceptionId + '\'' +
+                ", remark='" + remark + '\'' +
+                ", createTime='" + createTime + '\'' +
+                ", exceptionType=" + exceptionType +
+                ", photoUrls='" + photoUrls + '\'' +
+                ", videoUrls='" + videoUrls + '\'' +
+                ", imgPathList=" + imgPathList +
+                ", videoPath='" + videoPath + '\'' +
+                '}';
+    }
+
+    public ExceptionBean() {
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        super.writeToParcel(dest, flags);
+        dest.writeString(this.exceptionReasonId);
+        dest.writeString(this.taskId);
+        dest.writeString(this.exceptionReason);
+        dest.writeString(this.exceptionId);
+        dest.writeString(this.remark);
+        dest.writeString(this.createTime);
+        dest.writeInt(this.exceptionType);
+    }
+
+    protected ExceptionBean(Parcel in) {
+        super(in);
+        this.exceptionReasonId = in.readString();
+        this.taskId = in.readString();
+        this.exceptionReason = in.readString();
+        this.exceptionId = in.readString();
+        this.remark = in.readString();
+        this.createTime = in.readString();
+        this.exceptionType = in.readInt();
+    }
+
+    public static final Creator<ExceptionBean> CREATOR = new Creator<ExceptionBean>() {
+        @Override
+        public ExceptionBean createFromParcel(Parcel source) {
+            return new ExceptionBean(source);
+        }
+
+        @Override
+        public ExceptionBean[] newArray(int size) {
+            return new ExceptionBean[size];
+        }
+    };
+}

+ 77 - 0
app/src/main/java/com/fxy/bean/ScalesBean.java

@@ -0,0 +1,77 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 重量对象
+ *
+ * @author qin.guilin
+ *
+ */
+public class ScalesBean implements Parcelable {
+
+
+    public String weight_one="";
+    public String weight_two="";
+
+
+    @Override
+    public String toString() {
+        return "ScalesBean{" +
+                "weight_one=" + weight_one +
+                ", weight_two=" + weight_two +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.weight_one);
+        dest.writeString(this.weight_two);
+    }
+
+    public ScalesBean() {
+    }
+
+    protected ScalesBean(Parcel in) {
+        this.weight_one     = in.readString();
+        this.weight_two     = in.readString();
+    }
+
+    public static final Creator<ScalesBean> CREATOR = new Creator<ScalesBean>() {
+        @Override
+        public ScalesBean createFromParcel(Parcel source) {
+            return new ScalesBean(source);
+        }
+
+        @Override
+        public ScalesBean[] newArray(int size) {
+            return new ScalesBean[size];
+        }
+    };
+
+
+
+    public String getWeight(String weight) {
+        if (this.weight_one.equals(weight)){
+            this.weight_one = "";
+            this.weight_two = "";
+            return weight;
+        }else if (this.weight_two.equals(weight)){
+            this.weight_one = "";
+            this.weight_two = "";
+            return weight;
+
+        }else {
+            this.weight_one = this.weight_two;
+            this.weight_two = weight;
+            return "";
+        }
+    };
+
+}

+ 125 - 0
app/src/main/java/com/fxy/bean/ScanBean.java

@@ -0,0 +1,125 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 蓝牙对象
+ *
+ * @author qin.guilin
+ *
+ */
+public class ScanBean implements Parcelable {
+
+    public String device_name;
+    public String action;
+    public String data_name;
+    public int is_broadcast = 1 ;
+    public String status_name = "";
+    public String action_stop = "";
+    public int scan_id = 0 ;
+    public String manufacturer="";
+    public String device_model="";
+    public int is_api = 1;
+
+
+    public String toJsonString(){
+        return "{\"scan_id\":"+scan_id+"," +
+                "\"manufacturer\":\""+manufacturer+"\"," +
+                "\"device_model\":\""+device_model+"\"," +
+                "\"action\":\""+action+"\"," +
+                "\"is_broadcast\":"+is_broadcast+"," +
+                "\"data_name\":\""+data_name+"\"," +
+                "\"status_name\":\""+status_name+"\"," +
+                "\"is_api\":"+is_api+"," +
+                "\"device_name\":\""+device_name+"\",}";
+
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.device_name);
+        dest.writeString(this.action);
+        dest.writeString(this.data_name);
+        dest.writeString(this.status_name);
+        dest.writeInt(this.is_broadcast);
+        dest.writeString(this.action_stop);
+        dest.writeInt(this.scan_id);
+        dest.writeString(this.manufacturer);
+        dest.writeString(this.device_model);
+        dest.writeInt(this.is_api);
+    }
+
+    public ScanBean() {
+    }
+
+    protected ScanBean(Parcel in) {
+        this.device_name     = in.readString();
+        this.action     = in.readString();
+        this.data_name = in.readString();
+        this.status_name    = in.readString();
+        this.is_broadcast = in.readInt();
+        this.action_stop     = in.readString();
+        this.scan_id = in.readInt();
+        this.manufacturer = in.readString();
+        this.device_model = in.readString();
+        this.is_api = in.readInt();
+    }
+
+    public static final Creator<ScanBean> CREATOR = new Creator<ScanBean>() {
+        @Override
+        public ScanBean createFromParcel(Parcel source) {
+            return new ScanBean(source);
+        }
+
+        @Override
+        public ScanBean[] newArray(int size) {
+            return new ScanBean[size];
+        }
+    };
+
+    public String getDeviceName() {
+        return device_name;
+    }
+    public String getAction() {
+        return action;
+    }
+    public String getDataName() {
+        return data_name;
+    }
+    public String getStatusName() {
+        return status_name;
+    }
+
+    public Integer getBroadcast() {
+        return is_broadcast;
+    }
+
+    public Integer getIsBroadcast() {
+        return  is_broadcast;
+    }
+    public void setIsBroadcast(Integer isBroadcast) {
+        this.is_broadcast = isBroadcast;
+    }
+
+    public String getActionStop() {
+        return action_stop;
+    }
+
+    public int getCanId() {
+        return scan_id;
+    }
+
+    public String getManufacturer(){
+        return manufacturer;
+    }
+
+    public int getIsApi(){
+        return is_api;
+    }
+}

+ 94 - 0
app/src/main/java/com/fxy/bean/ScanDataBean.java

@@ -0,0 +1,94 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 扫描对象
+ *
+ * @author James.Jiang
+ *
+ */
+public class ScanDataBean implements Parcelable {
+    /**
+     * 单号
+     */
+    public String orderNo;
+
+    /**
+     * 扫描时间
+     */
+    public String scanTime;
+
+    /**
+     * 扫描添加序号
+     */
+    public Integer index;
+
+    @Override
+    public String toString() {
+        return "ScanDataBean{" +
+                "orderNo=" + orderNo +
+                ", scanTime=" + scanTime +
+                ", index=" + index +
+                '}';
+    }
+
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.orderNo);
+        dest.writeString(this.scanTime);
+        dest.writeInt(this.index);
+    }
+
+    public ScanDataBean() {
+    }
+
+    protected ScanDataBean(Parcel in) {
+        this.orderNo = in.readString();
+        this.scanTime = in.readString();
+        this.index = in.readInt();
+    }
+
+    public static final Creator<ScanDataBean> CREATOR = new Creator<ScanDataBean>() {
+        @Override
+        public ScanDataBean createFromParcel(Parcel source) {
+            return new ScanDataBean(source);
+        }
+
+        @Override
+        public ScanDataBean[] newArray(int size) {
+            return new ScanDataBean[size];
+        }
+    };
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getScanTime() {
+        return scanTime;
+    }
+
+    public void setScanTime(String scanTime) {
+        this.scanTime = scanTime;
+    }
+
+    public Integer getIndex() {
+        return index;
+    }
+
+    public void setIndex(Integer index) {
+        this.index = index;
+    }
+}

+ 122 - 0
app/src/main/java/com/fxy/bean/UpdateModel.java

@@ -0,0 +1,122 @@
+package com.fxy.bean;
+
+import java.io.Serializable;
+
+/**
+ * 项目名称:FingerApproval
+ * 类描述:
+ * 创建人:admin
+ * 创建时间:2016/12/7 15:11
+ * 修改人:COMP-021-2006
+ * 修改时间:2016/12/7 15:11
+ * 修改备注:
+ */
+
+public class UpdateModel implements Serializable {
+
+    /**
+     * 额外参数
+     */
+    private String original;
+
+    /**
+     * 是否强制升级
+     * indicated whether or not to force update,update dialog should not be disable by back key or touch outside if set true
+     */
+    private boolean forced;
+    /**
+     * update content,
+     * 更新内容说明  eg:测试更新
+     */
+    private String updateContent;
+    /**
+     * update url
+     * 更新URL地址  eg: http://api.p.tgnet.com/Client/Download
+     */
+    private String updateUrl;
+    /**
+     * update applyTime
+     * 更新时间
+     */
+    private long updateTime;
+    /**
+     * update code
+     * 更新版本号  eg:12
+     */
+    private int versionCode;
+    /**
+     * update name
+     * 更新版本名称   eg:2.0.1
+     */
+    private String versionName;
+
+    /**
+     *  是否显示忽略此次版本更新按钮
+     */
+    private boolean ignore;
+
+    public UpdateModel() {
+
+    }
+
+    public boolean isForced() {
+        return forced;
+    }
+
+    public boolean isIgnore() {
+        return ignore;
+    }
+
+    public void setIgnore(boolean ignore) {
+        this.ignore = ignore;
+    }
+
+    public void setForced(boolean forced) {
+        this.forced = forced;
+    }
+
+    public String getUpdateContent() {
+        return updateContent;
+    }
+
+    public void setUpdateContent(String updateContent) {
+        this.updateContent = updateContent;
+    }
+
+    public String getUpdateUrl() {
+        return updateUrl;
+    }
+
+    public void setUpdateUrl(String updateUrl) {
+        this.updateUrl = updateUrl;
+    }
+
+    public long getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(long updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public int getVersionCode() {
+        return versionCode;
+    }
+
+    public void setVersionCode(int versionCode) {
+        this.versionCode = versionCode;
+    }
+
+    public String getVersionName() {
+        return versionName;
+    }
+
+    public void setVersionName(String versionName) {
+        this.versionName = versionName;
+    }
+
+    public String getOriginal() {
+        return original;
+    }
+
+}

+ 81 - 0
app/src/main/java/com/fxy/bean/UrlModel.java

@@ -0,0 +1,81 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.ArrayList;
+
+/**
+ * 项目名称:FingerStorage
+ * 类描述:
+ * 创建人:admin
+ * 创建时间:2018/3/31 16:08
+ * 修改人:COMP-021-2006
+ * 修改时间:2018/3/31 16:08
+ * 修改备注:
+ */
+
+public class UrlModel implements Parcelable {
+    /**
+     * 服务器返回的图片url(逗号分隔)
+     */
+    public String photoUrls;
+    /**
+     * 服务器返回的视频url
+     */
+    public String videoUrls;
+    /**
+     * 已上传后的图片本地地址集合
+     */
+    public ArrayList<String> imgPathList=new ArrayList<>();
+    /**
+     * 已上传后的视频本地地址
+     */
+    public String videoPath;
+
+    public static final Creator<UrlModel> CREATOR = new Creator<UrlModel>() {
+        @Override
+        public UrlModel createFromParcel(Parcel in) {
+            return new UrlModel(in);
+        }
+
+        @Override
+        public UrlModel[] newArray(int size) {
+            return new UrlModel[size];
+        }
+    };
+
+    @Override
+    public String toString() {
+        return "UrlModel{" +
+                "photoUrls='" + photoUrls + '\'' +
+                ", videoUrls='" + videoUrls + '\'' +
+                ", imgPathList=" + imgPathList +
+                ", videoPath='" + videoPath + '\'' +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.photoUrls);
+        dest.writeString(this.videoUrls);
+        dest.writeStringList(this.imgPathList);
+        dest.writeString(this.videoPath);
+    }
+
+    public UrlModel() {
+    }
+
+    protected UrlModel(Parcel in) {
+        this.photoUrls = in.readString();
+        this.videoUrls = in.readString();
+        this.imgPathList = in.createStringArrayList();
+        this.videoPath = in.readString();
+    }
+
+}

+ 57 - 0
app/src/main/java/com/fxy/bean/VideoModel.java

@@ -0,0 +1,57 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * @Title: VideoModel.java
+ * @Package
+ * @Description: TODO
+ * @author admin
+ * @date 2016年10月19日 下午4:47:49
+ * @version V1.0
+ */
+public class VideoModel implements Parcelable {
+
+	public int tag ;
+	public String videoPath = "";
+
+	@Override
+	public String toString() {
+		return "VideoModel{" +
+				"tag=" + tag +
+				", videoPath='" + videoPath + '\'' +
+				'}';
+	}
+
+	public VideoModel() {
+	}
+
+	@Override
+	public int describeContents() {
+		return 0;
+	}
+
+	@Override
+	public void writeToParcel(Parcel dest, int flags) {
+		dest.writeInt(this.tag);
+		dest.writeString(this.videoPath);
+	}
+
+	protected VideoModel(Parcel in) {
+		this.tag = in.readInt();
+		this.videoPath = in.readString();
+	}
+
+	public static final Creator<VideoModel> CREATOR = new Creator<VideoModel>() {
+		@Override
+		public VideoModel createFromParcel(Parcel source) {
+			return new VideoModel(source);
+		}
+
+		@Override
+		public VideoModel[] newArray(int size) {
+			return new VideoModel[size];
+		}
+	};
+}

+ 63 - 0
app/src/main/java/com/fxy/bean/VideoUrlModel.java

@@ -0,0 +1,63 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 项目名称:FingerStorage
+ * 类描述:
+ * 创建人:admin
+ * 创建时间:2018/3/31 15:05
+ * 修改人:COMP-021-2006
+ * 修改时间:2018/3/31 15:05
+ * 修改备注:
+ */
+
+public class VideoUrlModel implements Parcelable {
+    public String tag = "";
+    public String videoUrl = "";
+
+    @Override
+    public String toString() {
+        return "VideoUrlModel{" +
+                "tag='" + tag + '\'' +
+                ", videoUrl='" + videoUrl + '\'' +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.tag);
+        dest.writeString(this.videoUrl);
+    }
+
+    public VideoUrlModel(String tag, String videoUrl) {
+        this.tag = tag;
+        this.videoUrl = videoUrl;
+    }
+
+    public VideoUrlModel() {
+    }
+
+    protected VideoUrlModel(Parcel in) {
+        this.tag = in.readString();
+        this.videoUrl = in.readString();
+    }
+
+    public static final Parcelable.Creator<VideoUrlModel> CREATOR = new Parcelable.Creator<VideoUrlModel>() {
+        @Override
+        public VideoUrlModel createFromParcel(Parcel source) {
+            return new VideoUrlModel(source);
+        }
+
+        @Override
+        public VideoUrlModel[] newArray(int size) {
+            return new VideoUrlModel[size];
+        }
+    };
+}

+ 85 - 0
app/src/main/java/com/fxy/bean/WeightBean.java

@@ -0,0 +1,85 @@
+package com.fxy.bean;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 重量对象
+ *
+ * @author qin.guilin
+ *
+ */
+public class WeightBean implements Parcelable {
+
+
+    public String weight="";
+
+    //连续次数
+    public Integer continuous = 0 ;
+
+    @Override
+    public String toString() {
+        return "WeightBean{" +
+                "weight=" + weight +
+                ", continuous=" + continuous +
+                '}';
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.weight);
+        dest.writeInt(this.continuous);
+    }
+
+    public WeightBean() {
+    }
+
+    protected WeightBean(Parcel in) {
+        this.weight     = in.readString();
+        this.continuous = in.readInt();
+    }
+
+    public static final Creator<WeightBean> CREATOR = new Creator<WeightBean>() {
+        @Override
+        public WeightBean createFromParcel(Parcel source) {
+            return new WeightBean(source);
+        }
+
+        @Override
+        public WeightBean[] newArray(int size) {
+            return new WeightBean[size];
+        }
+    };
+
+
+
+    public String getWeight() {
+        return weight;
+    }
+
+    public int getContinuous() {
+        return continuous;
+    }
+
+    public void setWeight(String weight) {
+        this.weight = weight;
+    }
+    public void setWeightContinuous(String weight,int num) {
+        if (this.weight.equals(weight.trim())){
+            this.continuous = this.continuous+num;
+        }else{
+            this.weight = weight;
+            this.continuous = 1;
+        }
+
+    }
+
+    public void incContinuous(int num ) {
+        this.continuous = this.continuous+num;
+    }
+}

+ 397 - 0
app/src/main/java/com/fxy/bean/realm/CargoBaseModel.java

@@ -0,0 +1,397 @@
+package com.fxy.bean.realm;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import io.realm.RealmObject;
+
+/**
+ * 项目名称:FingerStorage
+ * 类描述:货物基础数据表(缓存本地数据库)
+ * 创建人:admin
+ * 创建时间:2018/4/27 17:19
+ * 修改人:COMP-021-2006
+ * 修改时间:2018/4/27 17:19
+ * 修改备注:
+ */
+public class CargoBaseModel extends RealmObject implements Parcelable {
+    /**
+     * 商品id
+     */
+    private String id;
+    /**
+     * 产品编码
+     */
+    private String goodsCode;
+    /**
+     * 商品名称
+     */
+    private String goodsName;
+    /**
+     * 单位(米/支、码/支)
+     */
+    private String unit;
+    /**
+     * 规格
+     */
+    private String specification;
+    /**
+     * 重量
+     */
+    private String weight;
+    /**
+     * 商品抬头
+     */
+    private String goodsNameTitle;
+    /**
+     * 商品品牌
+     */
+    private String goodsBrandCode;
+    /**
+     * 商品图片
+     */
+    private String goodsPic;
+    /**
+     * 商品简介
+     */
+    private String goodsInfo;
+    /**
+     * 品牌名称
+     */
+    private String brandName;
+    /**
+     * 品牌英文名称
+     */
+    private String brandNameEn;
+    /**
+     * 产地
+     */
+    private String origin;
+    /**
+     * 长度
+     */
+    private String goodsLength;
+    /**
+     * 宽度
+     */
+    private String goodsWidth;
+    /**
+     * 高度
+     */
+    private String goodsHeight;
+    /**
+     * 保质期
+     */
+    private String shelfLife;
+    /**
+     * 温度类型
+     */
+    private String temperatureType;
+    /**
+     * 温度起
+     */
+    private String temperatureStart;
+    /**
+     * 温度至
+     */
+    private String temperatureEnd;
+    /**
+     * 湿度类型
+     */
+    private String humidityType;
+    /**
+     * 湿度起
+     */
+    private String humidityStart;
+    /**
+     * 湿度至
+     */
+    private String humidityEnd;
+
+
+    @Override
+    public String toString() {
+        return "CargoBaseModel{" +
+                "id='" + id + '\'' +
+                ", goodsCode='" + goodsCode + '\'' +
+                ", goodsName='" + goodsName + '\'' +
+                ", unit='" + unit + '\'' +
+                ", specification='" + specification + '\'' +
+                ", weight='" + weight + '\'' +
+                ", goodsNameTitle='" + goodsNameTitle + '\'' +
+                ", goodsBrandCode='" + goodsBrandCode + '\'' +
+                ", goodsPic='" + goodsPic + '\'' +
+                ", goodsInfo='" + goodsInfo + '\'' +
+                ", brandName='" + brandName + '\'' +
+                ", brandNameEn='" + brandNameEn + '\'' +
+                ", origin='" + origin + '\'' +
+                ", goodsLength='" + goodsLength + '\'' +
+                ", goodsWidth='" + goodsWidth + '\'' +
+                ", goodsHeight='" + goodsHeight + '\'' +
+                ", shelfLife='" + shelfLife + '\'' +
+                ", temperatureType='" + temperatureType + '\'' +
+                ", temperatureStart='" + temperatureStart + '\'' +
+                ", temperatureEnd='" + temperatureEnd + '\'' +
+                ", humidityType='" + humidityType + '\'' +
+                ", humidityStart='" + humidityStart + '\'' +
+                ", humidityEnd='" + humidityEnd + '\'' +
+                '}';
+    }
+
+    public CargoBaseModel() {
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getGoodsCode() {
+        return goodsCode;
+    }
+
+    public void setGoodsCode(String goodsCode) {
+        this.goodsCode = goodsCode;
+    }
+
+    public String getGoodsName() {
+        return goodsName;
+    }
+
+    public void setGoodsName(String goodsName) {
+        this.goodsName = goodsName;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public String getSpecification() {
+        return specification;
+    }
+
+    public void setSpecification(String specification) {
+        this.specification = specification;
+    }
+
+    public String getWeight() {
+        return weight;
+    }
+
+    public void setWeight(String weight) {
+        this.weight = weight;
+    }
+
+    public String getGoodsNameTitle() {
+        return goodsNameTitle;
+    }
+
+    public void setGoodsNameTitle(String goodsNameTitle) {
+        this.goodsNameTitle = goodsNameTitle;
+    }
+
+    public String getGoodsBrandCode() {
+        return goodsBrandCode;
+    }
+
+    public void setGoodsBrandCode(String goodsBrandCode) {
+        this.goodsBrandCode = goodsBrandCode;
+    }
+
+    public String getGoodsPic() {
+        return goodsPic;
+    }
+
+    public void setGoodsPic(String goodsPic) {
+        this.goodsPic = goodsPic;
+    }
+
+    public String getGoodsInfo() {
+        return goodsInfo;
+    }
+
+    public void setGoodsInfo(String goodsInfo) {
+        this.goodsInfo = goodsInfo;
+    }
+
+    public String getBrandName() {
+        return brandName;
+    }
+
+    public void setBrandName(String brandName) {
+        this.brandName = brandName;
+    }
+
+    public String getBrandNameEn() {
+        return brandNameEn;
+    }
+
+    public void setBrandNameEn(String brandNameEn) {
+        this.brandNameEn = brandNameEn;
+    }
+
+    public String getOrigin() {
+        return origin;
+    }
+
+    public void setOrigin(String origin) {
+        this.origin = origin;
+    }
+
+    public String getGoodsLength() {
+        return goodsLength;
+    }
+
+    public void setGoodsLength(String goodsLength) {
+        this.goodsLength = goodsLength;
+    }
+
+    public String getGoodsWidth() {
+        return goodsWidth;
+    }
+
+    public void setGoodsWidth(String goodsWidth) {
+        this.goodsWidth = goodsWidth;
+    }
+
+    public String getGoodsHeight() {
+        return goodsHeight;
+    }
+
+    public void setGoodsHeight(String goodsHeight) {
+        this.goodsHeight = goodsHeight;
+    }
+
+    public String getShelfLife() {
+        return shelfLife;
+    }
+
+    public void setShelfLife(String shelfLife) {
+        this.shelfLife = shelfLife;
+    }
+
+    public String getTemperatureType() {
+        return temperatureType;
+    }
+
+    public void setTemperatureType(String temperatureType) {
+        this.temperatureType = temperatureType;
+    }
+
+    public String getTemperatureStart() {
+        return temperatureStart;
+    }
+
+    public void setTemperatureStart(String temperatureStart) {
+        this.temperatureStart = temperatureStart;
+    }
+
+    public String getTemperatureEnd() {
+        return temperatureEnd;
+    }
+
+    public void setTemperatureEnd(String temperatureEnd) {
+        this.temperatureEnd = temperatureEnd;
+    }
+
+    public String getHumidityType() {
+        return humidityType;
+    }
+
+    public void setHumidityType(String humidityType) {
+        this.humidityType = humidityType;
+    }
+
+    public String getHumidityStart() {
+        return humidityStart;
+    }
+
+    public void setHumidityStart(String humidityStart) {
+        this.humidityStart = humidityStart;
+    }
+
+    public String getHumidityEnd() {
+        return humidityEnd;
+    }
+
+    public void setHumidityEnd(String humidityEnd) {
+        this.humidityEnd = humidityEnd;
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(this.id);
+        dest.writeString(this.goodsCode);
+        dest.writeString(this.goodsName);
+        dest.writeString(this.unit);
+        dest.writeString(this.specification);
+        dest.writeString(this.weight);
+        dest.writeString(this.goodsNameTitle);
+        dest.writeString(this.goodsBrandCode);
+        dest.writeString(this.goodsPic);
+        dest.writeString(this.goodsInfo);
+        dest.writeString(this.brandName);
+        dest.writeString(this.brandNameEn);
+        dest.writeString(this.origin);
+        dest.writeString(this.goodsLength);
+        dest.writeString(this.goodsWidth);
+        dest.writeString(this.goodsHeight);
+        dest.writeString(this.shelfLife);
+        dest.writeString(this.temperatureType);
+        dest.writeString(this.temperatureStart);
+        dest.writeString(this.temperatureEnd);
+        dest.writeString(this.humidityType);
+        dest.writeString(this.humidityStart);
+        dest.writeString(this.humidityEnd);
+    }
+
+    protected CargoBaseModel(Parcel in) {
+        this.id = in.readString();
+        this.goodsCode = in.readString();
+        this.goodsName = in.readString();
+        this.unit = in.readString();
+        this.specification = in.readString();
+        this.weight = in.readString();
+        this.goodsNameTitle = in.readString();
+        this.goodsBrandCode = in.readString();
+        this.goodsPic = in.readString();
+        this.goodsInfo = in.readString();
+        this.brandName = in.readString();
+        this.brandNameEn = in.readString();
+        this.origin = in.readString();
+        this.goodsLength = in.readString();
+        this.goodsWidth = in.readString();
+        this.goodsHeight = in.readString();
+        this.shelfLife = in.readString();
+        this.temperatureType = in.readString();
+        this.temperatureStart = in.readString();
+        this.temperatureEnd = in.readString();
+        this.humidityType = in.readString();
+        this.humidityStart = in.readString();
+        this.humidityEnd = in.readString();
+    }
+
+    public static final Creator<CargoBaseModel> CREATOR = new Creator<CargoBaseModel>() {
+        @Override
+        public CargoBaseModel createFromParcel(Parcel source) {
+            return new CargoBaseModel(source);
+        }
+
+        @Override
+        public CargoBaseModel[] newArray(int size) {
+            return new CargoBaseModel[size];
+        }
+    };
+}

+ 76 - 0
app/src/main/java/com/fxy/bean/realm/ScanSetupModel.java

@@ -0,0 +1,76 @@
+package com.fxy.bean.realm;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+import io.realm.RealmObject;
+
+/**
+ *  项目名称:大货
+ *  类描述:扫描设置数据表(缓存本地数据库)
+ *  创建人:桂林
+ *  创建时间:2021/01/29
+ *  修改备注:
+ *  修改时间
+ */
+public class ScanSetupModel  extends RealmObject implements Parcelable {
+
+    //表ID
+    private String id;
+    private String device_name;
+    private String action;
+    private String data_name;
+    private Integer is_broadcast = 1 ;
+    private String status_name = "";
+    private String action_stop = "";
+
+    protected ScanSetupModel(Parcel in) {
+        id = in.readString();
+        device_name = in.readString();
+        action = in.readString();
+        data_name = in.readString();
+        if (in.readByte() == 0) {
+            is_broadcast = null;
+        } else {
+            is_broadcast = in.readInt();
+        }
+        status_name = in.readString();
+        action_stop = in.readString();
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(id);
+        dest.writeString(device_name);
+        dest.writeString(action);
+        dest.writeString(data_name);
+        if (is_broadcast == null) {
+            dest.writeByte((byte) 0);
+        } else {
+            dest.writeByte((byte) 1);
+            dest.writeInt(is_broadcast);
+        }
+        dest.writeString(status_name);
+        dest.writeString(action_stop);
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    public static final Creator<ScanSetupModel> CREATOR = new Creator<ScanSetupModel>() {
+        @Override
+        public ScanSetupModel createFromParcel(Parcel in) {
+            return new ScanSetupModel(in);
+        }
+
+        @Override
+        public ScanSetupModel[] newArray(int size) {
+            return new ScanSetupModel[size];
+        }
+    };
+
+
+    public ScanSetupModel() {
+    }
+}

+ 217 - 0
app/src/main/java/com/fxy/common/CosService.java

@@ -0,0 +1,217 @@
+package com.fxy.common;
+
+import android.content.Context;
+import android.os.Handler;
+import android.os.Message;
+
+import com.elvishew.xlog.XLog;
+import com.fxy.BuildConfig;
+import com.fxy.constant.SPCache;
+import com.fxy.net.Urls;
+import com.tencent.cos.xml.CosXmlServiceConfig;
+import com.tencent.cos.xml.CosXmlSimpleService;
+import com.tencent.cos.xml.exception.CosXmlClientException;
+import com.tencent.cos.xml.exception.CosXmlServiceException;
+import com.tencent.cos.xml.listener.CosXmlProgressListener;
+import com.tencent.cos.xml.listener.CosXmlResultListener;
+import com.tencent.cos.xml.model.CosXmlRequest;
+import com.tencent.cos.xml.model.CosXmlResult;
+import com.tencent.cos.xml.transfer.COSXMLUploadTask;
+import com.tencent.cos.xml.transfer.TransferConfig;
+import com.tencent.cos.xml.transfer.TransferManager;
+import com.tencent.cos.xml.transfer.TransferState;
+import com.tencent.cos.xml.transfer.TransferStateListener;
+import com.tencent.qcloud.core.auth.QCloudCredentialProvider;
+import com.tencent.qcloud.core.auth.SessionCredentialProvider;
+import com.tencent.qcloud.core.http.HttpRequest;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class CosService {
+    private  Context mContext;
+
+    private String bucketName = "";
+    private String path_prefix = "";
+    // 存储桶所在地域简称,例如广州地区是 ap-guangzhou
+    private String regionId = "";
+    // 创建 CosXmlServiceConfig 对象,根据需要修改默认的配置参数
+    private CosXmlServiceConfig serviceConfig ;
+    // 初始化 COS Service,获取实例
+    private CosXmlSimpleService cosXmlService ;
+    private COSXMLUploadTask cosxmlUploadTask;
+
+    public CosService(Context context,String prefix){
+        mContext = context;
+
+
+        SPCache spCache = SPCache.getInstance(mContext);
+        String cosHost = spCache.getResourceHost();
+        String  resource_prefix = spCache.getResourcePrefix();
+        //上传路径确保前缀
+        if (!resource_prefix.contains(resource_prefix)){
+            prefix = resource_prefix+prefix;
+        }
+
+        //zj-1304592070.cos.ap-singapore.myqcloud.com
+        bucketName = spCache.getResourceBucket();
+        regionId   = spCache.getResourceRegion();
+        path_prefix = prefix;
+        creationCos();
+
+
+    }
+
+
+    public CosXmlSimpleService creationCos(){
+        URL url = null; // 后台授权服务的 url 地址
+        try {
+            url = new URL(Urls.getServiceAddress(mContext)+ Urls.FMS_UPLOAD_SIGN);
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+
+        QCloudCredentialProvider credentialProvider = new SessionCredentialProvider(new HttpRequest.Builder<String>()
+                .url(url)
+                .method("GET")
+                .addHeader("warehouse-id",SPCache.getInstance(mContext).getWareHouseId())
+                .addHeader("version","999999")
+                .addHeader("token",SPCache.getInstance(mContext).getToken())
+                .encodedQuery("path_prefix",path_prefix+"*")
+                .build());
+
+        serviceConfig = new CosXmlServiceConfig.Builder()
+                .setRegion(regionId)
+                .isHttps(true) // 使用 HTTPS 请求, 默认为 HTTP 请求
+                .builder();
+        cosXmlService = new CosXmlSimpleService(mContext,serviceConfig, credentialProvider);
+        return cosXmlService;
+    }
+
+    public void cosUpload(String filePath, String uploadName , int num, Handler handler){
+        new CosThread(filePath, uploadName , num,handler).start();
+    }
+    //取消上传
+    public void taskCancel(){
+        if (cosxmlUploadTask!=null){
+            boolean pauseSuccess = cosxmlUploadTask.pauseSafely();
+            if (pauseSuccess){
+                cosxmlUploadTask.cancel();
+            }
+        }
+    }
+
+    //腾讯云cos上传
+    class CosThread extends Thread {
+        private String urlPath = "";
+        private String fileName = "";
+        private int current = 0;
+        private Handler uploadHandler ;
+        // 若存在初始化分块上传的 UploadId,则赋值对应的 uploadId 值用于续传;否则,赋值 null
+        private String uploadId = null;
+        /**
+         *
+         * @param filePath 本地文件路径
+         * @param uploadName 上传后文件名
+         * @param num 序号
+         */
+        public CosThread(String filePath, String uploadName , int num, Handler handler) {
+            urlPath = filePath;
+            fileName = uploadName;
+            current = num;
+            uploadHandler = handler;
+        }
+        public void run() {
+            // 初始化 TransferConfig,这里使用默认配置,如果需要定制,请参考 SDK 接口文档
+            TransferConfig transferConfig = new TransferConfig.Builder().build();
+            // 初始化 TransferManager
+            TransferManager transferManager = new TransferManager(getCosXmlService(), transferConfig);
+            String bucket = getBucketName(); //存储桶,格式:BucketName-APPID
+            String cosPath = getCosPath()+fileName; //对象在存储桶中的位置标识符,即称对象键
+            //String srcPath = new File(mContext.getCacheDir(), urlPath).toString(); //本地文件的绝对路径
+
+            // 上传文件
+            cosxmlUploadTask = transferManager.upload(bucket, cosPath,urlPath, uploadId);
+            //设置上传进度回调
+            cosxmlUploadTask.setCosXmlProgressListener(new CosXmlProgressListener() {
+                @Override
+                public void onProgress(long complete, long target) {
+                    // todo Do something to update progress...
+                    int progress = (int) ((double) complete / (double) target * 100);
+                    Message msg = new Message();
+                    msg.arg1 = progress;
+                    msg.what = 3;
+                    uploadHandler.sendMessage(msg);
+
+                }
+            });
+            //设置返回结果回调
+            cosxmlUploadTask.setCosXmlResultListener(new CosXmlResultListener() {
+                @Override
+                public void onSuccess(CosXmlRequest request, CosXmlResult result) {
+                    if (BuildConfig.DEBUG){
+                        XLog.e(result);
+                    }
+
+                    //COSXMLUploadTask.COSXMLUploadTaskResult cOSXMLUploadTaskResult = (COSXMLUploadTask.COSXMLUploadTaskResult) result;
+                    String[] accessUrlArr = result.accessUrl.split(".myqcloud.com");
+                    Message msg = new Message();
+                    msg.arg1 = current;
+                    msg.obj = accessUrlArr[1];
+                    msg.what = 2;
+                    uploadHandler.sendMessage(msg);
+                }
+                @Override
+                public void onFail(CosXmlRequest request, CosXmlClientException clientException, CosXmlServiceException serviceException) {
+                    Message msg = new Message();
+                    msg.what = 1;
+                    if (clientException != null) {
+                        // 本地异常,如网络异常等。
+                        msg.obj = "网络异常,请稍后...";
+                        uploadHandler.sendMessage(msg);
+                        //clientException.printStackTrace();
+                    } else {
+                        msg.obj = "服务异常,请稍后...";
+                        uploadHandler.sendMessage(msg);
+                        //serviceException.printStackTrace();
+                        XLog.e("ErrorCode", serviceException.getErrorCode());
+                        XLog.e("RequestId", serviceException.getRequestId());
+                        XLog.e("tLocalizedMessage", serviceException.getLocalizedMessage());
+                        XLog.e("Message", serviceException.getMessage());
+                    }
+                }
+            });
+            //设置任务状态回调, 可以查看任务过程
+            cosxmlUploadTask.setTransferStateListener(new TransferStateListener() {
+                @Override
+                public void onStateChanged(TransferState state) {
+                    // todo notify transfer state
+                    if (BuildConfig.DEBUG){
+                        XLog.e(state);
+                    }
+                    Message msg = new Message();
+                    msg.arg1 = current;
+                    msg.obj = state;
+                    msg.what = 5;
+                    uploadHandler.sendMessage(msg);
+                }
+            });
+        }
+    }
+
+    /**
+     *  返回  cosXmlService
+     * @return
+     */
+    public CosXmlSimpleService getCosXmlService(){
+        return  cosXmlService;
+    }
+
+    public String getBucketName(){
+        return bucketName;
+    }
+
+    public String getCosPath(){
+        return path_prefix;
+    }
+}

+ 168 - 0
app/src/main/java/com/fxy/common/FiledUpload.java

@@ -0,0 +1,168 @@
+package com.fxy.common;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.os.Message;
+import android.widget.Toast;
+
+import com.elvishew.xlog.XLog;
+import com.fxy.baselibrary.util.RxTimeTool;
+import com.fxy.R;
+import com.fxy.constant.SPCache;
+
+import org.json.JSONObject;
+
+import java.util.UUID;
+
+public class FiledUpload {
+    private Activity mActivity;
+    private Context mContext;
+    // 图片上传目录
+    private String mPrefix="default";
+
+    //是否停止上传
+    private String resourceUrl = "";
+    private String resourceType = "";
+    private String resourcePrefix = "";
+
+    private ProgressDialog progressDialog;
+    private OssService ossService;
+    private CosService cosService;
+
+    public FiledUpload(Activity activity, String prefix){
+        mActivity = activity;
+        mContext  = activity.getBaseContext();
+        mPrefix = prefix;
+        initData();
+    }
+    private void initData() {
+        SPCache spCache = SPCache.getInstance(mContext);
+        resourceUrl    = spCache.getResourceHost()+"/";
+        resourceType   = spCache.getResourceType();
+        resourcePrefix = spCache.getResourcePrefix();
+    }
+
+    private void closeDialog(){
+        if (progressDialog != null && !progressDialog.isIndeterminate() && progressDialog.isShowing()) {
+            progressDialog.dismiss();
+        }
+    }
+    @SuppressLint("HandlerLeak")
+    private android.os.Handler uploadHandler = new android.os.Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            try {
+                //XLog.e(msg);
+                JSONObject jsonObject = new JSONObject();
+
+                switch (msg.what){
+                    case 0:
+                        Toast.makeText(mActivity, "error", Toast.LENGTH_SHORT).show();
+                        break;
+                    case 1://失败
+                        String message = (String) msg.obj;
+                        if (!message.isEmpty()){
+                            Toast.makeText(mActivity, message, Toast.LENGTH_SHORT).show();
+                        }
+                        break;
+                    case 2://成功
+                        String file_path = (String) msg.obj;
+                        //表示数据存在
+                        Toast.makeText(mActivity, "上传成功", Toast.LENGTH_SHORT).show();
+
+                        break;
+                    case 3:
+                        //设置进度条
+                        progressDialog.setProgress(msg.arg1);
+                        //progressDialog.show();
+                        return;
+                    case 4:
+                        //获取上传状态
+
+                        return;
+                    default:
+                        break;
+                }
+                closeDialog();
+
+            } catch (Exception e) {
+                XLog.e(e.getMessage());
+                e.printStackTrace();
+            }
+        }
+    };
+    //取消任务
+    public void taskCancel(){
+
+        new AlertDialog.Builder(mActivity)
+                .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) {
+                //取消上传任务
+                if (resourceType.equals("tencent")){
+                    cosService.taskCancel();
+                }else{
+                    ossService.taskCancel();
+                }
+            }
+        }).show();
+
+
+
+        //task.waitUntilFinished(); // 等待任务完成。
+    }
+    public void filedUpload(String urlPath){
+        String fileSuffix = "";
+        if (urlPath.lastIndexOf(".")>-1) {
+            // 获取文件后缀名
+            fileSuffix = urlPath.substring(urlPath.lastIndexOf("."));
+        }
+        String fileName= UUID.randomUUID().toString() + fileSuffix;
+        filedUpload(urlPath,fileName);
+    }
+    public void filedUpload(String urlPath,String fileName){
+
+        progressDialog = new ProgressDialog(mActivity);
+        progressDialog.setTitle("文件准备上传");
+        progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+        //设置对话框执行内容
+        progressDialog.show();
+        //监听取消事件
+        progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
+            @Override
+            public void onCancel(DialogInterface dialog) {
+                // TODO Auto-generated method stub
+                taskCancel();
+            }
+
+        });
+
+
+        if (resourceType.equals("tencent")){
+            if (cosService==null){
+                String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+ RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+                cosService  = new CosService(mActivity.getBaseContext(),path_prefix);
+            }
+            //new cosThread(urlPath, fileName , num).start();
+            cosService.cosUpload(urlPath, fileName , 0,uploadHandler);
+        }else{
+            if (ossService ==null){
+                ossService = new OssService(mActivity,mPrefix);
+            }
+            ossService.ossUpload(urlPath, fileName , 0,uploadHandler);
+            //new ossThread(urlPath, fileName , num).start();
+        }
+    }
+
+}

+ 230 - 0
app/src/main/java/com/fxy/common/OssService.java

@@ -0,0 +1,230 @@
+package com.fxy.common;
+
+import android.content.Context;
+import android.os.Handler;
+import android.os.Message;
+import android.widget.Toast;
+
+import com.alibaba.sdk.android.oss.ClientConfiguration;
+import com.alibaba.sdk.android.oss.ClientException;
+import com.alibaba.sdk.android.oss.OSS;
+import com.alibaba.sdk.android.oss.OSSClient;
+import com.alibaba.sdk.android.oss.ServiceException;
+import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback;
+import com.alibaba.sdk.android.oss.callback.OSSProgressCallback;
+import com.alibaba.sdk.android.oss.common.OSSConstants;
+import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
+import com.alibaba.sdk.android.oss.common.auth.OSSFederationCredentialProvider;
+import com.alibaba.sdk.android.oss.common.auth.OSSFederationToken;
+import com.alibaba.sdk.android.oss.common.utils.IOUtils;
+import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
+import com.alibaba.sdk.android.oss.model.PutObjectRequest;
+import com.alibaba.sdk.android.oss.model.PutObjectResult;
+import com.elvishew.xlog.XLog;
+import com.fxy.baselibrary.util.RxTimeTool;
+import com.fxy.BuildConfig;
+import com.fxy.constant.SPCache;
+import com.fxy.net.Urls;
+
+import org.json.JSONObject;
+
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+public class OssService {
+    private Context mContext;
+    private  String endpoint = ""; //上传节点 比如:http://oss-cn-hongkong.aliyuncs.com
+    private  String bucketName = "hcjfiles"; // bucket值
+    private  String regionId = "cn-hongkong"; //地区 比如:cn-hongkong
+    private  String filePath = "dahuo/fxy/";
+    protected OSS oss ;
+    protected String ossHost="";
+    OSSAsyncTask taskId = null;
+
+    public String getBucketName(){
+        return bucketName;
+    }
+
+    public String getFilePath(){
+        return filePath;
+    }
+
+    public String getOssHost(){
+        return ossHost;
+    }
+
+    public OSS getOSS(){
+        return oss;
+    }
+    public OssService(Context context, String prefix){
+        mContext = context;
+        initData();
+        prefix = prefix.isEmpty()?"default/":prefix+"/";
+        filePath = filePath+prefix+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+
+        creationOss();
+    }
+
+    //创建 OSS
+    public OSS creationOss(){
+        // 在移动端建议使用STS的方式初始化OSSClient。
+        String stsServer = Urls.getServiceAddress(mContext)+ Urls.FMS_UPLOAD_SIGN;
+        // 推荐使用OSSAuthCredentialsProvider。token过期可以及时更新。
+
+        OSSCredentialProvider credentialProvider = new OSSFederationCredentialProvider() {
+            @Override
+            public OSSFederationToken getFederationToken() {
+                try {
+                    URL stsUrl = new URL(Urls.getServiceAddress(mContext)+ Urls.FMS_UPLOAD_SIGN);
+                    HttpURLConnection conn = (HttpURLConnection) stsUrl.openConnection();
+                    conn.setRequestProperty("warehouse-id", SPCache.getInstance(mContext).getWareHouseId());
+                    conn.setRequestProperty("version", "999999");
+                    conn.setRequestProperty("token", SPCache.getInstance(mContext).getToken());
+                    InputStream input = conn.getInputStream();
+                    String jsonText = IOUtils.readStreamAsString(input, OSSConstants.DEFAULT_CHARSET_NAME);
+                    JSONObject response = new JSONObject(jsonText);
+                    if (response.getInt("code")==1){
+                        JSONObject jsonObjs = response.getJSONObject("data");
+                        String ak = jsonObjs.getString("AccessKeyId");
+                        String sk = jsonObjs.getString("AccessKeySecret");
+                        String token = jsonObjs.getString("SecurityToken");
+                        String expiration = jsonObjs.getString("Expiration");
+                        SPCache spCache = SPCache.getInstance(mContext);
+                        if (jsonObjs.has("resource_region") && !spCache.getResourceRegion().equals(jsonObjs.getString("resource_region")) ||
+                                !spCache.getResourceBucket().equals(jsonObjs.getString("resource_bucket"))||
+                                !spCache.getResourcePrefix().equals(jsonObjs.getString("resource_prefix"))){
+                            spCache.setResourcePrefix(jsonObjs.getString("resource_prefix"));
+                            spCache.setResourceRegion(jsonObjs.getString("resource_region"));
+                            spCache.setResourceBucket(jsonObjs.getString("resource_bucket"));
+                            initData();
+                        }
+                        return new OSSFederationToken(ak, sk, token, expiration);
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                return null;
+            }
+        };
+
+        // 在移动端建议使用STS的方式初始化OSSClient。
+        //OSSCredentialProvider credentialProvider = new OSSStsTokenCredentialProvider(accessKeyId, accessKeySecret, "");
+
+        ClientConfiguration conf = new ClientConfiguration();
+        conf.setConnectionTimeout(15 * 1000); // 连接超时,默认15秒。
+        conf.setSocketTimeout(15 * 1000); // socket超时,默认15秒。
+        conf.setMaxConcurrentRequest(5); // 最大并发请求书,默认5个。
+        conf.setMaxErrorRetry(2); // 失败后最大重试次数,默认2次。
+        oss = new OSSClient(mContext, endpoint, credentialProvider, conf);
+
+
+        //开始日志
+        //OSSLog.enableLog();
+        return oss;
+    }
+
+    //初始化oss数据以及切换不同的oss账号
+    private void initData(){
+        SPCache spCache = SPCache.getInstance(mContext);
+        ossHost = spCache.getResourceHost();
+        filePath = spCache.getResourcePrefix()+"/android/";
+        //匹配资源
+
+        bucketName = spCache.getResourceBucket();
+        regionId   = spCache.getResourceRegion();
+        if (!regionId.isEmpty()){
+            endpoint   = "https://oss-"+regionId+".aliyuncs.com";
+        }
+
+        if (regionId.isEmpty()){
+            Toast.makeText(mContext, "资源路径异常", Toast.LENGTH_SHORT).show();
+        }
+    }
+
+    public void ossUpload(String filePath, String uploadName , int num, Handler handler){
+        new ossThread(filePath, uploadName , num,handler).start();
+        // task.cancel(); // 可以取消任务
+        // task.waitUntilFinished(); // 可以等待直到任务完成
+    }
+
+    //取消上传
+    public void taskCancel(){
+        if (taskId!=null && !taskId.isCanceled()){
+            taskId.cancel();
+        }
+    }
+
+    //阿里云oss上传
+    class ossThread extends Thread {
+        private String urlPath = "";
+        private String objectKey = "";
+        private int current = 0;
+        private Handler uploadHandler ;
+        public ossThread(String filePath, String fileName ,int num,Handler handler) {
+            urlPath = filePath;
+            objectKey = fileName;
+            current = num;
+            uploadHandler = handler;
+        }
+        public void run() {
+
+            // 下面3个参数依次为bucket名,ObjectKey名,上传文件路径
+            final PutObjectRequest put = new PutObjectRequest(getBucketName(), getFilePath()+objectKey, urlPath);
+            // 设置进度回调
+            put.setProgressCallback(new OSSProgressCallback<PutObjectRequest>() {
+                @Override
+                public void onProgress(PutObjectRequest request, long currentSize, long totalSize) {
+                    // 进度逻辑
+                    int progress = (int) ((double) currentSize / (double) totalSize * 100);
+                    Message msg = new Message();
+                    msg.arg1 = progress;
+                    msg.what = 3;
+                    uploadHandler.sendMessage(msg);
+                }
+            });
+            // 异步上传
+            taskId = oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() {
+                @Override
+                public void onSuccess(PutObjectRequest request, PutObjectResult result) {
+
+                    if (BuildConfig.DEBUG){
+                        XLog.e(request);
+                    }
+                    Message msg = new Message();
+                    msg.arg1 = current;
+                    msg.obj = "/"+request.getObjectKey();
+                    msg.what = 2;
+                    uploadHandler.sendMessage(msg);
+                }
+
+                @Override
+                public void onFailure(PutObjectRequest request, ClientException clientExcepion, ServiceException serviceException) {
+                    Message msg = new Message();
+                    msg.what = 1;
+                    if (clientExcepion != null) {
+                        // 本地异常,如网络异常等。
+                        msg.obj = "网络异常,请稍后...";
+                        uploadHandler.sendMessage(msg);
+                        XLog.e("RawMessage", clientExcepion.getMessage());
+                    }
+                    if (serviceException != null) {
+                        msg.obj = "服务异常,请稍后...";
+                        uploadHandler.sendMessage(msg);
+                        if (BuildConfig.DEBUG){
+                            // 服务异常。
+                            XLog.e("ErrorCode", serviceException.getErrorCode());
+                            XLog.e("RequestId", serviceException.getRequestId());
+                            XLog.e("HostId", serviceException.getHostId());
+                            XLog.e("RawMessage", serviceException.getRawMessage());
+                        }
+                    }
+                }
+            });
+        }
+    }
+
+
+
+
+}

+ 512 - 0
app/src/main/java/com/fxy/common/PictureSelectorUpload.java

@@ -0,0 +1,512 @@
+package com.fxy.common;
+
+import android.Manifest;
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Handler;
+import android.os.Message;
+import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.Gravity;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.PopupWindow;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.alibaba.sdk.android.oss.internal.OSSAsyncTask;
+import com.elvishew.xlog.XLog;
+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.luck.picture.lib.permissions.Permission;
+import com.luck.picture.lib.permissions.RxPermissions;
+import com.fxy.baselibrary.util.RxTimeTool;
+import com.fxy.R;
+import com.fxy.adapter.GridImageAdapter;
+import com.fxy.constant.SPCache;
+import com.fxy.view.FullyGridLayoutManager;
+
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import io.reactivex.functions.Consumer;
+
+public class PictureSelectorUpload {
+    private Activity mActivity;
+    private Context mContext;
+    private int maxSelectNum = 9;
+    private GridImageAdapter adapter;
+    private RecyclerView mRecyclerView;
+    private PopupWindow pop;
+
+    private OSSAsyncTask task;
+    private ProgressDialog progressDialog;
+    List<String> errorList =  new ArrayList<String> ();;
+
+    //等待上传
+    private List<LocalMedia> awaitUploadList=new ArrayList<>();
+    //已失败
+    private List<LocalMedia> failUploadList=new ArrayList<>();
+    //已上传好的
+    private List<LocalMedia> selectList = new ArrayList<>();
+    //已上传
+    private ArrayList<String> ossPhotoList =new ArrayList<>();
+    // 图片上传目录
+    private String mPrefix="tally";
+
+    //是否停止上传
+    private String resourceUrl = "";
+
+    private String resourceType = "";
+
+    private String resourcePrefix = "";
+
+    private OssService ossService;
+
+    private CosService cosService;
+
+
+
+    public PictureSelectorUpload(Activity activity, RecyclerView rvShowImg, String prefix){
+        mActivity = activity;
+        mContext  = activity.getBaseContext();
+        mRecyclerView = rvShowImg;
+        mPrefix = prefix;
+        initAdapter();
+        initData();
+
+    }
+
+    private void initData() {
+        SPCache spCache = SPCache.getInstance(mContext);
+        resourceUrl    = spCache.getResourceHost()+"/";
+        resourceType   = spCache.getResourceType();
+        resourcePrefix = spCache.getResourcePrefix();
+    }
+
+    public ArrayList getPhotoList(){
+        return  adapter.getPhotoList();
+    }
+
+    public void emptyRemake(){
+        selectList.clear();
+        ossPhotoList.clear();
+        adapter.notifyDataSetChanged();
+    }
+
+
+    //销毁
+    public void removeHandler(){
+        if (uploadHandler!=null){
+            uploadHandler.removeCallbacksAndMessages(null);
+        }
+    }
+
+    /**
+     * 获取选中图片
+     * @param data
+     */
+    public void getSelectImg (Intent data){
+        List<LocalMedia>  images = PictureSelector.obtainMultipleResult(data);
+        //selectList = PictureSelector.obtainMultipleResult(data);
+        awaitUploadList.addAll(images);
+        // 例如 LocalMedia 里面返回三种path
+        // 1.media.getPath(); 为原图path
+        // 2.media.getCutPath();为裁剪后path,需判断media.isCut();是否为true
+        // 3.media.getCompressPath();为压缩后path,需判断media.isCompressed();是否为true
+        // 如果裁剪并压缩了,以取压缩路径为准,因为是先裁剪后压缩的
+
+
+
+        if (progressDialog != null && progressDialog.isShowing()) {
+            progressDialog.dismiss();
+            progressDialog = null;
+        }
+        progressDialog = new ProgressDialog(mActivity);
+        progressDialog.setTitle("待上传文件"+awaitUploadList.size()+"个");
+        progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+        progressDialog.setCanceledOnTouchOutside(false);
+        progressDialog.show();
+
+        //监听取消事件
+        progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
+            @Override
+            public void onCancel(DialogInterface dialog) {
+                // TODO Auto-generated method stub
+                taskCancel();
+                return ;
+            }
+
+        });
+
+
+        filedUpload();
+        //new UploadThread().start();;
+
+    }
+
+    //取消任务
+    public void taskCancel(){
+
+        if (awaitUploadList.size()>0){
+            new AlertDialog.Builder(mActivity)
+                    .setTitle(R.string.dl_hint)
+                    .setMessage("确定取消上传,并且清空所有上传任务?")
+                    .setNegativeButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                            dialogInterface.dismiss();
+                            boolean a = progressDialog.isIndeterminate();
+                            boolean b = progressDialog.isShowing();
+                            if (progressDialog!=null && !progressDialog.isShowing()){
+                                progressDialog.show();
+                            }
+                        }
+                    }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
+
+                @Override
+                public void onClick(DialogInterface dialogInterface, int i) {
+                    dialogInterface.dismiss();
+                    //取消上传任务
+                    if (resourceType.equals("tencent")){
+                        cosService.taskCancel();
+                    }else{
+                        ossService.taskCancel();
+                    }
+                    awaitUploadList.clear();
+
+                }
+            }).show();
+        }else if(failUploadList.size()>0){
+            new AlertDialog.Builder(mActivity)
+                    .setTitle(R.string.dl_hint)
+                    .setMessage("上传失败是否继续上传?")
+                    .setNegativeButton(R.string.str_cancel, new DialogInterface.OnClickListener() {
+                        @Override
+                        public void onClick(DialogInterface dialogInterface, int i) {
+                            dialogInterface.dismiss();
+                            progressDialog.dismiss();
+                            failUploadList.clear();
+
+                        }
+                    }).setPositiveButton(R.string.str_submit, new DialogInterface.OnClickListener() {
+
+                @Override
+                public void onClick(DialogInterface dialogInterface, int i) {
+                    awaitUploadList.addAll(failUploadList);
+                    filedUpload();
+                }
+            }).show();
+        }
+
+
+
+        //task.waitUntilFinished(); // 等待任务完成。
+    }
+
+
+
+
+    @SuppressLint("HandlerLeak")
+    private Handler uploadHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            try {
+                //XLog.e(msg);
+                JSONObject jsonObject = new JSONObject();
+                String showTitle = "待上传文件"+(awaitUploadList.size())+"个";
+
+                switch (msg.what){
+                    case 0:
+                        Toast.makeText(mActivity, "error", Toast.LENGTH_SHORT).show();
+                        break;
+                    case 1://失败
+                        if (awaitUploadList.size()>0){
+                            LocalMedia localMedia = awaitUploadList.get(0);
+                            awaitUploadList.remove(0);
+                            failUploadList.add(localMedia);
+                            String message = (String) msg.obj;
+                            if (!message.isEmpty()){
+                                Toast.makeText(mActivity, message, Toast.LENGTH_SHORT).show();
+                            }
+                        }
+                        break;
+                    case 2://成功
+                        String file_path = (String) msg.obj;
+                        int current = msg.arg1;
+                        //表示数据存在
+                        if (awaitUploadList.size()>current){
+                            LocalMedia localMedia = awaitUploadList.get(current);
+                            awaitUploadList.remove(current);
+                            selectList.add(localMedia);
+                            ossPhotoList.add(file_path);
+                            adapter.setPhotoPath(file_path);
+                            adapter.setList(selectList);
+                            adapter.notifyDataSetChanged();
+                            progressDialog.setTitle(showTitle);
+                        }
+                        break;
+                    case 3:
+                        //设置进度条
+                        progressDialog.setProgress(msg.arg1);
+                        //progressDialog.show();
+                        return;
+                    case 4:
+                        //获取上传状态
+
+                        return;
+                    default:
+                        break;
+                }
+
+                if (failUploadList.size()>0){
+                    showTitle= showTitle+",失败"+failUploadList.size()+"个";
+                }
+
+                progressDialog.setTitle(showTitle);
+                if (awaitUploadList.size()>0){
+                    filedUpload();
+                }else{
+                    closeDialog();
+                }
+            } catch (Exception e) {
+                XLog.e(e.getMessage());
+                e.printStackTrace();
+            }
+        }
+    };
+
+    private void closeDialog(){
+        if (progressDialog != null && !progressDialog.isIndeterminate() && progressDialog.isShowing()) {
+            progressDialog.cancel();
+        }
+    }
+
+    public void filedUpload(){
+        if (awaitUploadList.size()==0){
+            progressDialog.cancel();
+            return;
+        }
+        //设置对话框执行内容
+        if (progressDialog!=null){
+            progressDialog.setTitle("待上传文件"+awaitUploadList.size()+"个");
+            progressDialog.setProgress(0);
+        }
+
+        //上传第几个
+        int num = 0;
+
+        LocalMedia localMedia = awaitUploadList.get(num);
+        String urlPath =localMedia.getPath();
+        if (urlPath.isEmpty()){
+            Message msg = new Message();
+            msg.obj = "文件路径不存在";
+            msg.what = 1;
+            uploadHandler.sendMessage(msg);
+            return;
+        }
+
+        String fileSuffix = "";
+        if (urlPath.lastIndexOf(".")>-1) {
+            // 获取文件后缀名
+            fileSuffix = urlPath.substring(urlPath.lastIndexOf("."));
+        }
+
+        String fileName= UUID.randomUUID().toString() + fileSuffix;
+
+        if (resourceType.equals("tencent")){
+            if (cosService==null){
+                String path_prefix = resourcePrefix+"/android/"+mPrefix+"/"+RxTimeTool.getYestoryDate("yyyyMMd")+"/";
+                cosService  = new CosService(mActivity.getBaseContext(),path_prefix);
+            }
+            //new cosThread(urlPath, fileName , num).start();
+            cosService.cosUpload(urlPath, fileName , num,uploadHandler);
+
+        }else{
+            if (ossService ==null){
+                ossService = new OssService(mActivity,mPrefix);
+            }
+            ossService.ossUpload(urlPath, fileName , num,uploadHandler);
+            //new ossThread(urlPath, fileName , num).start();
+        }
+        // task.cancel(); // 可以取消任务
+        // task.waitUntilFinished(); // 可以等待直到任务完成
+    }
+
+
+    private void initAdapter() {
+        FullyGridLayoutManager manager = new FullyGridLayoutManager(mActivity, 3, GridLayoutManager.VERTICAL, false);
+        mRecyclerView.setLayoutManager(manager);
+        adapter = new GridImageAdapter(mActivity, onAddPicClickListener);
+        adapter.setList(selectList);
+        adapter.setSelectMax(maxSelectNum);
+        mRecyclerView.setAdapter(adapter);
+        adapter.setOnItemClickListener(new GridImageAdapter.OnItemClickListener() {
+            @Override
+            public void onItemClick(int position, View v) {
+                if (selectList.size() > 0) {
+                    LocalMedia media = selectList.get(position);
+                    String pictureType = media.getPictureType();
+                    int mediaType = PictureMimeType.pictureToVideo(pictureType);
+                    switch (mediaType) {
+                        case 1:
+                            // 预览图片 可自定长按保存路径
+                            //PictureSelector.create(MainActivity.this).externalPicturePreview(position, "/custom_file", selectList);
+                            com.luck.picture.lib.PictureSelector.create(mActivity).externalPicturePreview(position, selectList);
+                            break;
+                        case 2:
+                            // 预览视频
+                            com.luck.picture.lib.PictureSelector.create(mActivity).externalPictureVideo(media.getPath());
+                            break;
+                        case 3:
+                            // 预览音频
+                            com.luck.picture.lib.PictureSelector.create(mActivity).externalPictureAudio(media.getPath());
+                            break;
+                    }
+                }
+            }
+        });
+    }
+
+
+
+    public GridImageAdapter.onAddPicClickListener onAddPicClickListener = new GridImageAdapter.onAddPicClickListener() {
+
+        @SuppressLint("CheckResult")
+        @Override
+        public void onAddPicClick() {
+            //获取写的权限
+            RxPermissions rxPermission = new RxPermissions(mActivity);
+            rxPermission.requestEach(Manifest.permission.WRITE_EXTERNAL_STORAGE)
+                    .subscribe(new Consumer<Permission>() {
+                        @Override
+                        public void accept(Permission permission) {
+                            if (permission.granted) {// 用户已经同意该权限
+                                //第一种方式,弹出选择和拍照的dialog
+                                showPop();
+
+                                //第二种方式,直接进入相册,但是 是有拍照得按钮的
+//                                showAlbum();
+                            } else {
+                                Toast.makeText(mContext, "拒绝", Toast.LENGTH_SHORT).show();
+                            }
+                        }
+                    });
+        }
+    };
+
+    private void showAlbum() {
+        //参数很多,根据需要添加
+        com.luck.picture.lib.PictureSelector.create(mActivity)
+                .openGallery(PictureMimeType.ofImage())// 全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()、音频.ofAudio()
+                .maxSelectNum(maxSelectNum)// 最大图片选择数量
+                .minSelectNum(1)// 最小选择数量
+                .imageSpanCount(4)// 每行显示个数
+                .selectionMode(PictureConfig.MULTIPLE)// 多选 or 单选PictureConfig.MULTIPLE : PictureConfig.SINGLE
+                .previewImage(true)// 是否可预览图片
+                .isCamera(true)// 是否显示拍照按钮
+                .isZoomAnim(true)// 图片列表点击 缩放效果 默认true
+                //.setOutputCameraPath("/CustomPath")// 自定义拍照保存路径
+                .enableCrop(true)// 是否裁剪
+                .compress(true)// 是否压缩
+                //.sizeMultiplier(0.5f)// glide 加载图片大小 0~1之间 如设置 .glideOverride()无效
+                .glideOverride(160, 160)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度
+                .withAspectRatio(1, 1)// 裁剪比例 如16:9 3:2 3:4 1:1 可自定义
+                //.selectionMedia(selectList)// 是否传入已选图片
+                //.previewEggs(false)// 预览图片时 是否增强左右滑动图片体验(图片滑动一半即可看到上一张是否选中)
+                //.cropCompressQuality(90)// 裁剪压缩质量 默认100
+                //.compressMaxKB()//压缩最大值kb compressGrade()为Luban.CUSTOM_GEAR有效
+                //.compressWH() // 压缩宽高比 compressGrade()为Luban.CUSTOM_GEAR有效
+                //.cropWH()// 裁剪宽高比,设置如果大于图片本身宽高则无效
+                .rotateEnabled(false) // 裁剪是否可旋转图片
+                //.scaleEnabled()// 裁剪是否可放大缩小图片
+                //.recordVideoSecond()//录制视频秒数 默认60s
+                .forResult(PictureConfig.CHOOSE_REQUEST);//结果回调onActivityResult code
+    }
+
+    private void showPop() {
+        View bottomView = View.inflate(mContext, R.layout.layout_bottom_dialog, null);
+        TextView mAlbum = bottomView.findViewById(R.id.tv_album);
+        TextView mCamera = bottomView.findViewById(R.id.tv_camera);
+        TextView mCancel = bottomView.findViewById(R.id.tv_cancel);
+
+        pop = new PopupWindow(bottomView, -1, -2);
+        pop.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+        pop.setOutsideTouchable(true);
+        pop.setFocusable(true);
+        WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
+        lp.alpha = 0.5f;
+        mActivity.getWindow().setAttributes(lp);
+        pop.setOnDismissListener(new PopupWindow.OnDismissListener() {
+
+            @Override
+            public void onDismiss() {
+                WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
+                lp.alpha = 1f;
+                mActivity.getWindow().setAttributes(lp);
+            }
+        });
+        pop.setAnimationStyle(R.style.main_menu_photo_anim);
+        pop.showAtLocation(mActivity.getWindow().getDecorView(), Gravity.BOTTOM, 0, 0);
+
+        View.OnClickListener clickListener = new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                switch (view.getId()) {
+                    case R.id.tv_album:
+                        //相册
+                        com.luck.picture.lib.PictureSelector.create(mActivity)
+                                .openGallery(PictureMimeType.ofImage())
+                                .maxSelectNum(maxSelectNum)
+                                .minSelectNum(1)
+                                .imageSpanCount(4)
+                                .selectionMode(PictureConfig.MULTIPLE)
+                                .forResult(PictureConfig.CHOOSE_REQUEST);
+                        break;
+                    case R.id.tv_camera:
+                        //拍照
+                        com.luck.picture.lib.PictureSelector.create(mActivity)
+                                .openCamera(PictureMimeType.ofImage())
+                                //只需要拍照
+                                //.selectionMode(PictureConfig.SINGLE)
+                                //.isCamera(true)
+                                .forResult(PictureConfig.CHOOSE_REQUEST);
+
+                        break;
+                    case R.id.tv_cancel:
+                        //取消
+                        //closePopupWindow();
+                        break;
+                }
+                closePopupWindow();
+            }
+        };
+
+        mAlbum.setOnClickListener(clickListener);
+        mCamera.setOnClickListener(clickListener);
+        mCancel.setOnClickListener(clickListener);
+    }
+
+    public void closePopupWindow() {
+        if (pop != null && pop.isShowing()) {
+            pop.dismiss();
+            pop = null;
+        }
+    }
+
+
+
+
+}

+ 145 - 0
app/src/main/java/com/fxy/common/VersionUpgrades.java

@@ -0,0 +1,145 @@
+package com.fxy.common;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.widget.TextView;
+
+import com.fxy.R;
+import com.fxy.base.StorageApplication;
+import com.fxy.baselibrary.util.DateUtil;
+import com.fxy.baselibrary.util.JsonUtil;
+import com.fxy.baselibrary.views.MarqueeTextView;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.UpdateModel;
+import com.fxy.constant.SPCache;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+import com.fxy.utils.AllDialogShowStrategy;
+import com.lzy.okgo.OkGo;
+
+import org.lzh.framework.updatepluginlib.UpdateBuilder;
+import org.lzh.framework.updatepluginlib.base.UpdateParser;
+import org.lzh.framework.updatepluginlib.model.Update;
+
+import java.util.UUID;
+
+/**
+ * 本版升级共用基础类
+ */
+public class VersionUpgrades {
+    private final Context mContext;
+    private int currentVersionCode = 0;
+    private String currentVersionName="";
+    private String currentVersionContent="";
+    private String firstInstallTime="";
+    private String lastUpdateTime="";
+
+    private MarqueeTextView mtVersionName;
+    private TextView tvUpdateContent;
+
+    public VersionUpgrades(Context context){
+        mContext = context;
+        getVersionCode();
+    }
+
+    public String getCurrentVersionName(){
+        return currentVersionName;
+    }
+    public String getCurrentVersionContent(){
+        return currentVersionContent;
+    }
+    public String getLastUpdateTime(){
+        return lastUpdateTime;
+    }
+    //获取当前本版号
+    private void getVersionCode() {
+        try {
+            PackageManager manager = mContext.getPackageManager();
+            PackageInfo packageInfo = manager.getPackageInfo(mContext.getPackageName(), 0);
+            //XLog.e(packageInfo);
+            currentVersionCode = packageInfo.versionCode;
+            currentVersionName = packageInfo.versionName;
+            //应用装时间
+            firstInstallTime = DateUtil.utc2Local(DateUtil.getStandardMillon(packageInfo.firstInstallTime), DateUtil.FORMAT_YMDHMS);
+            //应用最后一次更新时间
+            lastUpdateTime = DateUtil.utc2Local(DateUtil.getStandardMillon(packageInfo.lastUpdateTime), DateUtil.FORMAT_YMDHMS);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+
+    //检查设置
+    public void checkUpgrades(MarqueeTextView marqueeTextView, TextView textView){
+        mtVersionName = marqueeTextView;
+        tvUpdateContent = textView;
+        checkUpgrades();
+    }
+    //升级本版
+    public void checkUpgrades(){
+        OkGo.<String>get(Urls.getVersionUpdate(mContext) + "?v=" + UUID.randomUUID().toString())
+                .execute(new MyDialogCallback(mContext, false, false) {
+                    @Override
+                    public void onSuccess(com.lzy.okgo.model.Response<String> response) {
+                        //super.onSuccess(response);
+                        try {
+                            ActionBean bean = JsonUtil.getObject(response.body().toString(), ActionBean.class);
+                            if (bean.code == 1) {
+                                final UpdateModel updateModel = JsonUtil.getObject(bean.data, UpdateModel.class);
+                                boolean isNewVersion = updateModel.getVersionCode() > currentVersionCode;
+
+                                //设置缓存获取
+                                SPCache sp = SPCache.getInstance(mContext);
+                                if (updateModel.getVersionCode()==currentVersionCode){
+                                    currentVersionContent = updateModel.getUpdateContent();
+                                    currentVersionName = String.format("%s(%s)",currentVersionName,mContext.getString(R.string.str_latest_version));
+                                    sp.setVersion(currentVersionContent);
+                                }else if (currentVersionCode > updateModel.getVersionCode()){
+                                    //开发版
+                                    currentVersionName = mContext.getString(R.string.str_version);
+                                    currentVersionContent = mContext.getString(R.string.str_updated_details);
+                                    sp.setVersion(currentVersionContent);
+                                }
+
+                                //判断是否需要更新页面信息
+                                if (mtVersionName!=null && tvUpdateContent!=null){
+                                    try {
+                                        tvUpdateContent.setText(currentVersionContent);
+                                        mtVersionName.setText(currentVersionName);
+                                    } catch (Exception e) {
+                                        e.printStackTrace();
+                                    }
+                                }
+
+                                if (isNewVersion){
+                                    UpdateBuilder updateBuilder = UpdateBuilder.create();
+                                    updateBuilder.getConfig().setUrl(Urls.getVersionUpdate(mContext) + "?v=" + UUID.randomUUID().toString());
+                                    updateBuilder.setUpdateParser(new UpdateParser() {
+                                        @Override
+                                        public Update parse(String response) throws Exception {
+                                            Update update = new Update();
+                                            update.setForced(updateModel.isForced());
+                                            update.setIgnore(updateModel.isIgnore());
+                                            update.setUpdateContent(updateModel.getUpdateContent());
+                                            update.setUpdateUrl(updateModel.getUpdateUrl() + "?v=" + UUID.randomUUID().toString());
+                                            update.setVersionCode(updateModel.getVersionCode());
+                                            update.setVersionName(updateModel.getVersionName());
+                                            return update;
+                                        }
+                                    });
+                                    StorageApplication.context.isShowUpdateToast = true;
+                                    updateBuilder.setUpdateStrategy(new AllDialogShowStrategy()).check();
+                                }
+
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+
+                    }
+                });
+    }
+}

+ 40 - 0
app/src/main/java/com/fxy/constant/BaseConfig.java

@@ -0,0 +1,40 @@
+package com.fxy.constant;
+
+/**
+ * 系统基本常量
+ * @author James.Jiang
+ * @date 2020-05-22
+ */
+public class BaseConfig {
+    public static final String SPName = "cargo_pda_sp";
+
+    public static final String COMMON_SCANNER_ONLY = "common_scanner_only";
+
+    /**
+     * 登陆类型:默认为仓库
+     * 1:仓库
+     */
+    public static final String CLIENT_CODE = "client_code";
+
+    /**
+     * 服务地址缓存KEY
+     */
+    public static final String SERVICE_ADDRESS = "service_address";
+
+    /**
+     * 服务仓库缓存KEY
+     */
+    public static final String WAREHOUSE_LIST = "warehouse_list";
+
+    /**
+     * 服务类型缓存KEY
+     */
+    public static final String SERVICE_TYPE = "service_type";
+    /**
+     * 区域序号缓存KEY
+     */
+    public static final String AREA_CODE = "area_code";
+
+    /************************************************界面之间传输值的KEY***************************************************/
+
+}

+ 116 - 0
app/src/main/java/com/fxy/constant/EventCode.java

@@ -0,0 +1,116 @@
+package com.fxy.constant;
+
+/**
+ * 项目名称:FingerStorage
+ * 类描述:EventBus通讯标志
+ * 创建人:admin
+ * 创建时间:2018/3/14 16:58
+ * 修改人:COMP-021-2006
+ * 修改时间:2018/3/14 16:58
+ * 修改备注:
+ */
+
+public final class EventCode {
+    /**
+     * 刷新蓝牙监听
+     */
+    public static final int refresh_blue_lister = 0x1;
+    /**
+     * 未完成任务刷新
+     */
+    public static final int taskToRefresh = 0x2;
+    /**
+     * 已完成任务刷新
+     */
+    public static final int taskCompleteRefresh = 0x3;
+
+    /**
+     * 完成单项货物信息的添加
+     */
+    public static final int taskToTransmissionGoodsDetails = 0x4;
+
+    /**
+     * 更新显示的商户信息
+     */
+    public static final int taskToTransmissionBusinessInfomation = 0x5;
+    /**
+     * 更新显示的商品名称信息
+     */
+    public static final int taskToTransmissionGoodsNameInfomation = 0x6;
+
+    /**
+     * 完成更新按箱收货的单货信息
+     */
+    public static final int taskToTransmissionGoodsBarInfomation = 0x7;
+
+    /**
+     * 完成更新按箱收货的单箱信息
+     */
+    public static final int taskToTransmissionGoodsBarOfBoxInfomation = 0x8;
+
+    /**
+     * 完成更新上架的货品信息
+     */
+    public static final int taskToTransmissionUpperShelf = 0x9;
+
+    /**
+     * 拣货任务的拣货item
+     */
+    public static final int pickCargoItemBean = 0x101;
+    /**
+     * 装箱任务的装箱item
+     */
+    public static final int binningBoxItemBean = 0x102;
+/**
+     * 装箱任务的装箱item里的货物item
+     */
+    public static final int binningBoxCargoItemBean = 0x103;
+    /**
+     * 码盘任务的码盘列表
+     */
+    public static final int trayBoxItemBean = 0x104;
+    /**
+     * 获取图片上传后服务器返回的地址集合(逗号分隔)
+     */
+    public static final int getImgUrl = 0x105;
+    /**
+     * 录制视频后视频存储地址
+     */
+    public static final int getVideoModel = 0x106;
+    /**
+     * 上传视频后的model
+     */
+    public static final int getVideoUrlModel = 0x107;
+    /**
+     * 盘点任务刷新
+     */
+    public static final int check_refresh = 0x108;
+    /**
+     * 收货包材赋值
+     */
+    public static final int packingMaterials = 0x109;
+    /**
+     * 收货主面板刷新
+     */
+    public static final int receive_main_refresh = 0x110;
+    /**
+     * 上架主面板刷新
+     */
+    public static final int putway_main_refresh = 0x111;
+
+    /**
+     * 包装校验-剔除无货订单
+     */
+    public static final int pack_validate_delete_order = 0x112;
+
+    /**
+     * 移位刷新
+     */
+    public static final int displacement_refresh = 0x113;
+
+    /**
+     * FBA签出任务刷新
+     */
+    public static final int check_out_refresh = 0x114;
+
+}

+ 243 - 0
app/src/main/java/com/fxy/constant/SPCache.java

@@ -0,0 +1,243 @@
+package com.fxy.constant;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+
+
+/**
+ * 用户缓存对象
+ *
+ * @date 2020-02-02
+ */
+
+public class SPCache {
+    private static SPCache spCache;
+    private SharedPreferences sp;
+    private SharedPreferences.Editor editor;
+
+    private SPCache(Context context) {
+        sp = context.getSharedPreferences(BaseConfig.SPName, Context.MODE_PRIVATE);
+        editor = sp.edit();
+    }
+
+    public static SPCache getInstance(Context context) {
+        if (spCache == null) {
+            spCache = new SPCache(context);
+        }
+        return spCache;
+    }
+
+    /**
+     * 设置客户端类型
+     */
+    public void setClientCode(String clientCode) {
+        editor.putString("clientCode", clientCode).commit();
+    }
+
+    /**
+     * 用户ID
+     */
+    public void setUserId(String userId) {
+        editor.putString("userId", userId).commit();
+    }
+
+    public String getUserId() {
+        return sp.getString("userId", "");
+    }
+
+    /**
+     * 用户仓库ID
+     */
+    public void setWareHouseId(String wareHouseId) {
+        editor.putString("wareHouseId", wareHouseId).commit();
+    }
+
+    public String getWareHouseId() {
+        return sp.getString("wareHouseId", "");
+    }
+    /**
+     * 用户仓库名称
+     */
+    public void setWareHouseName(String wareHouseName) {
+        editor.putString("wareHouseName", wareHouseName).commit();
+    }
+
+    public String getWareHouseName() {
+        return sp.getString("wareHouseName", "");
+    }
+
+
+    /**
+     * 性别
+     */
+    public String getGender() {
+        return sp.getString("gender", "");
+    }
+
+    public void setGender(String gender) {
+        editor.putString("gender", gender).commit();
+    }
+
+    /**
+     * 头像
+     */
+    public String getAvatarUrl() {
+        return sp.getString("avatarUrl", "");
+    }
+
+    public void setAvatarUrl(String avatar_url) {
+        editor.putString("avatarUrl", avatar_url).commit();
+    }
+
+    /**
+     * token
+     */
+    public void setToken(String token) {
+        editor.putString("token", token).commit();
+    }
+
+    public String getToken() {
+        return sp.getString("token", "");
+    }
+    public void clearCache() {
+        editor.clear();
+        editor.apply();
+    }
+
+    /**
+     * 用户名称
+     */
+    public void setUserName(String userName) {
+        editor.putString("userName", userName).commit();
+    }
+
+    public String getUserName() {
+        return sp.getString("userName", "");
+    }
+    public void setAccountName(String accountName) {
+        editor.putString("accountName", accountName).commit();
+    }
+
+    public String getAccountName() {
+        return sp.getString("accountName", "");
+    }
+    /**
+     * 用户手机
+     */
+    public void setUserPhone(String userPhone) {
+        editor.putString("userPhone", userPhone).commit();
+    }
+
+    /**
+     * 重量单位
+     * @return
+     */
+    public String getWeightUnit() {
+        return sp.getString("weight_unit", "");
+    }
+    public void setWeightUnit(String weight_unit){
+        editor.putString("weight_unit", weight_unit).commit();
+    }
+    /**
+     * 公司名称
+     * @return
+     */
+    public String getCompanyName() {
+        return sp.getString("company_name", "");
+    }
+    public void setCompanyName(String company_name){
+        editor.putString("company_name", company_name).commit();
+    }
+    //保存本版描述信息
+    public String getVersion() {
+        return sp.getString("version_describe", "");
+    }
+    public void setVersion(String version_describe){
+        editor.putString("version_describe", version_describe).commit();
+    }
+
+
+    /**
+     * 蓝牙对象json  获取以后需要转换
+     */
+    public Object getBluesScalePin() {
+        return sp.getString("bluesScalePin", "[{\"blue_ele_scale\":\"HC-06\",\"blue_ele_scale_pin\":\"1234\",\"reverse\":0,\"continuous\":1,\"is_record_log\":0,\"is_clear_weight\":0}]");
+    }
+
+    public void setBluesScalePin(String bluesScalePin) {
+        editor.putString("bluesScalePin", bluesScalePin).commit();
+    }
+
+    public String getCurrentBluesScale() {
+        return sp.getString("current_blues_scale", "");
+    }
+    public void setCurrentBluesScale(String current_blues_scale){
+        editor.putString("current_blues_scale", current_blues_scale).commit();
+    }
+
+    //保存理货信息
+    public String getTallyInfo() {
+        return sp.getString("tally_info", "");
+    }
+    public void setTallyInfo(String version_info){
+        editor.putString("tally_info", version_info).commit();
+    }
+
+    public String getTallyList() {
+        return sp.getString("tally_list", "");
+    }
+    public void setTallyList(String version_info){
+        editor.putString("tally_list", version_info).commit();
+    }
+
+    //记录移位
+    public String getMoveId() {
+        return sp.getString("move_id", "");
+    }
+    public void setMoveId(String move_id){
+        editor.putString("move_id", move_id).commit();
+    }
+
+
+    // 仓储资源 域名
+    public String getResourceHost() {
+        return sp.getString("resource_host", "https://hcjfiles.oss-cn-hongkong.aliyuncs.com");
+    }
+    public void setResourceHost(String version_info){
+        editor.putString("resource_host", version_info).commit();
+    }
+
+    // 仓储资源 类型
+    public String getResourceType() {
+        return sp.getString("resource_type", "aliyun");
+    }
+    public void setResourceType(String version_info){
+        editor.putString("resource_type", version_info).commit();
+    }
+
+    // 仓储资源 类型
+    public String getResourcePrefix() {
+        return sp.getString("resource_prefix", "dahuo");
+    }
+    public void setResourcePrefix(String version_info){
+        editor.putString("resource_prefix", version_info).commit();
+    }
+
+    public String getResourceRegion() {
+        return sp.getString("resource_region", "");
+    }
+    public void setResourceRegion(String version_info){
+        editor.putString("resource_region", version_info).commit();
+    }
+
+    public String getResourceBucket() {
+        return sp.getString("resource_bucket", "");
+    }
+    public void setResourceBucket(String version_info){
+        editor.putString("resource_bucket", version_info).commit();
+    }
+
+
+
+
+}

+ 578 - 0
app/src/main/java/com/fxy/fms/check/CheckGoodsDetailsMainActivity.java

@@ -0,0 +1,578 @@
+package com.fxy.fms.check;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+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.view.KeyEvent;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Switch;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.elvishew.xlog.XLog;
+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 com.fxy.baselibrary.base.BaseActivity;
+import com.fxy.baselibrary.bean.BaseEventBusBean;
+import com.fxy.baselibrary.interfaces.OnRxScanerListener;
+import com.fxy.baselibrary.util.JsonUtil;
+import com.fxy.R;
+import com.fxy.common.PictureSelectorUpload;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+import com.fxy.constant.BaseConfig;
+import com.fxy.constant.EventCode;
+import com.fxy.fms.logic.ViewLogic;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+
+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 CheckGoodsDetailsMainActivity extends  BaseActivity implements StoJNI.ScanCallBack {
+
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+
+    //
+    @BindView(R.id.ll_check_goods_list)
+    LinearLayout llCheckGoodsList;
+
+    @BindView(R.id.ll_check_options)
+    LinearLayout llCheckOptions;
+
+
+    @BindView(R.id.s_is_product_name_match)
+    Switch sIsProductNameMatch;
+    @BindView(R.id.s_is_brand_match)
+    Switch sIsBrandMatch;
+    @BindView(R.id.s_is_model_match)
+    Switch sIsModelMatch;
+
+    @BindView(R.id.s_is_battery)
+    Switch sIsBattery;
+    @BindView(R.id.s_is_magnetic)
+    Switch sIsMagnetic;
+    @BindView(R.id.s_is_wood)
+    Switch sIsWood;
+    @BindView(R.id.s_is_other)
+    Switch sIsOther;
+
+    @BindView(R.id.ll_take_picture)
+    LinearLayout llTakePicture;
+
+    @BindView(R.id.ll_remark_info)
+    LinearLayout llRemarkInfo;
+
+    @BindView(R.id.btn_confirm)
+    TextView btnConfirm;
+
+    @BindView(R.id.rv_show_img)
+    RecyclerView rvShowImg;
+
+
+    @BindView(R.id.et_remark)
+    EditText etRemark;
+
+
+    //搬运工队列
+    private JSONArray issueList= new JSONArray();
+
+    private Integer selectId= 0;
+
+    private ArrayList photoList =new ArrayList<>();
+
+    private PictureSelectorUpload pictureSelectorUpload;
+
+    //
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+    //订单信息对象
+    private JSONObject inboundObject = new JSONObject();
+
+    private JSONObject  goodsObject =  new JSONObject();
+
+    private List<JSONObject>  goodsList = new ArrayList<>();
+
+    protected String action;
+
+    private boolean isOk = true;
+
+    private Unbinder unbinder;
+
+    private JSONObject postParam = new JSONObject();
+
+    private ViewLogic viewLogic;
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fms_check_goods_details;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+        try {
+            action = bundle.getString("action","waitcheck");
+            inboundObject = new JSONObject(bundle.getString("inbound_object"));
+            goodsObject = new JSONObject(bundle.getString("goods_object"));
+
+        } catch (JSONException e) {
+            XLog.e("接收数据解析:"+e.getMessage());
+            e.printStackTrace();
+        }
+    }
+    //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();
+        pictureSelectorUpload = new PictureSelectorUpload(CheckGoodsDetailsMainActivity.this,rvShowImg,"check");
+    }
+
+
+
+    @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){
+            //按确定键
+            if(this.validate()){
+                finishCheck();
+            }
+        }
+        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(){
+        viewLogic = new ViewLogic(llCheckGoodsList);
+        viewLogic.setGoodsData(inboundObject,goodsObject);
+    }
+
+    /**
+     *  初始化下拉框控件值
+     */
+    private void initSpinner() {
+    }
+
+
+
+    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);
+
+            switch (view.getId()) {
+
+                default:
+            }
+
+
+        }
+    }
+
+
+    private void finishCheck(){
+        if (!validate()){
+            return;
+        }
+        //数据检查不通过
+
+        if (!isOk){  Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show(); return;}
+        isOk = false;
+        OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_FINISH_CHECK).upJson(postParam)
+                .execute(new MyDialogCallback(this, true, true) {
+                    @Override
+                    public void onSuccess(Response<String> response) {
+                        isOk = true;
+                        super.onSuccess(response);
+                        try {
+                            ActionBean bean = JsonUtil.getObject(response.body(), ActionBean.class);
+                            if(bean.code == 1){
+                                showSuccessToast(bean.msg);
+                                JSONObject data = new JSONObject(bean.data);
+                                if (data.has("next_package") && !data.getString("next_package").isEmpty() &&
+                                        !data.getString("next_package").equals("[]")){
+                                    goodsObject = new JSONObject(data.getString("next_package"));
+                                    viewLogic.setGoodsData(inboundObject,goodsObject);
+                                    restoreData();
+                                }else{
+                                    Intent intent = new Intent();
+                                    intent.putExtra("opt_status", "success");
+                                    intent.putExtra("package_goods_id",postParam.getInt("package_goods_id"));
+                                    setResult(200, intent);//返回值,200 是改返回的标志,也会返回
+                                    finish();
+                                }
+
+                            }else{
+                                showWarningToast(bean.msg);
+                            }
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                            XLog.e("添加理货数据结果返回错误",e.getMessage());
+                        }
+                    }
+                });
+    }
+
+    private void restoreData(){
+
+        postParam.remove("photo");
+        postParam.remove("remark");
+        postParam.remove("order_number");
+        postParam.remove("package_goods_id");
+        etRemark.setText("");
+        pictureSelectorUpload.emptyRemake();
+
+        sIsProductNameMatch.setChecked(false);
+        sIsBrandMatch.setChecked(false);
+        sIsModelMatch.setChecked(false);
+        sIsBattery.setChecked(false);
+        sIsMagnetic.setChecked(false);
+        sIsWood.setChecked(false);
+        sIsOther.setChecked(false);
+
+        try {
+            //初始化问题类型
+            selectId = 0;
+            JSONObject issueObject = issueList.getJSONObject(selectId);
+            etRemark.setText(issueObject.getString("dictionary_name"));
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+        llTakePicture.setVisibility(View.GONE);
+        llRemarkInfo.setVisibility(View.GONE);
+        btnConfirm.setBackgroundResource(R.drawable.bg_green_item);
+        btnConfirm.setText("查验无异常,下一个");
+    }
+
+    /*
+     * 校验必录
+     */
+    private boolean validate(){
+        photoList = pictureSelectorUpload.getPhotoList();
+        try {
+            postParam.put("order_number",inboundObject.getString("order_number"));
+            postParam.put("package_goods_id",goodsObject.getInt("package_goods_id"));
+
+            if (checkAllSwitch()){
+                //检查是否拍照
+                if (photoList.size()==0){
+                    showWarningToast("请拍照上传");
+                    return false;
+                }
+                Gson gson = new Gson();
+                postParam.put("photo",gson.toJson(photoList));
+
+
+//                if (etRemark.getText().toString().isEmpty()){
+//                    showWarningToast("请填写备注信息");
+//                    return false;
+//                }
+                postParam.put("remark",etRemark.getText().toString());
+
+            }
+        } catch (JSONException e) {
+            showWarningToast("系统异常"+e.getMessage());
+            e.printStackTrace();
+            return false;
+        }
+
+
+
+        return true;
+    }
+
+
+    //清除订单信息
+    private boolean checkAllSwitch() {
+        boolean result = false;
+        if (putSwitch(sIsProductNameMatch,"is_product_name_match")){result = true;}
+        if (putSwitch(sIsBrandMatch,"is_brand_match")){result = true;}
+        if (putSwitch(sIsModelMatch,"is_model_match")){result = true;}
+
+
+        if (putSwitch(sIsBattery,"is_battery")){result = true;}
+        if (putSwitch(sIsMagnetic,"is_magnetic")){result = true;}
+        if (putSwitch(sIsWood,"is_wood")){result = true;}
+        if (putSwitch(sIsOther,"is_other")){result = true;}
+        return result;
+    }
+
+    private boolean putSwitch(Switch sv,String name){
+        boolean isChecked = sv.isChecked();
+        try {
+            postParam.put(name,isChecked?"Y":"N");
+        } catch (JSONException e) {
+            XLog.e("设置Switch异常");
+            e.printStackTrace();
+        }
+        return isChecked;
+    }
+
+    //sIsGoodinfoMatch,sIsBattery,sIsMagnetic,sIsWood,sIsExtra,sIsOther
+    @OnClick({R.id.s_is_product_name_match,R.id.s_is_brand_match,R.id.s_is_model_match,R.id.s_is_battery,R.id.s_is_other,R.id.s_is_magnetic,R.id.s_is_wood,R.id.btn_confirm})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+            case R.id.s_is_product_name_match:
+            case R.id.s_is_brand_match:
+            case R.id.s_is_model_match:
+            case R.id.s_is_battery:
+            case R.id.s_is_other:
+            case R.id.s_is_magnetic:
+            case R.id.s_is_wood:
+                if (checkAllSwitch()){
+                    llTakePicture.setVisibility(View.VISIBLE);
+                    llRemarkInfo.setVisibility(View.VISIBLE);
+                    btnConfirm.setBackgroundResource(R.drawable.bg_orange_item);
+                    btnConfirm.setText("完成查验,下一个");
+                }else {
+                    llTakePicture.setVisibility(View.GONE);
+                    llRemarkInfo.setVisibility(View.GONE);
+                    btnConfirm.setBackgroundResource(R.drawable.bg_green_item);
+                    btnConfirm.setText("查验无异常,下一个");
+                }
+                break;
+            case R.id.btn_confirm:
+                finishCheck();
+            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());
+        }
+    }
+
+}

+ 510 - 0
app/src/main/java/com/fxy/fms/check/CheckGoodsMainActivity.java

@@ -0,0 +1,510 @@
+package com.fxy.fms.check;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+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.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.Toast;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.elvishew.xlog.XLog;
+import com.google.zxing.Result;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+import com.fxy.baselibrary.base.BaseActivity;
+import com.fxy.baselibrary.bean.BaseEventBusBean;
+import com.fxy.baselibrary.interfaces.OnRxScanerListener;
+import com.fxy.baselibrary.util.JsonUtil;
+import com.fxy.R;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+import com.fxy.constant.BaseConfig;
+import com.fxy.constant.EventCode;
+import com.fxy.fms.logic.ViewLogic;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+
+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 CheckGoodsMainActivity extends  BaseActivity implements StoJNI.ScanCallBack {
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+
+    @BindView(R.id.ll_check_info)
+    LinearLayout llCheckInfo;
+
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+    //订单信息对象
+    private JSONObject inboundObject;
+
+    private List<JSONObject>  goodsList = new ArrayList<>();
+
+    protected String action;
+
+
+    private Unbinder unbinder;
+
+    //订单号
+    private String orderNumber;
+    private GoodsAdapter goodsAdapter;
+    // 空显示页
+    private View emptyView;
+
+    @BindView(R.id.rc_check_goods)
+    RecyclerView rcCheckGoods;
+
+
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fms_check_goods;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+        try {
+            action = bundle.getString("action","waitcheck");
+            inboundObject = new JSONObject(bundle.getString("inbound_object"));
+        } catch (JSONException e) {
+            XLog.e("接收数据解析:"+e.getMessage());
+            e.printStackTrace();
+        }
+    }
+    //finish的返回监听
+    //这里的requestCode参数,就是上面设置的 1 ,当跳转的页面返回的时候,通过这个加以判断
+    //resultCode ,这个参数是在跳转的页面里面规定的,它也是一个int类型的标志
+    //第三个参数包含了返回的值
+    //如果不需要所跳转的页面返回值,也就不需要这个方法了
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (requestCode == 200 && resultCode == 200)//之前提到的两个标志,在这里显示出了作用
+        {
+            String  opt_status = data.getStringExtra("opt_status").toString();
+            if (opt_status.equals("success")){
+                Intent intent = new Intent();
+                intent.putExtra("opt_status", "success");
+                setResult(200, intent);//返回值,200 是改返回的标志,也会返回
+                finish();
+            }
+        }
+    }
+
+
+    /**
+     * 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();
+        initAdapter();
+        iniData();
+    }
+
+
+
+    @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){
+            //按确定键
+            if(this.validate()){
+                //getInboundInfo();
+            }
+        }
+        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(){
+        ViewLogic viewLogic = new ViewLogic(llCheckInfo);
+        viewLogic.setCheckData(inboundObject);
+        getPackageGoods();
+    }
+
+    private void initAdapter() {
+
+        emptyView = this.getLayoutInflater().inflate(R.layout.pager_empty, (ViewGroup) rcCheckGoods.getParent(), false);
+        goodsAdapter = new GoodsAdapter(goodsList);
+        goodsAdapter.setEmptyView(emptyView);
+        goodsAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
+        rcCheckGoods.setLayoutManager(new LinearLayoutManager(this));
+        rcCheckGoods.setAdapter(goodsAdapter);
+        // 卡片项点击事件
+        goodsAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
+            @Override
+            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
+                //showLoadDialog("开始调整查验...");
+                try {
+
+                    Bundle bundle = new Bundle();
+                    bundle.putString("inbound_object",inboundObject.toString());
+                    JSONObject goodsObject = goodsList.get(position);
+
+                    if (goodsObject.has("is_pass")){
+                        showErrorToast("已查验不需要重复操作");
+                        return;
+                    }
+                    bundle.putString("goods_object",goodsObject.toString());
+
+                    intentPageResult(CheckGoodsMainActivity.this,CheckGoodsDetailsMainActivity.class, bundle,200);
+                }catch (Exception e){
+                    XLog.e("选中获取商品信息错误:",e);
+                }
+
+            }
+        });
+    }
+
+    private static class GoodsAdapter extends BaseQuickAdapter<JSONObject, BaseViewHolder> {
+        GoodsAdapter(List<JSONObject> data) {
+            super(R.layout.item_check_goods, data);
+        }
+
+        @Override
+        protected void convert(BaseViewHolder holder, JSONObject jsonObject) {
+            //XLog.e(jsonObject);
+
+            try {
+
+                if (jsonObject.has("is_pass") && jsonObject.getString("is_pass").equals("Y")){
+                    holder.setBackgroundRes(R.id.ll_check_goods_list,R.drawable.bg_green_item);
+                }
+                if (jsonObject.has("is_pass") && jsonObject.getString("is_pass").equals("N")){
+                    holder.setBackgroundRes(R.id.ll_check_goods_list,R.drawable.bg_orange_item);
+                }
+                //holder.setBackgroundRes(R.id.ll_tally_info,R.drawable.bg_green_item);
+
+                holder.setGone(R.id.ll_order_number,false);
+                holder.setGone(R.id.ll_category_en_name,false);
+                holder.setGone(R.id.ll_right_icon,true);
+
+
+                holder.setText(R.id.mt_shipment_id, jsonObject.getString("shipment_id"));
+                holder.setText(R.id.mt_package_number, jsonObject.getString("package_number"));
+                holder.setText(R.id.mt_box_qty, jsonObject.getString("box_qty"));
+                holder.setText(R.id.mt_category_cn_name, jsonObject.getString("cn_name"));
+                holder.setText(R.id.mt_category_en_name, jsonObject.getString("en_name"));
+                holder.setText(R.id.mt_brand, jsonObject.getString("brand"));
+                holder.setText(R.id.mt_model_number, jsonObject.getString("type"));
+
+                double box_length = jsonObject.getDouble("box_length");
+                double box_width = jsonObject.getDouble("box_width");
+                double box_height = jsonObject.getDouble("box_height");
+                holder.setText(R.id.mt_carton_size, box_length+"*"+box_width+"*"+box_height);
+            } catch (Exception e) {
+                XLog.e("查询结果数据渲染失败:"+e.getMessage());
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+
+    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);
+
+            switch (view.getId()) {
+                case R.id.et_order_no:
+                    //getInboundInfo();
+                    break;
+                default:
+            }
+
+
+        }
+    }
+
+
+    private void getPackageGoods(){
+
+        try {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("order_number",inboundObject.getString("order_number"));
+            jsonObject.put("action","waitcheck");
+
+            if (!checkRepeat(Urls.FMS_GET_PACKAGE_GOODS+(jsonObject.toString()))){
+                Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
+                return;
+            }
+            goodsList.clear();
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_GET_PACKAGE_GOODS).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);
+                                if(bean.code == 1){
+                                    JSONObject data = new JSONObject(bean.data);
+                                    if (data.has("data")){
+                                        JSONArray list = data.getJSONArray("data");
+                                        for (int i = 0; i<list.length(); i++){
+                                            goodsList.add(list.getJSONObject(i));
+                                        }
+                                        goodsAdapter.notifyDataSetChanged();
+                                    }
+
+                                }else{
+                                    goodsList.clear();
+                                    goodsAdapter.notifyDataSetChanged();
+                                    showWarningToast(bean.msg);
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                                showEmptyView("入库订单包裹商品信息解析错误:"+e.getMessage());
+                                XLog.e("获取包裹商品信息解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            XLog.e("请求包裹商品订单信息错误:",e);
+        }
+    }
+
+
+    /*
+     * 校验必录
+     */
+    private boolean validate(){
+
+        return true;
+    }
+
+
+    //清除订单信息
+    private void clearData() {
+
+    }
+
+    @OnClick({})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+
+            default:
+                break;
+        }
+    }
+
+    @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());
+        }
+    }
+
+
+}

+ 476 - 0
app/src/main/java/com/fxy/fms/check/CheckStartMainActivity.java

@@ -0,0 +1,476 @@
+package com.fxy.fms.check;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+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.TextView;
+import android.widget.Toast;
+
+import com.elvishew.xlog.XLog;
+import com.google.zxing.Result;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+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.R;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+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 org.json.JSONObject;
+
+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 CheckStartMainActivity extends  BaseActivity implements StoJNI.ScanCallBack {
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+    //单号清除
+    @BindView(R.id.ib_order_no_clear)
+    ImageButton ibOrderNoClear;
+
+    //单号
+    @BindView(R.id.et_order_no)
+    EditText etOrderNo;
+
+    //浮动按钮
+    @BindView(R.id.iv_drag)
+    FloatingImageView iv_drag;
+
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+    //订单信息对象
+    private JSONObject inboundObject;
+
+
+
+
+    private Unbinder unbinder;
+
+    //订单号
+    private String orderNumber;
+
+
+
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fms_check_start;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle extras) {
+    }
+    //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)//之前提到的两个标志,在这里显示出了作用
+        {
+            String  opt_status    = data.getStringExtra("opt_status").toString();
+            if (opt_status.equals("success")){
+                clearData();
+            }
+        }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("货物查验");
+
+        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);
+                }
+            }
+        });
+
+    }
+
+
+
+    @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){
+            //按确定键
+            if(this.validate()){
+                getInboundInfo();
+            }
+        }
+        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() {
+
+        //
+        etOrderNo.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+            @Override
+            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+                if (actionId == EditorInfo.IME_ACTION_DONE) {
+                    String orderNo = etOrderNo.getText().toString().trim();
+                    if (StringUtils.isEmpty(orderNo)) {
+                        setEditTextFocused(v,true);
+                        showWarningToast(v.getHint().toString());
+                        return false;
+                    }
+                    getInboundInfo();//获取订单信息
+                    return false;
+                }
+                return false;
+            }
+        });
+        etOrderNo.addTextChangedListener(new TextWatcher() {
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+                orderNumber = s.toString().trim();
+                if (s.length() > 0 ) {
+                    if (etOrderNo.isEnabled()){
+                        ibOrderNoClear.setVisibility(View.VISIBLE);
+                    }
+                    setEditTextNormal(etOrderNo,true);
+                } else {
+                    ibOrderNoClear.setVisibility(View.INVISIBLE);
+                    setEditTextFocused(etOrderNo,true);
+                }
+            }
+
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+            }
+
+            public void afterTextChanged(Editable s) {
+
+            }
+        });
+        ibOrderNoClear.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                etOrderNo.requestFocus();
+                etOrderNo.getText().clear();
+            }
+        });
+    }
+
+    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);
+
+            switch (view.getId()) {
+                case R.id.et_order_no:
+                    getInboundInfo();
+                    break;
+                default:
+            }
+
+
+        }
+    }
+
+
+    private void getInboundInfo(){
+        final String orderNo = etOrderNo.getText().toString().trim();
+        if (orderNo.isEmpty()){
+            return;
+        }
+        try {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("order_number",orderNo);
+            jsonObject.put("action","waitcheck");
+
+            if (!checkRepeat(Urls.FMS_CHECK_ORDER+(jsonObject.toString()))){
+                Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
+                return;
+            }
+
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_CHECK_ORDER).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);
+                                if(bean.code == 1){
+                                    inboundObject = new JSONObject(bean.data);
+                                    Bundle bundle = new Bundle();
+                                    bundle.putString("inbound_object",bean.data);
+                                    intentPageResult(CheckStartMainActivity.this,CheckGoodsMainActivity.class, bundle,200);
+                                }else{
+                                    inboundObject = null;
+                                    showWarningToast(bean.msg);
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                                showEmptyView("入库订单信息解析错误:"+e.getMessage());
+                                XLog.e("获取入库订单信息解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            inboundObject = null;
+            XLog.e("请求入库订单信息错误:",e);
+        }
+    }
+
+
+    /*
+     * 校验必录
+     */
+    private boolean validate(){
+        if(!checkNull(etOrderNo)){
+            setEditTextFocused(etOrderNo,true);
+            showWarningToast(getString(R.string.hint_please_scan_no));
+            return false;
+        }
+        return true;
+    }
+
+
+    //清除订单信息
+    private void clearData() {
+        etOrderNo.setText("");
+        etOrderNo.requestFocus();
+    }
+
+    @OnClick({})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+
+
+            default:
+                break;
+        }
+    }
+
+    @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());
+        }
+    }
+
+
+}

+ 569 - 0
app/src/main/java/com/fxy/fms/check/WaitCheckMainActivity.java

@@ -0,0 +1,569 @@
+package com.fxy.fms.check;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+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.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.EditText;
+import android.widget.Toast;
+
+import com.chad.library.adapter.base.BaseQuickAdapter;
+import com.chad.library.adapter.base.BaseViewHolder;
+import com.elvishew.xlog.XLog;
+import com.google.zxing.Result;
+import com.jaredrummler.materialspinner.MaterialSpinner;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+import com.fxy.baselibrary.base.BaseActivity;
+import com.fxy.baselibrary.bean.BaseEventBusBean;
+import com.fxy.baselibrary.interfaces.OnRxScanerListener;
+import com.fxy.baselibrary.util.JsonUtil;
+import com.fxy.R;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+import com.fxy.constant.BaseConfig;
+import com.fxy.constant.EventCode;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+
+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 WaitCheckMainActivity extends  BaseActivity implements StoJNI.ScanCallBack {
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+    @BindView(R.id.ms_product_list)
+    MaterialSpinner ProductSpinner;
+
+    @BindView(R.id.rc_wait_check)
+    RecyclerView rcWaitCheck;
+
+
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+
+    private Unbinder unbinder;
+
+    //订单号
+    private String orderNumber;
+
+    //渠道列表
+    private JSONArray productList = new JSONArray();
+
+    //待查验数据
+    private List<JSONObject> waitCheckList = new ArrayList<>(); ;
+
+    private AvailableFinishWorkAdapter availableFinishWorkAdapter;
+    // 空显示页
+    private View emptyView;
+
+    private Integer selectId=0;
+
+    private JSONObject inboundObject;
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fms_check_wait;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle extras) {
+    }
+    //finish的返回监听
+    //这里的requestCode参数,就是上面设置的 1 ,当跳转的页面返回的时候,通过这个加以判断
+    //resultCode ,这个参数是在跳转的页面里面规定的,它也是一个int类型的标志
+    //第三个参数包含了返回的值
+    //如果不需要所跳转的页面返回值,也就不需要这个方法了
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        if (requestCode == 200 && resultCode == 200)//之前提到的两个标志,在这里显示出了作用
+        {
+            String  opt_status    = data.getStringExtra("opt_status").toString();
+            if (opt_status.equals("success")){
+                waitCheckList.clear();
+                getWaitCheckList(selectId);
+            }
+        }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("待查验列表");
+
+        initEdit();
+
+        initAdapter();
+
+        //loadServiceData();
+        iniProducts();
+        initData();
+
+
+    }
+
+    private void iniProducts(){
+        try {
+            productList = new JSONArray();
+            JSONObject initObject = new JSONObject();
+            initObject.put("id",0);
+            initObject.put("name",0);
+            productList.put(initObject);
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void initData(){
+
+        getWaitCheckList(selectId);
+
+        try {
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_GET_PRODUCTS)
+                    .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){
+                                    JSONObject data = new JSONObject(bean.data);
+                                    productList = new JSONArray(data.getString("product_list"));
+                                    List<String> spinnerList = new ArrayList<String>();
+                                    for (int i = 0;i < productList.length(); i++){
+                                        JSONObject jsonObject =productList.getJSONObject(i);
+                                        spinnerList.add(jsonObject.getString("name"));
+                                    }
+                                    ProductSpinner.setItems(spinnerList);
+                                    ProductSpinner.setSelectedIndex(selectId);
+                                    initSpinner();
+                                }else{
+                                    showWarningToast(bean.msg);
+                                }
+                            } catch (Exception e) {
+                                showWarningToast("获取产品列表解析错误:"+e.getMessage());
+                                e.printStackTrace();
+                                XLog.e("获取产品列表解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            showWarningToast(e.getMessage());
+            XLog.e("请求产品列表信息错误:",e);
+        }
+    }
+
+    /**
+     *  获取待查验产品
+     * @param id
+     */
+    private void getWaitCheckList(int id){
+        try {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("product_id",id);
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_GET_WAIT_CHECK_LIST).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);
+                                if(bean.code == 1){
+                                    JSONObject data = new JSONObject(bean.data);
+
+                                    if (data.has("data")){
+                                        JSONArray list = new JSONArray(data.getString("data"));
+                                        for (int i = 0; i<list.length(); i++){
+                                            waitCheckList.add(list.getJSONObject(i));
+                                        }
+                                        availableFinishWorkAdapter.notifyDataSetChanged();
+                                    }
+                                }else{
+                                    showWarningToast(bean.msg);
+                                }
+                            } catch (Exception e) {
+                                showWarningToast("获取产品列表解析错误:"+e.getMessage());
+                                e.printStackTrace();
+                                XLog.e("获取产品列表解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            showWarningToast(e.getMessage());
+            XLog.e("请求产品列表信息错误:",e);
+        }
+    }
+
+    /**
+     *  初始化下拉框控件值
+     */
+    private void initSpinner() {
+        ProductSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
+            @Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
+               // XLog.e(id);XLog.e(item);
+                selectId = position;
+                waitCheckList.clear();
+                availableFinishWorkAdapter.notifyDataSetChanged();
+
+                try {
+                    JSONObject productObject = productList.getJSONObject(selectId);
+                    getWaitCheckList(productObject.getInt("id"));
+                } catch (JSONException e) {
+                    XLog.e("获取产品的数据错误");
+                    e.printStackTrace();
+                }
+            }
+        });
+    }
+
+
+    private void initAdapter() {
+
+        emptyView = this.getLayoutInflater().inflate(R.layout.pager_empty, (ViewGroup) rcWaitCheck.getParent(), false);
+        availableFinishWorkAdapter = new AvailableFinishWorkAdapter(waitCheckList);
+        availableFinishWorkAdapter.setEmptyView(emptyView);
+        availableFinishWorkAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
+        rcWaitCheck.setLayoutManager(new LinearLayoutManager(this));
+        rcWaitCheck.setAdapter(availableFinishWorkAdapter);
+        // 卡片项点击事件
+        availableFinishWorkAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
+            @Override
+            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
+                //showLoadDialog("开始调整查验...");
+
+                try {
+                    JSONObject jsonObject = new JSONObject();
+                    jsonObject.put("order_number",waitCheckList.get(position).getString("order_number"));
+                    jsonObject.put("action","waitcheck");
+
+                    if (!checkRepeat(Urls.FMS_CHECK_ORDER+(jsonObject.toString()))){
+                        Toast.makeText(mContext, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
+                        return;
+                    }
+
+                    OkGo.<String>post(Urls.getServiceAddress(mContext) + Urls.FMS_CHECK_ORDER).upJson(jsonObject)
+                            .execute(new MyDialogCallback(mContext, 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){
+                                            inboundObject = new JSONObject(bean.data);
+                                            Bundle bundle = new Bundle();
+                                            bundle.putString("inbound_object",bean.data);
+                                            intentPageResult(WaitCheckMainActivity.this,CheckGoodsMainActivity.class, bundle,200);
+                                        }else{
+                                            inboundObject = null;
+                                            showWarningToast(bean.msg);
+                                        }
+                                    } catch (Exception e) {
+                                        e.printStackTrace();
+                                        showEmptyView("入库订单信息解析错误:"+e.getMessage());
+                                        XLog.e("获取入库订单信息解析错误",e.getMessage());
+                                    }
+                                }
+                            });
+                }catch (Exception e){
+                    inboundObject = null;
+                    XLog.e("请求入库订单信息错误:",e);
+                }
+
+
+            }
+        });
+    }
+
+    private class AvailableFinishWorkAdapter extends BaseQuickAdapter<JSONObject, BaseViewHolder> {
+        public AvailableFinishWorkAdapter(List<JSONObject> data) {
+            super(R.layout.item_check_info, data);
+        }
+
+        @Override
+        protected void convert(BaseViewHolder holder, JSONObject jsonObject) {
+            XLog.e(jsonObject);
+            //{"channel_name":"","inbound_date":"2021-03-26 03:29:08","order_number":"123","product_id":590,
+            // "inbound_pieces":12,"id":2,"product_name":"换号服务专用产品","domestic_wms_location":""}
+            try {
+
+                holder.setText(R.id.mt_order_number, jsonObject.getString("order_number"));
+                holder.setText(R.id.tv_country_name,jsonObject.getString("country_name"));
+                holder.setText(R.id.mt_channel_name, jsonObject.getString("channel_name"));
+                holder.setText(R.id.mt_location_code, jsonObject.getString("domestic_wms_location"));
+                holder.setText(R.id.mt_inbound_pieces, jsonObject.getString("inbound_pieces"));
+                holder.setText(R.id.mt_inbound_date, jsonObject.getString("inbound_date"));
+            } catch (Exception e) {
+                XLog.e("查询结果数据渲染失败:"+e.getMessage());
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+
+
+
+
+    @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 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);
+
+            switch (view.getId()) {
+                case R.id.et_order_no:
+
+                    break;
+                default:
+            }
+
+
+        }
+    }
+
+
+
+
+
+
+
+    @OnClick({})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+
+            default:
+                break;
+        }
+    }
+
+    @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());
+        }
+    }
+
+
+}

+ 215 - 0
app/src/main/java/com/fxy/fms/logic/ViewLogic.java

@@ -0,0 +1,215 @@
+package com.fxy.fms.logic;
+
+import android.annotation.SuppressLint;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.elvishew.xlog.XLog;
+import com.fxy.baselibrary.views.MarqueeTextView;
+import com.fxy.R;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+public class ViewLogic {
+    private LinearLayout linearLayout = null;
+
+    public ViewLogic(LinearLayout llTallyInfo) {
+        linearLayout = llTallyInfo;
+    }
+
+    //设置理货数据
+    public void setTallyData(JSONObject orderObject){
+        MarqueeTextView mtOrderNumber= linearLayout.findViewById(R.id.mt_order_number);
+        MarqueeTextView mtCustomerName= linearLayout.findViewById(R.id.mt_customer_name);
+        MarqueeTextView mtReceiverCountry= linearLayout.findViewById(R.id.mt_receiver_country);
+        MarqueeTextView mtDeliveryAddress= linearLayout.findViewById(R.id.mt_delivery_address);
+        MarqueeTextView mtLogisticsProducts= linearLayout.findViewById(R.id.mt_logistics_products);
+        MarqueeTextView mtForecastQty= linearLayout.findViewById(R.id.mt_forecast_qty);
+        MarqueeTextView mtStorageLocation= linearLayout.findViewById(R.id.mt_storage_location);
+        MarqueeTextView mtPutInTag= linearLayout.findViewById(R.id.mt_put_in_tag);
+
+
+        try {
+            mtOrderNumber.setText(orderObject.has("order_number")?orderObject.getString("order_number"):"");
+            mtCustomerName.setText(orderObject.has("customer_code")?orderObject.getString("customer_code"):"");
+            mtReceiverCountry.setText(orderObject.has("receive_country")?orderObject.getString("receive_country"):"");
+            mtDeliveryAddress.setText(orderObject.has("delivery_address")?orderObject.getString("delivery_address"):"");
+            mtLogisticsProducts.setText(orderObject.has("product_name")?orderObject.getString("product_name"):"");
+            mtStorageLocation.setText(orderObject.has("domestic_wms_location")?orderObject.getString("domestic_wms_location"):"");
+            mtForecastQty.setText(orderObject.has("forecast_pieces")?orderObject.getString("forecast_pieces"):"");
+        } catch (JSONException e) {
+            XLog.e("参数错误:",e.getMessage());
+            e.printStackTrace();
+        }
+
+        //mtPutInTag.setText(inboundBean.getInboundNumber());
+    }
+
+    //进行一些特殊设置
+    public void setTallyMore(JSONObject paramObject){
+        try {
+            if (paramObject.has("has_label")){
+                MarqueeTextView mtPutInTag= linearLayout.findViewById(R.id.mt_put_in_tag);
+                //ll_docker_name
+                if (paramObject.getString("has_label").equals("Y")){
+                    mtPutInTag.setText("有");
+                }
+                if (paramObject.getString("has_label").equals("N")){
+                    mtPutInTag.setText("无");
+                }
+                linearLayout.findViewById(R.id.ll_put_id_tag).setVisibility(View.VISIBLE);
+            }
+            if (paramObject.has("docker_name")){
+                MarqueeTextView  mtDockerName = linearLayout.findViewById(R.id.mt_docker_name);
+                mtDockerName.setText(paramObject.getString("docker_name"));
+                linearLayout.findViewById(R.id.ll_docker_name).setVisibility(View.VISIBLE);
+            }
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * 设置查验数据
+     * @param orderObject
+     */
+    public void setCheckData(JSONObject orderObject){
+        MarqueeTextView mtOrderNumber= linearLayout.findViewById(R.id.mt_order_number);
+        MarqueeTextView mtChannelName= linearLayout.findViewById(R.id.mt_channel_name);
+        MarqueeTextView mtLocationCode= linearLayout.findViewById(R.id.mt_location_code);
+        MarqueeTextView mtInboundPieces= linearLayout.findViewById(R.id.mt_inbound_pieces);
+        MarqueeTextView mtInboundDate= linearLayout.findViewById(R.id.mt_inbound_date);
+        try {
+            linearLayout.findViewById(R.id.ll_channel_name).setVisibility(View.GONE);
+            linearLayout.findViewById(R.id.tv_to_check).setVisibility(View.GONE);
+
+            mtOrderNumber.setText(orderObject.has("order_number")?orderObject.getString("order_number"):"");
+            mtChannelName.setText(orderObject.has("channel_name")?orderObject.getString("channel_name"):"");
+            mtLocationCode.setText(orderObject.has("domestic_wms_location")?orderObject.getString("domestic_wms_location"):"");
+            mtInboundPieces.setText(orderObject.has("inbound_pieces")?orderObject.getInt("inbound_pieces")+"":"");
+            mtInboundDate.setText(orderObject.has("inbound_date")?orderObject.getString("inbound_date"):"");
+        } catch (JSONException e) {
+            XLog.e("参数错误:",e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 设置查验数据
+     * @param orderObject
+     */
+    public void setGoodsData(JSONObject orderObject,JSONObject goodsObject){
+        MarqueeTextView mtOrderNumber= linearLayout.findViewById(R.id.mt_order_number);
+        MarqueeTextView mtShipmentId= linearLayout.findViewById(R.id.mt_shipment_id);
+        MarqueeTextView mtPackageNumber= linearLayout.findViewById(R.id.mt_package_number);
+        MarqueeTextView mtBoxQty= linearLayout.findViewById(R.id.mt_box_qty);
+        MarqueeTextView mtCategoryCnName= linearLayout.findViewById(R.id.mt_category_cn_name);
+        MarqueeTextView mtCategoryEnName= linearLayout.findViewById(R.id.mt_category_en_name);
+        MarqueeTextView mtBrand= linearLayout.findViewById(R.id.mt_brand);
+        MarqueeTextView mtModel_number= linearLayout.findViewById(R.id.mt_model_number);
+        MarqueeTextView mtCartonSize= linearLayout.findViewById(R.id.mt_carton_size);
+
+        try {
+            mtOrderNumber.setText(orderObject.has("order_number")?orderObject.getString("order_number"):"");
+
+            mtShipmentId.setText(goodsObject.getString("shipment_id"));
+            mtPackageNumber.setText(goodsObject.getString("package_number"));
+            mtBoxQty.setText(goodsObject.getString("box_qty"));
+            mtCategoryCnName.setText(goodsObject.getString("cn_name"));
+            mtCategoryEnName.setText(goodsObject.getString("en_name"));
+            mtBrand.setText(goodsObject.getString("brand"));
+            mtModel_number.setText( goodsObject.getString("type"));
+            double box_length = goodsObject.getDouble("box_length");
+            double box_width = goodsObject.getDouble("box_width");
+            double box_height = goodsObject.getDouble("box_height");
+            String boxSize = box_length+"*"+box_width+"*"+box_height;
+            mtCartonSize.setText(boxSize);
+
+
+        } catch (JSONException e) {
+            XLog.e("参数错误:",e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    public void setStorageInfo(JSONObject outboundObject){
+        MarqueeTextView mt_outbound_number= linearLayout.findViewById(R.id.mt_outbound_number);
+        MarqueeTextView mt_order_qty= linearLayout.findViewById(R.id.mt_order_qty);
+        MarqueeTextView mt_container_code= linearLayout.findViewById(R.id.mt_container_code);
+        MarqueeTextView mt_so_number= linearLayout.findViewById(R.id.mt_so_number);
+        MarqueeTextView mt_seal_number= linearLayout.findViewById(R.id.mt_seal_number);
+
+        try {
+            mt_outbound_number.setText(outboundObject.getString("outbound_number"));
+            mt_order_qty.setText(outboundObject.getString("order_qty"));
+            mt_container_code.setText(outboundObject.getString("container_code"));
+            mt_so_number.setText(outboundObject.getString("so_number"));
+            mt_seal_number.setText(outboundObject.getString("seal_number"));
+        } catch (JSONException e) {
+            XLog.e("参数错误:",e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     *
+     * @param orderObject
+     */
+    @SuppressLint("SetTextI18n")
+    public void setOutbound(JSONObject dataObject, JSONObject orderObject ){
+        MarqueeTextView mtOrderNumber= linearLayout.findViewById(R.id.mt_order_number);
+        MarqueeTextView mtContainerNumber= linearLayout.findViewById(R.id.mt_container_number);
+        TextView tvNotNum= linearLayout.findViewById(R.id.tv_not_num);
+        TextView tvHasNum= linearLayout.findViewById(R.id.tv_has_num);
+        TextView tvCargoWeight= linearLayout.findViewById(R.id.tv_cargo_weight);
+        TextView tvWeightUnit= linearLayout.findViewById(R.id.tv_weight_unit);
+        TextView tvVolume= linearLayout.findViewById(R.id.tv_volume);
+        TextView tvVolumeUnit= linearLayout.findViewById(R.id.tv_volume_unit);
+
+
+        try {
+            if (orderObject ==null){
+                linearLayout.findViewById(R.id.ll_order_number).setVisibility(View.GONE);
+                linearLayout.findViewById(R.id.ll_container_number).setVisibility(View.GONE);
+            }else{
+                mtOrderNumber.setText(orderObject.has("outbound_number")?orderObject.getString("outbound_number"):"");
+                mtContainerNumber.setText(orderObject.has("container_code")?orderObject.getString("container_code"):"");
+            }
+
+
+
+            String hasStr = dataObject.getString("has");
+            String notStr = dataObject.getString("not");
+
+            if (hasStr.isEmpty() || hasStr.equals("[]")){
+                tvHasNum.setText("0");
+                tvCargoWeight.setText("0");
+                tvWeightUnit.setText("KG");
+                tvVolume.setText("0");
+                tvVolumeUnit.setText("CM");
+            }else{
+                JSONObject hasObject = dataObject.getJSONObject("has");
+
+                tvHasNum.setText(Integer.toString(hasObject.getInt("total")));
+                tvCargoWeight.setText(hasObject.getString("inbound_weight"));
+                tvWeightUnit.setText(hasObject.getString("weight_unit"));
+                tvVolume.setText(hasObject.getString("inbound_volume"));
+                tvVolumeUnit.setText(hasObject.getString("volume_unit"));
+            }
+
+            if (notStr.isEmpty() || notStr.equals("[]")){
+                tvNotNum.setText("0");
+            }else{
+                JSONObject notObject = dataObject.getJSONObject("not");
+                tvNotNum.setText(notObject.getInt("total")+"");
+            }
+
+        } catch (JSONException e) {
+            XLog.e("参数错误:",e.getMessage());
+            e.printStackTrace();
+        }
+    }
+}

+ 599 - 0
app/src/main/java/com/fxy/fms/putIn/PutAwayMainActivity.java

@@ -0,0 +1,599 @@
+package com.fxy.fms.putIn;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+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.TextView;
+import android.widget.Toast;
+
+import com.elvishew.xlog.XLog;
+import com.google.zxing.Result;
+import com.jaredrummler.materialspinner.MaterialSpinner;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+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.R;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+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 org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PutAwayMainActivity extends  BaseActivity implements StoJNI.ScanCallBack {
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+    //单号清除
+    @BindView(R.id.ib_order_no_clear)
+    ImageButton ibOrderNoClear;
+
+    //单号
+    @BindView(R.id.et_order_no)
+    EditText etOrderNo;
+
+
+    //浮动按钮
+    @BindView(R.id.iv_drag)
+    FloatingImageView iv_drag;
+
+    @BindView(R.id.tv_already_location)
+    TextView tvAlreadyLocation;
+
+    @BindView(R.id.ms_location_list)
+    MaterialSpinner LocationSpinner;
+
+
+
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+    protected String action;
+
+    //订单信息对象
+    private JSONObject inboundObject;
+
+    private Unbinder unbinder;
+
+
+    //库位列
+    private JSONArray locationList;
+
+    private Integer selectId=0;
+
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fms_put_away;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+        action = bundle.getString("action","putaway");
+    }
+
+    /**
+     * 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();
+
+        //loadServiceData();
+        initData();
+
+        //监听浮动按钮
+        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(){
+
+        try {
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_LOCATION_LIST)
+                    .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);
+                                List<String> spinnerList = new ArrayList<String>();
+                                spinnerList.add("请选择上架库位");
+                                if(bean.code == 1){
+                                    //JSONObject data = new JSONObject(bean.data);
+                                    locationList = new JSONArray(bean.data);
+                                    for (int i = 0;i < locationList.length(); i++){
+                                        JSONObject jsonObject =locationList.getJSONObject(i);
+                                        spinnerList.add(jsonObject.getString("name"));
+                                    }
+                                    LocationSpinner.setItems(spinnerList);
+
+                                }else{
+                                    showWarningToast(bean.msg);
+                                }
+
+                                LocationSpinner.setSelectedIndex(selectId);
+                                initSpinner();
+
+                            } catch (Exception e) {
+                                showWarningToast("请配置上架库位基础数据");
+                                e.printStackTrace();
+                                XLog.e("获取上架库位解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            showWarningToast(e.getMessage());
+            XLog.e("请求上架库位信息错误:",e);
+        }
+    }
+
+    /**
+     *  初始化下拉框控件值
+     */
+    private void initSpinner() {
+        LocationSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
+            @Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
+                // XLog.e(id);XLog.e(item);
+                selectId = position;
+                if (position>0){
+                    setEditTextNormal(LocationSpinner,false);
+                }
+            }
+        });
+    }
+
+
+
+
+
+
+    @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){
+            //按确定键
+            if(this.validate()){
+                addPutAway();
+            }
+        }
+        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() {
+
+        //
+        etOrderNo.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+            @Override
+            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+                if (actionId == EditorInfo.IME_ACTION_DONE) {
+                    String orderNo = etOrderNo.getText().toString().trim();
+                    if (StringUtils.isEmpty(orderNo)) {
+                        setEditTextFocused(v,true);
+                        showWarningToast(v.getHint().toString());
+                        return false;
+                    }
+                    getInboundInfo();//获取订单信息
+                    return false;
+                }
+                return false;
+            }
+        });
+        etOrderNo.addTextChangedListener(new TextWatcher() {
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+                s = s.toString().trim();
+                if (s.length() > 0 ) {
+                    if (etOrderNo.isEnabled()){
+                        ibOrderNoClear.setVisibility(View.VISIBLE);
+                    }
+                    setEditTextNormal(etOrderNo,true);
+
+                } else {
+                    ibOrderNoClear.setVisibility(View.INVISIBLE);
+                    setEditTextFocused(etOrderNo,true);
+                }
+            }
+
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+            }
+
+            public void afterTextChanged(Editable s) {
+
+            }
+        });
+        ibOrderNoClear.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                etOrderNo.requestFocus();
+                etOrderNo.getText().clear();
+            }
+        });
+
+
+
+    }
+
+    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);
+
+            switch (view.getId()) {
+                case R.id.et_order_no:
+                    getInboundInfo();
+                    break;
+            }
+
+
+        }
+    }
+
+
+    private void getInboundInfo(){
+        final String orderNumber = etOrderNo.getText().toString().trim();
+        if (orderNumber.isEmpty()){
+            return;
+        }
+        try {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("order_number",orderNumber);
+            jsonObject.put("action",action);
+            if (!checkRepeat(Urls.FMS_CHECK_ORDER+(jsonObject.toString()))){
+                Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
+                return;
+            }
+
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_CHECK_ORDER).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);
+                                if(bean.code == 1){
+                                    showSuccessToast(bean.msg);
+                                    inboundObject = new JSONObject(bean.data);
+                                    tvAlreadyLocation.setText(inboundObject.getString("domestic_wms_location"));
+                                }else{
+                                    inboundObject = null;
+                                    showWarningToast(bean.msg);
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                                showEmptyView("入库订单信息解析错误:"+e.getMessage());
+                                XLog.e("获取入库订单信息解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            inboundObject = null;
+            XLog.e("请求出库订单信息错误:",e);
+        }
+    }
+
+
+    private void addPutAway() {
+
+        //校验数据
+        if (!validate()){
+            return;
+        }
+
+        String orderNumber = etOrderNo.getText().toString().trim();
+
+
+        try {
+            //locationList.getJSONObject(i);
+            JSONObject jsonObject = locationList.getJSONObject(selectId-1);
+            String locationNumber = jsonObject.getString("code");
+
+            JSONObject param = new JSONObject();
+            param.put("order_number",orderNumber);
+            param.put("domestic_wms_location",locationNumber);
+
+            if (!checkRepeat(Urls.FMS_PUT_AWAY+(param.toString()))){return;}
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_PUT_AWAY).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) {
+                                showErrorToast("数据解析失败"+e.getMessage());//不需要翻译
+                                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 (selectId==0){
+            setEditTextFocused(LocationSpinner,false);
+            showWarningToast("请选择上架库位");
+            return false;
+        }
+        return true;
+    }
+
+
+    //清除订单信息
+    private void clearData() {
+        etOrderNo.setText("");
+        etOrderNo.requestFocus();
+    }
+
+    @OnClick({R.id.ima_or_code,R.id.btn_confirm})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+            case R.id.btn_confirm:
+                addPutAway();
+
+                break;
+            case R.id.ima_or_code:
+                if(etOrderNo.isEnabled()){
+                    etOrderNo.requestFocus();
+                    ActivityScanerCode.setScanerListener(mScanerListener);
+                    ActivityScanerCode.intent2Activity(mContext, BaseConfig.COMMON_SCANNER_ONLY);
+                }
+                break;
+            default:
+                break;
+        }
+    }
+
+    @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());
+        }
+    }
+
+
+}

+ 484 - 0
app/src/main/java/com/fxy/fms/putIn/TallyPictureMainActivity.java

@@ -0,0 +1,484 @@
+package com.fxy.fms.putIn;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+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.view.KeyEvent;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+
+import com.elvishew.xlog.XLog;
+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 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.dialog.RxDialogChooseImage;
+import com.fxy.R;
+
+import com.fxy.common.PictureSelectorUpload;
+import com.fxy.base.fragment.ShowImgFragment;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+import com.fxy.constant.BaseConfig;
+import com.fxy.constant.EventCode;
+import com.fxy.fms.logic.ViewLogic;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+import com.fxy.view.FloatingImageView;
+
+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 TallyPictureMainActivity extends  BaseActivity implements StoJNI.ScanCallBack {
+
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+    //材积明细
+    @BindView(R.id.ll_add_img)
+    LinearLayout llAddImg;
+
+    //浮动按钮
+    @BindView(R.id.iv_drag)
+    FloatingImageView iv_drag;
+
+
+
+    @BindView(R.id.ll_tally_info)
+    LinearLayout llTallyInfo;
+
+    @BindView(R.id.rv_show_img)
+    RecyclerView rvShowImg;
+
+
+
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+    //订单信息对象
+    private JSONObject inboundObject;
+
+    private JSONObject paramObject;
+
+
+
+
+    private Unbinder unbinder;
+
+    protected String action;
+
+    private ShowImgFragment showImgFragment;
+
+
+// ArrayList<String> imgList = new  ArrayList<String>();
+    private RxDialogChooseImage rxDialogChooseImage;
+
+    private ArrayList photoList =new ArrayList<>();
+
+    private PictureSelectorUpload pictureSelectorUpload;
+
+
+    private JSONObject postParam = new JSONObject();
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fms_tally_picture;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+
+        try {
+            inboundObject = new JSONObject(bundle.getString("inbound_object"));
+            paramObject = new JSONObject(bundle.getString("param"));
+            postParam = new JSONObject(bundle.getString("post_param"));
+        } catch (JSONException e) {
+            XLog.e("接收数据解析:"+e.getMessage());
+            e.printStackTrace();
+        }
+
+
+
+    }
+    //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();
+
+
+        //loadServiceData();
+        initData();
+
+        //监听浮动按钮
+        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);
+                }
+            }
+        });
+
+        if (inboundObject!=null){
+            //设置订单信息
+            ViewLogic logic = new ViewLogic(llTallyInfo);
+            logic.setTallyData(inboundObject);
+            logic.setTallyMore(paramObject);
+        }
+
+        pictureSelectorUpload = new PictureSelectorUpload(TallyPictureMainActivity.this,rvShowImg,"tally");
+
+
+    }
+
+
+    private void initData(){
+
+    }
+
+
+    @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){
+            //按确定键
+            if(this.validate()){
+                addReceive();
+            }
+        }
+        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 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);
+
+            switch (view.getId()) {
+                case R.id.et_order_no:
+                    break;
+                default:
+            }
+
+
+        }
+    }
+
+
+
+
+    /*
+     * 校验必录
+     */
+    private boolean validate(){
+        photoList = pictureSelectorUpload.getPhotoList();
+        if (photoList.size()==0){
+            showWarningToast("请拍照拍照");
+            return false;
+        }
+        return true;
+    }
+
+
+
+
+    @OnClick({R.id.btn_confirm,R.id.tv_clear_pictures})
+    public void onViewClicked(final View view) {
+        Bundle bundle = new Bundle();
+
+        switch (view.getId()) {
+            case R.id.btn_confirm:
+                addReceive();
+                break;
+            case R.id.tv_clear_pictures:
+                pictureSelectorUpload.emptyRemake();
+                break;
+
+            default:
+                break;
+        }
+    }
+
+
+    private void addReceive(){
+        //校验数据
+        if (!validate()){
+            return;
+        }
+        try {
+
+            Gson gson = new Gson();
+            postParam.put("is_confirm","Y");
+            postParam.put("photo",gson.toJson(photoList));
+
+            if (!checkRepeat(Urls.FMS_ADD_RECEIVE+(postParam.toString()))){return;}
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_ADD_RECEIVE).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(getString(R.string.str_tally_success));
+                                    Intent intent = new Intent();
+                                    intent.putExtra("opt_status", "success");
+                                    setResult(200, intent);//返回值,200 是改返回的标志,也会返回
+                                    finish();
+                                }else{
+                                    showWarningToast(bean.msg);
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                                XLog.e("添加理货数据结果返回错误",e.getMessage());
+                            }
+                        }
+                    });
+        } catch (JSONException e) {
+            XLog.e("sku数据解析出错",e);
+            e.printStackTrace();
+        }
+    }
+
+
+
+
+
+    //获取输入框值
+    private String getValStr(EditText v){
+        return v.getText().toString().trim();
+    }
+
+    @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());
+        }
+    }
+
+
+}

+ 659 - 0
app/src/main/java/com/fxy/fms/putIn/TallyStartMainActivity.java

@@ -0,0 +1,659 @@
+package com.fxy.fms.putIn;
+
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.inputmethod.EditorInfo;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+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.google.zxing.Result;
+import com.jaredrummler.materialspinner.MaterialSpinner;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.model.Response;
+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.R;
+import com.fxy.bean.ActionBean;
+import com.fxy.bean.ScanBean;
+import com.fxy.constant.BaseConfig;
+import com.fxy.constant.EventCode;
+import com.fxy.fms.logic.ViewLogic;
+import com.fxy.fms.putIn.bean.InboundBean;
+import com.fxy.net.MyDialogCallback;
+import com.fxy.net.Urls;
+import com.fxy.view.FloatingImageView;
+
+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 TallyStartMainActivity extends  BaseActivity implements StoJNI.ScanCallBack {
+    /**
+     * 列表适配器
+     */
+    Context mContext = this;
+    //单号清除
+    @BindView(R.id.ib_order_no_clear)
+    ImageButton ibOrderNoClear;
+
+    //单号
+    @BindView(R.id.et_order_no)
+    EditText etOrderNo;
+
+
+    //浮动按钮
+    @BindView(R.id.iv_drag)
+    FloatingImageView iv_drag;
+
+
+    @BindView(R.id.ms_docker_list)
+    MaterialSpinner DockerSpinner;
+
+    @BindView(R.id.ll_tally_info)
+    LinearLayout llTallyInfo;
+
+    @BindView(R.id.checkBox_tag)
+    CheckBox checkBoxTag;
+
+
+
+    //扫码扫码动作
+    private ScanBean scanBean;
+
+    protected String action;
+
+    //订单信息对象
+    private JSONObject inboundObject;
+
+    private InboundBean inboundBean;
+
+
+
+    private Unbinder unbinder;
+
+    //订单号
+    private String orderNumber;
+
+    //搬运工队列
+    private JSONArray dockerList;
+
+    private Integer selectId=0;
+
+    private String hasLabel = "Y" ;//N 无标签入库  Y 需要标签入库
+
+    @Override
+    public int getContentViewResId() {
+        return R.layout.activity_fms_tally_start;
+    }
+
+    @Override
+    public boolean showToolBar() {
+        return true;
+    }
+
+    @Override
+    public boolean openEventBus() {
+        return true;
+    }
+
+    @Override
+    protected void getBundleExtras(Bundle bundle) {
+        action = bundle.getString("action","receive");
+    }
+    //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)//之前提到的两个标志,在这里显示出了作用
+        {
+            String  opt_status    = data.getStringExtra("opt_status").toString();
+            if (opt_status.equals("success")){
+                clearData();
+            }
+        }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.tally));
+
+        initEdit();
+
+
+        //loadServiceData();
+        initData();
+
+        //监听浮动按钮
+        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);
+                }
+            }
+        });
+
+        llTallyInfo.setVisibility(View.GONE);
+
+    }
+
+
+    private void initData(){
+
+        try {
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_DOCKER_LIST)
+                    .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);
+                                List<String> spinnerList = new ArrayList<String>();
+                                spinnerList.add("请选择搬运小组");
+                                if(bean.code == 1){
+                                    JSONObject data = new JSONObject(bean.data);
+                                    dockerList = new JSONArray(data.getString("docker_list"));
+                                    for (int i = 0;i < dockerList.length(); i++){
+                                        JSONObject jsonObject =dockerList.getJSONObject(i);
+                                        spinnerList.add(jsonObject.getString("name"));
+                                    }
+                                    DockerSpinner.setItems(spinnerList);
+
+                                }else{
+                                    showWarningToast(bean.msg);
+                                }
+
+                                DockerSpinner.setSelectedIndex(selectId);
+                                initSpinner();
+
+                            } catch (Exception e) {
+                                showWarningToast("获取搬运小组解析错误:"+e.getMessage());
+                                e.printStackTrace();
+                                XLog.e("获取搬运小组解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            showWarningToast(e.getMessage());
+            XLog.e("请求入库订单信息错误:",e);
+        }
+    }
+
+    /**
+     *  初始化下拉框控件值
+     */
+    private void initSpinner() {
+        DockerSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
+            @Override public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
+               // XLog.e(id);XLog.e(item);
+                selectId = position;
+                if (position>0){
+                    setEditTextNormal(DockerSpinner,false);
+                }
+            }
+        });
+    }
+
+
+    /**
+     * 复选框选中与不选中的事件
+     */
+    public void onCheckedChanged(CompoundButton checkBox, boolean checked) {
+        // TODO Auto-generated method stub
+        switch (checkBox.getId()) {
+            case R.id.checkBox_tag:
+                if (checked) {// 选中吃
+                    hasLabel = "Y";
+                } else {
+                    hasLabel = "N";
+                }
+                break;
+            default:
+                break;
+        }
+    }
+
+
+    @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){
+            //按确定键
+            if(this.validate()){
+                startReceive();
+            }
+        }
+        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() {
+
+        //
+        etOrderNo.setOnEditorActionListener(new TextView.OnEditorActionListener() {
+            @Override
+            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
+                if (actionId == EditorInfo.IME_ACTION_DONE) {
+                    String orderNo = etOrderNo.getText().toString().trim();
+                    if (StringUtils.isEmpty(orderNo)) {
+                        setEditTextFocused(v,true);
+                        showWarningToast(v.getHint().toString());
+                        return false;
+                    }
+                    getInboundInfo();//获取订单信息
+                    return false;
+                }
+                return false;
+            }
+        });
+        etOrderNo.addTextChangedListener(new TextWatcher() {
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+                orderNumber = s.toString().trim();
+                if (s.length() > 0 ) {
+                    if (etOrderNo.isEnabled()){
+                        ibOrderNoClear.setVisibility(View.VISIBLE);
+                    }
+                    setEditTextNormal(etOrderNo,true);
+                } else {
+                    ibOrderNoClear.setVisibility(View.INVISIBLE);
+                    setEditTextFocused(etOrderNo,true);
+                }
+            }
+
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+            }
+
+            public void afterTextChanged(Editable s) {
+
+            }
+        });
+        ibOrderNoClear.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                etOrderNo.requestFocus();
+                etOrderNo.getText().clear();
+            }
+        });
+    }
+
+    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);
+
+            switch (view.getId()) {
+                case R.id.et_order_no:
+                    getInboundInfo();
+                    break;
+                default:
+            }
+
+
+        }
+    }
+
+
+    private void getInboundInfo(){
+        final String orderNo = etOrderNo.getText().toString().trim();
+        if (orderNo.isEmpty()){
+            return;
+        }
+        try {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("order_number",orderNo);
+            jsonObject.put("action",action);
+            if (!checkRepeat(Urls.FMS_CHECK_ORDER+(jsonObject.toString()))){
+                Toast.makeText(this, getString(R.string.error_data_processed), Toast.LENGTH_LONG).show();
+                return;
+            }
+
+            OkGo.<String>post(Urls.getServiceAddress(this) + Urls.FMS_CHECK_ORDER).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);
+                                if(bean.code == 1){
+                                    inboundObject = new JSONObject(bean.data);
+                                    inboundBean  = JsonUtil.getObject(inboundObject.toString(), InboundBean.class);
+                                    //设置订单信息
+                                    llTallyInfo.setVisibility(View.VISIBLE);
+                                    ViewLogic logic = new ViewLogic(llTallyInfo);
+                                    logic.setTallyData(inboundObject);
+                                }else{
+                                    inboundObject = null;
+                                    showWarningToast(bean.msg);
+                                }
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                                showEmptyView("入库订单信息解析错误:"+e.getMessage());
+                                XLog.e("获取入库订单信息解析错误",e.getMessage());
+                            }
+                        }
+                    });
+        }catch (Exception e){
+            inboundObject = null;
+            XLog.e("请求入库订单信息错误:",e);
+        }
+    }
+
+
+    private void startReceive() {
+
+        //校验数据
+        if (!validate()){
+            return;
+        }
+        if (inboundObject==null){
+            getInboundInfo();
+            return;
+        }
+        orderNumber = etOrderNo.getText().toString().trim();
+
+        hasLabel = checkBoxTag.isChecked()?"Y":"N";
+
+        try {
+            JSONObject param = new JSONObject();
+            JSONObject dockerObject = dockerList.getJSONObject(selectId-1);
+            param.put("docker_id",dockerObject.getInt("id"));
+            param.put("docker_name",dockerObject.getString("name"));
+            param.put("order_number",orderNumber);
+            param.put("order_number",orderNumber);
+            param.put("has_label",hasLabel);
+
+            Bundle bundle = new Bundle();
+            bundle.putString("inbound_object",inboundObject.toString());
+            bundle.putString("param",param.toString());
+            intentPageResult(this,TallyVolumeMainActivity.class, bundle,200);
+        } catch (JSONException e) {
+            showEmptyView("数据组装失败:"+e.getMessage());
+            e.printStackTrace();
+        }
+
+
+    }
+
+    /*
+     * 校验必录
+     */
+    private boolean validate(){
+        if (selectId==0){
+            setEditTextFocused(DockerSpinner,false);
+            showWarningToast("请选择搬运小组");
+            return false;
+        }
+        if(!checkNull(etOrderNo)){
+            setEditTextFocused(etOrderNo,true);
+            showWarningToast(getString(R.string.hint_please_scan_no));
+            return false;
+        }
+
+        return true;
+    }
+
+
+    //清除订单信息
+    private void clearData() {
+        etOrderNo.setText("");
+        etOrderNo.requestFocus();
+        try {
+            JSONObject iniData = new JSONObject();
+            iniData.put("order_number", "");
+            iniData.put("customer_name", "");
+            iniData.put("receive_country", "");
+            iniData.put("product_name", "");
+            iniData.put("forecast_pieces", "");
+            iniData.put("domestic_wms_location", "");
+            llTallyInfo.setVisibility(View.GONE);
+            ViewLogic logic = new ViewLogic(llTallyInfo);
+            logic.setTallyData(iniData);
+            inboundObject = null;
+
+        } catch (JSONException e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+    @OnClick({R.id.ima_or_code,R.id.btn_confirm})
+    public void onViewClicked(View view) {
+        Bundle bundle = new Bundle();
+        switch (view.getId()) {
+            case R.id.btn_confirm:
+                startReceive();
+
+                break;
+            case R.id.ima_or_code:
+                if(etOrderNo.isEnabled()){
+                    etOrderNo.requestFocus();
+                    ActivityScanerCode.setScanerListener(mScanerListener);
+                    ActivityScanerCode.intent2Activity(TallyStartMainActivity.this, BaseConfig.COMMON_SCANNER_ONLY);
+                }
+                break;
+
+            default:
+                break;
+        }
+    }
+
+    @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());
+        }
+    }
+
+
+}

+ 0 - 0
app/src/main/java/com/fxy/fms/putIn/TallyVolumeMainActivity.java


Some files were not shown because too many files changed in this diff