Commit 98226f8e by Wyh

1、去掉library-updateApk下的FileProvider 2、統一LOG_DEBUG配置 3、凍鏈自動接單優化 4、供應鏈代碼

parent 1e28402f
...@@ -29,14 +29,14 @@ android { ...@@ -29,14 +29,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
zipAlignEnabled false zipAlignEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
......
...@@ -37,14 +37,14 @@ android { ...@@ -37,14 +37,14 @@ android {
resourcePrefix "coldChain" resourcePrefix "coldChain"
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
zipAlignEnabled false zipAlignEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.coldchain_module"> package="com.gingersoft.coldchain_module">
<application> <application>
<activity <activity
android:name=".mvp.ui.activity.OrderDetailsActivity" android:name=".mvp.ui.activity.OrderDetailsActivity"
......
...@@ -32,14 +32,14 @@ android { ...@@ -32,14 +32,14 @@ android {
// } // }
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
zipAlignEnabled false zipAlignEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
......
...@@ -19,7 +19,6 @@ import com.gingersoft.gsa.cloud.common.constans.PrintConstans ...@@ -19,7 +19,6 @@ import com.gingersoft.gsa.cloud.common.constans.PrintConstans
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails.Companion.verifiAmountTip import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails.Companion.verifiAmountTip
import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails.Companion.verificationAmount import com.gingersoft.gsa.cloud.common.core.delivery.OrderDetails.Companion.verificationAmount
import com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager
import com.gingersoft.gsa.cloud.common.core.user.UserContext import com.gingersoft.gsa.cloud.common.core.user.UserContext
import com.gingersoft.gsa.cloud.common.service.GetInfoUpdateService import com.gingersoft.gsa.cloud.common.service.GetInfoUpdateService
...@@ -31,14 +30,16 @@ import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils ...@@ -31,14 +30,16 @@ import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils
import com.gingersoft.gsa.cloud.component.ComponentName import com.gingersoft.gsa.cloud.component.ComponentName
import com.gingersoft.gsa.cloud.order.order.TakeawayOrder import com.gingersoft.gsa.cloud.order.order.TakeawayOrder
import com.gingersoft.gsa.cloud.pay.bean.PayMethod import com.gingersoft.gsa.cloud.pay.bean.PayMethod
import com.gingersoft.gsa.cloud.print.bean.adapter.PrintContentAdapter
import com.gingersoft.gsa.cloud.ui.utils.DialogUtils import com.gingersoft.gsa.cloud.ui.utils.DialogUtils
import com.gingersoft.gsa.delivery_pick_mode.R import com.gingersoft.gsa.delivery_pick_mode.R
import com.gingersoft.gsa.delivery_pick_mode.data.WeatherRepository import com.gingersoft.gsa.delivery_pick_mode.data.WeatherRepository
import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.* import com.gingersoft.gsa.delivery_pick_mode.data.model.bean.*
import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.DeliveryAdapter import com.gingersoft.gsa.delivery_pick_mode.ui.adapter.DeliveryAdapter
import com.gingersoft.gsa.delivery_pick_mode.util.OtherOrderUtils import com.gingersoft.gsa.delivery_pick_mode.util.OtherOrderUtils
import com.gingersoft.gsa.delivery_pick_mode.util.RxTimerUtil
import com.jess.arms.utils.ArmsUtils import com.jess.arms.utils.ArmsUtils
import com.xuexiang.rxutil2.rxjava.RxJavaUtils
import io.reactivex.disposables.Disposable
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
...@@ -115,12 +116,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -115,12 +116,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
//遍歷獲得外賣自取的 待確認和製作中的總單數 //遍歷獲得外賣自取的 待確認和製作中的總單數
for (i in data.selfTakeaway) { for (i in data.selfTakeaway) {
when { when (i.STATUS) {
i.STATUS == 0 -> //未支付的待確認 0 -> //未支付的待確認
mOrderNum[1].value = mOrderNum[1].value?.plus(i.SumNum) mOrderNum[1].value = mOrderNum[1].value?.plus(i.SumNum)
i.STATUS == 1 -> //已支付的待確認 1 -> //已支付的待確認
mOrderNum[1].value = mOrderNum[1].value?.plus(i.SumNum) mOrderNum[1].value = mOrderNum[1].value?.plus(i.SumNum)
i.STATUS == 2 -> //製作中 2 -> //製作中
mOrderNum[2].value = i.SumNum mOrderNum[2].value = i.SumNum
} }
} }
...@@ -179,11 +180,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -179,11 +180,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}) })
} }
private var autoPolling: Disposable? = null;
/** /**
* 開始自動確認訂單 * 開始自動確認訂單
*/ */
fun startAutoConfirmOrder() { fun startAutoConfirmOrder() {
RxTimerUtil.interval({ autoPolling = RxJavaUtils.polling(10) {
launch({ launch({
//獲取即時單 //獲取即時單
repository.requestOrderList(restaurantId.toString(), fragmentStatus[1] + ",8", fragmentType[0], "1", orderNo, phone, 0).apply { repository.requestOrderList(restaurantId.toString(), fragmentStatus[1] + ",8", fragmentType[0], "1", orderNo, phone, 0).apply {
...@@ -205,6 +208,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -205,6 +208,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
//如果是自取單,將物流類型改為本店 //如果是自取單,將物流類型改為本店
orderDetail.companyType = 0 orderDetail.companyType = 0
} }
//交通工具類型
var trafficType = "" var trafficType = ""
if (orderDetail.companyType == 2) { if (orderDetail.companyType == 2) {
//lalamove //lalamove
...@@ -221,21 +225,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -221,21 +225,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
confirmOrder(orderDetail, 2, trafficType, restaurantId, isPrintPrj = true, isPrintBill = true) { confirmOrder(orderDetail, 2, trafficType, restaurantId, isPrintPrj = true, isPrintBill = true) {
//確認之後,刷新列表 //確認之後,刷新列表
refreshState.postValue(0) refreshState.postValue(0)
} launch({
}
}
} else {
}
} else {
}
} else {
}
}
//獲取預約單 //獲取預約單
repository.requestOrderList(restaurantId.toString(), fragmentStatus[1], fragmentType[0], "1", orderNo, phone, 1).apply { repository.requestOrderList(restaurantId.toString(), fragmentStatus[1], fragmentType[0], "1", orderNo, phone, 1).apply {
if (isSuccess()) { if (isSuccess()) {
...@@ -257,13 +247,28 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() { ...@@ -257,13 +247,28 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
} }
} }
} }
}, {})
}
}
}
} else {
}
} else {
}
} else {
}
}
}, { }, {
//報錯處理
}) })
}, 10 * 1000) }
} }
fun stopAutoConfirmOrder() { fun stopAutoConfirmOrder() {
RxTimerUtil.cancelInterval() autoPolling?.dispose()
} }
......
...@@ -57,8 +57,8 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen ...@@ -57,8 +57,8 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
private val pageViewModel by lazy { ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] } private val pageViewModel by lazy { ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] }
private val instance by lazy { this } private val instance by lazy { this }
private val restaurantId by lazy { RestaurantInfoManager.newInstance().getRestaurantId() } private val restaurantId by lazy { RestaurantInfoManager.newInstance().restaurantId }
private val memberId by lazy { UserContext.newInstance().getMemberId() } private val memberId by lazy { UserContext.newInstance().memberId }
private val ints = arrayOf( private val ints = arrayOf(
R.string.tab_text_1, R.string.tab_text_1,
...@@ -92,9 +92,13 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen ...@@ -92,9 +92,13 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
mReceiver = ClearHeartBroadcastReceiver() mReceiver = ClearHeartBroadcastReceiver()
registerReceiver(mReceiver, mFilter) registerReceiver(mReceiver, mFilter)
val binding: ActivityOtherOrderBinding = DataBindingUtil.setContentView(this, R.layout.activity_other_order) val binding: ActivityOtherOrderBinding = DataBindingUtil.setContentView(this, R.layout.activity_other_order)
//初始化超時時間
initOutTime() initOutTime()
//初始化心跳長連接
initWebsocket() initWebsocket()
//初始化標題欄
initAppTop() initAppTop()
//初始化切換餐廳狀態
initSwitchRestStatus() initSwitchRestStatus()
initViewPager() initViewPager()
......
...@@ -35,15 +35,15 @@ android { ...@@ -35,15 +35,15 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -37,15 +37,15 @@ android { ...@@ -37,15 +37,15 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
signingConfig signingConfigs.GSAndroidNew signingConfig signingConfigs.GSAndroidNew
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
zipAlignEnabled false zipAlignEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
...@@ -122,10 +122,10 @@ dependencies { ...@@ -122,10 +122,10 @@ dependencies {
addComponent 'component-delivery-pick' addComponent 'component-delivery-pick'
addComponent 'component-manager' addComponent 'component-manager'
addComponent 'component-coldchain' addComponent 'component-coldchain'
// addComponent 'component-supply-chain' addComponent 'component-supply-chain'
addComponent 'component-webview' addComponent 'component-webview'
// addComponent 'component-scan' addComponent 'component-scan'
// addComponent 'component-pay' addComponent 'component-pay'
implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03' implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"] annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
......
...@@ -74,10 +74,10 @@ ...@@ -74,10 +74,10 @@
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
tools:replace="android:label"> tools:replace="android:label">
<!--适配android 7.0文件访问 --> <!-- &lt;!&ndash;适配android 7.0文件访问 &ndash;&gt;-->
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="com.gingersoft.gsa.cloud.login" android:authorities="${applicationId}.fileprovider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
android:roundIcon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity"> <activity android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
...@@ -37,14 +37,14 @@ android { ...@@ -37,14 +37,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -43,7 +43,8 @@ public class ComponentMain implements IComponent { ...@@ -43,7 +43,8 @@ public class ComponentMain implements IComponent {
new FModule("main/manager/pay", R.drawable.ic_pay_management, R.drawable.ic_pay_management_close), new FModule("main/manager/pay", R.drawable.ic_pay_management, R.drawable.ic_pay_management_close),
new FModule("main/manager/discout", R.drawable.ic_discount_management, R.drawable.ic_discount_management_close), new FModule("main/manager/discout", R.drawable.ic_discount_management, R.drawable.ic_discount_management_close),
new FModule("main/manager/soldoutCtr", R.drawable.ic_sell_off_manger, R.drawable.ic_sell_off_manger), new FModule("main/manager/soldoutCtr", R.drawable.ic_sell_off_manger, R.drawable.ic_sell_off_manger),
new FModule("main/manager/qrCode", R.drawable.ic_qr_code, R.drawable.ic_qr_code) new FModule("main/manager/qrCode", R.drawable.ic_qr_code, R.drawable.ic_qr_code),
new FModule("main/manager/purchase", R.drawable.ic_purchase, R.drawable.ic_purchase)
}; };
/** /**
* 首頁- 員工管理 * 首頁- 員工管理
......
...@@ -27,14 +27,14 @@ android { ...@@ -27,14 +27,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -27,14 +27,14 @@ android { ...@@ -27,14 +27,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard-rules.pro' proguardFiles 'proguard-rules.pro'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -23,14 +23,14 @@ android { ...@@ -23,14 +23,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
zipAlignEnabled false zipAlignEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
......
...@@ -27,14 +27,14 @@ android { ...@@ -27,14 +27,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -34,14 +34,14 @@ android { ...@@ -34,14 +34,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -20,10 +20,20 @@ ...@@ -20,10 +20,20 @@
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="640" /> android:value="640" />
<!-- <activity--> <activity
<!-- android:name="com.yalantis.ucrop.UCropActivity"--> android:name="com.yalantis.ucrop.UCropActivity"
<!-- android:screenOrientation="portrait"--> android:screenOrientation="portrait"
<!-- android:theme="@style/Theme.AppCompat.Light.NoActionBar" />--> android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
<!-- 哪個模塊用到,哪個模塊的androidmanifest裡面就要加這個 file_paths 要唯一-->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -30,19 +30,12 @@ ...@@ -30,19 +30,12 @@
android:value="360" /> android:value="360" />
<meta-data <meta-data
android:name="design_height_in_dp" android:name="design_height_in_dp"
android:value="640" /> <!-- 适配android 7.0文件访问 --> android:value="640" />
<!-- <provider-->
<!-- android:name="androidx.core.content.FileProvider"-->
<!-- android:authorities="com.gingersoft.supply_chain.fileprovider">-->
<!-- <meta-data-->
<!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
<!-- android:resource="@xml/file_paths" />-->
<!-- </provider>-->
<activity <activity
android:name="com.yalantis.ucrop.UCropActivity" android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/> android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -5,18 +5,18 @@ import dagger.Component; ...@@ -5,18 +5,18 @@ import dagger.Component;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.WareHousingDetailsModule; import com.gingersoft.supply_chain.di.module.WarehouseDetailsModule;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract; import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHousingDetailsFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehouseDetailsFragment;
/** /**
* ================================================ * ================================================
* Description: * Description:
* <p> * <p>
* Created by MVPArmsTemplate on 01/12/2021 14:28 * Created by MVPArmsTemplate on 01/21/2021 10:15
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a> * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a> * <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
...@@ -25,17 +25,17 @@ import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHousingDetailsF ...@@ -25,17 +25,17 @@ import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WareHousingDetailsF
* ================================================ * ================================================
*/ */
@FragmentScope @FragmentScope
@Component(modules = WareHousingDetailsModule.class, dependencies = AppComponent.class) @Component(modules = WarehouseDetailsModule.class, dependencies = AppComponent.class)
public interface WareHousingDetailsComponent { public interface WarehouseDetailsComponent {
void inject(WareHousingDetailsFragment fragment); void inject(WarehouseDetailsFragment fragment);
@Component.Builder @Component.Builder
interface Builder { interface Builder {
@BindsInstance @BindsInstance
WareHousingDetailsComponent.Builder view(WareHousingDetailsContract.View view); WarehouseDetailsComponent.Builder view(WarehouseDetailsContract.View view);
WareHousingDetailsComponent.Builder appComponent(AppComponent appComponent); WarehouseDetailsComponent.Builder appComponent(AppComponent appComponent);
WareHousingDetailsComponent build(); WarehouseDetailsComponent build();
} }
} }
\ No newline at end of file
package com.gingersoft.supply_chain.di.component;
import dagger.BindsInstance;
import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.WarehousingInventoryModule;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.jess.arms.di.scope.FragmentScope;
import com.gingersoft.supply_chain.mvp.ui.fragment.warehouse.WarehousingInventoryFragment;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/22/2021 15:10
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
@Component(modules = WarehousingInventoryModule.class, dependencies = AppComponent.class)
public interface WarehousingInventoryComponent {
void inject(WarehousingInventoryFragment fragment);
@Component.Builder
interface Builder {
@BindsInstance
WarehousingInventoryComponent.Builder view(WarehousingInventoryContract.View view);
WarehousingInventoryComponent.Builder appComponent(AppComponent appComponent);
WarehousingInventoryComponent build();
}
}
\ No newline at end of file
...@@ -6,15 +6,15 @@ import dagger.Binds; ...@@ -6,15 +6,15 @@ import dagger.Binds;
import dagger.Module; import dagger.Module;
import dagger.Provides; import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract; import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.gingersoft.supply_chain.mvp.model.WareHousingDetailsModel; import com.gingersoft.supply_chain.mvp.model.WarehouseDetailsModel;
/** /**
* ================================================ * ================================================
* Description: * Description:
* <p> * <p>
* Created by MVPArmsTemplate on 01/12/2021 14:28 * Created by MVPArmsTemplate on 01/21/2021 10:15
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a> * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a> * <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
...@@ -23,8 +23,8 @@ import com.gingersoft.supply_chain.mvp.model.WareHousingDetailsModel; ...@@ -23,8 +23,8 @@ import com.gingersoft.supply_chain.mvp.model.WareHousingDetailsModel;
* ================================================ * ================================================
*/ */
@Module @Module
public abstract class WareHousingDetailsModule { public abstract class WarehouseDetailsModule {
@Binds @Binds
abstract WareHousingDetailsContract.Model bindWareHousingDetailsModel(WareHousingDetailsModel model); abstract WarehouseDetailsContract.Model bindWarehouseDetailsModel(WarehouseDetailsModel model);
} }
\ No newline at end of file
package com.gingersoft.supply_chain.di.module;
import com.jess.arms.di.scope.FragmentScope;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.gingersoft.supply_chain.mvp.model.WarehousingInventoryModel;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/22/2021 15:10
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@Module
public abstract class WarehousingInventoryModule {
@Binds
abstract WarehousingInventoryContract.Model bindWarehousingInventoryModel(WarehousingInventoryModel model);
}
\ No newline at end of file
...@@ -32,22 +32,32 @@ public class ConfirmOrderBean { ...@@ -32,22 +32,32 @@ public class ConfirmOrderBean {
private int restaurantId; private int restaurantId;
private String sendingAddress; private String sendingAddress;
//默認第二天 //默認第二天
private long initialShippingTime; private String initialShippingTime;
private double totalAmount; private double totalAmount;
private int shipping; /**
* 運費
*/
private double shipping;
/**
* 實際支付金額
*/
private double actualPayment; private double actualPayment;
/**
* 備註
*/
private String remarks; private String remarks;
} }
public static PurchaseOrder conversionPurchaseOrder(int supplierId, String supplierName, double totalAmount) { public static PurchaseOrder conversionPurchaseOrder(ShoppingCartBean shoppingCartBean, double totalAmount) {
PurchaseOrder purchaseOrder = new PurchaseOrder(); PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setSupplierId(supplierId); purchaseOrder.setSupplierId(shoppingCartBean.getSupplierId());
purchaseOrder.setSupplierName(supplierName); purchaseOrder.setSupplierName(shoppingCartBean.getSupplierName());
purchaseOrder.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); purchaseOrder.setBrandId(RestaurantInfoManager.newInstance().getBrandId());
purchaseOrder.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); purchaseOrder.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId());
purchaseOrder.setInitialShippingTime(TimeUtils.getNextDayLong(1)); purchaseOrder.setRemarks(shoppingCartBean.getRemarks());
purchaseOrder.setInitialShippingTime(shoppingCartBean.getInitialShippingTime());
purchaseOrder.setTotalAmount(totalAmount); purchaseOrder.setTotalAmount(totalAmount);
purchaseOrder.setActualPayment(MoneyUtil.sum(purchaseOrder.getTotalAmount(), purchaseOrder.getShipping())); purchaseOrder.setActualPayment(MoneyUtil.sum(totalAmount, shoppingCartBean.getShipping()));
return purchaseOrder; return purchaseOrder;
} }
......
...@@ -36,6 +36,10 @@ public class DeputyUnitBean implements Serializable { ...@@ -36,6 +36,10 @@ public class DeputyUnitBean implements Serializable {
*/ */
private double deputyValue; private double deputyValue;
/** /**
* 入庫單位單價
*/
private double unitPrice;
/**
* 食材id * 食材id
*/ */
private int purchaseFoodId; private int purchaseFoodId;
...@@ -66,6 +70,16 @@ public class DeputyUnitBean implements Serializable { ...@@ -66,6 +70,16 @@ public class DeputyUnitBean implements Serializable {
deputyUnitBean.setDeputyUnit(wareHousingUnitBean.getUnitName()); deputyUnitBean.setDeputyUnit(wareHousingUnitBean.getUnitName());
deputyUnitBean.setDeputyValue(wareHousingUnitBean.getUnitValue()); deputyUnitBean.setDeputyValue(wareHousingUnitBean.getUnitValue());
deputyUnitBean.setConversionMultiple(wareHousingUnitBean.getConversionMultiple()); deputyUnitBean.setConversionMultiple(wareHousingUnitBean.getConversionMultiple());
deputyUnitBean.setUnitPrice(wareHousingUnitBean.getUnitPrice());
return deputyUnitBean; return deputyUnitBean;
} }
public static WareHousingUnitBean getWareHousingUnitByDeputyUnit(DeputyUnitBean deputyUnitBean){
WareHousingUnitBean wareHousingUnitBean = new WareHousingUnitBean();
wareHousingUnitBean.setUnitName(deputyUnitBean.getDeputyUnit());
wareHousingUnitBean.setUnitValue(deputyUnitBean.getDeputyValue());
wareHousingUnitBean.setConversionMultiple(deputyUnitBean.getConversionMultiple());
wareHousingUnitBean.setUnitPrice(deputyUnitBean.getUnitPrice());
return wareHousingUnitBean;
}
} }
...@@ -52,7 +52,7 @@ public class FoodCategoryResultBean { ...@@ -52,7 +52,7 @@ public class FoodCategoryResultBean {
private String remarks; private String remarks;
private long createTime; private long createTime;
private long updateTime; private long updateTime;
private int deletes; private Integer deletes;
/** /**
* 子類 * 子類
*/ */
......
...@@ -21,6 +21,9 @@ public class OrderWareHouseBean { ...@@ -21,6 +21,9 @@ public class OrderWareHouseBean {
@Data @Data
public static class PurchaseWarehousingOrder { public static class PurchaseWarehousingOrder {
/**
* 訂單圖片,多張,用逗號分隔
*/
private String files; private String files;
private String remarks; private String remarks;
private double totalPrice; private double totalPrice;
...@@ -47,6 +50,6 @@ public class OrderWareHouseBean { ...@@ -47,6 +50,6 @@ public class OrderWareHouseBean {
/** /**
* 副單位 * 副單位
*/ */
private List<WareHousingUnitBean> purchaseWarehousingUnits; private WareHousingUnitBean purchaseWarehousingUnit;
} }
} }
...@@ -100,7 +100,7 @@ public class PurchaseOrderDetailsBean { ...@@ -100,7 +100,7 @@ public class PurchaseOrderDetailsBean {
* 食品數量 * 食品數量
*/ */
private int foodQuantity; private int foodQuantity;
private int foodPrice; private double foodPrice;
private int status; private int status;
private int purchaseFoodId; private int purchaseFoodId;
private String images; private String images;
...@@ -131,13 +131,18 @@ public class PurchaseOrderDetailsBean { ...@@ -131,13 +131,18 @@ public class PurchaseOrderDetailsBean {
/** /**
* 入庫後,後台傳來的副單位數據 * 入庫後,後台傳來的副單位數據
*/ */
private List<WareHousingUnitBean> purchaseWarehousingUnits; WareHousingUnitBean purchaseWarehousingUnit;
/**
* 已入庫數量
*/
private int warehousingQuantity;
// List<DeputyUnitBean> deputyUnitBeans; // List<DeputyUnitBean> deputyUnitBeans;
/** /**
* 沒有入庫單號,暫時用訂單編號 * 沒有入庫單號,暫時用訂單編號
*/ */
private String orderNo; private String orderNo;
private DeputyUnitBean showUnit;
} }
} }
...@@ -42,11 +42,20 @@ public class ShoppingCartBean { ...@@ -42,11 +42,20 @@ public class ShoppingCartBean {
*/ */
private double selectFoodAmount; private double selectFoodAmount;
/** /**
* 預計送達時間
*/
private String initialShippingTime;
/**
* 當前供應商下的食品是否全選 * 當前供應商下的食品是否全選
*/ */
private boolean isAllSelect; private boolean isAllSelect;
private String remarks;
/** /**
* 是否閃爍:如果採購金額低於最低採購金額限制,會滾動到指定位置並閃爍 * 是否閃爍:如果採購金額低於最低採購金額限制,會滾動到指定位置並閃爍
*/ */
private boolean isFlashing = false; private boolean isFlashing = false;/**
* 運費
*/
private double shipping;
} }
...@@ -34,7 +34,7 @@ public class SupplierInfoBean implements Serializable { ...@@ -34,7 +34,7 @@ public class SupplierInfoBean implements Serializable {
private int countryId; private int countryId;
private long createTime; private long createTime;
private long updateTime; private long updateTime;
private int deletes; private Integer deletes;
private double minimumAmount; private double minimumAmount;
private List<SupplierContacts> supplierContacts; private List<SupplierContacts> supplierContacts;
......
...@@ -13,7 +13,7 @@ public class WareHousingUnitBean { ...@@ -13,7 +13,7 @@ public class WareHousingUnitBean {
/** /**
* 入庫單詳情id * 入庫單詳情id
*/ */
private int purchaseWarehousingOrderDetailsId; private Integer purchaseWarehousingOrderDetailsId;
/** /**
* 副單位名稱 * 副單位名稱
*/ */
...@@ -23,6 +23,10 @@ public class WareHousingUnitBean { ...@@ -23,6 +23,10 @@ public class WareHousingUnitBean {
*/ */
private double unitValue; private double unitValue;
/** /**
* 入庫單位單價
*/
private double unitPrice;
/**
* 換算倍數 * 換算倍數
*/ */
private double conversionMultiple; private double conversionMultiple;
...@@ -38,6 +42,10 @@ public class WareHousingUnitBean { ...@@ -38,6 +42,10 @@ public class WareHousingUnitBean {
this.conversionMultiple = conversionMultiple; this.conversionMultiple = conversionMultiple;
} }
public WareHousingUnitBean() {
}
public int getId() { public int getId() {
return id; return id;
} }
...@@ -93,4 +101,16 @@ public class WareHousingUnitBean { ...@@ -93,4 +101,16 @@ public class WareHousingUnitBean {
public void setRestaurantId(int restaurantId) { public void setRestaurantId(int restaurantId) {
this.restaurantId = restaurantId; this.restaurantId = restaurantId;
} }
public void setId(Integer id) {
this.id = id;
}
public double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(double unitPrice) {
this.unitPrice = unitPrice;
}
} }
package com.gingersoft.supply_chain.mvp.bean;
import java.util.List;
import lombok.Data;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/22
* Time: 12:36
* Use:
*/
@Data
public class WarehouseDetailsBean {
/**
* foodNum : 151
* purchaseWarehousingOrderDetailsContents : [{"name":"去微软","purchase":"採購入庫","orderNo":"JK11820389311","foodQuantity":17,"totalPrice":102,"createTime":2021,"warningDays":""},{"name":"去微软","purchase":"採購入庫","orderNo":"JK11820389311","foodQuantity":17,"totalPrice":102,"createTime":2021,"warningDays":""}]
*/
private String images;
private int foodNum;
private List<PurchaseWarehousingOrderDetailsContentsBean> purchaseWarehousingOrderDetailsContents;
@Data
public static class PurchaseWarehousingOrderDetailsContentsBean {
/**
* name : 去微软
* purchase : 採購入庫
* orderNo : JK11820389311
* foodQuantity : 17
* totalPrice : 102.0
* createTime : 2021
* warningDays :
*/
private String name;
private String purchase;
private String orderNo;
private int foodQuantity;
private double totalPrice;
private int createTime;
private String warningDays;
}
}
package com.gingersoft.supply_chain.mvp.content; package com.gingersoft.supply_chain.mvp.content;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import java.util.Map; import java.util.Map;
...@@ -30,6 +32,12 @@ public class Constant { ...@@ -30,6 +32,12 @@ public class Constant {
public static final String GET_INFO_ERROR = "數據獲取失敗,請稍候再試"; public static final String GET_INFO_ERROR = "數據獲取失敗,請稍候再試";
public static final String INFO_SYNTAX_ERROR = "數據解析失敗,請聯繫開發人員"; public static final String INFO_SYNTAX_ERROR = "數據解析失敗,請聯繫開發人員";
public static final String GET_INFO_LOADING = "數據獲取中..."; public static final String GET_INFO_LOADING = "數據獲取中...";
public static final String QUERY_LOADING = "查詢中...";
public static final String IMG_UPLOAD_LOADING = "圖片上傳中...";
public static final String IMG_UPLOAD_FAIL = "圖片上傳失敗,請稍後重試";
public static final String NULL_INFO_ERROR = "未獲取到數據,請退出後重試"; public static final String NULL_INFO_ERROR = "未獲取到數據,請退出後重試";
public static final String SAVE_LOADING = "保存中..."; public static final String SAVE_LOADING = "保存中...";
public static final String SAVE_SUCCESS = "保存成功"; public static final String SAVE_SUCCESS = "保存成功";
......
...@@ -43,5 +43,7 @@ public interface CategoryContract { ...@@ -43,5 +43,7 @@ public interface CategoryContract {
Observable<BaseResult> createFoodCategory(RequestBody requestBody); Observable<BaseResult> createFoodCategory(RequestBody requestBody);
Observable<BaseResult> updateFoodCategory(RequestBody requestBody); Observable<BaseResult> updateFoodCategory(RequestBody requestBody);
Observable<BaseResult> deleteFoodCategory(RequestBody requestBody);
} }
} }
...@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult; ...@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -38,5 +40,8 @@ public interface NewSupplierContract { ...@@ -38,5 +40,8 @@ public interface NewSupplierContract {
Observable<BaseResult> addSupplierContact(RequestBody requestBody); Observable<BaseResult> addSupplierContact(RequestBody requestBody);
Observable<BaseResult> deleteSupplier(int supplierId);
Observable<BaseResult> getSupplierInfo(Map<String, Object> map);
} }
} }
...@@ -5,7 +5,11 @@ import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean; ...@@ -5,7 +5,11 @@ import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -25,6 +29,8 @@ public interface OrderDetailsContract { ...@@ -25,6 +29,8 @@ public interface OrderDetailsContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean); void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean);
void uploadPicSuccess(String imgUrl);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
...@@ -35,5 +41,10 @@ public interface OrderDetailsContract { ...@@ -35,5 +41,10 @@ public interface OrderDetailsContract {
* 入庫 * 入庫
*/ */
Observable<BaseResult> addWarehouse(RequestBody requestBody); Observable<BaseResult> addWarehouse(RequestBody requestBody);
Observable<BaseResult> upLoadPic(List<MultipartBody.Part> parts, Map<String, Object> map);
Observable<BaseResult> deleteOrder(int orderId);
} }
} }
...@@ -42,5 +42,8 @@ public interface PurchaseListContract { ...@@ -42,5 +42,8 @@ public interface PurchaseListContract {
Observable<PurchaseOrderResultBean> getOrderList(Map<String, Object> map); Observable<PurchaseOrderResultBean> getOrderList(Map<String, Object> map);
Observable<BaseResult> updateOrder(RequestBody requestBody); Observable<BaseResult> updateOrder(RequestBody requestBody);
Observable<BaseResult> deleteOrder(int orderId);
} }
} }
...@@ -40,6 +40,10 @@ public interface ShoppingCatContract { ...@@ -40,6 +40,10 @@ public interface ShoppingCatContract {
*/ */
void notifyAdapter(int position); void notifyAdapter(int position);
/**
* 設置創建訂單按鈕顯示狀態
*/
void setCreateBtnState(boolean checkable);
} }
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存 //Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
...@@ -43,5 +43,7 @@ public interface SupplierListContract { ...@@ -43,5 +43,7 @@ public interface SupplierListContract {
Observable<BaseResult> updateSupplier(RequestBody requestBody); Observable<BaseResult> updateSupplier(RequestBody requestBody);
Observable<BaseResult> deleteSupplier(int id);
} }
} }
package com.gingersoft.supply_chain.mvp.contract;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/21/2021 10:15
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface WarehouseDetailsContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
/**
* 加載入庫信息和列表
* @param warehouseDetailsBean
*/
void loadWarehousing(WarehouseDetailsBean warehouseDetailsBean);
void loadAdapter(List<WarehouseDetailsBean.PurchaseWarehousingOrderDetailsContentsBean> purchaseWarehousingOrderDetailsContents);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
interface Model extends IModel {
Observable<BaseResult> getWarehousingOrderDetails(Map<String, Object> map);
Observable<BaseResult> getWarehouseInventoryReason();
}
}
...@@ -8,7 +8,7 @@ import com.jess.arms.mvp.IModel; ...@@ -8,7 +8,7 @@ import com.jess.arms.mvp.IModel;
* ================================================ * ================================================
* Description: * Description:
* <p> * <p>
* Created by MVPArmsTemplate on 01/12/2021 14:28 * Created by MVPArmsTemplate on 01/22/2021 15:10
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a> * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a> * <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
...@@ -16,7 +16,7 @@ import com.jess.arms.mvp.IModel; ...@@ -16,7 +16,7 @@ import com.jess.arms.mvp.IModel;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a> * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================ * ================================================
*/ */
public interface WareHousingDetailsContract { public interface WarehousingInventoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息 //对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView { interface View extends IView {
......
...@@ -65,4 +65,9 @@ public class CategoryModel extends BaseModel implements CategoryContract.Model { ...@@ -65,4 +65,9 @@ public class CategoryModel extends BaseModel implements CategoryContract.Model {
public Observable<BaseResult> updateFoodCategory(RequestBody requestBody) { public Observable<BaseResult> updateFoodCategory(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateFoodCategory(requestBody); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateFoodCategory(requestBody);
} }
@Override
public Observable<BaseResult> deleteFoodCategory(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteFoodCategory(requestBody);
}
} }
\ No newline at end of file
...@@ -10,6 +10,8 @@ import com.jess.arms.di.scope.FragmentScope; ...@@ -10,6 +10,8 @@ import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager; import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel; import com.jess.arms.mvp.BaseModel;
import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import io.reactivex.Observable; import io.reactivex.Observable;
...@@ -71,4 +73,14 @@ public class NewSupplierModel extends BaseModel implements NewSupplierContract.M ...@@ -71,4 +73,14 @@ public class NewSupplierModel extends BaseModel implements NewSupplierContract.M
public Observable<BaseResult> addSupplierContact(RequestBody requestBody) { public Observable<BaseResult> addSupplierContact(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addSupplierContact(requestBody); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addSupplierContact(requestBody);
} }
@Override
public Observable<BaseResult> deleteSupplier(int supplierId) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteSupplier(supplierId);
}
@Override
public Observable<BaseResult> getSupplierInfo(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getSupplierInfo(map);
}
} }
\ No newline at end of file
...@@ -14,7 +14,11 @@ import javax.inject.Inject; ...@@ -14,7 +14,11 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract; import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable; import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -58,4 +62,14 @@ public class OrderDetailsModel extends BaseModel implements OrderDetailsContract ...@@ -58,4 +62,14 @@ public class OrderDetailsModel extends BaseModel implements OrderDetailsContract
public Observable<BaseResult> addWarehouse(RequestBody requestBody) { public Observable<BaseResult> addWarehouse(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addWarehouse(requestBody); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).addWarehouse(requestBody);
} }
@Override
public Observable<BaseResult> upLoadPic(List<MultipartBody.Part> parts, Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).upLoadPic(parts, map);
}
@Override
public Observable<BaseResult> deleteOrder(int orderId) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteOrder(orderId);
}
} }
\ No newline at end of file
...@@ -59,4 +59,9 @@ public class PurchaseListModel extends BaseModel implements PurchaseListContract ...@@ -59,4 +59,9 @@ public class PurchaseListModel extends BaseModel implements PurchaseListContract
public Observable<BaseResult> updateOrder(RequestBody requestBody) { public Observable<BaseResult> updateOrder(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateOrder(requestBody); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateOrder(requestBody);
} }
@Override
public Observable<BaseResult> deleteOrder(int orderId) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteOrder(orderId);
}
} }
\ No newline at end of file
...@@ -59,4 +59,11 @@ public class SupplierListModel extends BaseModel implements SupplierListContract ...@@ -59,4 +59,11 @@ public class SupplierListModel extends BaseModel implements SupplierListContract
public Observable<BaseResult> updateSupplier(RequestBody requestBody) { public Observable<BaseResult> updateSupplier(RequestBody requestBody) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateSupplier(requestBody); return mRepositoryManager.obtainRetrofitService(SupplierServer.class).updateSupplier(requestBody);
} }
@Override
public Observable<BaseResult> deleteSupplier(int id) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).deleteSupplier(id);
}
} }
\ No newline at end of file
package com.gingersoft.supply_chain.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.supply_chain.mvp.server.SupplierServer;
import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import java.util.Map;
import io.reactivex.Observable;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/21/2021 10:15
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class WarehouseDetailsModel extends BaseModel implements WarehouseDetailsContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public WarehouseDetailsModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mGson = null;
this.mApplication = null;
}
@Override
public Observable<BaseResult> getWarehousingOrderDetails(Map<String, Object> map) {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getWarehousingOrderDetails(map);
}
@Override
public Observable<BaseResult> getWarehouseInventoryReason() {
return mRepositoryManager.obtainRetrofitService(SupplierServer.class).getWarehouseInventoryReason();
}
}
\ No newline at end of file
...@@ -10,14 +10,14 @@ import com.jess.arms.di.scope.FragmentScope; ...@@ -10,14 +10,14 @@ import com.jess.arms.di.scope.FragmentScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract; import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
/** /**
* ================================================ * ================================================
* Description: * Description:
* <p> * <p>
* Created by MVPArmsTemplate on 01/12/2021 14:28 * Created by MVPArmsTemplate on 01/22/2021 15:10
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a> * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a> * <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
...@@ -26,14 +26,14 @@ import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract; ...@@ -26,14 +26,14 @@ import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
* ================================================ * ================================================
*/ */
@FragmentScope @FragmentScope
public class WareHousingDetailsModel extends BaseModel implements WareHousingDetailsContract.Model { public class WarehousingInventoryModel extends BaseModel implements WarehousingInventoryContract.Model {
@Inject @Inject
Gson mGson; Gson mGson;
@Inject @Inject
Application mApplication; Application mApplication;
@Inject @Inject
public WareHousingDetailsModel(IRepositoryManager repositoryManager) { public WarehousingInventoryModel(IRepositoryManager repositoryManager) {
super(repositoryManager); super(repositoryManager);
} }
......
...@@ -27,6 +27,7 @@ import io.reactivex.annotations.NonNull; ...@@ -27,6 +27,7 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
...@@ -95,7 +96,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -95,7 +96,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
} }
mModel.getFoodCategoryList(map) mModel.getFoodCategoryList(map)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中...")) .doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> { .doAfterTerminate(() -> {
...@@ -217,10 +218,33 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat ...@@ -217,10 +218,33 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
return foodCategoryBean; return foodCategoryBean;
} }
public void deleteFoodCategory(FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean, int hierarchy, int position) { public void deleteFoodCategory(int id, int hierarchy, int position) {
foodCategoryBean.setDeletes(Constant.DELETE); RequestBody requestBody = new FormBody.Builder()
updateFoodCategory(foodCategoryBean, hierarchy, position); .add("id", id + "")
.add("brandId", RestaurantInfoManager.newInstance().getBrandId() + "")
.add("restaurantId", RestaurantInfoManager.newInstance().getRestaurantId() +"")
.build();
mModel.deleteFoodCategory(requestBody)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess()) {
mRootView.refreshInfo(hierarchy, position);
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage(Constant.DELETE_FAIL);
} }
}
});
}
/** /**
* @param foodCategoryBean * @param foodCategoryBean
......
...@@ -194,7 +194,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -194,7 +194,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "所屬供應商", true, "請輸入/選擇供應商", SELECT_SUPPLIER_RESULTCODE, true, new InputFilter[]{InputFilterUtils.getLengthFilter(context, 16), InputFilterUtils.getChAndEnAndNumInputFilter(context)}, SupplierListFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "所屬供應商", true, "請輸入/選擇供應商", SELECT_SUPPLIER_RESULTCODE, true, new InputFilter[]{InputFilterUtils.getLengthFilter(context, 16), InputFilterUtils.getChAndEnAndNumInputFilter(context)}, SupplierListFragment.class));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材名稱", true, "請輸入名稱")); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材名稱", true, "請輸入名稱"));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "食材類別", true, "請選擇食材類別", SELECT_FOOD_CATEGORY_REQUEST_CODE, CategorySelectFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "食材類別", true, "請選擇食材類別", SELECT_FOOD_CATEGORY_REQUEST_CODE, CategorySelectFragment.class));
infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", false, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class)); infoMultiBeans.add(new MultiSelectBean(InfoMultiBean.EDIT_FOOD_ITEM_SELECT, "基本單位", true, "請選擇食材單位", SELECT_PACKAGE_SPECIFICATION_REQUEST_CODE, FoodUnitPageFragment.class));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "包裝說明", false, "請輸入包裝說明")); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "包裝說明", false, "請輸入包裝說明"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材編號", false, "請輸入食材編號")); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "食材編號", false, "請輸入食材編號"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "單價($)", false, "請輸入單價,保留2位小數", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 9), new DecimalDigitsInputFilter(context, 2)}, InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "單價($)", false, "請輸入單價,保留2位小數", new InputFilter[]{InputFilterUtils.getLengthFilter(context, 9), new DecimalDigitsInputFilter(context, 2)}, InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL));
...@@ -224,7 +224,11 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -224,7 +224,11 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
//包裝描述 //包裝描述
infoMultiBeans.get(packingDescriptionIndex).setShowValue(purchaseFoodBean.getPackingDescription()); infoMultiBeans.get(packingDescriptionIndex).setShowValue(purchaseFoodBean.getPackingDescription());
//食品編號 //食品編號
infoMultiBeans.get(foodNoIndex).setShowValue(purchaseFoodBean.getFoodNo()); if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseFoodBean.getFoodNo())) {
MultiInputBean foodNoInputBean = (MultiInputBean) infoMultiBeans.get(foodNoIndex);
foodNoInputBean.setEdit(false);
foodNoInputBean.setShowValue(purchaseFoodBean.getFoodNo());
}
//單價 //單價
if (purchaseFoodBean.getUnitPrice() != null) { if (purchaseFoodBean.getUnitPrice() != null) {
infoMultiBeans.get(foodIngredientPriceIndex).setShowValue(purchaseFoodBean.getUnitPrice() + ""); infoMultiBeans.get(foodIngredientPriceIndex).setShowValue(purchaseFoodBean.getUnitPrice() + "");
...@@ -298,7 +302,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -298,7 +302,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
public void setCategoryInfo(List<SectionCheckItem> sectionCheckItems, List<InfoMultiBean> infoMultiBeans) { public void setCategoryInfo(List<SectionCheckItem> sectionCheckItems, List<InfoMultiBean> infoMultiBeans) {
StringBuilder categoryName = new StringBuilder(); StringBuilder categoryName = new StringBuilder();
if(categoryNames == null){ if (categoryNames == null) {
categoryNames = new ArrayList<>(); categoryNames = new ArrayList<>();
} }
categoryNames.clear(); categoryNames.clear();
...@@ -314,6 +318,10 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -314,6 +318,10 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
mRootView.refreshAdapterByPosition(foodIngredientCategoryIndex); mRootView.refreshAdapterByPosition(foodIngredientCategoryIndex);
} }
/**
* 上傳圖片
* @param filePath 圖片路徑
*/
public void uploadPic(String filePath) { public void uploadPic(String filePath) {
File file = new File(BitmapUtil.compressImage(filePath)); File file = new File(BitmapUtil.compressImage(filePath));
List<MultipartBody.Part> multipartBodies = new ArrayList<>(); List<MultipartBody.Part> multipartBodies = new ArrayList<>();
...@@ -408,6 +416,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient ...@@ -408,6 +416,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
msg = "請輸入食材名稱"; msg = "請輸入食材名稱";
} else if (TextUtil.isEmptyOrNullOrUndefined(categoryName)) { } else if (TextUtil.isEmptyOrNullOrUndefined(categoryName)) {
msg = "請選擇食材類別"; msg = "請選擇食材類別";
} else if (TextUtil.isEmptyOrNullOrUndefined(infoMultiBeans.get(basicUnitIndex).getShowValue())) {
msg = "請選擇基本單位";
} }
return msg; return msg;
} }
......
...@@ -3,7 +3,10 @@ package com.gingersoft.supply_chain.mvp.presenter; ...@@ -3,7 +3,10 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application; import android.app.Application;
import android.content.Context; import android.content.Context;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.InputType;
import android.view.View;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.constans.AppConstans; import com.gingersoft.gsa.cloud.common.constans.AppConstans;
...@@ -20,6 +23,7 @@ import com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter; ...@@ -20,6 +23,7 @@ import com.gingersoft.gsa.cloud.ui.adapter.multi.InfoMultiAdapter;
import com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider; import com.gingersoft.gsa.cloud.ui.adapter.multi.RemarkProvider;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean; import com.gingersoft.supply_chain.mvp.bean.SupplierInfoBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract; import com.gingersoft.supply_chain.mvp.contract.NewSupplierContract;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
...@@ -29,8 +33,10 @@ import com.jess.arms.utils.EnAndNumInputFilter; ...@@ -29,8 +33,10 @@ import com.jess.arms.utils.EnAndNumInputFilter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -121,7 +127,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -121,7 +127,7 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE)); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_LINE));
infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "基本信息")); infoMultiBeans.add(new InfoMultiBean(InfoMultiBean.ITEM_TYPE_TITLE, "基本信息"));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "供應商編號", false, "請輸入編號", new InputFilter[]{new InputFilter.LengthFilter(11), new EnAndNumInputFilter()})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "供應商編號", false, "請輸入編號", new InputFilter[]{new InputFilter.LengthFilter(11), new EnAndNumInputFilter()}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "名稱", true, "請輸入名稱", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, mSupplierNameChangeListener));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人", true, "請輸入聯繫人", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)})); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "詳細地址", true, "請輸入詳細地址", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}));
infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人電話", true, "請輸入聯繫人電話", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 11)}, EditorInfo.TYPE_CLASS_PHONE)); infoMultiBeans.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "聯繫人電話", true, "請輸入聯繫人電話", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 11)}, EditorInfo.TYPE_CLASS_PHONE));
...@@ -139,8 +145,9 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -139,8 +145,9 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
// childInfoMulti.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "Kakao Talk", false, "請輸入Kakao Talk")); // childInfoMulti.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "Kakao Talk", false, "請輸入Kakao Talk"));
// receivingMode.setInfoMultiBeans(childInfoMulti); // receivingMode.setInfoMultiBeans(childInfoMulti);
// infoMultiBeans.add(receivingMode); // infoMultiBeans.add(receivingMode);
MultiCheckInputBean emailInputBean = new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Email", false, "請輸入Email", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20)}, R.drawable.ic_email, false);
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Email", false, "請輸入Email", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20)}, R.drawable.ic_email, false)); emailInputBean.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
contactInfo.add(emailInputBean);
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WhatsApp", false, "請輸入WhatsApp", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_whatsapp, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WhatsApp", false, "請輸入WhatsApp", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_whatsapp, false));
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WeChat", false, "請輸入WeChat", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_wechat, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "WeChat", false, "請輸入WeChat", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_wechat, false));
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Line", false, "請輸入Line", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_line, false)); contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Line", false, "請輸入Line", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20), InputFilterUtils.getChAndEnAndNumInputFilter(mContext)}, R.drawable.ic_line, false));
...@@ -190,6 +197,62 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -190,6 +197,62 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
return infoMultiAdapter; return infoMultiAdapter;
} }
public View.OnFocusChangeListener mSupplierNameChangeListener = (v, hasFocus) -> {
if (v instanceof EditText) {
if (!hasFocus) {
EditText editText = (EditText) v;
if (TextUtil.isNotEmptyOrNullOrUndefined(editText)) {
if(TextUtil.isNotEmptyOrNullOrUndefined(supplierName)){
//當供應商名稱不為空時,是修改供應商
if(!editText.getText().toString().equals(supplierName)){
//輸入的供應商名稱和之前的名稱不相同,說明進行了修改,需要進行查詢
getSupplierInfo(editText, editText.getText().toString());
}
} else {
getSupplierInfo(editText, editText.getText().toString());
}
} else {
editText.setError("請輸入供應商名稱");
}
}
}
};
/**
* 獲取供應商聯繫方式
*
* @param supplierName 供應商名稱
*/
public void getSupplierInfo(EditText editText, String supplierName) {
Map<String, Object> map = new HashMap<>(3);
Constant.addRestaurantId(map);
Constant.addBrandId(map);
map.put("supplierName", supplierName);
mModel.getSupplierInfo(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> {
})
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {
})
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult.getData() != null) {
if (editText != null) {
editText.setError("供應商已存在,請重新輸入");
}
}
}
});
}
;
/** /**
* 修改供應商信息 * 修改供應商信息
*/ */
...@@ -232,6 +295,34 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode ...@@ -232,6 +295,34 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
} }
/** /**
* 刪除供應商信息
*/
public void deleteSupplier(int supplierId) {
mModel.deleteSupplier(supplierId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("保存中..."))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info != null) {
if (info.isSuccess()) {
mRootView.saveSuccess();
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} else {
mRootView.showMessage("保存失敗");
}
}
}
});
}
/**
* 獲取供應商聯繫方式 * 獲取供應商聯繫方式
* *
* @param supplierId * @param supplierId
......
...@@ -4,23 +4,28 @@ import android.app.Application; ...@@ -4,23 +4,28 @@ import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult; import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager; import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.view.BitmapUtil;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean; import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.gingersoft.supply_chain.mvp.bean.OrderWareHouseBean; import com.gingersoft.supply_chain.mvp.bean.OrderWareHouseBean;
import com.gingersoft.supply_chain.mvp.bean.WareHousingUnitBean; import com.gingersoft.supply_chain.mvp.bean.WareHousingUnitBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.jess.arms.integration.AppManager; import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope; import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader; import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler; import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber; import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -28,8 +33,13 @@ import javax.inject.Inject; ...@@ -28,8 +33,13 @@ import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract; import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import static com.gingersoft.supply_chain.mvp.content.Constant.GET_INFO_ERROR; import static com.gingersoft.supply_chain.mvp.content.Constant.GET_INFO_ERROR;
...@@ -61,6 +71,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -61,6 +71,10 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
AppManager mAppManager; AppManager mAppManager;
private int orderId; private int orderId;
/**
* 所上傳的圖片路徑集合
*/
private List<String> imgs;
@Inject @Inject
public OrderDetailsPresenter(OrderDetailsContract.Model model, OrderDetailsContract.View rootView) { public OrderDetailsPresenter(OrderDetailsContract.Model model, OrderDetailsContract.View rootView) {
...@@ -103,13 +117,18 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -103,13 +117,18 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
} }
} else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg()); mRootView.showMessage(baseResult.getErrMsg());
mRootView.killMyself();
} else { } else {
mRootView.showMessage(GET_INFO_ERROR); mRootView.showMessage(GET_INFO_ERROR);
mRootView.killMyself();
} }
} }
/** /**
* 將單價和 * 處理單位問題
* 未收過貨的單:顯示第一個副單位,用戶可切換副單位和主單位。副單位是 foodUnits集合
* 收過貨的單:不可操作單位,顯示入庫單位 purchaseWarehousingUnits
* showUnit 用於顯示的單位,進行收貨操作時傳遞給後台
*/ */
private void transformationWareHouse(PurchaseOrderDetailsBean orderDetailsBean) { private void transformationWareHouse(PurchaseOrderDetailsBean orderDetailsBean) {
List<PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean> purchaseOrderDetailsInfoVos = orderDetailsBean.getPurchaseOrderDetailsInfoVOS(); List<PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean> purchaseOrderDetailsInfoVos = orderDetailsBean.getPurchaseOrderDetailsInfoVOS();
...@@ -117,35 +136,54 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -117,35 +136,54 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
//遍歷訂單商品 //遍歷訂單商品
for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean purchaseOrderDetailsInfoVO : purchaseOrderDetailsInfoVos) { for (PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean purchaseOrderDetailsInfoVO : purchaseOrderDetailsInfoVos) {
purchaseOrderDetailsInfoVO.setOrderNo(orderDetailsBean.getOrderNo()); purchaseOrderDetailsInfoVO.setOrderNo(orderDetailsBean.getOrderNo());
List<DeputyUnitBean> deputyUnitBeans = new ArrayList<>(); //單位
double warehousingAmount = 0; List<DeputyUnitBean> deputyUnitBeans = purchaseOrderDetailsInfoVO.getFoodUnits();
//計算出當前食材總金額
double warehousingAmount = MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVO.getFoodPrice(), purchaseOrderDetailsInfoVO.getFoodQuantity());
//待收貨的
if (purchaseOrderDetailsInfoVO.getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) { if (purchaseOrderDetailsInfoVO.getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
//只要是待收貨的商品,都需要添加單價、主單位到副單位列表 //副單位為空,設置顯示主單位
deputyUnitBeans.add(new DeputyUnitBean("單價(HKD)", purchaseOrderDetailsInfoVO.getFoodPrice())); if (deputyUnitBeans == null) {
if (TextUtil.isNotEmptyOrNullOrUndefined(purchaseOrderDetailsInfoVO.getBasicUnitName())) { deputyUnitBeans = new ArrayList<>();
deputyUnitBeans.add(new DeputyUnitBean(purchaseOrderDetailsInfoVO.getBasicUnitName(), purchaseOrderDetailsInfoVO.getFoodQuantity())); //添加主單位到副單位列表,用戶可手動切換
DeputyUnitBean deputyUnitBean = new DeputyUnitBean(purchaseOrderDetailsInfoVO.getBasicUnitName(), purchaseOrderDetailsInfoVO.getFoodQuantity());
deputyUnitBean.setDeputyValue(purchaseOrderDetailsInfoVO.getFoodQuantity());
deputyUnitBean.setUnitPrice(purchaseOrderDetailsInfoVO.getFoodPrice());
deputyUnitBeans.add(deputyUnitBean);
//设置显示的单位為主單位
purchaseOrderDetailsInfoVO.setShowUnit(deputyUnitBeans.get(0));
purchaseOrderDetailsInfoVO.setFoodUnits(deputyUnitBeans);
} else {
//设置显示的单位為第一個副單位
DeputyUnitBean deputyUnitBean = purchaseOrderDetailsInfoVO.getFoodUnits().get(0);
deputyUnitBean.setDeputyValue(purchaseOrderDetailsInfoVO.getFoodQuantity());
deputyUnitBean.setUnitPrice(purchaseOrderDetailsInfoVO.getFoodPrice());
purchaseOrderDetailsInfoVO.setShowUnit(deputyUnitBean);
} }
warehousingAmount = MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVO.getFoodPrice(), purchaseOrderDetailsInfoVO.getFoodQuantity());
} else { } else {
//如果不是待收貨的商品,入庫金額和總金額由副單位第一個值和第二個值相乘 //如果不是待收貨的商品:部分收貨和已完成,都不可再更改收貨單位,只顯示一個固定的單位
//UI要改,先不管 //拿到入庫的那個單位
WareHousingUnitBean wareHousingUnitBean = purchaseOrderDetailsInfoVO.getPurchaseWarehousingUnit();
if (wareHousingUnitBean != null) {
//只有一個入庫單位
DeputyUnitBean warehouseUnit = DeputyUnitBean.getDeputyUnitByWareHousingUnit(wareHousingUnitBean);
purchaseOrderDetailsInfoVO.setShowUnit(warehouseUnit);
purchaseOrderDetailsInfoVO.setFoodUnits(Collections.singletonList(warehouseUnit));
}
} }
purchaseOrderDetailsInfoVO.setWarehousingAmount(warehousingAmount); purchaseOrderDetailsInfoVO.setWarehousingAmount(warehousingAmount);
purchaseOrderDetailsInfoVO.setTotalAmount(MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVO.getFoodPrice(), purchaseOrderDetailsInfoVO.getFoodQuantity())); purchaseOrderDetailsInfoVO.setTotalAmount(MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVO.getFoodPrice(), purchaseOrderDetailsInfoVO.getFoodQuantity()));
if (purchaseOrderDetailsInfoVO.getFoodUnits() != null) {
deputyUnitBeans.addAll(purchaseOrderDetailsInfoVO.getFoodUnits());
}
if (purchaseOrderDetailsInfoVO.getPurchaseWarehousingUnits() != null) {
//入庫單位不為空,將入庫單位轉為副單位,添加到副單位集合裡去,進行顯示
for (WareHousingUnitBean purchaseWarehousingUnit : purchaseOrderDetailsInfoVO.getPurchaseWarehousingUnits()) {
deputyUnitBeans.add(DeputyUnitBean.getDeputyUnitByWareHousingUnit(purchaseWarehousingUnit));
} }
} }
purchaseOrderDetailsInfoVO.setFoodUnits(deputyUnitBeans);
}
} }
@Override
public void onError(Throwable t) {
super.onError(t);
mRootView.showMessage(GET_INFO_ERROR);
mRootView.killMyself();
} }
}); });
} }
...@@ -153,15 +191,14 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -153,15 +191,14 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
/** /**
* 入庫 * 入庫
* *
* @param state 入庫單的狀態 * @param state 入庫狀態
* @param files 上傳的文件
* @param remark 備註 * @param remark 備註
* @param totalAmount 總金額 * @param totalAmount 總金額
* @param purchaseOrderDetailsInfoVosBeans 選中的食品 * @param purchaseOrderDetailsInfoVosBeans 選中的食品
*/ */
public void addWarehouse(int state, String files, String remark, double totalAmount, List<PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean> purchaseOrderDetailsInfoVosBeans) { public void addWarehouse(int state, String remark, double totalAmount, List<PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean> purchaseOrderDetailsInfoVosBeans) {
List<OrderWareHouseBean.PurchaseWarehousingOrderDetail> purchaseWarehousingOrderDetails = transformWareHoses(purchaseOrderDetailsInfoVosBeans); List<OrderWareHouseBean.PurchaseWarehousingOrderDetail> purchaseWarehousingOrderDetails = transformWareHoses(purchaseOrderDetailsInfoVosBeans);
OrderWareHouseBean wareHouseBean = getWareHouseBean(state, files, remark, totalAmount, purchaseWarehousingOrderDetails); OrderWareHouseBean wareHouseBean = getWareHouseBean(state, remark, totalAmount, purchaseWarehousingOrderDetails);
if (wareHouseBean == null) { if (wareHouseBean == null) {
return; return;
} }
...@@ -191,7 +228,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -191,7 +228,7 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
/** /**
* 生成入庫對象 * 生成入庫對象
*/ */
private OrderWareHouseBean getWareHouseBean(int state, String files, String remark, double totalAmount, List<OrderWareHouseBean.PurchaseWarehousingOrderDetail> purchaseWarehousingOrderDetails) { private OrderWareHouseBean getWareHouseBean(int state, String remark, double totalAmount, List<OrderWareHouseBean.PurchaseWarehousingOrderDetail> purchaseWarehousingOrderDetails) {
if (purchaseWarehousingOrderDetails == null) { if (purchaseWarehousingOrderDetails == null) {
return null; return null;
} }
...@@ -200,9 +237,16 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -200,9 +237,16 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
orderWareHouseBean.setOrderId(orderId); orderWareHouseBean.setOrderId(orderId);
OrderWareHouseBean.PurchaseWarehousingOrder purchaseWarehousingOrder = new OrderWareHouseBean.PurchaseWarehousingOrder(); OrderWareHouseBean.PurchaseWarehousingOrder purchaseWarehousingOrder = new OrderWareHouseBean.PurchaseWarehousingOrder();
if (imgs != null) {
StringBuilder files = new StringBuilder();
for (String img : imgs) {
files.append(img).append(",");
}
String substring = files.substring(0, files.length());
purchaseWarehousingOrder.setFiles(substring);
}
purchaseWarehousingOrder.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); purchaseWarehousingOrder.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId());
purchaseWarehousingOrder.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); purchaseWarehousingOrder.setBrandId(RestaurantInfoManager.newInstance().getBrandId());
purchaseWarehousingOrder.setFiles(files);
purchaseWarehousingOrder.setRemarks(remark); purchaseWarehousingOrder.setRemarks(remark);
purchaseWarehousingOrder.setTotalPrice(totalAmount); purchaseWarehousingOrder.setTotalPrice(totalAmount);
orderWareHouseBean.setPurchaseWarehousingOrder(purchaseWarehousingOrder); orderWareHouseBean.setPurchaseWarehousingOrder(purchaseWarehousingOrder);
...@@ -227,28 +271,25 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -227,28 +271,25 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
purchaseWarehousingOrderDetail.setFoodQuantity(purchaseOrderDetailsInfoVosBean.getFoodQuantity()); purchaseWarehousingOrderDetail.setFoodQuantity(purchaseOrderDetailsInfoVosBean.getFoodQuantity());
purchaseWarehousingOrderDetail.setFoodPrice(purchaseOrderDetailsInfoVosBean.getFoodPrice()); purchaseWarehousingOrderDetail.setFoodPrice(purchaseOrderDetailsInfoVosBean.getFoodPrice());
purchaseWarehousingOrderDetail.setTotalPrice(MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVosBean.getFoodPrice(), purchaseOrderDetailsInfoVosBean.getFoodQuantity())); purchaseWarehousingOrderDetail.setTotalPrice(MoneyUtil.priceCalculation(purchaseOrderDetailsInfoVosBean.getFoodPrice(), purchaseOrderDetailsInfoVosBean.getFoodQuantity()));
List<DeputyUnitBean> deputyUnitBeans = purchaseOrderDetailsInfoVosBean.getFoodUnits(); // List<DeputyUnitBean> deputyUnitBeans = purchaseOrderDetailsInfoVosBean.getFoodUnits();
//將副單位轉為入庫用的副單位 //將副單位轉為入庫用的副單位
if (deputyUnitBeans != null && deputyUnitBeans.size() > 1) { // if (deputyUnitBeans != null && deputyUnitBeans.size() > 1) {
//主單位名稱 // //主單位名稱
purchaseWarehousingOrderDetail.setBasicUnitName(deputyUnitBeans.get(1).getDeputyUnit()); // purchaseWarehousingOrderDetail.setBasicUnitName(deputyUnitBeans.get(1).getDeputyUnit());
//主單位數量 // //主單位數量
purchaseWarehousingOrderDetail.setBasicUnitValue(deputyUnitBeans.get(1).getDeputyValue()); // purchaseWarehousingOrderDetail.setBasicUnitValue(deputyUnitBeans.get(1).getDeputyValue());
//統計副單位 // //統計副單位
List<WareHousingUnitBean> wareHousingUnitBeans = new ArrayList<>(); // List<WareHousingUnitBean> wareHousingUnitBeans = new ArrayList<>();
for (int i = 0; i < deputyUnitBeans.size(); i++) { // for (int i = 0; i < deputyUnitBeans.size(); i++) {
DeputyUnitBean deputyUnitBean = deputyUnitBeans.get(i); DeputyUnitBean deputyUnitBean = purchaseOrderDetailsInfoVosBean.getShowUnit();
WareHousingUnitBean wareHousingUnitBean = new WareHousingUnitBean(purchaseOrderDetailsInfoVosBean.getId(), deputyUnitBean.getDeputyUnit(), deputyUnitBean.getDeputyValue(), deputyUnitBean.getConversionMultiple()); WareHousingUnitBean wareHousingUnitBean = DeputyUnitBean.getWareHousingUnitByDeputyUnit(deputyUnitBean);
if (deputyUnitBean.getId() != null) { if (purchaseOrderDetailsInfoVosBean.getStatus() != PurchaseOrderDetailsBean.WAIT_RECEIVED && deputyUnitBean.getId() != null) {
//不是待收貨狀態才設置id,因為如果已經收過貨才有id
wareHousingUnitBean.setId(deputyUnitBean.getId()); wareHousingUnitBean.setId(deputyUnitBean.getId());
} }
wareHousingUnitBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId()); wareHousingUnitBean.setBrandId(RestaurantInfoManager.newInstance().getBrandId());
wareHousingUnitBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId()); wareHousingUnitBean.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId());
wareHousingUnitBeans.add(wareHousingUnitBean); purchaseWarehousingOrderDetail.setPurchaseWarehousingUnit(wareHousingUnitBean);
}
purchaseWarehousingOrderDetail.setPurchaseWarehousingUnits(wareHousingUnitBeans);
}
purchaseWarehousingOrderDetails.add(purchaseWarehousingOrderDetail); purchaseWarehousingOrderDetails.add(purchaseWarehousingOrderDetail);
} }
} }
...@@ -259,4 +300,79 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo ...@@ -259,4 +300,79 @@ public class OrderDetailsPresenter extends BasePresenter<OrderDetailsContract.Mo
return purchaseWarehousingOrderDetails; return purchaseWarehousingOrderDetails;
} }
/**
* 刪除訂單
*/
public void deleteOrder() {
mModel.deleteOrder(orderId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(@NonNull BaseResult info) {
if (info.isSuccess()) {
mRootView.showMessage(Constant.DELETE_SUCCESS);
mRootView.killMyself();
}
}
});
}
/**
* 上傳圖片
*
* @param filePath 圖片路徑
*/
public void uploadPic(String filePath) {
File file = new File(BitmapUtil.compressImage(filePath));
List<MultipartBody.Part> multipartBodies = new ArrayList<>();
multipartBodies.add(MultipartBody.Part.createFormData("files", file.getName(), RequestBody.create(MediaType.parse("image/png"), file)));
Map<String, Object> map = new HashMap<>(1);
map.put("type", Constant.UPLOAD_PIC_TYPE_ORDER);
mModel.upLoadPic(multipartBodies, map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.IMG_UPLOAD_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess() && baseResult.getData() != null) {
List<String> imgUrl = JsonUtils.parseArray(baseResult.getData(), String.class);
if (imgUrl != null && imgUrl.size() > 0) {
String picUrl = imgUrl.get(0);
if (imgs == null) {
imgs = new ArrayList<>();
}
imgs.add(picUrl);
mRootView.uploadPicSuccess(picUrl);
}
}
boolean delete = file.delete();
}
});
}
public void deletePic(int position) {
if (imgs != null && position < imgs.size()) {
imgs.remove(position);
}
}
public String getPic(int position) {
if (imgs != null && position < imgs.size()) {
return imgs.get(position);
}
return null;
}
public int getPicSize() {
return imgs == null ? 0 : imgs.size();
}
} }
...@@ -118,13 +118,15 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo ...@@ -118,13 +118,15 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
}); });
} }
/**
public void deleteOrder(int position, OrderBean orderBean) { * 刪除訂單
orderBean.setDeletes(Constant.DELETE); * @param position 訂單下標
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(orderBean)); * @param orderId 訂單id
mModel.updateOrder(requestBody) */
public void deleteOrder(int position, int orderId) {
mModel.deleteOrder(orderId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中...")) .doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
......
...@@ -9,6 +9,7 @@ import com.gingersoft.gsa.cloud.common.utils.JsonUtils; ...@@ -9,6 +9,7 @@ import com.gingersoft.gsa.cloud.common.utils.JsonUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils; import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean; import com.gingersoft.supply_chain.mvp.bean.ConfirmOrderBean;
import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean; import com.gingersoft.supply_chain.mvp.bean.NewPurchaseOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
...@@ -21,6 +22,7 @@ import com.jess.arms.integration.AppManager; ...@@ -21,6 +22,7 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils; import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -88,6 +90,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -88,6 +90,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
int totalTypeNumber = 0; int totalTypeNumber = 0;
getFoodsBySupplierGrouping(listMap); getFoodsBySupplierGrouping(listMap);
shoppingCartBeans = new ArrayList<>(); shoppingCartBeans = new ArrayList<>();
//創建訂單按鈕是否可點擊,只要有供應商不滿足最低採購,就不能點擊
boolean createBtnCheckable = true;
//將裝有不同供應商和供應商食品的map轉換為用於顯示的集合數據 //將裝有不同供應商和供應商食品的map轉換為用於顯示的集合數據
for (Map.Entry<Integer, List<PurchaseFoodBean>> entry : listMap.entrySet()) { for (Map.Entry<Integer, List<PurchaseFoodBean>> entry : listMap.entrySet()) {
ShoppingCartBean shoppingCartBean = new ShoppingCartBean(); ShoppingCartBean shoppingCartBean = new ShoppingCartBean();
...@@ -112,6 +116,11 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -112,6 +116,11 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
shoppingCartBean.setAllSelect(false); shoppingCartBean.setAllSelect(false);
} }
} }
if (MoneyUtil.compareTo(shoppingCartBean.getMinimumAmount(), supplierTotalAmount) == 1) {
createBtnCheckable = false;
}
// shoppingCartBean.setShipping();運費
shoppingCartBean.setInitialShippingTime(TimeUtils.getNextDay(1));
shoppingCartBean.setSelectFoodAmount(supplierTotalAmount); shoppingCartBean.setSelectFoodAmount(supplierTotalAmount);
shoppingCartBean.setSelectSpeciesNum(supplierTotalSpecies); shoppingCartBean.setSelectSpeciesNum(supplierTotalSpecies);
//統計所有供應商的選中的食材的總金額 //統計所有供應商的選中的食材的總金額
...@@ -122,6 +131,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -122,6 +131,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
} }
shoppingCartBeans.add(shoppingCartBean); shoppingCartBeans.add(shoppingCartBean);
} }
mRootView.setCreateBtnState(createBtnCheckable);
mRootView.loadAdapter(shoppingCartBeans); mRootView.loadAdapter(shoppingCartBeans);
mRootView.setTotalInfo(totalTypeNumber, totalPrice); mRootView.setTotalInfo(totalTypeNumber, totalPrice);
} }
...@@ -250,12 +260,12 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -250,12 +260,12 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
/** /**
* 篩選出用戶選擇的要提交的食品數據 * 篩選出用戶選擇的要提交的食品數據
*/ */
public void filterData(List<ShoppingCartBean> shoppingCartBeans) { public boolean filterData(List<ShoppingCartBean> shoppingCartBeans) {
//判斷用戶是否擇了至少一個食品 //判斷用戶是否擇了至少一個食品
boolean isHasFood = false; boolean isHasFood = false;
if (shoppingCartBeans == null || shoppingCartBeans.size() <= 0) { if (shoppingCartBeans == null || shoppingCartBeans.size() <= 0) {
mRootView.showMessage("請添加食材"); mRootView.showMessage("請添加食材");
return; return false;
} }
for (ShoppingCartBean shoppingCartBean : shoppingCartBeans) { for (ShoppingCartBean shoppingCartBean : shoppingCartBeans) {
if (shoppingCartBean.isAllSelect()) { if (shoppingCartBean.isAllSelect()) {
...@@ -280,8 +290,12 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -280,8 +290,12 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
if (!isHasFood) { if (!isHasFood) {
//沒有食品,不允許提交訂單,提示用戶 //沒有食品,不允許提交訂單,提示用戶
mRootView.showMessage("請選擇採購食品"); mRootView.showMessage("請選擇採購食品");
return; return false;
}
return true;
} }
public void createOrder(List<ShoppingCartBean> shoppingCartBeans) {
//將供應商和食材信息轉換為提交訂單的數據 //將供應商和食材信息轉換為提交訂單的數據
List<ConfirmOrderBean> confirmOrderBeanList = new ArrayList<>(); List<ConfirmOrderBean> confirmOrderBeanList = new ArrayList<>();
for (int i = 0; i < shoppingCartBeans.size(); i++) { for (int i = 0; i < shoppingCartBeans.size(); i++) {
...@@ -309,7 +323,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -309,7 +323,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
return; return;
} }
//配置訂單信息 //配置訂單信息
confirmOrderBean.setPurchaseOrder(ConfirmOrderBean.conversionPurchaseOrder(shoppingCartBean.getSupplierId(), shoppingCartBean.getSupplierName(), totalAmount)); confirmOrderBean.setPurchaseOrder(ConfirmOrderBean.conversionPurchaseOrder(shoppingCartBean, totalAmount));
confirmOrderBean.setMinimumAmount(shoppingCartBean.getMinimumAmount()); confirmOrderBean.setMinimumAmount(shoppingCartBean.getMinimumAmount());
confirmOrderBeanList.add(confirmOrderBean); confirmOrderBeanList.add(confirmOrderBean);
} }
...@@ -317,6 +331,47 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -317,6 +331,47 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
addPurchaseOrder(confirmOrderBeanList); addPurchaseOrder(confirmOrderBeanList);
} }
private Disposable verificationDisposable;
/**
* 驗證最低採購金額是否都已經滿足
*/
public void verificationMixAmount(List<ShoppingCartBean> shoppingCartBeans) {
if (verificationDisposable != null) {
verificationDisposable.dispose();
}
verificationDisposable = RxJavaUtils.executeAsyncTask(new RxAsyncTask<Object, Boolean>(1) {
@Override
public Boolean doInIOThread(Object o) {
for (int i = 0; i < shoppingCartBeans.size(); i++) {
ShoppingCartBean shoppingCartBean = shoppingCartBeans.get(i);
//判斷選中了多少個商品,如果這個供應商的食品一個都沒被選中,就不用管
if (shoppingCartBean.getSelectSpeciesNum() > 0) {
//計算已選中食品的總金額
double totalAmount = 0;
for (PurchaseFoodBean purchaseFoodBean : shoppingCartBean.getFoodList()) {
if (purchaseFoodBean.isChecked()) {
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(purchaseFoodBean.getUnitPrice(), purchaseFoodBean.getFoodQuantity()));
}
}
//判斷總金額是否滿足最低採購金額
if (MoneyUtil.compareTo(totalAmount, shoppingCartBean.getMinimumAmount()) == -1) {
//不滿足最低採購金額
return false;
}
}
}
return true;
}
@Override
public void doInUIThread(Boolean o) {
mRootView.setCreateBtnState(o);
}
});
}
public void addPurchaseOrder(List<ConfirmOrderBean> confirmOrderBeans) { public void addPurchaseOrder(List<ConfirmOrderBean> confirmOrderBeans) {
if (confirmOrderBeans == null) { if (confirmOrderBeans == null) {
mRootView.showMessage("訂單計算出錯,請退出重試"); mRootView.showMessage("訂單計算出錯,請退出重試");
...@@ -333,7 +388,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode ...@@ -333,7 +388,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
@Override @Override
public void onNext(BaseResult baseResult) { public void onNext(BaseResult baseResult) {
if (baseResult.isSuccess()) { if (baseResult.isSuccess()) {
List<ConfirmOrderBean> confirmOrderBeanList = GsonUtils.jsonToList(baseResult.getData().toString(), ConfirmOrderBean.class); List<ConfirmOrderBean> confirmOrderBeanList = GsonUtils.jsonToList(GsonUtils.GsonString(baseResult.getData()), ConfirmOrderBean.class);
List<ConfirmOrderBean.PurchaseOrder> purchaseOrders = new ArrayList<>(); List<ConfirmOrderBean.PurchaseOrder> purchaseOrders = new ArrayList<>();
for (ConfirmOrderBean confirmOrderBean : confirmOrderBeanList) { for (ConfirmOrderBean confirmOrderBean : confirmOrderBeanList) {
for (ConfirmOrderBean confirmOrderBean1 : confirmOrderBeans) { for (ConfirmOrderBean confirmOrderBean1 : confirmOrderBeans) {
......
...@@ -162,14 +162,15 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo ...@@ -162,14 +162,15 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
}); });
} }
public void deleteSupplier(SupplierInfoBean supplierBean, int position) { /**
supplierBean.setDeletes(1); * 刪除供應商
supplierBean.setSupplierName(null); * @param id 供應商id
supplierBean.setSupplierNo(null); * @param position 所刪除的供應商下標
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(supplierBean)); */
mModel.updateSupplier(requestBody) public void deleteSupplier(int id, int position) {
mModel.deleteSupplier(id)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("刪除中...")) .doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread()) .subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading()) .doAfterTerminate(() -> mRootView.hideLoading())
...@@ -184,7 +185,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo ...@@ -184,7 +185,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) { } else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg()); mRootView.showMessage(info.getErrMsg());
} else { } else {
mRootView.showMessage("保存失敗"); mRootView.showMessage(Constant.DELETE_FAIL);
} }
} }
} }
......
package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.utils.gson.GsonUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.content.Constant;
import com.google.gson.Gson;
import com.jess.arms.integration.AppManager;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.http.imageloader.ImageLoader;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.HashMap;
import java.util.Map;
/**
* ================================================
* Description:
* <p>
* Created by MVPArmsTemplate on 01/21/2021 10:15
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
* <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
@FragmentScope
public class WarehouseDetailsPresenter extends BasePresenter<WarehouseDetailsContract.Model, WarehouseDetailsContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
Application mApplication;
@Inject
ImageLoader mImageLoader;
@Inject
AppManager mAppManager;
@Inject
public WarehouseDetailsPresenter(WarehouseDetailsContract.Model model, WarehouseDetailsContract.View rootView) {
super(model, rootView);
}
@Override
public void onDestroy() {
super.onDestroy();
this.mErrorHandler = null;
this.mAppManager = null;
this.mImageLoader = null;
this.mApplication = null;
}
public void getWarehousingOrderDetails(int foodId, String basicUnitName) {
Map<String, Object> map = new HashMap<>(4);
Constant.addBrandId(map);
Constant.addRestaurantId(map);
map.put("id", foodId);
map.put("basicUnitName", basicUnitName);
mModel.getWarehousingOrderDetails(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) {
WarehouseDetailsBean warehouseDetailsBean = GsonUtils.GsonToBean(baseResult.getData(), WarehouseDetailsBean.class);
mRootView.loadWarehousing(warehouseDetailsBean);
} else if(baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage(Constant.GET_INFO_ERROR);
}
}
});
}
/**
* 獲取庫存消耗原因
*/
public void getWarehouseInventoryReason(){
mModel.getWarehouseInventoryReason()
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
.compose(RxLifecycleUtils.bindToLifecycle(mRootView))
.subscribe(new ErrorHandleSubscriber<BaseResult>(mErrorHandler) {
@Override
public void onNext(BaseResult baseResult) {
if (baseResult != null && baseResult.isSuccess()) {
} else if(baseResult != null && TextUtil.isNotEmptyOrNullOrUndefined(baseResult.getErrMsg())) {
mRootView.showMessage(baseResult.getErrMsg());
} else {
mRootView.showMessage(Constant.GET_INFO_ERROR);
}
}
});
}
}
...@@ -11,14 +11,14 @@ import me.jessyan.rxerrorhandler.core.RxErrorHandler; ...@@ -11,14 +11,14 @@ import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract; import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
/** /**
* ================================================ * ================================================
* Description: * Description:
* <p> * <p>
* Created by MVPArmsTemplate on 01/12/2021 14:28 * Created by MVPArmsTemplate on 01/22/2021 15:10
* <a href="mailto:jess.yan.effort@gmail.com">Contact me</a> * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
* <a href="https://github.com/JessYanCoding">Follow me</a> * <a href="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a> * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
...@@ -27,7 +27,7 @@ import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract; ...@@ -27,7 +27,7 @@ import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
* ================================================ * ================================================
*/ */
@FragmentScope @FragmentScope
public class WareHousingDetailsPresenter extends BasePresenter<WareHousingDetailsContract.Model, WareHousingDetailsContract.View> { public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInventoryContract.Model, WarehousingInventoryContract.View> {
@Inject @Inject
RxErrorHandler mErrorHandler; RxErrorHandler mErrorHandler;
@Inject @Inject
...@@ -38,7 +38,7 @@ public class WareHousingDetailsPresenter extends BasePresenter<WareHousingDetail ...@@ -38,7 +38,7 @@ public class WareHousingDetailsPresenter extends BasePresenter<WareHousingDetail
AppManager mAppManager; AppManager mAppManager;
@Inject @Inject
public WareHousingDetailsPresenter(WareHousingDetailsContract.Model model, WareHousingDetailsContract.View rootView) { public WarehousingInventoryPresenter(WarehousingInventoryContract.Model model, WarehousingInventoryContract.View rootView) {
super(model, rootView); super(model, rootView);
} }
......
...@@ -69,6 +69,26 @@ public interface SupplierServer { ...@@ -69,6 +69,26 @@ public interface SupplierServer {
Observable<BaseResult> updateSupplier(@Body RequestBody requestBody); Observable<BaseResult> updateSupplier(@Body RequestBody requestBody);
/** /**
* 供應商刪除
*
* @param id 供應商id
*/
@FormUrlEncoded
@Headers({"Domain-Name: ricepon-purchase"})
@POST("supplier/delete" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> deleteSupplier(@Field("id") int id);
/**
* 獲取供應商信息
*
* @return
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("supplier/name/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getSupplierInfo(@QueryMap Map<String, Object> map);
/**
* 獲取供應商聯繫方式 * 獲取供應商聯繫方式
* *
* @param supplierId * @param supplierId
...@@ -153,6 +173,16 @@ public interface SupplierServer { ...@@ -153,6 +173,16 @@ public interface SupplierServer {
Observable<BaseResult> updateFoodCategory(@Body RequestBody requestBody); Observable<BaseResult> updateFoodCategory(@Body RequestBody requestBody);
/** /**
* 刪除分類
*
* @param requestBody
* @return
*/
@Headers({"Domain-Name: ricepon-purchase"})
@POST("foodCategory/delete" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> deleteFoodCategory(@Body RequestBody requestBody);
/**
* 上傳圖片 * 上傳圖片
* *
* @param parts * @param parts
...@@ -242,6 +272,16 @@ public interface SupplierServer { ...@@ -242,6 +272,16 @@ public interface SupplierServer {
Observable<BaseResult> updateOrder(@Body RequestBody requestBody); Observable<BaseResult> updateOrder(@Body RequestBody requestBody);
/** /**
* 修改採購單信息
* @param orderId 訂單id
* @return
*/
@FormUrlEncoded
@Headers({"Domain-Name: ricepon-purchase"})
@POST("purchaseOrder/delete" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> deleteOrder(@Field("id") int orderId);
/**
* 獲取下單頁面的分類結構 * 獲取下單頁面的分類結構
* *
* @param map * @param map
...@@ -353,4 +393,20 @@ public interface SupplierServer { ...@@ -353,4 +393,20 @@ public interface SupplierServer {
@POST("basicUnitType/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2) @POST("basicUnitType/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> addDeputyUnitInput(@Body RequestBody requestBody); Observable<BaseResult> addDeputyUnitInput(@Body RequestBody requestBody);
/**
* 查詢入庫流水
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseWarehousingOrder/details/get" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getWarehousingOrderDetails(@QueryMap Map<String, Object> map);
/**
* 查詢庫存消耗原因
*/
@Headers({"Domain-Name: ricepon-purchase"})
@GET("purchaseConsumeReason/list" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
Observable<BaseResult> getWarehouseInventoryReason();
} }
...@@ -31,7 +31,7 @@ public class ConfirmOrderAdapter extends BaseQuickAdapter<ConfirmOrderBean, Base ...@@ -31,7 +31,7 @@ public class ConfirmOrderAdapter extends BaseQuickAdapter<ConfirmOrderBean, Base
holder.setText(R.id.tv_confirm_order_item_supplier_name, purchaseOrder.getSupplierName()); holder.setText(R.id.tv_confirm_order_item_supplier_name, purchaseOrder.getSupplierName());
holder.setText(R.id.tv_confirm_order_item_supplier_address, purchaseOrder.getSendingAddress()); holder.setText(R.id.tv_confirm_order_item_supplier_address, purchaseOrder.getSendingAddress());
holder.setText(R.id.tv_confirm_order_item_send_time, TimeUtils.getStringByFormat(purchaseOrder.getInitialShippingTime(), TimeUtils.DEFAULT_DATE_FORMAT_YMDHM)); holder.setText(R.id.tv_confirm_order_item_send_time, purchaseOrder.getInitialShippingTime());
holder.setText(R.id.tv_confirm_order_item_total_amount, purchaseOrder.getTotalAmount() + ""); holder.setText(R.id.tv_confirm_order_item_total_amount, purchaseOrder.getTotalAmount() + "");
holder.setText(R.id.tv_confirm_order_item_freight, purchaseOrder.getShipping() + ""); holder.setText(R.id.tv_confirm_order_item_freight, purchaseOrder.getShipping() + "");
holder.setText(R.id.tv_confirm_order_item_pay_amount, purchaseOrder.getActualPayment() + ""); holder.setText(R.id.tv_confirm_order_item_pay_amount, purchaseOrder.getActualPayment() + "");
......
...@@ -3,6 +3,8 @@ package com.gingersoft.supply_chain.mvp.ui.adapter; ...@@ -3,6 +3,8 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -194,6 +196,23 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView ...@@ -194,6 +196,23 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
mTvTotalAmount.setText(String.format(moneyString, MoneyUtil.formatDouble(MoneyUtil.priceCalculation(foodInfoBean.getUnitPrice(), foodInfoBean.getFoodQuantity())))); mTvTotalAmount.setText(String.format(moneyString, MoneyUtil.formatDouble(MoneyUtil.priceCalculation(foodInfoBean.getUnitPrice(), foodInfoBean.getFoodQuantity()))));
} }
}); });
//食材減少按鈕長按
viewHolder.getView(R.id.btn_food_operation_sub).setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Log.e("eee", "長按:" + System.currentTimeMillis());
return false;
}
});
//食材增加按鈕長按
viewHolder.getView(R.id.btn_food_operation_add).setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Log.e("eee", "長按:" + System.currentTimeMillis());
return false;
}
});
//手動輸入食材數量變化監聽 //手動輸入食材數量變化監聽
TextWatcher foodNumTextWatcher = new TextWatcher() { TextWatcher foodNumTextWatcher = new TextWatcher() {
@Override @Override
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.supply_chain.R;
import org.jetbrains.annotations.NotNull;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/22
* Time: 20:28
* Use:
*/
public class ImageAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
public ImageAdapter() {
super(R.layout.item_image);
addChildClickViewIds(R.id.iv_img, R.id.iv_img_delete);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, String s) {
GlideUtils.display(getContext(), viewHolder.getView(R.id.iv_img), s);
}
}
...@@ -5,14 +5,20 @@ import android.text.Editable; ...@@ -5,14 +5,20 @@ import android.text.Editable;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.View; import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.MoneyInputFilter; import com.gingersoft.gsa.cloud.common.utils.inputFilter.MoneyInputFilter;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
...@@ -43,6 +49,11 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai ...@@ -43,6 +49,11 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
private Context context; private Context context;
private OnValueChangeListener onValueChangeListener; private OnValueChangeListener onValueChangeListener;
private String formatAmount;
private InputFilter[] inputFilters;
private int canEditColor;
private int notEditableColor;
public void setOnValueChangeListener(OnValueChangeListener onValueChangeListener) { public void setOnValueChangeListener(OnValueChangeListener onValueChangeListener) {
this.onValueChangeListener = onValueChangeListener; this.onValueChangeListener = onValueChangeListener;
...@@ -50,51 +61,132 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai ...@@ -50,51 +61,132 @@ public class OrderDetailsFoodAdapter extends BaseQuickAdapter<PurchaseOrderDetai
public OrderDetailsFoodAdapter(Context context, @Nullable List<PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean> data) { public OrderDetailsFoodAdapter(Context context, @Nullable List<PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean> data) {
super(R.layout.item_order_details_food, data); super(R.layout.item_order_details_food, data);
addChildClickViewIds(R.id.layout_order_details_unit);
this.context = context; this.context = context;
formatAmount = context.getString(R.string.amount_string);
inputFilters = new InputFilter[]{new MoneyInputFilter()};
canEditColor = ContextCompat.getColor(context, R.color.color_3c);
notEditableColor = ContextCompat.getColor(context, R.color.color_aaa);
} }
@Override @Override
protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean item) { protected void convert(@NotNull BaseViewHolder viewHolder, PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean item) {
viewHolder.setText(R.id.tv_order_no, item.getOrderNo() + ""); //食品編號
viewHolder.setText(R.id.tv_order_details_item_food_name, item.getName()); // viewHolder.setText(R.id.tv_order_no, item.getOrderNo() + "");
//食品名稱
viewHolder.setText(R.id.iv_order_details_item_food_select, item.getName());
//食品單位
viewHolder.setText(R.id.tv_order_details_item_purchasing_unit, item.getUnit_content()); viewHolder.setText(R.id.tv_order_details_item_purchasing_unit, item.getUnit_content());
viewHolder.setText(R.id.tv_order_details_item_purchasing_unit_price, "$" + item.getFoodPrice()); //已入庫數量
viewHolder.setText(R.id.tv_order_details_item_num, String.valueOf(item.getFoodQuantity())); viewHolder.setText(R.id.tv_order_details_item_warehouse_warehousing_num, String.valueOf(item.getWarehousingQuantity()));
//食品的收貨狀態
TextView tvFoodState = viewHolder.getView(R.id.tv_order_details_state);
tvFoodState.setText(PurchaseOrderDetailsBean.getStringByOrderState(item.getStatus()));
tvFoodState.setTextColor(ContextCompat.getColor(context, PurchaseOrderDetailsBean.getColorByOrderState(item.getStatus())));
//單位的操作
RelativeLayout layoutUnit = viewHolder.getView(R.id.layout_order_details_unit);
TextView tvUnit = viewHolder.getView(R.id.tv_order_details_show_unit);
ImageView ivSwitchUnit = viewHolder.getView(R.id.iv_switch_unit);
if (item.getStatus() == PurchaseOrderDetailsBean.WAIT_RECEIVED) {
//待收貨
if (item.getFoodUnits() != null && item.getFoodUnits().size() > 1) {
//有其他單位
layoutUnit.setEnabled(true);
tvUnit.setTextColor(canEditColor);
ivSwitchUnit.setVisibility(View.VISIBLE);
} else {
//沒有其他單位
layoutUnit.setEnabled(false);
tvUnit.setTextColor(notEditableColor);
ivSwitchUnit.setVisibility(View.GONE);
}
} else {
//部分收貨或已收貨其他狀態,收貨單位不可切換
layoutUnit.setEnabled(false);
tvUnit.setTextColor(notEditableColor);
ivSwitchUnit.setVisibility(View.GONE);
}
//訂單食品數量
viewHolder.setText(R.id.tv_order_details_item_warehouse_num, String.valueOf(item.getFoodQuantity()));
//食品的總價 //食品的總價
viewHolder.setText(R.id.tv_order_details_item_purchasing_total_amount, "$" + item.getTotalAmount()); viewHolder.setText(R.id.tv_order_details_item_warehouse_total_amount, String.format(formatAmount, item.getTotalAmount()));
//拿到單價 //實付
// double unitPrice = Integer.parseInt(item.getWareHouseBeans().get(0).getValue()); viewHolder.setText(R.id.tv_order_details_item_warehouse_actual_amount, String.format(formatAmount, item.getTotalAmount()));
//拿到數量 if (item.getShowUnit() != null) {
// double foodQuantity = Integer.parseInt(item.getWareHouseBeans().get(1).getValue()); viewHolder.setText(R.id.tv_order_details_show_unit, item.getShowUnit().getDeputyUnit());
//設置入庫總價,總價是由用戶輸入的單價*基本單位數 } else {
viewHolder.setText(R.id.tv_order_details_item_warehouse_total_amount, String.format(context.getString(R.string.amount_string_s), MoneyUtil.formatDouble(item.getWarehousingAmount()))); viewHolder.setText(R.id.tv_order_details_show_unit, "");
RecyclerView rvWarehouseUnit = viewHolder.getView(R.id.rv_warehouse_unit); }
if (item.getFoodUnits() != null) { //食品數量
rvWarehouseUnit.setVisibility(View.VISIBLE); EditText edFoodNum = viewHolder.getView(R.id.ed_food_num);
rvWarehouseUnit.setLayoutManager(new GridLayoutManager(context, 3)); edFoodNum.setFilters(inputFilters);
WareHouseUnitAdapter wareHouseUnitAdapter = new WareHouseUnitAdapter(item.getFoodUnits(), viewHolder.getAdapterPosition(), (position, value) -> { edFoodNum.setText(String.valueOf(item.getShowUnit().getDeputyValue()));
PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean purchaseOrderDetailsInfoVosBean = getData().get(viewHolder.getAdapterPosition()); TextWatcher watcher = new TextWatcher() {
//獲取入庫單位集合,用第0位(單價)乘以第一位(主單位數量),得到現在的入庫價格 @Override
List<DeputyUnitBean> deputyUnitBeans = purchaseOrderDetailsInfoVosBean.getFoodUnits(); public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (deputyUnitBeans != null && deputyUnitBeans.size() > 1) {
double currentWareHouseAmount = MoneyUtil.priceCalculation(deputyUnitBeans.get(0).getDeputyValue(), deputyUnitBeans.get(1).getDeputyValue()); }
//現在的價格減去之前的價格,得到增加了多少
double changeAmount = MoneyUtil.sub(currentWareHouseAmount, purchaseOrderDetailsInfoVosBean.getWarehousingAmount()); @Override
if (purchaseOrderDetailsInfoVosBean.isChecked()) { public void onTextChanged(CharSequence s, int start, int before, int count) {
//调用接口,修改外部總金額
onValueChangeListener.onValueChange(position, changeAmount); }
}
//保存最新的金額數據 @Override
purchaseOrderDetailsInfoVosBean.setWarehousingAmount(currentWareHouseAmount); public void afterTextChanged(Editable s) {
viewHolder.setText(R.id.tv_order_details_item_warehouse_total_amount, currentWareHouseAmount + ""); DeputyUnitBean showUnit = getItem(viewHolder.getAdapterPosition()).getShowUnit();
if (TextUtil.isNotEmptyOrNullOrUndefined(s + "")) {
showUnit.setDeputyValue(Double.parseDouble(s.toString()));
} else {
showUnit.setDeputyValue(0);
}
}
};
edFoodNum.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
edFoodNum.addTextChangedListener(watcher);
} else {
edFoodNum.removeTextChangedListener(watcher);
} }
}); });
rvWarehouseUnit.setAdapter(wareHouseUnitAdapter); //食品單價
EditText edUnitPrice = viewHolder.getView(R.id.ed_food_unit_price);
edUnitPrice.setFilters(inputFilters);
edUnitPrice.setText(String.valueOf(item.getShowUnit().getUnitPrice()));
TextWatcher unitPriceWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
DeputyUnitBean showUnit = getItem(viewHolder.getAdapterPosition()).getShowUnit();
if (TextUtil.isNotEmptyOrNullOrUndefined(s + "")) {
showUnit.setUnitPrice(Double.parseDouble(s.toString()));
} else { } else {
rvWarehouseUnit.setVisibility(View.GONE); showUnit.setUnitPrice(0);
} }
}
};
edUnitPrice.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
edUnitPrice.addTextChangedListener(unitPriceWatcher);
} else {
edUnitPrice.removeTextChangedListener(unitPriceWatcher);
}
});
viewHolder.setBackgroundResource(R.id.iv_order_details_item_food_select, item.isChecked() ? R.drawable.ic_checkbox_checked : R.drawable.ic_checkbox_uncheck); //設置入庫總價,總價是由用戶輸入的單價*基本單位數
viewHolder.setText(R.id.tv_order_details_item_warehouse_total_amount, String.format(context.getString(R.string.amount_string_s), MoneyUtil.formatDouble(item.getWarehousingAmount())));
CheckBox checkBox = viewHolder.getView(R.id.iv_order_details_item_food_select);
checkBox.setChecked(item.isChecked());
} }
private static class WareHouseUnitAdapter extends BaseQuickAdapter<DeputyUnitBean, BaseViewHolder> { private static class WareHouseUnitAdapter extends BaseQuickAdapter<DeputyUnitBean, BaseViewHolder> {
......
...@@ -4,6 +4,7 @@ import android.animation.AnimatorSet; ...@@ -4,6 +4,7 @@ import android.animation.AnimatorSet;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
...@@ -12,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView; ...@@ -12,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration; import com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration;
import com.gingersoft.gsa.cloud.ui.utils.AnimateUtils; import com.gingersoft.gsa.cloud.ui.utils.AnimateUtils;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog; import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
...@@ -39,10 +41,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -39,10 +41,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
private Context context; private Context context;
private DividerItemDecoration dividerItemDecoration; private DividerItemDecoration dividerItemDecoration;
private String amountUnitStr;
private String estimateDeliveryTimeStr;
public ShoppingCartAdapter(Context context, @Nullable List<ShoppingCartBean> data) { public ShoppingCartAdapter(Context context, @Nullable List<ShoppingCartBean> data) {
super(R.layout.item_shopping_cart, data); super(R.layout.item_shopping_cart, data);
this.context = context; this.context = context;
dividerItemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL_LIST); dividerItemDecoration = new DividerItemDecoration(context, DividerItemDecoration.VERTICAL_LIST);
amountUnitStr = context.getString(R.string.amount_string);
estimateDeliveryTimeStr = context.getString(R.string.estimate_delivery_time);
} }
@Override @Override
...@@ -50,10 +57,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -50,10 +57,15 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
RecyclerView rvFoods = viewHolder.getView(R.id.rv_shopping_cart_food); RecyclerView rvFoods = viewHolder.getView(R.id.rv_shopping_cart_food);
//先判斷是否滿足最低採購金額 //先判斷是否滿足最低採購金額
TextView tvMinMinimumAmount = viewHolder.getView(R.id.tv_minimumAmount); TextView tvMinMinimumAmount = viewHolder.getView(R.id.tv_minimumAmount);
viewHolder.setText(R.id.rv_purchase_shopping_estimate_delivery_time, String.format(estimateDeliveryTimeStr, shoppingCartBean.getInitialShippingTime()));
setTvMinimumAmount(shoppingCartBean, tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip)); setTvMinimumAmount(shoppingCartBean, tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip));
// viewHolder.setText(R.id.tv_order_item_freight, shoppingCartBean.getFoodList());
//選中食品的總價 //選中食品的總價
TextView tvPrice = viewHolder.getView(R.id.tv_order_item_total_amount); setTotalAmount(viewHolder, shoppingCartBean.getSelectFoodAmount());
tvPrice.setText(String.format(context.getString(R.string.amount_string), shoppingCartBean.getSelectFoodAmount())); //運費
viewHolder.setText(R.id.tv_order_item_freight, String.format(amountUnitStr, shoppingCartBean.getShipping()));
//實際應付金額
setActualAmount(viewHolder, shoppingCartBean.getSelectFoodAmount());
//選中食品的種類 //選中食品的種類
TextView tvFoodTypeNumber = viewHolder.getView(R.id.tv_order_item_food_type_total); TextView tvFoodTypeNumber = viewHolder.getView(R.id.tv_order_item_food_type_total);
tvFoodTypeNumber.setText(String.valueOf(shoppingCartBean.getSelectSpeciesNum())); tvFoodTypeNumber.setText(String.valueOf(shoppingCartBean.getSelectSpeciesNum()));
...@@ -66,7 +78,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -66,7 +78,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
CheckBox cbAllSelect = viewHolder.getView(R.id.cb_order_item_all_select); CheckBox cbAllSelect = viewHolder.getView(R.id.cb_order_item_all_select);
cbAllSelect.setText(shoppingCartBean.getSupplierName()); cbAllSelect.setText(shoppingCartBean.getSupplierName());
//全選按鈕的事件監聽 //全選按鈕的事件監聽
allSelectListener(foodListAdapter, shoppingCartBean, tvPrice, tvFoodTypeNumber, cbAllSelect); allSelectListener(foodListAdapter, shoppingCartBean, tvFoodTypeNumber, cbAllSelect, viewHolder);
cbAllSelect.setChecked(shoppingCartBean.isAllSelect()); cbAllSelect.setChecked(shoppingCartBean.isAllSelect());
//單個食品的數量修改 //單個食品的數量修改
foodListAdapter.setOnNumberChangeListener(((beforeNumber, number, position) -> { foodListAdapter.setOnNumberChangeListener(((beforeNumber, number, position) -> {
...@@ -78,7 +90,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -78,7 +90,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
//彈窗顯示 是否刪除 //彈窗顯示 是否刪除
new AppDialog().showWaringDialog(context, "是否刪除食品?", (view, dialog) -> { new AppDialog().showWaringDialog(context, "是否刪除食品?", (view, dialog) -> {
dialog.dismiss(); dialog.dismiss();
boolean isDeleteSupplier = deleteFood(viewHolder.getAdapterPosition(), tvPrice, tvFoodTypeNumber, foodListAdapter, beforeNumber, position, purchaseFoodBean); boolean isDeleteSupplier = deleteFood(viewHolder.getAdapterPosition(), viewHolder, tvFoodTypeNumber, foodListAdapter, beforeNumber, position, purchaseFoodBean);
//如果這個供應商被刪除了,就不用判斷採購金額了 //如果這個供應商被刪除了,就不用判斷採購金額了
if (!isDeleteSupplier) { if (!isDeleteSupplier) {
//判斷當前總價是否滿足最低採購金額 //判斷當前總價是否滿足最低採購金額
...@@ -96,10 +108,10 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -96,10 +108,10 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
//當數量發生改變時,重新計算價格。 //當數量發生改變時,重新計算價格。
if (beforeNumber > number) { if (beforeNumber > number) {
//減少金額 //減少金額
minusTotalPrice(tvPrice, getData().get(viewHolder.getLayoutPosition()), purchaseFoodBean.getUnitPrice(), beforeNumber - number, 0); minusTotalPrice(viewHolder, getData().get(viewHolder.getLayoutPosition()), purchaseFoodBean.getUnitPrice(), beforeNumber - number, 0);
} else { } else {
//增加金額 //增加金額
addTotalAmount(tvPrice, getData().get(viewHolder.getLayoutPosition()), purchaseFoodBean.getUnitPrice(), number - beforeNumber, 0); addTotalAmount(viewHolder, getData().get(viewHolder.getLayoutPosition()), purchaseFoodBean.getUnitPrice(), number - beforeNumber, 0);
} }
//判斷當前總價是否滿足最低採購金額 //判斷當前總價是否滿足最低採購金額
setTvMinimumAmount(getData().get(viewHolder.getAdapterPosition()), tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip)); setTvMinimumAmount(getData().get(viewHolder.getAdapterPosition()), tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip));
...@@ -129,17 +141,27 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -129,17 +141,27 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
cbAllSelect.setChecked(isAllSelected); cbAllSelect.setChecked(isAllSelected);
cartBean.setAllSelect(isAllSelected); cartBean.setAllSelect(isAllSelected);
//選中時,增加金額,增加種類 //選中時,增加金額,增加種類
addFood(tvPrice, tvFoodTypeNumber, cartBean, purchaseFoodListVosBean.getUnitPrice(), purchaseFoodListVosBean.getFoodQuantity()); addFood(viewHolder, tvFoodTypeNumber, cartBean, purchaseFoodListVosBean.getUnitPrice(), purchaseFoodListVosBean.getFoodQuantity());
} else { } else {
cbAllSelect.setChecked(false); cbAllSelect.setChecked(false);
cartBean.setAllSelect(false); cartBean.setAllSelect(false);
//取消時,減去金額,減去種類 //取消時,減去金額,減去種類
minusFood(tvPrice, tvFoodTypeNumber, cartBean, purchaseFoodListVosBean.getUnitPrice(), purchaseFoodListVosBean.getFoodQuantity()); minusFood(viewHolder, tvFoodTypeNumber, cartBean, purchaseFoodListVosBean.getUnitPrice(), purchaseFoodListVosBean.getFoodQuantity());
} }
//判斷當前總價是否滿足最低採購金額 //判斷當前總價是否滿足最低採購金額
setTvMinimumAmount(getData().get(viewHolder.getAdapterPosition()), tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip)); setTvMinimumAmount(getData().get(viewHolder.getAdapterPosition()), tvMinMinimumAmount, viewHolder.getView(R.id.rv_purchase_shopping_minimum_tip));
}); });
rvFoods.setVisibility(View.VISIBLE); rvFoods.setVisibility(View.VISIBLE);
//備註
viewHolder.setText(R.id.ed_purchase_shopping_remarks, shoppingCartBean.getRemarks());
EditText mEdRemarks = viewHolder.getView(R.id.ed_purchase_shopping_remarks);
mEdRemarks.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
//失去焦點時修改備註
ShoppingCartBean currentShoppingBean = getData().get(viewHolder.getAdapterPosition());
currentShoppingBean.setRemarks(mEdRemarks.getText() + "");
}
});
if (shoppingCartBean.isFlashing()) { if (shoppingCartBean.isFlashing()) {
//閃爍 //閃爍
viewHolder.setGone(R.id.item_purchase_shopping_parent_layout, false); viewHolder.setGone(R.id.item_purchase_shopping_parent_layout, false);
...@@ -153,6 +175,23 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -153,6 +175,23 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
} }
} }
/**
* 修改總金額
*/
private void setTotalAmount(BaseViewHolder viewHolder, Double totalAmount) {
viewHolder.setText(R.id.tv_order_item_total_amount, String.format(amountUnitStr, totalAmount));
}
/**
* 修改實際總金額
*
* @param totalAmount 加上運費後的總金額
*/
private void setActualAmount(BaseViewHolder viewHolder, Double totalAmount) {
viewHolder.setText(R.id.tv_order_item_actual_pay_amount, String.format(amountUnitStr, totalAmount));
}
private void setTvMinimumAmount(ShoppingCartBean shoppingCartBean, TextView tvMinMinimumAmount, TextView tipTv) { private void setTvMinimumAmount(ShoppingCartBean shoppingCartBean, TextView tvMinMinimumAmount, TextView tipTv) {
if (MoneyUtil.compareTo(shoppingCartBean.getSelectFoodAmount(), shoppingCartBean.getMinimumAmount()) < 0) { if (MoneyUtil.compareTo(shoppingCartBean.getSelectFoodAmount(), shoppingCartBean.getMinimumAmount()) < 0) {
//小於最低採購金額 //小於最低採購金額
...@@ -170,7 +209,6 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -170,7 +209,6 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
* 刪除食品 * 刪除食品
* *
* @param supplierPosition 供應商的下標 * @param supplierPosition 供應商的下標
* @param tvPrice 顯示供應商總價的textview
* @param tvFoodTypeNumber 顯示食品種類textview * @param tvFoodTypeNumber 顯示食品種類textview
* @param foodListAdapter 供應商的食品adapter * @param foodListAdapter 供應商的食品adapter
* @param beforeNumber 刪除之前的食品數量 * @param beforeNumber 刪除之前的食品數量
...@@ -178,7 +216,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -178,7 +216,7 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
* @param purchaseFoodBean 需要刪除的食品對象 * @param purchaseFoodBean 需要刪除的食品對象
* @return 是否刪除供應商 * @return 是否刪除供應商
*/ */
private boolean deleteFood(int supplierPosition, TextView tvPrice, TextView tvFoodTypeNumber, FoodListAdapter foodListAdapter, int beforeNumber, int position, PurchaseFoodBean purchaseFoodBean) { private boolean deleteFood(int supplierPosition, BaseViewHolder viewHolder, TextView tvFoodTypeNumber, FoodListAdapter foodListAdapter, int beforeNumber, int position, PurchaseFoodBean purchaseFoodBean) {
foodListAdapter.removeAt(position); foodListAdapter.removeAt(position);
//如果這個供應商沒有食品了,需要當前adapter刪除掉這個供應商 //如果這個供應商沒有食品了,需要當前adapter刪除掉這個供應商
if (foodListAdapter.getItemCount() == 0) { if (foodListAdapter.getItemCount() == 0) {
...@@ -187,12 +225,16 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -187,12 +225,16 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
} }
return true; return true;
} else { } else {
//這裡還需要從購物車裡將這個食品刪除
if (onFoodDeleteListener != null) {
onFoodDeleteListener.onDeleteFood(supplierPosition, purchaseFoodBean);
}
//這個供應商還有食品 //這個供應商還有食品
//如果這個食品是選中的 //如果這個食品是選中的
if (purchaseFoodBean.isChecked()) { if (purchaseFoodBean.isChecked()) {
//計算這個供應商 選中食材的價格,減去當前這個食材的價格 //計算這個供應商 選中食材的價格,減去當前這個食材的價格
ShoppingCartBean shoppingCartBean1 = getData().get(supplierPosition); ShoppingCartBean shoppingCartBean1 = getData().get(supplierPosition);
minusFood(tvPrice, tvFoodTypeNumber, shoppingCartBean1, purchaseFoodBean.getUnitPrice(), beforeNumber); minusFood(viewHolder, tvFoodTypeNumber, shoppingCartBean1, purchaseFoodBean.getUnitPrice(), beforeNumber);
} }
} }
return false; return false;
...@@ -201,49 +243,47 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -201,49 +243,47 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
/** /**
* 取消選中或刪除食品 需要對種類進行操作 * 取消選中或刪除食品 需要對種類進行操作
* *
* @param tvPrice 價格textview
* @param tvFoodTypeNumber 種類textview * @param tvFoodTypeNumber 種類textview
* @param cartBean 當前供應商信息 * @param cartBean 當前供應商信息
* @param unitPrice 食品單價 * @param unitPrice 食品單價
* @param foodQuantity 食品數量 * @param foodQuantity 食品數量
*/ */
private void minusFood(TextView tvPrice, TextView tvFoodTypeNumber, ShoppingCartBean cartBean, double unitPrice, int foodQuantity) { private void minusFood(BaseViewHolder viewHolder, TextView tvFoodTypeNumber, ShoppingCartBean cartBean, double unitPrice, int foodQuantity) {
int species = cartBean.getSelectSpeciesNum() - 1; int species = cartBean.getSelectSpeciesNum() - 1;
cartBean.setSelectSpeciesNum(species); cartBean.setSelectSpeciesNum(species);
tvFoodTypeNumber.setText(String.valueOf(species)); tvFoodTypeNumber.setText(String.valueOf(species));
minusTotalPrice(tvPrice, cartBean, unitPrice, foodQuantity, -1); minusTotalPrice(viewHolder, cartBean, unitPrice, foodQuantity, -1);
} }
/** /**
* 選中食品 需要對種類進行操作 * 選中食品 需要對種類進行操作
* *
* @param tvPrice 價格textview
* @param tvFoodTypeNumber 種類textview * @param tvFoodTypeNumber 種類textview
* @param cartBean 當前供應商信息 * @param cartBean 當前供應商信息
* @param unitPrice 食品單價 * @param unitPrice 食品單價
* @param foodQuantity 食品數量 * @param foodQuantity 食品數量
*/ */
private void addFood(TextView tvPrice, TextView tvFoodTypeNumber, ShoppingCartBean cartBean, double unitPrice, int foodQuantity) { private void addFood(BaseViewHolder viewHolder, TextView tvFoodTypeNumber, ShoppingCartBean cartBean, double unitPrice, int foodQuantity) {
int species = cartBean.getSelectSpeciesNum() + 1; int species = cartBean.getSelectSpeciesNum() + 1;
cartBean.setSelectSpeciesNum(species); cartBean.setSelectSpeciesNum(species);
tvFoodTypeNumber.setText(String.valueOf(species)); tvFoodTypeNumber.setText(String.valueOf(species));
addTotalAmount(tvPrice, cartBean, unitPrice, foodQuantity, 1); addTotalAmount(viewHolder, cartBean, unitPrice, foodQuantity, 1);
} }
/** /**
* 總價格增加 不需要修改種類數量 * 總價格增加 不需要修改種類數量
* *
* @param tvPrice 價格textview
* @param cartBean 當前供應商信息 * @param cartBean 當前供應商信息
* @param unitPrice 食品單價 * @param unitPrice 食品單價
* @param foodQuantity 食品數量 * @param foodQuantity 食品數量
* @param species 需要增加的種類數量 * @param species 需要增加的種類數量
*/ */
private void addTotalAmount(TextView tvPrice, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) { private void addTotalAmount(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) {
//供應商總價減去-這個食品的總價=等於現價 //供應商總價減去-這個食品的總價=等於現價
double currentPrice = MoneyUtil.sum(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity)); double currentPrice = MoneyUtil.sum(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity));
cartBean.setSelectFoodAmount(currentPrice); cartBean.setSelectFoodAmount(currentPrice);
tvPrice.setText(String.format(context.getString(R.string.amount_string), currentPrice)); setTotalAmount(viewHolder, currentPrice);
setActualAmount(viewHolder, currentPrice);
//傳遞回去 //傳遞回去
if (onInfoChangeListener != null) { if (onInfoChangeListener != null) {
onInfoChangeListener.onInfoChange(MoneyUtil.priceCalculation(unitPrice, foodQuantity), species); onInfoChangeListener.onInfoChange(MoneyUtil.priceCalculation(unitPrice, foodQuantity), species);
...@@ -253,17 +293,18 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -253,17 +293,18 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
/** /**
* 總價減少 不需要修改種類數量 * 總價減少 不需要修改種類數量
* *
* @param tvPrice 價格textview
* @param cartBean 當前供應商信息 * @param cartBean 當前供應商信息
* @param unitPrice 食品單價 * @param unitPrice 食品單價
* @param foodQuantity 食品數量 * @param foodQuantity 食品數量
* @param species 需要減少的種類數量 * @param species 需要減少的種類數量
*/ */
private void minusTotalPrice(TextView tvPrice, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) { private void minusTotalPrice(BaseViewHolder viewHolder, ShoppingCartBean cartBean, double unitPrice, int foodQuantity, int species) {
//供應商總價減去-這個食品的總價=等於現價 //供應商總價減去-這個食品的總價=等於現價
double currentPrice = MoneyUtil.sub(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity)); double currentPrice = MoneyUtil.sub(cartBean.getSelectFoodAmount(), MoneyUtil.priceCalculation(unitPrice, foodQuantity));
cartBean.setSelectFoodAmount(currentPrice); cartBean.setSelectFoodAmount(currentPrice);
tvPrice.setText(String.format(context.getString(R.string.amount_string), currentPrice)); String amountStr = String.format(amountUnitStr, currentPrice);
setTotalAmount(viewHolder, currentPrice);
viewHolder.setText(R.id.tv_order_item_actual_pay_amount, amountStr);
//傳遞回去 //傳遞回去
if (onInfoChangeListener != null) { if (onInfoChangeListener != null) {
onInfoChangeListener.onInfoChange(-MoneyUtil.priceCalculation(unitPrice, foodQuantity), species); onInfoChangeListener.onInfoChange(-MoneyUtil.priceCalculation(unitPrice, foodQuantity), species);
...@@ -306,11 +347,10 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -306,11 +347,10 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
* *
* @param foodListAdapter 顯示所有食品的adapter * @param foodListAdapter 顯示所有食品的adapter
* @param shoppingCartBean 單個供應商和供應商食品信息 * @param shoppingCartBean 單個供應商和供應商食品信息
* @param tvPrice 該供應商總價textview
* @param tvNumber 該供應商種類textview * @param tvNumber 該供應商種類textview
* @param cbAllSelect 全選複選框 * @param cbAllSelect 全選複選框
*/ */
private void allSelectListener(FoodListAdapter foodListAdapter, ShoppingCartBean shoppingCartBean, TextView tvPrice, TextView tvNumber, CheckBox cbAllSelect) { private void allSelectListener(FoodListAdapter foodListAdapter, ShoppingCartBean shoppingCartBean, TextView tvNumber, CheckBox cbAllSelect, BaseViewHolder viewHolder) {
//全選 //全選
cbAllSelect.setOnCheckedChangeListener((buttonView, isChecked) -> { cbAllSelect.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (buttonView.isPressed()) { if (buttonView.isPressed()) {
...@@ -329,7 +369,10 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base ...@@ -329,7 +369,10 @@ public class ShoppingCartAdapter extends BaseQuickAdapter<ShoppingCartBean, Base
} }
} }
tvNumber.setText(String.valueOf(speciesNum)); tvNumber.setText(String.valueOf(speciesNum));
tvPrice.setText(String.format(context.getString(R.string.amount_string_s), MoneyUtil.formatDouble(totalAmount))); String amountStr = String.format(context.getString(R.string.amount_string_s), MoneyUtil.formatDouble(totalAmount));
setTotalAmount(viewHolder, totalAmount);
//實際應付金額
viewHolder.setText(R.id.tv_order_item_actual_pay_amount, amountStr);
if (onInfoChangeListener != null) { if (onInfoChangeListener != null) {
if (isChecked) { if (isChecked) {
//總價和種類都增加 //總價和種類都增加
......
package com.gingersoft.supply_chain.mvp.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/22
* Time: 14:45
* Use:
*/
public class WareHousingDetailsAdapter extends BaseQuickAdapter<WarehouseDetailsBean.PurchaseWarehousingOrderDetailsContentsBean, BaseViewHolder> {
public WareHousingDetailsAdapter(@Nullable List<WarehouseDetailsBean.PurchaseWarehousingOrderDetailsContentsBean> data) {
super(R.layout.item_warehouse_details, data);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, WarehouseDetailsBean.PurchaseWarehousingOrderDetailsContentsBean purchaseWarehousingOrderDetailsContentsBean) {
//食品名
viewHolder.setText(R.id.tv_warehouse_details_food_name, purchaseWarehousingOrderDetailsContentsBean.getName());
//入庫單位
viewHolder.setText(R.id.tv_warehouse_details_food_unit, "單位");
//入庫食品數量
viewHolder.setText(R.id.tv_warehouse_details_food_num, String.format(getContext().getString(R.string.str_format_positive), purchaseWarehousingOrderDetailsContentsBean.getFoodQuantity()));
//下單時間
viewHolder.setText(R.id.tv_warehouse_details_order_time, "下單時間");
//供應商
viewHolder.setText(R.id.tv_warehouse_details_supplier, purchaseWarehousingOrderDetailsContentsBean.getName());
//入庫日期
viewHolder.setText(R.id.tv_warehouse_details_time, "入庫日期");
//入庫來源
viewHolder.setText(R.id.tv_warehouse_details_reason, purchaseWarehousingOrderDetailsContentsBean.getPurchase());
}
}
...@@ -27,6 +27,7 @@ public class WarehousingQueryAdapter extends BaseQuickAdapter<WareHouseListBean. ...@@ -27,6 +27,7 @@ public class WarehousingQueryAdapter extends BaseQuickAdapter<WareHouseListBean.
public WarehousingQueryAdapter(Context context, List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean> purchaseWarehousingOrderDetailsVosBeans) { public WarehousingQueryAdapter(Context context, List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean> purchaseWarehousingOrderDetailsVosBeans) {
super(R.layout.item_warehousing_query, purchaseWarehousingOrderDetailsVosBeans); super(R.layout.item_warehousing_query, purchaseWarehousingOrderDetailsVosBeans);
addChildClickViewIds(R.id.tv_warehouse_item_inventory_quantity);
this.context = context; this.context = context;
} }
......
...@@ -17,6 +17,8 @@ import androidx.core.content.ContextCompat; ...@@ -17,6 +17,8 @@ import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback; import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils; import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
...@@ -35,6 +37,7 @@ import com.gingersoft.supply_chain.mvp.presenter.CategoryPresenter; ...@@ -35,6 +37,7 @@ import com.gingersoft.supply_chain.mvp.presenter.CategoryPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.SecondCategoryAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.CategoryPopup; import com.gingersoft.supply_chain.mvp.ui.widget.CategoryPopup;
import com.jess.arms.base.App;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.kingja.loadsir.callback.Callback; import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadSir; import com.kingja.loadsir.core.LoadSir;
...@@ -88,6 +91,15 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -88,6 +91,15 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
*/ */
private boolean showDelete = false; private boolean showDelete = false;
/**
* 當前選中的是幾級分類
*/
private int currentLevel;
/**
* 當前等級分類的下標
*/
private int currentLevelPosition;
public static CategoryFragment newInstance() { public static CategoryFragment newInstance() {
CategoryFragment fragment = new CategoryFragment(); CategoryFragment fragment = new CategoryFragment();
return fragment; return fragment;
...@@ -117,18 +129,82 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -117,18 +129,82 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
} }
private void initTopBar() { private void initTopBar() {
// topbarFoodIngredients.addRightImageButton(R.drawable.ic_white_delete, R.id.topbar_right_delete_button).setOnClickListener(new View.OnClickListener() { topbarFoodIngredients.addRightImageButton(R.drawable.ic_white_edit, R.id.topbar_right_delete_button).setOnClickListener(v -> editCategory());
// @Override
// public void onClick(View v) {
// showDelete = !showDelete;
// updateDeleteBtnState();
// }
// });
topbarFoodIngredients.setTitle("類別管理"); topbarFoodIngredients.setTitle("類別管理");
topbarFoodIngredients.addLeftBackImageButton().setOnClickListener(v -> killMyself()); topbarFoodIngredients.addLeftBackImageButton().setOnClickListener(v -> killMyself());
} }
/** /**
* 右上角編輯分類
*/
private void editCategory() {
String categoryName = null;
int categoryId = 0;
int parentId = 0;
if (currentLevel == mPresenter.primaryCategoryTag) {
//如果是修改一級分類,拿到當前選中的分類的名稱,父級id,分類id
if (baseCategoryAdapter != null) {
List<CategoryBean> data = baseCategoryAdapter.getData();
if (data.size() > currentLevelPosition) {
categoryName = data.get(currentLevelPosition).getCategoryName();
categoryId = data.get(currentLevelPosition).getId();
}
}
} else if (currentLevel == mPresenter.secondCategoryTag) {
//如果是修改二級分類,拿到當前選中的分類的名稱,父級id,分類id
if (secondCategoryAdapter != null) {
List<FoodCategoryResultBean.DataBean.FoodCategoryBean> secondData = secondCategoryAdapter.getData();
if (secondData.size() > currentLevelPosition) {
categoryName = secondData.get(currentLevelPosition).getName();
categoryId = secondData.get(currentLevelPosition).getId();
parentId = secondData.get(currentLevelPosition).getParentId();
}
}
} else if (currentLevel == mPresenter.thirdCategoryTag) {
//如果是修改三級分類,拿到當前選中的分類的名稱,父級id,分類id
if (secondCategoryAdapter != null) {
List<FoodCategoryResultBean.DataBean.FoodCategoryBean> thirdData = thirdCategoryAdapter.getData();
if (thirdData.size() > currentLevelPosition) {
categoryName = thirdData.get(currentLevelPosition).getName();
categoryId = thirdData.get(currentLevelPosition).getId();
parentId = thirdData.get(currentLevelPosition).getParentId();
}
}
} else {
showMessage("請選擇分類");
return;
}
if (categoryId == 0) {
showMessage("請重新選擇分類");
return;
}
String finalCategoryName = categoryName;
int finalCategoryId = categoryId;
int finalParentId = parentId;
CategoryPopup categoryPopup = new CategoryPopup(mContext, "修改", "類別名稱", "请修改當前類別名稱", categoryName, true);
categoryPopup.setOnDeleteListener(v -> {
//刪除分類
AppDialog.getInstance().showWaringDialog(mContext, "是否確認刪除該類別【" + finalCategoryName + "】,子類將一同刪除?", (view, dialog) -> {
categoryPopup.dismiss();
dialog.dismiss();
mPresenter.deleteFoodCategory(finalCategoryId, currentLevel, currentLevelPosition);
});
});
new XPopup.Builder(getContext())
.asCustom(categoryPopup.setListener(() -> {
//修改分類
if (TextUtil.isEmptyOrNullOrUndefined(categoryPopup.getEditText())) {
showMessage("請輸入分類名稱");
return;
}
mPresenter.updateFoodCategory(mPresenter.toFoodCategoryBean(finalParentId, finalCategoryName, finalCategoryId), currentLevel, currentLevelPosition);
}, () -> {
}))
.show();
}
/**
* 修改刪除按鈕的顯示狀態 * 修改刪除按鈕的顯示狀態
*/ */
private void updateDeleteBtnState() { private void updateDeleteBtnState() {
...@@ -178,8 +254,8 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -178,8 +254,8 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
} }
int finalParentId = parentId; int finalParentId = parentId;
int finalLevel = level; int finalLevel = level;
if(TextUtil.isNotEmptyOrNullOrUndefined(parentCategoryName)) { if (TextUtil.isNotEmptyOrNullOrUndefined(parentCategoryName)) {
CategoryPopup categoryPopup = new CategoryPopup(mContext, parentCategoryName, "類別名稱", "请輸入類別名稱", level != mPresenter.primaryCategoryTag); CategoryPopup categoryPopup = new CategoryPopup(mContext, parentCategoryName, "類別名稱", "请輸入類別名稱", null, false);
new XPopup.Builder(getContext()) new XPopup.Builder(getContext())
.asCustom(categoryPopup.setListener(() -> { .asCustom(categoryPopup.setListener(() -> {
//創建分類 //創建分類
...@@ -190,8 +266,6 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -190,8 +266,6 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//創建分類 //創建分類
mPresenter.addCategory(finalParentId, categoryPopup.getEditText().getText().toString(), finalLevel); mPresenter.addCategory(finalParentId, categoryPopup.getEditText().getText().toString(), finalLevel);
}, () -> { }, () -> {
//刪除分類
deleteCategory(finalLevel);
})) }))
.show(); .show();
} else { } else {
...@@ -199,31 +273,6 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -199,31 +273,6 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
} }
} }
private void deleteCategory(int finalLevel) {
String categoryName = null;
int categoryId = 0;
int position = 0;
if (finalLevel == mPresenter.secondCategoryTag) {
CategoryBean categoryBean = baseCategoryAdapter.getData().get(baseCategoryAdapter.getSelectedIndex());
categoryName = categoryBean.getCategoryName();
categoryId = categoryBean.getId();
position = baseCategoryAdapter.getSelectedIndex();
} else if (finalLevel == mPresenter.thirdCategoryTag) {
FoodCategoryResultBean.DataBean.FoodCategoryBean categoryBean1 = secondCategoryAdapter.getData().get(secondCategoryAdapter.getSelectIndex());
categoryName = categoryBean1.getName();
categoryId = categoryBean1.getId();
position = secondCategoryAdapter.getSelectIndex();
}
//刪除該分類
String finalCategoryName = categoryName;
int finalCategoryId = categoryId;
int finalPosition = position;
new AppDialog().showWaringDialog(mContext, "是否確認刪除該類別【" + categoryName + "】,子類將一同刪除?", (view1, dialog1) -> {
mPresenter.deleteFoodCategory(mPresenter.toFoodCategoryBean(0, finalCategoryName, finalCategoryId), mPresenter.primaryCategoryTag, finalPosition);
dialog1.dismiss();
});
}
//一級 //一級
private BaseCategoryAdapter baseCategoryAdapter; private BaseCategoryAdapter baseCategoryAdapter;
//二級 //二級
...@@ -231,6 +280,11 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -231,6 +280,11 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//三級 //三級
private SecondCategoryAdapter thirdCategoryAdapter; private SecondCategoryAdapter thirdCategoryAdapter;
private void setCurrentInfo(int level, int position) {
currentLevelPosition = position;
currentLevel = level;
}
@Override @Override
public void loadCategoryInfo(List<FoodCategoryResultBean.DataBean.FoodCategoryBean> list, int hierarchy) { public void loadCategoryInfo(List<FoodCategoryResultBean.DataBean.FoodCategoryBean> list, int hierarchy) {
loadService.showSuccess(); loadService.showSuccess();
...@@ -255,8 +309,12 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -255,8 +309,12 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
baseCategoryAdapter = new BaseCategoryAdapter(data, mContext) baseCategoryAdapter = new BaseCategoryAdapter(data, mContext)
.setUnSelectColor(ContextCompat.getColor(mContext, R.color.color_3c)) .setUnSelectColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color)); .setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
setCurrentInfo(mPresenter.primaryCategoryTag, 0);
rvFirstCategory.setAdapter(baseCategoryAdapter); rvFirstCategory.setAdapter(baseCategoryAdapter);
baseCategoryAdapter.setOnItemClickListener((adapter, view, position) -> { baseCategoryAdapter.setOnItemClickListener((adapter, view, position) -> {
setCurrentInfo(mPresenter.primaryCategoryTag, position);
baseCategoryAdapter.setSelectedIndex(position); baseCategoryAdapter.setSelectedIndex(position);
List<CategoryBean> categoryBeans = baseCategoryAdapter.getData(); List<CategoryBean> categoryBeans = baseCategoryAdapter.getData();
mPresenter.getCategoryBeansById(categoryBeans.get(position).getId(), mPresenter.secondCategoryTag); mPresenter.getCategoryBeansById(categoryBeans.get(position).getId(), mPresenter.secondCategoryTag);
...@@ -266,13 +324,14 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -266,13 +324,14 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//刪除該分類 //刪除該分類
CategoryBean categoryBean = baseCategoryAdapter.getData().get(position); CategoryBean categoryBean = baseCategoryAdapter.getData().get(position);
new AppDialog().showWaringDialog(mContext, "是否確認刪除該類別【" + categoryBean.getCategoryName() + "】,子類將一同刪除?", (view1, dialog) -> { new AppDialog().showWaringDialog(mContext, "是否確認刪除該類別【" + categoryBean.getCategoryName() + "】,子類將一同刪除?", (view1, dialog) -> {
mPresenter.deleteFoodCategory(mPresenter.toFoodCategoryBean(0, categoryBean.getCategoryName(), categoryBean.getId()), mPresenter.primaryCategoryTag, position); mPresenter.deleteFoodCategory(categoryBean.getId(), mPresenter.primaryCategoryTag, position);
dialog.dismiss(); dialog.dismiss();
}); });
} }
}); });
} else { } else {
baseCategoryAdapter.setList(data); baseCategoryAdapter.setList(data);
setCurrentInfo(mPresenter.primaryCategoryTag, 0);
} }
} else if (hierarchy == mPresenter.secondCategoryTag) { } else if (hierarchy == mPresenter.secondCategoryTag) {
if (list == null || list.size() <= 0) { if (list == null || list.size() <= 0) {
...@@ -288,11 +347,15 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -288,11 +347,15 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
secondCategoryAdapter = new SecondCategoryAdapter(list); secondCategoryAdapter = new SecondCategoryAdapter(list);
//因為第一個數據是空的,用來顯示按鈕,所以下標跳過0 //因為第一個數據是空的,用來顯示按鈕,所以下標跳過0
secondCategoryAdapter.setSelectIndex(1); secondCategoryAdapter.setSelectIndex(1);
setCurrentInfo(mPresenter.secondCategoryTag, 1);
secondCategoryAdapter.setCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_app_btn_small_radius)) secondCategoryAdapter.setCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_app_btn_small_radius))
.setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_five_radius_gray_stroke)) .setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_five_radius_gray_stroke))
.setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white)) .setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white))
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_3c)) .setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_3c))
.setOnItemClickListener((adapter, view, position) -> { .setOnItemClickListener((adapter, view, position) -> {
setCurrentInfo(mPresenter.secondCategoryTag, position);
secondCategoryAdapter.setSelectIndex(position); secondCategoryAdapter.setSelectIndex(position);
List<FoodCategoryResultBean.DataBean.FoodCategoryBean> categoryBeans = secondCategoryAdapter.getData(); List<FoodCategoryResultBean.DataBean.FoodCategoryBean> categoryBeans = secondCategoryAdapter.getData();
mPresenter.getCategoryBeansById(categoryBeans.get(position).getId(), mPresenter.thirdCategoryTag); mPresenter.getCategoryBeansById(categoryBeans.get(position).getId(), mPresenter.thirdCategoryTag);
...@@ -306,6 +369,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -306,6 +369,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
}); });
rvSecondCategory.setAdapter(secondCategoryAdapter); rvSecondCategory.setAdapter(secondCategoryAdapter);
} else { } else {
setCurrentInfo(mPresenter.secondCategoryTag, 1);
secondCategoryAdapter.setSelectIndex(1); secondCategoryAdapter.setSelectIndex(1);
secondCategoryAdapter.setList(list); secondCategoryAdapter.setList(list);
} }
...@@ -313,13 +377,23 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -313,13 +377,23 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
hideLoading(); hideLoading();
if (thirdCategoryAdapter == null) { if (thirdCategoryAdapter == null) {
thirdCategoryAdapter = new SecondCategoryAdapter(list); thirdCategoryAdapter = new SecondCategoryAdapter(list);
thirdCategoryAdapter.setSelectIndex(-1) setCurrentInfo(mPresenter.thirdCategoryTag, 1);
thirdCategoryAdapter.setSelectIndex(1)
.setCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_theme_stoke_fifteen_corners))
.setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_da_stoke_fifteen_corners)) .setUnCheckedBg(ContextCompat.getDrawable(mContext, R.drawable.shape_color_da_stoke_fifteen_corners))
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_68)); .setCheckedTextColor(ContextCompat.getColor(mContext, R.color.white))
.setUnCheckedTextColor(ContextCompat.getColor(mContext, R.color.color_68))
.setOnItemClickListener((adapter, view, position) -> {
setCurrentInfo(mPresenter.thirdCategoryTag, position);
thirdCategoryAdapter.setSelectIndex(position);
});
addOnDelete(thirdCategoryAdapter, "】?", mPresenter.thirdCategoryTag); addOnDelete(thirdCategoryAdapter, "】?", mPresenter.thirdCategoryTag);
rvThirdCategory.setLayoutManager(new GridLayoutManager(mContext, 3)); rvThirdCategory.setLayoutManager(new GridLayoutManager(mContext, 3));
rvThirdCategory.setAdapter(thirdCategoryAdapter); rvThirdCategory.setAdapter(thirdCategoryAdapter);
} else { } else {
setCurrentInfo(mPresenter.thirdCategoryTag, 1);
thirdCategoryAdapter.setSelectIndex(1);
thirdCategoryAdapter.setList(list); thirdCategoryAdapter.setList(list);
} }
} }
...@@ -331,7 +405,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -331,7 +405,7 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
if (view.getId() == R.id.iv_category_delete) { if (view.getId() == R.id.iv_category_delete) {
//刪除該分類 //刪除該分類
new AppDialog().showWaringDialog(mContext, "是否確認刪除該類別【" + categoryAdapter.getData().get(position).getName() + s, (view1, dialog) -> { new AppDialog().showWaringDialog(mContext, "是否確認刪除該類別【" + categoryAdapter.getData().get(position).getName() + s, (view1, dialog) -> {
mPresenter.deleteFoodCategory(categoryAdapter.getData().get(position), categoryLevel, position); mPresenter.deleteFoodCategory(categoryAdapter.getData().get(position).getId(), categoryLevel, position);
dialog.dismiss(); dialog.dismiss();
}); });
} }
...@@ -391,4 +465,14 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter> ...@@ -391,4 +465,14 @@ public class CategoryFragment extends BaseSupplyChainFragment<CategoryPresenter>
//所以在這裡處理一下 //所以在這裡處理一下
hideLoading(); hideLoading();
} }
@Override
public void onHiddenChanged(boolean hidden) {
super.onHiddenChanged(hidden);
if (hidden) {
//獲取種類時,會連調幾次獲取下一級的接口,為了避免一直閃loading,不會關閉loading框,有時候會導致頁面關閉後還顯示loading
//所以在這裡處理一下
hideLoading();
}
}
} }
...@@ -402,6 +402,10 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -402,6 +402,10 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
@Override @Override
public void loadCategory(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) { public void loadCategory(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
if (foodCategoryTrees.size() <= 0) {
loadService.showCallback(EmptyCallback.class);
} else {
loadService.showSuccess();
initPrimaryAdapter(foodCategoryTrees); initPrimaryAdapter(foodCategoryTrees);
orderCategoryAdapter.setOnSecondCategoryClickListener((foodCategoryTrees1, position) -> { orderCategoryAdapter.setOnSecondCategoryClickListener((foodCategoryTrees1, position) -> {
//當前分類顯示的是一級分類和二級分類,二級分類的點擊事件 //當前分類顯示的是一級分類和二級分類,二級分類的點擊事件
...@@ -414,6 +418,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -414,6 +418,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
} }
}); });
} }
}
@Override @Override
public void loadFail() { public void loadFail() {
...@@ -500,6 +505,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -500,6 +505,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
private void initPrimaryAdapter private void initPrimaryAdapter
(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) { (List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
loadService.showSuccess();
if (orderCategoryAdapter == null) { if (orderCategoryAdapter == null) {
orderCategoryAdapter = new OrderCategoryAdapter(mContext, foodCategoryTrees); orderCategoryAdapter = new OrderCategoryAdapter(mContext, foodCategoryTrees);
} else { } else {
...@@ -513,7 +519,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi ...@@ -513,7 +519,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
getFoodsByCategoryId(); getFoodsByCategoryId();
orderCategoryAdapter.setSelectIndex(position); orderCategoryAdapter.setSelectIndex(position);
}); });
if (categoryId == -1) { if (categoryId == -1 && orderCategoryAdapter.getItemCount() > 0) {
//第一次進來,獲取默認的數據 //第一次進來,獲取默認的數據
orderCategoryAdapter.getOnItemClickListener().onItemClick(orderCategoryAdapter, null, 0); orderCategoryAdapter.getOnItemClickListener().onItemClick(orderCategoryAdapter, null, 0);
} }
......
...@@ -7,6 +7,7 @@ import android.database.Cursor; ...@@ -7,6 +7,7 @@ import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.provider.OpenableColumns; import android.provider.OpenableColumns;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -41,6 +42,7 @@ import com.gingersoft.supply_chain.mvp.presenter.NewFoodIngredientsPresenter; ...@@ -41,6 +42,7 @@ import com.gingersoft.supply_chain.mvp.presenter.NewFoodIngredientsPresenter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment;
import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.supplier.SupplierListFragment;
import com.gingersoft.supply_chain.mvp.utils.SelectPicture;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.permissionx.guolindev.PermissionX; import com.permissionx.guolindev.PermissionX;
import com.qmuiteam.qmui.alpha.QMUIAlphaButton; import com.qmuiteam.qmui.alpha.QMUIAlphaButton;
...@@ -58,6 +60,7 @@ import java.util.List; ...@@ -58,6 +60,7 @@ import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import cn.bingoogolapple.photopicker.activity.BGAPhotoPickerActivity;
import static com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST; import static com.gingersoft.gsa.cloud.ui.recylcler.decorator.DividerItemDecoration.VERTICAL_LIST;
import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_CATEGORY_DATA_KEY; import static com.gingersoft.supply_chain.mvp.ui.fragment.category.CategorySelectFragment.SELECT_CATEGORY_DATA_KEY;
...@@ -156,7 +159,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -156,7 +159,7 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
purchaseFoodBean = new PurchaseFoodBean(); purchaseFoodBean = new PurchaseFoodBean();
//拿到分類集合 //拿到分類集合
List<String> categoryNames = (List<String>) arguments.getSerializable(CATEGORY_NAME_KEY); List<String> categoryNames = (List<String>) arguments.getSerializable(CATEGORY_NAME_KEY);
if (categoryNames != null && categoryNames.size()>0) { if (categoryNames != null && categoryNames.size() > 0) {
//分類不為空,設置分類信息 //分類不為空,設置分類信息
mPresenter.setCategoryNames(categoryNames); mPresenter.setCategoryNames(categoryNames);
StringBuilder category = new StringBuilder(); StringBuilder category = new StringBuilder();
...@@ -204,86 +207,11 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -204,86 +207,11 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
}); });
//圖片點擊事件 //圖片點擊事件
infoMultiAdapter.setOnItemChildClickListener((adapter, view, position) -> { infoMultiAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_multi_upload_pic) { SelectPicture.getInstance().showSelectType(this);
//拍照或者選擇圖片
PermissionX.init(this).permissions(Manifest.permission.CAMERA)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要獲取拍照權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟拍照權限", "確定", "取消"))
.request((allGranted, grantedList, deniedList) -> showPictureChoice());
}
}); });
rvNewFoodIngredients.setAdapter(infoMultiAdapter); rvNewFoodIngredients.setAdapter(infoMultiAdapter);
} }
final String[] items = new String[]{"拍照", "從相冊選擇", "取消"};
public static final int CHOOSE_PHOTO = 101;
public static final int TAKE_PHOTO = 102;
public static final int PHOTO_CROP = 103;
/**
* 顯示照片選擇
*/
public void showPictureChoice() {
AppDialog.getInstance().showListDialog(mContext, items, (view, dialog, position) -> {
if (position == 0) {
takePhoto();
} else if (position == 1) {
Intent intentToPickPic = new Intent(Intent.ACTION_PICK, null);
intentToPickPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
startActivityForResult(intentToPickPic, CHOOSE_PHOTO);
}
});
}
/**
* 拍照
*/
private void takePhoto() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(mContext.getPackageManager()) != null) {
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException e) {
e.printStackTrace();
}
if (photoFile != null) {
try {
Uri photoUri = FileProvider.getUriForFile(mContext,
mContext.getPackageName() + ".fileprovider", photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(takePictureIntent, TAKE_PHOTO);
} catch (IllegalArgumentException e) {
ToastUtils.show(mContext, "打開相機失敗,請更換其他方式");
}
}
} else {
ToastUtils.show(mContext, "請安裝相機");
}
}
String currentPhotoPath;
/**
* 創建照片保存路徑,然後再進行拍照
*/
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
// File storageDir = mContext.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File cacheDir = mContext.getCacheDir();
File image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
cacheDir /* directory */
);
// Save a file: path for use with ACTION_VIEW intents
currentPhotoPath = image.getAbsolutePath();
mCameraUri = Uri.fromFile(image);
return image;
}
@OnClick({R2.id.btn_save_new_food_ingredients}) @OnClick({R2.id.btn_save_new_food_ingredients})
@Override @Override
public void onClick(View v) { public void onClick(View v) {
...@@ -331,19 +259,19 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -331,19 +259,19 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
@Override @Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CHOOSE_PHOTO && resultCode == RESULT_OK) { if (requestCode == SelectPicture.CHOOSE_PHOTO && resultCode == RESULT_OK) {
//從相冊選取完圖片之後 //從相冊選取完圖片之後
if (data != null) { if (data != null) {
Uri uri = data.getData(); Uri uri = data.getData();
if (uri != null) { if (uri != null) {
File file = uriToFileApiQ(uri); File file = SelectPicture.getInstance().uriToFileApiQ(requireContext(), uri);
crop(Uri.fromFile(file)); SelectPicture.getInstance().crop(Uri.fromFile(file), this);
} }
} }
} else if (requestCode == TAKE_PHOTO && resultCode == RESULT_OK) { } else if (requestCode == SelectPicture.TAKE_PHOTO && resultCode == RESULT_OK) {
//拍照 //拍照
//拍照完成後需要裁剪 //拍照完成後需要裁剪
crop(mCameraUri); SelectPicture.getInstance().crop(SelectPicture.getInstance().getmCameraUri(), this);
} else if (requestCode == REQUEST_CROP && resultCode == RESULT_OK && data != null) { } else if (requestCode == REQUEST_CROP && resultCode == RESULT_OK && data != null) {
final Uri resultUri = UCrop.getOutput(data); final Uri resultUri = UCrop.getOutput(data);
if (resultUri != null) { if (resultUri != null) {
...@@ -355,74 +283,6 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI ...@@ -355,74 +283,6 @@ public class NewFoodIngredientsFragment extends BaseSupplyChainFragment<NewFoodI
} }
} }
/**
* 裁剪
*
* @param mCameraUri
*/
private void crop(Uri mCameraUri) {
UCrop.of(mCameraUri, mCameraUri)
.withAspectRatio(1, 1)
.withMaxResultSize(500, 500)
.start(mContext, this);
}
/**
* uri轉換為文件路徑,適配android Q
*
* @param uri 私有uri
* @return 轉換到沙盒文件的文件
*/
public File uriToFileApiQ(Uri uri) {
File file = null;
//android10以上转换
String scheme = uri.getScheme();
if (scheme != null) {
if (scheme.equals(ContentResolver.SCHEME_FILE)) {
String path = uri.getPath();
if (path != null) {
file = new File(path);
}
} else if (uri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
//把文件复制到沙盒目录
ContentResolver contentResolver = mContext.getContentResolver();
Cursor cursor = contentResolver.query(uri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
String displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
try {
InputStream is = contentResolver.openInputStream(uri);
File externalCacheDir = mContext.getExternalCacheDir();
if (externalCacheDir != null) {
File cache = new File(mContext.getExternalCacheDir().getAbsolutePath(), Math.round((Math.random() + 1) * 1000) + displayName);
FileOutputStream fos = new FileOutputStream(cache);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && is != null) {
android.os.FileUtils.copy(is, fos);
} else {
String path = FileUtils.getFilePathByUri(mContext, uri);
FileUtils.copyFile(path, cache.getPath());
}
file = cache;
fos.close();
}
if (is != null) {
is.close();
}
cursor.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return file;
}
/**
* 用于保存拍照图片的uri
*/
private Uri mCameraUri;
@Override @Override
public void refreshAdapterByPosition(int position) { public void refreshAdapterByPosition(int position) {
if (infoMultiAdapter != null) { if (infoMultiAdapter != null) {
......
package com.gingersoft.supply_chain.mvp.ui.fragment.order; package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.gingersoft.gsa.cloud.common.utils.FileUtils;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.common.utils.glide.GlideUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils; import com.gingersoft.gsa.cloud.common.utils.time.TimeUtils;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerOrderDetailsComponent; import com.gingersoft.supply_chain.di.component.DaggerOrderDetailsComponent;
import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean; import com.gingersoft.supply_chain.mvp.bean.DeputyUnitBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean; import com.gingersoft.supply_chain.mvp.bean.PurchaseOrderDetailsBean;
import com.gingersoft.supply_chain.mvp.bean.WareHousingUnitBean;
import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract; import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract;
import com.gingersoft.supply_chain.mvp.presenter.OrderDetailsPresenter; import com.gingersoft.supply_chain.mvp.presenter.OrderDetailsPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.ImageAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.OrderDetailsFoodAdapter; import com.gingersoft.supply_chain.mvp.ui.adapter.OrderDetailsFoodAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment; import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.PurchaseListMorePopup;
import com.gingersoft.supply_chain.mvp.utils.SelectPicture;
import com.google.android.material.checkbox.MaterialCheckBox;
import com.jess.arms.di.component.AppComponent; import com.jess.arms.di.component.AppComponent;
import com.jess.arms.http.imageloader.ImageLoader;
import com.lxj.xpopup.XPopup;
import com.lxj.xpopup.core.ImageViewerPopupView;
import com.lxj.xpopup.enums.PopupPosition;
import com.lxj.xpopup.interfaces.OnSelectListener;
import com.lxj.xpopup.interfaces.XPopupImageLoader;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView; import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.QMUITopBar; import com.qmuiteam.qmui.widget.QMUITopBar;
import com.yalantis.ucrop.UCrop;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import static com.yalantis.ucrop.UCrop.REQUEST_CROP;
/** /**
* ================================================ * ================================================
* Description: 訂單詳情 * Description: 訂單詳情
*/ */
public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPresenter> implements OrderDetailsContract.View { public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPresenter> implements OrderDetailsContract.View, View.OnClickListener {
@BindView(R2.id.supply_top_bar) @BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar; QMUITopBar supplyTopBar;
@BindView(R2.id.tv_order_details_supplier_name) @BindView(R2.id.tv_order_details_supplier_name)
TextView tvOrderDetailsSupplierName; TextView tvOrderDetailsSupplierName;
@BindView(R2.id.tv_order_details_order_no)
TextView tvOrderDetailsOrderNo;
@BindView(R2.id.tv_order_details_create_time) @BindView(R2.id.tv_order_details_create_time)
TextView tvOrderDetailsCreateTime; TextView tvOrderDetailsCreateTime;
@BindView(R2.id.tv_order_details_order_state) @BindView(R2.id.tv_order_details_order_no)
TextView tvOrderDetailsOrderState; TextView tvOrderDetailsOrderNo;
@BindView(R2.id.tv_warehouse_order_no)
TextView tvWarehouseOrderNo;
@BindView(R2.id.layout_remarks)
LinearLayout layoutRemarks;
@BindView(R2.id.iv_order_state)
ImageView ivOrderState;
@BindView(R2.id.rv_order_details_pictures)
RecyclerView rvOrderDetailsPictures;
@BindView(R2.id.rv_order_details_food_name)
RecyclerView rvOrderDetailsFoodName;
@BindView(R2.id.rv_order_details_food_list) @BindView(R2.id.rv_order_details_food_list)
RecyclerView rvOrderDetailsFoodList; RecyclerView rvOrderDetailsFoodList;
@BindView(R2.id.cb_order_details_all_selected) @BindView(R2.id.cb_order_details_all_selected)
CheckBox cbOrderDetailsAllSelected; MaterialCheckBox cbOrderDetailsAllSelected;
@BindView(R2.id.tv_order_details_food_type_total) @BindView(R2.id.tv_order_details_food_type_total)
TextView tvOrderDetailsFoodTypeTotal; TextView tvOrderDetailsFoodTypeTotal;
@BindView(R2.id.tv_order_details_total_amount) @BindView(R2.id.tv_order_details_total_amount)
TextView tvOrderDetailsTotalAmount; TextView tvOrderDetailsTotalAmount;
@BindView(R2.id.tv_order_details_click_upload)
TextView tvOrderDetailsClickUpload;
@BindView(R2.id.ed_order_details_remark)
EditText edOrderDetailsRemark;
@BindView(R2.id.tv_order_details_buy_again)
QMUIAlphaTextView tvOrderDetailsBuyAgain;
@BindView(R2.id.tv_order_details_partial_receipt) @BindView(R2.id.tv_order_details_partial_receipt)
QMUIAlphaTextView tvOrderDetailsPartialReceipt; QMUIAlphaTextView tvOrderDetailsPartialReceipt;
@BindView(R2.id.tv_order_details_receipt) @BindView(R2.id.tv_order_details_receipt)
QMUIAlphaTextView tvOrderDetailsReceipt; QMUIAlphaTextView tvOrderDetailsReceipt;
@BindView(R2.id.ed_warehouse_order_remark)
EditText edRemark;
@BindView(R2.id.layout_ed_remark)
LinearLayout layoutEdRemark;
private OrderDetailsFoodAdapter orderDetailsFoodAdapter; private OrderDetailsFoodAdapter orderDetailsFoodAdapter;
private int typesOfFood = 0; private int typesOfFood = 0;
...@@ -77,6 +116,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -77,6 +116,7 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
// private int orderState = PurchaseOrderDetailsBean.WAIT_RECEIVED; // private int orderState = PurchaseOrderDetailsBean.WAIT_RECEIVED;
private final static String ORDER_DETAILS_ORDER_ID = "orderId"; private final static String ORDER_DETAILS_ORDER_ID = "orderId";
private final static String ORDER_STATE = "orderState"; private final static String ORDER_STATE = "orderState";
private int orderState;
public static OrderDetailsFragment newInstance(int orderId, int orderState) { public static OrderDetailsFragment newInstance(int orderId, int orderState) {
OrderDetailsFragment fragment = new OrderDetailsFragment(); OrderDetailsFragment fragment = new OrderDetailsFragment();
...@@ -99,24 +139,22 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -99,24 +139,22 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
@Override @Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_order_details, container, false); return inflater.inflate(R.layout.fragment_order_details_new, container, false);
} }
@Override @Override
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(supplyTopBar, "入庫單"); initTopBar(supplyTopBar, "入庫單");
supplyTopBar.addRightImageButton(R.drawable.ic_white_delete, R.id.qmui_delete_order).setOnClickListener(v -> { supplyTopBar.addRightImageButton(R.drawable.ic_white_more, R.id.id_more).setOnClickListener(this);
//刪除訂單 supplyTopBar.addRightImageButton(R.drawable.ic_take_pictures, R.id.id_take_pictures).setOnClickListener(this);
});
Bundle arguments = getArguments(); Bundle arguments = getArguments();
if (arguments != null) { if (arguments != null) {
int orderId = arguments.getInt(ORDER_DETAILS_ORDER_ID, 0); int orderId = arguments.getInt(ORDER_DETAILS_ORDER_ID, 0);
// orderState = arguments.getInt(ORDER_STATE, 0); orderState = arguments.getInt(ORDER_STATE, PurchaseOrderDetailsBean.WAIT_RECEIVED);
// if (orderState == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) { int isShow = orderState == PurchaseOrderDetailsBean.COMPLETE_RECEIVED ? View.GONE : View.VISIBLE;
// } else { tvOrderDetailsPartialReceipt.setVisibility(isShow);
tvOrderDetailsReceipt.setVisibility(isShow);
mPresenter.getOrderDetailsById(orderId); mPresenter.getOrderDetailsById(orderId);
// }
} else { } else {
showMessage("未獲取到訂單編號,請重試"); showMessage("未獲取到訂單編號,請重試");
killMyself(); killMyself();
...@@ -124,47 +162,94 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -124,47 +162,94 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
} }
@OnClick({R2.id.tv_order_details_click_upload, R2.id.tv_order_details_buy_again, R2.id.tv_order_details_partial_receipt, R2.id.tv_order_details_receipt}) @OnClick({R2.id.tv_order_details_partial_receipt, R2.id.tv_order_details_receipt, R2.id.layout_remarks})
@Override
public void onClick(View v) { public void onClick(View v) {
int viewId = v.getId(); int viewId = v.getId();
if (viewId == R.id.tv_order_details_click_upload) { if (viewId == R.id.id_take_pictures) {
//文件上傳 //拍照
if (mPresenter.getPicSize() < 4) {
} else if (viewId == R.id.tv_order_details_buy_again) { SelectPicture.getInstance().showSelectType(this);
//再次購買 } else {
ToastUtils.show(requireContext(), "最多只能上傳四張圖片");
}
} else if (viewId == R.id.id_more) {
//更多:刪除。發送。再次購買
String[] functions;
if (orderState == PurchaseOrderDetailsBean.COMPLETE_RECEIVED) {
functions = new String[]{"删除"};
} else {
functions = new String[]{"删除", "部分收貨", "收貨"};
}
new XPopup.Builder(mContext)
.atView(v)
.hasShadowBg(false)
.popupPosition(PopupPosition.Left)
.asCustom(new PurchaseListMorePopup(mContext)
.setStringData(functions, new int[]{R.drawable.ic_purchase_delete, R.drawable.ic_partial_receipt, R.drawable.ic_receipt})
.setOnSelectListener(mOnSelectListener))
.show();
} else if (viewId == R.id.tv_order_details_partial_receipt) { } else if (viewId == R.id.tv_order_details_partial_receipt) {
//部分收貨 //部分收貨
mPresenter.addWarehouse(PurchaseOrderDetailsBean.PART_RECEIVED, "", edOrderDetailsRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData()); mPresenter.addWarehouse(PurchaseOrderDetailsBean.PART_RECEIVED, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData());
setFragmentResult(RESULT_OK, null); // setFragmentResult(RESULT_OK, null);
} else if (viewId == R.id.tv_order_details_receipt) { } else if (viewId == R.id.tv_order_details_receipt) {
//收貨 //收貨
mPresenter.addWarehouse(PurchaseOrderDetailsBean.COMPLETE_RECEIVED, "", edOrderDetailsRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData()); mPresenter.addWarehouse(PurchaseOrderDetailsBean.COMPLETE_RECEIVED, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData());
// setFragmentResult(RESULT_OK, null);
} else if (viewId == R.id.layout_remarks) {
//備註,顯示備註輸入框
v.setVisibility(View.GONE);
layoutEdRemark.setVisibility(View.VISIBLE);
layoutRemarks.setVisibility(View.GONE);
}
}
private OnSelectListener mOnSelectListener = new OnSelectListener() {
@Override
public void onSelect(int position, String text) {
if (position == 0) {
//刪除
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> {
dialog.dismiss();
mPresenter.deleteOrder();
});
} else if (position == 1) {
//部分收貨
mPresenter.addWarehouse(PurchaseOrderDetailsBean.PART_RECEIVED, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData());
setFragmentResult(RESULT_OK, null);
} else if (position == 2) {
//收貨
mPresenter.addWarehouse(PurchaseOrderDetailsBean.COMPLETE_RECEIVED, edRemark.getText() + "", totalAmount, orderDetailsFoodAdapter.getData());
setFragmentResult(RESULT_OK, null); setFragmentResult(RESULT_OK, null);
} }
} }
};
@Override @Override
public void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean) { public void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean) {
tvOrderDetailsSupplierName.setText(orderDetailsBean.getSupplierName()); tvOrderDetailsSupplierName.setText(orderDetailsBean.getSupplierName());
tvOrderDetailsOrderNo.setText(orderDetailsBean.getOrderNo()); tvOrderDetailsOrderNo.setText(String.format(getString(R.string.str_format_purchase_no), orderDetailsBean.getOrderNo()));
tvOrderDetailsCreateTime.setText(TimeUtils.getStringByFormat(orderDetailsBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT_YMDHM)); tvOrderDetailsCreateTime.setText(TimeUtils.getStringByFormat(orderDetailsBean.getCreateTime(), TimeUtils.DEFAULT_DATE_FORMAT_YMDHM));
switch (orderDetailsBean.getStatus()) { // switch (orderDetailsBean.getStatus()) {
case PurchaseOrderDetailsBean.WAIT_RECEIVED: // case PurchaseOrderDetailsBean.WAIT_RECEIVED:
tvOrderDetailsOrderState.setText("待收貨"); // ivOrderState.setImageResource();
break; // tvOrderDetailsOrderState.setText("待收貨");
case PurchaseOrderDetailsBean.PART_RECEIVED: // break;
tvOrderDetailsOrderState.setText("部分收貨"); // case PurchaseOrderDetailsBean.PART_RECEIVED:
break; // tvOrderDetailsOrderState.setText("部分收貨");
case PurchaseOrderDetailsBean.COMPLETE_RECEIVED: // ivOrderState.setImageResource();
tvOrderDetailsOrderState.setText("已完成"); // break;
break; // case PurchaseOrderDetailsBean.COMPLETE_RECEIVED:
case PurchaseOrderDetailsBean.REFUSE_RECEIVED: // tvOrderDetailsOrderState.setText("已完成");
tvOrderDetailsOrderState.setText("拒收"); // ivOrderState.setImageResource();
break; // break;
default: // case PurchaseOrderDetailsBean.REFUSE_RECEIVED:
break; // ivOrderState.setImageResource();
} // break;
// default:
// break;
// }
setTypesOfFood(); setTypesOfFood();
initRecyclerView(orderDetailsBean); initRecyclerView(orderDetailsBean);
//全選按鈕狀態切換 //全選按鈕狀態切換
...@@ -187,6 +272,51 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -187,6 +272,51 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
}); });
} }
ImageAdapter imageAdapter;
@Override
public void uploadPicSuccess(String imgUrl) {
if (imageAdapter == null) {
imageAdapter = new ImageAdapter();
rvOrderDetailsPictures.setAdapter(imageAdapter);
rvOrderDetailsPictures.setLayoutManager(new GridLayoutManager(requireContext(), 4));
imageAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if (view.getId() == R.id.iv_img_delete) {
imageAdapter.removeAt(position);
mPresenter.deletePic(position);
} else if (view.getId() == R.id.iv_img) {
//預覽大圖
String pic = mPresenter.getPic(position);
if (TextUtil.isNotEmptyOrNullOrUndefined(pic)) {
new XPopup.Builder(requireContext())
.isDestroyOnDismiss(true)
.asImageViewer((ImageView) view, pic, true, Color.parseColor("#f1f1f1"), -1, 0, false, new ImageLoader())
.show();
}
}
});
}
imageAdapter.addData(imgUrl);
}
public static class ImageLoader implements XPopupImageLoader {
@Override
public void loadImage(int position, @NonNull Object url, @NonNull ImageView imageView) {
//必须指定Target.SIZE_ORIGINAL,否则无法拿到原图,就无法享用天衣无缝的动画
Glide.with(imageView).load(url).apply(new RequestOptions().override(Target.SIZE_ORIGINAL)).into(imageView);
}
@Override
public File getImageFile(@NonNull Context context, @NonNull Object uri) {
try {
return Glide.with(context).downloadOnly().load(uri).submit().get();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
private void setTypesOfFood() { private void setTypesOfFood() {
tvOrderDetailsFoodTypeTotal.setText(String.valueOf(typesOfFood)); tvOrderDetailsFoodTypeTotal.setText(String.valueOf(typesOfFood));
} }
...@@ -219,5 +349,59 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr ...@@ -219,5 +349,59 @@ public class OrderDetailsFragment extends BaseSupplyChainFragment<OrderDetailsPr
setTotalAmount(); setTotalAmount();
setTypesOfFood(); setTypesOfFood();
}); });
orderDetailsFoodAdapter.setOnItemChildClickListener((adapter, view, position) -> {
int id = view.getId();
if (id == R.id.layout_order_details_unit) {
//切換單位
PurchaseOrderDetailsBean.PurchaseOrderDetailsInfoVosBean purchaseOrderDetailsInfoVosBean = orderDetailsFoodAdapter.getData().get(position);
List<DeputyUnitBean> foodUnits = purchaseOrderDetailsInfoVosBean.getFoodUnits();
String[] units = new String[0];
if (foodUnits != null) {
units = new String[foodUnits.size()];
for (int i = 0; i < foodUnits.size(); i++) {
units[i] = foodUnits.get(i).getDeputyUnit();
}
}
if (units.length > 1) {
new XPopup.Builder(getContext())
.hasShadowBg(false)
.atView(view) // 依附于所点击的View,内部会自动判断在上方或者下方显示
.asAttachList(units,
null,
(position1, text) -> {
purchaseOrderDetailsInfoVosBean.setShowUnit(foodUnits.get(position1));
orderDetailsFoodAdapter.notifyItemChanged(position);
}).show();
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SelectPicture.CHOOSE_PHOTO && resultCode == RESULT_OK) {
//從相冊選取完圖片之後
if (data != null) {
Uri uri = data.getData();
if (uri != null) {
File file = SelectPicture.getInstance().uriToFileApiQ(requireContext(), uri);
SelectPicture.getInstance().crop(Uri.fromFile(file), this);
}
}
} else if (requestCode == SelectPicture.TAKE_PHOTO && resultCode == RESULT_OK) {
//拍照
//拍照完成後需要裁剪
SelectPicture.getInstance().crop(SelectPicture.getInstance().getmCameraUri(), this);
} else if (requestCode == REQUEST_CROP && resultCode == RESULT_OK && data != null) {
final Uri resultUri = UCrop.getOutput(data);
if (resultUri != null) {
String filePath = FileUtils.getFilePathByUri(mContext, resultUri);
if (!TextUtils.isEmpty(filePath)) {
mPresenter.uploadPic(filePath);
}
}
}
} }
} }
package com.gingersoft.supply_chain.mvp.ui.fragment.order; package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.app.Dialog;
import android.os.Bundle; import android.os.Bundle;
import android.text.InputFilter; import android.text.InputFilter;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -101,6 +102,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -101,6 +102,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
* 當前訂單列表類型的下標 * 當前訂單列表類型的下標
*/ */
private int orderStateIndex = 0; private int orderStateIndex = 0;
private final static int REQUEST_ORDER_DETAILS_CODE = 1001; private final static int REQUEST_ORDER_DETAILS_CODE = 1001;
@Override @Override
...@@ -125,7 +127,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -125,7 +127,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
edSearch.setFilters(new InputFilter[]{InputFilterUtils.getChAndEnAndNumInputFilter(mContext), InputFilterUtils.getLengthFilter(mContext, 20)}); edSearch.setFilters(new InputFilter[]{InputFilterUtils.getChAndEnAndNumInputFilter(mContext), InputFilterUtils.getLengthFilter(mContext, 20)});
btnNewOrder.setOnClickListener(v -> { btnNewOrder.setOnClickListener(v -> {
//跳轉到下單頁面 //跳轉到下單頁面
start(FoodIngredientsFragment.newInstance(ADD_ORDER)); startForResult(FoodIngredientsFragment.newInstance(ADD_ORDER), REQUEST_ORDER_DETAILS_CODE);
}); });
loadService = LoadSir.getDefault().register(loadBg, (Callback.OnReloadListener) v -> getOrderList()); loadService = LoadSir.getDefault().register(loadBg, (Callback.OnReloadListener) v -> getOrderList());
refreshPurchaseList.setOnRefreshListener(refreshLayout -> { refreshPurchaseList.setOnRefreshListener(refreshLayout -> {
...@@ -173,7 +175,10 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -173,7 +175,10 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color)); .setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
purchaseOrderAdapter = new PurchaseOrderAdapter(null); purchaseOrderAdapter = new PurchaseOrderAdapter(null);
purchaseOrderAdapter.setOnItemClickListener((adapter, view, position) -> startForResult(OrderDetailsFragment.newInstance(purchaseOrderAdapter.getData().get(position).getId(), orderState[orderStateIndex]), REQUEST_ORDER_DETAILS_CODE)); //訂單詳情
purchaseOrderAdapter.setOnItemClickListener((adapter, view, position) ->
startForResult(OrderDetailsFragment.newInstance(purchaseOrderAdapter.getData().get(position).getId(), orderState[orderStateIndex]), REQUEST_ORDER_DETAILS_CODE)
);
purchaseOrderAdapter.setOnItemChildClickListener((adapter, view, position) -> { purchaseOrderAdapter.setOnItemChildClickListener((adapter, view, position) -> {
int viewId = view.getId(); int viewId = view.getId();
if (viewId == R.id.iv_purchase_order_more) { if (viewId == R.id.iv_purchase_order_more) {
...@@ -183,22 +188,15 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -183,22 +188,15 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
.hasShadowBg(false) .hasShadowBg(false)
.popupPosition(PopupPosition.Left) .popupPosition(PopupPosition.Left)
.asCustom(new PurchaseListMorePopup(mContext) .asCustom(new PurchaseListMorePopup(mContext)
.setStringData(new String[]{"删除", "发送", "再次购买"}, new int[]{R.drawable.ic_purchase_delete, R.drawable.ic_purchase_send, R.drawable.ic_purchase_buy_again}) //, "再次购买" , R.drawable.ic_purchase_buy_again
.setOnSelectListener((position1, text) -> { .setStringData(new String[]{"删除", "发送"}, new int[]{R.drawable.ic_purchase_delete, R.drawable.ic_purchase_send})
if (position1 == 2) { .setOnSelectListener(mOnSelectListener))
//發送
//發送採購單
sendPurchase(position);
}
}))
.show(); .show();
} }
}); });
PurchasePageAdapter adapter = new PurchasePageAdapter(purchaseOrderAdapter, 2); PurchasePageAdapter adapter = new PurchasePageAdapter(purchaseOrderAdapter, 2);
contentViewPager.setAdapter(adapter); contentViewPager.setAdapter(adapter);
mTabSegment.setupWithViewPager(contentViewPager); mTabSegment.setupWithViewPager(contentViewPager);
//new QMUITabIndicator(
// QMUIDisplayHelper.dp2px(getContext(), 2), false, false)
QMUITabIndicator qmuiTabIndicator = new QMUITabIndicator( QMUITabIndicator qmuiTabIndicator = new QMUITabIndicator(
ContextCompat.getDrawable(mContext, R.drawable.ic_open_close), false, false, ContextCompat.getColor(mContext, R.color.color_3c)); ContextCompat.getDrawable(mContext, R.drawable.ic_open_close), false, false, ContextCompat.getColor(mContext, R.color.color_3c));
mTabSegment.setIndicator(qmuiTabIndicator); mTabSegment.setIndicator(qmuiTabIndicator);
...@@ -230,6 +228,22 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -230,6 +228,22 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
}); });
} }
private OnSelectListener mOnSelectListener = new OnSelectListener() {
@Override
public void onSelect(int position, String text) {
if (position == 0) {
//刪除
AppDialog.getInstance().showWaringDialog(mContext, "是否刪除訂單", (view1, dialog) -> {
dialog.dismiss();
mPresenter.deleteOrder(position, purchaseOrderAdapter.getData().get(position).getId());
});
} else if (position == 1) {
//發送採購單
sendPurchase(position);
}
}
};
private void sendPurchase(int position) { private void sendPurchase(int position) {
List<OrderBean> data = purchaseOrderAdapter.getData(); List<OrderBean> data = purchaseOrderAdapter.getData();
OrderBean orderBean = data.get(position); OrderBean orderBean = data.get(position);
...@@ -293,8 +307,8 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr ...@@ -293,8 +307,8 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
@Override @Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) { public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data); super.onFragmentResult(requestCode, resultCode, data);
if (requestCode == REQUEST_ORDER_DETAILS_CODE && resultCode == RESULT_OK) { if (requestCode == REQUEST_ORDER_DETAILS_CODE) {
//用戶進行了收貨操作,需要對列表進行刷新 // //用戶對訂單進行了操作,需要對列表進行刷新
getOrderList(); getOrderList();
} }
} }
......
...@@ -104,9 +104,9 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -104,9 +104,9 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
} }
} }
@Override @Override
public void shareThirdApp(String url, int type) { public void shareThirdApp(String url, int type) {
ClipboardUtils.copyText(url);
if (type == Whatsapp) { if (type == Whatsapp) {
//分享到WhatsApp //分享到WhatsApp
DeviceUtils.shareWhatsApp(mContext, url); DeviceUtils.shareWhatsApp(mContext, url);
...@@ -117,7 +117,6 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i ...@@ -117,7 +117,6 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
DeviceUtils.shareLine(mContext, "", url); DeviceUtils.shareLine(mContext, "", url);
} else if (type == Kakao_Talk) { } else if (type == Kakao_Talk) {
//分享到kakao //分享到kakao
ClipboardUtils.copyText(url);
ToastUtils.show(mContext, "暫未開放此app發送,訂單已複製,請手動打開Kakao粘貼發送"); ToastUtils.show(mContext, "暫未開放此app發送,訂單已複製,請手動打開Kakao粘貼發送");
} }
} }
......
package com.gingersoft.supply_chain.mvp.ui.fragment.order; package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.app.Dialog;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -10,9 +13,11 @@ import android.widget.TextView; ...@@ -10,9 +13,11 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.gingersoft.gsa.cloud.common.utils.MoneyUtil; import com.gingersoft.gsa.cloud.common.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2; import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerShoppingCatComponent; import com.gingersoft.supply_chain.di.component.DaggerShoppingCatComponent;
...@@ -54,6 +59,8 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -54,6 +59,8 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
TextView tvOrderContentTotalAmount; TextView tvOrderContentTotalAmount;
@BindView(R2.id.ed_order_content_remark) @BindView(R2.id.ed_order_content_remark)
EditText edOrderContentRemark; EditText edOrderContentRemark;
@BindView(R2.id.tv_order_content_complete)
TextView tvConfirm;
private ShoppingCartAdapter shoppingCartAdapter; private ShoppingCartAdapter shoppingCartAdapter;
/** /**
...@@ -64,6 +71,12 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -64,6 +71,12 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
* 總金額 * 總金額
*/ */
private double totalAmount = 0; private double totalAmount = 0;
/**
* 是否可以創建訂單按鈕的背景
*/
private Drawable canClick;
private Drawable notCanClick;
public static ShoppingCatFragment newInstance() { public static ShoppingCatFragment newInstance() {
ShoppingCatFragment fragment = new ShoppingCatFragment(); ShoppingCatFragment fragment = new ShoppingCatFragment();
...@@ -89,6 +102,9 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -89,6 +102,9 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
public void initData(@Nullable Bundle savedInstanceState) { public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(topBar, "採購單"); initTopBar(topBar, "採購單");
mPresenter.organizeShopCartData(); mPresenter.organizeShopCartData();
canClick = ContextCompat.getDrawable(requireContext(), R.drawable.shape_app_btn);
notCanClick = ContextCompat.getDrawable(requireContext(), R.drawable.shape_btn_unclick);
cbOrderContentAllSelect.setOnCheckedChangeListener((buttonView, isChecked) -> { cbOrderContentAllSelect.setOnCheckedChangeListener((buttonView, isChecked) -> {
//全選 //全選
if (buttonView.isPressed()) { if (buttonView.isPressed()) {
...@@ -105,7 +121,12 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -105,7 +121,12 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
int viewId = v.getId(); int viewId = v.getId();
if (viewId == R.id.tv_order_content_complete) { if (viewId == R.id.tv_order_content_complete) {
//完成,篩選出選擇的食品 //完成,篩選出選擇的食品
mPresenter.filterData(shoppingCartAdapter.getData()); if (mPresenter.filterData(shoppingCartAdapter.getData())) {
AppDialog.getInstance().showWaringDialog(requireContext(), "確認創建訂單?", (view, dialog) -> {
dialog.dismiss();
mPresenter.createOrder(shoppingCartAdapter.getData());
});
}
} else if (viewId == R.id.btn_order_content_order_template) { } else if (viewId == R.id.btn_order_content_order_template) {
//訂單模板 //訂單模板
...@@ -122,18 +143,20 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -122,18 +143,20 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
public void loadAdapter(List<ShoppingCartBean> shoppingCartBeans) { public void loadAdapter(List<ShoppingCartBean> shoppingCartBeans) {
shoppingCartAdapter = new ShoppingCartAdapter(mContext, shoppingCartBeans); shoppingCartAdapter = new ShoppingCartAdapter(mContext, shoppingCartBeans);
shoppingCartAdapter.setOnFoodDeleteListener((supplierIndex, foodListVosBean) -> { shoppingCartAdapter.setOnFoodDeleteListener((supplierIndex, foodListVosBean) -> {
//刪除食品之後,這個供應商下面沒有食材才會調用這裡
//從購物車元數據移除掉這個食材 //從購物車元數據移除掉這個食材
SupplyShoppingCart.getInstance().getCartFoods().remove(foodListVosBean); SupplyShoppingCart.getInstance().getCartFoods().remove(foodListVosBean);
List<ShoppingCartBean> shoppingCartAdapterData = shoppingCartAdapter.getData(); List<ShoppingCartBean> shoppingCartAdapterData = shoppingCartAdapter.getData();
//購物車adapter移除這個供應商
if (shoppingCartAdapterData.get(supplierIndex).getFoodList().size() <= 0) {
shoppingCartAdapter.removeAt(supplierIndex);
if (foodListVosBean.isChecked()) { if (foodListVosBean.isChecked()) {
totalSpecies = MoneyUtil.sub(totalSpecies, 1); totalSpecies = MoneyUtil.sub(totalSpecies, 1);
totalAmount = MoneyUtil.sub(totalAmount, shoppingCartAdapterData.get(supplierIndex).getSelectFoodAmount()); totalAmount = MoneyUtil.sub(totalAmount, MoneyUtil.priceCalculation(foodListVosBean.getUnitPrice(), foodListVosBean.getFoodQuantity()));
setTotalInfo(totalSpecies, totalAmount); setTotalInfo(totalSpecies, totalAmount);
} }
//購物車adapter移除這個供應商 }
shoppingCartAdapter.removeAt(supplierIndex);
setAllSelect(shoppingCartAdapterData); setAllSelect(shoppingCartAdapterData);
mPresenter.verificationMixAmount(shoppingCartAdapter.getData());
}); });
rvOrderContent.setAdapter(shoppingCartAdapter); rvOrderContent.setAdapter(shoppingCartAdapter);
setAllSelect(shoppingCartBeans); setAllSelect(shoppingCartBeans);
...@@ -144,6 +167,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -144,6 +167,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
setTotalInfo(totalSpecies, totalAmount); setTotalInfo(totalSpecies, totalAmount);
//這裡應該可以再加一個回調接口,用來專門處理食材的選中狀態切換 //這裡應該可以再加一個回調接口,用來專門處理食材的選中狀態切換
setAllSelect(shoppingCartAdapter.getData()); setAllSelect(shoppingCartAdapter.getData());
mPresenter.verificationMixAmount(shoppingCartAdapter.getData());
}); });
} }
...@@ -187,4 +211,10 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres ...@@ -187,4 +211,10 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
rvOrderContent.scrollToPosition(position); rvOrderContent.scrollToPosition(position);
} }
} }
@Override
public void setCreateBtnState(boolean checkable) {
// tvConfirm.setBackground(checkable ? canClick : notCanClick);
// tvConfirm.setClickable(checkable);
}
} }
...@@ -105,8 +105,7 @@ public class NewSupplierFragment extends BaseSupplyChainFragment<NewSupplierPres ...@@ -105,8 +105,7 @@ public class NewSupplierFragment extends BaseSupplyChainFragment<NewSupplierPres
//刪除供應商 //刪除供應商
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> { new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> {
dialog.dismiss(); dialog.dismiss();
supplierBean.setDeletes(Constant.DELETE); mPresenter.deleteSupplier(supplierBean.getId());
mPresenter.updateSupplier();
}); });
} else if (viewId == R.id.btn_save_supplier) { } else if (viewId == R.id.btn_save_supplier) {
//保存 //保存
......
...@@ -225,7 +225,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr ...@@ -225,7 +225,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> { new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> {
dialog.dismiss(); dialog.dismiss();
List<SupplierInfoBean> data = supplierAdapter.getData(); List<SupplierInfoBean> data = supplierAdapter.getData();
mPresenter.deleteSupplier(data.get(position), position); mPresenter.deleteSupplier(data.get(position).getId(), position);
}); });
} else if (view.getId() == R.id.layout_supplier_food_info) { } else if (view.getId() == R.id.layout_supplier_food_info) {
//跳轉到供應商食品詳情 //跳轉到供應商食品詳情
......
...@@ -14,6 +14,9 @@ import androidx.annotation.Nullable; ...@@ -14,6 +14,9 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemChildClickListener;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback; import com.gingersoft.gsa.cloud.common.loadsir.EmptyCallback;
import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback; import com.gingersoft.gsa.cloud.common.loadsir.ErrorCallback;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
...@@ -178,19 +181,20 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList ...@@ -178,19 +181,20 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
} else { } else {
loadService.showSuccess(); loadService.showSuccess();
} }
// WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean purchaseWarehousingOrderDetailsVosBean = new WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean();
// purchaseWarehousingOrderDetailsVosBean.setName("食材名");
// purchaseWarehousingOrderDetailsVosBean.setCateName("食材種類");
// purchaseWarehousingOrderDetailsVosBean.setSupplierName("供應商");
// purchaseWarehousingOrderDetailsVosBean.setBasicUnitName("單位");
// purchaseWarehousingOrderDetailsVosBean.setFoodPrice("單價");
// purchaseWarehousingOrderDetailsVosBean.setFoodNum("庫存數量");
// purchaseWarehousingOrderDetailsVosBean.setFoodAmount("總價");
// purchaseWarehousingOrderDetailsVos.add(0, purchaseWarehousingOrderDetailsVosBean);
if (warehousingQueryAdapter == null) { if (warehousingQueryAdapter == null) {
warehousingQueryAdapter = new WarehousingQueryAdapter(mContext, purchaseWarehousingOrderDetailsVos); warehousingQueryAdapter = new WarehousingQueryAdapter(mContext, purchaseWarehousingOrderDetailsVos);
rvWarehouseList.setLayoutManager(new LinearLayoutManager(mContext)); rvWarehouseList.setLayoutManager(new LinearLayoutManager(mContext));
rvWarehouseList.setAdapter(warehousingQueryAdapter); rvWarehouseList.setAdapter(warehousingQueryAdapter);
warehousingQueryAdapter.setOnItemChildClickListener((adapter, view, position) -> {
if(view.getId() == R.id.tv_warehouse_item_inventory_quantity){
//點擊庫存數量,進入庫存盤點
start(WarehousingInventoryFragment.newInstance(warehousingQueryAdapter.getItem(position)));
}
});
warehousingQueryAdapter.setOnItemClickListener((adapter, view, position) -> {
//進入庫存詳情
start(WarehouseDetailsFragment.newInstance(warehousingQueryAdapter.getItem(position)));
});
} else { } else {
warehousingQueryAdapter.setList(purchaseWarehousingOrderDetailsVos); warehousingQueryAdapter.setList(purchaseWarehousingOrderDetailsVos);
} }
......
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.di.component.DaggerWareHousingDetailsComponent;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
import com.gingersoft.supply_chain.mvp.presenter.WareHousingDetailsPresenter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent;
/**
* ================================================
* Description: 入庫庫存詳情
*/
public class WareHousingDetailsFragment extends BaseSupplyChainFragment<WareHousingDetailsPresenter> implements WareHousingDetailsContract.View {
public static WareHousingDetailsFragment newInstance() {
WareHousingDetailsFragment fragment = new WareHousingDetailsFragment();
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerWareHousingDetailsComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_ware_housing_details, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager2.widget.ViewPager2;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehouseDetailsComponent;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
import com.gingersoft.supply_chain.mvp.bean.WarehouseDetailsBean;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehouseDetailsPresenter;
import com.gingersoft.supply_chain.mvp.ui.adapter.PurchasePageAdapter;
import com.gingersoft.supply_chain.mvp.ui.adapter.WareHousingDetailsAdapter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.gingersoft.supply_chain.mvp.ui.widget.InventoryConsumptionPopup;
import com.jess.arms.di.component.AppComponent;
import com.lxj.xpopup.XPopup;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import java.util.Arrays;
import java.util.List;
import butterknife.BindView;
/**
* Description: 入庫詳情
*/
public class WarehouseDetailsFragment extends BaseSupplyChainFragment<WarehouseDetailsPresenter> implements WarehouseDetailsContract.View {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.tv_warehouse_inventory_number)
TextView tvWarehouseInventoryNumber;
@BindView(R2.id.tv_warehouse_specifications)
TextView tvWarehouseSpecifications;
@BindView(R2.id.tv_warehouse_unit_price)
TextView tvWarehouseUnitPrice;
@BindView(R2.id.tv_warehouse_total_amount)
TextView tvWarehouseTotalAmount;
@BindView(R2.id.tv_warehousing_record)
TextView tvWarehousingRecord;
@BindView(R2.id.tv_outbound_record)
TextView tvOutboundRecord;
@BindView(R2.id.vp_warehouse_viewpager)
ViewPager2 vpWarehouseViewpager;
@BindView(R2.id.srl_warehouse_details_list)
SmartRefreshLayout smartRefreshLayout;
private final static String FOOD_NAME_KEY = "foodNameKey";
private final static String FOOD_ID_KEY = "foodIdKey";
private final static String FOOD_UNIT_KEY = "foodUnitKey";
private final static String FOOD_NUM_KEY = "foodNumKey";
public static WarehouseDetailsFragment newInstance(WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean purchaseWarehousingOrderDetailsVosBean) {
WarehouseDetailsFragment fragment = new WarehouseDetailsFragment();
Bundle bundle = new Bundle();
bundle.putString(FOOD_NAME_KEY, purchaseWarehousingOrderDetailsVosBean.getName());
bundle.putInt(FOOD_ID_KEY, purchaseWarehousingOrderDetailsVosBean.getId());
bundle.putString(FOOD_UNIT_KEY, purchaseWarehousingOrderDetailsVosBean.getBasicUnitName());
bundle.putInt(FOOD_NUM_KEY, purchaseWarehousingOrderDetailsVosBean.getFoodNum());
fragment.setArguments(bundle);
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerWarehouseDetailsComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_warehouse_details, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
Bundle arguments = getArguments();
smartRefreshLayout.setEnableHeaderTranslationContent(false).
setEnableFooterTranslationContent(false);
if (arguments != null) {
initTopBar(supplyTopBar, arguments.getString(FOOD_NAME_KEY));
int foodId = arguments.getInt(FOOD_ID_KEY);
String foodUnit = arguments.getString(FOOD_UNIT_KEY);
int foodNum = arguments.getInt(FOOD_NUM_KEY);
mPresenter.getWarehousingOrderDetails(foodId, foodUnit);
if (foodNum > 0) {
//獲取庫存消耗的原因列表
mPresenter.getWarehouseInventoryReason();
Button button = supplyTopBar.addRightTextButton(R.string.str_inventory_consumption, R.id.id_inventory_consumption);
button.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
button.setOnClickListener(v -> {
//庫存消耗
new XPopup.Builder(requireContext())
.asCustom(new InventoryConsumptionPopup(requireContext(), Arrays.asList("正常消耗", "退貨消耗", "過期消耗", "其他消耗"), 10, (consumptionNum, reasonIndex, remarks) -> {
})).show();
});
}
initViewPager();
}
}
private void initViewPager() {
vpWarehouseViewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
}
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
if (position == 0) {
tvWarehousingRecord.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
tvWarehousingRecord.setBackground(ContextCompat.getDrawable(requireContext(), R.drawable.shape_left_themecolor_radius_btn));
tvOutboundRecord.setTextColor(ContextCompat.getColor(requireContext(), R.color.color_3c));
tvOutboundRecord.setBackground(ContextCompat.getDrawable(requireContext(), R.drawable.shape_right_white_radius_btn));
} else {
tvOutboundRecord.setTextColor(ContextCompat.getColor(requireContext(), R.color.white));
tvOutboundRecord.setBackground(ContextCompat.getDrawable(requireContext(), R.drawable.shape_left_themecolor_radius_btn));
tvWarehousingRecord.setTextColor(ContextCompat.getColor(requireContext(), R.color.color_3c));
tvWarehousingRecord.setBackground(ContextCompat.getDrawable(requireContext(), R.drawable.shape_right_white_radius_btn));
}
}
@Override
public void onPageScrollStateChanged(int state) {
super.onPageScrollStateChanged(state);
}
});
}
private WareHousingDetailsAdapter wareHousingDetailsAdapter;
@Override
public void loadWarehousing(WarehouseDetailsBean warehouseDetailsBean) {
loadAdapter(warehouseDetailsBean.getPurchaseWarehousingOrderDetailsContents());
PurchasePageAdapter adapter = new PurchasePageAdapter(wareHousingDetailsAdapter, 2);
vpWarehouseViewpager.setAdapter(adapter);
}
@Override
public void loadAdapter(List<WarehouseDetailsBean.PurchaseWarehousingOrderDetailsContentsBean> purchaseWarehousingOrderDetailsContents) {
if (wareHousingDetailsAdapter == null) {
wareHousingDetailsAdapter = new WareHousingDetailsAdapter(purchaseWarehousingOrderDetailsContents);
} else {
wareHousingDetailsAdapter.setList(purchaseWarehousingOrderDetailsContents);
}
}
}
package com.gingersoft.supply_chain.mvp.ui.fragment.warehouse;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.gingersoft.supply_chain.R;
import com.gingersoft.supply_chain.R2;
import com.gingersoft.supply_chain.di.component.DaggerWarehousingInventoryComponent;
import com.gingersoft.supply_chain.mvp.bean.WareHouseListBean;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
import com.gingersoft.supply_chain.mvp.presenter.WarehousingInventoryPresenter;
import com.gingersoft.supply_chain.mvp.ui.fragment.BaseSupplyChainFragment;
import com.jess.arms.di.component.AppComponent;
import com.qmuiteam.qmui.widget.QMUITopBar;
import butterknife.BindView;
/**
* Description: 庫存盤點
*/
public class WarehousingInventoryFragment extends BaseSupplyChainFragment<WarehousingInventoryPresenter> implements WarehousingInventoryContract.View {
@BindView(R2.id.supply_top_bar)
QMUITopBar supplyTopBar;
@BindView(R2.id.iv_warehouse_img)
ImageView ivWarehouseImg;
@BindView(R2.id.tv_warehouse_total)
TextView tvWarehouseTotal;
@BindView(R2.id.tv_warehouse_difference)
TextView tvWarehouseDifference;
@BindView(R2.id.ed_warehouse_loss)
EditText edWarehouseLoss;
private final static String FOOD_NAME_KEY = "foodNameKey";
private final static String FOOD_ID_KEY = "foodIdKey";
private final static String FOOD_NUM_KEY = "foodNumKey";
public static WarehousingInventoryFragment newInstance(WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean purchaseWarehousingOrderDetailsVosBean) {
WarehousingInventoryFragment fragment = new WarehousingInventoryFragment();
Bundle bundle = new Bundle();
bundle.putString(FOOD_NAME_KEY, purchaseWarehousingOrderDetailsVosBean.getName());
bundle.putInt(FOOD_ID_KEY, purchaseWarehousingOrderDetailsVosBean.getId());
bundle.putInt(FOOD_NUM_KEY, purchaseWarehousingOrderDetailsVosBean.getFoodNum());
fragment.setArguments(bundle);
return fragment;
}
@Override
public void setupFragmentComponent(@NonNull AppComponent appComponent) {
DaggerWarehousingInventoryComponent //如找不到该类,请编译一下项目
.builder()
.appComponent(appComponent)
.view(this)
.build()
.inject(this);
}
@Override
public View initView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_warehousing_inventory, container, false);
}
@Override
public void initData(@Nullable Bundle savedInstanceState) {
Bundle arguments = getArguments();
if (arguments != null) {
int foodId = arguments.getInt(FOOD_ID_KEY);
String foodName = arguments.getString(FOOD_NAME_KEY);
int foodNum = arguments.getInt(FOOD_NUM_KEY);
//初始化標題
initTopBar(supplyTopBar, foodName);
supplyTopBar.addRightTextButton(R.string.str_save, R.id.id_save).setOnClickListener(mOnClickListener);
//庫存數量
tvWarehouseTotal.setText(String.valueOf(foodNum));
} else {
showMessage("獲取食材信息失敗,請稍候重試");
killMyself();
}
}
private View.OnClickListener mOnClickListener = v -> {
if(v.getId() == R.id.id_save){
//保存
// edWarehouseLoss.getText()
}
};
}
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import androidx.annotation.NonNull;
import com.lxj.xpopup.core.CenterPopupView;
import com.lxj.xpopup.core.ImageViewerPopupView;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/22
* Time: 21:18
* Use:
*/
public class BigImagePopup extends ImageViewerPopupView {
public BigImagePopup(@NonNull Context context) {
super(context);
}
@Override
protected void onCreate() {
super.onCreate();
}
}
...@@ -4,13 +4,17 @@ import android.content.Context; ...@@ -4,13 +4,17 @@ import android.content.Context;
import android.text.InputFilter; import android.text.InputFilter;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils; import com.gingersoft.gsa.cloud.common.utils.inputFilter.InputFilterUtils;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.gingersoft.supply_chain.R; import com.gingersoft.supply_chain.R;
import com.lxj.xpopup.impl.ConfirmPopupView; import com.lxj.xpopup.impl.ConfirmPopupView;
import com.lxj.xpopup.impl.InputConfirmPopupView; import com.lxj.xpopup.impl.InputConfirmPopupView;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
/** /**
* @author 宇航. * @author 宇航.
...@@ -22,23 +26,37 @@ import com.lxj.xpopup.impl.InputConfirmPopupView; ...@@ -22,23 +26,37 @@ import com.lxj.xpopup.impl.InputConfirmPopupView;
public class CategoryPopup extends ConfirmPopupView { public class CategoryPopup extends ConfirmPopupView {
private boolean showDelete; private boolean showDelete;
private EditText et_input; private EditText et_input;
private OnClickListener onDeleteListener;
private String inputText;
public CategoryPopup(@NonNull Context context, CharSequence title, CharSequence content, CharSequence hint, boolean showDelete) { public CategoryPopup(@NonNull Context context, CharSequence title, CharSequence content, CharSequence hint, String inputText, boolean showDelete) {
super(context, R.layout.dialog_new_category); super(context, R.layout.dialog_new_category);
setTitleContent(title, content, hint); setTitleContent(title, content, hint);
this.showDelete = showDelete; this.showDelete = showDelete;
this.inputText = inputText;
} }
@Override @Override
protected void onCreate() { protected void onCreate() {
super.onCreate(); super.onCreate();
findViewById(R.id.iv_create_category_close).setOnClickListener(v -> dialog.dismiss()); findViewById(R.id.iv_create_category_close).setOnClickListener(v -> dialog.dismiss());
findViewById(R.id.tv_cancel).setVisibility(showDelete ? View.VISIBLE : GONE); QMUIAlphaTextView tvDelete = findViewById(R.id.tv_category_delete);
tvDelete.setVisibility(showDelete ? View.VISIBLE : GONE);
tvDelete.setOnClickListener(onDeleteListener);
et_input = findViewById(R.id.et_input); et_input = findViewById(R.id.et_input);
et_input.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), 4), InputFilterUtils.getChAndEnAndNumInputFilter(getContext())}); et_input.setFilters(new InputFilter[]{InputFilterUtils.getLengthFilter(getContext(), 4), InputFilterUtils.getChAndEnAndNumInputFilter(getContext())});
if (TextUtil.isNotEmptyOrNullOrUndefined(inputText)) {
et_input.setText(inputText);
et_input.setSelection(inputText.length());
}
} }
public EditText getEditText() { public EditText getEditText() {
return et_input; return et_input;
} }
public CategoryPopup setOnDeleteListener(OnClickListener onDeleteListener) {
this.onDeleteListener = onDeleteListener;
return this;
}
} }
package com.gingersoft.supply_chain.mvp.ui.widget;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.supply_chain.R;
import com.lxj.xpopup.impl.InputConfirmPopupView;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author 宇航.
* User: admin
* Date: 2021/1/22
* Time: 10:47
* Use: 庫存消耗彈窗
*/
public class InventoryConsumptionPopup extends InputConfirmPopupView {
/**
* 庫存損耗原因
*/
private List<String> consumptionReasons;
private EditText edRemarks;
private RecyclerView rvConsumptionReason;
private OnConfirmClickListener onConfirmClickListener;
private int maxConsumption;
/**
* @param context
* @param consumptionReasons 庫存消耗原因
* @param maxConsumption 最大消耗數
* @param onConfirmClickListener 確認按鈕回調
*/
public InventoryConsumptionPopup(@NonNull Context context, List<String> consumptionReasons, int maxConsumption, OnConfirmClickListener onConfirmClickListener) {
super(context, R.layout.popup_inventory_consumption);
this.consumptionReasons = consumptionReasons;
this.onConfirmClickListener = onConfirmClickListener;
this.maxConsumption = maxConsumption;
}
@Override
protected void onCreate() {
super.onCreate();
edRemarks = findViewById(R.id.ed_inventory_consumption_remark);
rvConsumptionReason = findViewById(R.id.rv_inventory_consumption_reason);
ConsumptionReasonAdapter consumptionReasonAdapter = new ConsumptionReasonAdapter();
consumptionReasonAdapter.setOnItemClickListener((adapter, view, position) -> consumptionReasonAdapter.setSelectIndex(position));
rvConsumptionReason.setLayoutManager(new GridLayoutManager(getContext(), 2));
rvConsumptionReason.setAdapter(consumptionReasonAdapter);
findViewById(R.id.tv_confirm).setOnClickListener(v -> {
if (onConfirmClickListener != null) {
String s = getEditText().getText().toString();
try {
int i = Integer.parseInt(s);
if (i > 0) {
if (i > maxConsumption) {
getEditText().setError("不能超過當前庫存數量:" + maxConsumption);
} else {
onConfirmClickListener.onConfirm(i, consumptionReasonAdapter.getSelectIndex(), edRemarks.getText().toString());
}
} else {
ToastUtils.show(getContext(), "請輸入消耗庫存數");
getEditText().setError("請輸入消耗庫存數");
}
} catch (NumberFormatException e) {
e.printStackTrace();
ToastUtils.show(getContext(), "請輸入消耗庫存數");
getEditText().setError("請輸入消耗庫存數");
}
}
});
getEditText().addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
try {
int i = Integer.parseInt(s.toString());
if (i > maxConsumption) {
getEditText().setError("不能超過當前庫存數量:" + maxConsumption);
}
} catch (NumberFormatException e) {
e.printStackTrace();
}
}
});
}
public interface OnConfirmClickListener {
/**
* 確認時,將消耗的庫存,原因,備註傳遞回去
* @param consumptionNum 消耗的庫存數量
* @param reasonIndex 原因下標
* @param remarks 備註
*/
void onConfirm(int consumptionNum, int reasonIndex, String remarks);
}
private class ConsumptionReasonAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
private int selectIndex = 0;
public ConsumptionReasonAdapter() {
super(R.layout.item_consumption_reason, consumptionReasons);
}
@Override
protected void convert(@NotNull BaseViewHolder viewHolder, String s) {
AppCompatCheckBox compatCheckBox = viewHolder.getView(R.id.cb_consumption_reason);
compatCheckBox.setText(s);
compatCheckBox.setChecked(viewHolder.getAdapterPosition() == selectIndex);
}
public int getSelectIndex() {
return selectIndex;
}
public void setSelectIndex(int selectIndex) {
if (this.selectIndex < getData().size()) {
notifyItemChanged(this.selectIndex);
}
this.selectIndex = selectIndex;
if (this.selectIndex < getData().size()) {
notifyItemChanged(this.selectIndex);
}
}
}
}
package com.gingersoft.supply_chain.mvp.utils;//package com.gingersoft.supply_chain.mvp.utils; package com.gingersoft.supply_chain.mvp.utils;//package com.gingersoft.supply_chain.mvp.utils;
//
//import android.Manifest;
//import android.app.Activity;
//import android.content.ContentValues;
//import android.content.Context;
//import android.content.Intent;
//import android.net.Uri;
//import android.os.Build;
//import android.os.Environment;
//import android.provider.MediaStore;
//
//import androidx.core.content.FileProvider;
//import androidx.core.os.EnvironmentCompat;
//
//import com.gingersoft.gsa.cloud.common.ui.utils.AppDialog;
//import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
//import com.permissionx.guolindev.PermissionX;
//import com.permissionx.guolindev.callback.RequestCallback;
//
//import java.io.File;
//import java.io.IOException;
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.Locale;
//
//import static com.gingersoft.gsa.cloud.common.ui.adapter.multi.MultiUploadPicProvider.CHOOSE_PHOTO;
//
///**
// * @author 宇航.
// * User: admin
// * Date: 2020/12/25
// * Time: 11:29
// * Use:
// */
//public class SelectPicture {
// private static SelectPicture selectPicture;
//
// public static SelectPicture getInstance(){
// if(selectPicture == null){
// selectPicture = new SelectPicture();
// }
// return selectPicture;
// }
//
// final String[] items = new String[]{"拍照", "從相冊選擇", "取消"};
// public static final int CHOOSE_PHOTO = 101;
// public static final int TAKE_PHOTO = 102;
// public static final int TAKE_PHOTO_CUT = 103;
//
// public void showPictureChoice(Context context) {
// AppDialog.getInstance().showListDialog(context, items, (view, dialog, position) -> {
// if (position == 0) {
// takePhoto(context);
// } else if (position == 1) {
// Intent intentToPickPic = new Intent(Intent.ACTION_PICK, null);
// intentToPickPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
// ((Activity) context).startActivityForResult(intentToPickPic, CHOOSE_PHOTO);
// }
// });
// }
//
// private void takePhoto(Context context) {
// Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// if (takePictureIntent.resolveActivity(context.getPackageManager()) != null) {
// File photoFile = null;
// try {
// photoFile = createImageFile(context);
// } catch (IOException e) {
// e.printStackTrace();
// }
// if (photoFile != null) {
// Uri photoUri = FileProvider.getUriForFile(context,
// context.getPackageName() + ".fileprovider", photoFile);
// takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
// }
// ((Activity) context).startActivityForResult(takePictureIntent, TAKE_PHOTO);
// } else {
// ToastUtils.show(context, "請安裝相機");
// }
// }
//
// String currentPhotoPath;
//
// private File createImageFile(Context context) throws IOException {
// // Create an image file name
// String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
// String imageFileName = "JPEG_" + timeStamp + "_";
// File storageDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES);
// File image = File.createTempFile(
// imageFileName, /* prefix */
// ".jpg", /* suffix */
// storageDir /* directory */
// );
// // Save a file: path for use with ACTION_VIEW intents
// currentPhotoPath = image.getAbsolutePath();
// return image;
// }
//
// public String getCurrentPhotoPath() {
// return currentPhotoPath;
// }
//
// /**
// * 创建图片地址uri,用于保存拍照后的照片 Android 10以后使用这种方法
// *
// * @return 图片的uri
// */
// private Uri createImageUri(Context context) {
// //设置保存参数到ContentValues中
// ContentValues contentValues = new ContentValues();
// //设置文件名
// contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, "gsa_food_" + System.currentTimeMillis());
// //兼容Android Q和以下版本
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// //android Q中不再使用DATA字段,而用RELATIVE_PATH代替
// //TODO RELATIVE_PATH是相对路径不是绝对路径;照片存储的地方为:内部存储/Pictures
// contentValues.put(MediaStore.Images.Media.RELATIVE_PATH, "Pictures");
// }
// //设置文件类型
// contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/JPEG");
// //执行insert操作,向系统文件夹中添加文件
// //EXTERNAL_CONTENT_URI代表外部存储器,该值不变
// return context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
// }
//
//在公共文件夹下查询图片
//这里的filepath在androidQ中表示相对路径
//在androidQ以下是绝对路径
//public Uri querySignImage(String filePath) {
// // 图片列表
// Uri contentUri = null;
// try {
// //兼容androidQ和以下版本
// String queryPathKey = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q ?
// MediaStore.Images.Media.RELATIVE_PATH : MediaStore.Images.Media.DATA;
// //查询的条件语句
// String selection = queryPathKey + "=?";
// //查询的sql
// //Uri:指向外部存储Uri
// //projection:查询那些结果
// //selection:查询的where条件
// //sortOrder:排序
// Cursor cursor = mContext.getContentResolver().query(
// MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
// new String[]{MediaStore.Images.Media._ID,
// queryPathKey,
// MediaStore.Images.Media.MIME_TYPE,
// MediaStore.Images.Media.DISPLAY_NAME},
// selection,
// new String[]{filePath},
// null);
// //是否查询到了
// if (cursor != null && cursor.moveToFirst()) {
// //循环取出所有查询到的数据
// do {
// //一张图片的基本信息
// int id = cursor.getInt(cursor.getColumnIndex(MediaStore.Images.Media._ID));//uri的id,用于获取图片
// String path = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.RELATIVE_PATH));//图片的相对路径
// String type = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.MIME_TYPE));//图片类型
// String name = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME));//图片名字
// System.out.println("id=" + id + ", path=" + path + ", type=" + type + ", name=" + name);
// //根据图片id获取uri,这里的操作是拼接uri
// Uri uri = Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + id);
// long value = Long.valueOf(name.replace(".jpg", ""));
// //官方代码:
// contentUri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id);
//// if (uri != null) {
//// //通过流转化成bitmap对象
//// InputStream inputStream = context.getContentResolver().openInputStream(uri);
//// Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
//// }
// } while (cursor.moveToNext());
// }
// if (cursor != null) {
// cursor.close();
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// return contentUri;
// }
//
//private void takePhoto2() {
// Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// // 判断是否有相机
// if (captureIntent.resolveActivity(mContext.getPackageManager()) != null) {
// File photoFile = null;
// Uri photoUri = null;
//
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// // 适配android 10
// photoUri = createImageUri();
// } else {
// try {
// photoFile = createImageFile();
// } catch (IOException e) {
// e.printStackTrace();
// }
//
// if (photoFile != null) {
// currentPhotoPath = photoFile.getAbsolutePath();
// System.out.println("path = " + currentPhotoPath);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {//7.0到9.0
// //适配Android 7.0文件权限,通过FileProvider创建一个content类型的Uri 如:content://
// photoUri = FileProvider.getUriForFile(mContext,
// mContext.getPackageName() + ".fileprovider", photoFile);
// } else {//7.0以下, 如:file://
// photoUri = Uri.fromFile(photoFile);
// }
// }
// }
// System.out.println("photoUri = " + photoUri);
// mCameraUri = photoUri;
// if (photoUri != null) {
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// List<ResolveInfo> resInfoList = mContext.getPackageManager()
// .queryIntentActivities(captureIntent, PackageManager.MATCH_DEFAULT_ONLY);
// for (ResolveInfo resolveInfo : resInfoList) {
// String packageName = resolveInfo.activityInfo.packageName;
// mContext.grantUriPermission(packageName, photoUri,
// Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
// }
// }
//
// captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
// captureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
// startActivityForResult(captureIntent, TAKE_PHOTO);
// }
// }
// }
// import android.Manifest;
//} import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
import androidx.core.content.FileProvider;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.gingersoft.gsa.cloud.common.utils.FileUtils;
import com.gingersoft.gsa.cloud.common.utils.toast.ToastUtils;
import com.gingersoft.gsa.cloud.ui.utils.AppDialog;
import com.permissionx.guolindev.PermissionX;
import com.yalantis.ucrop.UCrop;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
//
/** /**
* 创建图片地址uri,用于保存拍照后的照片 Android 10以后使用这种方法 * @author 宇航.
* User: admin
* Date: 2020/12/25
* Time: 11:29
* Use:
*/
public class SelectPicture {
private static SelectPicture selectPicture;
/**
* 用于保存拍照图片的uri
*/
private Uri mCameraUri;
/**
* 當前圖片的絕對路徑
*/
// private String currentPhotoPath;
final String[] items = new String[]{"拍照", "從相冊選擇", "取消"};
public static final int CHOOSE_PHOTO = 101;
public static final int TAKE_PHOTO = 102;
public static final int PHOTO_CROP = 103;
public static SelectPicture getInstance() {
if (selectPicture == null) {
selectPicture = new SelectPicture();
}
return selectPicture;
}
/**
* 顯示方式
*/
public void showSelectType(Fragment fragment) {
//拍照或者選擇圖片
PermissionX.init(fragment).permissions(Manifest.permission.CAMERA)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要獲取拍照權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟拍照權限", "確定", "取消"))
.request((allGranted, grantedList, deniedList) -> showPictureChoice(fragment));
}
/**
* 顯示方式
*
* @param activity
*/
public void showSelectType(FragmentActivity activity) {
//拍照或者選擇圖片
PermissionX.init(activity).permissions(Manifest.permission.CAMERA)
.onExplainRequestReason((scope, deniedList) -> scope.showRequestReasonDialog(deniedList, "上傳圖片需要獲取拍照權限", "確定", "取消"))
.onForwardToSettings((scope, deniedList) -> scope.showForwardToSettingsDialog(deniedList, "您需要去設置當中開啟拍照權限", "確定", "取消"))
.request((allGranted, grantedList, deniedList) -> showPictureChoice(activity));
}
/**
* 顯示照片選擇
*/
public void showPictureChoice(Fragment fragment) {
AppDialog.getInstance().showListDialog(fragment.requireContext(), items, (view, dialog, position) -> {
if (position == 0) {
takePhoto(fragment);
} else if (position == 1) {
Intent intentToPickPic = new Intent(Intent.ACTION_PICK, null);
intentToPickPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
fragment.startActivityForResult(intentToPickPic, CHOOSE_PHOTO);
}
});
}
/**
* 顯示照片選擇
*/
public void showPictureChoice(FragmentActivity activity) {
AppDialog.getInstance().showListDialog(activity, items, (view, dialog, position) -> {
if (position == 0) {
takePhoto(activity);
} else if (position == 1) {
Intent intentToPickPic = new Intent(Intent.ACTION_PICK, null);
intentToPickPic.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
activity.startActivityForResult(intentToPickPic, CHOOSE_PHOTO);
}
});
}
/**
* 拍照
*/
private void takePhoto(Activity activity) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(activity.getPackageManager()) != null) {
File photoFile;
photoFile = createImageFile(activity);
// currentPhotoPath = image.getAbsolutePath();
mCameraUri = Uri.fromFile(photoFile);
try {
Uri photoUri = FileProvider.getUriForFile(activity,
activity.getPackageName() + ".fileprovider", photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
activity.startActivityForResult(takePictureIntent, TAKE_PHOTO);
} catch (IllegalArgumentException e) {
ToastUtils.show(activity, "打開相機失敗,請更換其他方式");
}
} else {
ToastUtils.show(activity, "請安裝相機");
}
}
/**
* 拍照
*/
private void takePhoto(Fragment fragment) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(fragment.requireContext().getPackageManager()) != null) {
File photoFile;
photoFile = createImageFile(fragment.requireContext());
// currentPhotoPath = image.getAbsolutePath();
mCameraUri = Uri.fromFile(photoFile);
try {
Uri photoUri = FileProvider.getUriForFile(fragment.requireActivity(),
fragment.requireActivity().getPackageName() + ".fileprovider", photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
fragment.startActivityForResult(takePictureIntent, TAKE_PHOTO);
} catch (IllegalArgumentException e) {
ToastUtils.show(fragment.requireContext(), "打開相機失敗,請更換其他方式");
e.printStackTrace();
}
} else {
ToastUtils.show(fragment.requireContext(), "請安裝相機");
}
}
/**
* 創建照片保存路徑,然後再進行拍照
*/
public File createImageFile(Context mContext) {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File cacheDir = mContext.getCacheDir();
File image = null;
try {
image = File.createTempFile(
imageFileName, /* prefix */
".jpg", /* suffix */
cacheDir /* directory */
);
} catch (IOException e) {
e.printStackTrace();
}
// Save a file: path for use with ACTION_VIEW intents
// currentPhotoPath = image.getAbsolutePath();
// mCameraUri = Uri.fromFile(image);
return image;
}
/**
* uri轉換為文件路徑,適配android Q
*
* @param uri 私有uri
* @return 轉換到沙盒文件的文件
*/
public File uriToFileApiQ(Context mContext, Uri uri) {
File file = null;
//android10以上转换
String scheme = uri.getScheme();
if (scheme != null) {
if (scheme.equals(ContentResolver.SCHEME_FILE)) {
String path = uri.getPath();
if (path != null) {
file = new File(path);
}
} else if (uri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
//把文件复制到沙盒目录
ContentResolver contentResolver = mContext.getContentResolver();
Cursor cursor = contentResolver.query(uri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
String displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
try {
InputStream is = contentResolver.openInputStream(uri);
File externalCacheDir = mContext.getExternalCacheDir();
if (externalCacheDir != null) {
File cache = new File(mContext.getExternalCacheDir().getAbsolutePath(), Math.round((Math.random() + 1) * 1000) + displayName);
FileOutputStream fos = new FileOutputStream(cache);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && is != null) {
android.os.FileUtils.copy(is, fos);
} else {
String path = FileUtils.getFilePathByUri(mContext, uri);
FileUtils.copyFile(path, cache.getPath());
}
file = cache;
fos.close();
}
if (is != null) {
is.close();
}
cursor.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
return file;
}
/**
* 裁剪
* *
* @return 图片的uri * @param mCameraUri
*/ */
//private Uri createImageUri() { public void crop(Uri mCameraUri, Fragment fragment) {
// //设置保存参数到ContentValues中 UCrop.of(mCameraUri, mCameraUri)
// ContentValues contentValues = new ContentValues(); .withAspectRatio(1, 1)
// //设置文件名 .withMaxResultSize(500, 500)
// contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, "gsa_food_" + System.currentTimeMillis()); .start(fragment.requireContext(), fragment);
// //兼容Android Q和以下版本 }
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// //android Q中不再使用DATA字段,而用RELATIVE_PATH代替 public Uri getmCameraUri() {
// //TODO RELATIVE_PATH是相对路径不是绝对路径;照片存储的地方为:内部存储/Pictures return mCameraUri;
// contentValues.put(MediaStore.Images.Media.RELATIVE_PATH, "Pictures"); }
// } }
// //设置文件类型
// contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/JPEG");
// //执行insert操作,向系统文件夹中添加文件
// //EXTERNAL_CONTENT_URI代表外部存储器,该值不变
// return mContext.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
// }
...@@ -29,7 +29,18 @@ ...@@ -29,7 +29,18 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical" android:layout_gravity="right|center_vertical"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:src="@drawable/icon_popup_close_dark" /> android:src="@drawable/icon_popup_close_dark"
android:visibility="gone" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_category_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:layout_marginRight="@dimen/dp_19"
android:text="刪除"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14" />
</FrameLayout> </FrameLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" /> <include layout="@layout/include_horizontal_color_eee_dividing_line" />
...@@ -39,8 +50,8 @@ ...@@ -39,8 +50,8 @@
android:id="@+id/tv_content" android:id="@+id/tv_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginLeft="@dimen/new_category_dialog_marginLeft" android:layout_marginLeft="@dimen/new_category_dialog_marginLeft"
android:layout_marginTop="@dimen/dp_20"
android:text="種類名稱" android:text="種類名稱"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" /> android:textSize="@dimen/dp_14" />
...@@ -50,11 +61,11 @@ ...@@ -50,11 +61,11 @@
style="@style/Multi_Input_editStyle" style="@style/Multi_Input_editStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_40" android:layout_height="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/new_category_dialog_marginLeft" android:layout_marginRight="@dimen/new_category_dialog_marginLeft"
android:background="@null" android:background="@null"
android:gravity="left|center_vertical" android:gravity="left|center_vertical"
android:hint="請輸入類別名稱" android:hint="請輸入類別名稱"
android:layout_marginTop="@dimen/dp_5"
android:maxLength="4" android:maxLength="4"
android:paddingLeft="@dimen/new_category_dialog_marginLeft" android:paddingLeft="@dimen/new_category_dialog_marginLeft"
android:paddingRight="@dimen/new_category_dialog_marginLeft" android:paddingRight="@dimen/new_category_dialog_marginLeft"
...@@ -72,30 +83,31 @@ ...@@ -72,30 +83,31 @@
android:layout_marginBottom="@dimen/dp_20" android:layout_marginBottom="@dimen/dp_20"
android:orientation="horizontal"> android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_cancel" android:id="@+id/tv_confirm"
style="@style/Save_Btn_Style" style="@style/Save_Btn_Style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/new_category_dialog_marginLeft" android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/dp_7" android:layout_marginRight="@dimen/new_category_dialog_marginLeft"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/shape_red_seven_radius_bg"
android:paddingTop="@dimen/dp_13" android:paddingTop="@dimen/dp_13"
android:paddingBottom="@dimen/dp_13" android:paddingBottom="@dimen/dp_13"
android:text="刪除" /> android:text="確定" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_confirm" android:id="@+id/tv_cancel"
style="@style/Save_Btn_Style" style="@style/Cancel_Btn_Style"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7" android:layout_marginLeft="@dimen/new_category_dialog_marginLeft"
android:layout_marginRight="@dimen/new_category_dialog_marginLeft" android:layout_marginRight="@dimen/dp_7"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/shape_3c_cancel_btn_bg"
android:paddingTop="@dimen/dp_13" android:paddingTop="@dimen/dp_13"
android:paddingBottom="@dimen/dp_13" android:paddingBottom="@dimen/dp_13"
android:text="確定" /> android:text="取消" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -146,6 +146,7 @@ ...@@ -146,6 +146,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/shape_app_btn"
android:gravity="center" android:gravity="center"
android:paddingLeft="@dimen/dp_35" android:paddingLeft="@dimen/dp_35"
android:paddingTop="@dimen/dp_10" android:paddingTop="@dimen/dp_10"
......
...@@ -9,89 +9,186 @@ ...@@ -9,89 +9,186 @@
<include layout="@layout/supply_chain_top_bar" /> <include layout="@layout/supply_chain_top_bar" />
<FrameLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10" android:background="@color/white"
android:layout_marginTop="@dimen/dp_10" android:orientation="vertical"
android:layout_marginRight="@dimen/dp_10" android:paddingLeft="@dimen/dp_18"
android:layout_marginBottom="@dimen/dp_10" android:paddingRight="@dimen/dp_18"
android:background="@drawable/shape_theme_eight_corners_bg" android:paddingBottom="@dimen/dp_6"
app:layout_collapseMode="parallax"> app:layout_collapseMode="parallax">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_marginTop="@dimen/dp_11"
android:paddingLeft="@dimen/dp_10" android:orientation="horizontal">
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5">
<TextView <TextView
android:id="@+id/tv_order_details_supplier_name" android:id="@+id/tv_order_details_supplier_name"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/white" android:layout_weight="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_16" android:textSize="@dimen/dp_16"
android:textStyle="bold"
tools:text="海鮮天地" /> tools:text="海鮮天地" />
<TextView <TextView
android:id="@+id/tv_order_details_create_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14"
tools:text="2020-11-20 12:00" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/tv_order_details_order_no" android:id="@+id/tv_order_details_order_no"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_9"
android:textColor="@color/white" android:text="採購單號:"
android:textSize="@dimen/dp_14" android:textColor="@color/color_3c"
tools:text="訂單號:DD0001" /> android:textSize="@dimen/dp_14" />
<TextView <TextView
android:id="@+id/tv_order_details_create_time" android:id="@+id/tv_warehouse_order_no"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:layout_marginTop="@dimen/dp_10"
android:textColor="@color/white" android:text="入庫單號:"
android:textSize="@dimen/dp_14" android:textColor="@color/color_3c"
tools:text="2020-11-20 12:00" /> android:textSize="@dimen/dp_14" />
<LinearLayout
android:id="@+id/layout_ed_remark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="備註:"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" />
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:counterEnabled="true"
app:counterMaxLength="50">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_warehouse_order_remark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" />
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/layout_remarks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/shape_oval_border_bg_c8"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_7"
android:paddingTop="@dimen/dp_5"
android:paddingRight="@dimen/dp_7"
android:paddingBottom="@dimen/dp_5">
<ImageView
android:layout_width="@dimen/dp_19"
android:layout_height="@dimen/dp_19"
android:src="@drawable/ic_dialogue" />
<TextView <TextView
android:id="@+id/tv_order_details_order_state"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical" android:layout_marginLeft="@dimen/dp_3"
android:layout_marginRight="@dimen/dp_10" android:text="@string/str_remark"
android:textColor="@color/white" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_18" android:textSize="@dimen/dp_12" />
tools:text="部分收貨" /> </LinearLayout>
</FrameLayout>
<ImageView
android:id="@+id/iv_order_state"
android:layout_width="@dimen/dp_52"
android:layout_height="@dimen/dp_46"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/dp_32"
android:src="@drawable/img_partial_receipt" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_details_pictures"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" />
</LinearLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginTop="@dimen/dp_10">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_details_food_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</HorizontalScrollView>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_order_details_food_list" android:id="@+id/rv_order_details_food_list"
android:layout_width="match_parent" android:layout_width="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" /> android:layout_marginTop="@dimen/dp_10"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:elevation="@dimen/dp_10"
android:background="@color/white" android:background="@color/white"
android:orientation="vertical" android:elevation="@dimen/dp_10"
android:paddingTop="@dimen/dp_10" android:orientation="vertical">
android:paddingBottom="@dimen/dp_10">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="@dimen/dp_20" android:paddingRight="@dimen/dp_25">
android:paddingRight="@dimen/dp_20">
<CheckBox <com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/cb_order_details_all_selected" android:id="@+id/cb_order_details_all_selected"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:text="全選" android:text="全選"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" /> android:textSize="@dimen/dp_14" />
...@@ -100,20 +197,19 @@ ...@@ -100,20 +197,19 @@
style="@style/supplier_chain_222_16" style="@style/supplier_chain_222_16"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_20" android:layout_marginLeft="@dimen/dp_24"
android:text="食材種類:" android:text="食材種類:"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_order_details_food_type_total" android:id="@+id/tv_order_details_food_type_total"
style="@style/supplier_chain_222_16" style="@style/Text_Bold_amount_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/required_color"
tools:text="3" /> tools:text="3" />
<View <View
android:layout_width="@dimen/dp_0" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" /> android:layout_weight="1" />
...@@ -127,110 +223,45 @@ ...@@ -127,110 +223,45 @@
<TextView <TextView
android:id="@+id/tv_order_details_total_amount" android:id="@+id/tv_order_details_total_amount"
style="@style/supplier_chain_222_16" style="@style/Text_Bold_amount_style"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/required_color"
tools:text="$300.00" /> tools:text="$300.00" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_20"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_20">
<TextView
style="@style/supplier_chain_222_16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="文件上傳:" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_order_details_click_upload"
style="@style/supplier_chain_222_16"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="end"
android:layout_weight="1"
android:text="點擊上傳"
android:textColor="@color/click_upload_text_color" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/dp_1"
android:background="@color/color_53" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_20"
android:paddingRight="@dimen/dp_20">
<TextView
style="@style/supplier_chain_222_16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="備註:" />
<EditText
android:id="@+id/ed_order_details_remark"
style="@style/supplier_chain_222_16"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="手動輸入"
android:textColorHint="@color/color_c9" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="horizontal" android:orientation="horizontal">
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_details_buy_again"
style="@style/Style_Btn_Green"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="再次購買" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_details_partial_receipt" android:id="@+id/tv_order_details_partial_receipt"
style="@style/Style_Btn_Yellow"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:layout_weight="1" android:layout_weight="1"
android:background="@color/other_order_details_print_btn_color"
android:gravity="center" android:gravity="center"
android:text="部分收貨" /> android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:text="部分收貨"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView <com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_order_details_receipt" android:id="@+id/tv_order_details_receipt"
style="@style/Style_Btn_Brick_Red"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_12"
android:layout_weight="1" android:layout_weight="1"
android:background="@color/brick_red"
android:gravity="center" android:gravity="center"
android:text="收貨" /> android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:text="收貨"
android:textColor="@color/white"
android:textSize="@dimen/sp_16" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/supply_chain_bg_color"
android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
<ImageView
android:layout_width="@dimen/dp_77"
android:layout_height="@dimen/dp_77"
android:layout_marginLeft="@dimen/dp_13" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_16"
android:layout_marginRight="@dimen/dp_8"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存:" />
<TextView
android:id="@+id/tv_warehouse_inventory_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/other_order_details_sure_btn_color"
android:textSize="@dimen/dp_19"
tools:text="100" />
<TextView
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="盒" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1" />
<TextView
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="規格:" />
<TextView
android:id="@+id/tv_warehouse_specifications"
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="1KG/盒" />
</LinearLayout>
<TextView
android:id="@+id/tv_warehouse_unit_price"
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center_vertical"
tools:text="單價:$10.00" />
<TextView
android:id="@+id/tv_warehouse_total_amount"
style="@style/WareHouse_Details_TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="總價:$1000.00" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_warehousing_record"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/shape_left_themecolor_radius_btn"
android:gravity="center"
android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11"
android:text="入庫流水"
android:textColor="@color/white"
android:textSize="@dimen/dp_17" />
<TextView
android:id="@+id/tv_outbound_record"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/shape_right_white_radius_btn"
android:gravity="center"
android:paddingTop="@dimen/dp_11"
android:paddingBottom="@dimen/dp_11"
android:text="出庫流水"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17" />
</LinearLayout>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id="@+id/srl_warehouse_details_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srlAccentColor="@color/theme_333_color"
app:srlEnablePreviewInEditMode="true"
app:srlPrimaryColor="@color/trans">
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp_warehouse_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_10" />
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/supply_chain_top_bar" />
<ImageView
android:id="@+id/iv_warehouse_img"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_36"
android:layout_marginRight="@dimen/dp_36"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存數量:"
android:textColor="@color/color_66"
android:textSize="@dimen/dp_17" />
<TextView
android:id="@+id/tv_warehouse_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
tools:text="100" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="庫存差異:"
android:textColor="@color/color_66"
android:textSize="@dimen/dp_17" />
<TextView
android:id="@+id/tv_warehouse_difference"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
tools:text="+100" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_15"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="盤點庫存:"
android:textColor="@color/color_66"
android:textSize="@dimen/dp_17" />
<EditText
android:id="@+id/ed_warehouse_loss"
android:layout_width="@dimen/dp_86"
android:layout_height="wrap_content"
android:background="@drawable/shape_square_edit_border_3c"
android:text="2"
android:textColor="@color/theme_333_color"
android:textSize="@dimen/dp_14" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/cb_consumption_reason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:layout_marginTop="@dimen/dp_15"
android:text="正常消耗" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_img"
android:layout_width="@dimen/dp_58"
android:layout_height="@dimen/dp_58"
android:src="@drawable/img_search_keyboard_bg"
android:layout_marginTop="@dimen/dp_8"
android:layout_marginRight="@dimen/dp_8"/>
<ImageView
android:id="@+id/iv_img_delete"
android:layout_width="@dimen/dp_20"
android:layout_height="@dimen/dp_20"
android:layout_gravity="right"
android:src="@drawable/icon_dialog_close" />
</FrameLayout>
\ No newline at end of file
...@@ -3,88 +3,185 @@ ...@@ -3,88 +3,185 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_10" android:layout_marginRight="@dimen/dp_10"
android:elevation="@dimen/dp_10" android:layout_marginBottom="@dimen/dp_5"
android:background="@drawable/shape_dialog_bg" android:background="@drawable/shape_dialog_bg"
android:elevation="@dimen/dp_10"
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="@dimen/dp_15"> android:paddingBottom="@dimen/dp_15">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="@dimen/dp_15" android:paddingLeft="@dimen/dp_12"
android:paddingTop="@dimen/dp_10" android:paddingTop="@dimen/dp_8"
android:paddingBottom="@dimen/dp_10"> android:paddingRight="@dimen/dp_9"
android:paddingBottom="@dimen/dp_8">
<ImageView <com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/iv_order_details_item_food_select" android:id="@+id/iv_order_details_item_food_select"
style="@style/TextStyle_Order_Details" style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/selector_checkbox" /> android:layout_weight="1"
android:button="@drawable/selector_checkbox"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
tools:text="巴西肥牛單個記錄是積分臨時凍結了附加上來點擊發" />
<TextView <TextView
android:id="@+id/tv_order_details_item_purchasing_unit"
style="@style/TextStyle_Order_Details" style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:layout_marginLeft="@dimen/dp_5"
android:text="入庫單號:" /> tools:text="3KG/盒" />
<TextView <TextView
android:id="@+id/tv_order_no" android:id="@+id/tv_order_details_state"
style="@style/TextStyle_Order_Details" style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_40"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
tools:text="123456789" /> android:gravity="end"
android:textColor="@color/other_order_details_print_btn_color"
tools:text="部分收貨" />
</LinearLayout> </LinearLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" /> <include layout="@layout/include_horizontal_color_eee_dividing_line" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="@dimen/dp_30"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:orientation="vertical" android:layout_marginRight="@dimen/dp_9"
android:paddingLeft="@dimen/dp_15" android:orientation="horizontal">
android:paddingRight="@dimen/dp_15">
<LinearLayout <RelativeLayout
android:id="@+id/layout_order_details_unit"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/shape_border_bg_c8"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_6"
android:text="單位"
android:textColor="@color/color_aaa"
android:textSize="@dimen/dp_12" />
<ImageView
android:id="@+id/iv_switch_unit"
android:layout_width="@dimen/dp_10"
android:layout_height="@dimen/dp_6"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_11"
android:src="@drawable/ic_inverted_triangle_66" />
<TextView
android:id="@+id/tv_order_details_show_unit"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_8"
android:layout_toLeftOf="@id/iv_switch_unit"
android:layout_toRightOf="@id/tv_unit"
android:gravity="right"
android:text="雙"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15" />
</RelativeLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_9"
android:layout_weight="1"
android:background="@drawable/shape_border_bg_c8"
android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_order_details_item_food_name"
style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:layout_marginLeft="@dimen/dp_6"
tools:text="巴西肥牛" /> android:text="數量"
android:textColor="@color/color_aaa"
android:textSize="@dimen/dp_12" />
<View <com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_food_num"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:background="@null"
android:gravity="end|center_vertical"
android:inputType="numberDecimal"
android:maxLines="1"
android:textColor="@color/color_3c"
android:textColorHighlight="@color/theme_color"
android:textCursorDrawable="@drawable/cursor_theme"
android:textSize="@dimen/dp_15"
android:textStyle="bold"
tools:text="2" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="match_parent"
android:layout_weight="1" /> android:layout_marginLeft="@dimen/dp_9"
android:layout_weight="1"
android:background="@drawable/shape_border_bg_c8"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView <TextView
android:id="@+id/tv_order_details_item_purchasing_unit"
style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:layout_marginLeft="@dimen/dp_6"
tools:text="3KG/盒" /> android:text="單價"
android:textColor="@color/color_aaa"
android:textSize="@dimen/dp_12" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ed_food_unit_price"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:background="@null"
android:textCursorDrawable="@drawable/cursor_theme"
android:gravity="end|center_vertical"
android:inputType="numberDecimal"
android:maxLines="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_15"
android:textStyle="bold"
tools:text="2" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_9"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -92,87 +189,105 @@ ...@@ -92,87 +189,105 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:text="單價:" /> android:text="訂單金額:" />
<TextView <TextView
android:id="@+id/tv_order_details_item_purchasing_unit_price" android:id="@+id/tv_order_details_item_warehouse_total_amount"
style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="$100.00" /> tools:text="$100.00" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView <TextView
style="@style/TextStyle_Order_Details" style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:text="數量:" /> android:gravity="right"
android:text="實付:" />
<TextView <TextView
android:id="@+id/tv_order_details_item_num" android:id="@+id/tv_order_details_item_warehouse_actual_amount"
style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
tools:text="3" /> android:textColor="@color/required_color"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="$100.00" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_9"
android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:text="總價:" /> android:text="訂單數量:"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12" />
<TextView
android:id="@+id/tv_order_details_item_warehouse_num"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/selector_checkbox"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_12"
android:textStyle="bold"
tools:text="2000000000000" />
<TextView <TextView
android:id="@+id/tv_order_details_item_purchasing_total_amount"
style="@style/TextStyle_Order_Details" style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
tools:text="$100.00" /> android:gravity="right"
</LinearLayout> android:text="已入庫:"
android:textSize="@dimen/dp_12" />
<androidx.recyclerview.widget.RecyclerView <TextView
android:id="@+id/rv_warehouse_unit" android:id="@+id/tv_order_details_item_warehouse_warehousing_num"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_weight="1"
android:orientation="horizontal"> android:button="@drawable/selector_checkbox"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_12"
android:textStyle="bold"
tools:text="2000000000" />
<TextView <TextView
style="@style/TextStyle_Order_Details" style="@style/TextStyle_Order_Details"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:text="入庫總價:" /> android:gravity="right"
android:text="未入庫:"
android:textSize="@dimen/dp_12" />
<TextView <TextView
android:id="@+id/tv_order_details_item_warehouse_total_amount" android:id="@+id/tv_order_details_item_warehouse_not_in_storage_num"
style="@style/TextStyle_Order_Details" android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:textColor="@color/required_color" android:textColor="@color/required_color"
android:textSize="@dimen/dp_12"
android:textStyle="bold" android:textStyle="bold"
tools:text="$100.00" /> tools:text="00000000000" />
</LinearLayout> </LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -24,10 +24,12 @@ ...@@ -24,10 +24,12 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/dp_17" android:textSize="@dimen/dp_17"
android:textStyle="bold" android:textStyle="bold"
tools:text="供應商名稱" /> tools:text="供應商名稱是會計法還是得會計法離開時點擊分類手機的三代機傅雷家書水電費is地方水電費刻錄機" />
<TextView <TextView
android:id="@+id/btn_receiver_goods" android:id="@+id/btn_receiver_goods"
......
...@@ -20,27 +20,28 @@ ...@@ -20,27 +20,28 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="@dimen/dp_10" android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_10"> android:paddingBottom="@dimen/dp_9">
<CheckBox <CheckBox
android:id="@+id/cb_order_item_all_select" android:id="@+id/cb_order_item_all_select"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_weight="6"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15" android:layout_marginLeft="@dimen/dp_12"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_16"
android:textStyle="bold"
tools:text="海鮮天地" /> tools:text="海鮮天地" />
<TextView <TextView
android:id="@+id/tv_minimumAmount" android:id="@+id/tv_minimumAmount"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15" android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_15" android:layout_marginRight="@dimen/dp_5"
android:layout_weight="1" android:layout_weight="4"
android:textSize="@dimen/dp_14"
android:gravity="right" android:gravity="right"
android:text="@string/minimumAmount" android:text="@string/minimumAmount"
android:textColor="@color/required_color" /> android:textColor="@color/required_color" />
...@@ -59,24 +60,23 @@ ...@@ -59,24 +60,23 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical|right" android:layout_marginLeft="@dimen/dp_5"
android:orientation="horizontal" android:layout_marginTop="@dimen/dp_5"
android:paddingLeft="@dimen/dp_15" android:layout_marginRight="@dimen/dp_5"
android:paddingTop="@dimen/dp_10" android:orientation="horizontal">
android:paddingRight="@dimen/dp_15">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="食材種類:" android:text="食材種類:"
android:textColor="@color/color_222" android:textColor="@color/color_222"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_15" />
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_order_item_food_type_total" android:id="@+id/tv_order_item_food_type_total"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color" android:textColor="@color/required_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
android:textStyle="bold" android:textStyle="bold"
...@@ -85,17 +85,61 @@ ...@@ -85,17 +85,61 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_25" android:layout_marginLeft="@dimen/dp_5"
android:gravity="right" android:gravity="right"
android:text="總計:" android:text="總\u3000\u3000計:"
android:textColor="@color/color_222" android:textColor="@color/color_222"
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_order_item_total_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
tools:text="$330" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="運\u3000\u3000費:"
android:textColor="@color/color_222"
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_order_item_freight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="$0"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_order_item_total_amount"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:gravity="right"
android:text="實際應付:"
android:textColor="@color/color_222"
android:textSize="@dimen/dp_15" />
<TextView
android:id="@+id/tv_order_item_actual_pay_amount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/required_color" android:textColor="@color/required_color"
android:textSize="@dimen/dp_14" android:textSize="@dimen/dp_14"
android:textStyle="bold" android:textStyle="bold"
...@@ -103,11 +147,47 @@ ...@@ -103,11 +147,47 @@
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/rv_purchase_shopping_estimate_delivery_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:textColor="@color/other_order_details_sure_btn_color"
android:textSize="@dimen/dp_12"
tools:text="預計送貨時間:默認第二天日期" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="備註:"
android:textColorHint="@color/color_222"
android:textSize="@dimen/sp_14" />
<EditText
android:id="@+id/ed_purchase_shopping_remarks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="手動輸入"
android:textColor="@color/color_3c"
android:textColorHint="@color/color_c9"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<TextView
android:id="@+id/rv_purchase_shopping_minimum_tip" android:id="@+id/rv_purchase_shopping_minimum_tip"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_marginLeft="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_10" android:layout_marginRight="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:text="未滿足該供應商最低採購金額,請繼續添加食材" android:text="未滿足該供應商最低採購金額,請繼續添加食材"
android:textColor="@color/required_color" android:textColor="@color/required_color"
android:textSize="@dimen/dp_12" /> android:textSize="@dimen/dp_12" />
...@@ -117,6 +197,6 @@ ...@@ -117,6 +197,6 @@
android:id="@+id/item_purchase_shopping_parent_layout" android:id="@+id/item_purchase_shopping_parent_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone" android:background="@drawable/shape_eight_corners_red_border_bg"
android:background="@drawable/shape_eight_corners_red_border_bg" /> android:visibility="gone" />
</FrameLayout> </FrameLayout>
...@@ -53,10 +53,6 @@ ...@@ -53,10 +53,6 @@
</LinearLayout> </LinearLayout>
<!-- <include-->
<!-- android:id="@+id/line_supplier_info"-->
<!-- layout="@layout/include_horizontal_color_eee_dividing_line" />-->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -68,21 +64,21 @@ ...@@ -68,21 +64,21 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_15" android:layout_marginLeft="@dimen/dp_6"
android:button="@drawable/selector_checkbox" android:button="@drawable/selector_checkbox"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" /> android:textSize="@dimen/dp_14" />
<LinearLayout <LinearLayout
android:layout_width="@dimen/dp_84" android:layout_width="@dimen/dp_88"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/iv_food_ingredient_img" android:id="@+id/iv_food_ingredient_img"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_84" /> android:layout_height="@dimen/dp_88"
android:scaleType="fitXY" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -91,13 +87,14 @@ ...@@ -91,13 +87,14 @@
android:layout_marginTop="@dimen/dp_4" android:layout_marginTop="@dimen/dp_4"
android:textColor="@color/color_3c" android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12" android:textSize="@dimen/dp_12"
android:visibility="gone"
tools:text="15/30" /> tools:text="15/30" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_8" android:layout_marginLeft="@dimen/dp_6"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
...@@ -116,6 +113,7 @@ ...@@ -116,6 +113,7 @@
<ImageView <ImageView
android:id="@+id/iv_order_food_delete" android:id="@+id/iv_order_food_delete"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginRight="@dimen/dp_5"
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@drawable/ic_red_delete" /> android:src="@drawable/ic_red_delete" />
</LinearLayout> </LinearLayout>
...@@ -125,7 +123,6 @@ ...@@ -125,7 +123,6 @@
style="@style/Food_Ingredient_Info_TextStyle" style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
tools:text="巴西肥牛" /> tools:text="巴西肥牛" />
<LinearLayout <LinearLayout
...@@ -161,7 +158,7 @@ ...@@ -161,7 +158,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -182,6 +179,7 @@ ...@@ -182,6 +179,7 @@
android:id="@+id/layout_operation_food_num" android:id="@+id/layout_operation_food_num"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_5"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
...@@ -195,13 +193,11 @@ ...@@ -195,13 +193,11 @@
android:id="@+id/ed_food_ingredient_number" android:id="@+id/ed_food_ingredient_number"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@null" android:background="@null"
android:inputType="number" android:inputType="number"
android:maxLength="4" android:maxLength="4"
android:paddingLeft="@dimen/dp_4" android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_4" android:paddingRight="@dimen/dp_10"
android:text="10" android:text="10"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/dp_22" /> android:textSize="@dimen/dp_22" />
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@drawable/shape_white_eight_corners_bg"
android:elevation="@dimen/dp_10"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/dp_10">
<TextView
android:id="@+id/tv_warehouse_details_food_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"
tools:text="巴西肥牛" />
<TextView
android:id="@+id/tv_warehouse_details_food_unit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_14"
tools:text="250g/個" />
<TextView
android:id="@+id/tv_warehouse_details_food_num"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_19"
tools:text="+50" />
</LinearLayout>
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_9"
android:paddingLeft="@dimen/dp_9"
android:paddingRight="@dimen/dp_9"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"
tools:text="下單日期:" />
<TextView
android:id="@+id/tv_warehouse_details_order_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"
tools:text="2020-11-20" />
<TextView
android:id="@+id/tv_warehouse_details_supplier"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_14"
tools:text="肥牛天地供應商" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_9"
android:paddingLeft="@dimen/dp_9"
android:paddingRight="@dimen/dp_9"
android:paddingBottom="@dimen/dp_10"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"
tools:text="入庫日期:" />
<TextView
android:id="@+id/tv_warehouse_details_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16"
tools:text="2020-11-20" />
<TextView
android:id="@+id/tv_warehouse_details_reason"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_14"
tools:text="採購入庫" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_white_eight_corners_bg"
android:orientation="vertical"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:paddingBottom="@dimen/dp_17">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="消耗庫存:"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17" />
<EditText
android:id="@+id/et_input"
android:layout_width="@dimen/dp_70"
android:layout_height="@dimen/dp_21"
android:maxLines="1"
android:background="@drawable/shape_login_edit_border"
android:drawablePadding="@dimen/dp_3"
android:inputType="number"
android:text=""
android:textColor="@color/color_3c"
android:textSize="@dimen/sp_16" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_inventory_consumption_reason"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_remark_colon"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_17" />
<EditText
android:id="@+id/ed_inventory_consumption_remark"
style="@style/Remark_editStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="手動輸入"
android:text="" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_confirm"
style="@style/app_btn_style"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:text="確定" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_cancel"
style="@style/Cancel_Btn_Style"
android:layout_width="@dimen/dp_0"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_13"
android:layout_weight="1"
android:gravity="center"
android:paddingTop="@dimen/dp_12"
android:paddingBottom="@dimen/dp_12"
android:text="確定" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
...@@ -3,5 +3,10 @@ ...@@ -3,5 +3,10 @@
<item name="qmui_shopping_cart" type="id"/> <item name="qmui_shopping_cart" type="id"/>
<item name="qmui_add_new_food_ingredients" type="id"/> <item name="qmui_add_new_food_ingredients" type="id"/>
<item name="qmui_delete_order" type="id"/> <item name="qmui_delete_order" type="id"/>
<item name="id_inventory_consumption" type="id"/>
<item name="id_save" type="id"/>
<item name="id_take_pictures" type="id"/>
<item name="id_more" type="id"/>
</resources> </resources>
\ No newline at end of file
...@@ -6,6 +6,17 @@ ...@@ -6,6 +6,17 @@
<string name="amount_string">$%1$.2f</string> <string name="amount_string">$%1$.2f</string>
<string name="amount_string_s">$%1$s</string> <string name="amount_string_s">$%1$s</string>
<string name="estimate_delivery_time">預計送貨時間:%1$s</string>
<string name="str_supplier">供應商</string> <string name="str_supplier">供應商</string>
<string name="str_species">種類</string> <string name="str_species">種類</string>
<string name="str_inventory_consumption">庫存消耗</string>
<string name="str_remark">備註</string>
<string name="str_remark_colon">備註:</string>
<string name="str_save">保存</string>
<string name="str_format_purchase_no">採購單號:%1$s</string>
<string name="str_format_warehouse_no">入庫單號:%1$s</string>
<string name="str_format_remark">備註:%1$d</string>
<string name="str_format_positive">+%1$d</string>
</resources> </resources>
\ No newline at end of file
...@@ -55,4 +55,21 @@ ...@@ -55,4 +55,21 @@
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
<item name="android:textColor">@color/color_3c</item> <item name="android:textColor">@color/color_3c</item>
</style> </style>
<style name="WareHouse_Details_TextStyle">
<item name="android:textSize">@dimen/dp_14</item>
<item name="android:textColor">@color/color_3c</item>
</style>
<style name="Remark_editStyle">
<item name="android:textColorHint">@color/color_c9</item>
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:gravity">center_vertical</item>
<item name="android:textColor">@color/color_3c</item>
</style>
<style name="Text_Bold_amount_style">
<item name="android:textSize">@dimen/dp_16</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/required_color</item>
</style>
</resources> </resources>
\ No newline at end of file
...@@ -33,14 +33,14 @@ android { ...@@ -33,14 +33,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -27,14 +27,14 @@ android { ...@@ -27,14 +27,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -7,8 +7,8 @@ ext { ...@@ -7,8 +7,8 @@ ext {
targetSdkVersion : 29, targetSdkVersion : 29,
//正式版: 1.0.3 3 //正式版: 1.0.3 3
//內部測試版:1.2.0 20 //內部測試版:1.2.0 20
versionCode : 20, versionCode : 21,
versionName : "1.2.0" versionName : "1.2.1"
] ]
version = [ version = [
...@@ -24,6 +24,13 @@ ext { ...@@ -24,6 +24,13 @@ ext {
canarySdkVersion : "1.5.4", canarySdkVersion : "1.5.4",
] ]
buildType = [
debugLogDebug : "true",
debugUseCanary : "true",
releaseLogDebug : "true",
releaseUseCanary: "false"
]
dependencies = [ dependencies = [
//support //support
"appcompat-v7" : 'androidx.appcompat:appcompat:1.0.2',//不要超過1.0.2,不然android5.1.1用webview會有問題 "appcompat-v7" : 'androidx.appcompat:appcompat:1.0.2',//不要超過1.0.2,不然android5.1.1用webview會有問題
......
...@@ -17,24 +17,15 @@ android { ...@@ -17,24 +17,15 @@ android {
versionName rootProject.ext.android["versionName"] versionName rootProject.ext.android["versionName"]
} }
buildTypes { buildTypes {
// Test {
// buildConfigField "boolean", "LOG_DEBUG", "false"
// buildConfigField "boolean", "USE_CANARY", "false"
// minifyEnabled false
// shrinkResources false
// zipAlignEnabled false
// proguardFiles 'proguard.cfg'
// }
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled true minifyEnabled true
// shrinkResources true // shrinkResources true
zipAlignEnabled true zipAlignEnabled true
......
...@@ -31,14 +31,14 @@ android { ...@@ -31,14 +31,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
zipAlignEnabled false zipAlignEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
...@@ -168,9 +168,11 @@ dependencies { ...@@ -168,9 +168,11 @@ dependencies {
api rootProject.ext.dependencies["design"] api rootProject.ext.dependencies["design"]
api rootProject.ext.dependencies["appcompat-v7"] api rootProject.ext.dependencies["appcompat-v7"]
implementation 'cn.bingoogolapple:bga-photopicker:1.2.8@aar' api 'cn.bingoogolapple:bga-photopicker:2.0.2@aar'
implementation 'cn.bingoogolapple:bga-baseadapter:1.2.9@aar' api 'cn.bingoogolapple:bga-flowlayout:1.0.0@aar'
implementation 'cn.bingoogolapple:bga-flowlayout:1.0.0@aar' api 'cn.bingoogolapple:bga-baseadapter:2.0.0@aar'
api 'pub.devrel:easypermissions:0.4.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'cn.onestravel.one:one_bottom_navigationbar:1.1.1' implementation 'cn.onestravel.one:one_bottom_navigationbar:1.1.1'
......
...@@ -77,8 +77,9 @@ public class GsonUtils { ...@@ -77,8 +77,9 @@ public class GsonUtils {
* @return * @return
*/ */
public static <T> T GsonToBean(Object gsonString, Class<T> cls) { public static <T> T GsonToBean(Object gsonString, Class<T> cls) {
JsonObject jsonObject = new JsonParser().parse(GsonString(gsonString)).getAsJsonObject(); // JsonObject jsonObject = new JsonParser().parse(GsonString(gsonString)).getAsJsonObject();
return gson.fromJson(jsonObject, cls); // return gson.fromJson(jsonObject, cls);
return GsonToBean(GsonString(gsonString), cls);
} }
/** /**
......
...@@ -42,8 +42,9 @@ public class MoneyInputFilter implements InputFilter { ...@@ -42,8 +42,9 @@ public class MoneyInputFilter implements InputFilter {
* *
* @param length 保留小數位數 * @param length 保留小數位數
*/ */
public void setDecimalLength(int length) { public MoneyInputFilter setDecimalLength(int length) {
mPattern = Pattern.compile(String.format(FORMAT, length)); mPattern = Pattern.compile(String.format(FORMAT, length));
return this;
} }
/** /**
...@@ -51,8 +52,9 @@ public class MoneyInputFilter implements InputFilter { ...@@ -51,8 +52,9 @@ public class MoneyInputFilter implements InputFilter {
* *
* @param maxValue 最大金額 * @param maxValue 最大金額
*/ */
public void setMaxValue(double maxValue) { public MoneyInputFilter setMaxValue(double maxValue) {
this.maxValue = maxValue; this.maxValue = maxValue;
return this;
} }
/** /**
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/theme_color" />
<size android:width="@dimen/dp_2" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/shape_app_btn" android:state_checkable="true"/>
<item android:drawable="@drawable/shape_btn_unclick"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_4" />
<stroke
android:width="@dimen/dp_1"
android:color="@color/color_c8" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_8" />
<solid android:color="@color/color_ccc" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_14" />
<solid android:color="@color/theme_color" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_14" />
<stroke
android:width="@dimen/dp_1"
android:color="@color/color_c8" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="@dimen/dp_1"
android:color="@color/color_3c" />
</shape>
\ No newline at end of file
...@@ -535,4 +535,5 @@ ...@@ -535,4 +535,5 @@
<color name="dotted_color">#9FA0A2</color> <color name="dotted_color">#9FA0A2</color>
<color name="brick_red">#EC6941</color> <color name="brick_red">#EC6941</color>
<color name="add_deputy_unit_bg">#F19149</color> <color name="add_deputy_unit_bg">#F19149</color>
<color name="dk_color_999999">#999</color>
</resources> </resources>
\ No newline at end of file
...@@ -57,5 +57,4 @@ ...@@ -57,5 +57,4 @@
<external-cache-path <external-cache-path
name="external_cache_path" name="external_cache_path"
path="" /> path="" />
</paths> </paths>
...@@ -33,14 +33,14 @@ android { ...@@ -33,14 +33,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -28,24 +28,15 @@ android { ...@@ -28,24 +28,15 @@ android {
resourcePrefix "order" resourcePrefix "order"
buildTypes { buildTypes {
// Test {
// buildConfigField "boolean", "LOG_DEBUG", "false"
// buildConfigField "boolean", "USE_CANARY", "false"
// minifyEnabled false
// shrinkResources false
// zipAlignEnabled false
// proguardFiles 'proguard.cfg'
// }
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled true minifyEnabled true
// shrinkResources true // shrinkResources true
zipAlignEnabled true zipAlignEnabled true
......
...@@ -17,24 +17,15 @@ android { ...@@ -17,24 +17,15 @@ android {
versionName rootProject.ext.android["versionName"] versionName rootProject.ext.android["versionName"]
} }
buildTypes { buildTypes {
// Test {
// buildConfigField "boolean", "LOG_DEBUG", "false"
// buildConfigField "boolean", "USE_CANARY", "false"
// minifyEnabled false
// shrinkResources false
// zipAlignEnabled false
// proguardFiles 'proguard-rules.pro'
// }
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard-rules.pro' proguardFiles 'proguard-rules.pro'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled true minifyEnabled true
// shrinkResources true // shrinkResources true
zipAlignEnabled true zipAlignEnabled true
......
...@@ -21,14 +21,14 @@ android { ...@@ -21,14 +21,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard-rules.pro' proguardFiles 'proguard-rules.pro'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
zipAlignEnabled false zipAlignEnabled false
proguardFiles 'proguard-rules.pro' proguardFiles 'proguard-rules.pro'
......
...@@ -33,24 +33,15 @@ android { ...@@ -33,24 +33,15 @@ android {
// enabled = true // enabled = true
// } // }
buildTypes { buildTypes {
// Test {
// buildConfigField "boolean", "LOG_DEBUG", "false"
// buildConfigField "boolean", "USE_CANARY", "false"
// minifyEnabled false
// shrinkResources false
// zipAlignEnabled false
// proguardFiles 'proguard.cfg'
// }
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled true minifyEnabled true
// shrinkResources true // shrinkResources true
zipAlignEnabled true zipAlignEnabled true
......
...@@ -2,6 +2,8 @@ package com.gingersoft.gsa.cloud.ui.adapter.bean; ...@@ -2,6 +2,8 @@ package com.gingersoft.gsa.cloud.ui.adapter.bean;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.View;
import lombok.Data; import lombok.Data;
import me.yokeyword.fragmentation.ISupportFragment; import me.yokeyword.fragmentation.ISupportFragment;
...@@ -19,11 +21,14 @@ public class MultiInputBean extends InfoMultiBean { ...@@ -19,11 +21,14 @@ public class MultiInputBean extends InfoMultiBean {
private int inputType = -1; private int inputType = -1;
private int maxLength = 0; private int maxLength = 0;
private TextWatcher textWatcher; private TextWatcher textWatcher;
/** /**
* 是否可以編輯 * 是否可以編輯
*/ */
private boolean isEdit = true; private boolean isEdit = true;
/**
* 輸入框的焦點事件
*/
private View.OnFocusChangeListener onFocusChangeListener;
private MultiInputBean() { private MultiInputBean() {
} }
...@@ -36,7 +41,11 @@ public class MultiInputBean extends InfoMultiBean { ...@@ -36,7 +41,11 @@ public class MultiInputBean extends InfoMultiBean {
super(itemType, showTitle, isRequired, hintText); super(itemType, showTitle, isRequired, hintText);
this.inputFilters = inputFilters; this.inputFilters = inputFilters;
} }
public MultiInputBean(int itemType, String showTitle, boolean isRequired, String hintText, InputFilter[] inputFilters, View.OnFocusChangeListener onFocusChangeListener) {
super(itemType, showTitle, isRequired, hintText);
this.inputFilters = inputFilters;
this.onFocusChangeListener = onFocusChangeListener;
}
public MultiInputBean(int itemType, String showTitle, boolean isRequired, String hintText, int type) { public MultiInputBean(int itemType, String showTitle, boolean isRequired, String hintText, int type) {
super(itemType, showTitle, isRequired, hintText); super(itemType, showTitle, isRequired, hintText);
this.inputType = type; this.inputType = type;
......
...@@ -6,6 +6,8 @@ import android.view.View; ...@@ -6,6 +6,8 @@ import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.core.content.ContextCompat;
import com.chad.library.adapter.base.provider.BaseItemProvider; import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder; import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil; import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
...@@ -18,6 +20,8 @@ import com.xuexiang.rxutil2.rxjava.RxJavaUtils; ...@@ -18,6 +20,8 @@ import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.concurrent.TimeUnit;
/** /**
* @author 宇航. * @author 宇航.
* User: admin * User: admin
...@@ -78,10 +82,21 @@ public class InputProvider<T extends InfoMultiBean> extends BaseItemProvider<T> ...@@ -78,10 +82,21 @@ public class InputProvider<T extends InfoMultiBean> extends BaseItemProvider<T>
editText.setOnFocusChangeListener((v, hasFocus) -> { editText.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) { if (hasFocus) {
editText.addTextChangedListener(textWatcher); editText.addTextChangedListener(textWatcher);
RxJavaUtils.delay(1, aLong -> baseViewHolder.setGone(R.id.iv_clear_multi_content, TextUtil.isEmptyOrNullOrUndefined(editText))); RxJavaUtils.delay(500,
TimeUnit.MILLISECONDS, aLong -> baseViewHolder.setGone(R.id.iv_clear_multi_content, TextUtil.isEmptyOrNullOrUndefined(editText)), throwable -> { });
} else { } else {
editText.removeTextChangedListener(textWatcher); editText.removeTextChangedListener(textWatcher);
RxJavaUtils.delay(1, aLong -> baseViewHolder.setGone(R.id.iv_clear_multi_content, true)); RxJavaUtils.delay(500,
TimeUnit.MILLISECONDS, aLong -> baseViewHolder.setGone(R.id.iv_clear_multi_content, true), throwable -> { });
}
if (getAdapter() != null) {
T infoBean = getAdapter().getData().get(baseViewHolder.getAdapterPosition());
if (infoBean instanceof MultiInputBean) {
MultiInputBean currentInputBean = (MultiInputBean) infoBean;
if (currentInputBean.getOnFocusChangeListener() != null) {
currentInputBean.getOnFocusChangeListener().onFocusChange(v, hasFocus);
}
}
} }
}); });
ImageView ivClear = baseViewHolder.getView(R.id.iv_clear_multi_content); ImageView ivClear = baseViewHolder.getView(R.id.iv_clear_multi_content);
...@@ -94,11 +109,11 @@ public class InputProvider<T extends InfoMultiBean> extends BaseItemProvider<T> ...@@ -94,11 +109,11 @@ public class InputProvider<T extends InfoMultiBean> extends BaseItemProvider<T>
editText.setFocusable(infoMultiBean.isEdit()); editText.setFocusable(infoMultiBean.isEdit());
// if (infoMultiBean.isEdit()) { if (infoMultiBean.isEdit()) {
// editText.setTextColor(ContextCompat.getColor(context, R.color.color_3c)); editText.setTextColor(ContextCompat.getColor(context, R.color.color_3c));
// } else { } else {
// editText.setTextColor(ContextCompat.getColor(context, R.color.color_c9)); editText.setTextColor(ContextCompat.getColor(context, R.color.color_ef));
// } }
} }
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
style="@style/Multi_Input_editStyle" style="@style/Multi_Input_editStyle"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:drawablePadding="@dimen/dp_5"
android:layout_marginLeft="@dimen/dp_5" android:layout_marginLeft="@dimen/dp_5"
android:layout_weight="1" android:layout_weight="1"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
......
...@@ -20,14 +20,14 @@ android { ...@@ -20,14 +20,14 @@ android {
buildTypes { buildTypes {
debug { debug {
buildConfigField "boolean", "LOG_DEBUG", "true" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", "true" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false minifyEnabled false
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
release { release {
buildConfigField "boolean", "LOG_DEBUG", "false" buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", "false" buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false minifyEnabled false
shrinkResources false shrinkResources false
zipAlignEnabled false zipAlignEnabled false
......
...@@ -18,16 +18,6 @@ ...@@ -18,16 +18,6 @@
android:theme="@style/DialogActivityTheme" /> android:theme="@style/DialogActivityTheme" />
<service android:name="service.UpdateAppService"/> <service android:name="service.UpdateAppService"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/update_file_paths"/>
</provider>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path path="" name="files_root" />
</paths>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment