Commit 98226f8e by Wyh

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

parent 1e28402f
......@@ -29,14 +29,14 @@ android {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
......
......@@ -37,14 +37,14 @@ android {
resourcePrefix "coldChain"
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
......
......@@ -2,7 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.coldchain_module">
<application>
<activity
android:name=".mvp.ui.activity.OrderDetailsActivity"
......
......@@ -32,14 +32,14 @@ android {
// }
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
......
......@@ -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.Companion.verifiAmountTip
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.user.UserContext
import com.gingersoft.gsa.cloud.common.service.GetInfoUpdateService
......@@ -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.order.order.TakeawayOrder
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.delivery_pick_mode.R
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.ui.adapter.DeliveryAdapter
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.xuexiang.rxutil2.rxjava.RxJavaUtils
import io.reactivex.disposables.Disposable
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
......@@ -115,12 +116,12 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
//遍歷獲得外賣自取的 待確認和製作中的總單數
for (i in data.selfTakeaway) {
when {
i.STATUS == 0 -> //未支付的待確認
when (i.STATUS) {
0 -> //未支付的待確認
mOrderNum[1].value = mOrderNum[1].value?.plus(i.SumNum)
i.STATUS == 1 -> //已支付的待確認
1 -> //已支付的待確認
mOrderNum[1].value = mOrderNum[1].value?.plus(i.SumNum)
i.STATUS == 2 -> //製作中
2 -> //製作中
mOrderNum[2].value = i.SumNum
}
}
......@@ -179,11 +180,13 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
})
}
private var autoPolling: Disposable? = null;
/**
* 開始自動確認訂單
*/
fun startAutoConfirmOrder() {
RxTimerUtil.interval({
autoPolling = RxJavaUtils.polling(10) {
launch({
//獲取即時單
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() {
//如果是自取單,將物流類型改為本店
orderDetail.companyType = 0
}
//交通工具類型
var trafficType = ""
if (orderDetail.companyType == 2) {
//lalamove
......@@ -221,21 +225,7 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
confirmOrder(orderDetail, 2, trafficType, restaurantId, isPrintPrj = true, isPrintBill = true) {
//確認之後,刷新列表
refreshState.postValue(0)
}
}
}
} else {
}
} else {
}
} else {
}
}
launch({
//獲取預約單
repository.requestOrderList(restaurantId.toString(), fragmentStatus[1], fragmentType[0], "1", orderNo, phone, 1).apply {
if (isSuccess()) {
......@@ -257,13 +247,28 @@ class PageViewModel(private val repository: WeatherRepository) : ViewModel() {
}
}
}
}, {})
}
}
}
} else {
}
} else {
}
} else {
}
}
}, {
//報錯處理
})
}, 10 * 1000)
}
}
fun stopAutoConfirmOrder() {
RxTimerUtil.cancelInterval()
autoPolling?.dispose()
}
......
......@@ -57,8 +57,8 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
private val pageViewModel by lazy { ViewModelProvider(this, InjectorUtil.getWeatherModelFactory())[PageViewModel::class.java] }
private val instance by lazy { this }
private val restaurantId by lazy { RestaurantInfoManager.newInstance().getRestaurantId() }
private val memberId by lazy { UserContext.newInstance().getMemberId() }
private val restaurantId by lazy { RestaurantInfoManager.newInstance().restaurantId }
private val memberId by lazy { UserContext.newInstance().memberId }
private val ints = arrayOf(
R.string.tab_text_1,
......@@ -92,9 +92,13 @@ class DeliveryOrderMainActivity : BaseActivity<IPresenter>(), View.OnClickListen
mReceiver = ClearHeartBroadcastReceiver()
registerReceiver(mReceiver, mFilter)
val binding: ActivityOtherOrderBinding = DataBindingUtil.setContentView(this, R.layout.activity_other_order)
//初始化超時時間
initOutTime()
//初始化心跳長連接
initWebsocket()
//初始化標題欄
initAppTop()
//初始化切換餐廳狀態
initSwitchRestStatus()
initViewPager()
......
......@@ -35,15 +35,15 @@ android {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
shrinkResources false
zipAlignEnabled false
......
......@@ -37,15 +37,15 @@ android {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
signingConfig signingConfigs.GSAndroidNew
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
......@@ -122,10 +122,10 @@ dependencies {
addComponent 'component-delivery-pick'
addComponent 'component-manager'
addComponent 'component-coldchain'
// addComponent 'component-supply-chain'
addComponent 'component-supply-chain'
addComponent 'component-webview'
// addComponent 'component-scan'
// addComponent 'component-pay'
addComponent 'component-scan'
addComponent 'component-pay'
implementation 'androidx.viewpager2:viewpager2:1.0.0-alpha03'
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
......
......@@ -74,10 +74,10 @@
android:theme="@style/AppTheme"
tools:replace="android:label">
<!--适配android 7.0文件访问 -->
<!-- &lt;!&ndash;适配android 7.0文件访问 &ndash;&gt;-->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.gingersoft.gsa.cloud.login"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
......
......@@ -17,7 +17,6 @@
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".mvp.ui.activity.mvp.ui.activity.WelcomeActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -37,14 +37,14 @@ android {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
shrinkResources false
zipAlignEnabled false
......
......@@ -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/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/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 {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
shrinkResources false
zipAlignEnabled false
......
......@@ -27,14 +27,14 @@ android {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard-rules.pro'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
shrinkResources false
zipAlignEnabled false
......
......@@ -23,14 +23,14 @@ android {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
......
......@@ -27,14 +27,14 @@ android {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
shrinkResources false
zipAlignEnabled false
......
......@@ -34,14 +34,14 @@ android {
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["debugLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["debugUseCanary"]
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
buildConfigField "boolean", "LOG_DEBUG", rootProject.ext.buildType["releaseLogDebug"]
buildConfigField "boolean", "USE_CANARY", rootProject.ext.buildType["releaseUseCanary"]
minifyEnabled false
shrinkResources false
zipAlignEnabled false
......
......@@ -20,10 +20,20 @@
android:name="design_height_in_dp"
android:value="640" />
<!-- <activity-->
<!-- android:name="com.yalantis.ucrop.UCropActivity"-->
<!-- android:screenOrientation="portrait"-->
<!-- android:theme="@style/Theme.AppCompat.Light.NoActionBar" />-->
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
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>
</manifest>
\ No newline at end of file
......@@ -30,19 +30,12 @@
android:value="360" />
<meta-data
android:name="design_height_in_dp"
android:value="640" /> <!-- 适配android 7.0文件访问 -->
<!-- <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>-->
android:value="640" />
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
</application>
</manifest>
\ No newline at end of file
......@@ -5,18 +5,18 @@ import dagger.Component;
import com.jess.arms.di.component.AppComponent;
import com.gingersoft.supply_chain.di.module.WareHousingDetailsModule;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
import com.gingersoft.supply_chain.di.module.WarehouseDetailsModule;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
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:
* <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="https://github.com/JessYanCoding">Follow 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
* ================================================
*/
@FragmentScope
@Component(modules = WareHousingDetailsModule.class, dependencies = AppComponent.class)
public interface WareHousingDetailsComponent {
void inject(WareHousingDetailsFragment fragment);
@Component(modules = WarehouseDetailsModule.class, dependencies = AppComponent.class)
public interface WarehouseDetailsComponent {
void inject(WarehouseDetailsFragment fragment);
@Component.Builder
interface Builder {
@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;
import dagger.Module;
import dagger.Provides;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
import com.gingersoft.supply_chain.mvp.model.WareHousingDetailsModel;
import com.gingersoft.supply_chain.mvp.contract.WarehouseDetailsContract;
import com.gingersoft.supply_chain.mvp.model.WarehouseDetailsModel;
/**
* ================================================
* Description:
* <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="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
......@@ -23,8 +23,8 @@ import com.gingersoft.supply_chain.mvp.model.WareHousingDetailsModel;
* ================================================
*/
@Module
public abstract class WareHousingDetailsModule {
public abstract class WarehouseDetailsModule {
@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 {
private int restaurantId;
private String sendingAddress;
//默認第二天
private long initialShippingTime;
private String initialShippingTime;
private double totalAmount;
private int shipping;
/**
* 運費
*/
private double shipping;
/**
* 實際支付金額
*/
private double actualPayment;
/**
* 備註
*/
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.setSupplierId(supplierId);
purchaseOrder.setSupplierName(supplierName);
purchaseOrder.setSupplierId(shoppingCartBean.getSupplierId());
purchaseOrder.setSupplierName(shoppingCartBean.getSupplierName());
purchaseOrder.setBrandId(RestaurantInfoManager.newInstance().getBrandId());
purchaseOrder.setRestaurantId(RestaurantInfoManager.newInstance().getRestaurantId());
purchaseOrder.setInitialShippingTime(TimeUtils.getNextDayLong(1));
purchaseOrder.setRemarks(shoppingCartBean.getRemarks());
purchaseOrder.setInitialShippingTime(shoppingCartBean.getInitialShippingTime());
purchaseOrder.setTotalAmount(totalAmount);
purchaseOrder.setActualPayment(MoneyUtil.sum(purchaseOrder.getTotalAmount(), purchaseOrder.getShipping()));
purchaseOrder.setActualPayment(MoneyUtil.sum(totalAmount, shoppingCartBean.getShipping()));
return purchaseOrder;
}
......
......@@ -36,6 +36,10 @@ public class DeputyUnitBean implements Serializable {
*/
private double deputyValue;
/**
* 入庫單位單價
*/
private double unitPrice;
/**
* 食材id
*/
private int purchaseFoodId;
......@@ -66,6 +70,16 @@ public class DeputyUnitBean implements Serializable {
deputyUnitBean.setDeputyUnit(wareHousingUnitBean.getUnitName());
deputyUnitBean.setDeputyValue(wareHousingUnitBean.getUnitValue());
deputyUnitBean.setConversionMultiple(wareHousingUnitBean.getConversionMultiple());
deputyUnitBean.setUnitPrice(wareHousingUnitBean.getUnitPrice());
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 {
private String remarks;
private long createTime;
private long updateTime;
private int deletes;
private Integer deletes;
/**
* 子類
*/
......
......@@ -21,6 +21,9 @@ public class OrderWareHouseBean {
@Data
public static class PurchaseWarehousingOrder {
/**
* 訂單圖片,多張,用逗號分隔
*/
private String files;
private String remarks;
private double totalPrice;
......@@ -47,6 +50,6 @@ public class OrderWareHouseBean {
/**
* 副單位
*/
private List<WareHousingUnitBean> purchaseWarehousingUnits;
private WareHousingUnitBean purchaseWarehousingUnit;
}
}
......@@ -100,7 +100,7 @@ public class PurchaseOrderDetailsBean {
* 食品數量
*/
private int foodQuantity;
private int foodPrice;
private double foodPrice;
private int status;
private int purchaseFoodId;
private String images;
......@@ -131,13 +131,18 @@ public class PurchaseOrderDetailsBean {
/**
* 入庫後,後台傳來的副單位數據
*/
private List<WareHousingUnitBean> purchaseWarehousingUnits;
WareHousingUnitBean purchaseWarehousingUnit;
/**
* 已入庫數量
*/
private int warehousingQuantity;
// List<DeputyUnitBean> deputyUnitBeans;
/**
* 沒有入庫單號,暫時用訂單編號
*/
private String orderNo;
private DeputyUnitBean showUnit;
}
}
......@@ -42,11 +42,20 @@ public class ShoppingCartBean {
*/
private double selectFoodAmount;
/**
* 預計送達時間
*/
private String initialShippingTime;
/**
* 當前供應商下的食品是否全選
*/
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 {
private int countryId;
private long createTime;
private long updateTime;
private int deletes;
private Integer deletes;
private double minimumAmount;
private List<SupplierContacts> supplierContacts;
......
......@@ -13,7 +13,7 @@ public class WareHousingUnitBean {
/**
* 入庫單詳情id
*/
private int purchaseWarehousingOrderDetailsId;
private Integer purchaseWarehousingOrderDetailsId;
/**
* 副單位名稱
*/
......@@ -23,6 +23,10 @@ public class WareHousingUnitBean {
*/
private double unitValue;
/**
* 入庫單位單價
*/
private double unitPrice;
/**
* 換算倍數
*/
private double conversionMultiple;
......@@ -38,6 +42,10 @@ public class WareHousingUnitBean {
this.conversionMultiple = conversionMultiple;
}
public WareHousingUnitBean() {
}
public int getId() {
return id;
}
......@@ -93,4 +101,16 @@ public class WareHousingUnitBean {
public void setRestaurantId(int 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;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.core.restaurant.RestaurantInfoManager;
import com.gingersoft.gsa.cloud.common.utils.other.TextUtil;
import java.util.Map;
......@@ -30,6 +32,12 @@ public class Constant {
public static final String GET_INFO_ERROR = "數據獲取失敗,請稍候再試";
public static final String INFO_SYNTAX_ERROR = "數據解析失敗,請聯繫開發人員";
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 SAVE_LOADING = "保存中...";
public static final String SAVE_SUCCESS = "保存成功";
......
......@@ -43,5 +43,7 @@ public interface CategoryContract {
Observable<BaseResult> createFoodCategory(RequestBody requestBody);
Observable<BaseResult> updateFoodCategory(RequestBody requestBody);
Observable<BaseResult> deleteFoodCategory(RequestBody requestBody);
}
}
......@@ -4,6 +4,8 @@ import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.jess.arms.mvp.IModel;
import com.jess.arms.mvp.IView;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.RequestBody;
......@@ -38,5 +40,8 @@ public interface NewSupplierContract {
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;
import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
......@@ -25,6 +29,8 @@ public interface OrderDetailsContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
void loadOrderDetails(PurchaseOrderDetailsBean orderDetailsBean);
void uploadPicSuccess(String imgUrl);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......@@ -35,5 +41,10 @@ public interface OrderDetailsContract {
* 入庫
*/
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 {
Observable<PurchaseOrderResultBean> getOrderList(Map<String, Object> map);
Observable<BaseResult> updateOrder(RequestBody requestBody);
Observable<BaseResult> deleteOrder(int orderId);
}
}
......@@ -40,6 +40,10 @@ public interface ShoppingCatContract {
*/
void notifyAdapter(int position);
/**
* 設置創建訂單按鈕顯示狀態
*/
void setCreateBtnState(boolean checkable);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
......@@ -43,5 +43,7 @@ public interface SupplierListContract {
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;
* ================================================
* Description:
* <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="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
......@@ -16,7 +16,7 @@ import com.jess.arms.mvp.IModel;
* <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
* ================================================
*/
public interface WareHousingDetailsContract {
public interface WarehousingInventoryContract {
//对于经常使用的关于UI的方法可以定义到IView中,如显示隐藏进度条,和显示文字消息
interface View extends IView {
......
......@@ -65,4 +65,9 @@ public class CategoryModel extends BaseModel implements CategoryContract.Model {
public Observable<BaseResult> updateFoodCategory(RequestBody 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;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import java.util.Map;
import javax.inject.Inject;
import io.reactivex.Observable;
......@@ -71,4 +73,14 @@ public class NewSupplierModel extends BaseModel implements NewSupplierContract.M
public Observable<BaseResult> addSupplierContact(RequestBody 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;
import com.gingersoft.supply_chain.mvp.contract.OrderDetailsContract;
import java.util.List;
import java.util.Map;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
......@@ -58,4 +62,14 @@ public class OrderDetailsModel extends BaseModel implements OrderDetailsContract
public Observable<BaseResult> addWarehouse(RequestBody 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
public Observable<BaseResult> updateOrder(RequestBody 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
public Observable<BaseResult> updateSupplier(RequestBody 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;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
/**
* ================================================
* Description:
* <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="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
......@@ -26,14 +26,14 @@ import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
* ================================================
*/
@FragmentScope
public class WareHousingDetailsModel extends BaseModel implements WareHousingDetailsContract.Model {
public class WarehousingInventoryModel extends BaseModel implements WarehousingInventoryContract.Model {
@Inject
Gson mGson;
@Inject
Application mApplication;
@Inject
public WareHousingDetailsModel(IRepositoryManager repositoryManager) {
public WarehousingInventoryModel(IRepositoryManager repositoryManager) {
super(repositoryManager);
}
......
......@@ -27,6 +27,7 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.schedulers.Schedulers;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;
import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.RequestBody;
......@@ -95,7 +96,7 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
}
mModel.getFoodCategoryList(map)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中..."))
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.GET_INFO_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> {
......@@ -217,10 +218,33 @@ public class CategoryPresenter extends BasePresenter<CategoryContract.Model, Cat
return foodCategoryBean;
}
public void deleteFoodCategory(FoodCategoryResultBean.DataBean.FoodCategoryBean foodCategoryBean, int hierarchy, int position) {
foodCategoryBean.setDeletes(Constant.DELETE);
updateFoodCategory(foodCategoryBean, hierarchy, position);
public void deleteFoodCategory(int id, int hierarchy, int position) {
RequestBody requestBody = new FormBody.Builder()
.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
......
......@@ -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 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, "基本單位", 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, "請輸入單價,保留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
//包裝描述
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) {
infoMultiBeans.get(foodIngredientPriceIndex).setShowValue(purchaseFoodBean.getUnitPrice() + "");
......@@ -298,7 +302,7 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
public void setCategoryInfo(List<SectionCheckItem> sectionCheckItems, List<InfoMultiBean> infoMultiBeans) {
StringBuilder categoryName = new StringBuilder();
if(categoryNames == null){
if (categoryNames == null) {
categoryNames = new ArrayList<>();
}
categoryNames.clear();
......@@ -314,6 +318,10 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
mRootView.refreshAdapterByPosition(foodIngredientCategoryIndex);
}
/**
* 上傳圖片
* @param filePath 圖片路徑
*/
public void uploadPic(String filePath) {
File file = new File(BitmapUtil.compressImage(filePath));
List<MultipartBody.Part> multipartBodies = new ArrayList<>();
......@@ -408,6 +416,8 @@ public class NewFoodIngredientsPresenter extends BasePresenter<NewFoodIngredient
msg = "請輸入食材名稱";
} else if (TextUtil.isEmptyOrNullOrUndefined(categoryName)) {
msg = "請選擇食材類別";
} else if (TextUtil.isEmptyOrNullOrUndefined(infoMultiBeans.get(basicUnitIndex).getShowValue())) {
msg = "請選擇基本單位";
}
return msg;
}
......
......@@ -3,7 +3,10 @@ package com.gingersoft.supply_chain.mvp.presenter;
import android.app.Application;
import android.content.Context;
import android.text.InputFilter;
import android.text.InputType;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.constans.AppConstans;
......@@ -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.supply_chain.R;
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.jess.arms.di.scope.FragmentScope;
import com.jess.arms.http.imageloader.ImageLoader;
......@@ -29,8 +33,10 @@ import com.jess.arms.utils.EnAndNumInputFilter;
import com.jess.arms.utils.RxLifecycleUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
......@@ -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_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, "名稱", 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, 11)}, EditorInfo.TYPE_CLASS_PHONE));
......@@ -139,8 +145,9 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
// childInfoMulti.add(new MultiInputBean(InfoMultiBean.ITEM_TYPE_INPUT, "Kakao Talk", false, "請輸入Kakao Talk"));
// receivingMode.setInfoMultiBeans(childInfoMulti);
// infoMultiBeans.add(receivingMode);
contactInfo.add(new MultiCheckInputBean(InfoMultiBean.ITEM_MULTIPLE_CHECKBOX, "Email", false, "請輸入Email", new InputFilter[]{InputFilterUtils.getLengthFilter(mContext, 20)}, R.drawable.ic_email, false));
MultiCheckInputBean emailInputBean = 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, "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));
......@@ -190,6 +197,62 @@ public class NewSupplierPresenter extends BasePresenter<NewSupplierContract.Mode
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
}
/**
* 刪除供應商信息
*/
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
......
......@@ -118,13 +118,15 @@ public class PurchaseListPresenter extends BasePresenter<PurchaseListContract.Mo
});
}
public void deleteOrder(int position, OrderBean orderBean) {
orderBean.setDeletes(Constant.DELETE);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(orderBean));
mModel.updateOrder(requestBody)
/**
* 刪除訂單
* @param position 訂單下標
* @param orderId 訂單id
*/
public void deleteOrder(int position, int orderId) {
mModel.deleteOrder(orderId)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("獲取中..."))
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
......
......@@ -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.gson.GsonUtils;
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.NewPurchaseOrderBean;
import com.gingersoft.supply_chain.mvp.bean.PurchaseFoodBean;
......@@ -21,6 +22,7 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils;
import com.xuexiang.rxutil2.rxjava.RxJavaUtils;
import com.xuexiang.rxutil2.rxjava.task.RxAsyncTask;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -88,6 +90,8 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
int totalTypeNumber = 0;
getFoodsBySupplierGrouping(listMap);
shoppingCartBeans = new ArrayList<>();
//創建訂單按鈕是否可點擊,只要有供應商不滿足最低採購,就不能點擊
boolean createBtnCheckable = true;
//將裝有不同供應商和供應商食品的map轉換為用於顯示的集合數據
for (Map.Entry<Integer, List<PurchaseFoodBean>> entry : listMap.entrySet()) {
ShoppingCartBean shoppingCartBean = new ShoppingCartBean();
......@@ -112,6 +116,11 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
shoppingCartBean.setAllSelect(false);
}
}
if (MoneyUtil.compareTo(shoppingCartBean.getMinimumAmount(), supplierTotalAmount) == 1) {
createBtnCheckable = false;
}
// shoppingCartBean.setShipping();運費
shoppingCartBean.setInitialShippingTime(TimeUtils.getNextDay(1));
shoppingCartBean.setSelectFoodAmount(supplierTotalAmount);
shoppingCartBean.setSelectSpeciesNum(supplierTotalSpecies);
//統計所有供應商的選中的食材的總金額
......@@ -122,6 +131,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
}
shoppingCartBeans.add(shoppingCartBean);
}
mRootView.setCreateBtnState(createBtnCheckable);
mRootView.loadAdapter(shoppingCartBeans);
mRootView.setTotalInfo(totalTypeNumber, totalPrice);
}
......@@ -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;
if (shoppingCartBeans == null || shoppingCartBeans.size() <= 0) {
mRootView.showMessage("請添加食材");
return;
return false;
}
for (ShoppingCartBean shoppingCartBean : shoppingCartBeans) {
if (shoppingCartBean.isAllSelect()) {
......@@ -280,8 +290,12 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
if (!isHasFood) {
//沒有食品,不允許提交訂單,提示用戶
mRootView.showMessage("請選擇採購食品");
return;
return false;
}
return true;
}
public void createOrder(List<ShoppingCartBean> shoppingCartBeans) {
//將供應商和食材信息轉換為提交訂單的數據
List<ConfirmOrderBean> confirmOrderBeanList = new ArrayList<>();
for (int i = 0; i < shoppingCartBeans.size(); i++) {
......@@ -309,7 +323,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
return;
}
//配置訂單信息
confirmOrderBean.setPurchaseOrder(ConfirmOrderBean.conversionPurchaseOrder(shoppingCartBean.getSupplierId(), shoppingCartBean.getSupplierName(), totalAmount));
confirmOrderBean.setPurchaseOrder(ConfirmOrderBean.conversionPurchaseOrder(shoppingCartBean, totalAmount));
confirmOrderBean.setMinimumAmount(shoppingCartBean.getMinimumAmount());
confirmOrderBeanList.add(confirmOrderBean);
}
......@@ -317,6 +331,47 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
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) {
if (confirmOrderBeans == null) {
mRootView.showMessage("訂單計算出錯,請退出重試");
......@@ -333,7 +388,7 @@ public class ShoppingCatPresenter extends BasePresenter<ShoppingCatContract.Mode
@Override
public void onNext(BaseResult baseResult) {
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<>();
for (ConfirmOrderBean confirmOrderBean : confirmOrderBeanList) {
for (ConfirmOrderBean confirmOrderBean1 : confirmOrderBeans) {
......
......@@ -162,14 +162,15 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
});
}
public void deleteSupplier(SupplierInfoBean supplierBean, int position) {
supplierBean.setDeletes(1);
supplierBean.setSupplierName(null);
supplierBean.setSupplierNo(null);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), GsonUtils.GsonString(supplierBean));
mModel.updateSupplier(requestBody)
/**
* 刪除供應商
* @param id 供應商id
* @param position 所刪除的供應商下標
*/
public void deleteSupplier(int id, int position) {
mModel.deleteSupplier(id)
.subscribeOn(Schedulers.io())
.doOnSubscribe(disposable -> mRootView.showLoading("刪除中..."))
.doOnSubscribe(disposable -> mRootView.showLoading(Constant.DELETE_LOADING))
.subscribeOn(AndroidSchedulers.mainThread())
.observeOn(AndroidSchedulers.mainThread())
.doAfterTerminate(() -> mRootView.hideLoading())
......@@ -184,7 +185,7 @@ public class SupplierListPresenter extends BasePresenter<SupplierListContract.Mo
} else if (TextUtil.isNotEmptyOrNullOrUndefined(info.getErrMsg())) {
mRootView.showMessage(info.getErrMsg());
} 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;
import javax.inject.Inject;
import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
import com.gingersoft.supply_chain.mvp.contract.WarehousingInventoryContract;
/**
* ================================================
* Description:
* <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="https://github.com/JessYanCoding">Follow me</a>
* <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
......@@ -27,7 +27,7 @@ import com.gingersoft.supply_chain.mvp.contract.WareHousingDetailsContract;
* ================================================
*/
@FragmentScope
public class WareHousingDetailsPresenter extends BasePresenter<WareHousingDetailsContract.Model, WareHousingDetailsContract.View> {
public class WarehousingInventoryPresenter extends BasePresenter<WarehousingInventoryContract.Model, WarehousingInventoryContract.View> {
@Inject
RxErrorHandler mErrorHandler;
@Inject
......@@ -38,7 +38,7 @@ public class WareHousingDetailsPresenter extends BasePresenter<WareHousingDetail
AppManager mAppManager;
@Inject
public WareHousingDetailsPresenter(WareHousingDetailsContract.Model model, WareHousingDetailsContract.View rootView) {
public WarehousingInventoryPresenter(WarehousingInventoryContract.Model model, WarehousingInventoryContract.View rootView) {
super(model, rootView);
}
......
......@@ -69,6 +69,26 @@ public interface SupplierServer {
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
......@@ -153,6 +173,16 @@ public interface SupplierServer {
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
......@@ -242,6 +272,16 @@ public interface SupplierServer {
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
......@@ -353,4 +393,20 @@ public interface SupplierServer {
@POST("basicUnitType/add" + RetrofitUrlManager.IDENTIFICATION_PATH_SIZE + 2)
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
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_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_freight, purchaseOrder.getShipping() + "");
holder.setText(R.id.tv_confirm_order_item_pay_amount, purchaseOrder.getActualPayment() + "");
......
......@@ -3,6 +3,8 @@ package com.gingersoft.supply_chain.mvp.ui.adapter;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
......@@ -194,6 +196,23 @@ public class FoodListAdapter extends BaseQuickAdapter<PurchaseFoodBean, BaseView
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() {
@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);
}
}
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.
public WarehousingQueryAdapter(Context context, List<WareHouseListBean.WareHousingDataBean.PurchaseWarehousingOrderDetailsVOSBean> purchaseWarehousingOrderDetailsVosBeans) {
super(R.layout.item_warehousing_query, purchaseWarehousingOrderDetailsVosBeans);
addChildClickViewIds(R.id.tv_warehouse_item_inventory_quantity);
this.context = context;
}
......
......@@ -402,6 +402,10 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
@Override
public void loadCategory(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
if (foodCategoryTrees.size() <= 0) {
loadService.showCallback(EmptyCallback.class);
} else {
loadService.showSuccess();
initPrimaryAdapter(foodCategoryTrees);
orderCategoryAdapter.setOnSecondCategoryClickListener((foodCategoryTrees1, position) -> {
//當前分類顯示的是一級分類和二級分類,二級分類的點擊事件
......@@ -414,6 +418,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
}
});
}
}
@Override
public void loadFail() {
......@@ -500,6 +505,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
private void initPrimaryAdapter
(List<OrderCategoryBean.FoodCategoryTrees> foodCategoryTrees) {
loadService.showSuccess();
if (orderCategoryAdapter == null) {
orderCategoryAdapter = new OrderCategoryAdapter(mContext, foodCategoryTrees);
} else {
......@@ -513,7 +519,7 @@ public class FoodIngredientsFragment extends BaseSupplyChainFragment<FoodIngredi
getFoodsByCategoryId();
orderCategoryAdapter.setSelectIndex(position);
});
if (categoryId == -1) {
if (categoryId == -1 && orderCategoryAdapter.getItemCount() > 0) {
//第一次進來,獲取默認的數據
orderCategoryAdapter.getOnItemClickListener().onItemClick(orderCategoryAdapter, null, 0);
}
......
package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.app.Dialog;
import android.os.Bundle;
import android.text.InputFilter;
import android.view.LayoutInflater;
......@@ -101,6 +102,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
* 當前訂單列表類型的下標
*/
private int orderStateIndex = 0;
private final static int REQUEST_ORDER_DETAILS_CODE = 1001;
@Override
......@@ -125,7 +127,7 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
edSearch.setFilters(new InputFilter[]{InputFilterUtils.getChAndEnAndNumInputFilter(mContext), InputFilterUtils.getLengthFilter(mContext, 20)});
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());
refreshPurchaseList.setOnRefreshListener(refreshLayout -> {
......@@ -173,7 +175,10 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
.setSelectColor(ContextCompat.getColor(mContext, R.color.theme_color));
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) -> {
int viewId = view.getId();
if (viewId == R.id.iv_purchase_order_more) {
......@@ -183,22 +188,15 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
.hasShadowBg(false)
.popupPosition(PopupPosition.Left)
.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})
.setOnSelectListener((position1, text) -> {
if (position1 == 2) {
//發送
//發送採購單
sendPurchase(position);
}
}))
//, "再次购买" , R.drawable.ic_purchase_buy_again
.setStringData(new String[]{"删除", "发送"}, new int[]{R.drawable.ic_purchase_delete, R.drawable.ic_purchase_send})
.setOnSelectListener(mOnSelectListener))
.show();
}
});
PurchasePageAdapter adapter = new PurchasePageAdapter(purchaseOrderAdapter, 2);
contentViewPager.setAdapter(adapter);
mTabSegment.setupWithViewPager(contentViewPager);
//new QMUITabIndicator(
// QMUIDisplayHelper.dp2px(getContext(), 2), false, false)
QMUITabIndicator qmuiTabIndicator = new QMUITabIndicator(
ContextCompat.getDrawable(mContext, R.drawable.ic_open_close), false, false, ContextCompat.getColor(mContext, R.color.color_3c));
mTabSegment.setIndicator(qmuiTabIndicator);
......@@ -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) {
List<OrderBean> data = purchaseOrderAdapter.getData();
OrderBean orderBean = data.get(position);
......@@ -293,8 +307,8 @@ public class PurchaseListFragment extends BaseSupplyChainFragment<PurchaseListPr
@Override
public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
super.onFragmentResult(requestCode, resultCode, data);
if (requestCode == REQUEST_ORDER_DETAILS_CODE && resultCode == RESULT_OK) {
//用戶進行了收貨操作,需要對列表進行刷新
if (requestCode == REQUEST_ORDER_DETAILS_CODE) {
// //用戶對訂單進行了操作,需要對列表進行刷新
getOrderList();
}
}
......
......@@ -104,9 +104,9 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
}
}
@Override
public void shareThirdApp(String url, int type) {
ClipboardUtils.copyText(url);
if (type == Whatsapp) {
//分享到WhatsApp
DeviceUtils.shareWhatsApp(mContext, url);
......@@ -117,7 +117,6 @@ public class SendMsgFragment extends BaseSupplyChainFragment<SendMsgPresenter> i
DeviceUtils.shareLine(mContext, "", url);
} else if (type == Kakao_Talk) {
//分享到kakao
ClipboardUtils.copyText(url);
ToastUtils.show(mContext, "暫未開放此app發送,訂單已複製,請手動打開Kakao粘貼發送");
}
}
......
package com.gingersoft.supply_chain.mvp.ui.fragment.order;
import android.app.Dialog;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -10,9 +13,11 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
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.R2;
import com.gingersoft.supply_chain.di.component.DaggerShoppingCatComponent;
......@@ -54,6 +59,8 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
TextView tvOrderContentTotalAmount;
@BindView(R2.id.ed_order_content_remark)
EditText edOrderContentRemark;
@BindView(R2.id.tv_order_content_complete)
TextView tvConfirm;
private ShoppingCartAdapter shoppingCartAdapter;
/**
......@@ -64,6 +71,12 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
* 總金額
*/
private double totalAmount = 0;
/**
* 是否可以創建訂單按鈕的背景
*/
private Drawable canClick;
private Drawable notCanClick;
public static ShoppingCatFragment newInstance() {
ShoppingCatFragment fragment = new ShoppingCatFragment();
......@@ -89,6 +102,9 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
public void initData(@Nullable Bundle savedInstanceState) {
initTopBar(topBar, "採購單");
mPresenter.organizeShopCartData();
canClick = ContextCompat.getDrawable(requireContext(), R.drawable.shape_app_btn);
notCanClick = ContextCompat.getDrawable(requireContext(), R.drawable.shape_btn_unclick);
cbOrderContentAllSelect.setOnCheckedChangeListener((buttonView, isChecked) -> {
//全選
if (buttonView.isPressed()) {
......@@ -105,7 +121,12 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
int viewId = v.getId();
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) {
//訂單模板
......@@ -122,18 +143,20 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
public void loadAdapter(List<ShoppingCartBean> shoppingCartBeans) {
shoppingCartAdapter = new ShoppingCartAdapter(mContext, shoppingCartBeans);
shoppingCartAdapter.setOnFoodDeleteListener((supplierIndex, foodListVosBean) -> {
//刪除食品之後,這個供應商下面沒有食材才會調用這裡
//從購物車元數據移除掉這個食材
SupplyShoppingCart.getInstance().getCartFoods().remove(foodListVosBean);
List<ShoppingCartBean> shoppingCartAdapterData = shoppingCartAdapter.getData();
//購物車adapter移除這個供應商
if (shoppingCartAdapterData.get(supplierIndex).getFoodList().size() <= 0) {
shoppingCartAdapter.removeAt(supplierIndex);
if (foodListVosBean.isChecked()) {
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);
}
//購物車adapter移除這個供應商
shoppingCartAdapter.removeAt(supplierIndex);
}
setAllSelect(shoppingCartAdapterData);
mPresenter.verificationMixAmount(shoppingCartAdapter.getData());
});
rvOrderContent.setAdapter(shoppingCartAdapter);
setAllSelect(shoppingCartBeans);
......@@ -144,6 +167,7 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
setTotalInfo(totalSpecies, totalAmount);
//這裡應該可以再加一個回調接口,用來專門處理食材的選中狀態切換
setAllSelect(shoppingCartAdapter.getData());
mPresenter.verificationMixAmount(shoppingCartAdapter.getData());
});
}
......@@ -187,4 +211,10 @@ public class ShoppingCatFragment extends BaseSupplyChainFragment<ShoppingCatPres
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
//刪除供應商
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> {
dialog.dismiss();
supplierBean.setDeletes(Constant.DELETE);
mPresenter.updateSupplier();
mPresenter.deleteSupplier(supplierBean.getId());
});
} else if (viewId == R.id.btn_save_supplier) {
//保存
......
......@@ -225,7 +225,7 @@ public class SupplierListFragment extends BaseSupplyChainFragment<SupplierListPr
new AppDialog().showWaringDialog(mContext, "刪除供應商", (view1, dialog) -> {
dialog.dismiss();
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) {
//跳轉到供應商食品詳情
......
......@@ -14,6 +14,9 @@ import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
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.ErrorCallback;
import com.gingersoft.supply_chain.R;
......@@ -178,19 +181,20 @@ public class WareHouseListFragment extends BaseSupplyChainFragment<WareHouseList
} else {
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) {
warehousingQueryAdapter = new WarehousingQueryAdapter(mContext, purchaseWarehousingOrderDetailsVos);
rvWarehouseList.setLayoutManager(new LinearLayoutManager(mContext));
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 {
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;
import android.text.InputFilter;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
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.lxj.xpopup.impl.ConfirmPopupView;
import com.lxj.xpopup.impl.InputConfirmPopupView;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
/**
* @author 宇航.
......@@ -22,23 +26,37 @@ import com.lxj.xpopup.impl.InputConfirmPopupView;
public class CategoryPopup extends ConfirmPopupView {
private boolean showDelete;
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);
setTitleContent(title, content, hint);
this.showDelete = showDelete;
this.inputText = inputText;
}
@Override
protected void onCreate() {
super.onCreate();
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.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() {
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);
}
}
}
}
......@@ -29,7 +29,18 @@
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
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>
<include layout="@layout/include_horizontal_color_eee_dividing_line" />
......@@ -39,8 +50,8 @@
android:id="@+id/tv_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginLeft="@dimen/new_category_dialog_marginLeft"
android:layout_marginTop="@dimen/dp_20"
android:text="種類名稱"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" />
......@@ -50,11 +61,11 @@
style="@style/Multi_Input_editStyle"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginRight="@dimen/new_category_dialog_marginLeft"
android:background="@null"
android:gravity="left|center_vertical"
android:hint="請輸入類別名稱"
android:layout_marginTop="@dimen/dp_5"
android:maxLength="4"
android:paddingLeft="@dimen/new_category_dialog_marginLeft"
android:paddingRight="@dimen/new_category_dialog_marginLeft"
......@@ -72,30 +83,31 @@
android:layout_marginBottom="@dimen/dp_20"
android:orientation="horizontal">
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_cancel"
android:id="@+id/tv_confirm"
style="@style/Save_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/new_category_dialog_marginLeft"
android:layout_marginRight="@dimen/dp_7"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/new_category_dialog_marginLeft"
android:layout_weight="1"
android:background="@drawable/shape_red_seven_radius_bg"
android:paddingTop="@dimen/dp_13"
android:paddingBottom="@dimen/dp_13"
android:text="刪除" />
android:text="確定" />
<com.qmuiteam.qmui.alpha.QMUIAlphaTextView
android:id="@+id/tv_confirm"
style="@style/Save_Btn_Style"
android:id="@+id/tv_cancel"
style="@style/Cancel_Btn_Style"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_7"
android:layout_marginRight="@dimen/new_category_dialog_marginLeft"
android:layout_marginLeft="@dimen/new_category_dialog_marginLeft"
android:layout_marginRight="@dimen/dp_7"
android:layout_weight="1"
android:background="@drawable/shape_3c_cancel_btn_bg"
android:paddingTop="@dimen/dp_13"
android:paddingBottom="@dimen/dp_13"
android:text="確定" />
android:text="取消" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
......@@ -146,6 +146,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_weight="1"
android:background="@drawable/shape_app_btn"
android:gravity="center"
android:paddingLeft="@dimen/dp_35"
android:paddingTop="@dimen/dp_10"
......
<?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
......@@ -24,10 +24,12 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/black"
android:textSize="@dimen/dp_17"
android:textStyle="bold"
tools:text="供應商名稱" />
tools:text="供應商名稱是會計法還是得會計法離開時點擊分類手機的三代機傅雷家書水電費is地方水電費刻錄機" />
<TextView
android:id="@+id/btn_receiver_goods"
......
......@@ -20,27 +20,28 @@
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/dp_10"
android:paddingBottom="@dimen/dp_10">
android:paddingTop="@dimen/dp_6"
android:paddingBottom="@dimen/dp_9">
<CheckBox
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_marginLeft="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_12"
android:button="@drawable/selector_checkbox"
android:textColor="@color/black"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
android:textSize="@dimen/dp_16"
tools:text="海鮮天地" />
<TextView
android:id="@+id/tv_minimumAmount"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginRight="@dimen/dp_15"
android:layout_weight="1"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:layout_weight="4"
android:textSize="@dimen/dp_14"
android:gravity="right"
android:text="@string/minimumAmount"
android:textColor="@color/required_color" />
......@@ -59,24 +60,23 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|right"
android:orientation="horizontal"
android:paddingLeft="@dimen/dp_15"
android:paddingTop="@dimen/dp_10"
android:paddingRight="@dimen/dp_15">
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginTop="@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:textColor="@color/color_222"
android:textSize="@dimen/dp_14"
android:textStyle="bold" />
android:textSize="@dimen/dp_15" />
<TextView
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_weight="1"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_14"
android:textStyle="bold"
......@@ -85,17 +85,61 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginLeft="@dimen/dp_5"
android:gravity="right"
android:text="總計:"
android:text="總\u3000\u3000計:"
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:textStyle="bold" />
<TextView
android:id="@+id/tv_order_item_total_amount"
android:layout_width="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:textSize="@dimen/dp_14"
android:textStyle="bold"
......@@ -103,11 +147,47 @@
</LinearLayout>
<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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_5"
android:layout_marginRight="@dimen/dp_5"
android:layout_marginBottom="@dimen/dp_5"
android:text="未滿足該供應商最低採購金額,請繼續添加食材"
android:textColor="@color/required_color"
android:textSize="@dimen/dp_12" />
......@@ -117,6 +197,6 @@
android:id="@+id/item_purchase_shopping_parent_layout"
android:layout_width="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>
......@@ -53,10 +53,6 @@
</LinearLayout>
<!-- <include-->
<!-- android:id="@+id/line_supplier_info"-->
<!-- layout="@layout/include_horizontal_color_eee_dividing_line" />-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -68,21 +64,21 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dp_15"
android:layout_marginLeft="@dimen/dp_6"
android:button="@drawable/selector_checkbox"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_14" />
<LinearLayout
android:layout_width="@dimen/dp_84"
android:layout_width="@dimen/dp_88"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_5"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_food_ingredient_img"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_84" />
android:layout_height="@dimen/dp_88"
android:scaleType="fitXY" />
<TextView
android:layout_width="wrap_content"
......@@ -91,13 +87,14 @@
android:layout_marginTop="@dimen/dp_4"
android:textColor="@color/color_3c"
android:textSize="@dimen/dp_12"
android:visibility="gone"
tools:text="15/30" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_8"
android:layout_marginLeft="@dimen/dp_6"
android:orientation="vertical">
<LinearLayout
......@@ -116,6 +113,7 @@
<ImageView
android:id="@+id/iv_order_food_delete"
android:layout_width="wrap_content"
android:layout_marginRight="@dimen/dp_5"
android:layout_height="match_parent"
android:src="@drawable/ic_red_delete" />
</LinearLayout>
......@@ -125,7 +123,6 @@
style="@style/Food_Ingredient_Info_TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
tools:text="巴西肥牛" />
<LinearLayout
......@@ -161,7 +158,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
......@@ -182,6 +179,7 @@
android:id="@+id/layout_operation_food_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_5"
android:gravity="center_vertical"
android:orientation="horizontal">
......@@ -195,13 +193,11 @@
android:id="@+id/ed_food_ingredient_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginRight="@dimen/dp_10"
android:background="@null"
android:inputType="number"
android:maxLength="4"
android:paddingLeft="@dimen/dp_4"
android:paddingRight="@dimen/dp_4"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:text="10"
android:textColor="@color/black"
android:textSize="@dimen/dp_22" />
......
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